ppc4xx.h 3.6 KB

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