]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap1/board-h6300.c
h63xx: very initial mmc support.
[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 /*
69         int err;
70         u8 dat = 0;
71
72         err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
73         if (err < 0)
74                 return err;
75
76         if (power_on)
77                 dat |= SOFIA_MMC_POWER;
78         else
79                 dat &= ~SOFIA_MMC_POWER;
80
81         return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
82 */
83 /*
84         if (power_on)
85                 gpio_set_value(H6300_GPIO_MMC_POWER, 1);
86         else
87                 gpio_set_value(H6300_GPIO_MMC_POWER, 0);
88 */
89         return 0;
90 }
91
92 /*
93 static int h6300_mmc_get_cover_state(struct device *dev, int slot)
94 {
95         return gpio_get_value(H6300_GPIO_MMC_CARD_DETECT);
96 }
97 */
98
99 static struct omap_mmc_platform_data h6300_mmc1_data = {
100         .nr_slots                       = 1,
101 /*      .dma_mask                       = 0xffffffff, */
102         .slots[0]       = {
103                 .set_power              = h6300_mmc_set_power,
104 /*              .get_cover_state        = h6300_mmc_get_cover_state, */
105                 .gpio_wp                = H6300_GPIO_MMC_WRITE_PROTECT, // input, write protect
106                 .switch_pin             = H6300_GPIO_MMC_CARD_DETECT,   // input, card detect
107                 .wires                  = 4,
108                 .name                   = "mmcblk",
109         },
110 };
111
112 static struct omap_mmc_platform_data *h6300_mmc_data[OMAP15XX_NR_MMC];
113
114 static void __init h6300_mmc_init(void)
115 {
116         h6300_mmc_data[0] = &h6300_mmc1_data;
117         omap1_init_mmc(h6300_mmc_data, OMAP15XX_NR_MMC);
118 /*
119         int ret;
120
121         ret = gpio_request(H6300_GPIO_MMC_POWER, "MMC power");
122         if (ret < 0)
123                 return;
124         gpio_direction_output(H6300_GPIO_MMC_POWER, 0);
125         mmc_data[0] = &h6300_mmc1_data;
126         omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
127
128         ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
129         if (ret < 0) {
130                 gpio_free(NOKIA770_GPIO_MMC_POWER);
131                 return;
132         }
133         gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
134 */
135 }
136
137 #else
138 static inline void h6300_mmc_init(void)
139 {
140 }
141 #endif
142
143 static struct omap_board_config_kernel h6300_config[] = {
144         { OMAP_TAG_LCD,         &h6300_lcd_config },
145         { OMAP_TAG_UART,        &h6300_uart_config },
146         { OMAP_TAG_USB,         &h6300_usb_config },
147 };
148
149 static void __init h6300_init_irq(void)
150 {
151         omap1_init_common_hw();
152         omap_init_irq();
153         omap_gpio_init();
154 }
155
156 static void __init h6300_init(void)
157 {
158         int ret;
159         
160         ret = platform_add_devices(h6300_devices, ARRAY_SIZE(h6300_devices));
161         if (ret) {
162                 printk(KERN_WARNING "Unable to add h6300 platform devices.");
163         }
164         omap_board_config       = h6300_config;
165         omap_board_config_size  = ARRAY_SIZE(h6300_config);
166         omap_serial_init();
167         omap_register_i2c_bus(1, 100, NULL, 0);
168         //h6300_mmc_init();
169 }
170
171 static void __init h6300_map_io(void)
172 {
173         omap1_map_common_io();
174 }
175
176 MACHINE_START(OMAP_H6300, "HP iPAQ h6300")
177         /* MAINTAINER("Mika Laitio <lamikr at pilppa dot org>") */
178         .phys_io        = 0xfff00000,
179         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
180         .boot_params    = 0x10000100,
181         .map_io         = h6300_map_io,
182         .init_irq       = h6300_init_irq,
183         .init_machine   = h6300_init,
184         .timer          = &omap_timer,
185 MACHINE_END