Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [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 | */ |
| 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/mfd/htc-egpio.h> |
| 29 | #include <linux/mtd/mtd.h> |
| 30 | #include <linux/mtd/partitions.h> |
| 31 | #include <linux/serial_core.h> |
| 32 | #include <linux/gpio.h> |
| 33 | #include <linux/platform_device.h> |
| 34 | |
| 35 | #include <asm/irq.h> |
| 36 | #include <mach/hardware.h> |
| 37 | #include <asm/mach-types.h> |
| 38 | #include <asm/setup.h> |
| 39 | |
| 40 | #include <asm/mach/irq.h> |
| 41 | #include <asm/mach/arch.h> |
| 42 | #include <asm/mach/flash.h> |
| 43 | #include <asm/mach/irda.h> |
| 44 | #include <asm/mach/map.h> |
| 45 | #include <asm/mach/serial_sa1100.h> |
| 46 | |
| 47 | #include <mach/h3xxx.h> |
| 48 | |
| 49 | #include "generic.h" |
| 50 | |
| 51 | /* |
| 52 | * helper for sa1100fb |
| 53 | */ |
| 54 | static void h3100_lcd_power(int enable) |
| 55 | { |
| 56 | if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) { |
| 57 | gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); |
| 58 | gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); |
| 59 | gpio_free(H3XXX_EGPIO_LCD_ON); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | static void __init h3100_map_io(void) |
| 65 | { |
| 66 | h3xxx_map_io(); |
| 67 | |
| 68 | sa1100fb_lcd_power = h3100_lcd_power; |
| 69 | |
| 70 | /* Older bootldrs put GPIO2-9 in alternate mode on the |
| 71 | assumption that they are used for video */ |
| 72 | GAFR &= ~0x000001fb; |
| 73 | } |
| 74 | |
| 75 | /* |
| 76 | * This turns the IRDA power on or off on the Compaq H3100 |
| 77 | */ |
| 78 | static int h3100_irda_set_power(struct device *dev, unsigned int state) |
| 79 | { |
| 80 | gpio_set_value(H3100_GPIO_IR_ON, state); |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | static void h3100_irda_set_speed(struct device *dev, unsigned int speed) |
| 85 | { |
| 86 | gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); |
| 87 | } |
| 88 | |
| 89 | static struct irda_platform_data h3100_irda_data = { |
| 90 | .set_power = h3100_irda_set_power, |
| 91 | .set_speed = h3100_irda_set_speed, |
| 92 | }; |
| 93 | |
| 94 | static struct gpio_default_state h3100_default_gpio[] = { |
| 95 | { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" }, |
| 96 | { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" }, |
| 97 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, |
| 98 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, |
| 99 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, |
| 100 | { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" }, |
| 101 | }; |
| 102 | |
| 103 | static void __init h3100_mach_init(void) |
| 104 | { |
| 105 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); |
| 106 | h3xxx_mach_init(); |
| 107 | sa11x0_register_irda(&h3100_irda_data); |
| 108 | } |
| 109 | |
| 110 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
| 111 | .phys_io = 0x80000000, |
| 112 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
| 113 | .boot_params = 0xc0000100, |
| 114 | .map_io = h3100_map_io, |
| 115 | .init_irq = sa1100_init_irq, |
| 116 | .timer = &sa1100_timer, |
| 117 | .init_machine = h3100_mach_init, |
| 118 | MACHINE_END |
| 119 | |