Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * linux/arch/arm/mach-omap1/board-palmte.c
0004  *
0005  * Modified from board-generic.c
0006  *
0007  * Support for the Palm Tungsten E PDA.
0008  *
0009  * Original version : Laurent Gonzalez
0010  *
0011  * Maintainers : http://palmtelinux.sf.net
0012  *                palmtelinux-developpers@lists.sf.net
0013  *
0014  * Copyright (c) 2006 Andrzej Zaborowski  <balrog@zabor.org>
0015  */
0016 #include <linux/gpio.h>
0017 #include <linux/kernel.h>
0018 #include <linux/init.h>
0019 #include <linux/input.h>
0020 #include <linux/platform_device.h>
0021 #include <linux/mtd/mtd.h>
0022 #include <linux/mtd/partitions.h>
0023 #include <linux/mtd/physmap.h>
0024 #include <linux/spi/spi.h>
0025 #include <linux/interrupt.h>
0026 #include <linux/apm-emulation.h>
0027 #include <linux/omapfb.h>
0028 #include <linux/omap-dma.h>
0029 #include <linux/platform_data/keypad-omap.h>
0030 #include <linux/platform_data/omap1_bl.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 "mmc.h"
0042 #include "common.h"
0043 
0044 #define PALMTE_USBDETECT_GPIO   0
0045 #define PALMTE_USB_OR_DC_GPIO   1
0046 #define PALMTE_TSC_GPIO     4
0047 #define PALMTE_PINTDAV_GPIO 6
0048 #define PALMTE_MMC_WP_GPIO  8
0049 #define PALMTE_MMC_POWER_GPIO   9
0050 #define PALMTE_HDQ_GPIO     11
0051 #define PALMTE_HEADPHONES_GPIO  14
0052 #define PALMTE_SPEAKER_GPIO 15
0053 #define PALMTE_DC_GPIO      OMAP_MPUIO(2)
0054 #define PALMTE_MMC_SWITCH_GPIO  OMAP_MPUIO(4)
0055 #define PALMTE_MMC1_GPIO    OMAP_MPUIO(6)
0056 #define PALMTE_MMC2_GPIO    OMAP_MPUIO(7)
0057 #define PALMTE_MMC3_GPIO    OMAP_MPUIO(11)
0058 
0059 static const unsigned int palmte_keymap[] = {
0060     KEY(0, 0, KEY_F1),      /* Calendar */
0061     KEY(1, 0, KEY_F2),      /* Contacts */
0062     KEY(2, 0, KEY_F3),      /* Tasks List */
0063     KEY(3, 0, KEY_F4),      /* Note Pad */
0064     KEY(4, 0, KEY_POWER),
0065     KEY(0, 1, KEY_LEFT),
0066     KEY(1, 1, KEY_DOWN),
0067     KEY(2, 1, KEY_UP),
0068     KEY(3, 1, KEY_RIGHT),
0069     KEY(4, 1, KEY_ENTER),
0070 };
0071 
0072 static const struct matrix_keymap_data palmte_keymap_data = {
0073     .keymap     = palmte_keymap,
0074     .keymap_size    = ARRAY_SIZE(palmte_keymap),
0075 };
0076 
0077 static struct omap_kp_platform_data palmte_kp_data = {
0078     .rows   = 8,
0079     .cols   = 8,
0080     .keymap_data = &palmte_keymap_data,
0081     .rep    = true,
0082     .delay  = 12,
0083 };
0084 
0085 static struct resource palmte_kp_resources[] = {
0086     [0] = {
0087         .start  = INT_KEYBOARD,
0088         .end    = INT_KEYBOARD,
0089         .flags  = IORESOURCE_IRQ,
0090     },
0091 };
0092 
0093 static struct platform_device palmte_kp_device = {
0094     .name       = "omap-keypad",
0095     .id     = -1,
0096     .dev        = {
0097         .platform_data  = &palmte_kp_data,
0098     },
0099     .num_resources  = ARRAY_SIZE(palmte_kp_resources),
0100     .resource   = palmte_kp_resources,
0101 };
0102 
0103 static struct mtd_partition palmte_rom_partitions[] = {
0104     /* PalmOS "Small ROM", contains the bootloader and the debugger */
0105     {
0106         .name       = "smallrom",
0107         .offset     = 0,
0108         .size       = 0xa000,
0109         .mask_flags = MTD_WRITEABLE,
0110     },
0111     /* PalmOS "Big ROM", a filesystem with all the OS code and data */
0112     {
0113         .name       = "bigrom",
0114         .offset     = SZ_128K,
0115         /*
0116          * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
0117          * 0x7b0000 bytes in the English-only ("enUS") version.
0118          */
0119         .size       = 0x7b0000,
0120         .mask_flags = MTD_WRITEABLE,
0121     },
0122 };
0123 
0124 static struct physmap_flash_data palmte_rom_data = {
0125     .width      = 2,
0126     .set_vpp    = omap1_set_vpp,
0127     .parts      = palmte_rom_partitions,
0128     .nr_parts   = ARRAY_SIZE(palmte_rom_partitions),
0129 };
0130 
0131 static struct resource palmte_rom_resource = {
0132     .start      = OMAP_CS0_PHYS,
0133     .end        = OMAP_CS0_PHYS + SZ_8M - 1,
0134     .flags      = IORESOURCE_MEM,
0135 };
0136 
0137 static struct platform_device palmte_rom_device = {
0138     .name       = "physmap-flash",
0139     .id     = -1,
0140     .dev        = {
0141         .platform_data  = &palmte_rom_data,
0142     },
0143     .num_resources  = 1,
0144     .resource   = &palmte_rom_resource,
0145 };
0146 
0147 static struct platform_device palmte_lcd_device = {
0148     .name       = "lcd_palmte",
0149     .id     = -1,
0150 };
0151 
0152 static struct omap_backlight_config palmte_backlight_config = {
0153     .default_intensity  = 0xa0,
0154 };
0155 
0156 static struct platform_device palmte_backlight_device = {
0157     .name       = "omap-bl",
0158     .id     = -1,
0159     .dev        = {
0160         .platform_data  = &palmte_backlight_config,
0161     },
0162 };
0163 
0164 static struct platform_device *palmte_devices[] __initdata = {
0165     &palmte_rom_device,
0166     &palmte_kp_device,
0167     &palmte_lcd_device,
0168     &palmte_backlight_device,
0169 };
0170 
0171 static struct omap_usb_config palmte_usb_config __initdata = {
0172     .register_dev   = 1,    /* Mini-B only receptacle */
0173     .hmc_mode   = 0,
0174     .pins[0]    = 2,
0175 };
0176 
0177 static const struct omap_lcd_config palmte_lcd_config __initconst = {
0178     .ctrl_name  = "internal",
0179 };
0180 
0181 static struct spi_board_info palmte_spi_info[] __initdata = {
0182     {
0183         .modalias   = "tsc2102",
0184         .bus_num    = 2,    /* uWire (officially) */
0185         .chip_select    = 0,    /* As opposed to 3 */
0186         .max_speed_hz   = 8000000,
0187     },
0188 };
0189 
0190 static void __init palmte_misc_gpio_setup(void)
0191 {
0192     /* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
0193     if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
0194         printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
0195         return;
0196     }
0197     gpio_direction_input(PALMTE_PINTDAV_GPIO);
0198 
0199     /* Set USB-or-DC-IN pin as input (unused) */
0200     if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
0201         printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
0202         return;
0203     }
0204     gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
0205 }
0206 
0207 #if IS_ENABLED(CONFIG_MMC_OMAP)
0208 
0209 static struct omap_mmc_platform_data _palmte_mmc_config = {
0210     .nr_slots           = 1,
0211     .slots[0]           = {
0212         .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
0213         .name           = "mmcblk",
0214     },
0215 };
0216 
0217 static struct omap_mmc_platform_data *palmte_mmc_config[OMAP15XX_NR_MMC] = {
0218     [0] = &_palmte_mmc_config,
0219 };
0220 
0221 static void palmte_mmc_init(void)
0222 {
0223     omap1_init_mmc(palmte_mmc_config, OMAP15XX_NR_MMC);
0224 }
0225 
0226 #else /* CONFIG_MMC_OMAP */
0227 
0228 static void palmte_mmc_init(void)
0229 {
0230 }
0231 
0232 #endif /* CONFIG_MMC_OMAP */
0233 
0234 static void __init omap_palmte_init(void)
0235 {
0236     /* mux pins for uarts */
0237     omap_cfg_reg(UART1_TX);
0238     omap_cfg_reg(UART1_RTS);
0239     omap_cfg_reg(UART2_TX);
0240     omap_cfg_reg(UART2_RTS);
0241     omap_cfg_reg(UART3_TX);
0242     omap_cfg_reg(UART3_RX);
0243 
0244     platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
0245 
0246     palmte_spi_info[0].irq = gpio_to_irq(PALMTE_PINTDAV_GPIO);
0247     spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
0248     palmte_misc_gpio_setup();
0249     omap_serial_init();
0250     omap1_usb_init(&palmte_usb_config);
0251     omap_register_i2c_bus(1, 100, NULL, 0);
0252 
0253     omapfb_set_lcd_config(&palmte_lcd_config);
0254     palmte_mmc_init();
0255 }
0256 
0257 MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
0258     .atag_offset    = 0x100,
0259     .map_io     = omap15xx_map_io,
0260     .init_early     = omap1_init_early,
0261     .init_irq   = omap1_init_irq,
0262     .handle_irq = omap1_handle_irq,
0263     .init_machine   = omap_palmte_init,
0264     .init_late  = omap1_init_late,
0265     .init_time  = omap1_timer_init,
0266     .restart    = omap1_restart,
0267 MACHINE_END