Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Hardware definitions for Palm Tungsten|T5 |
| 4 | * |
| 5 | * Author: Marek Vasut <marek.vasut@gmail.com> |
| 6 | * |
| 7 | * Based on work of: |
| 8 | * Ales Snuparek <snuparek@atlas.cz> |
| 9 | * Justin Kendrick <twilightsentry@gmail.com> |
| 10 | * RichardT5 <richard_t5@users.sourceforge.net> |
| 11 | * |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 12 | * (find more info at www.hackndev.com) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/delay.h> |
| 17 | #include <linux/irq.h> |
| 18 | #include <linux/gpio_keys.h> |
| 19 | #include <linux/input.h> |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 20 | #include <linux/memblock.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 21 | #include <linux/pda_power.h> |
| 22 | #include <linux/pwm_backlight.h> |
| 23 | #include <linux/gpio.h> |
Marek Vasut | 241cf47 | 2010-06-04 03:07:33 +0200 | [diff] [blame] | 24 | #include <linux/wm97xx.h> |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 25 | #include <linux/power_supply.h> |
| 26 | |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 31 | #include "pxa27x.h" |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 32 | #include <mach/audio.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 33 | #include "palmt5.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 34 | #include <linux/platform_data/mmc-pxamci.h> |
| 35 | #include <linux/platform_data/video-pxafb.h> |
| 36 | #include <linux/platform_data/irda-pxaficp.h> |
| 37 | #include <linux/platform_data/keypad-pxa27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 38 | #include "udc.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 39 | #include <linux/platform_data/asoc-palm27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 40 | #include "palm27x.h" |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 41 | |
| 42 | #include "generic.h" |
| 43 | #include "devices.h" |
| 44 | |
| 45 | /****************************************************************************** |
| 46 | * Pin configuration |
| 47 | ******************************************************************************/ |
| 48 | static unsigned long palmt5_pin_config[] __initdata = { |
| 49 | /* MMC */ |
| 50 | GPIO32_MMC_CLK, |
| 51 | GPIO92_MMC_DAT_0, |
| 52 | GPIO109_MMC_DAT_1, |
| 53 | GPIO110_MMC_DAT_2, |
| 54 | GPIO111_MMC_DAT_3, |
| 55 | GPIO112_MMC_CMD, |
| 56 | GPIO14_GPIO, /* SD detect */ |
| 57 | GPIO114_GPIO, /* SD power */ |
| 58 | GPIO115_GPIO, /* SD r/o switch */ |
| 59 | |
| 60 | /* AC97 */ |
| 61 | GPIO28_AC97_BITCLK, |
| 62 | GPIO29_AC97_SDATA_IN_0, |
| 63 | GPIO30_AC97_SDATA_OUT, |
| 64 | GPIO31_AC97_SYNC, |
Marek Vasut | 6ec04f4 | 2009-05-22 01:39:10 +0200 | [diff] [blame] | 65 | GPIO89_AC97_SYSCLK, |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 66 | GPIO95_AC97_nRESET, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 67 | |
| 68 | /* IrDA */ |
| 69 | GPIO40_GPIO, /* ir disable */ |
| 70 | GPIO46_FICP_RXD, |
| 71 | GPIO47_FICP_TXD, |
| 72 | |
| 73 | /* USB */ |
| 74 | GPIO15_GPIO, /* usb detect */ |
Marek Vasut | efb12cd | 2009-04-12 16:37:23 +0200 | [diff] [blame] | 75 | GPIO93_GPIO, /* usb power */ |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 76 | |
| 77 | /* MATRIX KEYPAD */ |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 78 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 79 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 80 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 81 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 82 | GPIO103_KP_MKOUT_0, |
| 83 | GPIO104_KP_MKOUT_1, |
| 84 | GPIO105_KP_MKOUT_2, |
| 85 | |
| 86 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 87 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 88 | |
| 89 | /* PWM */ |
| 90 | GPIO16_PWM0_OUT, |
| 91 | |
Marek Vasut | ecf763c | 2009-07-16 19:37:29 +0200 | [diff] [blame] | 92 | /* FFUART */ |
| 93 | GPIO34_FFUART_RXD, |
| 94 | GPIO39_FFUART_TXD, |
| 95 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 96 | /* MISC */ |
| 97 | GPIO10_GPIO, /* hotsync button */ |
| 98 | GPIO90_GPIO, /* power detect */ |
| 99 | GPIO107_GPIO, /* earphone detect */ |
| 100 | }; |
| 101 | |
| 102 | /****************************************************************************** |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 103 | * GPIO keyboard |
| 104 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 105 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 106 | static const unsigned int palmt5_matrix_keys[] = { |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 107 | KEY(0, 0, KEY_POWER), |
| 108 | KEY(0, 1, KEY_F1), |
| 109 | KEY(0, 2, KEY_ENTER), |
| 110 | |
| 111 | KEY(1, 0, KEY_F2), |
| 112 | KEY(1, 1, KEY_F3), |
| 113 | KEY(1, 2, KEY_F4), |
| 114 | |
| 115 | KEY(2, 0, KEY_UP), |
| 116 | KEY(2, 2, KEY_DOWN), |
| 117 | |
| 118 | KEY(3, 0, KEY_RIGHT), |
| 119 | KEY(3, 2, KEY_LEFT), |
| 120 | }; |
| 121 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 122 | static struct matrix_keymap_data palmt5_matrix_keymap_data = { |
| 123 | .keymap = palmt5_matrix_keys, |
| 124 | .keymap_size = ARRAY_SIZE(palmt5_matrix_keys), |
| 125 | }; |
| 126 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 127 | static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { |
| 128 | .matrix_key_rows = 4, |
| 129 | .matrix_key_cols = 3, |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 130 | .matrix_keymap_data = &palmt5_matrix_keymap_data, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 131 | |
| 132 | .debounce_interval = 30, |
| 133 | }; |
| 134 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 135 | static void __init palmt5_kpc_init(void) |
| 136 | { |
| 137 | pxa_set_keypad_info(&palmt5_keypad_platform_data); |
| 138 | } |
| 139 | #else |
| 140 | static inline void palmt5_kpc_init(void) {} |
| 141 | #endif |
| 142 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 143 | /****************************************************************************** |
| 144 | * GPIO keys |
| 145 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 146 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 147 | static struct gpio_keys_button palmt5_pxa_buttons[] = { |
| 148 | {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, |
| 149 | }; |
| 150 | |
| 151 | static struct gpio_keys_platform_data palmt5_pxa_keys_data = { |
| 152 | .buttons = palmt5_pxa_buttons, |
| 153 | .nbuttons = ARRAY_SIZE(palmt5_pxa_buttons), |
| 154 | }; |
| 155 | |
| 156 | static struct platform_device palmt5_pxa_keys = { |
| 157 | .name = "gpio-keys", |
| 158 | .id = -1, |
| 159 | .dev = { |
| 160 | .platform_data = &palmt5_pxa_keys_data, |
| 161 | }, |
| 162 | }; |
| 163 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 164 | static void __init palmt5_keys_init(void) |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 165 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 166 | platform_device_register(&palmt5_pxa_keys); |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 167 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 168 | #else |
| 169 | static inline void palmt5_keys_init(void) {} |
| 170 | #endif |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 171 | |
Marek Vasut | 81854f8 | 2009-03-28 12:37:42 +0100 | [diff] [blame] | 172 | /****************************************************************************** |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 173 | * Machine init |
| 174 | ******************************************************************************/ |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 175 | static void __init palmt5_reserve(void) |
| 176 | { |
Russell King | 8d717a5 | 2010-05-22 19:47:18 +0100 | [diff] [blame] | 177 | memblock_reserve(0xa0200000, 0x1000); |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 178 | } |
| 179 | |
Linus Walleij | 58e2d87 | 2018-12-02 09:43:23 +0100 | [diff] [blame] | 180 | static struct gpiod_lookup_table palmt5_mci_gpio_table = { |
| 181 | .dev_id = "pxa2xx-mci.0", |
| 182 | .table = { |
| 183 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_DETECT_N, |
| 184 | "cd", GPIO_ACTIVE_LOW), |
| 185 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY, |
| 186 | "wp", GPIO_ACTIVE_LOW), |
Linus Walleij | f54005b | 2018-12-02 09:43:27 +0100 | [diff] [blame] | 187 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_POWER, |
| 188 | "power", GPIO_ACTIVE_HIGH), |
Linus Walleij | 58e2d87 | 2018-12-02 09:43:23 +0100 | [diff] [blame] | 189 | { }, |
| 190 | }, |
| 191 | }; |
| 192 | |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 193 | static void __init palmt5_init(void) |
| 194 | { |
| 195 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 196 | pxa_set_ffuart_info(NULL); |
| 197 | pxa_set_btuart_info(NULL); |
| 198 | pxa_set_stuart_info(NULL); |
| 199 | |
Linus Walleij | f54005b | 2018-12-02 09:43:27 +0100 | [diff] [blame] | 200 | palm27x_mmc_init(&palmt5_mci_gpio_table); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 201 | palm27x_pm_init(PALMT5_STR_BASE); |
| 202 | palm27x_lcd_init(-1, &palm_320x480_lcd_mode); |
| 203 | palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, |
| 204 | GPIO_NR_PALMT5_USB_PULLUP, 1); |
| 205 | palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE); |
| 206 | palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE, |
| 207 | GPIO_NR_PALMT5_EARPHONE_DETECT, 95); |
| 208 | palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER); |
| 209 | palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1); |
| 210 | palm27x_pmic_init(); |
| 211 | palmt5_kpc_init(); |
| 212 | palmt5_keys_init(); |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | MACHINE_START(PALMT5, "Palm Tungsten|T5") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 216 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 217 | .map_io = pxa27x_map_io, |
Russell King | 98c672c | 2010-05-22 18:18:57 +0100 | [diff] [blame] | 218 | .reserve = palmt5_reserve, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 219 | .nr_irqs = PXA_NR_IRQS, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 220 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 221 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 222 | .init_time = pxa_timer_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 223 | .init_machine = palmt5_init, |
| 224 | .restart = pxa_restart, |
Marek Vasut | 0f6ff0f | 2008-11-20 00:58:38 +0100 | [diff] [blame] | 225 | MACHINE_END |