gemini.h 4.3 KB

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