2 * linux/arch/arm/mach-omap1/board-h6300.c
4 * Modified from board-innovator.c
6 * Board specific inits for OMAP-1510 based iPAQ h63xx series of mobile phones.
7 * (h6315, h6340 and h6365)
9 * Copyright (C) 2009 Mika Laitio
10 * Copyright (C) 2009 Husam Senussi
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.
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>
23 #include <mach/hardware.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
29 #include <mach/gpio.h>
30 #include <mach/common.h>
31 #include <mach/board.h>
34 static struct platform_device h6300_lcd_device = {
39 static struct platform_device *h6300_devices[] __initdata = {
43 static struct omap_lcd_config h6300_lcd_config __initdata = {
44 .ctrl_name = "internal",
47 static struct omap_uart_config h6300_uart_config __initdata = {
48 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
51 /* assume no Mini-AB port */
52 static struct omap_usb_config h6300_usb_config __initdata = {
58 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
60 //#define H6300_GPIO_MMC_POWER 13
61 #define H6300_GPIO_MMC_WRITE_PROTECT 13
62 #define H6300_GPIO_MMC_CARD_DETECT 15
65 static int h6300_mmc_set_power(struct device *dev, int slot, int power_on,
68 //printk("h6300_mmc_set_power started\n");
74 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
79 dat |= SOFIA_MMC_POWER;
81 dat &= ~SOFIA_MMC_POWER;
83 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
87 gpio_set_value(H6300_GPIO_MMC_POWER, 1);
89 gpio_set_value(H6300_GPIO_MMC_POWER, 0);
95 static int h6300_mmc_get_cover_state(struct device *dev, int slot)
97 return gpio_get_value(H6300_GPIO_MMC_CARD_DETECT);
101 static struct omap_mmc_platform_data h6300_mmc1_data = {
103 /* .dma_mask = 0xffffffff, */
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
116 static struct omap_mmc_platform_data *h6300_mmc_data[OMAP15XX_NR_MMC];
118 static void __init h6300_mmc_init(void)
122 printk("h6300_mmc_init() started\n");
123 ret = gpio_request(H6300_GPIO_MMC_WRITE_PROTECT, "MMC WP");
125 printk("Failed to get MMC WP gpio\n");
126 gpio_free(H6300_GPIO_MMC_WRITE_PROTECT);
129 gpio_direction_input(H6300_GPIO_MMC_WRITE_PROTECT);
130 printk("MMC WP gpio set input\n");
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");
138 ret = gpio_request(H6300_GPIO_MMC_POWER, "MMC power");
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);
145 ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
147 gpio_free(NOKIA770_GPIO_MMC_POWER);
150 gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
155 static inline void h6300_mmc_init(void)
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 },
166 static void __init h6300_init_irq(void)
168 omap1_init_common_hw();
173 static void __init h6300_init(void)
177 ret = platform_add_devices(h6300_devices, ARRAY_SIZE(h6300_devices));
179 printk(KERN_WARNING "Unable to add h6300 platform devices.");
181 omap_board_config = h6300_config;
182 omap_board_config_size = ARRAY_SIZE(h6300_config);
184 omap_register_i2c_bus(1, 100, NULL, 0);
188 static void __init h6300_map_io(void)
190 omap1_map_common_io();
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,