rte_me2_cb.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * include/asm-v850/rte_me2_cb.h -- Midas labs RTE-V850E/ME2-CB board
  3. *
  4. * Copyright (C) 2001,02,03 NEC Corporation
  5. * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General
  8. * Public License. See the file COPYING in the main directory of this
  9. * archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #ifndef __V850_RTE_ME2_CB_H__
  14. #define __V850_RTE_ME2_CB_H__
  15. #include <asm/rte_cb.h> /* Common defs for Midas RTE-CB boards. */
  16. #define PLATFORM "rte-v850e/me2-cb"
  17. #define PLATFORM_LONG "Midas lab RTE-V850E/ME2-CB"
  18. #define CPU_CLOCK_FREQ 150000000 /* 150MHz */
  19. #define FIXED_BOGOMIPS 50
  20. /* 32MB of onbard SDRAM. */
  21. #define SDRAM_ADDR 0x00800000
  22. #define SDRAM_SIZE 0x02000000 /* 32MB */
  23. /* CPU addresses of GBUS memory spaces. */
  24. #define GCS0_ADDR 0x04000000 /* GCS0 - Common SRAM (2MB) */
  25. #define GCS0_SIZE 0x00800000 /* 8MB */
  26. #define GCS1_ADDR 0x04800000 /* GCS1 - Flash ROM (8MB) */
  27. #define GCS1_SIZE 0x00800000 /* 8MB */
  28. #define GCS2_ADDR 0x07000000 /* GCS2 - I/O registers */
  29. #define GCS2_SIZE 0x00800000 /* 8MB */
  30. #define GCS5_ADDR 0x08000000 /* GCS5 - PCI bus space */
  31. #define GCS5_SIZE 0x02000000 /* 32MB */
  32. #define GCS6_ADDR 0x07800000 /* GCS6 - PCI control registers */
  33. #define GCS6_SIZE 0x00800000 /* 8MB */
  34. /* For <asm/page.h> */
  35. #define PAGE_OFFSET SDRAM_ADDR
  36. #ifdef CONFIG_ROM_KERNEL
  37. /* Kernel is in ROM, starting at address 0. */
  38. #define INTV_BASE 0
  39. #define ROOT_FS_IMAGE_RW 0
  40. #else /* !CONFIG_ROM_KERNEL */
  41. /* Using RAM-kernel. Assume some sort of boot-loader got us loaded at
  42. address 0. */
  43. #define INTV_BASE 0
  44. #define ROOT_FS_IMAGE_RW 1
  45. #endif /* CONFIG_ROM_KERNEL */
  46. /* Some misc. on-board devices. */
  47. /* Seven-segment LED display (four digits). */
  48. #define LED_ADDR(n) (0x0FE02000 + (n))
  49. #define LED(n) (*(volatile unsigned char *)LED_ADDR(n))
  50. #define LED_NUM_DIGITS 4
  51. /* On-board PIC. */
  52. #define CB_PIC_BASE_ADDR 0x0FE04000
  53. #define CB_PIC_INT0M_ADDR (CB_PIC_BASE_ADDR + 0x00)
  54. #define CB_PIC_INT0M (*(volatile u16 *)CB_PIC_INT0M_ADDR)
  55. #define CB_PIC_INT1M_ADDR (CB_PIC_BASE_ADDR + 0x10)
  56. #define CB_PIC_INT1M (*(volatile u16 *)CB_PIC_INT1M_ADDR)
  57. #define CB_PIC_INTR_ADDR (CB_PIC_BASE_ADDR + 0x20)
  58. #define CB_PIC_INTR (*(volatile u16 *)CB_PIC_INTR_ADDR)
  59. #define CB_PIC_INTEN_ADDR (CB_PIC_BASE_ADDR + 0x30)
  60. #define CB_PIC_INTEN (*(volatile u16 *)CB_PIC_INTEN_ADDR)
  61. #define CB_PIC_INT0EN 0x0001
  62. #define CB_PIC_INT1EN 0x0002
  63. #define CB_PIC_INT0SEL 0x0080
  64. /* The PIC interrupts themselves. */
  65. #define CB_PIC_BASE_IRQ NUM_CPU_IRQS
  66. #define IRQ_CB_PIC_NUM 10
  67. /* Some specific CB_PIC interrupts. */
  68. #define IRQ_CB_EXTTM0 (CB_PIC_BASE_IRQ + 0)
  69. #define IRQ_CB_EXTSIO (CB_PIC_BASE_IRQ + 1)
  70. #define IRQ_CB_TOVER (CB_PIC_BASE_IRQ + 2)
  71. #define IRQ_CB_GINT0 (CB_PIC_BASE_IRQ + 3)
  72. #define IRQ_CB_USB (CB_PIC_BASE_IRQ + 4)
  73. #define IRQ_CB_LANC (CB_PIC_BASE_IRQ + 5)
  74. #define IRQ_CB_USB_VBUS_ON (CB_PIC_BASE_IRQ + 6)
  75. #define IRQ_CB_USB_VBUS_OFF (CB_PIC_BASE_IRQ + 7)
  76. #define IRQ_CB_EXTTM1 (CB_PIC_BASE_IRQ + 8)
  77. #define IRQ_CB_EXTTM2 (CB_PIC_BASE_IRQ + 9)
  78. /* The GBUS GINT1 - GINT3 (note, not GINT0!) interrupts are connected to
  79. the INTP65 - INTP67 pins on the CPU. These are shared among the GBUS
  80. interrupts. */
  81. #define IRQ_GINT(n) IRQ_INTP((n) + 9) /* 0 is unused! */
  82. #define IRQ_GINT_NUM 4 /* 0 is unused! */
  83. /* The shared interrupt line from the PIC is connected to CPU pin INTP23. */
  84. #define IRQ_CB_PIC IRQ_INTP(4) /* P23 */
  85. /* Used by <asm/rte_cb.h> to derive NUM_MACH_IRQS. */
  86. #define NUM_RTE_CB_IRQS (NUM_CPU_IRQS + IRQ_CB_PIC_NUM)
  87. #ifndef __ASSEMBLY__
  88. struct cb_pic_irq_init {
  89. const char *name; /* name of interrupt type */
  90. /* Range of kernel irq numbers for this type:
  91. BASE, BASE+INTERVAL, ..., BASE+INTERVAL*NUM */
  92. unsigned base, num, interval;
  93. unsigned priority; /* interrupt priority to assign */
  94. };
  95. struct hw_interrupt_type; /* fwd decl */
  96. /* Enable interrupt handling for interrupt IRQ. */
  97. extern void cb_pic_enable_irq (unsigned irq);
  98. /* Disable interrupt handling for interrupt IRQ. Note that any interrupts
  99. received while disabled will be delivered once the interrupt is enabled
  100. again, unless they are explicitly cleared using `cb_pic_clear_pending_irq'. */
  101. extern void cb_pic_disable_irq (unsigned irq);
  102. /* Initialize HW_IRQ_TYPES for PIC irqs described in array INITS (which is
  103. terminated by an entry with the name field == 0). */
  104. extern void cb_pic_init_irq_types (struct cb_pic_irq_init *inits,
  105. struct hw_interrupt_type *hw_irq_types);
  106. /* Initialize PIC interrupts. */
  107. extern void cb_pic_init_irqs (void);
  108. #endif /* __ASSEMBLY__ */
  109. /* TL16C550C on board UART see also asm/serial.h */
  110. #define CB_UART_BASE 0x0FE08000
  111. #define CB_UART_REG_GAP 0x10
  112. #define CB_UART_CLOCK 0x16000000
  113. /* CompactFlash setting */
  114. #define CB_CF_BASE 0x0FE0C000
  115. #define CB_CF_CCR_ADDR (CB_CF_BASE+0x200)
  116. #define CB_CF_CCR (*(volatile u8 *)CB_CF_CCR_ADDR)
  117. #define CB_CF_REG0_ADDR (CB_CF_BASE+0x1000)
  118. #define CB_CF_REG0 (*(volatile u16 *)CB_CF_REG0_ADDR)
  119. #define CB_CF_STS0_ADDR (CB_CF_BASE+0x1004)
  120. #define CB_CF_STS0 (*(volatile u16 *)CB_CF_STS0_ADDR)
  121. #define CB_PCATA_BASE (CB_CF_BASE+0x800)
  122. #define CB_IDE_BASE (CB_CF_BASE+0x9F0)
  123. #define CB_IDE_CTRL (CB_CF_BASE+0xBF6)
  124. #define CB_IDE_REG_OFFS 0x1
  125. /* SMSC LAN91C111 setting */
  126. #if defined(CONFIG_SMC91111)
  127. #define CB_LANC_BASE 0x0FE10300
  128. #define CONFIG_SMC16BITONLY
  129. #define ETH0_ADDR CB_LANC_BASE
  130. #define ETH0_IRQ IRQ_CB_LANC
  131. #endif /* CONFIG_SMC16BITONLY */
  132. #undef V850E_UART_PRE_CONFIGURE
  133. #define V850E_UART_PRE_CONFIGURE rte_me2_cb_uart_pre_configure
  134. #ifndef __ASSEMBLY__
  135. extern void rte_me2_cb_uart_pre_configure (unsigned chan,
  136. unsigned cflags, unsigned baud);
  137. #endif /* __ASSEMBLY__ */
  138. /* This board supports RTS/CTS for the on-chip UART, but only for channel 0. */
  139. /* CTS for UART channel 0 is pin P22 (bit 2 of port 2). */
  140. #define V850E_UART_CTS(chan) ((chan) == 0 ? !(ME2_PORT2_IO & 0x4) : 1)
  141. /* RTS for UART channel 0 is pin P21 (bit 1 of port 2). */
  142. #define V850E_UART_SET_RTS(chan, val) \
  143. do { \
  144. if (chan == 0) { \
  145. unsigned old = ME2_PORT2_IO; \
  146. if (val) \
  147. ME2_PORT2_IO = old & ~0x2; \
  148. else \
  149. ME2_PORT2_IO = old | 0x2; \
  150. } \
  151. } while (0)
  152. #ifndef __ASSEMBLY__
  153. extern void rte_me2_cb_init_irqs (void);
  154. #endif /* !__ASSEMBLY__ */
  155. #endif /* __V850_RTE_ME2_CB_H__ */