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 Zire72
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *	Vladimir "Farcaller" Pouzanov <farcaller@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	Sergey Lapin <slapin@ossfans.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *	Alex Osborne <bobofdoom@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *	Jan Herman <2hp@seznam.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Rewrite for mainline:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *	Marek Vasut <marek.vasut@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * (find more info at www.hackndev.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/syscore_ops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/pda_power.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/wm97xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/platform_data/i2c-gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <asm/suspend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <asm/mach/map.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 <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include "palmz72.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include <linux/platform_data/irda-pxaficp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include <linux/platform_data/keypad-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include "udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include <linux/platform_data/asoc-palm27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include "palm27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #include <linux/platform_data/media/camera-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * Pin configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static unsigned long palmz72_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	/* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	GPIO14_GPIO,	/* SD detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	GPIO115_GPIO,	/* SD RO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	GPIO98_GPIO,	/* SD power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	/* AC97 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	GPIO28_AC97_BITCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	GPIO29_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	GPIO30_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	GPIO31_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	GPIO89_AC97_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	GPIO113_AC97_nRESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	/* IrDA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	GPIO49_GPIO,	/* ir disable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	GPIO46_FICP_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	GPIO47_FICP_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	/* PWM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	GPIO16_PWM0_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	/* USB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	GPIO15_GPIO,	/* usb detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	GPIO95_GPIO,	/* usb pullup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	/* Matrix keypad */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	GPIO100_KP_MKIN_0	| WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	GPIO101_KP_MKIN_1	| WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	GPIO102_KP_MKIN_2	| WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	GPIO97_KP_MKIN_3	| WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	GPIO103_KP_MKOUT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	GPIO104_KP_MKOUT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	GPIO105_KP_MKOUT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	/* LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	GPIOxx_LCD_TFT_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	GPIO20_GPIO,	/* bl power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	GPIO21_GPIO,	/* LCD border switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	GPIO22_GPIO,	/* LCD border color */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	GPIO96_GPIO,	/* lcd power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	/* PXA Camera */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	GPIO81_CIF_DD_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	GPIO48_CIF_DD_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	GPIO50_CIF_DD_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	GPIO51_CIF_DD_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	GPIO52_CIF_DD_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	GPIO53_CIF_MCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	GPIO54_CIF_PCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	GPIO55_CIF_DD_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	GPIO84_CIF_FV,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	GPIO85_CIF_LV,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	GPIO93_CIF_DD_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	GPIO108_CIF_DD_7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	GPIO56_GPIO,	/* OV9640 Powerdown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	GPIO57_GPIO,	/* OV9640 Reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	GPIO91_GPIO,	/* OV9640 Power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	/* I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	GPIO117_GPIO,	/* I2C_SCL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	GPIO118_GPIO,	/* I2C_SDA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	/* Misc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	GPIO0_GPIO	| WAKEUP_ON_LEVEL_HIGH,	/* power detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	GPIO88_GPIO,				/* green led */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	GPIO27_GPIO,				/* WM9712 IRQ */
^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)  * GPIO keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static const unsigned int palmz72_matrix_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	KEY(0, 0, KEY_POWER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	KEY(0, 1, KEY_F1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	KEY(0, 2, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	KEY(1, 0, KEY_F2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	KEY(1, 1, KEY_F3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	KEY(1, 2, KEY_F4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	KEY(2, 0, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	KEY(2, 2, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	KEY(3, 0, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	KEY(3, 2, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static struct matrix_keymap_data almz72_matrix_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.keymap			= palmz72_matrix_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.keymap_size		= ARRAY_SIZE(palmz72_matrix_keys),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.matrix_key_rows	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	.matrix_key_cols	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	.matrix_keymap_data	= &almz72_matrix_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	.debounce_interval	= 30,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static void __init palmz72_kpc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	pxa_set_keypad_info(&palmz72_keypad_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static inline void palmz72_kpc_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static struct gpio_led gpio_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		.name			= "palmz72:green:led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		.default_trigger	= "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		.gpio			= GPIO_NR_PALMZ72_LED_GREEN,
^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 gpio_led_platform_data gpio_led_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	.leds		= gpio_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	.num_leds	= ARRAY_SIZE(gpio_leds),
^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_device palmz72_leds = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	.name	= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		.platform_data	= &gpio_led_info,
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) static void __init palmz72_leds_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	platform_device_register(&palmz72_leds);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) static inline void palmz72_leds_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /* We have some black magic here
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * PalmOS ROM on recover expects special struct physical address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * to be transferred via PSPR. Using this struct PalmOS restores
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * its state after sleep. As for Linux, we need to setup it the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * same way. More than that, PalmOS ROM changes some values in memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * For now only one location is found, which needs special treatment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * for reading backtraces for me :)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct palmz72_resume_info palmz72_resume_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	.magic0 = 0xb4e6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	.magic1 = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	/* reset state, MMU off etc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.arm_control = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.aux_control = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.ttb = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.domain_access = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.process_id = 0,
^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 unsigned long store_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* syscore_ops for Palm Zire 72 PM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static int palmz72_pm_suspend(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	/* setup the resume_info struct for the original bootloader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	palmz72_resume_info.resume_addr = (u32) cpu_resume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	/* Storing memory touched by ROM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	store_ptr = *PALMZ72_SAVE_DWORD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	/* Setting PSPR to a proper value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	PSPR = __pa_symbol(&palmz72_resume_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static void palmz72_pm_resume(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	*PALMZ72_SAVE_DWORD = store_ptr;
^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) static struct syscore_ops palmz72_pm_syscore_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	.suspend = palmz72_pm_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	.resume = palmz72_pm_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) static int __init palmz72_pm_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	if (machine_is_palmz72()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		register_syscore_ops(&palmz72_pm_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	return -ENODEV;
^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) device_initcall(palmz72_pm_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) static struct gpiod_lookup_table palmz72_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	.dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 			    "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 			    "wp", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			    "power", GPIO_ACTIVE_LOW),
^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) };
^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)  * Machine init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) static void __init palmz72_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	palm27x_mmc_init(&palmz72_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	palm27x_lcd_init(-1, &palm_320x320_lcd_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			GPIO_NR_PALMZ72_USB_PULLUP, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE, PALMZ72_BAT_MAX_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 			-1, 113);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	palm27x_pwm_init(-1, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	palm27x_power_init(-1, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	palm27x_pmic_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	palmz72_kpc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	palmz72_leds_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) MACHINE_START(PALMZ72, "Palm Zire72")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	.map_io		= pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	.nr_irqs	= PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	.init_irq	= pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	.handle_irq	= pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	.init_time	= pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	.init_machine	= palmz72_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	.restart	= pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) MACHINE_END