Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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