0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/delay.h>
0012 #include <linux/gpio.h>
0013 #include <linux/kernel.h>
0014 #include <linux/init.h>
0015 #include <linux/platform_device.h>
0016 #include <linux/notifier.h>
0017 #include <linux/clk.h>
0018 #include <linux/input.h>
0019 #include <linux/interrupt.h>
0020 #include <linux/mtd/mtd.h>
0021 #include <linux/mtd/partitions.h>
0022 #include <linux/mtd/physmap.h>
0023 #include <linux/leds.h>
0024 #include <linux/omapfb.h>
0025 #include <linux/spi/spi.h>
0026 #include <linux/spi/ads7846.h>
0027 #include <linux/omap-dma.h>
0028 #include <linux/platform_data/omap1_bl.h>
0029 #include <linux/platform_data/leds-omap.h>
0030 #include <linux/platform_data/keypad-omap.h>
0031
0032 #include <asm/mach-types.h>
0033 #include <asm/mach/arch.h>
0034 #include <asm/mach/map.h>
0035
0036 #include "tc.h"
0037 #include "flash.h"
0038 #include "mux.h"
0039 #include "hardware.h"
0040 #include "usb.h"
0041 #include "common.h"
0042
0043 #define PALMTT_USBDETECT_GPIO 0
0044 #define PALMTT_CABLE_GPIO 1
0045 #define PALMTT_LED_GPIO 3
0046 #define PALMTT_PENIRQ_GPIO 6
0047 #define PALMTT_MMC_WP_GPIO 8
0048 #define PALMTT_HDQ_GPIO 11
0049
0050 static const unsigned int palmtt_keymap[] = {
0051 KEY(0, 0, KEY_ESC),
0052 KEY(1, 0, KEY_SPACE),
0053 KEY(2, 0, KEY_LEFTCTRL),
0054 KEY(3, 0, KEY_TAB),
0055 KEY(4, 0, KEY_ENTER),
0056 KEY(0, 1, KEY_LEFT),
0057 KEY(1, 1, KEY_DOWN),
0058 KEY(2, 1, KEY_UP),
0059 KEY(3, 1, KEY_RIGHT),
0060 KEY(0, 2, KEY_SLEEP),
0061 KEY(4, 2, KEY_Y),
0062 };
0063
0064 static struct mtd_partition palmtt_partitions[] = {
0065 {
0066 .name = "write8k",
0067 .offset = 0,
0068 .size = SZ_8K,
0069 .mask_flags = 0,
0070 },
0071 {
0072 .name = "PalmOS-BootLoader(ro)",
0073 .offset = SZ_8K,
0074 .size = 7 * SZ_8K,
0075 .mask_flags = MTD_WRITEABLE,
0076 },
0077 {
0078 .name = "u-boot",
0079 .offset = MTDPART_OFS_APPEND,
0080 .size = 8 * SZ_8K,
0081 .mask_flags = 0,
0082 },
0083 {
0084 .name = "PalmOS-FS(ro)",
0085 .offset = MTDPART_OFS_APPEND,
0086 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
0087 .mask_flags = MTD_WRITEABLE,
0088 },
0089 {
0090 .name = "u-boot(rez)",
0091 .offset = MTDPART_OFS_APPEND,
0092 .size = SZ_128K,
0093 .mask_flags = 0
0094 },
0095 {
0096 .name = "empty",
0097 .offset = MTDPART_OFS_APPEND,
0098 .size = MTDPART_SIZ_FULL,
0099 .mask_flags = 0
0100 }
0101 };
0102
0103 static struct physmap_flash_data palmtt_flash_data = {
0104 .width = 2,
0105 .set_vpp = omap1_set_vpp,
0106 .parts = palmtt_partitions,
0107 .nr_parts = ARRAY_SIZE(palmtt_partitions),
0108 };
0109
0110 static struct resource palmtt_flash_resource = {
0111 .start = OMAP_CS0_PHYS,
0112 .end = OMAP_CS0_PHYS + SZ_8M - 1,
0113 .flags = IORESOURCE_MEM,
0114 };
0115
0116 static struct platform_device palmtt_flash_device = {
0117 .name = "physmap-flash",
0118 .id = 0,
0119 .dev = {
0120 .platform_data = &palmtt_flash_data,
0121 },
0122 .num_resources = 1,
0123 .resource = &palmtt_flash_resource,
0124 };
0125
0126 static struct resource palmtt_kp_resources[] = {
0127 [0] = {
0128 .start = INT_KEYBOARD,
0129 .end = INT_KEYBOARD,
0130 .flags = IORESOURCE_IRQ,
0131 },
0132 };
0133
0134 static const struct matrix_keymap_data palmtt_keymap_data = {
0135 .keymap = palmtt_keymap,
0136 .keymap_size = ARRAY_SIZE(palmtt_keymap),
0137 };
0138
0139 static struct omap_kp_platform_data palmtt_kp_data = {
0140 .rows = 6,
0141 .cols = 3,
0142 .keymap_data = &palmtt_keymap_data,
0143 };
0144
0145 static struct platform_device palmtt_kp_device = {
0146 .name = "omap-keypad",
0147 .id = -1,
0148 .dev = {
0149 .platform_data = &palmtt_kp_data,
0150 },
0151 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
0152 .resource = palmtt_kp_resources,
0153 };
0154
0155 static struct platform_device palmtt_lcd_device = {
0156 .name = "lcd_palmtt",
0157 .id = -1,
0158 };
0159
0160 static struct platform_device palmtt_spi_device = {
0161 .name = "spi_palmtt",
0162 .id = -1,
0163 };
0164
0165 static struct omap_backlight_config palmtt_backlight_config = {
0166 .default_intensity = 0xa0,
0167 };
0168
0169 static struct platform_device palmtt_backlight_device = {
0170 .name = "omap-bl",
0171 .id = -1,
0172 .dev = {
0173 .platform_data= &palmtt_backlight_config,
0174 },
0175 };
0176
0177 static struct omap_led_config palmtt_led_config[] = {
0178 {
0179 .cdev = {
0180 .name = "palmtt:led0",
0181 },
0182 .gpio = PALMTT_LED_GPIO,
0183 },
0184 };
0185
0186 static struct omap_led_platform_data palmtt_led_data = {
0187 .nr_leds = ARRAY_SIZE(palmtt_led_config),
0188 .leds = palmtt_led_config,
0189 };
0190
0191 static struct platform_device palmtt_led_device = {
0192 .name = "omap-led",
0193 .id = -1,
0194 .dev = {
0195 .platform_data = &palmtt_led_data,
0196 },
0197 };
0198
0199 static struct platform_device *palmtt_devices[] __initdata = {
0200 &palmtt_flash_device,
0201 &palmtt_kp_device,
0202 &palmtt_lcd_device,
0203 &palmtt_spi_device,
0204 &palmtt_backlight_device,
0205 &palmtt_led_device,
0206 };
0207
0208 static int palmtt_get_pendown_state(void)
0209 {
0210 return !gpio_get_value(6);
0211 }
0212
0213 static const struct ads7846_platform_data palmtt_ts_info = {
0214 .model = 7846,
0215 .vref_delay_usecs = 100,
0216 .x_plate_ohms = 419,
0217 .y_plate_ohms = 486,
0218 .get_pendown_state = palmtt_get_pendown_state,
0219 };
0220
0221 static struct spi_board_info __initdata palmtt_boardinfo[] = {
0222 {
0223
0224 .modalias = "ads7846",
0225 .platform_data = &palmtt_ts_info,
0226 .max_speed_hz = 120000
0227 * 26 ,
0228 .bus_num = 2,
0229 .chip_select = 0,
0230 }
0231 };
0232
0233 static struct omap_usb_config palmtt_usb_config __initdata = {
0234 .register_dev = 1,
0235 .hmc_mode = 0,
0236 .pins[0] = 2,
0237 };
0238
0239 static const struct omap_lcd_config palmtt_lcd_config __initconst = {
0240 .ctrl_name = "internal",
0241 };
0242
0243 static void __init omap_mpu_wdt_mode(int mode) {
0244 if (mode)
0245 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
0246 else {
0247 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
0248 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
0249 }
0250 }
0251
0252 static void __init omap_palmtt_init(void)
0253 {
0254
0255 omap_cfg_reg(UART1_TX);
0256 omap_cfg_reg(UART1_RTS);
0257 omap_cfg_reg(UART2_TX);
0258 omap_cfg_reg(UART2_RTS);
0259 omap_cfg_reg(UART3_TX);
0260 omap_cfg_reg(UART3_RX);
0261
0262 omap_mpu_wdt_mode(0);
0263
0264 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
0265
0266 palmtt_boardinfo[0].irq = gpio_to_irq(6);
0267 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
0268 omap_serial_init();
0269 omap1_usb_init(&palmtt_usb_config);
0270 omap_register_i2c_bus(1, 100, NULL, 0);
0271
0272 omapfb_set_lcd_config(&palmtt_lcd_config);
0273 }
0274
0275 MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
0276 .atag_offset = 0x100,
0277 .map_io = omap15xx_map_io,
0278 .init_early = omap1_init_early,
0279 .init_irq = omap1_init_irq,
0280 .handle_irq = omap1_handle_irq,
0281 .init_machine = omap_palmtt_init,
0282 .init_late = omap1_init_late,
0283 .init_time = omap1_timer_init,
0284 .restart = omap1_restart,
0285 MACHINE_END