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/z2.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Support for the Zipit Z2 Handheld device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  Copyright (C) 2009-2010 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 research and code by: Ken McGuire
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *  Based on mainstone.c as modified for the Zipit Z2.
^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/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/pwm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/z2_battery.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/dma-mapping.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/spi/pxa2xx_spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/spi/libertas_spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/spi/lms283gf05.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/power_supply.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) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/platform_data/i2c-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include "mfp-pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <mach/z2.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include <linux/platform_data/keypad-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * Pin configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static unsigned long z2_pin_config[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	/* LCD - 16bpp Active TFT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	GPIO58_LCD_LDD_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	GPIO59_LCD_LDD_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	GPIO60_LCD_LDD_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	GPIO61_LCD_LDD_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	GPIO62_LCD_LDD_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	GPIO63_LCD_LDD_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	GPIO64_LCD_LDD_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	GPIO65_LCD_LDD_7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	GPIO66_LCD_LDD_8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	GPIO67_LCD_LDD_9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	GPIO68_LCD_LDD_10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	GPIO69_LCD_LDD_11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	GPIO70_LCD_LDD_12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	GPIO71_LCD_LDD_13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	GPIO72_LCD_LDD_14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	GPIO73_LCD_LDD_15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	GPIO74_LCD_FCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	GPIO75_LCD_LCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	GPIO76_LCD_PCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	GPIO77_LCD_BIAS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	GPIO19_GPIO,		/* LCD reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	GPIO88_GPIO,		/* LCD chipselect */
^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) 	GPIO115_PWM1_OUT,	/* Keypad Backlight */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	GPIO11_PWM2_OUT,	/* LCD Backlight */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	/* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	GPIO96_GPIO,		/* SD detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	/* STUART */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	GPIO46_STUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	GPIO47_STUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	/* Keypad */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	GPIO100_KP_MKIN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	GPIO101_KP_MKIN_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	GPIO102_KP_MKIN_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	GPIO34_KP_MKIN_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	GPIO38_KP_MKIN_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	GPIO16_KP_MKIN_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	GPIO17_KP_MKIN_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	GPIO103_KP_MKOUT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	GPIO104_KP_MKOUT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	GPIO105_KP_MKOUT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	GPIO106_KP_MKOUT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	GPIO107_KP_MKOUT_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	GPIO108_KP_MKOUT_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	GPIO35_KP_MKOUT_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	GPIO41_KP_MKOUT_7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	/* I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	GPIO117_I2C_SCL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	GPIO118_I2C_SDA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	/* SSP1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	GPIO23_SSP1_SCLK,	/* SSP1_SCK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	GPIO25_SSP1_TXD,	/* SSP1_TXD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	GPIO26_SSP1_RXD,	/* SSP1_RXD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	/* SSP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	GPIO22_SSP2_SCLK,	/* SSP2_SCK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	GPIO13_SSP2_TXD,	/* SSP2_TXD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	GPIO40_SSP2_RXD,	/* SSP2_RXD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	/* LEDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	GPIO10_GPIO,		/* WiFi LED */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	GPIO83_GPIO,		/* Charging LED */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	GPIO85_GPIO,		/* Charged LED */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	/* I2S */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	GPIO28_I2S_BITCLK_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	GPIO29_I2S_SDATA_IN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	GPIO30_I2S_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	GPIO31_I2S_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	GPIO113_I2S_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	/* MISC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	GPIO0_GPIO,		/* AC power detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	GPIO1_GPIO,		/* Power button */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	GPIO37_GPIO,		/* Headphone detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	GPIO98_GPIO,		/* Lid switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	GPIO14_GPIO,		/* WiFi Power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	GPIO24_GPIO,		/* WiFi CS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	GPIO36_GPIO,		/* WiFi IRQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	GPIO88_GPIO,		/* LCD CS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * NOR Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static struct resource z2_flash_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.start	= PXA_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.end	= PXA_CS0_PHYS + SZ_8M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.flags	= IORESOURCE_MEM,
^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 mtd_partition z2_flash_parts[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		.name	= "U-Boot Bootloader",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		.offset	= 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		.size	= 0x40000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		.name	= "U-Boot Environment",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		.offset	= 0x40000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		.size	= 0x20000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		.name	= "Flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		.offset	= 0x60000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		.size	= MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static struct physmap_flash_data z2_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	.width		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.parts		= z2_flash_parts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.nr_parts	= ARRAY_SIZE(z2_flash_parts),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static struct platform_device z2_flash = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	.name		= "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	.id		= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	.resource	= &z2_flash_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	.num_resources	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	.dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		.platform_data	= &z2_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	},
^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 void __init z2_nor_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	platform_device_register(&z2_flash);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static inline void z2_nor_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * Backlight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static struct pwm_lookup z2_pwm_lookup[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight.0", NULL, 1260320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		   PWM_POLARITY_NORMAL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.1", NULL, 1260320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		   PWM_POLARITY_NORMAL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static struct platform_pwm_backlight_data z2_backlight_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		/* Keypad Backlight */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		.max_brightness	= 1023,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		.dft_brightness	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		/* LCD Backlight */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		.max_brightness	= 1023,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		.dft_brightness	= 512,
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct platform_device z2_backlight_devices[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		.name	= "pwm-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		.id	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			.platform_data	= &z2_backlight_data[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		.name	= "pwm-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		.id	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			.platform_data	= &z2_backlight_data[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static void __init z2_pwm_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	pwm_add_table(z2_pwm_lookup, ARRAY_SIZE(z2_pwm_lookup));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	platform_device_register(&z2_backlight_devices[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	platform_device_register(&z2_backlight_devices[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) static inline void z2_pwm_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * Framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static struct pxafb_mode_info z2_lcd_modes[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	.pixclock	= 192000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	.xres		= 240,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	.yres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	.bpp		= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	.left_margin	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	.right_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	.upper_margin	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	.lower_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	.hsync_len	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	.vsync_len	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) static struct pxafb_mach_info z2_lcd_screen = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	.modes		= z2_lcd_modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	.num_modes      = ARRAY_SIZE(z2_lcd_modes),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	.lcd_conn	= LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 			  LCD_ALTERNATE_MAPPING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static void __init z2_lcd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	pxa_set_fb_info(NULL, &z2_lcd_screen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static inline void z2_lcd_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * SD/MMC card controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) static struct pxamci_platform_data z2_mci_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	.detect_delay_ms	= 200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) static struct gpiod_lookup_table z2_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	.dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 		GPIO_LOOKUP("gpio-pxa", GPIO96_ZIPITZ2_SD_DETECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 			    "cd", GPIO_ACTIVE_LOW),
^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) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) static void __init z2_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	gpiod_add_lookup_table(&z2_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	pxa_set_mci_info(&z2_mci_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) static inline void z2_mmc_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) #endif
^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)  * LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) struct gpio_led z2_gpio_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	.name			= "z2:green:wifi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	.default_trigger	= "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	.gpio			= GPIO10_ZIPITZ2_LED_WIFI,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	.name			= "z2:green:charged",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	.default_trigger	= "mmc0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	.gpio			= GPIO85_ZIPITZ2_LED_CHARGED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	.name			= "z2:amber:charging",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	.default_trigger	= "Z2-charging-or-full",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	.gpio			= GPIO83_ZIPITZ2_LED_CHARGING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) static struct gpio_led_platform_data z2_gpio_led_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	.leds		= z2_gpio_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	.num_leds	= ARRAY_SIZE(z2_gpio_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) static struct platform_device z2_leds = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	.name	= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		.platform_data	= &z2_gpio_led_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	}
^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 z2_leds_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	platform_device_register(&z2_leds);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) static inline void z2_leds_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)  * GPIO keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) static const unsigned int z2_matrix_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	KEY(0, 0, KEY_OPTION),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	KEY(1, 0, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	KEY(2, 0, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	KEY(3, 0, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	KEY(4, 0, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	KEY(5, 0, KEY_END),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	KEY(6, 0, KEY_KPPLUS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	KEY(0, 1, KEY_HOME),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	KEY(1, 1, KEY_Q),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	KEY(2, 1, KEY_I),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	KEY(3, 1, KEY_G),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	KEY(4, 1, KEY_X),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	KEY(5, 1, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	KEY(6, 1, KEY_KPMINUS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	KEY(0, 2, KEY_PAGEUP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	KEY(1, 2, KEY_W),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	KEY(2, 2, KEY_O),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	KEY(3, 2, KEY_H),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	KEY(4, 2, KEY_C),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	KEY(5, 2, KEY_LEFTALT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	KEY(0, 3, KEY_PAGEDOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	KEY(1, 3, KEY_E),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	KEY(2, 3, KEY_P),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	KEY(3, 3, KEY_J),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	KEY(4, 3, KEY_V),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	KEY(5, 3, KEY_LEFTSHIFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	KEY(0, 4, KEY_ESC),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	KEY(1, 4, KEY_R),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	KEY(2, 4, KEY_A),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	KEY(3, 4, KEY_K),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	KEY(4, 4, KEY_B),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	KEY(5, 4, KEY_LEFTCTRL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	KEY(0, 5, KEY_TAB),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	KEY(1, 5, KEY_T),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	KEY(2, 5, KEY_S),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	KEY(3, 5, KEY_L),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	KEY(4, 5, KEY_N),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	KEY(5, 5, KEY_SPACE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	KEY(0, 6, KEY_STOPCD),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	KEY(1, 6, KEY_Y),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	KEY(2, 6, KEY_D),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	KEY(3, 6, KEY_BACKSPACE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	KEY(4, 6, KEY_M),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	KEY(5, 6, KEY_COMMA),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	KEY(0, 7, KEY_PLAYCD),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	KEY(1, 7, KEY_U),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	KEY(2, 7, KEY_F),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	KEY(3, 7, KEY_Z),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	KEY(4, 7, KEY_SEMICOLON),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	KEY(5, 7, KEY_DOT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) static struct matrix_keymap_data z2_matrix_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	.keymap			= z2_matrix_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	.keymap_size		= ARRAY_SIZE(z2_matrix_keys),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) static struct pxa27x_keypad_platform_data z2_keypad_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	.matrix_key_rows	= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	.matrix_key_cols	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	.matrix_keymap_data	= &z2_matrix_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	.debounce_interval	= 30,
^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) static void __init z2_mkp_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	pxa_set_keypad_info(&z2_keypad_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) static inline void z2_mkp_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)  * GPIO keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static struct gpio_keys_button z2_pxa_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 		.code		= KEY_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 		.gpio		= GPIO1_ZIPITZ2_POWER_BUTTON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 		.active_low	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 		.desc		= "Power Button",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 		.wakeup		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 		.type		= EV_KEY,
^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) 		.code		= SW_LID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 		.gpio		= GPIO98_ZIPITZ2_LID_BUTTON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 		.desc		= "Lid Switch",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 		.wakeup		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 		.type		= EV_SW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	},
^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) static struct gpio_keys_platform_data z2_pxa_keys_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 	.buttons	= z2_pxa_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	.nbuttons	= ARRAY_SIZE(z2_pxa_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) static struct platform_device z2_pxa_keys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	.name	= "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 		.platform_data = &z2_pxa_keys_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) static void __init z2_keys_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	platform_device_register(&z2_pxa_keys);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) static inline void z2_keys_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  * Battery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) static struct z2_battery_info batt_chip_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	.batt_I2C_bus	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	.batt_I2C_addr	= 0x55,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 	.batt_I2C_reg	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	.charge_gpio	= GPIO0_ZIPITZ2_AC_DETECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 	.min_voltage	= 3475000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	.max_voltage	= 4190000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	.batt_div	= 59,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	.batt_mult	= 1000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	.batt_tech	= POWER_SUPPLY_TECHNOLOGY_LION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	.batt_name	= "Z2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) static struct i2c_board_info __initdata z2_i2c_board_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 		I2C_BOARD_INFO("aer915", 0x55),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 		.platform_data	= &batt_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 		I2C_BOARD_INFO("wm8750", 0x1b),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) static void __init z2_i2c_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	pxa_set_i2c_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	i2c_register_board_info(0, ARRAY_AND_SIZE(z2_i2c_board_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) static inline void z2_i2c_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)  * SSP Devices - WiFi and LCD control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) /* WiFi */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) static int z2_lbs_spi_setup(struct spi_device *spi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 	ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 		goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 		goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	/* Wait until card is powered on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	mdelay(180);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	spi->bits_per_word = 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	spi->mode = SPI_MODE_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	spi_setup(spi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) err2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) static int z2_lbs_spi_teardown(struct spi_device *spi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	gpio_free(GPIO14_ZIPITZ2_WIFI_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) static struct pxa2xx_spi_chip z2_lbs_chip_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	.rx_threshold	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	.tx_threshold	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	.timeout	= 1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	.gpio_cs	= GPIO24_ZIPITZ2_WIFI_CS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) static struct libertas_spi_platform_data z2_lbs_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	.use_dummy_writes	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	.setup			= z2_lbs_spi_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	.teardown		= z2_lbs_spi_teardown,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) /* LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) static struct pxa2xx_spi_chip lms283_chip_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 	.rx_threshold	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	.tx_threshold	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	.timeout	= 64,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	.gpio_cs	= GPIO88_ZIPITZ2_LCD_CS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) static const struct lms283gf05_pdata lms283_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	.reset_gpio	= GPIO19_ZIPITZ2_LCD_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) static struct spi_board_info spi_board_info[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	.modalias		= "libertas_spi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	.platform_data		= &z2_lbs_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	.controller_data	= &z2_lbs_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	.irq			= PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	.max_speed_hz		= 13000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	.bus_num		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	.chip_select		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	.modalias		= "lms283gf05",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	.controller_data	= &lms283_chip_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	.platform_data		= &lms283_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	.max_speed_hz		= 400000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	.bus_num		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	.chip_select		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) static struct pxa2xx_spi_controller pxa_ssp1_master_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	.num_chipselect	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	.enable_dma	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) static struct pxa2xx_spi_controller pxa_ssp2_master_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	.num_chipselect	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) static void __init z2_spi_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	pxa2xx_set_spi_info(1, &pxa_ssp1_master_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) static inline void z2_spi_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)  * Core power regulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) #if defined(CONFIG_REGULATOR_TPS65023) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	defined(CONFIG_REGULATOR_TPS65023_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) static struct regulator_consumer_supply z2_tps65021_consumers[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 	REGULATOR_SUPPLY("vcc_core", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) static struct regulator_init_data z2_tps65021_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 		.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 			.name		= "vcc_core range",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 			.min_uV		= 800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 			.max_uV		= 1600000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 			.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 		.consumer_supplies	= z2_tps65021_consumers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 		.num_consumer_supplies	= ARRAY_SIZE(z2_tps65021_consumers),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 		.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 			.name		= "DCDC2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 			.min_uV		= 3300000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 			.max_uV		= 3300000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 			.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 		.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 			.name		= "DCDC3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 			.min_uV		= 1800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 			.max_uV		= 1800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 			.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 		.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 			.name		= "LDO1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 			.min_uV		= 1000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 			.max_uV		= 3150000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 			.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 		.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 			.name		= "LDO2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 			.min_uV		= 1050000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 			.max_uV		= 3300000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 			.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) static struct i2c_board_info __initdata z2_pi2c_board_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 		I2C_BOARD_INFO("tps65021", 0x48),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 		.platform_data	= &z2_tps65021_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) static void __init z2_pmic_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 	pxa27x_set_i2c_power_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 	i2c_register_board_info(1, ARRAY_AND_SIZE(z2_pi2c_board_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) static inline void z2_pmic_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) static void z2_power_off(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 	/* We're using deep sleep as poweroff, so clear PSPR to ensure that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 	 * bootloader will jump to its entry point in resume handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 	PSPR = 0x0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 	local_irq_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) #define z2_power_off   NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)  * Machine init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) static void __init z2_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 	pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 	pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 	pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 	pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 	z2_lcd_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 	z2_mmc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	z2_mkp_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 	z2_i2c_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 	z2_spi_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 	z2_nor_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 	z2_pwm_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 	z2_leds_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) 	z2_keys_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) 	z2_pmic_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) 	pm_power_off = z2_power_off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) MACHINE_START(ZIPIT2, "Zipit Z2")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) 	.map_io		= pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) 	.nr_irqs	= PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) 	.init_irq	= pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) 	.handle_irq	= pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) 	.init_time	= pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) 	.init_machine	= z2_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) 	.restart	= pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) MACHINE_END