2 * board-omap3pandora.c (Pandora Handheld Console)
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/platform_device.h>
24 #include <linux/spi/spi.h>
25 #include <linux/spi/ads7846.h>
26 #include <linux/i2c/twl4030.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
32 #include <mach/board.h>
33 #include <mach/common.h>
34 #include <mach/gpio.h>
35 #include <mach/hardware.h>
36 #include <mach/mcspi.h>
38 #include "mmc-twl4030.h"
40 #define OMAP3_PANDORA_TS_GPIO 94
42 static struct twl4030_hsmmc_info omap3pandora_mmc
[] = {
60 static struct omap_uart_config omap3pandora_uart_config __initdata
= {
61 .enabled_uarts
= (1 << 2), /* UART3 */
64 static int omap3pandora_twl_gpio_setup(struct device
*dev
,
65 unsigned gpio
, unsigned ngpio
)
67 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
68 omap3pandora_mmc
[0].gpio_cd
= gpio
+ 0;
69 omap3pandora_mmc
[1].gpio_cd
= gpio
+ 1;
70 twl4030_mmc_init(omap3pandora_mmc
);
75 static struct twl4030_gpio_platform_data omap3pandora_gpio_data
= {
76 .gpio_base
= OMAP_MAX_GPIO_LINES
,
77 .irq_base
= TWL4030_GPIO_IRQ_BASE
,
78 .irq_end
= TWL4030_GPIO_IRQ_END
,
79 .setup
= omap3pandora_twl_gpio_setup
,
82 static struct twl4030_usb_data omap3pandora_usb_data
= {
83 .usb_mode
= T2_USB_MODE_ULPI
,
86 static struct twl4030_platform_data omap3pandora_twldata
= {
87 .irq_base
= TWL4030_IRQ_BASE
,
88 .irq_end
= TWL4030_IRQ_END
,
89 .gpio
= &omap3pandora_gpio_data
,
90 .usb
= &omap3pandora_usb_data
,
93 static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo
[] = {
95 I2C_BOARD_INFO("tps65950", 0x48),
96 .flags
= I2C_CLIENT_WAKE
,
97 .irq
= INT_34XX_SYS_NIRQ
,
98 .platform_data
= &omap3pandora_twldata
,
102 static int __init
omap3pandora_i2c_init(void)
104 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo
,
105 ARRAY_SIZE(omap3pandora_i2c_boardinfo
));
106 /* i2c2 pins are not connected */
107 omap_register_i2c_bus(3, 400, NULL
, 0);
111 static void __init
omap3pandora_init_irq(void)
113 omap2_init_common_hw();
118 static void __init
omap3pandora_ads7846_init(void)
120 int gpio
= OMAP3_PANDORA_TS_GPIO
;
123 ret
= gpio_request(gpio
, "ads7846_pen_down");
125 printk(KERN_ERR
"Failed to request GPIO %d for "
126 "ads7846 pen down IRQ\n", gpio
);
130 gpio_direction_input(gpio
);
133 static int ads7846_get_pendown_state(void)
135 return !gpio_get_value(OMAP3_PANDORA_TS_GPIO
);
138 static struct ads7846_platform_data ads7846_config
= {
146 .get_pendown_state
= ads7846_get_pendown_state
,
150 static struct omap2_mcspi_device_config ads7846_mcspi_config
= {
152 .single_channel
= 1, /* 0: slave, 1: master */
155 static struct spi_board_info omap3pandora_spi_board_info
[] __initdata
= {
157 .modalias
= "ads7846",
160 .max_speed_hz
= 1500000,
161 .controller_data
= &ads7846_mcspi_config
,
162 .irq
= OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO
),
163 .platform_data
= &ads7846_config
,
167 static struct platform_device omap3pandora_lcd_device
= {
168 .name
= "pandora_lcd",
172 static struct omap_lcd_config omap3pandora_lcd_config __initdata
= {
173 .ctrl_name
= "internal",
176 static struct omap_board_config_kernel omap3pandora_config
[] __initdata
= {
177 { OMAP_TAG_UART
, &omap3pandora_uart_config
},
178 { OMAP_TAG_LCD
, &omap3pandora_lcd_config
},
181 static struct platform_device
*omap3pandora_devices
[] __initdata
= {
182 &omap3pandora_lcd_device
,
185 static void __init
omap3pandora_init(void)
187 omap3pandora_i2c_init();
188 platform_add_devices(omap3pandora_devices
,
189 ARRAY_SIZE(omap3pandora_devices
));
190 omap_board_config
= omap3pandora_config
;
191 omap_board_config_size
= ARRAY_SIZE(omap3pandora_config
);
193 spi_register_board_info(omap3pandora_spi_board_info
,
194 ARRAY_SIZE(omap3pandora_spi_board_info
));
195 omap3pandora_ads7846_init();
198 static void __init
omap3pandora_map_io(void)
200 omap2_set_globals_343x();
201 omap2_map_common_io();
204 MACHINE_START(OMAP3_PANDORA
, "Pandora Handheld Console")
205 .phys_io
= 0x48000000,
206 .io_pg_offst
= ((0xd8000000) >> 18) & 0xfffc,
207 .boot_params
= 0x80000100,
208 .map_io
= omap3pandora_map_io
,
209 .init_irq
= omap3pandora_init_irq
,
210 .init_machine
= omap3pandora_init
,
211 .timer
= &omap_timer
,