mb-regs.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /* mb-regs.h: motherboard registers
  2. *
  3. * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_MB_REGS_H
  12. #define _ASM_MB_REGS_H
  13. #include <asm/cpu-irqs.h>
  14. #include <asm/sections.h>
  15. #include <asm/mem-layout.h>
  16. #ifndef __ASSEMBLY__
  17. /* gcc builtins, annotated */
  18. unsigned long __builtin_read8(volatile void __iomem *);
  19. unsigned long __builtin_read16(volatile void __iomem *);
  20. unsigned long __builtin_read32(volatile void __iomem *);
  21. void __builtin_write8(volatile void __iomem *, unsigned char);
  22. void __builtin_write16(volatile void __iomem *, unsigned short);
  23. void __builtin_write32(volatile void __iomem *, unsigned long);
  24. #endif
  25. #define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable
  26. * protection laid over the top for use in memory-mapped
  27. * I/O
  28. */
  29. #define __region_CS0 0xff000000 /* Boot ROMs area */
  30. #ifdef CONFIG_MB93091_VDK
  31. /*
  32. * VDK motherboard and CPU card specific stuff
  33. */
  34. #include <asm/mb93091-fpga-irqs.h>
  35. #define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0
  36. #define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1
  37. #define __region_CS2 0xe0000000 /* SLBUS/PCI I/O space */
  38. #define __region_CS2_M 0x0fffffff /* mask */
  39. #define __region_CS2_C 0x00000000 /* control */
  40. #define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */
  41. #define __region_CS5_M 0x00ffffff
  42. #define __region_CS5_C 0x00010000
  43. #define __region_CS7 0xf1000000 /* CB70 CPU-card PCMCIA port I/O space */
  44. #define __region_CS7_M 0x00ffffff
  45. #define __region_CS7_C 0x00410701
  46. #define __region_CS1 0xfc000000 /* SLBUS/PCI bridge control registers */
  47. #define __region_CS1_M 0x000fffff
  48. #define __region_CS1_C 0x00000000
  49. #define __region_CS6 0xfc100000 /* CB70 CPU-card DM9000 LAN I/O space */
  50. #define __region_CS6_M 0x000fffff
  51. #define __region_CS6_C 0x00400707
  52. #define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */
  53. #define __region_CS3_M 0x000fffff
  54. #define __region_CS3_C 0xc8100000
  55. #define __region_CS4 0xfd000000 /* CB70 CPU-card extra flash space */
  56. #define __region_CS4_M 0x00ffffff
  57. #define __region_CS4_C 0x00000f07
  58. #define __region_PCI_IO (__region_CS2 + 0x04000000UL)
  59. #define __region_PCI_MEM (__region_CS2 + 0x08000000UL)
  60. #define __flush_PCI_writes() \
  61. do { \
  62. __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \
  63. } while(0)
  64. #define __is_PCI_IO(addr) \
  65. (((unsigned long)(addr) >> 24) - (__region_PCI_IO >> 24) < (0x04000000UL >> 24))
  66. #define __is_PCI_MEM(addr) \
  67. ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL)
  68. #define __is_PCI_addr(addr) \
  69. ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL)
  70. #define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; })
  71. #define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U)
  72. #ifndef __ASSEMBLY__
  73. extern int __nongprelbss mb93090_mb00_detected;
  74. #endif
  75. #define __addr_LEDS() (__region_CS2 + 0x01200004UL)
  76. #ifdef CONFIG_MB93090_MB00
  77. #define __set_LEDS(X) \
  78. do { \
  79. if (mb93090_mb00_detected) \
  80. __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \
  81. } while (0)
  82. #else
  83. #define __set_LEDS(X)
  84. #endif
  85. #define __addr_LCD() (__region_CS2 + 0x01200008UL)
  86. #define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B))
  87. #define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X))
  88. #define LCD_D 0x000000ff /* LCD data bus */
  89. #define LCD_RW 0x00000100 /* LCD R/W signal */
  90. #define LCD_RS 0x00000200 /* LCD Register Select */
  91. #define LCD_E 0x00000400 /* LCD Start Enable Signal */
  92. #define LCD_CMD_CLEAR (LCD_E|0x001)
  93. #define LCD_CMD_HOME (LCD_E|0x002)
  94. #define LCD_CMD_CURSOR_INC (LCD_E|0x004)
  95. #define LCD_CMD_SCROLL_INC (LCD_E|0x005)
  96. #define LCD_CMD_CURSOR_DEC (LCD_E|0x006)
  97. #define LCD_CMD_SCROLL_DEC (LCD_E|0x007)
  98. #define LCD_CMD_OFF (LCD_E|0x008)
  99. #define LCD_CMD_ON(CRSR,BLINK) (LCD_E|0x00c|(CRSR<<1)|BLINK)
  100. #define LCD_CMD_CURSOR_MOVE_L (LCD_E|0x010)
  101. #define LCD_CMD_CURSOR_MOVE_R (LCD_E|0x014)
  102. #define LCD_CMD_DISPLAY_SHIFT_L (LCD_E|0x018)
  103. #define LCD_CMD_DISPLAY_SHIFT_R (LCD_E|0x01c)
  104. #define LCD_CMD_FUNCSET(DL,N,F) (LCD_E|0x020|(DL<<4)|(N<<3)|(F<<2))
  105. #define LCD_CMD_SET_CG_ADDR(X) (LCD_E|0x040|X)
  106. #define LCD_CMD_SET_DD_ADDR(X) (LCD_E|0x080|X)
  107. #define LCD_CMD_READ_BUSY (LCD_E|LCD_RW)
  108. #define LCD_DATA_WRITE(X) (LCD_E|LCD_RS|(X))
  109. #define LCD_DATA_READ (LCD_E|LCD_RS|LCD_RW)
  110. #else
  111. /*
  112. * PDK unit specific stuff
  113. */
  114. #include <asm/mb93093-fpga-irqs.h>
  115. #define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0
  116. #define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1
  117. #define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */
  118. #define __region_CS5_M 0x00ffffff /* mask */
  119. #define __region_CS5_C 0x00010000 /* control */
  120. #define __region_CS2 0x20000000 /* FPGA registers */
  121. #define __region_CS2_M 0x000fffff
  122. #define __region_CS2_C 0x00000000
  123. #define __region_CS1 0xfc100000 /* LAN registers */
  124. #define __region_CS1_M 0x000fffff
  125. #define __region_CS1_C 0x00010404
  126. #define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */
  127. #define __region_CS3_M 0x000fffff
  128. #define __region_CS3_C 0xc8000000
  129. #define __region_CS4 0xfd000000 /* extra ROMs area */
  130. #define __region_CS4_M 0x00ffffff
  131. #define __region_CS4_C 0x00000f07
  132. #define __region_CS6 0xfe000000 /* not used - hide behind CPU resource I/O regs */
  133. #define __region_CS6_M 0x000fffff
  134. #define __region_CS6_C 0x00000f07
  135. #define __region_CS7 0xfe000000 /* not used - hide behind CPU resource I/O regs */
  136. #define __region_CS7_M 0x000fffff
  137. #define __region_CS7_C 0x00000f07
  138. #define __is_PCI_IO(addr) 0 /* no PCI */
  139. #define __is_PCI_MEM(addr) 0
  140. #define __is_PCI_addr(addr) 0
  141. #define __region_PCI_IO 0
  142. #define __region_PCI_MEM 0
  143. #define __flush_PCI_writes() do { } while(0)
  144. #define __get_CLKSW() 0UL
  145. #define __get_CLKIN() 66000000UL
  146. #define __addr_LEDS() (__region_CS2 + 0x00000023UL)
  147. #define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X))
  148. #define __addr_FPGATR() (__region_CS2 + 0x00000030UL)
  149. #define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X))
  150. #define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR())
  151. #define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003
  152. #define __set_FPGATR_AUDIO_CLK(V) \
  153. __set_FPGATR((__get_FPGATR() & ~MB93093_FPGA_FPGATR_AUDIO_CLK) | (V))
  154. #define MB93093_FPGA_FPGATR_AUDIO_CLK_OFF 0x0
  155. #define MB93093_FPGA_FPGATR_AUDIO_CLK_11MHz 0x1
  156. #define MB93093_FPGA_FPGATR_AUDIO_CLK_12MHz 0x2
  157. #define MB93093_FPGA_FPGATR_AUDIO_CLK_02MHz 0x3
  158. #define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26)
  159. #define MB93093_FPGA_SWR_PUSHSW4 (1<<29)
  160. #define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL))
  161. #define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK)
  162. #endif
  163. #endif /* _ASM_MB_REGS_H */