1 // SPDX-License-Identifier: GPL-2.0-only
3 * Hardware definitions for PalmTX
5 * Author: Marek Vasut <marek.vasut@gmail.com>
8 * Alex Osborne <ato@meshy.org>
9 * Cristiano P. <cristianop@users.sourceforge.net>
10 * Jan Herman <2hp@seznam.cz>
13 * (find more info at www.hackndev.com)
16 #include <linux/platform_device.h>
17 #include <linux/delay.h>
18 #include <linux/irq.h>
19 #include <linux/gpio_keys.h>
20 #include <linux/input.h>
21 #include <linux/pda_power.h>
22 #include <linux/pwm_backlight.h>
23 #include <linux/gpio.h>
24 #include <linux/wm97xx.h>
25 #include <linux/power_supply.h>
26 #include <linux/mtd/platnand.h>
27 #include <linux/mtd/mtd.h>
28 #include <linux/mtd/physmap.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
35 #include <mach/audio.h>
36 #include <mach/palmtx.h>
37 #include <linux/platform_data/mmc-pxamci.h>
38 #include <linux/platform_data/video-pxafb.h>
39 #include <linux/platform_data/irda-pxaficp.h>
40 #include <linux/platform_data/keypad-pxa27x.h>
42 #include <linux/platform_data/asoc-palm27x.h>
48 /******************************************************************************
50 ******************************************************************************/
51 static unsigned long palmtx_pin_config
[] __initdata
= {
59 GPIO14_GPIO
, /* SD detect */
60 GPIO114_GPIO
, /* SD power */
61 GPIO115_GPIO
, /* SD r/o switch */
65 GPIO29_AC97_SDATA_IN_0
,
66 GPIO30_AC97_SDATA_OUT
,
72 GPIO40_GPIO
, /* ir disable */
80 GPIO13_GPIO
, /* usb detect */
81 GPIO93_GPIO
, /* usb power */
94 GPIO94_GPIO
, /* wifi power 1 */
95 GPIO108_GPIO
, /* wifi power 2 */
96 GPIO116_GPIO
, /* wifi ready */
99 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
100 GPIO101_KP_MKIN_1
| WAKEUP_ON_LEVEL_HIGH
,
101 GPIO102_KP_MKIN_2
| WAKEUP_ON_LEVEL_HIGH
,
102 GPIO97_KP_MKIN_3
| WAKEUP_ON_LEVEL_HIGH
,
108 GPIOxx_LCD_TFT_16BPP
,
119 GPIO10_GPIO
, /* hotsync button */
120 GPIO12_GPIO
, /* power detect */
121 GPIO107_GPIO
, /* earphone detect */
124 /******************************************************************************
126 ******************************************************************************/
127 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
128 static struct mtd_partition palmtx_partitions
[] = {
131 .offset
= 0x00000000,
132 .size
= MTDPART_SIZ_FULL
,
137 static struct physmap_flash_data palmtx_flash_data
[] = {
139 .width
= 2, /* bankwidth in bytes */
140 .parts
= palmtx_partitions
,
141 .nr_parts
= ARRAY_SIZE(palmtx_partitions
)
145 static struct resource palmtx_flash_resource
= {
146 .start
= PXA_CS0_PHYS
,
147 .end
= PXA_CS0_PHYS
+ SZ_8M
- 1,
148 .flags
= IORESOURCE_MEM
,
151 static struct platform_device palmtx_flash
= {
152 .name
= "physmap-flash",
154 .resource
= &palmtx_flash_resource
,
157 .platform_data
= palmtx_flash_data
,
161 static void __init
palmtx_nor_init(void)
163 platform_device_register(&palmtx_flash
);
166 static inline void palmtx_nor_init(void) {}
169 /******************************************************************************
171 ******************************************************************************/
172 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
173 static const unsigned int palmtx_matrix_keys
[] = {
174 KEY(0, 0, KEY_POWER
),
176 KEY(0, 2, KEY_ENTER
),
185 KEY(3, 0, KEY_RIGHT
),
189 static struct matrix_keymap_data palmtx_matrix_keymap_data
= {
190 .keymap
= palmtx_matrix_keys
,
191 .keymap_size
= ARRAY_SIZE(palmtx_matrix_keys
),
194 static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data
= {
195 .matrix_key_rows
= 4,
196 .matrix_key_cols
= 3,
197 .matrix_keymap_data
= &palmtx_matrix_keymap_data
,
199 .debounce_interval
= 30,
202 static void __init
palmtx_kpc_init(void)
204 pxa_set_keypad_info(&palmtx_keypad_platform_data
);
207 static inline void palmtx_kpc_init(void) {}
210 /******************************************************************************
212 ******************************************************************************/
213 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
214 static struct gpio_keys_button palmtx_pxa_buttons
[] = {
215 {KEY_F8
, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N
, 1, "HotSync Button" },
218 static struct gpio_keys_platform_data palmtx_pxa_keys_data
= {
219 .buttons
= palmtx_pxa_buttons
,
220 .nbuttons
= ARRAY_SIZE(palmtx_pxa_buttons
),
223 static struct platform_device palmtx_pxa_keys
= {
227 .platform_data
= &palmtx_pxa_keys_data
,
231 static void __init
palmtx_keys_init(void)
233 platform_device_register(&palmtx_pxa_keys
);
236 static inline void palmtx_keys_init(void) {}
239 /******************************************************************************
241 ******************************************************************************/
242 #if defined(CONFIG_MTD_NAND_PLATFORM) || \
243 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
244 static void palmtx_nand_cmd_ctl(struct nand_chip
*this, int cmd
,
247 char __iomem
*nandaddr
= this->legacy
.IO_ADDR_W
;
249 if (cmd
== NAND_CMD_NONE
)
253 writeb(cmd
, PALMTX_NAND_CLE_VIRT
);
254 else if (ctrl
& NAND_ALE
)
255 writeb(cmd
, PALMTX_NAND_ALE_VIRT
);
257 writeb(cmd
, nandaddr
);
260 static struct mtd_partition palmtx_partition_info
[] = {
264 .size
= MTDPART_SIZ_FULL
268 struct platform_nand_data palmtx_nand_platdata
= {
272 .nr_partitions
= ARRAY_SIZE(palmtx_partition_info
),
273 .partitions
= palmtx_partition_info
,
277 .cmd_ctrl
= palmtx_nand_cmd_ctl
,
281 static struct resource palmtx_nand_resource
[] = {
283 .start
= PXA_CS1_PHYS
,
284 .end
= PXA_CS1_PHYS
+ SZ_1M
- 1,
285 .flags
= IORESOURCE_MEM
,
289 static struct platform_device palmtx_nand
= {
291 .num_resources
= ARRAY_SIZE(palmtx_nand_resource
),
292 .resource
= palmtx_nand_resource
,
295 .platform_data
= &palmtx_nand_platdata
,
299 static void __init
palmtx_nand_init(void)
301 platform_device_register(&palmtx_nand
);
304 static inline void palmtx_nand_init(void) {}
307 /******************************************************************************
309 ******************************************************************************/
310 static struct map_desc palmtx_io_desc
[] __initdata
= {
312 .virtual = (unsigned long)PALMTX_PCMCIA_VIRT
,
313 .pfn
= __phys_to_pfn(PALMTX_PCMCIA_PHYS
),
314 .length
= PALMTX_PCMCIA_SIZE
,
317 .virtual = (unsigned long)PALMTX_NAND_ALE_VIRT
,
318 .pfn
= __phys_to_pfn(PALMTX_NAND_ALE_PHYS
),
322 .virtual = (unsigned long)PALMTX_NAND_CLE_VIRT
,
323 .pfn
= __phys_to_pfn(PALMTX_NAND_CLE_PHYS
),
329 static void __init
palmtx_map_io(void)
332 iotable_init(palmtx_io_desc
, ARRAY_SIZE(palmtx_io_desc
));
335 static struct gpiod_lookup_table palmtx_mci_gpio_table
= {
336 .dev_id
= "pxa2xx-mci.0",
338 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_DETECT_N
,
339 "cd", GPIO_ACTIVE_LOW
),
340 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY
,
341 "wp", GPIO_ACTIVE_LOW
),
342 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_POWER
,
343 "power", GPIO_ACTIVE_HIGH
),
348 static void __init
palmtx_init(void)
350 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config
));
351 pxa_set_ffuart_info(NULL
);
352 pxa_set_btuart_info(NULL
);
353 pxa_set_stuart_info(NULL
);
355 palm27x_mmc_init(&palmtx_mci_gpio_table
);
356 palm27x_pm_init(PALMTX_STR_BASE
);
357 palm27x_lcd_init(-1, &palm_320x480_lcd_mode
);
358 palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N
,
359 GPIO_NR_PALMTX_USB_PULLUP
, 1);
360 palm27x_irda_init(GPIO_NR_PALMTX_IR_DISABLE
);
361 palm27x_ac97_init(PALMTX_BAT_MIN_VOLTAGE
, PALMTX_BAT_MAX_VOLTAGE
,
362 GPIO_NR_PALMTX_EARPHONE_DETECT
, 95);
363 palm27x_pwm_init(GPIO_NR_PALMTX_BL_POWER
, GPIO_NR_PALMTX_LCD_POWER
);
364 palm27x_power_init(GPIO_NR_PALMTX_POWER_DETECT
, -1);
372 MACHINE_START(PALMTX
, "Palm T|X")
373 .atag_offset
= 0x100,
374 .map_io
= palmtx_map_io
,
375 .nr_irqs
= PXA_NR_IRQS
,
376 .init_irq
= pxa27x_init_irq
,
377 .handle_irq
= pxa27x_handle_irq
,
378 .init_time
= pxa_timer_init
,
379 .init_machine
= palmtx_init
,
380 .restart
= pxa_restart
,