cplbinit.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * File: include/asm-blackfin/cplbinit.h
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #ifndef __ASM_CPLBINIT_H__
  30. #define __ASM_CPLBINIT_H__
  31. #include <asm/blackfin.h>
  32. #include <asm/cplb.h>
  33. #ifdef CONFIG_MPU
  34. #include <asm/cplb-mpu.h>
  35. extern void bfin_icache_init(struct cplb_entry *icplb_tbl);
  36. extern void bfin_dcache_init(struct cplb_entry *icplb_tbl);
  37. #else
  38. #define INITIAL_T 0x1
  39. #define SWITCH_T 0x2
  40. #define I_CPLB 0x4
  41. #define D_CPLB 0x8
  42. #define ASYNC_MEMORY_CPLB_COVERAGE ((ASYNC_BANK0_SIZE + ASYNC_BANK1_SIZE + \
  43. ASYNC_BANK2_SIZE + ASYNC_BANK3_SIZE) / SIZE_4M)
  44. #define CPLB_MEM CONFIG_MAX_MEM_SIZE
  45. /*
  46. * Number of required data CPLB switchtable entries
  47. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  48. * approx 16 for smaller 1MB page size CPLBs for allignment purposes
  49. * 1 for L1 Data Memory
  50. * possibly 1 for L2 Data Memory
  51. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  52. * 1 for ASYNC Memory
  53. */
  54. #define MAX_SWITCH_D_CPLBS (((CPLB_MEM / 4) + 16 + 1 + 1 + 1 \
  55. + ASYNC_MEMORY_CPLB_COVERAGE) * 2)
  56. /*
  57. * Number of required instruction CPLB switchtable entries
  58. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  59. * approx 12 for smaller 1MB page size CPLBs for allignment purposes
  60. * 1 for L1 Instruction Memory
  61. * possibly 1 for L2 Instruction Memory
  62. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  63. */
  64. #define MAX_SWITCH_I_CPLBS (((CPLB_MEM / 4) + 12 + 1 + 1 + 1) * 2)
  65. /* Number of CPLB table entries, used for cplb-nompu. */
  66. #define CPLB_TBL_ENTRIES (16 * 4)
  67. enum {
  68. ZERO_P, L1I_MEM, L1D_MEM, L2_MEM, SDRAM_KERN, SDRAM_RAM_MTD, SDRAM_DMAZ,
  69. RES_MEM, ASYNC_MEM, OCB_ROM
  70. };
  71. struct cplb_desc {
  72. u32 start; /* start address */
  73. u32 end; /* end address */
  74. u32 psize; /* prefered size if any otherwise 1MB or 4MB*/
  75. u16 attr;/* attributes */
  76. u16 i_conf;/* I-CPLB DATA */
  77. u16 d_conf;/* D-CPLB DATA */
  78. u16 valid;/* valid */
  79. const s8 name[30];/* name */
  80. };
  81. struct cplb_tab {
  82. u_long *tab;
  83. u16 pos;
  84. u16 size;
  85. };
  86. extern u_long icplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
  87. extern u_long dcplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
  88. /* Till here we are discussing about the static memory management model.
  89. * However, the operating envoronments commonly define more CPLB
  90. * descriptors to cover the entire addressable memory than will fit into
  91. * the available on-chip 16 CPLB MMRs. When this happens, the below table
  92. * will be used which will hold all the potentially required CPLB descriptors
  93. *
  94. * This is how Page descriptor Table is implemented in uClinux/Blackfin.
  95. */
  96. extern u_long ipdt_tables[NR_CPUS][MAX_SWITCH_I_CPLBS+1];
  97. extern u_long dpdt_tables[NR_CPUS][MAX_SWITCH_D_CPLBS+1];
  98. #ifdef CONFIG_CPLB_INFO
  99. extern u_long ipdt_swapcount_tables[NR_CPUS][MAX_SWITCH_I_CPLBS];
  100. extern u_long dpdt_swapcount_tables[NR_CPUS][MAX_SWITCH_D_CPLBS];
  101. #endif
  102. extern void bfin_icache_init(u_long icplbs[]);
  103. extern void bfin_dcache_init(u_long dcplbs[]);
  104. #endif /* CONFIG_MPU */
  105. #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
  106. extern void generate_cplb_tables_cpu(unsigned int cpu);
  107. #endif
  108. #endif