Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Hardware definitions for Palm Tungsten|T5
0004  *
0005  * Author:  Marek Vasut <marek.vasut@gmail.com>
0006  *
0007  * Based on work of:
0008  *      Ales Snuparek <snuparek@atlas.cz>
0009  *      Justin Kendrick <twilightsentry@gmail.com>
0010  *      RichardT5 <richard_t5@users.sourceforge.net>
0011  *
0012  * (find more info at www.hackndev.com)
0013  */
0014 
0015 #include <linux/platform_device.h>
0016 #include <linux/delay.h>
0017 #include <linux/irq.h>
0018 #include <linux/gpio_keys.h>
0019 #include <linux/input.h>
0020 #include <linux/memblock.h>
0021 #include <linux/pda_power.h>
0022 #include <linux/pwm_backlight.h>
0023 #include <linux/gpio.h>
0024 #include <linux/wm97xx.h>
0025 #include <linux/power_supply.h>
0026 
0027 #include <asm/mach-types.h>
0028 #include <asm/mach/arch.h>
0029 #include <asm/mach/map.h>
0030 
0031 #include "pxa27x.h"
0032 #include <linux/platform_data/asoc-pxa.h>
0033 #include "palmt5.h"
0034 #include <linux/platform_data/mmc-pxamci.h>
0035 #include <linux/platform_data/video-pxafb.h>
0036 #include <linux/platform_data/irda-pxaficp.h>
0037 #include <linux/platform_data/keypad-pxa27x.h>
0038 #include "udc.h"
0039 #include <linux/platform_data/asoc-palm27x.h>
0040 #include "palm27x.h"
0041 
0042 #include "generic.h"
0043 #include "devices.h"
0044 
0045 /******************************************************************************
0046  * Pin configuration
0047  ******************************************************************************/
0048 static unsigned long palmt5_pin_config[] __initdata = {
0049     /* MMC */
0050     GPIO32_MMC_CLK,
0051     GPIO92_MMC_DAT_0,
0052     GPIO109_MMC_DAT_1,
0053     GPIO110_MMC_DAT_2,
0054     GPIO111_MMC_DAT_3,
0055     GPIO112_MMC_CMD,
0056     GPIO14_GPIO,    /* SD detect */
0057     GPIO114_GPIO,   /* SD power */
0058     GPIO115_GPIO,   /* SD r/o switch */
0059 
0060     /* AC97 */
0061     GPIO28_AC97_BITCLK,
0062     GPIO29_AC97_SDATA_IN_0,
0063     GPIO30_AC97_SDATA_OUT,
0064     GPIO31_AC97_SYNC,
0065     GPIO89_AC97_SYSCLK,
0066     GPIO95_AC97_nRESET,
0067 
0068     /* IrDA */
0069     GPIO40_GPIO,    /* ir disable */
0070     GPIO46_FICP_RXD,
0071     GPIO47_FICP_TXD,
0072 
0073     /* USB */
0074     GPIO15_GPIO,    /* usb detect */
0075     GPIO93_GPIO,    /* usb power */
0076 
0077     /* MATRIX KEYPAD */
0078     GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
0079     GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
0080     GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
0081     GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
0082     GPIO103_KP_MKOUT_0,
0083     GPIO104_KP_MKOUT_1,
0084     GPIO105_KP_MKOUT_2,
0085 
0086     /* LCD */
0087     GPIOxx_LCD_TFT_16BPP,
0088 
0089     /* PWM */
0090     GPIO16_PWM0_OUT,
0091 
0092     /* FFUART */
0093     GPIO34_FFUART_RXD,
0094     GPIO39_FFUART_TXD,
0095 
0096     /* MISC */
0097     GPIO10_GPIO,    /* hotsync button */
0098     GPIO90_GPIO,    /* power detect */
0099     GPIO107_GPIO,   /* earphone detect */
0100 };
0101 
0102 /******************************************************************************
0103  * GPIO keyboard
0104  ******************************************************************************/
0105 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
0106 static const unsigned int palmt5_matrix_keys[] = {
0107     KEY(0, 0, KEY_POWER),
0108     KEY(0, 1, KEY_F1),
0109     KEY(0, 2, KEY_ENTER),
0110 
0111     KEY(1, 0, KEY_F2),
0112     KEY(1, 1, KEY_F3),
0113     KEY(1, 2, KEY_F4),
0114 
0115     KEY(2, 0, KEY_UP),
0116     KEY(2, 2, KEY_DOWN),
0117 
0118     KEY(3, 0, KEY_RIGHT),
0119     KEY(3, 2, KEY_LEFT),
0120 };
0121 
0122 static struct matrix_keymap_data palmt5_matrix_keymap_data = {
0123     .keymap         = palmt5_matrix_keys,
0124     .keymap_size        = ARRAY_SIZE(palmt5_matrix_keys),
0125 };
0126 
0127 static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
0128     .matrix_key_rows    = 4,
0129     .matrix_key_cols    = 3,
0130     .matrix_keymap_data = &palmt5_matrix_keymap_data,
0131 
0132     .debounce_interval  = 30,
0133 };
0134 
0135 static void __init palmt5_kpc_init(void)
0136 {
0137     pxa_set_keypad_info(&palmt5_keypad_platform_data);
0138 }
0139 #else
0140 static inline void palmt5_kpc_init(void) {}
0141 #endif
0142 
0143 /******************************************************************************
0144  * GPIO keys
0145  ******************************************************************************/
0146 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
0147 static struct gpio_keys_button palmt5_pxa_buttons[] = {
0148     {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
0149 };
0150 
0151 static struct gpio_keys_platform_data palmt5_pxa_keys_data = {
0152     .buttons    = palmt5_pxa_buttons,
0153     .nbuttons   = ARRAY_SIZE(palmt5_pxa_buttons),
0154 };
0155 
0156 static struct platform_device palmt5_pxa_keys = {
0157     .name   = "gpio-keys",
0158     .id = -1,
0159     .dev    = {
0160         .platform_data = &palmt5_pxa_keys_data,
0161     },
0162 };
0163 
0164 static void __init palmt5_keys_init(void)
0165 {
0166     platform_device_register(&palmt5_pxa_keys);
0167 }
0168 #else
0169 static inline void palmt5_keys_init(void) {}
0170 #endif
0171 
0172 /******************************************************************************
0173  * Machine init
0174  ******************************************************************************/
0175 static void __init palmt5_reserve(void)
0176 {
0177     memblock_reserve(0xa0200000, 0x1000);
0178 }
0179 
0180 static struct gpiod_lookup_table palmt5_mci_gpio_table = {
0181     .dev_id = "pxa2xx-mci.0",
0182     .table = {
0183         GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_DETECT_N,
0184                 "cd", GPIO_ACTIVE_LOW),
0185         GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY,
0186                 "wp", GPIO_ACTIVE_LOW),
0187         GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_POWER,
0188                 "power", GPIO_ACTIVE_HIGH),
0189         { },
0190     },
0191 };
0192 
0193 static struct gpiod_lookup_table palmt5_wm97xx_touch_gpio_table = {
0194     .dev_id = "wm97xx-touch",
0195     .table = {
0196         GPIO_LOOKUP("gpio-pxa", 27, "touch", GPIO_ACTIVE_HIGH),
0197         { },
0198     },
0199 };
0200 
0201 static void __init palmt5_init(void)
0202 {
0203     pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
0204     pxa_set_ffuart_info(NULL);
0205     pxa_set_btuart_info(NULL);
0206     pxa_set_stuart_info(NULL);
0207 
0208     palm27x_mmc_init(&palmt5_mci_gpio_table);
0209     gpiod_add_lookup_table(&palmt5_wm97xx_touch_gpio_table);
0210     palm27x_pm_init(PALMT5_STR_BASE);
0211     palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
0212     palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
0213             GPIO_NR_PALMT5_USB_PULLUP, 1);
0214     palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
0215     palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
0216             GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
0217     palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
0218     palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
0219     palm27x_pmic_init();
0220     palmt5_kpc_init();
0221     palmt5_keys_init();
0222 }
0223 
0224 MACHINE_START(PALMT5, "Palm Tungsten|T5")
0225     .atag_offset    = 0x100,
0226     .map_io     = pxa27x_map_io,
0227     .reserve    = palmt5_reserve,
0228     .nr_irqs    = PXA_NR_IRQS,
0229     .init_irq   = pxa27x_init_irq,
0230     .handle_irq = pxa27x_handle_irq,
0231     .init_time  = pxa_timer_init,
0232     .init_machine   = palmt5_init,
0233     .restart    = pxa_restart,
0234 MACHINE_END