^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Handles the Mitac Mio A701 Board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2008 Robert Jarzmik
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/syscore_ops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/pwm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/rtc.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/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/pda_power.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/wm97xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/regulator/fixed.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/regulator/max1586.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <linux/platform_data/i2c-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include "pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include "regs-rtc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <linux/platform_data/keypad-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include "udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include "pxa27x-udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <linux/platform_data/media/camera-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <mach/smemc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include "mioa701.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static unsigned long mioa701_pin_config[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* Mio global */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MIO_CFG_OUT(GPIO9_CHARGE_EN, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) MIO_CFG_OUT(GPIO18_POWEROFF, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) MFP_CFG_OUT(GPIO3, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) MFP_CFG_OUT(GPIO4, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) MIO_CFG_IN(GPIO80_MAYBE_CHARGE_VDROP, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /* Backlight PWM 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) GPIO16_PWM0_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) GPIO32_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) GPIO92_MMC_DAT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) GPIO109_MMC_DAT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) GPIO110_MMC_DAT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) GPIO111_MMC_DAT_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) GPIO112_MMC_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) MIO_CFG_IN(GPIO78_SDIO_RO, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) MIO_CFG_IN(GPIO15_SDIO_INSERT, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) MIO_CFG_OUT(GPIO91_SDIO_EN, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* USB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) MIO_CFG_IN(GPIO13_nUSB_DETECT, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) MIO_CFG_OUT(GPIO22_USB_ENABLE, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) GPIOxx_LCD_TFT_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* QCI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) GPIO12_CIF_DD_7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) GPIO17_CIF_DD_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) GPIO50_CIF_DD_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) GPIO51_CIF_DD_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) GPIO52_CIF_DD_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) GPIO53_CIF_MCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) GPIO54_CIF_PCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) GPIO55_CIF_DD_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) GPIO81_CIF_DD_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) GPIO82_CIF_DD_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) GPIO84_CIF_FV,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) GPIO85_CIF_LV,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) MIO_CFG_OUT(GPIO56_MT9M111_nOE, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) /* Bluetooth */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) MIO_CFG_IN(GPIO14_BT_nACTIVITY, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) GPIO44_BTUART_CTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) GPIO42_BTUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) GPIO45_BTUART_RTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) GPIO43_BTUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) MIO_CFG_OUT(GPIO83_BT_ON, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) MIO_CFG_OUT(GPIO77_BT_UNKNOWN1, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) MIO_CFG_OUT(GPIO86_BT_MAYBE_nRESET, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /* GPS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) MIO_CFG_OUT(GPIO23_GPS_UNKNOWN1, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) MIO_CFG_OUT(GPIO26_GPS_ON, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) MIO_CFG_OUT(GPIO27_GPS_RESET, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) MIO_CFG_OUT(GPIO106_GPS_UNKNOWN2, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) MIO_CFG_OUT(GPIO107_GPS_UNKNOWN3, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) GPIO46_STUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) GPIO47_STUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* GSM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) MIO_CFG_OUT(GPIO24_GSM_MOD_RESET_CMD, AF0, DRIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) MIO_CFG_OUT(GPIO88_GSM_nMOD_ON_CMD, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) MIO_CFG_OUT(GPIO90_GSM_nMOD_OFF_CMD, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) MIO_CFG_OUT(GPIO114_GSM_nMOD_DTE_UART_STATE, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) MIO_CFG_IN(GPIO25_GSM_MOD_ON_STATE, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) MIO_CFG_IN(GPIO113_GSM_EVENT, AF0) | WAKEUP_ON_EDGE_BOTH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) GPIO34_FFUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) GPIO35_FFUART_CTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) GPIO36_FFUART_DCD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) GPIO37_FFUART_DSR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) GPIO39_FFUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) GPIO40_FFUART_DTR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) GPIO41_FFUART_RTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* Sound */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) GPIO28_AC97_BITCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) GPIO29_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) GPIO30_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) GPIO31_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) GPIO89_AC97_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) MIO_CFG_IN(GPIO12_HPJACK_INSERT, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /* Leds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) MIO_CFG_OUT(GPIO10_LED_nCharging, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) MIO_CFG_OUT(GPIO97_LED_nBlue, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) MIO_CFG_OUT(GPIO98_LED_nOrange, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) MIO_CFG_OUT(GPIO82_LED_nVibra, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) MIO_CFG_OUT(GPIO115_LED_nKeyboard, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* Keyboard */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) MIO_CFG_IN(GPIO0_KEY_POWER, AF0) | WAKEUP_ON_EDGE_BOTH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) MIO_CFG_IN(GPIO93_KEY_VOLUME_UP, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) MIO_CFG_IN(GPIO94_KEY_VOLUME_DOWN, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) GPIO100_KP_MKIN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) GPIO101_KP_MKIN_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) GPIO102_KP_MKIN_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) GPIO103_KP_MKOUT_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) GPIO104_KP_MKOUT_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) GPIO105_KP_MKOUT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) GPIO117_I2C_SCL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) GPIO118_I2C_SDA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Unknown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) MFP_CFG_IN(GPIO20, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) MFP_CFG_IN(GPIO21, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) MFP_CFG_IN(GPIO33, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) MFP_CFG_OUT(GPIO49, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) MFP_CFG_OUT(GPIO57, AF0, DRIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) MFP_CFG_IN(GPIO96, AF0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),
^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) static struct pwm_lookup mioa701_pwm_lookup[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 4000 * 1024,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) PWM_POLARITY_NORMAL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /* LCD Screen and Backlight */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static struct platform_pwm_backlight_data mioa701_backlight_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) .max_brightness = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .dft_brightness = 50,
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * LTM0305A776C LCD panel timings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * see:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * - the LTM0305A776C datasheet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * - and the PXA27x Programmers' manual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static struct pxafb_mode_info mioa701_ltm0305a776c = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) .pixclock = 220000, /* CLK=4.545 MHz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .xres = 240,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) .yres = 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) .hsync_len = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) .vsync_len = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) .left_margin = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) .right_margin = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) .upper_margin = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) .lower_margin = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static void mioa701_lcd_power(int on, struct fb_var_screeninfo *si)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) gpio_set_value(GPIO87_LCD_POWER, on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static struct pxafb_mach_info mioa701_pxafb_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .modes = &mioa701_ltm0305a776c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .num_modes = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) .pxafb_lcd_power = mioa701_lcd_power,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * Keyboard configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static const unsigned int mioa701_matrix_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) KEY(0, 0, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) KEY(0, 1, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) KEY(0, 2, KEY_MEDIA),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) KEY(1, 0, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) KEY(1, 1, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) KEY(1, 2, KEY_CONNECT), /* GPS key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) KEY(2, 0, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) KEY(2, 1, KEY_PHONE), /* Phone Green key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) KEY(2, 2, KEY_CAMERA) /* Camera key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static struct matrix_keymap_data mioa701_matrix_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) .keymap = mioa701_matrix_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .keymap_size = ARRAY_SIZE(mioa701_matrix_keys),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) static struct pxa27x_keypad_platform_data mioa701_keypad_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) .matrix_key_rows = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) .matrix_key_cols = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) .matrix_keymap_data = &mioa701_matrix_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) };
^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) * GPIO Key Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #define MIO_KEY(key, _gpio, _desc, _wakeup) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) { .code = (key), .gpio = (_gpio), .active_low = 0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) .desc = (_desc), .type = EV_KEY, .wakeup = (_wakeup) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static struct gpio_keys_button mioa701_button_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) MIO_KEY(KEY_EXIT, GPIO0_KEY_POWER, "Power button", 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) MIO_KEY(KEY_VOLUMEUP, GPIO93_KEY_VOLUME_UP, "Volume up", 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MIO_KEY(KEY_VOLUMEDOWN, GPIO94_KEY_VOLUME_DOWN, "Volume down", 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MIO_KEY(KEY_HP, GPIO12_HPJACK_INSERT, "HP jack detect", 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) static struct gpio_keys_platform_data mioa701_gpio_keys_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .buttons = mioa701_button_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .nbuttons = ARRAY_SIZE(mioa701_button_table),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * Leds and vibrator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #define ONE_LED(_gpio, _name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) { .gpio = (_gpio), .name = (_name), .active_low = true }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static struct gpio_led gpio_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) ONE_LED(GPIO10_LED_nCharging, "mioa701:charging"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) ONE_LED(GPIO97_LED_nBlue, "mioa701:blue"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) ONE_LED(GPIO98_LED_nOrange, "mioa701:orange"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ONE_LED(GPIO82_LED_nVibra, "mioa701:vibra"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) ONE_LED(GPIO115_LED_nKeyboard, "mioa701:keyboard")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) static struct gpio_led_platform_data gpio_led_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) .leds = gpio_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) .num_leds = ARRAY_SIZE(gpio_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * GSM Sagem XS200 chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) * GSM handling was purged from kernel. For history, this is the way to go :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * - init : GPIO24_GSM_MOD_RESET_CMD = 0, GPIO114_GSM_nMOD_DTE_UART_STATE = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * GPIO88_GSM_nMOD_ON_CMD = 1, GPIO90_GSM_nMOD_OFF_CMD = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) * - reset : GPIO24_GSM_MOD_RESET_CMD = 1, msleep(100),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) * GPIO24_GSM_MOD_RESET_CMD = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) * - turn on : GPIO88_GSM_nMOD_ON_CMD = 0, msleep(1000),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) * GPIO88_GSM_nMOD_ON_CMD = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * - turn off : GPIO90_GSM_nMOD_OFF_CMD = 0, msleep(1000),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * GPIO90_GSM_nMOD_OFF_CMD = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) static int is_gsm_on(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) int is_on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) is_on = !!gpio_get_value(GPIO25_GSM_MOD_ON_STATE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) return is_on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) irqreturn_t gsm_on_irq(int irq, void *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) printk(KERN_DEBUG "Mioa701: GSM status changed to %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) is_gsm_on() ? "on" : "off");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) static struct gpio gsm_gpios[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) { GPIO25_GSM_MOD_ON_STATE, GPIOF_IN, "GSM state" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) { GPIO113_GSM_EVENT, GPIOF_IN, "GSM event" },
^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) static int __init gsm_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) rc = gpio_request_array(ARRAY_AND_SIZE(gsm_gpios));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) goto err_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) rc = request_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), gsm_on_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) "GSM XS200 Power Irq", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) goto err_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) gpio_set_wake(GPIO113_GSM_EVENT, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) err_irq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) printk(KERN_ERR "Mioa701: Can't request GSM_ON irq\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) gpio_free_array(ARRAY_AND_SIZE(gsm_gpios));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) err_gpio:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) printk(KERN_ERR "Mioa701: gsm not available\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) static void gsm_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) free_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) gpio_free_array(ARRAY_AND_SIZE(gsm_gpios));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) * Bluetooth BRF6150 chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * BT handling was purged from kernel. For history, this is the way to go :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * - turn on : GPIO83_BT_ON = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * - turn off : GPIO83_BT_ON = 0
^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) * GPS Sirf Star III chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * GPS handling was purged from kernel. For history, this is the way to go :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * - init : GPIO23_GPS_UNKNOWN1 = 1, GPIO26_GPS_ON = 0, GPIO27_GPS_RESET = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * GPIO106_GPS_UNKNOWN2 = 0, GPIO107_GPS_UNKNOWN3 = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * - turn on : GPIO27_GPS_RESET = 1, GPIO26_GPS_ON = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) * - turn off : GPIO26_GPS_ON = 0, GPIO27_GPS_RESET = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * USB UDC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) static int is_usb_connected(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) return !gpio_get_value(GPIO13_nUSB_DETECT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static struct pxa2xx_udc_mach_info mioa701_udc_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) .udc_is_connected = is_usb_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) .gpio_pullup = GPIO22_USB_ENABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static struct gpiod_lookup_table gpio_vbus_gpiod_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .dev_id = "gpio-vbus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) GPIO_LOOKUP("gpio-pxa", GPIO13_nUSB_DETECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) "vbus", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * SDIO/MMC Card controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * The card detect interrupt isn't debounced so we delay it by 250ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * to give the card a chance to fully insert/eject.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) static struct pxamci_platform_data mioa701_mci_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) .detect_delay_ms = 250,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) static struct gpiod_lookup_table mioa701_mci_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) .dev_id = "pxa2xx-mci.0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) /* Card detect on GPIO 15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) GPIO_LOOKUP("gpio-pxa", GPIO15_SDIO_INSERT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) /* Write protect on GPIO 78 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) "wp", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) /* Power on GPIO 91 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) GPIO_LOOKUP("gpio-pxa", GPIO91_SDIO_EN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) "power", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) { },
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /* FlashRAM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) static struct resource docg3_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) .start = PXA_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) .end = PXA_CS0_PHYS + SZ_8K - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) static struct platform_device docg3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) .name = "docg3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) .resource = &docg3_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) .platform_data = NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * Suspend/Resume bootstrap management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * MIO A701 reboot sequence is highly ROM dependent. From the one dissassembled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * this sequence is as follows :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * - disables interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * - initialize SDRAM (self refresh RAM into active RAM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * - initialize GPIOs (depends on value at 0xa020b020)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * - initialize coprossessors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * - if edge detect on PWR_SCL(GPIO3), then proceed to cold start
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * - or if value at 0xa020b000 not equal to 0x0f0f0f0f, proceed to cold start
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * - else do a resume, ie. jump to addr 0xa0100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) #define RESUME_ENABLE_ADDR 0xa020b000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) #define RESUME_ENABLE_VAL 0x0f0f0f0f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) #define RESUME_BT_ADDR 0xa020b020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define RESUME_UNKNOWN_ADDR 0xa020b024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) #define RESUME_VECTOR_ADDR 0xa0100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) #define BOOTSTRAP_WORDS mioa701_bootstrap_lg/4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static u32 *save_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) static void install_bootstrap(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) u32 *rom_bootstrap = phys_to_virt(RESUME_VECTOR_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) u32 *src = &mioa701_bootstrap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) for (i = 0; i < BOOTSTRAP_WORDS; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) rom_bootstrap[i] = src[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) static int mioa701_sys_suspend(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) int i = 0, is_bt_on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) /* Devices prepare suspend */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) is_bt_on = !!gpio_get_value(GPIO83_BT_ON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) pxa2xx_mfp_set_lpm(GPIO83_BT_ON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) is_bt_on ? MFP_LPM_DRIVE_HIGH : MFP_LPM_DRIVE_LOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) for (i = 0; i < BOOTSTRAP_WORDS; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) save_buffer[i] = mem_resume_vector[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) save_buffer[i++] = *mem_resume_enabler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) save_buffer[i++] = *mem_resume_bt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) save_buffer[i++] = *mem_resume_unknown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) *mem_resume_enabler = RESUME_ENABLE_VAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) *mem_resume_bt = is_bt_on;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) install_bootstrap();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) return 0;
^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 mioa701_sys_resume(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) int i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) for (i = 0; i < BOOTSTRAP_WORDS; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) mem_resume_vector[i] = save_buffer[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) *mem_resume_enabler = save_buffer[i++];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) *mem_resume_bt = save_buffer[i++];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) *mem_resume_unknown = save_buffer[i++];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) static struct syscore_ops mioa701_syscore_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) .suspend = mioa701_sys_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) .resume = mioa701_sys_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) static int __init bootstrap_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) int save_size = mioa701_bootstrap_lg + (sizeof(u32) * 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) register_syscore_ops(&mioa701_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) save_buffer = kmalloc(save_size, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) if (!save_buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) printk(KERN_INFO "MioA701: allocated %d bytes for bootstrap\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) save_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) static void bootstrap_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) kfree(save_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) unregister_syscore_ops(&mioa701_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) printk(KERN_CRIT "Unregistering mioa701 suspend will hang next"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) "resume !!!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) * Power Supply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) static char *supplicants[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) "mioa701_battery"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) static int is_ac_connected(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) return gpio_get_value(GPIO96_AC_DETECT);
^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) static void mioa701_set_charge(int flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) gpio_set_value(GPIO9_CHARGE_EN, (flags == PDA_POWER_CHARGE_USB));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) static struct pda_power_pdata power_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) .is_ac_online = is_ac_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) .is_usb_online = is_usb_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) .set_charge = mioa701_set_charge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) .supplied_to = supplicants,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) .num_supplicants = ARRAY_SIZE(supplicants),
^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 resource power_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) .name = "ac",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) .start = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) .end = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) IORESOURCE_IRQ_LOWEDGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) .name = "usb",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) .start = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) .end = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) IORESOURCE_IRQ_LOWEDGE,
^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)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) static struct platform_device power_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) .name = "pda-power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) .resource = power_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) .num_resources = ARRAY_SIZE(power_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) .platform_data = &power_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) static struct wm97xx_batt_pdata mioa701_battery_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) .batt_aux = WM97XX_AUX_ID1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) .temp_aux = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) .charge_gpio = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) .min_voltage = 0xc00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) .max_voltage = 0xfc0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) .batt_div = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) .batt_mult = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) .batt_name = "mioa701_battery",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) static struct wm97xx_pdata mioa701_wm97xx_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) .batt_pdata = &mioa701_battery_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) * Voltage regulation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) static struct regulator_consumer_supply max1586_consumers[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) REGULATOR_SUPPLY("vcc_core", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) static struct regulator_init_data max1586_v3_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) .constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) .name = "vcc_core range",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) .min_uV = 1000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) .max_uV = 1705000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) .always_on = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) .num_consumer_supplies = ARRAY_SIZE(max1586_consumers),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) .consumer_supplies = max1586_consumers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) static struct max1586_subdev_data max1586_subdevs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) { .name = "vcc_core", .id = MAX1586_V3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) .platform_data = &max1586_v3_info },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) static struct max1586_platform_data max1586_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) .subdevs = max1586_subdevs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) .num_subdevs = ARRAY_SIZE(max1586_subdevs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) .v3_gain = MAX1586_GAIN_NO_R24, /* 700..1475 mV */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * Camera interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) struct pxacamera_platform_data mioa701_pxacamera_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) .mclk_10khz = 5000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) .sensor_i2c_adapter_id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .sensor_i2c_address = 0x5d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) static struct i2c_board_info __initdata mioa701_pi2c_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) I2C_BOARD_INFO("max1586", 0x14),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) .platform_data = &max1586_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) /* Board I2C devices. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) static struct i2c_board_info mioa701_i2c_devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) I2C_BOARD_INFO("mt9m111", 0x5d),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) struct i2c_pxa_platform_data i2c_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) .fast_mode = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) static pxa2xx_audio_ops_t mioa701_ac97_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) .reset_gpio = 95,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) .codec_pdata = { &mioa701_wm97xx_pdata, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) * Mio global
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) /* Devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) #define MIO_PARENT_DEV(var, strname, tparent, pdata) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) static struct platform_device var = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) .name = strname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) .id = -1, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) .dev = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) .platform_data = pdata, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) .parent = tparent, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) #define MIO_SIMPLE_DEV(var, strname, pdata) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) MIO_PARENT_DEV(var, strname, NULL, pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) MIO_SIMPLE_DEV(mioa701_gpio_keys, "gpio-keys", &mioa701_gpio_keys_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) MIO_PARENT_DEV(mioa701_backlight, "pwm-backlight", &pxa27x_device_pwm0.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) &mioa701_backlight_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) static struct platform_device *devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) &mioa701_gpio_keys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) &mioa701_backlight,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) &mioa701_led,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) &pxa2xx_pcm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) &mioa701_sound,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) &power_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) &docg3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) &gpio_vbus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) &mioa701_board,
^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) static void mioa701_machine_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) static void mioa701_poweroff(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) mioa701_machine_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) pxa_restart(REBOOT_SOFT, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) static void mioa701_restart(enum reboot_mode c, const char *cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) mioa701_machine_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) pxa_restart(REBOOT_SOFT, cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) static struct gpio global_gpios[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) { GPIO9_CHARGE_EN, GPIOF_OUT_INIT_HIGH, "Charger enable" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) { GPIO18_POWEROFF, GPIOF_OUT_INIT_LOW, "Power Off" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) { GPIO87_LCD_POWER, GPIOF_OUT_INIT_LOW, "LCD Power" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) { GPIO56_MT9M111_nOE, GPIOF_OUT_INIT_LOW, "Camera nOE" },
^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) static struct regulator_consumer_supply fixed_5v0_consumers[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) REGULATOR_SUPPLY("power", "pwm-backlight"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) static void __init mioa701_machine_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) PSLR = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) RTTR = 32768 - 1; /* Reset crazy WinCE value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) UP2OCR = UP2OCR_HXOE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) * Set up the flash memory : DiskOnChip G3 on first static memory bank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) __raw_writel(0x7ff02dd8, MSC0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) __raw_writel(0x0001c391, MCMEM0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) __raw_writel(0x0001c391, MCATT0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) __raw_writel(0x0001c391, MCIO0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) rc = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) pr_err("MioA701: Failed to request GPIOs: %d", rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) bootstrap_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) pxa_set_fb_info(NULL, &mioa701_pxafb_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) gpiod_add_lookup_table(&mioa701_mci_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) pxa_set_mci_info(&mioa701_mci_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) pxa_set_keypad_info(&mioa701_keypad_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) pxa_set_udc_info(&mioa701_udc_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) pxa_set_ac97_info(&mioa701_ac97_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) pm_power_off = mioa701_poweroff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) pwm_add_table(mioa701_pwm_lookup, ARRAY_SIZE(mioa701_pwm_lookup));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) gpiod_add_lookup_table(&gpio_vbus_gpiod_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) platform_add_devices(devices, ARRAY_SIZE(devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) gsm_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) i2c_register_board_info(0, ARRAY_AND_SIZE(mioa701_i2c_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) i2c_register_board_info(1, ARRAY_AND_SIZE(mioa701_pi2c_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) pxa_set_i2c_info(&i2c_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) pxa27x_set_i2c_power_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) pxa_set_camera_info(&mioa701_pxacamera_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) regulator_register_always_on(0, "fixed-5.0V", fixed_5v0_consumers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) ARRAY_SIZE(fixed_5v0_consumers),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) 5000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) regulator_has_full_constraints();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) static void mioa701_machine_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) bootstrap_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) gsm_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) MACHINE_START(MIOA701, "MIO A701")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) .map_io = &pxa27x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) .init_irq = &pxa27x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) .handle_irq = &pxa27x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) .init_machine = mioa701_machine_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) .restart = mioa701_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) MACHINE_END