ppc4xx.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*----------------------------------------------------------------------------+
  2. |
  3. | This source code has been made available to you by IBM on an AS-IS
  4. | basis. Anyone receiving this source is licensed under IBM
  5. | copyrights to use it in any way he or she deems fit, including
  6. | copying it, modifying it, compiling it, and redistributing it either
  7. | with or without modifications. No license under IBM patents or
  8. | patent applications is to be implied by the copyright license.
  9. |
  10. | Any user of this software should understand that IBM cannot provide
  11. | technical support for this software and will not be responsible for
  12. | any consequences resulting from the use of this software.
  13. |
  14. | Any person who transfers this source code or any derivative work
  15. | must include the IBM copyright notice, this paragraph, and the
  16. | preceding two paragraphs in the transferred software.
  17. |
  18. | COPYRIGHT I B M CORPORATION 1999
  19. | LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
  20. +----------------------------------------------------------------------------*/
  21. #ifndef __PPC4XX_H__
  22. #define __PPC4XX_H__
  23. /*
  24. * Configure which SDRAM/DDR/DDR2 controller is equipped
  25. */
  26. #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
  27. defined(CONFIG_AP1000) || defined(CONFIG_ML2)
  28. #define CONFIG_SDRAM_PPC4xx_IBM_SDRAM /* IBM SDRAM controller */
  29. #endif
  30. #if defined(CONFIG_440GP) || defined(CONFIG_440GX) || \
  31. defined(CONFIG_440EP) || defined(CONFIG_440GR)
  32. #define CONFIG_SDRAM_PPC4xx_IBM_DDR /* IBM DDR controller */
  33. #endif
  34. #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  35. #define CONFIG_SDRAM_PPC4xx_DENALI_DDR2 /* Denali DDR(2) controller */
  36. #endif
  37. #if defined(CONFIG_405EX) || \
  38. defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
  39. defined(CONFIG_460EX) || defined(CONFIG_460GT)
  40. #define CONFIG_SDRAM_PPC4xx_IBM_DDR2 /* IBM DDR(2) controller */
  41. #endif
  42. #if defined(CONFIG_440)
  43. /*
  44. * Enable long long (%ll ...) printf format on 440 PPC's since most of
  45. * them support 36bit physical addressing
  46. */
  47. #define CFG_64BIT_VSPRINTF
  48. #define CFG_64BIT_STRTOUL
  49. #include <ppc440.h>
  50. #else
  51. #include <ppc405.h>
  52. #endif
  53. #include <asm/ppc4xx-sdram.h>
  54. /*
  55. * Macro for generating register field mnemonics
  56. */
  57. #define PPC_REG_BITS 32
  58. #define PPC_REG_VAL(bit, value) ((value) << ((PPC_REG_BITS - 1) - (bit)))
  59. /*
  60. * Elide casts when assembling register mnemonics
  61. */
  62. #ifndef __ASSEMBLY__
  63. #define static_cast(type, val) (type)(val)
  64. #else
  65. #define static_cast(type, val) (val)
  66. #endif
  67. /*
  68. * Common stuff for 4xx (405 and 440)
  69. */
  70. #define EXC_OFF_SYS_RESET 0x0100 /* System reset */
  71. #define _START_OFFSET (EXC_OFF_SYS_RESET + 0x2000)
  72. #define RESET_VECTOR 0xfffffffc
  73. #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
  74. line aligned data. */
  75. #define CPR0_DCR_BASE 0x0C
  76. #define cprcfga (CPR0_DCR_BASE+0x0)
  77. #define cprcfgd (CPR0_DCR_BASE+0x1)
  78. #define SDR_DCR_BASE 0x0E
  79. #define sdrcfga (SDR_DCR_BASE+0x0)
  80. #define sdrcfgd (SDR_DCR_BASE+0x1)
  81. #define SDRAM_DCR_BASE 0x10
  82. #define memcfga (SDRAM_DCR_BASE+0x0)
  83. #define memcfgd (SDRAM_DCR_BASE+0x1)
  84. #define EBC_DCR_BASE 0x12
  85. #define ebccfga (EBC_DCR_BASE+0x0)
  86. #define ebccfgd (EBC_DCR_BASE+0x1)
  87. /*
  88. * Macros for indirect DCR access
  89. */
  90. #define mtcpr(reg, d) do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,d); } while (0)
  91. #define mfcpr(reg, d) do { mtdcr(cprcfga,reg);d = mfdcr(cprcfgd); } while (0)
  92. #define mtebc(reg, d) do { mtdcr(ebccfga,reg);mtdcr(ebccfgd,d); } while (0)
  93. #define mfebc(reg, d) do { mtdcr(ebccfga,reg);d = mfdcr(ebccfgd); } while (0)
  94. #define mtsdram(reg, d) do { mtdcr(memcfga,reg);mtdcr(memcfgd,d); } while (0)
  95. #define mfsdram(reg, d) do { mtdcr(memcfga,reg);d = mfdcr(memcfgd); } while (0)
  96. #define mtsdr(reg, d) do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,d); } while (0)
  97. #define mfsdr(reg, d) do { mtdcr(sdrcfga,reg);d = mfdcr(sdrcfgd); } while (0)
  98. #ifndef __ASSEMBLY__
  99. typedef struct
  100. {
  101. unsigned long freqDDR;
  102. unsigned long freqEBC;
  103. unsigned long freqOPB;
  104. unsigned long freqPCI;
  105. unsigned long freqPLB;
  106. unsigned long freqTmrClk;
  107. unsigned long freqUART;
  108. unsigned long freqProcessor;
  109. unsigned long freqVCOHz;
  110. unsigned long freqVCOMhz; /* in MHz */
  111. unsigned long pciClkSync; /* PCI clock is synchronous */
  112. unsigned long pciIntArbEn; /* Internal PCI arbiter is enabled */
  113. unsigned long pllExtBusDiv;
  114. unsigned long pllFbkDiv;
  115. unsigned long pllFwdDiv;
  116. unsigned long pllFwdDivA;
  117. unsigned long pllFwdDivB;
  118. unsigned long pllOpbDiv;
  119. unsigned long pllPciDiv;
  120. unsigned long pllPlbDiv;
  121. } PPC4xx_SYS_INFO;
  122. #endif /* __ASSEMBLY__ */
  123. #endif /* __PPC4XX_H__ */