tag_omap.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2011-2012
  4. * Pali Rohár <pali@kernel.org>
  5. *
  6. * (C) Copyright 2011
  7. * marcel@mesa.nl, Mesa Consulting B.V.
  8. *
  9. * (C) Copyright 2004-2005
  10. * Nokia Corporation
  11. */
  12. /*
  13. * Code copied from maemo kernel 2.6.28 file
  14. * arch/arm/plat-omap/include/mach/board.h
  15. *
  16. * Information structures for board-specific data
  17. *
  18. * Copyright (C) 2004 Nokia Corporation
  19. * Written by Juha Yrjölä <juha.yrjola@nokia.com>
  20. */
  21. /* Different peripheral ids */
  22. #define OMAP_TAG_CLOCK 0x4f01
  23. #define OMAP_TAG_SERIAL_CONSOLE 0x4f03
  24. #define OMAP_TAG_USB 0x4f04
  25. #define OMAP_TAG_LCD 0x4f05
  26. #define OMAP_TAG_GPIO_SWITCH 0x4f06
  27. #define OMAP_TAG_UART 0x4f07
  28. #define OMAP_TAG_FBMEM 0x4f08
  29. #define OMAP_TAG_STI_CONSOLE 0x4f09
  30. #define OMAP_TAG_CAMERA_SENSOR 0x4f0a
  31. #define OMAP_TAG_PARTITION 0x4f0b
  32. #define OMAP_TAG_TEA5761 0x4f10
  33. #define OMAP_TAG_TMP105 0x4f11
  34. #define OMAP_TAG_BOOT_REASON 0x4f80
  35. #define OMAP_TAG_FLASH_PART_STR 0x4f81
  36. #define OMAP_TAG_VERSION_STR 0x4f82
  37. #define OMAP_TAG_NOKIA_BT 0x4e01
  38. #define OMAP_TAG_WLAN_CX3110X 0x4e02
  39. #define OMAP_TAG_CBUS 0x4e03
  40. #define OMAP_TAG_EM_ASIC_BB5 0x4e04
  41. struct omap_clock_config {
  42. /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */
  43. u8 system_clock_type;
  44. };
  45. struct omap_serial_console_config {
  46. u8 console_uart;
  47. u32 console_speed;
  48. };
  49. struct omap_sti_console_config {
  50. unsigned enable:1;
  51. u8 channel;
  52. };
  53. struct omap_usb_config {
  54. /* Configure drivers according to the connectors on your board:
  55. * - "A" connector (rectagular)
  56. * ... for host/OHCI use, set "register_host".
  57. * - "B" connector (squarish) or "Mini-B"
  58. * ... for device/gadget use, set "register_dev".
  59. * - "Mini-AB" connector (very similar to Mini-B)
  60. * ... for OTG use as device OR host, initialize "otg"
  61. */
  62. unsigned register_host:1;
  63. unsigned register_dev:1;
  64. u8 otg; /* port number, 1-based: usb1 == 2 */
  65. u8 hmc_mode;
  66. /* implicitly true if otg: host supports remote wakeup? */
  67. u8 rwc;
  68. /* signaling pins used to talk to transceiver on usbN:
  69. * 0 == usbN unused
  70. * 2 == usb0-only, using internal transceiver
  71. * 3 == 3 wire bidirectional
  72. * 4 == 4 wire bidirectional
  73. * 6 == 6 wire unidirectional (or TLL)
  74. */
  75. u8 pins[3];
  76. };
  77. struct omap_lcd_config {
  78. char panel_name[16];
  79. char ctrl_name[16];
  80. s16 nreset_gpio;
  81. u8 data_lines;
  82. };
  83. struct omap_fbmem_config {
  84. u32 start;
  85. u32 size;
  86. };
  87. struct omap_gpio_switch_config {
  88. char name[12];
  89. u16 gpio;
  90. u8 flags:4;
  91. u8 type:4;
  92. unsigned int key_code:24; /* Linux key code */
  93. };
  94. struct omap_uart_config {
  95. /* Bit field of UARTs present; bit 0 --> UART1 */
  96. unsigned int enabled_uarts;
  97. };
  98. struct omap_tea5761_config {
  99. u16 enable_gpio;
  100. };
  101. struct omap_partition_config {
  102. char name[16];
  103. unsigned int size;
  104. unsigned int offset;
  105. /* same as in include/linux/mtd/partitions.h */
  106. unsigned int mask_flags;
  107. };
  108. struct omap_flash_part_str_config {
  109. char part_table[0];
  110. };
  111. struct omap_boot_reason_config {
  112. char reason_str[12];
  113. };
  114. struct omap_version_config {
  115. char component[12];
  116. char version[12];
  117. };
  118. /*
  119. * Code copied from maemo kernel 2.6.28 file
  120. * arch/arm/plat-omap/include/mach/board-nokia.h
  121. *
  122. * Information structures for Nokia-specific board config data
  123. *
  124. * Copyright (C) 2005 Nokia Corporation
  125. */
  126. struct omap_bluetooth_config {
  127. u8 chip_type;
  128. u8 bt_wakeup_gpio;
  129. u8 host_wakeup_gpio;
  130. u8 reset_gpio;
  131. u8 bt_uart;
  132. u8 bd_addr[6];
  133. u8 bt_sysclk;
  134. };
  135. struct omap_wlan_cx3110x_config {
  136. u8 chip_type;
  137. u8 reserverd;
  138. s16 power_gpio;
  139. s16 irq_gpio;
  140. s16 spi_cs_gpio;
  141. };
  142. struct omap_cbus_config {
  143. s16 clk_gpio;
  144. s16 dat_gpio;
  145. s16 sel_gpio;
  146. };
  147. struct omap_em_asic_bb5_config {
  148. s16 retu_irq_gpio;
  149. s16 tahvo_irq_gpio;
  150. };
  151. /*
  152. * omap_tag handling
  153. *
  154. * processing omap tag structures
  155. *
  156. * Copyright (C) 2011 marcel@mesa.nl, Mesa Consulting B.V.
  157. * Copyright (C) 2012 Pali Rohár <pali@kernel.org>
  158. */
  159. /* TI OMAP specific information */
  160. #define ATAG_BOARD 0x414f4d50
  161. struct tag_omap_header {
  162. u16 tag;
  163. u16 size;
  164. };
  165. struct tag_omap {
  166. struct tag_omap_header hdr;
  167. union {
  168. struct omap_clock_config clock;
  169. struct omap_serial_console_config serial_console;
  170. struct omap_sti_console_config sti_console;
  171. struct omap_usb_config usb;
  172. struct omap_lcd_config lcd;
  173. struct omap_fbmem_config fbmem;
  174. struct omap_gpio_switch_config gpio_switch;
  175. struct omap_uart_config uart;
  176. struct omap_tea5761_config tea5761;
  177. struct omap_partition_config partition;
  178. struct omap_flash_part_str_config flash_part_str;
  179. struct omap_boot_reason_config boot_reason;
  180. struct omap_version_config version;
  181. struct omap_bluetooth_config bluetooth;
  182. struct omap_wlan_cx3110x_config wlan_cx3110x;
  183. struct omap_cbus_config cbus;
  184. struct omap_em_asic_bb5_config em_asic_bb5;
  185. } u;
  186. };
  187. #define tag_omap_next(t) ((struct tag_omap *)((u8 *)(t) + \
  188. (t)->hdr.size + sizeof(struct tag_omap_header)))
  189. #define OMAP_TAG_HEADER_CONFIG(config, type) \
  190. .hdr.tag = config, \
  191. .hdr.size = sizeof(struct type)
  192. #define OMAP_TAG_UART_CONFIG(p1) \
  193. { \
  194. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_UART, omap_uart_config), \
  195. .u.uart.enabled_uarts = p1, \
  196. }
  197. #define OMAP_TAG_SERIAL_CONSOLE_CONFIG(p1, p2) \
  198. { \
  199. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_SERIAL_CONSOLE, \
  200. omap_serial_console_config), \
  201. .u.serial_console.console_uart = p1, \
  202. .u.serial_console.console_speed = p2, \
  203. }
  204. #define OMAP_TAG_LCD_CONFIG(p1, p2, p3, p4) \
  205. { \
  206. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_LCD, omap_lcd_config), \
  207. .u.lcd.panel_name = p1, \
  208. .u.lcd.ctrl_name = p2, \
  209. .u.lcd.nreset_gpio = p3, \
  210. .u.lcd.data_lines = p4, \
  211. }
  212. #define OMAP_TAG_GPIO_SWITCH_CONFIG(p1, p2, p3, p4, p5) \
  213. { \
  214. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_GPIO_SWITCH, \
  215. omap_gpio_switch_config), \
  216. .u.gpio_switch.name = p1, \
  217. .u.gpio_switch.gpio = p2, \
  218. .u.gpio_switch.flags = p3, \
  219. .u.gpio_switch.type = p4, \
  220. .u.gpio_switch.key_code = p5, \
  221. }
  222. #define OMAP_TAG_WLAN_CX3110X_CONFIG(p1, p2, p3, p4, p5) \
  223. { \
  224. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_WLAN_CX3110X, \
  225. omap_wlan_cx3110x_config), \
  226. .u.wlan_cx3110x.chip_type = p1, \
  227. .u.wlan_cx3110x.reserverd = p2, \
  228. .u.wlan_cx3110x.power_gpio = p3, \
  229. .u.wlan_cx3110x.irq_gpio = p4, \
  230. .u.wlan_cx3110x.spi_cs_gpio = p5, \
  231. }
  232. #define OMAP_TAG_PARTITION_CONFIG(p1, p2, p3, p4) \
  233. { \
  234. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_PARTITION, \
  235. omap_partition_config), \
  236. .u.partition.name = p1, \
  237. .u.partition.size = p2, \
  238. .u.partition.offset = p3, \
  239. .u.partition.mask_flags = p4, \
  240. }
  241. #define OMAP_TAG_BOOT_REASON_CONFIG(p1) \
  242. { \
  243. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_BOOT_REASON, \
  244. omap_boot_reason_config), \
  245. .u.boot_reason.reason_str = p1, \
  246. }
  247. #define OMAP_TAG_VERSION_STR_CONFIG(p1, p2) \
  248. { \
  249. OMAP_TAG_HEADER_CONFIG(OMAP_TAG_VERSION_STR, \
  250. omap_version_config), \
  251. .u.version.component = p1, \
  252. .u.version.version = p2, \
  253. }