Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 2 | /* |
| 3 | * linux/arch/arm/mach-pxa/palmtc.c |
| 4 | * |
| 5 | * Support for the Palm Tungsten|C |
| 6 | * |
| 7 | * Author: Marek Vasut <marek.vasut@gmail.com> |
| 8 | * |
| 9 | * Based on work of: |
| 10 | * Petr Blaha <p3t3@centrum.cz> |
| 11 | * Chetan S. Kumar <shivakumar.chetan@gmail.com> |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/delay.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/input.h> |
Thierry Reding | bfcb311 | 2015-10-05 10:49:50 +0200 | [diff] [blame] | 18 | #include <linux/pwm.h> |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 19 | #include <linux/pwm_backlight.h> |
Linus Walleij | 58e2d87 | 2018-12-02 09:43:23 +0100 | [diff] [blame] | 20 | #include <linux/gpio/machine.h> |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 21 | #include <linux/input/matrix_keypad.h> |
| 22 | #include <linux/ucb1400.h> |
| 23 | #include <linux/power_supply.h> |
| 24 | #include <linux/gpio_keys.h> |
| 25 | #include <linux/mtd/physmap.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 "pxa25x.h" |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 32 | #include <mach/audio.h> |
| 33 | #include <mach/palmtc.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> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 37 | #include "udc.h" |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 38 | |
| 39 | #include "generic.h" |
| 40 | #include "devices.h" |
| 41 | |
| 42 | /****************************************************************************** |
| 43 | * Pin configuration |
| 44 | ******************************************************************************/ |
| 45 | static unsigned long palmtc_pin_config[] __initdata = { |
| 46 | /* MMC */ |
| 47 | GPIO6_MMC_CLK, |
| 48 | GPIO8_MMC_CS0, |
| 49 | GPIO12_GPIO, /* detect */ |
| 50 | GPIO32_GPIO, /* power */ |
| 51 | GPIO54_GPIO, /* r/o switch */ |
| 52 | |
| 53 | /* PCMCIA */ |
| 54 | GPIO52_nPCE_1, |
| 55 | GPIO53_nPCE_2, |
| 56 | GPIO50_nPIOR, |
| 57 | GPIO51_nPIOW, |
| 58 | GPIO49_nPWE, |
| 59 | GPIO48_nPOE, |
| 60 | GPIO52_nPCE_1, |
| 61 | GPIO53_nPCE_2, |
| 62 | GPIO57_nIOIS16, |
| 63 | GPIO56_nPWAIT, |
| 64 | |
| 65 | /* AC97 */ |
| 66 | GPIO28_AC97_BITCLK, |
| 67 | GPIO29_AC97_SDATA_IN_0, |
| 68 | GPIO30_AC97_SDATA_OUT, |
| 69 | GPIO31_AC97_SYNC, |
| 70 | |
| 71 | /* IrDA */ |
| 72 | GPIO45_GPIO, /* ir disable */ |
| 73 | GPIO46_FICP_RXD, |
| 74 | GPIO47_FICP_TXD, |
| 75 | |
| 76 | /* PWM */ |
| 77 | GPIO17_PWM1_OUT, |
| 78 | |
| 79 | /* USB */ |
| 80 | GPIO4_GPIO, /* detect */ |
| 81 | GPIO36_GPIO, /* pullup */ |
| 82 | |
| 83 | /* LCD */ |
Eric Miao | 07bae6c | 2010-01-04 11:25:10 +0800 | [diff] [blame] | 84 | GPIOxx_LCD_TFT_16BPP, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 85 | |
| 86 | /* MATRIX KEYPAD */ |
| 87 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 0 */ |
| 88 | GPIO9_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 1 */ |
| 89 | GPIO10_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 2 */ |
| 90 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* in 3 */ |
| 91 | GPIO18_GPIO | MFP_LPM_DRIVE_LOW, /* out 0 */ |
| 92 | GPIO19_GPIO | MFP_LPM_DRIVE_LOW, /* out 1 */ |
| 93 | GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* out 2 */ |
| 94 | GPIO21_GPIO | MFP_LPM_DRIVE_LOW, /* out 3 */ |
| 95 | GPIO22_GPIO | MFP_LPM_DRIVE_LOW, /* out 4 */ |
| 96 | GPIO23_GPIO | MFP_LPM_DRIVE_LOW, /* out 5 */ |
| 97 | GPIO24_GPIO | MFP_LPM_DRIVE_LOW, /* out 6 */ |
| 98 | GPIO25_GPIO | MFP_LPM_DRIVE_LOW, /* out 7 */ |
| 99 | GPIO26_GPIO | MFP_LPM_DRIVE_LOW, /* out 8 */ |
| 100 | GPIO27_GPIO | MFP_LPM_DRIVE_LOW, /* out 9 */ |
| 101 | GPIO79_GPIO | MFP_LPM_DRIVE_LOW, /* out 10 */ |
| 102 | GPIO80_GPIO | MFP_LPM_DRIVE_LOW, /* out 11 */ |
| 103 | |
| 104 | /* PXA GPIO KEYS */ |
| 105 | GPIO7_GPIO | WAKEUP_ON_EDGE_BOTH, /* hotsync button on cradle */ |
| 106 | |
| 107 | /* MISC */ |
| 108 | GPIO1_RST, /* reset */ |
| 109 | GPIO2_GPIO, /* earphone detect */ |
| 110 | GPIO16_GPIO, /* backlight switch */ |
| 111 | }; |
| 112 | |
| 113 | /****************************************************************************** |
| 114 | * SD/MMC card controller |
| 115 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 116 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 117 | static struct pxamci_platform_data palmtc_mci_platform_data = { |
| 118 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
Eric Miao | f97cab2 | 2010-04-14 07:00:42 +0800 | [diff] [blame] | 119 | .detect_delay_ms = 200, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 120 | }; |
| 121 | |
Linus Walleij | 32d1544 | 2018-12-02 09:43:22 +0100 | [diff] [blame] | 122 | static struct gpiod_lookup_table palmtc_mci_gpio_table = { |
| 123 | .dev_id = "pxa2xx-mci.0", |
| 124 | .table = { |
| 125 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_DETECT_N, |
| 126 | "cd", GPIO_ACTIVE_LOW), |
| 127 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY, |
| 128 | "wp", GPIO_ACTIVE_LOW), |
Linus Walleij | f54005b | 2018-12-02 09:43:27 +0100 | [diff] [blame] | 129 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_POWER, |
| 130 | "power", GPIO_ACTIVE_HIGH), |
Linus Walleij | 32d1544 | 2018-12-02 09:43:22 +0100 | [diff] [blame] | 131 | { }, |
| 132 | }, |
| 133 | }; |
| 134 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 135 | static void __init palmtc_mmc_init(void) |
| 136 | { |
Linus Walleij | 32d1544 | 2018-12-02 09:43:22 +0100 | [diff] [blame] | 137 | gpiod_add_lookup_table(&palmtc_mci_gpio_table); |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 138 | pxa_set_mci_info(&palmtc_mci_platform_data); |
| 139 | } |
| 140 | #else |
| 141 | static inline void palmtc_mmc_init(void) {} |
| 142 | #endif |
| 143 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 144 | /****************************************************************************** |
| 145 | * GPIO keys |
| 146 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 147 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 148 | static struct gpio_keys_button palmtc_pxa_buttons[] = { |
| 149 | {KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1}, |
| 150 | }; |
| 151 | |
| 152 | static struct gpio_keys_platform_data palmtc_pxa_keys_data = { |
| 153 | .buttons = palmtc_pxa_buttons, |
| 154 | .nbuttons = ARRAY_SIZE(palmtc_pxa_buttons), |
| 155 | }; |
| 156 | |
| 157 | static struct platform_device palmtc_pxa_keys = { |
| 158 | .name = "gpio-keys", |
| 159 | .id = -1, |
| 160 | .dev = { |
| 161 | .platform_data = &palmtc_pxa_keys_data, |
| 162 | }, |
| 163 | }; |
| 164 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 165 | static void __init palmtc_keys_init(void) |
| 166 | { |
| 167 | platform_device_register(&palmtc_pxa_keys); |
| 168 | } |
| 169 | #else |
| 170 | static inline void palmtc_keys_init(void) {} |
| 171 | #endif |
| 172 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 173 | /****************************************************************************** |
| 174 | * Backlight |
| 175 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 176 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
Linus Walleij | 2644f91 | 2020-02-10 11:15:46 +0100 | [diff] [blame] | 177 | |
| 178 | static struct gpiod_lookup_table palmtc_pwm_bl_gpio_table = { |
| 179 | .dev_id = "pwm-backlight.0", |
| 180 | .table = { |
| 181 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_BL_POWER, |
| 182 | "enable", GPIO_ACTIVE_HIGH), |
| 183 | }, |
| 184 | }; |
| 185 | |
Thierry Reding | bfcb311 | 2015-10-05 10:49:50 +0200 | [diff] [blame] | 186 | static struct pwm_lookup palmtc_pwm_lookup[] = { |
| 187 | PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS, |
Thierry Reding | ca1ef9c | 2015-11-03 14:05:57 +0100 | [diff] [blame] | 188 | PWM_POLARITY_NORMAL), |
Thierry Reding | bfcb311 | 2015-10-05 10:49:50 +0200 | [diff] [blame] | 189 | }; |
| 190 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 191 | static struct platform_pwm_backlight_data palmtc_backlight_data = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 192 | .max_brightness = PALMTC_MAX_INTENSITY, |
| 193 | .dft_brightness = PALMTC_MAX_INTENSITY, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 194 | }; |
| 195 | |
| 196 | static struct platform_device palmtc_backlight = { |
| 197 | .name = "pwm-backlight", |
| 198 | .dev = { |
| 199 | .parent = &pxa25x_device_pwm1.dev, |
| 200 | .platform_data = &palmtc_backlight_data, |
| 201 | }, |
| 202 | }; |
| 203 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 204 | static void __init palmtc_pwm_init(void) |
| 205 | { |
Linus Walleij | 2644f91 | 2020-02-10 11:15:46 +0100 | [diff] [blame] | 206 | gpiod_add_lookup_table(&palmtc_pwm_bl_gpio_table); |
Thierry Reding | bfcb311 | 2015-10-05 10:49:50 +0200 | [diff] [blame] | 207 | pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup)); |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 208 | platform_device_register(&palmtc_backlight); |
| 209 | } |
| 210 | #else |
| 211 | static inline void palmtc_pwm_init(void) {} |
| 212 | #endif |
| 213 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 214 | /****************************************************************************** |
| 215 | * IrDA |
| 216 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 217 | #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 218 | static struct pxaficp_platform_data palmtc_ficp_platform_data = { |
Marek Vasut | c4bd017 | 2009-07-17 12:50:43 +0200 | [diff] [blame] | 219 | .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE, |
| 220 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 221 | }; |
| 222 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 223 | static void __init palmtc_irda_init(void) |
| 224 | { |
| 225 | pxa_set_ficp_info(&palmtc_ficp_platform_data); |
| 226 | } |
| 227 | #else |
| 228 | static inline void palmtc_irda_init(void) {} |
| 229 | #endif |
| 230 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 231 | /****************************************************************************** |
| 232 | * Keyboard |
| 233 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 234 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 235 | static const uint32_t palmtc_matrix_keys[] = { |
| 236 | KEY(0, 0, KEY_F1), |
| 237 | KEY(0, 1, KEY_X), |
| 238 | KEY(0, 2, KEY_POWER), |
| 239 | KEY(0, 3, KEY_TAB), |
| 240 | KEY(0, 4, KEY_A), |
| 241 | KEY(0, 5, KEY_Q), |
| 242 | KEY(0, 6, KEY_LEFTSHIFT), |
| 243 | KEY(0, 7, KEY_Z), |
| 244 | KEY(0, 8, KEY_S), |
| 245 | KEY(0, 9, KEY_W), |
| 246 | KEY(0, 10, KEY_E), |
| 247 | KEY(0, 11, KEY_UP), |
| 248 | |
| 249 | KEY(1, 0, KEY_F2), |
| 250 | KEY(1, 1, KEY_DOWN), |
| 251 | KEY(1, 3, KEY_D), |
| 252 | KEY(1, 4, KEY_C), |
| 253 | KEY(1, 5, KEY_F), |
| 254 | KEY(1, 6, KEY_R), |
| 255 | KEY(1, 7, KEY_SPACE), |
| 256 | KEY(1, 8, KEY_V), |
| 257 | KEY(1, 9, KEY_G), |
| 258 | KEY(1, 10, KEY_T), |
| 259 | KEY(1, 11, KEY_LEFT), |
| 260 | |
| 261 | KEY(2, 0, KEY_F3), |
| 262 | KEY(2, 1, KEY_LEFTCTRL), |
| 263 | KEY(2, 3, KEY_H), |
| 264 | KEY(2, 4, KEY_Y), |
| 265 | KEY(2, 5, KEY_N), |
| 266 | KEY(2, 6, KEY_J), |
| 267 | KEY(2, 7, KEY_U), |
| 268 | KEY(2, 8, KEY_M), |
| 269 | KEY(2, 9, KEY_K), |
| 270 | KEY(2, 10, KEY_I), |
| 271 | KEY(2, 11, KEY_RIGHT), |
| 272 | |
| 273 | KEY(3, 0, KEY_F4), |
| 274 | KEY(3, 1, KEY_ENTER), |
| 275 | KEY(3, 3, KEY_DOT), |
| 276 | KEY(3, 4, KEY_L), |
| 277 | KEY(3, 5, KEY_O), |
| 278 | KEY(3, 6, KEY_LEFTALT), |
| 279 | KEY(3, 7, KEY_ENTER), |
| 280 | KEY(3, 8, KEY_BACKSPACE), |
| 281 | KEY(3, 9, KEY_P), |
| 282 | KEY(3, 10, KEY_B), |
| 283 | KEY(3, 11, KEY_FN), |
| 284 | }; |
| 285 | |
| 286 | const struct matrix_keymap_data palmtc_keymap_data = { |
| 287 | .keymap = palmtc_matrix_keys, |
| 288 | .keymap_size = ARRAY_SIZE(palmtc_matrix_keys), |
| 289 | }; |
| 290 | |
Tobias Klauser | 600ae40 | 2010-05-20 10:31:46 +0200 | [diff] [blame] | 291 | static const unsigned int palmtc_keypad_row_gpios[] = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 292 | 0, 9, 10, 11 |
| 293 | }; |
| 294 | |
Tobias Klauser | 600ae40 | 2010-05-20 10:31:46 +0200 | [diff] [blame] | 295 | static const unsigned int palmtc_keypad_col_gpios[] = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 296 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 79, 80 |
| 297 | }; |
| 298 | |
| 299 | static struct matrix_keypad_platform_data palmtc_keypad_platform_data = { |
| 300 | .keymap_data = &palmtc_keymap_data, |
Ondrej Zajicek | 902805d | 2009-10-26 23:59:30 +0100 | [diff] [blame] | 301 | .row_gpios = palmtc_keypad_row_gpios, |
| 302 | .num_row_gpios = ARRAY_SIZE(palmtc_keypad_row_gpios), |
| 303 | .col_gpios = palmtc_keypad_col_gpios, |
| 304 | .num_col_gpios = ARRAY_SIZE(palmtc_keypad_col_gpios), |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 305 | .active_low = 1, |
| 306 | |
| 307 | .debounce_ms = 20, |
| 308 | .col_scan_delay_us = 5, |
| 309 | }; |
| 310 | |
| 311 | static struct platform_device palmtc_keyboard = { |
| 312 | .name = "matrix-keypad", |
| 313 | .id = -1, |
| 314 | .dev = { |
| 315 | .platform_data = &palmtc_keypad_platform_data, |
| 316 | }, |
| 317 | }; |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 318 | static void __init palmtc_mkp_init(void) |
| 319 | { |
| 320 | platform_device_register(&palmtc_keyboard); |
| 321 | } |
| 322 | #else |
| 323 | static inline void palmtc_mkp_init(void) {} |
| 324 | #endif |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 325 | |
| 326 | /****************************************************************************** |
| 327 | * UDC |
| 328 | ******************************************************************************/ |
Haojian Zhuang | c0a3915 | 2011-11-10 07:13:07 +0800 | [diff] [blame] | 329 | #if defined(CONFIG_USB_PXA25X)||defined(CONFIG_USB_PXA25X_MODULE) |
Linus Walleij | fdabc46 | 2020-01-23 16:50:13 +0100 | [diff] [blame] | 330 | static struct gpiod_lookup_table palmtc_udc_gpiod_table = { |
| 331 | .dev_id = "gpio-vbus", |
| 332 | .table = { |
| 333 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_DETECT_N, |
| 334 | "vbus", GPIO_ACTIVE_LOW), |
| 335 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_USB_POWER, |
| 336 | "pullup", GPIO_ACTIVE_HIGH), |
| 337 | { }, |
| 338 | }, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 339 | }; |
| 340 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 341 | static struct platform_device palmtc_gpio_vbus = { |
| 342 | .name = "gpio-vbus", |
| 343 | .id = -1, |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | static void __init palmtc_udc_init(void) |
| 347 | { |
Linus Walleij | fdabc46 | 2020-01-23 16:50:13 +0100 | [diff] [blame] | 348 | gpiod_add_lookup_table(&palmtc_udc_gpiod_table); |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 349 | platform_device_register(&palmtc_gpio_vbus); |
| 350 | }; |
| 351 | #else |
| 352 | static inline void palmtc_udc_init(void) {} |
| 353 | #endif |
| 354 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 355 | /****************************************************************************** |
| 356 | * Touchscreen / Battery / GPIO-extender |
| 357 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 358 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
| 359 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
| 360 | static struct platform_device palmtc_ucb1400_device = { |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 361 | .name = "ucb1400_core", |
| 362 | .id = -1, |
| 363 | }; |
| 364 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 365 | static void __init palmtc_ts_init(void) |
| 366 | { |
| 367 | pxa_set_ac97_info(NULL); |
| 368 | platform_device_register(&palmtc_ucb1400_device); |
| 369 | } |
| 370 | #else |
| 371 | static inline void palmtc_ts_init(void) {} |
| 372 | #endif |
| 373 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 374 | /****************************************************************************** |
Marek Vasut | 5fe2acc | 2010-08-09 06:13:06 +0200 | [diff] [blame] | 375 | * LEDs |
| 376 | ******************************************************************************/ |
| 377 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 378 | struct gpio_led palmtc_gpio_leds[] = { |
| 379 | { |
| 380 | .name = "palmtc:green:user", |
| 381 | .default_trigger = "none", |
| 382 | .gpio = GPIO_NR_PALMTC_LED_POWER, |
| 383 | .active_low = 1, |
| 384 | }, { |
| 385 | .name = "palmtc:vibra:vibra", |
| 386 | .default_trigger = "none", |
| 387 | .gpio = GPIO_NR_PALMTC_VIBRA_POWER, |
| 388 | .active_low = 1, |
| 389 | } |
| 390 | |
| 391 | }; |
| 392 | |
| 393 | static struct gpio_led_platform_data palmtc_gpio_led_info = { |
| 394 | .leds = palmtc_gpio_leds, |
| 395 | .num_leds = ARRAY_SIZE(palmtc_gpio_leds), |
| 396 | }; |
| 397 | |
| 398 | static struct platform_device palmtc_leds = { |
| 399 | .name = "leds-gpio", |
| 400 | .id = -1, |
| 401 | .dev = { |
| 402 | .platform_data = &palmtc_gpio_led_info, |
| 403 | } |
| 404 | }; |
| 405 | |
| 406 | static void __init palmtc_leds_init(void) |
| 407 | { |
| 408 | platform_device_register(&palmtc_leds); |
| 409 | } |
| 410 | #else |
| 411 | static inline void palmtc_leds_init(void) {} |
| 412 | #endif |
| 413 | |
| 414 | /****************************************************************************** |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 415 | * NOR Flash |
| 416 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 417 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 418 | static struct resource palmtc_flash_resource = { |
| 419 | .start = PXA_CS0_PHYS, |
| 420 | .end = PXA_CS0_PHYS + SZ_16M - 1, |
| 421 | .flags = IORESOURCE_MEM, |
| 422 | }; |
| 423 | |
| 424 | static struct mtd_partition palmtc_flash_parts[] = { |
| 425 | { |
| 426 | .name = "U-Boot Bootloader", |
| 427 | .offset = 0x0, |
| 428 | .size = 0x40000, |
| 429 | }, |
| 430 | { |
| 431 | .name = "Linux Kernel", |
| 432 | .offset = 0x40000, |
| 433 | .size = 0x2c0000, |
| 434 | }, |
| 435 | { |
| 436 | .name = "Filesystem", |
| 437 | .offset = 0x300000, |
| 438 | .size = 0xcc0000, |
| 439 | }, |
| 440 | { |
| 441 | .name = "U-Boot Environment", |
| 442 | .offset = 0xfc0000, |
| 443 | .size = MTDPART_SIZ_FULL, |
| 444 | }, |
| 445 | }; |
| 446 | |
| 447 | static struct physmap_flash_data palmtc_flash_data = { |
| 448 | .width = 4, |
| 449 | .parts = palmtc_flash_parts, |
| 450 | .nr_parts = ARRAY_SIZE(palmtc_flash_parts), |
| 451 | }; |
| 452 | |
| 453 | static struct platform_device palmtc_flash = { |
| 454 | .name = "physmap-flash", |
| 455 | .id = -1, |
| 456 | .resource = &palmtc_flash_resource, |
| 457 | .num_resources = 1, |
| 458 | .dev = { |
| 459 | .platform_data = &palmtc_flash_data, |
| 460 | }, |
| 461 | }; |
| 462 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 463 | static void __init palmtc_nor_init(void) |
| 464 | { |
| 465 | platform_device_register(&palmtc_flash); |
| 466 | } |
| 467 | #else |
| 468 | static inline void palmtc_nor_init(void) {} |
| 469 | #endif |
| 470 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 471 | /****************************************************************************** |
| 472 | * Framebuffer |
| 473 | ******************************************************************************/ |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 474 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 475 | static struct pxafb_mode_info palmtc_lcd_modes[] = { |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 476 | { |
| 477 | .pixclock = 115384, |
| 478 | .xres = 320, |
| 479 | .yres = 320, |
| 480 | .bpp = 16, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 481 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 482 | .left_margin = 27, |
| 483 | .right_margin = 7, |
| 484 | .upper_margin = 7, |
| 485 | .lower_margin = 8, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 486 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 487 | .hsync_len = 6, |
| 488 | .vsync_len = 1, |
| 489 | }, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 490 | }; |
| 491 | |
| 492 | static struct pxafb_mach_info palmtc_lcd_screen = { |
| 493 | .modes = palmtc_lcd_modes, |
| 494 | .num_modes = ARRAY_SIZE(palmtc_lcd_modes), |
| 495 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
| 496 | }; |
| 497 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 498 | static void __init palmtc_lcd_init(void) |
| 499 | { |
Russell King - ARM Linux | 4321e1a | 2011-02-15 15:37:30 +0800 | [diff] [blame] | 500 | pxa_set_fb_info(NULL, &palmtc_lcd_screen); |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 501 | } |
| 502 | #else |
| 503 | static inline void palmtc_lcd_init(void) {} |
| 504 | #endif |
| 505 | |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 506 | /****************************************************************************** |
| 507 | * Machine init |
| 508 | ******************************************************************************/ |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 509 | static void __init palmtc_init(void) |
| 510 | { |
| 511 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config)); |
| 512 | |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 513 | pxa_set_ffuart_info(NULL); |
| 514 | pxa_set_btuart_info(NULL); |
| 515 | pxa_set_stuart_info(NULL); |
| 516 | pxa_set_hwuart_info(NULL); |
| 517 | |
Marek Vasut | 4c6a832 | 2010-08-09 05:01:45 +0200 | [diff] [blame] | 518 | palmtc_mmc_init(); |
| 519 | palmtc_keys_init(); |
| 520 | palmtc_pwm_init(); |
| 521 | palmtc_irda_init(); |
| 522 | palmtc_mkp_init(); |
| 523 | palmtc_udc_init(); |
| 524 | palmtc_ts_init(); |
| 525 | palmtc_nor_init(); |
| 526 | palmtc_lcd_init(); |
Marek Vasut | 5fe2acc | 2010-08-09 06:13:06 +0200 | [diff] [blame] | 527 | palmtc_leds_init(); |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | MACHINE_START(PALMTC, "Palm Tungsten|C") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 531 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 532 | .map_io = pxa25x_map_io, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 533 | .nr_irqs = PXA_NR_IRQS, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 534 | .init_irq = pxa25x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 535 | .handle_irq = pxa25x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 536 | .init_time = pxa_timer_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 537 | .init_machine = palmtc_init, |
| 538 | .restart = pxa_restart, |
Marek Vasut | 5d783a2 | 2009-07-16 13:26:48 +0200 | [diff] [blame] | 539 | MACHINE_END |