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)  * Hardware definitions for Palm LifeDrive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Author:     Marek Vasut <marek.vasut@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Based on work of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *		Alex Osborne <ato@meshy.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * (find more info at www.hackndev.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/gpio_keys.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/pda_power.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.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/wm97xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/mtd/partitions.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 "pxa27x.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/palmld.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 <linux/platform_data/keypad-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/platform_data/asoc-palm27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include "palm27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * Pin configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static unsigned long palmld_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	/* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	GPIO14_GPIO,	/* SD detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	GPIO114_GPIO,	/* SD power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	GPIO116_GPIO,	/* SD r/o switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/* AC97 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	GPIO28_AC97_BITCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	GPIO29_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	GPIO30_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	GPIO31_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	GPIO89_AC97_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	GPIO95_AC97_nRESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	/* IrDA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	GPIO108_GPIO,	/* ir disable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	GPIO46_FICP_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	GPIO47_FICP_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	/* MATRIX KEYPAD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	GPIO103_KP_MKOUT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	GPIO104_KP_MKOUT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	GPIO105_KP_MKOUT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/* LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	GPIOxx_LCD_TFT_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	/* PWM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	GPIO16_PWM0_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	/* GPIO KEYS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	GPIO10_GPIO,	/* hotsync button */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	GPIO12_GPIO,	/* power switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	GPIO15_GPIO,	/* lock switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	/* LEDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	GPIO52_GPIO,	/* green led */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	GPIO94_GPIO,	/* orange led */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/* PCMCIA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	GPIO48_nPOE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	GPIO49_nPWE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	GPIO50_nPIOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	GPIO51_nPIOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	GPIO85_nPCE_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	GPIO54_nPCE_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	GPIO79_PSKTSEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	GPIO55_nPREG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	GPIO56_nPWAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	GPIO57_nIOIS16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	GPIO36_GPIO,	/* wifi power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	GPIO38_GPIO,	/* wifi ready */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	GPIO81_GPIO,	/* wifi reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	/* FFUART */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	GPIO34_FFUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	GPIO39_FFUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	/* HDD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	GPIO98_GPIO,	/* HDD reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	GPIO115_GPIO,	/* HDD power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	/* MISC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	GPIO13_GPIO,	/* earphone detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * NOR Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static struct mtd_partition palmld_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		.name		= "Flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		.offset		= 0x00000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		.size		= MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		.mask_flags	= 0
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static struct physmap_flash_data palmld_flash_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		.width		= 2,			/* bankwidth in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		.parts		= palmld_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		.nr_parts	= ARRAY_SIZE(palmld_partitions)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) static struct resource palmld_flash_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	.start	= PXA_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	.end	= PXA_CS0_PHYS + SZ_4M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static struct platform_device palmld_flash = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	.name		= "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.id		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.resource	= &palmld_flash_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.num_resources	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.dev 		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		.platform_data = palmld_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static void __init palmld_nor_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	platform_device_register(&palmld_flash);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static inline void palmld_nor_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * GPIO keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static const unsigned int palmld_matrix_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	KEY(0, 1, KEY_F2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	KEY(0, 2, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	KEY(1, 0, KEY_F3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	KEY(1, 1, KEY_F4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	KEY(1, 2, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	KEY(2, 0, KEY_F1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	KEY(2, 1, KEY_F5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	KEY(2, 2, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	KEY(3, 0, KEY_F6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	KEY(3, 1, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	KEY(3, 2, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) static struct matrix_keymap_data palmld_matrix_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	.keymap			= palmld_matrix_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	.keymap_size		= ARRAY_SIZE(palmld_matrix_keys),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	.matrix_key_rows	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	.matrix_key_cols	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.matrix_keymap_data	= &palmld_matrix_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	.debounce_interval	= 30,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static void __init palmld_kpc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	pxa_set_keypad_info(&palmld_keypad_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static inline void palmld_kpc_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * GPIO keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) static struct gpio_keys_button palmld_pxa_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	{KEY_F8, GPIO_NR_PALMLD_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	{KEY_F9, GPIO_NR_PALMLD_LOCK_SWITCH, 0, "Lock Switch" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	{KEY_POWER, GPIO_NR_PALMLD_POWER_SWITCH, 0, "Power Switch" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static struct gpio_keys_platform_data palmld_pxa_keys_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	.buttons	= palmld_pxa_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	.nbuttons	= ARRAY_SIZE(palmld_pxa_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) static struct platform_device palmld_pxa_keys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.name	= "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		.platform_data = &palmld_pxa_keys_data,
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) static void __init palmld_keys_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	platform_device_register(&palmld_pxa_keys);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static inline void palmld_keys_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct gpio_led gpio_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	.name			= "palmld:green:led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	.default_trigger	= "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	.gpio			= GPIO_NR_PALMLD_LED_GREEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	.name			= "palmld:amber:led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	.default_trigger	= "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.gpio			= GPIO_NR_PALMLD_LED_AMBER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static struct gpio_led_platform_data gpio_led_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	.leds		= gpio_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	.num_leds	= ARRAY_SIZE(gpio_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static struct platform_device palmld_leds = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	.name	= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		.platform_data	= &gpio_led_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) static void __init palmld_leds_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	platform_device_register(&palmld_leds);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static inline void palmld_leds_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * HDD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #if defined(CONFIG_PATA_PALMLD) || defined(CONFIG_PATA_PALMLD_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) static struct platform_device palmld_ide_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	.name	= "pata_palmld",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) static struct gpiod_lookup_table palmld_ide_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	.dev_id = "pata_palmld",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_PWEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			    "power", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_IDE_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			    "reset", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) static void __init palmld_ide_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	gpiod_add_lookup_table(&palmld_ide_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	platform_device_register(&palmld_ide_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) static inline void palmld_ide_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * Machine init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) static struct map_desc palmld_io_desc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	.virtual	= PALMLD_IDE_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	.pfn		= __phys_to_pfn(PALMLD_IDE_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	.length		= PALMLD_IDE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	.type		= MT_DEVICE
^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) 	.virtual	= PALMLD_USB_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	.pfn		= __phys_to_pfn(PALMLD_USB_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	.length		= PALMLD_USB_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	.type		= MT_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) static void __init palmld_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	pxa27x_map_io();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) static struct gpiod_lookup_table palmld_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	.dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_DETECT_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 			    "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 			    "wp", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 			    "power", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) static void __init palmld_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	palm27x_mmc_init(&palmld_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	palm27x_pm_init(PALMLD_STR_BASE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	palm27x_ac97_init(PALMLD_BAT_MIN_VOLTAGE, PALMLD_BAT_MAX_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 			GPIO_NR_PALMLD_EARPHONE_DETECT, 95);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	palm27x_pwm_init(GPIO_NR_PALMLD_BL_POWER, GPIO_NR_PALMLD_LCD_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	palm27x_power_init(GPIO_NR_PALMLD_POWER_DETECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 			GPIO_NR_PALMLD_USB_DETECT_N);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	palm27x_pmic_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	palmld_kpc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	palmld_keys_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	palmld_nor_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	palmld_leds_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	palmld_ide_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) MACHINE_START(PALMLD, "Palm LifeDrive")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	.map_io		= palmld_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	.nr_irqs	= PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	.init_irq	= pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	.handle_irq	= pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	.init_time	= pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	.init_machine	= palmld_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	.restart	= pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) MACHINE_END