gemini.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * arch/ppc/platforms/gemini.h
  3. *
  4. *
  5. * Onboard registers and descriptions for Synergy Microsystems'
  6. * "Gemini" boards.
  7. *
  8. */
  9. #ifdef __KERNEL__
  10. #ifndef __PPC_GEMINI_H
  11. #define __PPC_GEMINI_H
  12. /* Registers */
  13. #define GEMINI_SERIAL_B (0xffeffb00)
  14. #define GEMINI_SERIAL_A (0xffeffb08)
  15. #define GEMINI_USWITCH (0xffeffd00)
  16. #define GEMINI_BREV (0xffeffe00)
  17. #define GEMINI_BECO (0xffeffe08)
  18. #define GEMINI_FEAT (0xffeffe10)
  19. #define GEMINI_BSTAT (0xffeffe18)
  20. #define GEMINI_CPUSTAT (0xffeffe20)
  21. #define GEMINI_L2CFG (0xffeffe30)
  22. #define GEMINI_MEMCFG (0xffeffe38)
  23. #define GEMINI_FLROM (0xffeffe40)
  24. #define GEMINI_P0PCI (0xffeffe48)
  25. #define GEMINI_FLWIN (0xffeffe50)
  26. #define GEMINI_P0INTMASK (0xffeffe60)
  27. #define GEMINI_P0INTAP (0xffeffe68)
  28. #define GEMINI_PCIERR (0xffeffe70)
  29. #define GEMINI_LEDBASE (0xffeffe80)
  30. #define GEMINI_RTC (0xffe9fff8)
  31. #define GEMINI_LEDS 8
  32. #define GEMINI_SWITCHES 8
  33. /* Flash ROM bit definitions */
  34. #define GEMINI_FLS_WEN (1<<0)
  35. #define GEMINI_FLS_JMP (1<<6)
  36. #define GEMINI_FLS_BOOT (1<<7)
  37. /* Memory bit definitions */
  38. #define GEMINI_MEM_TYPE_MASK 0xc0
  39. #define GEMINI_MEM_SIZE_MASK 0x38
  40. #define GEMINI_MEM_BANK_MASK 0x07
  41. /* L2 cache bit definitions */
  42. #define GEMINI_L2_SIZE_MASK 0xc0
  43. #define GEMINI_L2_RATIO_MASK 0x03
  44. /* Timebase register bit definitons */
  45. #define GEMINI_TIMEB0_EN (1<<0)
  46. #define GEMINI_TIMEB1_EN (1<<1)
  47. #define GEMINI_TIMEB2_EN (1<<2)
  48. #define GEMINI_TIMEB3_EN (1<<3)
  49. /* CPU status bit definitions */
  50. #define GEMINI_CPU_ID_MASK 0x03
  51. #define GEMINI_CPU_COUNT_MASK 0x0c
  52. #define GEMINI_CPU0_HALTED (1<<4)
  53. #define GEMINI_CPU1_HALTED (1<<5)
  54. #define GEMINI_CPU2_HALTED (1<<6)
  55. #define GEMINI_CPU3_HALTED (1<<7)
  56. /* Board status bit definitions */
  57. #define GEMINI_BRD_FAIL (1<<0) /* FAIL led is lit */
  58. #define GEMINI_BRD_BUS_MASK 0x0c /* PowerPC bus speed */
  59. /* Board family/feature bit descriptions */
  60. #define GEMINI_FEAT_HAS_FLASH (1<<0)
  61. #define GEMINI_FEAT_HAS_ETH (1<<1)
  62. #define GEMINI_FEAT_HAS_SCSI (1<<2)
  63. #define GEMINI_FEAT_HAS_P0 (1<<3)
  64. #define GEMINI_FEAT_FAM_MASK 0xf0
  65. /* Mod/ECO bit definitions */
  66. #define GEMINI_ECO_LEVEL_MASK 0x0f
  67. #define GEMINI_MOD_MASK 0xf0
  68. /* Type/revision bit definitions */
  69. #define GEMINI_REV_MASK 0x0f
  70. #define GEMINI_TYPE_MASK 0xf0
  71. /* User switch definitions */
  72. #define GEMINI_SWITCH_VERBOSE 1 /* adds "debug" to boot cmd line */
  73. #define GEMINI_SWITCH_SINGLE_USER 7 /* boots into "single-user" mode */
  74. #define SGS_RTC_CONTROL 0
  75. #define SGS_RTC_SECONDS 1
  76. #define SGS_RTC_MINUTES 2
  77. #define SGS_RTC_HOURS 3
  78. #define SGS_RTC_DAY 4
  79. #define SGS_RTC_DAY_OF_MONTH 5
  80. #define SGS_RTC_MONTH 6
  81. #define SGS_RTC_YEAR 7
  82. #define SGS_RTC_SET 0x80
  83. #define SGS_RTC_IS_STOPPED 0x80
  84. #define GRACKLE_CONFIG_ADDR_ADDR (0xfec00000)
  85. #define GRACKLE_CONFIG_DATA_ADDR (0xfee00000)
  86. #define GEMINI_BOOT_INIT (0xfff00100)
  87. #ifndef __ASSEMBLY__
  88. static inline void grackle_write( unsigned long addr, unsigned long data )
  89. {
  90. __asm__ __volatile__(
  91. " stwbrx %1, 0, %0\n \
  92. sync\n \
  93. stwbrx %3, 0, %2\n \
  94. sync "
  95. : /* no output */
  96. : "r" (GRACKLE_CONFIG_ADDR_ADDR), "r" (addr),
  97. "r" (GRACKLE_CONFIG_DATA_ADDR), "r" (data));
  98. }
  99. static inline unsigned long grackle_read( unsigned long addr )
  100. {
  101. unsigned long val;
  102. __asm__ __volatile__(
  103. " stwbrx %1, 0, %2\n \
  104. sync\n \
  105. lwbrx %0, 0, %3\n \
  106. sync "
  107. : "=r" (val)
  108. : "r" (addr), "r" (GRACKLE_CONFIG_ADDR_ADDR),
  109. "r" (GRACKLE_CONFIG_DATA_ADDR));
  110. return val;
  111. }
  112. static inline void gemini_led_on( int led )
  113. {
  114. if (led >= 0 && led < GEMINI_LEDS)
  115. *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 1;
  116. }
  117. static inline void gemini_led_off(int led)
  118. {
  119. if (led >= 0 && led < GEMINI_LEDS)
  120. *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 0;
  121. }
  122. static inline int gemini_led_val(int led)
  123. {
  124. int val = 0;
  125. if (led >= 0 && led < GEMINI_LEDS)
  126. val = *(unsigned char *)(GEMINI_LEDBASE + (led<<3));
  127. return (val & 0x1);
  128. }
  129. /* returns processor id from the board */
  130. static inline int gemini_processor(void)
  131. {
  132. unsigned char cpu = *(unsigned char *)(GEMINI_CPUSTAT);
  133. return (int) ((cpu == 0) ? 4 : (cpu & GEMINI_CPU_ID_MASK));
  134. }
  135. extern void _gemini_reboot(void);
  136. extern void gemini_prom_init(void);
  137. extern void gemini_init_l2(void);
  138. #endif /* __ASSEMBLY__ */
  139. #endif
  140. #endif /* __KERNEL__ */