^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 PalmTX
^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) * Cristiano P. <cristianop@users.sourceforge.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Jan Herman <2hp@seznam.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Michal Hrusecky
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * (find more info at www.hackndev.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/pda_power.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/wm97xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/mtd/platnand.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include "pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <mach/palmtx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include <linux/platform_data/irda-pxaficp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include <linux/platform_data/keypad-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include "udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <linux/platform_data/asoc-palm27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include "palm27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * Pin configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static unsigned long palmtx_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) GPIO14_GPIO, /* SD detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) GPIO114_GPIO, /* SD power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) GPIO115_GPIO, /* SD r/o switch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* AC97 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) GPIO28_AC97_BITCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) GPIO29_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) GPIO30_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) GPIO31_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) GPIO89_AC97_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) GPIO95_AC97_nRESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* IrDA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) GPIO40_GPIO, /* ir disable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) GPIO46_FICP_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) GPIO47_FICP_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* PWM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) GPIO16_PWM0_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* USB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) GPIO13_GPIO, /* usb detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) GPIO93_GPIO, /* usb power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* PCMCIA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) GPIO48_nPOE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) GPIO49_nPWE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) GPIO50_nPIOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) GPIO51_nPIOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) GPIO85_nPCE_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) GPIO54_nPCE_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) GPIO79_PSKTSEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) GPIO55_nPREG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) GPIO56_nPWAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) GPIO57_nIOIS16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) GPIO94_GPIO, /* wifi power 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) GPIO108_GPIO, /* wifi power 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) GPIO116_GPIO, /* wifi ready */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /* MATRIX KEYPAD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) GPIO103_KP_MKOUT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) GPIO104_KP_MKOUT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) GPIO105_KP_MKOUT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) GPIOxx_LCD_TFT_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* FFUART */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) GPIO34_FFUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) GPIO39_FFUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* NAND */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) GPIO15_nCS_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) GPIO18_RDY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* MISC. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) GPIO10_GPIO, /* hotsync button */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) GPIO12_GPIO, /* power detect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) GPIO107_GPIO, /* earphone detect */
^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) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * NOR Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) static struct mtd_partition palmtx_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) .name = "Flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) .offset = 0x00000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) .size = MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) .mask_flags = 0
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static struct physmap_flash_data palmtx_flash_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) .width = 2, /* bankwidth in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) .parts = palmtx_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) .nr_parts = ARRAY_SIZE(palmtx_partitions)
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static struct resource palmtx_flash_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) .start = PXA_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) .end = PXA_CS0_PHYS + SZ_8M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static struct platform_device palmtx_flash = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) .name = "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) .resource = &palmtx_flash_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) .platform_data = palmtx_flash_data,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static void __init palmtx_nor_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) platform_device_register(&palmtx_flash);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static inline void palmtx_nor_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * GPIO keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static const unsigned int palmtx_matrix_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) KEY(0, 0, KEY_POWER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) KEY(0, 1, KEY_F1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) KEY(0, 2, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) KEY(1, 0, KEY_F2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) KEY(1, 1, KEY_F3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) KEY(1, 2, KEY_F4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) KEY(2, 0, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) KEY(2, 2, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) KEY(3, 0, KEY_RIGHT),
^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 palmtx_matrix_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .keymap = palmtx_matrix_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .keymap_size = ARRAY_SIZE(palmtx_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 palmtx_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 = &palmtx_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 palmtx_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(&palmtx_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 palmtx_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 palmtx_pxa_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) {KEY_F8, GPIO_NR_PALMTX_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) static struct gpio_keys_platform_data palmtx_pxa_keys_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) .buttons = palmtx_pxa_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) .nbuttons = ARRAY_SIZE(palmtx_pxa_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static struct platform_device palmtx_pxa_keys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) .name = "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) .platform_data = &palmtx_pxa_keys_data,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) static void __init palmtx_keys_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) platform_device_register(&palmtx_pxa_keys);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static inline void palmtx_keys_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * NAND Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #if defined(CONFIG_MTD_NAND_PLATFORM) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) static void palmtx_nand_cmd_ctl(struct nand_chip *this, int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) unsigned int ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) char __iomem *nandaddr = this->legacy.IO_ADDR_W;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) if (cmd == NAND_CMD_NONE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) if (ctrl & NAND_CLE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) writeb(cmd, PALMTX_NAND_CLE_VIRT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) else if (ctrl & NAND_ALE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) writeb(cmd, PALMTX_NAND_ALE_VIRT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) writeb(cmd, nandaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) static struct mtd_partition palmtx_partition_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) .name = "palmtx-0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) .offset = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) .size = MTDPART_SIZ_FULL
^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) struct platform_nand_data palmtx_nand_platdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) .nr_chips = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) .chip_offset = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) .nr_partitions = ARRAY_SIZE(palmtx_partition_info),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .partitions = palmtx_partition_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) .chip_delay = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) .ctrl = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) .cmd_ctrl = palmtx_nand_cmd_ctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static struct resource palmtx_nand_resource[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) .start = PXA_CS1_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) .end = PXA_CS1_PHYS + SZ_1M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) static struct platform_device palmtx_nand = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) .name = "gen_nand",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) .num_resources = ARRAY_SIZE(palmtx_nand_resource),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) .resource = palmtx_nand_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) .platform_data = &palmtx_nand_platdata,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) static void __init palmtx_nand_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) platform_device_register(&palmtx_nand);
^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 palmtx_nand_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 palmtx_io_desc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) .virtual = (unsigned long)PALMTX_PCMCIA_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) .length = PALMTX_PCMCIA_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) .virtual = (unsigned long)PALMTX_NAND_ALE_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) .pfn = __phys_to_pfn(PALMTX_NAND_ALE_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) .length = SZ_1M,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) .type = MT_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) .virtual = (unsigned long)PALMTX_NAND_CLE_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) .pfn = __phys_to_pfn(PALMTX_NAND_CLE_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) .length = SZ_1M,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) .type = MT_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static void __init palmtx_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) pxa27x_map_io();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static struct gpiod_lookup_table palmtx_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) .dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_DETECT_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) "wp", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) "power", GPIO_ACTIVE_HIGH),
^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) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) static void __init palmtx_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) palm27x_mmc_init(&palmtx_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) palm27x_pm_init(PALMTX_STR_BASE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) GPIO_NR_PALMTX_USB_PULLUP, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) palm27x_irda_init(GPIO_NR_PALMTX_IR_DISABLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) palm27x_ac97_init(PALMTX_BAT_MIN_VOLTAGE, PALMTX_BAT_MAX_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) GPIO_NR_PALMTX_EARPHONE_DETECT, 95);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) palm27x_pwm_init(GPIO_NR_PALMTX_BL_POWER, GPIO_NR_PALMTX_LCD_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) palm27x_power_init(GPIO_NR_PALMTX_POWER_DETECT, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) palm27x_pmic_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) palmtx_kpc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) palmtx_keys_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) palmtx_nor_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) palmtx_nand_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) MACHINE_START(PALMTX, "Palm T|X")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) .map_io = palmtx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) .init_irq = pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) .handle_irq = pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .init_machine = palmtx_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .restart = pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) MACHINE_END