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