ppc4xx.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. defined(CONFIG_460SX)
  41. #define CONFIG_SDRAM_PPC4xx_IBM_DDR2 /* IBM DDR(2) controller */
  42. #endif
  43. #if defined(CONFIG_440)
  44. #include <ppc440.h>
  45. #else
  46. #include <ppc405.h>
  47. #endif
  48. #include <asm/ppc4xx-sdram.h>
  49. #include <asm/ppc4xx-ebc.h>
  50. #if !defined(CONFIG_XILINX_440)
  51. #include <asm/ppc4xx-uic.h>
  52. #endif
  53. /*
  54. * Macro for generating register field mnemonics
  55. */
  56. #define PPC_REG_BITS 32
  57. #define PPC_REG_VAL(bit, value) ((value) << ((PPC_REG_BITS - 1) - (bit)))
  58. /*
  59. * Elide casts when assembling register mnemonics
  60. */
  61. #ifndef __ASSEMBLY__
  62. #define static_cast(type, val) (type)(val)
  63. #else
  64. #define static_cast(type, val) (val)
  65. #endif
  66. /*
  67. * Common stuff for 4xx (405 and 440)
  68. */
  69. #define EXC_OFF_SYS_RESET 0x0100 /* System reset */
  70. #define _START_OFFSET (EXC_OFF_SYS_RESET + 0x2000)
  71. #define RESET_VECTOR 0xfffffffc
  72. #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
  73. line aligned data. */
  74. #define CPR0_DCR_BASE 0x0C
  75. #define cprcfga (CPR0_DCR_BASE+0x0)
  76. #define cprcfgd (CPR0_DCR_BASE+0x1)
  77. #define SDR_DCR_BASE 0x0E
  78. #define sdrcfga (SDR_DCR_BASE+0x0)
  79. #define sdrcfgd (SDR_DCR_BASE+0x1)
  80. #define SDRAM_DCR_BASE 0x10
  81. #define memcfga (SDRAM_DCR_BASE+0x0)
  82. #define memcfgd (SDRAM_DCR_BASE+0x1)
  83. #define EBC_DCR_BASE 0x12
  84. #define ebccfga (EBC_DCR_BASE+0x0)
  85. #define ebccfgd (EBC_DCR_BASE+0x1)
  86. /*
  87. * Macros for indirect DCR access
  88. */
  89. #define mtcpr(reg, d) do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,d); } while (0)
  90. #define mfcpr(reg, d) do { mtdcr(cprcfga,reg);d = mfdcr(cprcfgd); } while (0)
  91. #define mtebc(reg, d) do { mtdcr(ebccfga,reg);mtdcr(ebccfgd,d); } while (0)
  92. #define mfebc(reg, d) do { mtdcr(ebccfga,reg);d = mfdcr(ebccfgd); } while (0)
  93. #define mtsdram(reg, d) do { mtdcr(memcfga,reg);mtdcr(memcfgd,d); } while (0)
  94. #define mfsdram(reg, d) do { mtdcr(memcfga,reg);d = mfdcr(memcfgd); } while (0)
  95. #define mtsdr(reg, d) do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,d); } while (0)
  96. #define mfsdr(reg, d) do { mtdcr(sdrcfga,reg);d = mfdcr(sdrcfgd); } while (0)
  97. #ifndef __ASSEMBLY__
  98. typedef struct
  99. {
  100. unsigned long freqDDR;
  101. unsigned long freqEBC;
  102. unsigned long freqOPB;
  103. unsigned long freqPCI;
  104. unsigned long freqPLB;
  105. unsigned long freqTmrClk;
  106. unsigned long freqUART;
  107. unsigned long freqProcessor;
  108. unsigned long freqVCOHz;
  109. unsigned long freqVCOMhz; /* in MHz */
  110. unsigned long pciClkSync; /* PCI clock is synchronous */
  111. unsigned long pciIntArbEn; /* Internal PCI arbiter is enabled */
  112. unsigned long pllExtBusDiv;
  113. unsigned long pllFbkDiv;
  114. unsigned long pllFwdDiv;
  115. unsigned long pllFwdDivA;
  116. unsigned long pllFwdDivB;
  117. unsigned long pllOpbDiv;
  118. unsigned long pllPciDiv;
  119. unsigned long pllPlbDiv;
  120. } PPC4xx_SYS_INFO;
  121. #endif /* __ASSEMBLY__ */
  122. #endif /* __PPC4XX_H__ */