cacheinit.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2004-2007 Analog Devices Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, see the file COPYING, or write
  16. * to the Free Software Foundation, Inc.,
  17. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <linux/cpu.h>
  20. #include <asm/cacheflush.h>
  21. #include <asm/blackfin.h>
  22. #include <asm/cplb.h>
  23. #include <asm/cplbinit.h>
  24. #if defined(CONFIG_BFIN_ICACHE)
  25. void __init bfin_icache_init(void)
  26. {
  27. unsigned long ctrl;
  28. int i;
  29. SSYNC();
  30. for (i = 0; i < MAX_CPLBS; i++) {
  31. bfin_write32(ICPLB_ADDR0 + i * 4, icplb_tbl[i].addr);
  32. bfin_write32(ICPLB_DATA0 + i * 4, icplb_tbl[i].data);
  33. }
  34. ctrl = bfin_read_IMEM_CONTROL();
  35. ctrl |= IMC | ENICPLB;
  36. bfin_write_IMEM_CONTROL(ctrl);
  37. SSYNC();
  38. }
  39. #endif
  40. #if defined(CONFIG_BFIN_DCACHE)
  41. void __init bfin_dcache_init(void)
  42. {
  43. unsigned long ctrl;
  44. int i;
  45. SSYNC();
  46. for (i = 0; i < MAX_CPLBS; i++) {
  47. bfin_write32(DCPLB_ADDR0 + i * 4, dcplb_tbl[i].addr);
  48. bfin_write32(DCPLB_DATA0 + i * 4, dcplb_tbl[i].data);
  49. }
  50. ctrl = bfin_read_DMEM_CONTROL();
  51. ctrl |= DMEM_CNTR;
  52. bfin_write_DMEM_CONTROL(ctrl);
  53. SSYNC();
  54. }
  55. #endif