Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Hardware definitions for Compaq iPAQ H3xxx Handheld Computers |
| 3 | * |
| 4 | * Copyright 2000,1 Compaq Computer Corporation. |
| 5 | * |
| 6 | * Use consistent with the GNU GPL is permitted, |
| 7 | * provided that this copyright notice is |
| 8 | * preserved in its entirety in all copies and derived works. |
| 9 | * |
| 10 | * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED, |
| 11 | * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS |
| 12 | * FITNESS FOR ANY PARTICULAR PURPOSE. |
| 13 | * |
| 14 | * Author: Jamey Hicks. |
| 15 | * |
| 16 | * History: |
| 17 | * |
| 18 | * 2001-10-?? Andrew Christian Added support for iPAQ H3800 |
| 19 | * and abstracted EGPIO interface. |
| 20 | * |
| 21 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/module.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/kernel.h> |
| 25 | #include <linux/tty.h> |
| 26 | #include <linux/pm.h> |
| 27 | #include <linux/device.h> |
| 28 | #include <linux/mtd/mtd.h> |
| 29 | #include <linux/mtd/partitions.h> |
| 30 | #include <linux/serial_core.h> |
Russell King | 0831e3e | 2009-10-06 14:35:16 +0100 | [diff] [blame^] | 31 | #include <linux/gpio.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | #include <asm/irq.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 34 | #include <mach/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/setup.h> |
| 37 | |
| 38 | #include <asm/mach/irq.h> |
| 39 | #include <asm/mach/arch.h> |
| 40 | #include <asm/mach/flash.h> |
| 41 | #include <asm/mach/irda.h> |
| 42 | #include <asm/mach/map.h> |
| 43 | #include <asm/mach/serial_sa1100.h> |
| 44 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | #include <mach/h3600.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 46 | #include <mach/h3600_gpio.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #include "generic.h" |
| 49 | |
Dmitry Artamonow | 607b067 | 2009-03-15 19:14:27 +0100 | [diff] [blame] | 50 | void (*assign_h3600_egpio)(enum ipaq_egpio_type x, int level); |
| 51 | EXPORT_SYMBOL(assign_h3600_egpio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Russell King | 0831e3e | 2009-10-06 14:35:16 +0100 | [diff] [blame^] | 53 | struct gpio_default_state { |
| 54 | int gpio; |
| 55 | int mode; |
| 56 | const char *name; |
| 57 | }; |
| 58 | |
| 59 | #define GPIO_MODE_IN -1 |
| 60 | #define GPIO_MODE_OUT0 0 |
| 61 | #define GPIO_MODE_OUT1 1 |
| 62 | |
| 63 | static void h3xxx_init_gpio(struct gpio_default_state *s, size_t n) |
| 64 | { |
| 65 | while (n--) { |
| 66 | const char *name = s->name; |
| 67 | int err; |
| 68 | |
| 69 | if (!name) |
| 70 | name = "[init]"; |
| 71 | err = gpio_request(s->gpio, name); |
| 72 | if (err) { |
| 73 | printk(KERN_ERR "gpio%u: unable to request: %d\n", |
| 74 | s->gpio, err); |
| 75 | continue; |
| 76 | } |
| 77 | if (s->mode >= 0) { |
| 78 | err = gpio_direction_output(s->gpio, s->mode); |
| 79 | } else { |
| 80 | err = gpio_direction_input(s->gpio); |
| 81 | } |
| 82 | if (err) { |
| 83 | printk(KERN_ERR "gpio%u: unable to set direction: %d\n", |
| 84 | s->gpio, err); |
| 85 | continue; |
| 86 | } |
| 87 | if (!s->name) |
| 88 | gpio_free(s->gpio); |
| 89 | s++; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | static struct mtd_partition h3xxx_partitions[] = { |
| 95 | { |
| 96 | .name = "H3XXX boot firmware", |
| 97 | .size = 0x00040000, |
| 98 | .offset = 0, |
| 99 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 100 | }, { |
Dmitry Artamonow | f110b3f | 2009-03-15 19:09:50 +0100 | [diff] [blame] | 101 | .name = "H3XXX rootfs", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | .size = MTDPART_SIZ_FULL, |
| 103 | .offset = 0x00040000, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | } |
| 105 | }; |
| 106 | |
| 107 | static void h3xxx_set_vpp(int vpp) |
| 108 | { |
| 109 | assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp); |
| 110 | } |
| 111 | |
| 112 | static struct flash_platform_data h3xxx_flash_data = { |
| 113 | .map_name = "cfi_probe", |
| 114 | .set_vpp = h3xxx_set_vpp, |
| 115 | .parts = h3xxx_partitions, |
| 116 | .nr_parts = ARRAY_SIZE(h3xxx_partitions), |
| 117 | }; |
| 118 | |
| 119 | static struct resource h3xxx_flash_resource = { |
| 120 | .start = SA1100_CS0_PHYS, |
| 121 | .end = SA1100_CS0_PHYS + SZ_32M - 1, |
| 122 | .flags = IORESOURCE_MEM, |
| 123 | }; |
| 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | static void h3xxx_mach_init(void) |
| 126 | { |
Russell King | 7a5b4e1 | 2009-10-06 14:55:53 +0100 | [diff] [blame] | 127 | sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | /* |
| 131 | * low-level UART features |
| 132 | */ |
| 133 | |
| 134 | static void h3600_uart_set_mctrl(struct uart_port *port, u_int mctrl) |
| 135 | { |
| 136 | if (port->mapbase == _Ser3UTCR0) { |
| 137 | if (mctrl & TIOCM_RTS) |
| 138 | GPCR = GPIO_H3600_COM_RTS; |
| 139 | else |
| 140 | GPSR = GPIO_H3600_COM_RTS; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | static u_int h3600_uart_get_mctrl(struct uart_port *port) |
| 145 | { |
| 146 | u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR; |
| 147 | |
| 148 | if (port->mapbase == _Ser3UTCR0) { |
| 149 | int gplr = GPLR; |
| 150 | /* DCD and CTS bits are inverted in GPLR by RS232 transceiver */ |
| 151 | if (gplr & GPIO_H3600_COM_DCD) |
| 152 | ret &= ~TIOCM_CD; |
| 153 | if (gplr & GPIO_H3600_COM_CTS) |
| 154 | ret &= ~TIOCM_CTS; |
| 155 | } |
| 156 | |
| 157 | return ret; |
| 158 | } |
| 159 | |
| 160 | static void h3600_uart_pm(struct uart_port *port, u_int state, u_int oldstate) |
| 161 | { |
| 162 | if (port->mapbase == _Ser2UTCR0) { /* TODO: REMOVE THIS */ |
| 163 | assign_h3600_egpio(IPAQ_EGPIO_IR_ON, !state); |
| 164 | } else if (port->mapbase == _Ser3UTCR0) { |
| 165 | assign_h3600_egpio(IPAQ_EGPIO_RS232_ON, !state); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /* |
| 170 | * Enable/Disable wake up events for this serial port. |
| 171 | * Obviously, we only support this on the normal COM port. |
| 172 | */ |
| 173 | static int h3600_uart_set_wake(struct uart_port *port, u_int enable) |
| 174 | { |
| 175 | int err = -EINVAL; |
| 176 | |
| 177 | if (port->mapbase == _Ser3UTCR0) { |
| 178 | if (enable) |
| 179 | PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */ |
| 180 | else |
| 181 | PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */ |
| 182 | err = 0; |
| 183 | } |
| 184 | return err; |
| 185 | } |
| 186 | |
| 187 | static struct sa1100_port_fns h3600_port_fns __initdata = { |
| 188 | .set_mctrl = h3600_uart_set_mctrl, |
| 189 | .get_mctrl = h3600_uart_get_mctrl, |
| 190 | .pm = h3600_uart_pm, |
| 191 | .set_wake = h3600_uart_set_wake, |
| 192 | }; |
| 193 | |
| 194 | /* |
| 195 | * helper for sa1100fb |
| 196 | */ |
| 197 | static void h3xxx_lcd_power(int enable) |
| 198 | { |
| 199 | assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable); |
| 200 | } |
| 201 | |
| 202 | static struct map_desc h3600_io_desc[] __initdata = { |
Deepak Saxena | 92519d8 | 2005-10-28 15:19:04 +0100 | [diff] [blame] | 203 | { /* static memory bank 2 CS#2 */ |
| 204 | .virtual = H3600_BANK_2_VIRT, |
| 205 | .pfn = __phys_to_pfn(SA1100_CS2_PHYS), |
| 206 | .length = 0x02800000, |
| 207 | .type = MT_DEVICE |
| 208 | }, { /* static memory bank 4 CS#4 */ |
| 209 | .virtual = H3600_BANK_4_VIRT, |
| 210 | .pfn = __phys_to_pfn(SA1100_CS4_PHYS), |
| 211 | .length = 0x00800000, |
| 212 | .type = MT_DEVICE |
| 213 | }, { /* EGPIO 0 CS#5 */ |
| 214 | .virtual = H3600_EGPIO_VIRT, |
| 215 | .pfn = __phys_to_pfn(H3600_EGPIO_PHYS), |
| 216 | .length = 0x01000000, |
| 217 | .type = MT_DEVICE |
| 218 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | /* |
| 222 | * Common map_io initialization |
| 223 | */ |
| 224 | |
| 225 | static void __init h3xxx_map_io(void) |
| 226 | { |
| 227 | sa1100_map_io(); |
| 228 | iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc)); |
| 229 | |
| 230 | sa1100_register_uart_fns(&h3600_port_fns); |
| 231 | sa1100_register_uart(0, 3); /* Common serial port */ |
| 232 | // sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */ |
| 233 | |
| 234 | /* Ensure those pins are outputs and driving low */ |
| 235 | PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM; |
| 236 | PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM); |
| 237 | |
| 238 | /* Configure suspend conditions */ |
| 239 | PGSR = 0; |
| 240 | PWER = PWER_GPIO0 | PWER_RTC; |
| 241 | PCFR = PCFR_OPDE; |
| 242 | PSDR = 0; |
| 243 | |
| 244 | sa1100fb_lcd_power = h3xxx_lcd_power; |
| 245 | } |
| 246 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | /************************* H3100 *************************/ |
| 248 | |
| 249 | #ifdef CONFIG_SA1100_H3100 |
| 250 | |
| 251 | #define H3100_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT) |
| 252 | static unsigned int h3100_egpio = 0; |
| 253 | |
| 254 | static void h3100_control_egpio(enum ipaq_egpio_type x, int setp) |
| 255 | { |
| 256 | unsigned int egpio = 0; |
| 257 | long gpio = 0; |
| 258 | unsigned long flags; |
| 259 | |
| 260 | switch (x) { |
| 261 | case IPAQ_EGPIO_LCD_POWER: |
| 262 | egpio |= EGPIO_H3600_LCD_ON; |
| 263 | gpio |= GPIO_H3100_LCD_3V_ON; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | break; |
| 265 | case IPAQ_EGPIO_LCD_ENABLE: |
| 266 | break; |
| 267 | case IPAQ_EGPIO_CODEC_NRESET: |
| 268 | egpio |= EGPIO_H3600_CODEC_NRESET; |
| 269 | break; |
| 270 | case IPAQ_EGPIO_AUDIO_ON: |
| 271 | gpio |= GPIO_H3100_AUD_PWR_ON |
| 272 | | GPIO_H3100_AUD_ON; |
| 273 | break; |
| 274 | case IPAQ_EGPIO_QMUTE: |
| 275 | gpio |= GPIO_H3100_QMUTE; |
| 276 | break; |
| 277 | case IPAQ_EGPIO_OPT_NVRAM_ON: |
| 278 | egpio |= EGPIO_H3600_OPT_NVRAM_ON; |
| 279 | break; |
| 280 | case IPAQ_EGPIO_OPT_ON: |
| 281 | egpio |= EGPIO_H3600_OPT_ON; |
| 282 | break; |
| 283 | case IPAQ_EGPIO_CARD_RESET: |
| 284 | egpio |= EGPIO_H3600_CARD_RESET; |
| 285 | break; |
| 286 | case IPAQ_EGPIO_OPT_RESET: |
| 287 | egpio |= EGPIO_H3600_OPT_RESET; |
| 288 | break; |
| 289 | case IPAQ_EGPIO_IR_ON: |
| 290 | gpio |= GPIO_H3100_IR_ON; |
| 291 | break; |
| 292 | case IPAQ_EGPIO_IR_FSEL: |
| 293 | gpio |= GPIO_H3100_IR_FSEL; |
| 294 | break; |
| 295 | case IPAQ_EGPIO_RS232_ON: |
| 296 | egpio |= EGPIO_H3600_RS232_ON; |
| 297 | break; |
| 298 | case IPAQ_EGPIO_VPP_ON: |
| 299 | egpio |= EGPIO_H3600_VPP_ON; |
| 300 | break; |
| 301 | } |
| 302 | |
| 303 | if (egpio || gpio) { |
| 304 | local_irq_save(flags); |
| 305 | if (setp) { |
| 306 | h3100_egpio |= egpio; |
| 307 | GPSR = gpio; |
| 308 | } else { |
| 309 | h3100_egpio &= ~egpio; |
| 310 | GPCR = gpio; |
| 311 | } |
| 312 | H3100_EGPIO = h3100_egpio; |
| 313 | local_irq_restore(flags); |
| 314 | } |
| 315 | } |
| 316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | #define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \ |
| 318 | | GPIO_H3100_GPIO3 \ |
| 319 | | GPIO_H3100_QMUTE \ |
| 320 | | GPIO_H3100_LCD_3V_ON \ |
| 321 | | GPIO_H3100_AUD_ON \ |
| 322 | | GPIO_H3100_AUD_PWR_ON \ |
| 323 | | GPIO_H3100_IR_ON \ |
| 324 | | GPIO_H3100_IR_FSEL) |
| 325 | |
| 326 | static void __init h3100_map_io(void) |
| 327 | { |
| 328 | h3xxx_map_io(); |
| 329 | |
| 330 | /* Initialize h3100-specific values here */ |
| 331 | GPCR = 0x0fffffff; /* All outputs are set low by default */ |
| 332 | GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK | |
| 333 | GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA | |
| 334 | GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 | |
| 335 | H3100_DIRECT_EGPIO; |
| 336 | |
| 337 | /* Older bootldrs put GPIO2-9 in alternate mode on the |
| 338 | assumption that they are used for video */ |
| 339 | GAFR &= ~H3100_DIRECT_EGPIO; |
| 340 | |
| 341 | H3100_EGPIO = h3100_egpio; |
Dmitry Artamonow | 607b067 | 2009-03-15 19:14:27 +0100 | [diff] [blame] | 342 | assign_h3600_egpio = h3100_control_egpio; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | } |
| 344 | |
Russell King | a5d176a | 2009-10-06 14:22:23 +0100 | [diff] [blame] | 345 | /* |
| 346 | * This turns the IRDA power on or off on the Compaq H3100 |
| 347 | */ |
| 348 | static int h3100_irda_set_power(struct device *dev, unsigned int state) |
| 349 | { |
| 350 | assign_h3100_egpio(IPAQ_EGPIO_IR_ON, state); |
| 351 | |
| 352 | return 0; |
| 353 | } |
| 354 | |
| 355 | static void h3100_irda_set_speed(struct device *dev, unsigned int speed) |
| 356 | { |
| 357 | assign_h3100_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000)); |
| 358 | } |
| 359 | |
| 360 | static struct irda_platform_data h3100_irda_data = { |
| 361 | .set_power = h3100_irda_set_power, |
| 362 | .set_speed = h3100_irda_set_speed, |
| 363 | }; |
| 364 | |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 365 | static void h3100_mach_init(void) |
| 366 | { |
| 367 | h3xxx_mach_init(); |
Russell King | a5d176a | 2009-10-06 14:22:23 +0100 | [diff] [blame] | 368 | sa11x0_register_irda(&h3100_irda_data); |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 369 | } |
| 370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 372 | .phys_io = 0x80000000, |
| 373 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
| 374 | .boot_params = 0xc0000100, |
| 375 | .map_io = h3100_map_io, |
| 376 | .init_irq = sa1100_init_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | .timer = &sa1100_timer, |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 378 | .init_machine = h3100_mach_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | MACHINE_END |
| 380 | |
| 381 | #endif /* CONFIG_SA1100_H3100 */ |
| 382 | |
| 383 | /************************* H3600 *************************/ |
| 384 | |
| 385 | #ifdef CONFIG_SA1100_H3600 |
| 386 | |
| 387 | #define H3600_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT) |
| 388 | static unsigned int h3600_egpio = EGPIO_H3600_RS232_ON; |
| 389 | |
| 390 | static void h3600_control_egpio(enum ipaq_egpio_type x, int setp) |
| 391 | { |
| 392 | unsigned int egpio = 0; |
| 393 | unsigned long flags; |
| 394 | |
| 395 | switch (x) { |
| 396 | case IPAQ_EGPIO_LCD_POWER: |
| 397 | egpio |= EGPIO_H3600_LCD_ON | |
| 398 | EGPIO_H3600_LCD_PCI | |
| 399 | EGPIO_H3600_LCD_5V_ON | |
| 400 | EGPIO_H3600_LVDD_ON; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | break; |
| 402 | case IPAQ_EGPIO_LCD_ENABLE: |
| 403 | break; |
| 404 | case IPAQ_EGPIO_CODEC_NRESET: |
| 405 | egpio |= EGPIO_H3600_CODEC_NRESET; |
| 406 | break; |
| 407 | case IPAQ_EGPIO_AUDIO_ON: |
| 408 | egpio |= EGPIO_H3600_AUD_AMP_ON | |
| 409 | EGPIO_H3600_AUD_PWR_ON; |
| 410 | break; |
| 411 | case IPAQ_EGPIO_QMUTE: |
| 412 | egpio |= EGPIO_H3600_QMUTE; |
| 413 | break; |
| 414 | case IPAQ_EGPIO_OPT_NVRAM_ON: |
| 415 | egpio |= EGPIO_H3600_OPT_NVRAM_ON; |
| 416 | break; |
| 417 | case IPAQ_EGPIO_OPT_ON: |
| 418 | egpio |= EGPIO_H3600_OPT_ON; |
| 419 | break; |
| 420 | case IPAQ_EGPIO_CARD_RESET: |
| 421 | egpio |= EGPIO_H3600_CARD_RESET; |
| 422 | break; |
| 423 | case IPAQ_EGPIO_OPT_RESET: |
| 424 | egpio |= EGPIO_H3600_OPT_RESET; |
| 425 | break; |
| 426 | case IPAQ_EGPIO_IR_ON: |
| 427 | egpio |= EGPIO_H3600_IR_ON; |
| 428 | break; |
| 429 | case IPAQ_EGPIO_IR_FSEL: |
| 430 | egpio |= EGPIO_H3600_IR_FSEL; |
| 431 | break; |
| 432 | case IPAQ_EGPIO_RS232_ON: |
| 433 | egpio |= EGPIO_H3600_RS232_ON; |
| 434 | break; |
| 435 | case IPAQ_EGPIO_VPP_ON: |
| 436 | egpio |= EGPIO_H3600_VPP_ON; |
| 437 | break; |
| 438 | } |
| 439 | |
| 440 | if (egpio) { |
| 441 | local_irq_save(flags); |
| 442 | if (setp) |
| 443 | h3600_egpio |= egpio; |
| 444 | else |
| 445 | h3600_egpio &= ~egpio; |
| 446 | H3600_EGPIO = h3600_egpio; |
| 447 | local_irq_restore(flags); |
| 448 | } |
| 449 | } |
| 450 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | static void __init h3600_map_io(void) |
| 452 | { |
| 453 | h3xxx_map_io(); |
| 454 | |
| 455 | /* Initialize h3600-specific values here */ |
| 456 | |
| 457 | GPCR = 0x0fffffff; /* All outputs are set low by default */ |
| 458 | GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK | |
| 459 | GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA | |
| 460 | GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 | |
| 461 | GPIO_LDD15 | GPIO_LDD14 | GPIO_LDD13 | GPIO_LDD12 | |
| 462 | GPIO_LDD11 | GPIO_LDD10 | GPIO_LDD9 | GPIO_LDD8; |
| 463 | |
| 464 | H3600_EGPIO = h3600_egpio; /* Maintains across sleep? */ |
Dmitry Artamonow | 607b067 | 2009-03-15 19:14:27 +0100 | [diff] [blame] | 465 | assign_h3600_egpio = h3600_control_egpio; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Russell King | a5d176a | 2009-10-06 14:22:23 +0100 | [diff] [blame] | 468 | /* |
| 469 | * This turns the IRDA power on or off on the Compaq H3600 |
| 470 | */ |
| 471 | static int h3600_irda_set_power(struct device *dev, unsigned int state) |
| 472 | { |
| 473 | assign_h3600_egpio(IPAQ_EGPIO_IR_ON, state); |
| 474 | return 0; |
| 475 | } |
| 476 | |
| 477 | static void h3600_irda_set_speed(struct device *dev, unsigned int speed) |
| 478 | { |
| 479 | assign_h3600_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000)); |
| 480 | } |
| 481 | |
| 482 | static struct irda_platform_data h3600_irda_data = { |
| 483 | .set_power = h3600_irda_set_power, |
| 484 | .set_speed = h3600_irda_set_speed, |
| 485 | }; |
| 486 | |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 487 | static void h3600_mach_init(void) |
| 488 | { |
| 489 | h3xxx_mach_init(); |
Russell King | a5d176a | 2009-10-06 14:22:23 +0100 | [diff] [blame] | 490 | sa11x0_register_irda(&h3600_irda_data); |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 491 | } |
| 492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | MACHINE_START(H3600, "Compaq iPAQ H3600") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 494 | .phys_io = 0x80000000, |
| 495 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
| 496 | .boot_params = 0xc0000100, |
| 497 | .map_io = h3600_map_io, |
| 498 | .init_irq = sa1100_init_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | .timer = &sa1100_timer, |
Russell King | 898e810 | 2009-10-06 14:19:44 +0100 | [diff] [blame] | 500 | .init_machine = h3600_mach_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | MACHINE_END |
| 502 | |
| 503 | #endif /* CONFIG_SA1100_H3600 */ |
| 504 | |