^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) * Support for Sharp SL-Cxx00 Series of PDAs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2005 Richard Purdie
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Based on Sharp's 2.4 kernel patches/lubbock.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h> /* symbol_get ; symbol_put */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/platform_data/i2c-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/platform_data/pca953x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/spi/ads7846.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/spi/corgi_lcd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/spi/pxa2xx_spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/mtd/sharpsl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/input/matrix_keypad.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <linux/memblock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <asm/mach/sharpsl_param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <asm/hardware/scoop.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include "pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include "pxa27x-udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <mach/reset.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <linux/platform_data/irda-pxaficp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <linux/platform_data/usb-ohci-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include <mach/spitz.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include "sharpsl_pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include <mach/smemc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * Pin configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static unsigned long spitz_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* Chip Selects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) GPIO78_nCS_2, /* SCOOP #2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) GPIO79_nCS_3, /* NAND */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) GPIO80_nCS_4, /* SCOOP #1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* LCD - 16bpp Active TFT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) GPIOxx_LCD_TFT_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* PC Card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) GPIO48_nPOE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) GPIO49_nPWE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) GPIO50_nPIOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) GPIO51_nPIOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) GPIO85_nPCE_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) GPIO54_nPCE_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) GPIO55_nPREG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) GPIO56_nPWAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) GPIO57_nIOIS16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) GPIO104_PSKTSEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* I2S */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) GPIO28_I2S_BITCLK_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) GPIO29_I2S_SDATA_IN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) GPIO30_I2S_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) GPIO31_I2S_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* GPIOs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) GPIO16_GPIO, /* SPITZ_GPIO_SYNC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) GPIO35_GPIO, /* SPITZ_GPIO_USB_DEVICE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) GPIO22_GPIO, /* SPITZ_GPIO_HSYNC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) GPIO94_GPIO, /* SPITZ_GPIO_CF_CD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /* GPIO matrix keypad */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) GPIO88_GPIO, /* column 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) GPIO23_GPIO, /* column 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) GPIO24_GPIO, /* column 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) GPIO25_GPIO, /* column 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) GPIO26_GPIO, /* column 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) GPIO27_GPIO, /* column 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) GPIO52_GPIO, /* column 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) GPIO103_GPIO, /* column 7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) GPIO107_GPIO, /* column 8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) GPIO108_GPIO, /* column 9 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) GPIO114_GPIO, /* column 10 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) GPIO12_GPIO, /* row 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) GPIO17_GPIO, /* row 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) GPIO91_GPIO, /* row 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) GPIO34_GPIO, /* row 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) GPIO36_GPIO, /* row 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) GPIO38_GPIO, /* row 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) GPIO39_GPIO, /* row 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /* I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) GPIO117_I2C_SCL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) GPIO118_I2C_SDA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* SPITZ_GPIO_KEY_INT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^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) * Scoop GPIO expander
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) /* SCOOP Device #1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static struct resource spitz_scoop_1_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) .start = 0x10800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) .end = 0x10800fff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) .flags = IORESOURCE_MEM,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static struct scoop_config spitz_scoop_1_setup = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) .io_dir = SPITZ_SCP_IO_DIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) .io_out = SPITZ_SCP_IO_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) .suspend_clr = SPITZ_SCP_SUS_CLR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) .suspend_set = SPITZ_SCP_SUS_SET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .gpio_base = SPITZ_SCP_GPIO_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct platform_device spitz_scoop_1_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) .name = "sharp-scoop",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) .platform_data = &spitz_scoop_1_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) .num_resources = ARRAY_SIZE(spitz_scoop_1_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .resource = spitz_scoop_1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /* SCOOP Device #2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static struct resource spitz_scoop_2_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .start = 0x08800040,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) .end = 0x08800fff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .flags = IORESOURCE_MEM,
^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 scoop_config spitz_scoop_2_setup = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) .io_dir = SPITZ_SCP2_IO_DIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) .io_out = SPITZ_SCP2_IO_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) .suspend_clr = SPITZ_SCP2_SUS_CLR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) .suspend_set = SPITZ_SCP2_SUS_SET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .gpio_base = SPITZ_SCP2_GPIO_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct platform_device spitz_scoop_2_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) .name = "sharp-scoop",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .platform_data = &spitz_scoop_2_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) .num_resources = ARRAY_SIZE(spitz_scoop_2_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) .resource = spitz_scoop_2_resources,
^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 void __init spitz_scoop_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) platform_device_register(&spitz_scoop_1_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* Akita doesn't have the second SCOOP chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if (!machine_is_akita())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) platform_device_register(&spitz_scoop_2_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /* Power control is shared with between one of the CF slots and SD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static void __maybe_unused spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) unsigned short cpr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (new_cpr & 0x7) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) mdelay(5);
^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) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (enable & new_cpr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) cpr |= new_cpr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) cpr &= ~enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) if (!(cpr & 0x7)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) mdelay(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
^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) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) static inline void spitz_scoop_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #endif
^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) * PCMCIA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /* Only need to override behaviour for slot 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) if (nr == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) spitz_card_pwr_ctrl(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) write_scoop_reg(scoop, SCOOP_CPR, cpr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .dev = &spitz_scoop_1_device.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .irq = SPITZ_IRQ_GPIO_CF_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .cd_irq_str = "PCMCIA0 CD",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .dev = &spitz_scoop_2_device.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) .cd_irq = -1,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static struct scoop_pcmcia_config spitz_pcmcia_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) .devs = &spitz_pcmcia_scoop[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) .num_devs = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) .power_ctrl = spitz_pcmcia_pwr,
^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 void __init spitz_pcmcia_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) /* Akita has only one PCMCIA slot used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) if (machine_is_akita())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) spitz_pcmcia_config.num_devs = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) platform_scoop_config = &spitz_pcmcia_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static inline void spitz_pcmcia_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #endif
^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) * GPIO keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) #define SPITZ_KEY_CALENDAR KEY_F1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #define SPITZ_KEY_ADDRESS KEY_F2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #define SPITZ_KEY_FN KEY_F3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) #define SPITZ_KEY_CANCEL KEY_F4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define SPITZ_KEY_EXOK KEY_F5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) #define SPITZ_KEY_EXCANCEL KEY_F6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) #define SPITZ_KEY_EXJOGDOWN KEY_F7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #define SPITZ_KEY_EXJOGUP KEY_F8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) #define SPITZ_KEY_JAP1 KEY_LEFTALT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) #define SPITZ_KEY_JAP2 KEY_RIGHTCTRL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #define SPITZ_KEY_SYNC KEY_F9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) #define SPITZ_KEY_MAIL KEY_F10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) #define SPITZ_KEY_OK KEY_F11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) #define SPITZ_KEY_MENU KEY_F12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static const uint32_t spitz_keymap[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) KEY(0, 0, KEY_LEFTCTRL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) KEY(0, 1, KEY_1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) KEY(0, 2, KEY_3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) KEY(0, 3, KEY_5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) KEY(0, 4, KEY_6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) KEY(0, 5, KEY_7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) KEY(0, 6, KEY_9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) KEY(0, 7, KEY_0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) KEY(0, 8, KEY_BACKSPACE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) KEY(0, 9, SPITZ_KEY_EXOK), /* EXOK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) KEY(0, 10, SPITZ_KEY_EXCANCEL), /* EXCANCEL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) KEY(1, 1, KEY_2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) KEY(1, 2, KEY_4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) KEY(1, 3, KEY_R),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) KEY(1, 4, KEY_Y),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) KEY(1, 5, KEY_8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) KEY(1, 6, KEY_I),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) KEY(1, 7, KEY_O),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) KEY(1, 8, KEY_P),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) KEY(1, 9, SPITZ_KEY_EXJOGDOWN), /* EXJOGDOWN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) KEY(1, 10, SPITZ_KEY_EXJOGUP), /* EXJOGUP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) KEY(2, 0, KEY_TAB),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) KEY(2, 1, KEY_Q),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) KEY(2, 2, KEY_E),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) KEY(2, 3, KEY_T),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) KEY(2, 4, KEY_G),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) KEY(2, 5, KEY_U),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) KEY(2, 6, KEY_J),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) KEY(2, 7, KEY_K),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) KEY(3, 0, SPITZ_KEY_ADDRESS), /* ADDRESS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) KEY(3, 1, KEY_W),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) KEY(3, 2, KEY_S),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) KEY(3, 3, KEY_F),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) KEY(3, 4, KEY_V),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) KEY(3, 5, KEY_H),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) KEY(3, 6, KEY_M),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) KEY(3, 7, KEY_L),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) KEY(3, 9, KEY_RIGHTSHIFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) KEY(4, 0, SPITZ_KEY_CALENDAR), /* CALENDAR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) KEY(4, 1, KEY_A),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) KEY(4, 2, KEY_D),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) KEY(4, 3, KEY_C),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) KEY(4, 4, KEY_B),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) KEY(4, 5, KEY_N),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) KEY(4, 6, KEY_DOT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) KEY(4, 8, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) KEY(4, 9, KEY_LEFTSHIFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) KEY(5, 0, SPITZ_KEY_MAIL), /* MAIL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) KEY(5, 1, KEY_Z),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) KEY(5, 2, KEY_X),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) KEY(5, 3, KEY_MINUS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) KEY(5, 4, KEY_SPACE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) KEY(5, 5, KEY_COMMA),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) KEY(5, 7, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) KEY(5, 10, SPITZ_KEY_FN), /* FN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) KEY(6, 0, KEY_SYSRQ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) KEY(6, 1, SPITZ_KEY_JAP1), /* JAP1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) KEY(6, 2, SPITZ_KEY_JAP2), /* JAP2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) KEY(6, 3, SPITZ_KEY_CANCEL), /* CANCEL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) KEY(6, 4, SPITZ_KEY_OK), /* OK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) KEY(6, 5, SPITZ_KEY_MENU), /* MENU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) KEY(6, 6, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) KEY(6, 7, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) KEY(6, 8, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) static const struct matrix_keymap_data spitz_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) .keymap = spitz_keymap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) .keymap_size = ARRAY_SIZE(spitz_keymap),
^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) static const uint32_t spitz_row_gpios[] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) { 12, 17, 91, 34, 36, 38, 39 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) static const uint32_t spitz_col_gpios[] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) static struct matrix_keypad_platform_data spitz_mkp_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .keymap_data = &spitz_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .row_gpios = spitz_row_gpios,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .col_gpios = spitz_col_gpios,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) .num_row_gpios = ARRAY_SIZE(spitz_row_gpios),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .num_col_gpios = ARRAY_SIZE(spitz_col_gpios),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) .col_scan_delay_us = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) .debounce_ms = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) .wakeup = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) static struct platform_device spitz_mkp_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) .name = "matrix-keypad",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) .platform_data = &spitz_mkp_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) static void __init spitz_mkp_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) platform_device_register(&spitz_mkp_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) static inline void spitz_mkp_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * GPIO keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) static struct gpio_keys_button spitz_gpio_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) .type = EV_PWR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) .code = KEY_SUSPEND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) .gpio = SPITZ_GPIO_ON_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) .desc = "On Off",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) .wakeup = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) /* Two buttons detecting the lid state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) .type = EV_SW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) .code = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) .gpio = SPITZ_GPIO_SWA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) .desc = "Display Down",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) .type = EV_SW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) .code = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) .gpio = SPITZ_GPIO_SWB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) .desc = "Lid Closed",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) },
^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 struct gpio_keys_platform_data spitz_gpio_keys_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) .buttons = spitz_gpio_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) .nbuttons = ARRAY_SIZE(spitz_gpio_keys),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) static struct platform_device spitz_gpio_keys_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) .name = "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) .platform_data = &spitz_gpio_keys_platform_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) static void __init spitz_keys_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) platform_device_register(&spitz_gpio_keys_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static inline void spitz_keys_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) #endif
^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) * LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) static struct gpio_led spitz_gpio_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) .name = "spitz:amber:charge",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) .default_trigger = "sharpsl-charge",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) .gpio = SPITZ_GPIO_LED_ORANGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) .name = "spitz:green:hddactivity",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) .default_trigger = "disk-activity",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) .gpio = SPITZ_GPIO_LED_GREEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) static struct gpio_led_platform_data spitz_gpio_leds_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) .leds = spitz_gpio_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) .num_leds = ARRAY_SIZE(spitz_gpio_leds),
^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) static struct platform_device spitz_led_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) .name = "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) .platform_data = &spitz_gpio_leds_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) static void __init spitz_leds_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) platform_device_register(&spitz_led_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) static inline void spitz_leds_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * SSP Devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) static void spitz_ads7846_wait_for_hsync(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) while (gpio_get_value(SPITZ_GPIO_HSYNC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) cpu_relax();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) while (!gpio_get_value(SPITZ_GPIO_HSYNC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) cpu_relax();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) static struct ads7846_platform_data spitz_ads7846_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) .model = 7846,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) .vref_delay_usecs = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) .x_plate_ohms = 419,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) .y_plate_ohms = 486,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) .pressure_max = 1024,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) .gpio_pendown = SPITZ_GPIO_TP_INT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) .wait_for_sync = spitz_ads7846_wait_for_hsync,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) static struct pxa2xx_spi_chip spitz_ads7846_chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) .gpio_cs = SPITZ_GPIO_ADS7846_CS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) static void spitz_bl_kick_battery(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) void (*kick_batt)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) kick_batt = symbol_get(sharpsl_battery_kick);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) if (kick_batt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) kick_batt();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) symbol_put(sharpsl_battery_kick);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) .dev_id = "spi2.1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) "BL_CONT", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) "BL_ON", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) static struct gpiod_lookup_table akita_lcdcon_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) .dev_id = "spi2.1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) "BL_CONT", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) "BL_ON", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) static struct corgi_lcd_platform_data spitz_lcdcon_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) .init_mode = CORGI_LCD_MODE_VGA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) .max_intensity = 0x2f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) .default_intensity = 0x1f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) .limit_mask = 0x0b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) .kick_battery = spitz_bl_kick_battery,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) static struct pxa2xx_spi_chip spitz_lcdcon_chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) .gpio_cs = SPITZ_GPIO_LCDCON_CS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) static struct pxa2xx_spi_chip spitz_max1111_chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) .gpio_cs = SPITZ_GPIO_MAX1111_CS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) static struct spi_board_info spitz_spi_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) .modalias = "ads7846",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) .max_speed_hz = 1200000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) .bus_num = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) .chip_select = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) .platform_data = &spitz_ads7846_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) .controller_data = &spitz_ads7846_chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) .modalias = "corgi-lcd",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) .max_speed_hz = 50000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) .bus_num = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) .chip_select = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) .platform_data = &spitz_lcdcon_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) .controller_data = &spitz_lcdcon_chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) .modalias = "max1111",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) .max_speed_hz = 450000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) .bus_num = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) .chip_select = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) .controller_data = &spitz_max1111_chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) static struct pxa2xx_spi_controller spitz_spi_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) .num_chipselect = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) static void __init spitz_spi_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) if (machine_is_akita())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) gpiod_add_lookup_table(&akita_lcdcon_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) pxa2xx_set_spi_info(2, &spitz_spi_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) static inline void spitz_spi_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) #endif
^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) * SD/MMC card controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) * give the card a chance to fully insert/eject.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) static int spitz_mci_setpower(struct device *dev, unsigned int vdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) struct pxamci_platform_data* p_d = dev->platform_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) if ((1 << vdd) & p_d->ocr_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) static struct pxamci_platform_data spitz_mci_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) .detect_delay_ms = 250,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) .setpower = spitz_mci_setpower,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) static struct gpiod_lookup_table spitz_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) .dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) "wp", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) static void __init spitz_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) gpiod_add_lookup_table(&spitz_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) pxa_set_mci_info(&spitz_mci_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) static inline void spitz_mmc_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) * USB Host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) static int spitz_ohci_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) /* Only Port 2 is connected, setup USB Port 2 Output Control Register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) return gpio_direction_output(SPITZ_GPIO_USB_HOST, 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) static void spitz_ohci_exit(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) gpio_free(SPITZ_GPIO_USB_HOST);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) static struct pxaohci_platform_data spitz_ohci_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) .port_mode = PMM_NPS_MODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) .init = spitz_ohci_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) .exit = spitz_ohci_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) .flags = ENABLE_PORT_ALL | NO_OC_PROTECTION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) .power_budget = 150,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) static void __init spitz_uhc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) pxa_set_ohci_info(&spitz_ohci_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) static inline void spitz_uhc_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) * IrDA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) #if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) static struct pxaficp_platform_data spitz_ficp_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) .transceiver_cap = IR_SIRMODE | IR_OFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) static void __init spitz_irda_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) if (machine_is_akita())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) pxa_set_ficp_info(&spitz_ficp_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) static inline void spitz_irda_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) * Framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) static struct pxafb_mode_info spitz_pxafb_modes[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) .pixclock = 19231,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) .xres = 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) .yres = 640,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) .hsync_len = 40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) .left_margin = 46,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) .right_margin = 125,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) .vsync_len = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) .upper_margin = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) .lower_margin = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) .sync = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) .pixclock = 134617,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) .xres = 240,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) .yres = 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) .hsync_len = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) .left_margin = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) .right_margin = 46,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) .vsync_len = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) .upper_margin = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) .lower_margin = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) .sync = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) static struct pxafb_mach_info spitz_pxafb_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) .modes = spitz_pxafb_modes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) .num_modes = ARRAY_SIZE(spitz_pxafb_modes),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) .fixed_modes = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) static void __init spitz_lcd_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) pxa_set_fb_info(NULL, &spitz_pxafb_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) static inline void spitz_lcd_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) * NAND Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) static struct nand_bbt_descr spitz_nand_bbt = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) .options = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) .offs = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) .len = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) .pattern = scan_ff_pattern
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) static int akita_ooblayout_ecc(struct mtd_info *mtd, int section,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) struct mtd_oob_region *oobregion)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) if (section > 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) return -ERANGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) switch (section % 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) oobregion->offset = 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) oobregion->length = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) oobregion->offset = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) oobregion->length = 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) oobregion->offset = 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) oobregion->length = 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) oobregion->offset += (section / 3) * 0x10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) static int akita_ooblayout_free(struct mtd_info *mtd, int section,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) struct mtd_oob_region *oobregion)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) if (section)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) return -ERANGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) oobregion->offset = 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) oobregion->length = 9;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) static const struct mtd_ooblayout_ops akita_ooblayout_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) .ecc = akita_ooblayout_ecc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) .free = akita_ooblayout_free,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) static const char * const probes[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) "cmdlinepart",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) "ofpart",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) "sharpslpart",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) static struct sharpsl_nand_platform_data spitz_nand_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) .badblock_pattern = &spitz_nand_bbt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) .part_parsers = probes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) static struct resource spitz_nand_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) .start = PXA_CS3_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) .end = PXA_CS3_PHYS + SZ_4K - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) static struct platform_device spitz_nand_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) .name = "sharpsl-nand",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) .resource = spitz_nand_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) .num_resources = ARRAY_SIZE(spitz_nand_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) .platform_data = &spitz_nand_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) static void __init spitz_nand_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) if (machine_is_akita() || machine_is_borzoi()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) spitz_nand_bbt.len = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) platform_device_register(&spitz_nand_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) static inline void spitz_nand_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) * NOR Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) static struct mtd_partition spitz_rom_parts[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) .name ="Boot PROM Filesystem",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) .offset = 0x00140000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) .size = MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) static struct physmap_flash_data spitz_rom_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) .width = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) .nr_parts = ARRAY_SIZE(spitz_rom_parts),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) .parts = spitz_rom_parts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) static struct resource spitz_rom_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) .start = PXA_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) .end = PXA_CS0_PHYS + SZ_8M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) static struct platform_device spitz_rom_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) .name = "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) .resource = spitz_rom_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) .num_resources = ARRAY_SIZE(spitz_rom_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) .platform_data = &spitz_rom_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) static void __init spitz_nor_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) platform_device_register(&spitz_rom_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) static inline void spitz_nor_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) * I2C devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) static struct pca953x_platform_data akita_pca953x_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) .gpio_base = AKITA_IOEXP_GPIO_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) static struct i2c_board_info spitz_i2c_devs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) .type = "wm8750",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) .addr = 0x1b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) .type = "max7310",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) .addr = 0x18,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) .platform_data = &akita_pca953x_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) static struct regulator_consumer_supply isl6271a_consumers[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) REGULATOR_SUPPLY("vcc_core", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) static struct regulator_init_data isl6271a_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) .constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) .name = "vcc_core range",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) .min_uV = 850000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) .max_uV = 1600000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) .always_on = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) .consumer_supplies = isl6271a_consumers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) .num_consumer_supplies = ARRAY_SIZE(isl6271a_consumers),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) static struct i2c_board_info spitz_pi2c_devs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) .type = "isl6271a",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) .addr = 0x0c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) .platform_data = &isl6271a_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) static void __init spitz_i2c_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) int size = ARRAY_SIZE(spitz_i2c_devs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) /* Only Akita has the max7310 chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) if (!machine_is_akita())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) size--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) pxa_set_i2c_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) pxa27x_set_i2c_power_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) i2c_register_board_info(0, spitz_i2c_devs, size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) static inline void spitz_i2c_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) * Audio devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) static inline void spitz_audio_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974) platform_device_register_simple("spitz-audio", -1, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) * Machine init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) static void spitz_poweroff(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982) pxa_restart(REBOOT_GPIO, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) static void spitz_restart(enum reboot_mode mode, const char *cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) uint32_t msc0 = __raw_readl(MSC0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) /* Bootloader magic for a reboot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) if ((msc0 & 0xffff0000) == 0x7ff00000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) __raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) spitz_poweroff();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) static void __init spitz_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998) pm_power_off = spitz_poweroff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) PMCR = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) PCFR |= PCFR_OPDE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) spitz_spi_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) spitz_scoop_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) spitz_mkp_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) spitz_keys_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) spitz_leds_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) spitz_mmc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) spitz_pcmcia_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) spitz_irda_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) spitz_uhc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) spitz_lcd_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) spitz_nor_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) spitz_nand_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) spitz_i2c_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) spitz_audio_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) regulator_has_full_constraints();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) static void __init spitz_fixup(struct tag *tags, char **cmdline)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) sharpsl_save_param();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) memblock_add(0xa0000000, SZ_64M);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) #ifdef CONFIG_MACH_SPITZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) MACHINE_START(SPITZ, "SHARP Spitz")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) .fixup = spitz_fixup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) .map_io = pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) .init_irq = pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) .handle_irq = pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) .init_machine = spitz_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) .restart = spitz_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) #ifdef CONFIG_MACH_BORZOI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) MACHINE_START(BORZOI, "SHARP Borzoi")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) .fixup = spitz_fixup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) .map_io = pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) .init_irq = pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) .handle_irq = pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) .init_machine = spitz_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) .restart = spitz_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) #ifdef CONFIG_MACH_AKITA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) MACHINE_START(AKITA, "SHARP Akita")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) .fixup = spitz_fixup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) .map_io = pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) .init_irq = pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) .handle_irq = pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) .init_machine = spitz_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) .restart = spitz_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) #endif