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,
72 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
77 dat |= SOFIA_MMC_POWER;
79 dat &= ~SOFIA_MMC_POWER;
81 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
85 gpio_set_value(H6300_GPIO_MMC_POWER, 1);
87 gpio_set_value(H6300_GPIO_MMC_POWER, 0);
93 static int h6300_mmc_get_cover_state(struct device *dev, int slot)
95 return gpio_get_value(H6300_GPIO_MMC_CARD_DETECT);
99 static struct omap_mmc_platform_data h6300_mmc1_data = {
101 /* .dma_mask = 0xffffffff, */
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
112 static struct omap_mmc_platform_data *h6300_mmc_data[OMAP15XX_NR_MMC];
114 static void __init h6300_mmc_init(void)
116 h6300_mmc_data[0] = &h6300_mmc1_data;
117 omap1_init_mmc(h6300_mmc_data, OMAP15XX_NR_MMC);
121 ret = gpio_request(H6300_GPIO_MMC_POWER, "MMC power");
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);
128 ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
130 gpio_free(NOKIA770_GPIO_MMC_POWER);
133 gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
138 static inline void h6300_mmc_init(void)
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 },
149 static void __init h6300_init_irq(void)
151 omap1_init_common_hw();
156 static void __init h6300_init(void)
160 ret = platform_add_devices(h6300_devices, ARRAY_SIZE(h6300_devices));
162 printk(KERN_WARNING "Unable to add h6300 platform devices.");
164 omap_board_config = h6300_config;
165 omap_board_config_size = ARRAY_SIZE(h6300_config);
167 omap_register_i2c_bus(1, 100, NULL, 0);
171 static void __init h6300_map_io(void)
173 omap1_map_common_io();
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,