]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap1/board-h6300.c
h63xx: nfs mount works, gpe image boots to ts config screen.
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / board-h6300.c
1 /*
2  * linux/arch/arm/mach-omap1/board-h6300.c
3  *
4  * Modified from board-innovator.c
5  *
6  * Board specific inits for OMAP-1510 based iPAQ h63xx series of mobile phones.
7  * (h6315, h6340 and h6365)
8  *
9  * Copyright (C) 2009 Mika Laitio
10  * Copyright (C) 2009 Husam Senussi
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  */
16
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/platform_device.h>
20 #include <linux/delay.h>
21 #include <linux/input.h>
22
23 #include <mach/hardware.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27
28 #include <mach/mux.h>
29 #include <mach/gpio.h>
30 #include <mach/common.h>
31 #include <mach/board.h>
32 #include <mach/mmc.h>
33
34 static struct platform_device h6300_lcd_device = {
35         .name   = "lcd_h6300",
36         .id     = -1,
37 };
38
39 static struct platform_device *h6300_devices[] __initdata = {
40         &h6300_lcd_device,
41 };
42
43 static struct omap_lcd_config h6300_lcd_config __initdata = {
44         .ctrl_name      = "internal",
45 };
46
47 static struct omap_uart_config h6300_uart_config __initdata = {
48         .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
49 };
50
51 /* assume no Mini-AB port */
52 static struct omap_usb_config h6300_usb_config __initdata = {
53         .register_dev   = 1,
54         .hmc_mode       = 0,
55         .pins[0]        = 0,
56 };
57
58 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
59
60 //#define H6300_GPIO_MMC_POWER  13
61 #define H6300_GPIO_MMC_WRITE_PROTECT    13
62 #define H6300_GPIO_MMC_CARD_DETECT      15
63
64
65 static int h6300_mmc_set_power(struct device *dev, int slot, int power_on,
66                                 int vdd)
67 {
68         //printk("h6300_mmc_set_power started\n");
69
70 /*
71         int err;
72         u8 dat = 0;
73
74         err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
75         if (err < 0)
76                 return err;
77
78         if (power_on)
79                 dat |= SOFIA_MMC_POWER;
80         else
81                 dat &= ~SOFIA_MMC_POWER;
82
83         return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
84 */
85 /*
86         if (power_on)
87                 gpio_set_value(H6300_GPIO_MMC_POWER, 1);
88         else
89                 gpio_set_value(H6300_GPIO_MMC_POWER, 0);
90 */
91         return 0;
92 }
93
94 /*
95 static int h6300_mmc_get_cover_state(struct device *dev, int slot)
96 {
97         return gpio_get_value(H6300_GPIO_MMC_CARD_DETECT);
98 }
99 */
100
101 static struct omap_mmc_platform_data h6300_mmc1_data = {
102         .nr_slots                       = 1,
103 /*      .dma_mask                       = 0xffffffff, */
104         .slots[0]       = {
105                 .set_power              = h6300_mmc_set_power,
106 /*              .get_cover_state        = h6300_mmc_get_cover_state, */
107                 .gpio_wp                = H6300_GPIO_MMC_WRITE_PROTECT,         // input, write protect
108 /*              .switch_pin             = H6300_GPIO_MMC_CARD_DETECT,   */      // input, card detect
109 /*
110                 .wires                  = 4,
111                 .name                   = "mmcblk",
112 */
113         },
114 };
115
116 static struct omap_mmc_platform_data *h6300_mmc_data[OMAP15XX_NR_MMC];
117
118 static void __init h6300_mmc_init(void)
119 {
120         int     ret;
121
122         printk("h6300_mmc_init() started\n");
123         ret = gpio_request(H6300_GPIO_MMC_WRITE_PROTECT, "MMC WP");
124         if (ret < 0) {
125                 printk("Failed to get MMC WP gpio\n");
126                 gpio_free(H6300_GPIO_MMC_WRITE_PROTECT);
127                 return;
128         }
129         gpio_direction_input(H6300_GPIO_MMC_WRITE_PROTECT);
130         printk("MMC WP gpio set input\n");
131
132         h6300_mmc_data[0] = &h6300_mmc1_data;
133         omap1_init_mmc(h6300_mmc_data, OMAP15XX_NR_MMC);
134         printk("h6300 mmc init done\n");
135 /*
136         int ret;
137
138         ret = gpio_request(H6300_GPIO_MMC_POWER, "MMC power");
139         if (ret < 0)
140                 return;
141         gpio_direction_output(H6300_GPIO_MMC_POWER, 0);
142         mmc_data[0] = &h6300_mmc1_data;
143         omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
144
145         ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
146         if (ret < 0) {
147                 gpio_free(NOKIA770_GPIO_MMC_POWER);
148                 return;
149         }
150         gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
151 */
152 }
153
154 #else
155 static inline void h6300_mmc_init(void)
156 {
157 }
158 #endif
159
160 static struct omap_board_config_kernel h6300_config[] = {
161         { OMAP_TAG_LCD,         &h6300_lcd_config },
162         { OMAP_TAG_UART,        &h6300_uart_config },
163         { OMAP_TAG_USB,         &h6300_usb_config },
164 };
165
166 static void __init h6300_init_irq(void)
167 {
168         omap1_init_common_hw();
169         omap_init_irq();
170         omap_gpio_init();
171 }
172
173 static void __init h6300_init(void)
174 {
175         int ret;
176         
177         ret = platform_add_devices(h6300_devices, ARRAY_SIZE(h6300_devices));
178         if (ret) {
179                 printk(KERN_WARNING "Unable to add h6300 platform devices.");
180         }
181         omap_board_config       = h6300_config;
182         omap_board_config_size  = ARRAY_SIZE(h6300_config);
183         omap_serial_init();
184         omap_register_i2c_bus(1, 100, NULL, 0);
185         h6300_mmc_init();
186 }
187
188 static void __init h6300_map_io(void)
189 {
190         omap1_map_common_io();
191 }
192
193 MACHINE_START(OMAP_H6300, "HP iPAQ h6300")
194         /* MAINTAINER("Mika Laitio <lamikr at pilppa dot org>") */
195         .phys_io        = 0xfff00000,
196         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
197         .boot_params    = 0x10000100,
198         .map_io         = h6300_map_io,
199         .init_irq       = h6300_init_irq,
200         .init_machine   = h6300_init,
201         .timer          = &omap_timer,
202 MACHINE_END