ppc4xx.h 4.4 KB

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