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 | |
Russell King | e1b7a72 | 2012-01-14 11:50:04 +0000 | [diff] [blame] | 17 | #include <video/sa1100fb.h> |
| 18 | |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 19 | #include <asm/mach-types.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 20 | #include <asm/mach/arch.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 21 | #include <asm/mach/irda.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 22 | |
| 23 | #include <mach/h3xxx.h> |
Rob Herring | f314f33 | 2012-02-24 00:06:51 +0100 | [diff] [blame] | 24 | #include <mach/irqs.h> |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 25 | |
| 26 | #include "generic.h" |
| 27 | |
| 28 | /* |
| 29 | * helper for sa1100fb |
| 30 | */ |
| 31 | static void h3100_lcd_power(int enable) |
| 32 | { |
| 33 | if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) { |
| 34 | gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); |
| 35 | gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); |
| 36 | gpio_free(H3XXX_EGPIO_LCD_ON); |
Dmitry Artamonow | 729fae4 | 2009-11-27 12:22:32 +0100 | [diff] [blame] | 37 | } else { |
| 38 | pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__); |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 39 | } |
| 40 | } |
| 41 | |
Russell King | e1b7a72 | 2012-01-14 11:50:04 +0000 | [diff] [blame] | 42 | static struct sa1100fb_mach_info h3100_lcd_info = { |
| 43 | .pixclock = 406977, .bpp = 4, |
| 44 | .xres = 320, .yres = 240, |
| 45 | |
| 46 | .hsync_len = 26, .vsync_len = 41, |
| 47 | .left_margin = 4, .upper_margin = 0, |
| 48 | .right_margin = 4, .lower_margin = 0, |
| 49 | |
| 50 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
| 51 | .cmap_greyscale = 1, |
| 52 | .cmap_inverse = 1, |
| 53 | |
| 54 | .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas, |
| 55 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), |
Russell King | 086ada5 | 2012-01-14 12:03:22 +0000 | [diff] [blame] | 56 | |
| 57 | .lcd_power = h3100_lcd_power, |
Russell King | e1b7a72 | 2012-01-14 11:50:04 +0000 | [diff] [blame] | 58 | }; |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 59 | |
| 60 | static void __init h3100_map_io(void) |
| 61 | { |
| 62 | h3xxx_map_io(); |
| 63 | |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 64 | /* Older bootldrs put GPIO2-9 in alternate mode on the |
| 65 | assumption that they are used for video */ |
| 66 | GAFR &= ~0x000001fb; |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * This turns the IRDA power on or off on the Compaq H3100 |
| 71 | */ |
| 72 | static int h3100_irda_set_power(struct device *dev, unsigned int state) |
| 73 | { |
| 74 | gpio_set_value(H3100_GPIO_IR_ON, state); |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | static void h3100_irda_set_speed(struct device *dev, unsigned int speed) |
| 79 | { |
| 80 | gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); |
| 81 | } |
| 82 | |
| 83 | static struct irda_platform_data h3100_irda_data = { |
| 84 | .set_power = h3100_irda_set_power, |
| 85 | .set_speed = h3100_irda_set_speed, |
| 86 | }; |
| 87 | |
| 88 | static struct gpio_default_state h3100_default_gpio[] = { |
| 89 | { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" }, |
| 90 | { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" }, |
| 91 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, |
| 92 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, |
| 93 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, |
| 94 | { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" }, |
| 95 | }; |
| 96 | |
| 97 | static void __init h3100_mach_init(void) |
| 98 | { |
| 99 | h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); |
| 100 | h3xxx_mach_init(); |
Russell King | e1b7a72 | 2012-01-14 11:50:04 +0000 | [diff] [blame] | 101 | |
Russell King | e1b7a72 | 2012-01-14 11:50:04 +0000 | [diff] [blame] | 102 | sa11x0_register_lcd(&h3100_lcd_info); |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 103 | sa11x0_register_irda(&h3100_irda_data); |
| 104 | } |
| 105 | |
| 106 | MACHINE_START(H3100, "Compaq iPAQ H3100") |
Nicolas Pitre | 17f4425 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 107 | .atag_offset = 0x100, |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 108 | .map_io = h3100_map_io, |
Rob Herring | f314f33 | 2012-02-24 00:06:51 +0100 | [diff] [blame] | 109 | .nr_irqs = SA1100_NR_IRQS, |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 110 | .init_irq = sa1100_init_irq, |
| 111 | .timer = &sa1100_timer, |
| 112 | .init_machine = h3100_mach_init, |
Shawn Guo | 7fea1ba | 2012-04-26 21:22:45 +0800 | [diff] [blame] | 113 | .init_late = sa11x0_init_late, |
Russell King | d9ca583 | 2011-11-05 10:28:50 +0000 | [diff] [blame] | 114 | .restart = sa11x0_restart, |
Dmitry Artamonow | 86e5e38 | 2009-11-27 12:10:55 +0100 | [diff] [blame] | 115 | MACHINE_END |
| 116 | |