Path: blob/master/arch/arm/mach-omap1/board-palmtt.c
10817 views
/*1* linux/arch/arm/mach-omap1/board-palmtt.c2*3* Modified from board-palmtt2.c4*5* Modified and amended for Palm Tungsten|T6* by Marek Vasut <[email protected]>7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License version 2 as10* published by the Free Software Foundation.11*/1213#include <linux/delay.h>14#include <linux/kernel.h>15#include <linux/init.h>16#include <linux/platform_device.h>17#include <linux/notifier.h>18#include <linux/clk.h>19#include <linux/input.h>20#include <linux/interrupt.h>21#include <linux/mtd/mtd.h>22#include <linux/mtd/partitions.h>23#include <linux/mtd/physmap.h>24#include <linux/leds.h>2526#include <mach/hardware.h>27#include <asm/mach-types.h>28#include <asm/mach/arch.h>29#include <asm/mach/map.h>3031#include <plat/led.h>32#include <mach/gpio.h>33#include <plat/flash.h>34#include <plat/mux.h>35#include <plat/usb.h>36#include <plat/dma.h>37#include <plat/tc.h>38#include <plat/board.h>39#include <plat/irda.h>40#include <plat/keypad.h>41#include <plat/common.h>4243#include <linux/spi/spi.h>44#include <linux/spi/ads7846.h>4546#define PALMTT_USBDETECT_GPIO 047#define PALMTT_CABLE_GPIO 148#define PALMTT_LED_GPIO 349#define PALMTT_PENIRQ_GPIO 650#define PALMTT_MMC_WP_GPIO 851#define PALMTT_HDQ_GPIO 115253static const unsigned int palmtt_keymap[] = {54KEY(0, 0, KEY_ESC),55KEY(1, 0, KEY_SPACE),56KEY(2, 0, KEY_LEFTCTRL),57KEY(3, 0, KEY_TAB),58KEY(4, 0, KEY_ENTER),59KEY(0, 1, KEY_LEFT),60KEY(1, 1, KEY_DOWN),61KEY(2, 1, KEY_UP),62KEY(3, 1, KEY_RIGHT),63KEY(0, 2, KEY_SLEEP),64KEY(4, 2, KEY_Y),65};6667static struct mtd_partition palmtt_partitions[] = {68{69.name = "write8k",70.offset = 0,71.size = SZ_8K,72.mask_flags = 0,73},74{75.name = "PalmOS-BootLoader(ro)",76.offset = SZ_8K,77.size = 7 * SZ_8K,78.mask_flags = MTD_WRITEABLE,79},80{81.name = "u-boot",82.offset = MTDPART_OFS_APPEND,83.size = 8 * SZ_8K,84.mask_flags = 0,85},86{87.name = "PalmOS-FS(ro)",88.offset = MTDPART_OFS_APPEND,89.size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,90.mask_flags = MTD_WRITEABLE,91},92{93.name = "u-boot(rez)",94.offset = MTDPART_OFS_APPEND,95.size = SZ_128K,96.mask_flags = 097},98{99.name = "empty",100.offset = MTDPART_OFS_APPEND,101.size = MTDPART_SIZ_FULL,102.mask_flags = 0103}104};105106static struct physmap_flash_data palmtt_flash_data = {107.width = 2,108.set_vpp = omap1_set_vpp,109.parts = palmtt_partitions,110.nr_parts = ARRAY_SIZE(palmtt_partitions),111};112113static struct resource palmtt_flash_resource = {114.start = OMAP_CS0_PHYS,115.end = OMAP_CS0_PHYS + SZ_8M - 1,116.flags = IORESOURCE_MEM,117};118119static struct platform_device palmtt_flash_device = {120.name = "physmap-flash",121.id = 0,122.dev = {123.platform_data = &palmtt_flash_data,124},125.num_resources = 1,126.resource = &palmtt_flash_resource,127};128129static struct resource palmtt_kp_resources[] = {130[0] = {131.start = INT_KEYBOARD,132.end = INT_KEYBOARD,133.flags = IORESOURCE_IRQ,134},135};136137static const struct matrix_keymap_data palmtt_keymap_data = {138.keymap = palmtt_keymap,139.keymap_size = ARRAY_SIZE(palmtt_keymap),140};141142static struct omap_kp_platform_data palmtt_kp_data = {143.rows = 6,144.cols = 3,145.keymap_data = &palmtt_keymap_data,146};147148static struct platform_device palmtt_kp_device = {149.name = "omap-keypad",150.id = -1,151.dev = {152.platform_data = &palmtt_kp_data,153},154.num_resources = ARRAY_SIZE(palmtt_kp_resources),155.resource = palmtt_kp_resources,156};157158static struct platform_device palmtt_lcd_device = {159.name = "lcd_palmtt",160.id = -1,161};162static struct omap_irda_config palmtt_irda_config = {163.transceiver_cap = IR_SIRMODE,164.rx_channel = OMAP_DMA_UART3_RX,165.tx_channel = OMAP_DMA_UART3_TX,166.dest_start = UART3_THR,167.src_start = UART3_RHR,168.tx_trigger = 0,169.rx_trigger = 0,170};171172static struct resource palmtt_irda_resources[] = {173[0] = {174.start = INT_UART3,175.end = INT_UART3,176.flags = IORESOURCE_IRQ,177},178};179180static struct platform_device palmtt_irda_device = {181.name = "omapirda",182.id = -1,183.dev = {184.platform_data = &palmtt_irda_config,185},186.num_resources = ARRAY_SIZE(palmtt_irda_resources),187.resource = palmtt_irda_resources,188};189190static struct platform_device palmtt_spi_device = {191.name = "spi_palmtt",192.id = -1,193};194195static struct omap_backlight_config palmtt_backlight_config = {196.default_intensity = 0xa0,197};198199static struct platform_device palmtt_backlight_device = {200.name = "omap-bl",201.id = -1,202.dev = {203.platform_data= &palmtt_backlight_config,204},205};206207static struct omap_led_config palmtt_led_config[] = {208{209.cdev = {210.name = "palmtt:led0",211},212.gpio = PALMTT_LED_GPIO,213},214};215216static struct omap_led_platform_data palmtt_led_data = {217.nr_leds = ARRAY_SIZE(palmtt_led_config),218.leds = palmtt_led_config,219};220221static struct platform_device palmtt_led_device = {222.name = "omap-led",223.id = -1,224.dev = {225.platform_data = &palmtt_led_data,226},227};228229static struct platform_device *palmtt_devices[] __initdata = {230&palmtt_flash_device,231&palmtt_kp_device,232&palmtt_lcd_device,233&palmtt_irda_device,234&palmtt_spi_device,235&palmtt_backlight_device,236&palmtt_led_device,237};238239static int palmtt_get_pendown_state(void)240{241return !gpio_get_value(6);242}243244static const struct ads7846_platform_data palmtt_ts_info = {245.model = 7846,246.vref_delay_usecs = 100, /* internal, no capacitor */247.x_plate_ohms = 419,248.y_plate_ohms = 486,249.get_pendown_state = palmtt_get_pendown_state,250};251252static struct spi_board_info __initdata palmtt_boardinfo[] = {253{254/* MicroWire (bus 2) CS0 has an ads7846e */255.modalias = "ads7846",256.platform_data = &palmtt_ts_info,257.irq = OMAP_GPIO_IRQ(6),258.max_speed_hz = 120000 /* max sample rate at 3V */259* 26 /* command + data + overhead */,260.bus_num = 2,261.chip_select = 0,262}263};264265static void __init omap_palmtt_init_irq(void)266{267omap1_init_common_hw();268omap_init_irq();269}270271static struct omap_usb_config palmtt_usb_config __initdata = {272.register_dev = 1,273.hmc_mode = 0,274.pins[0] = 2,275};276277static struct omap_lcd_config palmtt_lcd_config __initdata = {278.ctrl_name = "internal",279};280281static struct omap_board_config_kernel palmtt_config[] __initdata = {282{ OMAP_TAG_LCD, &palmtt_lcd_config },283};284285static void __init omap_mpu_wdt_mode(int mode) {286if (mode)287omap_writew(0x8000, OMAP_WDT_TIMER_MODE);288else {289omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);290omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);291}292}293294static void __init omap_palmtt_init(void)295{296/* mux pins for uarts */297omap_cfg_reg(UART1_TX);298omap_cfg_reg(UART1_RTS);299omap_cfg_reg(UART2_TX);300omap_cfg_reg(UART2_RTS);301omap_cfg_reg(UART3_TX);302omap_cfg_reg(UART3_RX);303304omap_mpu_wdt_mode(0);305306omap_board_config = palmtt_config;307omap_board_config_size = ARRAY_SIZE(palmtt_config);308309platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));310311spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));312omap_serial_init();313omap1_usb_init(&palmtt_usb_config);314omap_register_i2c_bus(1, 100, NULL, 0);315}316317static void __init omap_palmtt_map_io(void)318{319omap1_map_common_io();320}321322MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")323.boot_params = 0x10000100,324.map_io = omap_palmtt_map_io,325.reserve = omap_reserve,326.init_irq = omap_palmtt_init_irq,327.init_machine = omap_palmtt_init,328.timer = &omap_timer,329MACHINE_END330331332