Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 1 | /* |
Dmitry Artamonow | 6e23fcb | 2009-11-27 12:11:48 +0100 | [diff] [blame] | 2 | * Support for Compaq iPAQ H3100 handheld computer |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 3 | * |
Dmitry Artamonow | 6e23fcb | 2009-11-27 12:11:48 +0100 | [diff] [blame] | 4 | * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks) |
| 5 | * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 6 | * |
Dmitry Artamonow | 6e23fcb | 2009-11-27 12:11:48 +0100 | [diff] [blame] | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 10 | * |
| 11 | */ |
Dmitry Artamonow | 6e23fcb | 2009-11-27 12:11:48 +0100 | [diff] [blame] | 12 | |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 13 | #include <linux/init.h> |
| 14 | #include <linux/kernel.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 15 | #include <linux/gpio.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 16 | |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 17 | #include <asm/mach-types.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 18 | #include <asm/mach/arch.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 19 | #include <asm/mach/irda.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 20 | |
| 21 | #include <mach/h3xxx.h> |
| 22 | |
| 23 | #include "generic.h" |
| 24 | |
| 25 | /* |
| 26 | * helper for sa1100fb |
| 27 | */ |
| 28 | static void h3100_lcd_power(int enable) |
| 29 | { |
| 30 | if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) { |
| 31 | gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); |
| 32 | gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); |
| 33 | gpio_free(H3XXX_EGPIO_LCD_ON); |
Dmitry Artamonow | 729fae4 | 2009-11-27 12:22:32 +0100 | [diff] [blame^] | 34 | } else { |
| 35 | pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__); |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 36 | } |
| 37 | } |
| 38 | |
| 39 | |
| 40 | static void __init h3100_map_io(void) |
| 41 | { |
| 42 | h3xxx_map_io(); |
| 43 | |
| 44 | sa1100fb_lcd_power = h3100_lcd_power; |
| 45 | |
| 46 | /* Older bootldrs put GPIO2-9 in alternate mode on the |
| 47 | assumption that they are used for video */ |
| 48 | GAFR &= ~0x000001fb; |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * This turns the IRDA power on or off on the Compaq H3100 |
| 53 | */ |
| 54 | static int h3100_irda_set_power(struct device *dev, unsigned int state) |
| 55 | { |
| 56 | gpio_set_value(H3100_GPIO_IR_ON, state); |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | static void h3100_irda_set_speed(struct device *dev, unsigned int speed) |
| 61 | { |
| 62 | gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); |
| 63 | } |
| 64 | |
| 65 | static struct irda_platform_data h3100_irda_data = { |
| 66 | .set_power = h3100_irda_set_power, |
| 67 | .set_speed = h3100_irda_set_speed, |
| 68 | }; |
| 69 | |
| 70 | static struct gpio_default_state h3100_default_gpio[] = { |
| 71 | { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" }, |
| 72 | { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" }, |
| 73 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, |
| 74 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, |
| 75 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, |
| 76 | { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" }, |
| 77 | }; |
| 78 | |
| 79 | static void __init h3100_mach_init(void) |
| 80 | { |
| 81 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); |
| 82 | h3xxx_mach_init(); |
| 83 | sa11x0_register_irda(&h3100_irda_data); |
| 84 | } |
| 85 | |
| 86 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
| 87 | .phys_io = 0x80000000, |
| 88 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, |
| 89 | .boot_params = 0xc0000100, |
| 90 | .map_io = h3100_map_io, |
| 91 | .init_irq = sa1100_init_irq, |
| 92 | .timer = &sa1100_timer, |
| 93 | .init_machine = h3100_mach_init, |
| 94 | MACHINE_END |
| 95 | |