1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-omap1/board-palmtt.c
5 * Modified from board-palmtt2.c
7 * Modified and amended for Palm Tungsten|T
8 * by Marek Vasut <marek.vasut@gmail.com>
11 #include <linux/delay.h>
12 #include <linux/gpio.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/notifier.h>
17 #include <linux/clk.h>
18 #include <linux/input.h>
19 #include <linux/interrupt.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/leds.h>
24 #include <linux/omapfb.h>
25 #include <linux/spi/spi.h>
26 #include <linux/spi/ads7846.h>
27 #include <linux/omap-dma.h>
28 #include <linux/platform_data/omap1_bl.h>
29 #include <linux/platform_data/leds-omap.h>
30 #include <linux/platform_data/keypad-omap.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
43 #define PALMTT_USBDETECT_GPIO 0
44 #define PALMTT_CABLE_GPIO 1
45 #define PALMTT_LED_GPIO 3
46 #define PALMTT_PENIRQ_GPIO 6
47 #define PALMTT_MMC_WP_GPIO 8
48 #define PALMTT_HDQ_GPIO 11
50 static const unsigned int palmtt_keymap[] = {
53 KEY(2, 0, KEY_LEFTCTRL),
64 static struct mtd_partition palmtt_partitions[] = {
72 .name = "PalmOS-BootLoader(ro)",
75 .mask_flags = MTD_WRITEABLE,
79 .offset = MTDPART_OFS_APPEND,
84 .name = "PalmOS-FS(ro)",
85 .offset = MTDPART_OFS_APPEND,
86 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
87 .mask_flags = MTD_WRITEABLE,
90 .name = "u-boot(rez)",
91 .offset = MTDPART_OFS_APPEND,
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
103 static struct physmap_flash_data palmtt_flash_data = {
105 .set_vpp = omap1_set_vpp,
106 .parts = palmtt_partitions,
107 .nr_parts = ARRAY_SIZE(palmtt_partitions),
110 static struct resource palmtt_flash_resource = {
111 .start = OMAP_CS0_PHYS,
112 .end = OMAP_CS0_PHYS + SZ_8M - 1,
113 .flags = IORESOURCE_MEM,
116 static struct platform_device palmtt_flash_device = {
117 .name = "physmap-flash",
120 .platform_data = &palmtt_flash_data,
123 .resource = &palmtt_flash_resource,
126 static struct resource palmtt_kp_resources[] = {
128 .start = INT_KEYBOARD,
130 .flags = IORESOURCE_IRQ,
134 static const struct matrix_keymap_data palmtt_keymap_data = {
135 .keymap = palmtt_keymap,
136 .keymap_size = ARRAY_SIZE(palmtt_keymap),
139 static struct omap_kp_platform_data palmtt_kp_data = {
142 .keymap_data = &palmtt_keymap_data,
145 static struct platform_device palmtt_kp_device = {
146 .name = "omap-keypad",
149 .platform_data = &palmtt_kp_data,
151 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
152 .resource = palmtt_kp_resources,
155 static struct platform_device palmtt_lcd_device = {
156 .name = "lcd_palmtt",
160 static struct platform_device palmtt_spi_device = {
161 .name = "spi_palmtt",
165 static struct omap_backlight_config palmtt_backlight_config = {
166 .default_intensity = 0xa0,
169 static struct platform_device palmtt_backlight_device = {
173 .platform_data= &palmtt_backlight_config,
177 static struct omap_led_config palmtt_led_config[] = {
180 .name = "palmtt:led0",
182 .gpio = PALMTT_LED_GPIO,
186 static struct omap_led_platform_data palmtt_led_data = {
187 .nr_leds = ARRAY_SIZE(palmtt_led_config),
188 .leds = palmtt_led_config,
191 static struct platform_device palmtt_led_device = {
195 .platform_data = &palmtt_led_data,
199 static struct platform_device *palmtt_devices[] __initdata = {
200 &palmtt_flash_device,
204 &palmtt_backlight_device,
208 static int palmtt_get_pendown_state(void)
210 return !gpio_get_value(6);
213 static const struct ads7846_platform_data palmtt_ts_info = {
215 .vref_delay_usecs = 100, /* internal, no capacitor */
218 .get_pendown_state = palmtt_get_pendown_state,
221 static struct spi_board_info __initdata palmtt_boardinfo[] = {
223 /* MicroWire (bus 2) CS0 has an ads7846e */
224 .modalias = "ads7846",
225 .platform_data = &palmtt_ts_info,
226 .max_speed_hz = 120000 /* max sample rate at 3V */
227 * 26 /* command + data + overhead */,
233 static struct omap_usb_config palmtt_usb_config __initdata = {
239 static const struct omap_lcd_config palmtt_lcd_config __initconst = {
240 .ctrl_name = "internal",
243 static void __init omap_mpu_wdt_mode(int mode) {
245 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
247 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
248 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
252 static void __init omap_palmtt_init(void)
254 /* mux pins for uarts */
255 omap_cfg_reg(UART1_TX);
256 omap_cfg_reg(UART1_RTS);
257 omap_cfg_reg(UART2_TX);
258 omap_cfg_reg(UART2_RTS);
259 omap_cfg_reg(UART3_TX);
260 omap_cfg_reg(UART3_RX);
262 omap_mpu_wdt_mode(0);
264 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
266 palmtt_boardinfo[0].irq = gpio_to_irq(6);
267 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
269 omap1_usb_init(&palmtt_usb_config);
270 omap_register_i2c_bus(1, 100, NULL, 0);
272 omapfb_set_lcd_config(&palmtt_lcd_config);
275 MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
276 .atag_offset = 0x100,
277 .map_io = omap15xx_map_io,
278 .init_early = omap1_init_early,
279 .init_irq = omap1_init_irq,
280 .handle_irq = omap1_handle_irq,
281 .init_machine = omap_palmtt_init,
282 .init_late = omap1_init_late,
283 .init_time = omap1_timer_init,
284 .restart = omap1_restart,