mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-09-24 07:35:43 +00:00
mark your calendars: this is the day one kernel supports both boards
one regression: wireless on smarttop has stopped working, probably not being reset properly
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.31.14.17
|
||||
# Sat Feb 12 03:18:38 2011
|
||||
# Fri Feb 18 01:05:21 2011
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_HAVE_PWM=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
CONFIG_GENERIC_GPIO=y
|
||||
CONFIG_GENERIC_TIME=y
|
||||
@@ -218,8 +219,8 @@ CONFIG_ARCH_MX51=y
|
||||
CONFIG_MX5_OPTIONS=y
|
||||
# CONFIG_MACH_MX51_3DS is not set
|
||||
# CONFIG_MACH_MX51_BABBAGE is not set
|
||||
CONFIG_MACH_MX51_EFIKASB=y
|
||||
CONFIG_MACH_MX51_EFIKAMX=y
|
||||
# CONFIG_MACH_MX51_EFIKASB is not set
|
||||
# CONFIG_MACH_MX53_EVK is not set
|
||||
# CONFIG_MACH_MX50_ARM2 is not set
|
||||
|
||||
@@ -229,7 +230,7 @@ CONFIG_MACH_MX51_EFIKAMX=y
|
||||
CONFIG_MXC_TZIC=y
|
||||
CONFIG_ISP1504_MXC=y
|
||||
# CONFIG_MXC_IRQ_PRIOR is not set
|
||||
# CONFIG_MXC_PWM is not set
|
||||
CONFIG_MXC_PWM=y
|
||||
CONFIG_MXC_DVFS_PER=y
|
||||
|
||||
#
|
||||
@@ -1175,8 +1176,9 @@ CONFIG_INPUT_MOUSE=y
|
||||
# CONFIG_MOUSE_BCM5974 is not set
|
||||
# CONFIG_MOUSE_VSXXXAA is not set
|
||||
# CONFIG_MOUSE_GPIO is not set
|
||||
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
|
||||
# CONFIG_MOUSE_SYNAPTICS_USB is not set
|
||||
CONFIG_MOUSE_SYNAPTICS_I2C=m
|
||||
CONFIG_MOUSE_SYNAPTICS_USB=m
|
||||
# CONFIG_MOUSE_SYNAPTICS_CPADDEV is not set
|
||||
CONFIG_INPUT_JOYSTICK=y
|
||||
# CONFIG_JOYSTICK_ANALOG is not set
|
||||
# CONFIG_JOYSTICK_A3D is not set
|
||||
@@ -1399,8 +1401,7 @@ CONFIG_POWER_SUPPLY=y
|
||||
# CONFIG_BATTERY_DS2782 is not set
|
||||
# CONFIG_BATTERY_BQ27x00 is not set
|
||||
# CONFIG_BATTERY_MAX17040 is not set
|
||||
# CONFIG_BATTERY_SBS is not set
|
||||
# CONFIG_BATTERY_EFIKASB is not set
|
||||
CONFIG_BATTERY_SBS=m
|
||||
# CONFIG_HWMON is not set
|
||||
# CONFIG_THERMAL is not set
|
||||
# CONFIG_THERMAL_HWMON is not set
|
||||
@@ -1547,7 +1548,7 @@ CONFIG_VIDEO_PVRUSB2_DVB=y
|
||||
CONFIG_VIDEO_HDPVR=m
|
||||
CONFIG_VIDEO_EM28XX=m
|
||||
CONFIG_VIDEO_EM28XX_ALSA=m
|
||||
# CONFIG_VIDEO_EM28XX_DVB is not set
|
||||
CONFIG_VIDEO_EM28XX_DVB=m
|
||||
CONFIG_VIDEO_CX231XX=m
|
||||
CONFIG_VIDEO_CX231XX_ALSA=m
|
||||
CONFIG_VIDEO_CX231XX_DVB=m
|
||||
@@ -1761,6 +1762,7 @@ CONFIG_FB_MXC_SYNC_PANEL=y
|
||||
# CONFIG_FB_MXC_CLAA_WVGA_SYNC_PANEL is not set
|
||||
CONFIG_FB_MXC_SIIHDMI=y
|
||||
# CONFIG_FB_SIIHDMI_HOTPLUG is not set
|
||||
CONFIG_FB_MXC_MTL017=y
|
||||
# CONFIG_FB_MXC_CH7026 is not set
|
||||
# CONFIG_FB_MXC_TVOUT_CH7024 is not set
|
||||
# CONFIG_FB_MXC_ASYNC_PANEL is not set
|
||||
@@ -1773,8 +1775,9 @@ CONFIG_FB_MXC_SIIHDMI=y
|
||||
# CONFIG_FB_BROADSHEET is not set
|
||||
CONFIG_BACKLIGHT_LCD_SUPPORT=y
|
||||
# CONFIG_LCD_CLASS_DEVICE is not set
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=m
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
# CONFIG_BACKLIGHT_GENERIC is not set
|
||||
CONFIG_BACKLIGHT_PWM=y
|
||||
# CONFIG_BACKLIGHT_MXC is not set
|
||||
|
||||
#
|
||||
@@ -2114,6 +2117,7 @@ CONFIG_LEDS_GPIO_PLATFORM=y
|
||||
# CONFIG_LEDS_LP3944 is not set
|
||||
# CONFIG_LEDS_PCA955X is not set
|
||||
# CONFIG_LEDS_DAC124S085 is not set
|
||||
# CONFIG_LEDS_PWM is not set
|
||||
# CONFIG_LEDS_BD2802 is not set
|
||||
|
||||
#
|
||||
@@ -2126,6 +2130,7 @@ CONFIG_LEDS_TRIGGER_IDE_DISK=y
|
||||
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
|
||||
CONFIG_LEDS_TRIGGER_GPIO=y
|
||||
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||
CONFIG_LEDS_TRIGGER_INPUT=y
|
||||
|
||||
#
|
||||
# iptables trigger is under Netfilter config (LED target)
|
||||
@@ -2328,6 +2333,7 @@ CONFIG_MXC_VPU=y
|
||||
#
|
||||
# Broadcom GPS ioctrl support
|
||||
#
|
||||
# CONFIG_GPS_IOCTRL is not set
|
||||
|
||||
#
|
||||
# MXC Media Local Bus Driver
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,17 +41,15 @@ config MACH_MX51_BABBAGE
|
||||
Include support for MX51 Babbage platform. This includes specific
|
||||
configurations for the board and its peripherals.
|
||||
|
||||
config MACH_MX51_EFIKAMX
|
||||
bool "Support Genesi Efika MX Smarttop"
|
||||
select ARCH_MX51
|
||||
help
|
||||
Include support for Genesi Efika MX Smarttop.
|
||||
|
||||
config MACH_MX51_EFIKASB
|
||||
bool "Support Genesi Efika MX Smartbook"
|
||||
select ARCH_MX51
|
||||
help
|
||||
Include support for Genesi Efika MX Smartbook.
|
||||
bool
|
||||
|
||||
config MACH_MX51_EFIKAMX
|
||||
bool "Support Genesi Efika MX Platforms (Smarttop and Smartbook)"
|
||||
select ARCH_MX51
|
||||
select MACH_MX51_EFIKASB
|
||||
help
|
||||
Include support for Genesi Efika MX Platforms.
|
||||
|
||||
config MACH_MX53_EVK
|
||||
bool "Support MX53 EVK platform"
|
||||
|
||||
@@ -17,14 +17,13 @@ obj-$(CONFIG_MACH_MX51_BABBAGE) += mx51_babbage.o mx51_babbage_gpio.o mx51_babba
|
||||
obj-$(CONFIG_MACH_MX53_EVK) += mx53_evk.o mx53_evk_gpio.o mx53_evk_pmic_mc13892.o
|
||||
obj-$(CONFIG_MACH_MX50_ARM2) += mx50_arm2.o mx50_arm2_gpio.o mx50_arm2_pmic_mc13892.o
|
||||
|
||||
obj-$(CONFIG_MACH_MX51_EFIKAMX) += mx51_efikamx.o mx51_efikamx_io.o mx51_efikamx_cpu.o \
|
||||
mx51_efikamx_uart.o mx51_efikamx_usb.o mx51_efikamx_i2c.o \
|
||||
mx51_efikamx_spi.o mx51_efikamx_nor.o mx51_efikamx_pmic.o \
|
||||
mx51_efikamx_mmc.o mx51_efikamx_ata.o mx51_efikamx_powerkey.o \
|
||||
mx51_efikamx_audio.o mx51_efikamx_display.o early_setup.o
|
||||
obj-$(CONFIG_MACH_MX51_EFIKASB) += mx51_efikasb.o mx51_efikasb_gpio.o mx51_efikamx_cpu.o mx51_efikasb_pmic.o \
|
||||
mx51_efikasb_switch.o mx51_efikasb_lid.o \
|
||||
mx51_efikamx_audio.o mx51_efikamx_ata.o mx51_efikamx_mmc.o \
|
||||
mx51_efikamx_uart.o mx51_efikasb_leds.o mx51_efikamx_spi.o \
|
||||
mx51_efikamx_nor.o mx51_efikamx_display.o mx51_efikamx_i2c.o \
|
||||
mx51_efikasb_battery.o mx51_efikasb_wwan.o early_setup.o
|
||||
obj-$(CONFIG_MACH_MX51_EFIKAMX) += mx51_efikamx.o \
|
||||
mx51_efikamx_cpu.o mx51_efikamx_uart.o \
|
||||
mx51_efikamx_i2c.o mx51_efikamx_spi.o \
|
||||
mx51_efikamx_nor.o mx51_efikamx_pmic.o \
|
||||
mx51_efikamx_mmc.o mx51_efikamx_ata.o \
|
||||
mx51_efikamx_input.o mx51_efikamx_leds.o \
|
||||
mx51_efikamx_audio.o mx51_efikamx_display.o \
|
||||
mx51_efikamx_wwan.o mx51_efikamx_usb.o \
|
||||
mx51_efikamx_battery.o \
|
||||
early_setup.o
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
* Copyright 2009-2011 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -13,17 +13,20 @@
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fsl_devices.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/map.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
@@ -54,7 +57,173 @@
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
|
||||
extern struct resource mxcfb_resources[];
|
||||
int mx51_efikamx_id = 0; /* can't get less than 1.0 */
|
||||
int mx51_efikamx_mem = 0;
|
||||
|
||||
char *mx51_efikasb_memory_types[3] = {
|
||||
"Nanya DDR2",
|
||||
"Hynix DDR2",
|
||||
"Micron DDR2",
|
||||
};
|
||||
|
||||
#define EFIKAMX_PCBID0 MX51_PIN_NANDF_CS0
|
||||
#define EFIKAMX_PCBID1 MX51_PIN_NANDF_CS1
|
||||
#define EFIKAMX_PCBID2 MX51_PIN_NANDF_RB3
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_id_iomux_pins[] = {
|
||||
/* Note the 100K pullups. These are being driven low by the different revisions */
|
||||
{ EFIKAMX_PCBID0, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
{ EFIKAMX_PCBID1, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
{ EFIKAMX_PCBID2, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
};
|
||||
|
||||
#define EFIKASB_MEMID0 MX51_PIN_EIM_LBA
|
||||
#define EFIKASB_MEMID1 MX51_PIN_EIM_CRE
|
||||
#define EFIKASB_PCBID0 MX51_PIN_EIM_CS3
|
||||
#define EFIKASB_PCBID1 MX51_PIN_EIM_CS4
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_id_iomux_pins[] = {
|
||||
{ EFIKASB_PCBID0, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_PCBID1, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_MEMID0, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_MEMID1, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
EIM A16 CKIH_FREQ_SEL[0]
|
||||
EIM A17 CKIH_FREQ_SEL[1]
|
||||
EIM A18 BT_LPB[0]
|
||||
EIM A19 BT_LPB[1]
|
||||
EIM A20 BT_UART_SRC[0]
|
||||
EIM A21 BT_UART_SRC[1]
|
||||
EIM A22 TBD3 ???
|
||||
EIM A23 BT_HPN_EN
|
||||
|
||||
EIM LBA (GPIO3_1) DI1_PIN12
|
||||
EIM CRE (GPIO3_2) DI1_PIN13 - Test Point (1.2+), WDOG (1.0, 1.1)
|
||||
|
||||
DI_GP4 DISP2_DRDY_CPU
|
||||
*/
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_general_iomux_pins[] = {
|
||||
{ MX51_PIN_EIM_A18, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_A19, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_A20, IOMUX_CONFIG_GPIO, (PAD_CTL_PKE_ENABLE), },
|
||||
{ MX51_PIN_EIM_A21, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_LBA, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_CRE, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_DI_GP4, IOMUX_CONFIG_ALT4, },
|
||||
};
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_general_iomux_pins[] = {
|
||||
/* ron: GPIO2_24 CPU 22.5792M OSC enable */
|
||||
{ MX51_PIN_EIM_OE, IOMUX_CONFIG_ALT1, (PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE), },
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int mx51_efikamx_revision(void)
|
||||
{
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
return(mx51_efikamx_id & 0xf);
|
||||
} else if (machine_is_mx51_efikasb()) {
|
||||
return(mx51_efikamx_id);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *mx51_efikamx_memory(void)
|
||||
{
|
||||
return(mx51_efikasb_memory_types[mx51_efikamx_mem]);
|
||||
}
|
||||
|
||||
|
||||
void mx51_efikamx_board_id(void)
|
||||
{
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
int pcbid[3];
|
||||
|
||||
mx51_efikamx_id = 0x10; /* can't get less than 1.0 */
|
||||
|
||||
/* NOTE:
|
||||
IOMUX settings have to settle so run the iomux setup long before this
|
||||
function has to otherwise it will give freakish results.
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID0), "efikamx:pcbid0");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID0));
|
||||
pcbid[0] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID0));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID1), "efikamx:pcbid1");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID1));
|
||||
pcbid[1] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID1));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID2), "efikamx:pcbid2");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID2));
|
||||
pcbid[2] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID2));
|
||||
|
||||
/*
|
||||
* PCBID2 PCBID1 PCBID0 STATE
|
||||
* 1 1 1 ER1:rev1.1
|
||||
* 1 1 0 ER2:rev1.2
|
||||
* 1 0 1 ER3:rev1.3
|
||||
* 1 0 0 ER4:rev1.4
|
||||
*/
|
||||
if (pcbid[2] == 1) {
|
||||
if (pcbid[1] == 1) {
|
||||
if (pcbid[0] == 1) {
|
||||
mx51_efikamx_id = 0x11;
|
||||
} else {
|
||||
mx51_efikamx_id = 0x12;
|
||||
}
|
||||
} else {
|
||||
if (pcbid[0] == 1) {
|
||||
mx51_efikamx_id = 0x13;
|
||||
} else {
|
||||
mx51_efikamx_id = 0x14;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mx51_efikamx_id == 0x10) || /* "developer edition" */
|
||||
(mx51_efikamx_id == 0x12) || /* unreleased, broken PATA */
|
||||
(mx51_efikamx_id == 0x14) ) { /* unreleased.. */
|
||||
DBG(("PCB Identification Error!\n"));
|
||||
DBG(("Unsupported board revision 1.%u - USE AT YOUR OWN RISK!\n",
|
||||
mx51_efikamx_revision() ));
|
||||
}
|
||||
} else if (machine_is_mx51_efikasb()) {
|
||||
int pcbid[2], memid[2];
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_MEMID0), "efikasb:memid0");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_MEMID0));
|
||||
memid[0] = gpio_get_value(IOMUX_TO_GPIO(EFIKASB_MEMID0));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_MEMID1), "efikasb:memid1");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_MEMID1));
|
||||
memid[1] = gpio_get_value(IOMUX_TO_GPIO(EFIKASB_MEMID1));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_PCBID0), "efikasb:pcbid0");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_PCBID0));
|
||||
pcbid[0] = gpio_get_value(IOMUX_TO_GPIO(EFIKASB_PCBID0));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_PCBID1), "efikasb:pcbid1");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_PCBID1));
|
||||
pcbid[1] = gpio_get_value(IOMUX_TO_GPIO(EFIKASB_PCBID1));
|
||||
|
||||
/*
|
||||
* PCBID1 PCBID0 STATE
|
||||
* 0 1 TO2: Revision 1.3
|
||||
* 1 0 TO3: Revision 2.0
|
||||
*/
|
||||
|
||||
/* gives us 0x1 or 0x2 */
|
||||
mx51_efikamx_id = pcbid[0] | (pcbid[1] << 1);
|
||||
mx51_efikamx_mem = memid[0] | (memid[1] << 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void __init mx51_efikamx_board_init(void)
|
||||
@@ -62,15 +231,57 @@ static void __init mx51_efikamx_board_init(void)
|
||||
mxc_cpu_common_init();
|
||||
mxc_register_gpios();
|
||||
|
||||
mx51_efikamx_io_init();
|
||||
CONFIG_IOMUX(mx51_efikamx_general_iomux_pins);
|
||||
|
||||
/* do ID pins first! */
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
CONFIG_IOMUX(mx51_efikamx_id_iomux_pins);
|
||||
} else if (machine_is_mx51_efikasb()) {
|
||||
CONFIG_IOMUX(mx51_efikasb_id_iomux_pins);
|
||||
CONFIG_IOMUX(mx51_efikasb_general_iomux_pins);
|
||||
}
|
||||
|
||||
/* common platform configuration for all boards */
|
||||
mx51_efikamx_init_uart();
|
||||
mx51_efikamx_init_soc();
|
||||
mx51_efikamx_init_nor();
|
||||
mx51_efikamx_init_spi();
|
||||
mx51_efikamx_init_i2c();
|
||||
mx51_efikamx_init_pata();
|
||||
|
||||
/* we do board id late because it takes time to settle */
|
||||
mx51_efikamx_board_id();
|
||||
|
||||
/* these all depend on board id */
|
||||
mx51_efikamx_init_display();
|
||||
mx51_efikamx_init_audio();
|
||||
mx51_efikamx_init_pmic();
|
||||
mx51_efikamx_init_mmc();
|
||||
mx51_efikamx_init_input();
|
||||
mx51_efikamx_init_leds();
|
||||
mx51_efikamx_init_usb();
|
||||
|
||||
pm_power_off = mx51_efikamx_power_off;
|
||||
|
||||
printk(KERN_INFO "Efika MX Revision 1.%u", mx51_efikamx_revision());
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
mxc_free_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT2);
|
||||
mxc_free_iomux(MX51_PIN_GPIO1_3, IOMUX_CONFIG_ALT2);
|
||||
mxc_free_iomux(MX51_PIN_EIM_LBA, IOMUX_CONFIG_GPIO);
|
||||
|
||||
DBG(("Smarttop Revision 1.%u", mx51_efikamx_revision() ));
|
||||
} else if (machine_is_mx51_efikasb()) {
|
||||
mx51_efikamx_init_wwan();
|
||||
mx51_efikamx_init_battery();
|
||||
|
||||
/* dastardly code to give us 1.3 or 2.0 out of "1" or "2" */
|
||||
DBG(("Smartbook Revision %u.%u\n",
|
||||
mx51_efikamx_revision(),
|
||||
((mx51_efikamx_revision() == 1) ? 3 : 0) ));
|
||||
DBG(("Memory type %s\n", mx51_efikamx_memory() ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* is in mx51_efikamx_cpu.c */
|
||||
static struct sys_timer mx51_efikamx_timer = {
|
||||
.init = mx51_efikamx_timer_init,
|
||||
};
|
||||
@@ -146,3 +357,12 @@ MACHINE_START(MX51_EFIKAMX, "Genesi Efika MX (Smarttop)")
|
||||
.init_machine = mx51_efikamx_board_init,
|
||||
.timer = &mx51_efikamx_timer,
|
||||
MACHINE_END
|
||||
|
||||
MACHINE_START(MX51_EFIKASB, "Genesi Efika MX (Smartbook)")
|
||||
/* Maintainer: Genesi, Inc. */
|
||||
.fixup = mx51_efikamx_fixup,
|
||||
.map_io = mx5_map_io,
|
||||
.init_irq = mx5_init_irq,
|
||||
.init_machine = mx51_efikamx_board_init,
|
||||
.timer = &mx51_efikamx_timer,
|
||||
MACHINE_END
|
||||
|
||||
@@ -27,19 +27,23 @@ extern void __init mx51_efikamx_init_leds(void);
|
||||
extern void __init mx51_efikamx_init_power_key(void);
|
||||
extern void __init mx51_efikamx_init_spi(void);
|
||||
extern void __init mx51_efikamx_init_i2c(void);
|
||||
extern void __init mx51_efikamx_init_i2c2(void);
|
||||
extern void __init mx51_efikamx_init_nor(void);
|
||||
extern void __init mx51_efikamx_init_display(void);
|
||||
extern void __init mx51_efikamx_init_audio(void);
|
||||
extern void __init mx51_efikamx_init_usb(void);
|
||||
extern void __init mx51_efikamx_init_pata(void);
|
||||
extern void __init mx51_efikamx_init_usb(void);
|
||||
extern void __init mx51_efikamx_init_input(void);
|
||||
extern void __init mx51_efikamx_init_leds(void);
|
||||
extern void __init mx51_efikamx_init_wwan(void);
|
||||
extern int __init mx51_efikamx_init_pmic(void);
|
||||
extern void __init mx51_efikamx_init_soc(void);
|
||||
extern void __init mx51_efikamx_init_battery(void);
|
||||
|
||||
/* io */
|
||||
extern void mx51_efikamx_board_id(void);
|
||||
extern int mx51_efikamx_revision(void);
|
||||
extern char *mx51_efikamx_memory(void);
|
||||
|
||||
/* cpu */
|
||||
extern struct cpu_wp *(*get_cpu_wp)(int *wp);
|
||||
@@ -70,10 +74,11 @@ extern void mx51_efikamx_power_off(void);
|
||||
extern void mx51_efikamx_display_adjust_mem(int gpu_start, int gpu_mem, int fb_mem);
|
||||
#define DBG(x) { printk(KERN_INFO "Efika MX: "); printk x ; }
|
||||
|
||||
// also valid values: 125000 (leaves some bandwdith), 133333 (IPU max on MX51)
|
||||
// arbitrarily chosen to be 117MHz just because I heard someone at Freescale
|
||||
// mention this as the best value to leave enough for the VPU and so on..
|
||||
#define PIXCLK_LIMIT KHZ2PICOS(117000)
|
||||
#define MXCFB_DEFAULT_BPP 16
|
||||
extern void mx51_efikamx_wifi_power(int state);
|
||||
extern void mx51_efikamx_wifi_reset(void);
|
||||
extern void mx51_efikamx_bluetooth_power(int state);
|
||||
extern void mx51_efikamx_camera_power(int state);
|
||||
extern void mx51_efikamx_wwan_power(int state);
|
||||
|
||||
|
||||
#endif /* __MX51_EFIKAMX_H__ */
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
* Copyright 2009-2011 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/irq.h>
|
||||
@@ -14,17 +12,19 @@
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/sbs.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "mx51_efikasb.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
#define EFIKASB_BATTERY_LOW MX51_PIN_DI1_PIN11
|
||||
#define EFIKASB_BATTERY_INSERT MX51_PIN_DISPB2_SER_DIO
|
||||
#define EFIKASB_AC_INSERT MX51_PIN_DI1_D0_CS
|
||||
|
||||
static struct mxc_iomux_pin_cfg mx51_efikasb_battery_pins[] = {
|
||||
static struct mxc_iomux_pin_cfg mx51_efikamx_battery_pins[] = {
|
||||
{ EFIKASB_BATTERY_INSERT, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_BATTERY_LOW, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION, },
|
||||
{ EFIKASB_AC_INSERT, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
@@ -34,13 +34,13 @@ static struct mxc_iomux_pin_cfg mx51_efikasb_battery_pins[] = {
|
||||
|
||||
|
||||
|
||||
enum mxc_power_resource {
|
||||
enum power_resource_index {
|
||||
MAINS_INSERTION_STATUS,
|
||||
BATTERY_INSERTION_STATUS,
|
||||
BATTERY_ALERT,
|
||||
};
|
||||
|
||||
static struct resource mxc_power_resources[] = {
|
||||
static struct resource mx51_efikamx_power_resources[] = {
|
||||
[MAINS_INSERTION_STATUS] = {
|
||||
.start = IOMUX_TO_IRQ(EFIKASB_AC_INSERT),
|
||||
.end = IOMUX_TO_IRQ(EFIKASB_AC_INSERT),
|
||||
@@ -61,51 +61,53 @@ static struct resource mxc_power_resources[] = {
|
||||
},
|
||||
};
|
||||
|
||||
int mx51_efikasb_battery_status(void)
|
||||
int mx51_efikamx_battery_status(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(EFIKASB_BATTERY_INSERT));
|
||||
}
|
||||
|
||||
int mx51_efikasb_battery_alarm(void)
|
||||
int mx51_efikamx_battery_alarm(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(EFIKASB_BATTERY_LOW));
|
||||
}
|
||||
|
||||
int mx51_efikasb_ac_status(void)
|
||||
int mx51_efikamx_ac_status(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(EFIKASB_AC_INSERT));
|
||||
}
|
||||
|
||||
static struct sbs_platform_data mx51_efikasb_sbs_platform_data = {
|
||||
.mains_insertion_status = mx51_efikasb_ac_status,
|
||||
.battery_insertion_status = mx51_efikasb_battery_status,
|
||||
static struct sbs_platform_data mx51_efikamx_sbs_platform_data = {
|
||||
.mains_insertion_status = mx51_efikamx_ac_status,
|
||||
.battery_insertion_status = mx51_efikamx_battery_status,
|
||||
|
||||
.battery_alert = &mxc_power_resources[BATTERY_ALERT],
|
||||
.battery_alert = &mx51_efikamx_power_resources[BATTERY_ALERT],
|
||||
|
||||
.mains_presence_changed = &mxc_power_resources[MAINS_INSERTION_STATUS],
|
||||
.battery_presence_changed = &mxc_power_resources[BATTERY_INSERTION_STATUS],
|
||||
.mains_presence_changed = &mx51_efikamx_power_resources[MAINS_INSERTION_STATUS],
|
||||
.battery_presence_changed = &mx51_efikamx_power_resources[BATTERY_INSERTION_STATUS],
|
||||
};
|
||||
|
||||
static struct i2c_board_info mx51_efikasb_i2c_battery __initdata = {
|
||||
static struct i2c_board_info mx51_efikamx_i2c_battery __initdata = {
|
||||
.type = "smart-battery",
|
||||
.addr = 0x0b,
|
||||
.platform_data = &mx51_efikasb_sbs_platform_data,
|
||||
.platform_data = &mx51_efikamx_sbs_platform_data,
|
||||
};
|
||||
|
||||
void __init mx51_efikasb_init_battery(void)
|
||||
void __init mx51_efikamx_init_battery(void)
|
||||
{
|
||||
CONFIG_IOMUX(mx51_efikasb_battery_pins);
|
||||
if (machine_is_mx51_efikasb()) {
|
||||
CONFIG_IOMUX(mx51_efikamx_battery_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_BATTERY_INSERT), "battery:insert");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_BATTERY_INSERT));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_BATTERY_INSERT), "battery:insert");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_BATTERY_INSERT));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_BATTERY_LOW), "battery:alarm");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_BATTERY_LOW));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_BATTERY_LOW), "battery:alarm");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_BATTERY_LOW));
|
||||
|
||||
/* ron: IOMUXC_GPIO3_IPP_IND_G_IN_3_SELECT_INPUT: 1: Selecting Pad DI1_D0_CS for Mode:ALT4 */
|
||||
__raw_writel(0x01, IO_ADDRESS(IOMUXC_BASE_ADDR) + 0x980);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_AC_INSERT), "battery:ac");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_AC_INSERT));
|
||||
/* ron: IOMUXC_GPIO3_IPP_IND_G_IN_3_SELECT_INPUT: 1: Selecting Pad DI1_D0_CS for Mode:ALT4 */
|
||||
__raw_writel(0x01, IO_ADDRESS(IOMUXC_BASE_ADDR) + 0x980);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_AC_INSERT), "battery:ac");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_AC_INSERT));
|
||||
|
||||
i2c_register_board_info(1, &mx51_efikasb_i2c_battery, 1);
|
||||
i2c_register_board_info(1, &mx51_efikamx_i2c_battery, 1);
|
||||
}
|
||||
}
|
||||
221
arch/arm/mach-mx5/mx51_efikamx_input.c
Normal file
221
arch/arm/mach-mx5/mx51_efikamx_input.c
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright 2009 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
#define POWER_ON 1
|
||||
#define POWER_OFF 0
|
||||
|
||||
#define EFIKASB_LID_SWITCH MX51_PIN_CSI1_VSYNC
|
||||
#define EFIKASB_RFKILL_SWITCH MX51_PIN_DI1_PIN12
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikasb_input_iomux_pins[] = {
|
||||
{ EFIKASB_LID_SWITCH, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_RFKILL_SWITCH, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
#define EFIKAMX_WIFI_POWER MX51_PIN_EIM_A22
|
||||
#define EFIKAMX_WIFI_RESET MX51_PIN_EIM_A16
|
||||
#define EFIKAMX_BT_POWER MX51_PIN_EIM_A17
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikamx_power_iomux_pins[] = {
|
||||
{ EFIKAMX_WIFI_POWER, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKAMX_WIFI_RESET, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKAMX_BT_POWER, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
#define EFIKASB_CAMERA_POWER MX51_PIN_NANDF_CS0
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikasb_power_iomux_pins[] = {
|
||||
{ EFIKASB_CAMERA_POWER, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
#define EFIKAMX_POWER_KEY MX51_PIN_EIM_DTACK
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikamx_input_iomux_pins[] = {
|
||||
{
|
||||
EFIKAMX_POWER_KEY, IOMUX_CONFIG_GPIO,
|
||||
(PAD_CTL_PKE_ENABLE | PAD_CTL_100K_PU),
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_keys_button mx51_efikamx_powerkey[] = {
|
||||
{
|
||||
.code = KEY_POWER | KEY_SLEEP | KEY_WAKEUP,
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_POWER_KEY),
|
||||
.type = EV_KEY | EV_PWR,
|
||||
.desc = "Power Button",
|
||||
.wakeup = 1,
|
||||
.debounce_interval = 10, /* ms */
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data mx51_efikamx_powerkey_data = {
|
||||
.buttons = mx51_efikamx_powerkey,
|
||||
.nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey),
|
||||
};
|
||||
|
||||
|
||||
static struct platform_device mx51_efikamx_input_device = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikamx_powerkey_data,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
int mx51_efikasb_rfkill_status(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(EFIKASB_RFKILL_SWITCH));
|
||||
}
|
||||
|
||||
static struct gpio_keys_button mx51_efikasb_input[] = {
|
||||
/* yes, this is duplicated! */
|
||||
{
|
||||
.code = KEY_POWER | KEY_SLEEP | KEY_WAKEUP,
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_POWER_KEY),
|
||||
.type = EV_KEY | EV_PWR,
|
||||
.desc = "Power Button",
|
||||
.wakeup = 1,
|
||||
.debounce_interval = 10, /* ms */
|
||||
},
|
||||
{
|
||||
.code = SW_LID,
|
||||
.gpio = IOMUX_TO_GPIO(EFIKASB_LID_SWITCH),
|
||||
.type = EV_SW,
|
||||
.desc = "Lid Switch",
|
||||
.active_low = 1,
|
||||
.wakeup = 1,
|
||||
.debounce_interval = 10, /* ms */
|
||||
},
|
||||
{
|
||||
.code = SW_RFKILL_ALL,
|
||||
.gpio = IOMUX_TO_GPIO(EFIKASB_RFKILL_SWITCH),
|
||||
.type = EV_SW,
|
||||
.desc = "Wifi Switch",
|
||||
.active_low = 1,
|
||||
.debounce_interval = 10,
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data mx51_efikasb_input_data = {
|
||||
.buttons = mx51_efikasb_input,
|
||||
.nbuttons = ARRAY_SIZE(mx51_efikasb_input),
|
||||
};
|
||||
|
||||
|
||||
static struct platform_device mx51_efikasb_input_device = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikasb_input_data,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void mx51_efikamx_wifi_power(int state)
|
||||
{
|
||||
if (state)
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_WIFI_POWER), 1);
|
||||
else
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_WIFI_POWER), 0);
|
||||
|
||||
}
|
||||
|
||||
void mx51_efikamx_wifi_reset(void)
|
||||
{
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_WIFI_RESET), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_WIFI_RESET), 1);
|
||||
}
|
||||
|
||||
|
||||
void mx51_efikamx_bluetooth_power(int state)
|
||||
{
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_BT_POWER), state);
|
||||
msleep(250);
|
||||
}
|
||||
|
||||
void mx51_efikamx_camera_power(int state)
|
||||
{
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKASB_CAMERA_POWER), !state);
|
||||
}
|
||||
|
||||
void __init mx51_efikamx_init_input(void)
|
||||
{
|
||||
CONFIG_IOMUX(mx51_efikamx_input_iomux_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_POWER_KEY));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_POWER_KEY), "key:power");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_POWER_KEY));
|
||||
|
||||
CONFIG_IOMUX(mx51_efikasb_power_iomux_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_WIFI_POWER));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_WIFI_POWER), "wifi:power");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_WIFI_POWER), 0);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_WIFI_RESET));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_WIFI_RESET), "wifi:reset");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_WIFI_RESET), 0);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_BT_POWER));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_BT_POWER), "bluetooth:power");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_BT_POWER), 1);
|
||||
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
|
||||
(void)platform_device_register(&mx51_efikamx_input_device);
|
||||
|
||||
} else if (machine_is_mx51_efikasb()) {
|
||||
|
||||
CONFIG_IOMUX(mx51_efikasb_input_iomux_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_LID_SWITCH));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_LID_SWITCH), "switch:lid");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_LID_SWITCH));
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_RFKILL_SWITCH));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_RFKILL_SWITCH), "switch:rfkill");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_RFKILL_SWITCH));
|
||||
|
||||
CONFIG_IOMUX(mx51_efikasb_power_iomux_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_CAMERA_POWER));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_CAMERA_POWER), "camera:power");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_CAMERA_POWER), 1);
|
||||
|
||||
(void)platform_device_register(&mx51_efikasb_input_device);
|
||||
}
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
|
||||
#define EFIKAMX_PCBID0 MX51_PIN_NANDF_CS0
|
||||
#define EFIKAMX_PCBID1 MX51_PIN_NANDF_CS1
|
||||
#define EFIKAMX_PCBID2 MX51_PIN_NANDF_RB3
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_id_iomux_pins[] = {
|
||||
/* Note the 100K pullups. These are being driven low by the different revisions */
|
||||
{ EFIKAMX_PCBID0, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
{ EFIKAMX_PCBID1, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
{ EFIKAMX_PCBID2, IOMUX_CONFIG_GPIO, PAD_CTL_100K_PU, },
|
||||
};
|
||||
|
||||
int mx51_efikamx_id = 0x10; /* can't get less than 1.0 */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
EIM A16 CKIH_FREQ_SEL[0]
|
||||
EIM A17 CKIH_FREQ_SEL[1]
|
||||
EIM A18 BT_LPB[0]
|
||||
EIM A19 BT_LPB[1]
|
||||
EIM A20 BT_UART_SRC[0]
|
||||
EIM A21 BT_UART_SRC[1]
|
||||
EIM A22 TBD3 ???
|
||||
EIM A23 BT_HPN_EN
|
||||
|
||||
EIM LBA (GPIO3_1) DI1_PIN12
|
||||
EIM CRE (GPIO3_2) DI1_PIN13 - Test Point (1.2+), WDOG (1.0, 1.1)
|
||||
|
||||
DI_GP4 DISP2_DRDY_CPU
|
||||
*/
|
||||
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_general_iomux_pins[] = {
|
||||
{ MX51_PIN_EIM_A18, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_A19, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_A20, IOMUX_CONFIG_GPIO, (PAD_CTL_PKE_ENABLE), },
|
||||
{ MX51_PIN_EIM_A21, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_LBA, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_EIM_CRE, IOMUX_CONFIG_GPIO, },
|
||||
{ MX51_PIN_DI_GP4, IOMUX_CONFIG_ALT4, },
|
||||
};
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_wdog2_iomux_pins[] = {
|
||||
/* Watchdog (1.2+) */
|
||||
{
|
||||
MX51_PIN_GPIO1_4, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
(PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU),
|
||||
},
|
||||
};
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_wdog1_iomux_pins[] = {
|
||||
/* Watchdog (1.1) */
|
||||
{
|
||||
MX51_PIN_DI1_PIN13, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
(PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU),
|
||||
},
|
||||
};
|
||||
|
||||
__init void mx51_efikamx_init_wdog(void)
|
||||
{
|
||||
/* Watchdog */
|
||||
|
||||
if (mx51_efikamx_revision() < 2)
|
||||
{
|
||||
DBG(("IOMUX for WDOG (1.1) (%u pins)\n", ARRAY_SIZE(mx51_efikamx_wdog1_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_wdog1_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_DI1_PIN13), "wdog_rst");
|
||||
gpio_direction_input(MX51_PIN_DI1_PIN13);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG(("IOMUX for WDOG (1.2) (%u pins)\n", ARRAY_SIZE(mx51_efikamx_wdog2_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_wdog2_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_GPIO1_4), "wdog_rst");
|
||||
gpio_direction_input(MX51_PIN_GPIO1_4);
|
||||
}
|
||||
}
|
||||
|
||||
void __init mx51_efikamx_io_init(void)
|
||||
{
|
||||
/* do ID pins first! */
|
||||
DBG(("IOMUX for Board ID (%u pins)\n", ARRAY_SIZE(mx51_efikamx_id_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_id_iomux_pins);
|
||||
DBG(("IOMUX for General GPIO Stuff (%u pins)\n", ARRAY_SIZE(mx51_efikamx_general_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_general_iomux_pins);
|
||||
|
||||
mx51_efikamx_init_uart();
|
||||
mx51_efikamx_init_soc();
|
||||
|
||||
mx51_efikamx_init_pmic();
|
||||
mx51_efikamx_init_nor();
|
||||
mx51_efikamx_init_spi();
|
||||
|
||||
mx51_efikamx_init_i2c(); /* i2c devices like sii9022 need IPU already there */
|
||||
|
||||
mx51_efikamx_init_usb();
|
||||
|
||||
mx51_efikamx_init_display(); /* register IPU and so on */
|
||||
mx51_efikamx_init_audio(); /* register audio devices and so on */
|
||||
|
||||
mx51_efikamx_board_id(); /* we do board id late because it takes time to settle */
|
||||
mx51_efikamx_init_pata();
|
||||
mx51_efikamx_init_mmc(); /* depends on board id - do it last */
|
||||
mx51_efikamx_init_wdog(); /* depends on board id - do it last */
|
||||
mx51_efikamx_init_leds(); /* mmc trigger depends on board id */
|
||||
|
||||
|
||||
mxc_free_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT2);
|
||||
mxc_free_iomux(MX51_PIN_GPIO1_3, IOMUX_CONFIG_ALT2);
|
||||
mxc_free_iomux(MX51_PIN_EIM_LBA, IOMUX_CONFIG_GPIO);
|
||||
}
|
||||
|
||||
int mx51_efikamx_revision(void)
|
||||
{
|
||||
/* short and sweet */
|
||||
return(mx51_efikamx_id & 0xf);
|
||||
}
|
||||
|
||||
void mx51_efikamx_board_id(void)
|
||||
{
|
||||
int pcbid[3];
|
||||
|
||||
/* NOTE:
|
||||
IOMUX settings have to settle so run the iomux setup long before this
|
||||
function has to otherwise it will give freakish results.
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID0), "efikamx_pcbid0");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID0));
|
||||
pcbid[0] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID0));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID1), "efikamx_pcbid1");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID1));
|
||||
pcbid[1] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID1));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_PCBID2), "efikamx_pcbid2");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_PCBID2));
|
||||
pcbid[2] = gpio_get_value(IOMUX_TO_GPIO(EFIKAMX_PCBID2));
|
||||
|
||||
/*
|
||||
PCBID2 PCBID1 PCBID0 STATE
|
||||
1 1 1 ER1:rev1.1
|
||||
1 1 0 ER2:rev1.2
|
||||
1 0 1 ER3:rev1.3
|
||||
1 0 0 ER4:rev1.4
|
||||
*/
|
||||
if (pcbid[2] == 1) {
|
||||
if (pcbid[1] == 1) {
|
||||
if (pcbid[0] == 1) {
|
||||
mx51_efikamx_id = 0x11;
|
||||
} else {
|
||||
mx51_efikamx_id = 0x12;
|
||||
}
|
||||
} else {
|
||||
if (pcbid[0] == 1) {
|
||||
mx51_efikamx_id = 0x13;
|
||||
} else {
|
||||
mx51_efikamx_id = 0x14;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mx51_efikamx_id == 0x10) || /* "developer edition" */
|
||||
(mx51_efikamx_id == 0x12) || /* unreleased, broken PATA */
|
||||
(mx51_efikamx_id == 0x14) ) { /* unreleased.. */
|
||||
printk(KERN_ERR "Efika MX: PCB Identification Error!\n"
|
||||
"Efika MX: Unsupported board revision 1.%u - USE AT YOUR OWN RISK!\n",
|
||||
mx51_efikamx_revision());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
@@ -39,6 +40,58 @@
|
||||
#warning using the PWM led driver but not the backlight trigger, backlight control will be manual!!
|
||||
#endif
|
||||
|
||||
|
||||
#define EFIKAMX_BLUE_LED MX51_PIN_CSI1_D9
|
||||
#define EFIKAMX_GREEN_LED MX51_PIN_CSI1_VSYNC
|
||||
#define EFIKAMX_RED_LED MX51_PIN_CSI1_HSYNC
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikamx_led_iomux_pins[] = {
|
||||
{ EFIKAMX_BLUE_LED, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKAMX_GREEN_LED, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKAMX_RED_LED, IOMUX_CONFIG_GPIO, },
|
||||
|
||||
};
|
||||
|
||||
static struct gpio_led mx51_efikamx_leds[] = {
|
||||
{
|
||||
.name = "efikamx:green",
|
||||
.default_trigger = "default-on",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_GREEN_LED),
|
||||
},
|
||||
{
|
||||
.name = "efikamx:red",
|
||||
.default_trigger = "ide-disk",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_RED_LED),
|
||||
},
|
||||
{
|
||||
.name = "efikamx:blue",
|
||||
.default_trigger = "mmc1",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_BLUE_LED),
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data mx51_efikamx_leds_data = {
|
||||
.leds = mx51_efikamx_leds,
|
||||
.num_leds = ARRAY_SIZE(mx51_efikamx_leds),
|
||||
};
|
||||
|
||||
static struct platform_device mx51_efikamx_leds_device = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikamx_leds_data,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define EFIKASB_CAPSLOCK_LED MX51_PIN_EIM_CS0
|
||||
#define EFIKASB_ALARM_LED MX51_PIN_GPIO1_3
|
||||
#define EFIKASB_PWM_BACKLIGHT MX51_PIN_GPIO1_2
|
||||
@@ -98,7 +151,7 @@ static struct platform_pwm_backlight_data mx51_efikasb_backlight_data = {
|
||||
#elif defined(CONFIG_LEDS_PWM)
|
||||
static struct led_pwm mx51_efikasb_pwm_backlight[] = {
|
||||
{
|
||||
.name = "backlight",
|
||||
.name = "led:backlight",
|
||||
.default_trigger = "backlight",
|
||||
.pwm_id = 0,
|
||||
.max_brightness = 64,
|
||||
@@ -134,31 +187,68 @@ static struct platform_device mx51_efikasb_leds_device = {
|
||||
},
|
||||
};
|
||||
|
||||
void __init mx51_efikasb_init_leds(void)
|
||||
|
||||
void __init mx51_efikamx_init_leds(void)
|
||||
{
|
||||
CONFIG_IOMUX(mx51_efikasb_led_iomux_pins);
|
||||
|
||||
/*
|
||||
Request each color and set a default output.
|
||||
Since Green is our power light by default, turn it on.
|
||||
Since Red & Blue are disk activity, turn them off (the trigger will activate it)
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), "led:capslock");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED));
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
CONFIG_IOMUX(mx51_efikamx_led_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), "led:alarm");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), 1);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_ALARM_LED));
|
||||
/*
|
||||
Request each color and set a default output.
|
||||
Since Green is our power light by default, turn it on.
|
||||
Since Red & Blue are disk activity, turn them off (the trigger will activate it)
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED), "blue_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), "backlight:en#");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), 0);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED), "green_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED), 1);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED));
|
||||
|
||||
mxc_register_device(&mxc_pwm1_device, NULL);
|
||||
#if defined(CONFIG_BACKLIGHT_PWM)
|
||||
mxc_register_device(&mxc_pwm_backlight_device, &mx51_efikasb_backlight_data);
|
||||
#elif defined(CONFIG_LEDS_PWM)
|
||||
(void)platform_device_register(&mx51_efikasb_backlight_device);
|
||||
#endif
|
||||
(void)platform_device_register(&mx51_efikasb_leds_device);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_RED_LED), "red_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_RED_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_RED_LED));
|
||||
|
||||
if (mx51_efikamx_revision() >= 2)
|
||||
{
|
||||
/* on 1.2 and above there is no second SD controller,
|
||||
* so the previous external "mmc1" is not valid anymore.
|
||||
* change the trigger to mmc0 to activate the LED for
|
||||
* the external slot for the newer boards
|
||||
*/
|
||||
mx51_efikamx_leds[2].default_trigger = "mmc0";
|
||||
}
|
||||
|
||||
(void)platform_device_register(&mx51_efikamx_leds_device);
|
||||
} else {
|
||||
CONFIG_IOMUX(mx51_efikasb_led_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), "led:capslock");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), "led:alarm");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), 1);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_ALARM_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), "backlight:en#");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_PWM_BACKLIGHT_EN), 0);
|
||||
|
||||
mxc_register_device(&mxc_pwm1_device, NULL);
|
||||
#if defined(CONFIG_BACKLIGHT_PWM)
|
||||
mxc_register_device(&mxc_pwm_backlight_device, &mx51_efikasb_backlight_data);
|
||||
#elif defined(CONFIG_LEDS_PWM)
|
||||
(void)platform_device_register(&mx51_efikasb_backlight_device);
|
||||
#endif
|
||||
(void)platform_device_register(&mx51_efikasb_leds_device);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* mx51-efikamx-pmic-mc13892.c -- i.MX51 Efika MX Driver for Atlas MC13892 PMIC
|
||||
* mx51_efikamx_pmic.c -- Efika MX Driver for Atlas MC13892 PMIC
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2011 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/mfd/mc13892/core.h>
|
||||
#include <mach/irqs.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
@@ -91,6 +93,11 @@
|
||||
#define SWMODE_MASK 0xF
|
||||
#define SWMODE_AUTO 0x8
|
||||
|
||||
#define PWGT1SPIEN (1 << 15)
|
||||
#define PWGT2SPIEN (1 << 16)
|
||||
#define USEROFFSPI (1 << 3)
|
||||
|
||||
|
||||
/* CPU */
|
||||
static struct regulator_consumer_supply sw1_consumers[] = {
|
||||
{
|
||||
@@ -293,6 +300,7 @@ static struct regulator_init_data vgen2_init = {
|
||||
.min_uV = mV_to_uV(1200),
|
||||
.max_uV = mV_to_uV(3150),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -302,6 +310,7 @@ static struct regulator_init_data vgen3_init = {
|
||||
.min_uV = mV_to_uV(1800),
|
||||
.max_uV = mV_to_uV(2900),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -371,10 +380,12 @@ static int mc13892_regulator_init(struct mc13892 *mc13892)
|
||||
pmic_write_reg(REG_SW_5, value, 0xffffff);
|
||||
}
|
||||
|
||||
/* Enable coin cell charger */
|
||||
value = BITFVAL(COINCHEN, 1) | BITFVAL(VCOIN, VCOIN_3_0V);
|
||||
register_mask = BITFMASK(COINCHEN) | BITFMASK(VCOIN);
|
||||
pmic_write_reg(REG_POWER_CTL0, value, register_mask);
|
||||
if (machine_is_mx51_efikamx()) {
|
||||
/* Enable coin cell charger */
|
||||
value = BITFVAL(COINCHEN, 1) | BITFVAL(VCOIN, VCOIN_3_0V);
|
||||
register_mask = BITFMASK(COINCHEN) | BITFMASK(VCOIN);
|
||||
pmic_write_reg(REG_POWER_CTL0, value, register_mask);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_RTC_DRV_MXC_V2) || defined(CONFIG_RTC_DRV_MXC_V2_MODULE)
|
||||
value = BITFVAL(DRM, 1);
|
||||
@@ -413,11 +424,12 @@ static struct mc13892_platform_data mc13892_plat = {
|
||||
.init = mc13892_regulator_init,
|
||||
};
|
||||
|
||||
#define EFIKAMX_PMIC_INTERRUPT MX51_PIN_GPIO1_6
|
||||
|
||||
static struct spi_board_info __initdata mc13892_spi_device[] = {
|
||||
{
|
||||
.modalias = "pmic_spi",
|
||||
.irq = IOMUX_TO_IRQ(MX51_PIN_GPIO1_6),
|
||||
.max_speed_hz = 6000000, /* max spi SCK clock speed in HZ */
|
||||
.irq = IOMUX_TO_IRQ(EFIKAMX_PMIC_INTERRUPT),
|
||||
.platform_data = &mc13892_plat,
|
||||
.chip_select = 0,
|
||||
#if defined(CONFIG_SPI_GPIO)
|
||||
@@ -430,60 +442,88 @@ static struct spi_board_info __initdata mc13892_spi_device[] = {
|
||||
#elif defined(CONFIG_SPI_MXC)
|
||||
.bus_num = 1,
|
||||
#endif
|
||||
.max_speed_hz = 1000000, /* max spi SCK clock speed in HZ */
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_pmic_iomux_pins[] = {
|
||||
/* PMIC interrupt */
|
||||
{
|
||||
MX51_PIN_GPIO1_6, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
EFIKAMX_PMIC_INTERRUPT, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
(PAD_CTL_SRE_SLOW | PAD_CTL_DRV_MEDIUM | PAD_CTL_100K_PU |
|
||||
PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_VOT_HIGH),
|
||||
},
|
||||
};
|
||||
|
||||
#define EFIKAMX_WATCHDOG_REBOOT MX51_PIN_DI1_PIN13
|
||||
#define EFIKASB_WATCHDOG_REBOOT MX51_PIN_GPIO1_4
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_watchdog_pins[] = {
|
||||
{ EFIKAMX_WATCHDOG_REBOOT, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_watchdog_pins[] = {
|
||||
{ EFIKASB_WATCHDOG_REBOOT, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
#define EFIKASB_POWERGOOD MX51_PIN_CSI2_PIXCLK
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_power_pins[] = {
|
||||
{ EFIKASB_POWERGOOD, IOMUX_CONFIG_GPIO, },
|
||||
};
|
||||
|
||||
int __init mx51_efikamx_init_pmic(void)
|
||||
{
|
||||
DBG(("IOMUX for PMIC (%d pins)\n", ARRAY_SIZE(mx51_efikamx_pmic_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_pmic_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_GPIO1_6), "pmic_intr");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_6));
|
||||
/* disable power gating for some reason */
|
||||
pmic_write_reg(REG_POWER_MISC, ~(PWGT1SPIEN|PWGT2SPIEN), (PWGT1SPIEN|PWGT2SPIEN));
|
||||
|
||||
if (machine_is_mx51_efikamx() && (mx51_efikamx_revision() == 1)) {
|
||||
CONFIG_IOMUX(mx51_efikamx_watchdog_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_WATCHDOG_REBOOT));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_WATCHDOG_REBOOT), "sys:reboot");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_WATCHDOG_REBOOT), 1);
|
||||
} else {
|
||||
CONFIG_IOMUX(mx51_efikasb_watchdog_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_WATCHDOG_REBOOT));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WATCHDOG_REBOOT), "sys:reboot");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_WATCHDOG_REBOOT), 1);
|
||||
|
||||
if (machine_is_mx51_efikasb()) {
|
||||
CONFIG_IOMUX(mx51_efikasb_power_pins);
|
||||
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_POWERGOOD));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_POWERGOOD), "sys:powergood");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_POWERGOOD));
|
||||
}
|
||||
}
|
||||
|
||||
return spi_register_board_info(mc13892_spi_device, ARRAY_SIZE(mc13892_spi_device));
|
||||
}
|
||||
|
||||
int mx51_efikamx_reboot(void)
|
||||
{
|
||||
/* wdog reset workaround, result power reset! */
|
||||
printk(KERN_INFO "%s\n", __func__ );
|
||||
|
||||
if ( mx51_efikamx_revision() == 1 ) /* board rev1.1 */
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_DI1_PIN13), 0);
|
||||
if ( machine_is_mx51_efikamx() && (mx51_efikamx_revision() == 1) ) /* board rev1.1 */
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_WATCHDOG_REBOOT), 0);
|
||||
else
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_GPIO1_4), 0);
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_WATCHDOG_REBOOT), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PWGT1SPIEN (1<<15)
|
||||
#define PWGT2SPIEN (1<<16)
|
||||
#define USEROFFSPI (1<<3)
|
||||
#define EFIKAMX_POWEROFF MX51_PIN_CSI2_VSYNC
|
||||
|
||||
void mx51_efikamx_power_off(void)
|
||||
{
|
||||
/* We can do power down one of two ways:
|
||||
Set the power gating
|
||||
Set USEROFFSPI */
|
||||
printk(KERN_CRIT "%s\n", __func__);
|
||||
|
||||
/* Set the power gate bits to power down */
|
||||
pmic_write_reg(REG_POWER_MISC, (PWGT1SPIEN|PWGT2SPIEN),
|
||||
(PWGT1SPIEN|PWGT2SPIEN));
|
||||
pmic_write_reg(REG_POWER_MISC, (PWGT1SPIEN|PWGT2SPIEN), (PWGT1SPIEN|PWGT2SPIEN));
|
||||
|
||||
mxc_request_iomux(MX51_PIN_CSI2_VSYNC, IOMUX_CONFIG_GPIO);
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSI2_VSYNC), "poweroff");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSI2_VSYNC), 1);
|
||||
mxc_wd_reset();
|
||||
|
||||
mxc_request_iomux(EFIKAMX_POWEROFF, IOMUX_CONFIG_GPIO);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_POWEROFF), "sys:poweroff");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_POWEROFF), 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
#define EFIKAMX_BLUE_LED MX51_PIN_CSI1_D9
|
||||
#define EFIKAMX_GREEN_LED MX51_PIN_CSI1_VSYNC
|
||||
#define EFIKAMX_RED_LED MX51_PIN_CSI1_HSYNC
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikamx_led_iomux_pins[] = {
|
||||
{ EFIKAMX_BLUE_LED, IOMUX_CONFIG_ALT3, },
|
||||
{ EFIKAMX_GREEN_LED, IOMUX_CONFIG_ALT3, },
|
||||
{ EFIKAMX_RED_LED, IOMUX_CONFIG_ALT3, },
|
||||
|
||||
};
|
||||
|
||||
#define EFIKAMX_POWER_KEY MX51_PIN_EIM_DTACK
|
||||
|
||||
struct mxc_iomux_pin_cfg __initdata mx51_efikamx_powerkey_iomux_pins[] = {
|
||||
{
|
||||
EFIKAMX_POWER_KEY, IOMUX_CONFIG_GPIO,
|
||||
(PAD_CTL_PKE_ENABLE | PAD_CTL_100K_PU),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static struct gpio_led mx51_efikamx_leds[] = {
|
||||
{
|
||||
.name = "efikamx:green",
|
||||
.default_trigger = "default-on",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_GREEN_LED),
|
||||
},
|
||||
{
|
||||
.name = "efikamx:red",
|
||||
.default_trigger = "ide-disk",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_RED_LED),
|
||||
},
|
||||
{
|
||||
.name = "efikamx:blue",
|
||||
.default_trigger = "mmc1",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_BLUE_LED),
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data mx51_efikamx_leds_data = {
|
||||
.leds = mx51_efikamx_leds,
|
||||
.num_leds = ARRAY_SIZE(mx51_efikamx_leds),
|
||||
};
|
||||
|
||||
static struct platform_device mx51_efikamx_leds_device = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikamx_leds_data,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static struct gpio_keys_button mx51_efikamx_powerkey[] = {
|
||||
{
|
||||
.code = KEY_POWER,
|
||||
.gpio = IOMUX_TO_GPIO(EFIKAMX_POWER_KEY),
|
||||
.type = EV_PWR,
|
||||
.desc = "Power Button (CM)",
|
||||
.wakeup = 1,
|
||||
.debounce_interval = 10, /* ms */
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data mx51_efikamx_powerkey_data = {
|
||||
.buttons = mx51_efikamx_powerkey,
|
||||
.nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey),
|
||||
};
|
||||
|
||||
|
||||
static struct platform_device mx51_efikamx_powerkey_device = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikamx_powerkey_data,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
void mx51_efikamx_init_leds(void)
|
||||
{
|
||||
DBG(("IOMUX for LED (%d pins)\n", ARRAY_SIZE(mx51_efikamx_led_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_led_iomux_pins);
|
||||
|
||||
/*
|
||||
Request each color and set a default output.
|
||||
Since Green is our power light by default, turn it on.
|
||||
Since Red & Blue are disk activity, turn them off (the trigger will activate it)
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED), "blue_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_BLUE_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED), "green_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED), 1);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_GREEN_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_RED_LED), "red_led");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_RED_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKAMX_RED_LED));
|
||||
|
||||
if (mx51_efikamx_revision() >= 2)
|
||||
{
|
||||
/* on 1.2 and above there is no second SD controller,
|
||||
* so the previous external "mmc1" is not valid anymore.
|
||||
* change the trigger to mmc0 to activate the LED for
|
||||
* the external slot for the newer boards
|
||||
*/
|
||||
mx51_efikamx_leds[2].default_trigger = "mmc0";
|
||||
}
|
||||
|
||||
(void)platform_device_register(&mx51_efikamx_leds_device);
|
||||
|
||||
/*
|
||||
Register power key (since it's got the LEDs in it :)
|
||||
*/
|
||||
|
||||
DBG(("IOMUX for Power Key (%d pins)\n", ARRAY_SIZE(mx51_efikamx_powerkey_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_powerkey_iomux_pins);
|
||||
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKAMX_POWER_KEY));
|
||||
(void)platform_device_register(&mx51_efikamx_powerkey_device);
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
@@ -28,6 +29,8 @@
|
||||
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
#define POWER_ON 1
|
||||
#define POWER_OFF 0
|
||||
|
||||
#define USB_PAD_CONFIG \
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU | \
|
||||
@@ -91,60 +94,67 @@ static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_usb_iomux_pins[] = {
|
||||
{ MX51_PIN_USBH1_DATA5, IOMUX_CONFIG_ALT0, USB_PAD_CONFIG, },
|
||||
{ MX51_PIN_USBH1_DATA6, IOMUX_CONFIG_ALT0, USB_PAD_CONFIG, },
|
||||
{ MX51_PIN_USBH1_DATA7, IOMUX_CONFIG_ALT0, USB_PAD_CONFIG, },
|
||||
};
|
||||
|
||||
/* USB HUB RESET */
|
||||
{ MX51_PIN_GPIO1_5, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_DRV_HIGH | PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST),
|
||||
},
|
||||
#define EFIKAMX_USB_HUB_RESET MX51_PIN_GPIO1_5
|
||||
#define EFIKAMX_USB_PHY_RESET MX51_PIN_EIM_D27
|
||||
|
||||
/* Wireless enable (active low) */
|
||||
{ MX51_PIN_EIM_A22, IOMUX_CONFIG_GPIO, },
|
||||
/* Wireless reset */
|
||||
{ MX51_PIN_EIM_A16, IOMUX_CONFIG_GPIO, },
|
||||
/* Bluetooth enable (active low) */
|
||||
{ MX51_PIN_EIM_A17, IOMUX_CONFIG_GPIO, },
|
||||
/* USB PHY reset */
|
||||
struct mxc_iomux_pin_cfg mx51_efikamx_usb_control_pins[] = {
|
||||
{
|
||||
MX51_PIN_EIM_D27, IOMUX_CONFIG_ALT1,
|
||||
EFIKAMX_USB_HUB_RESET, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_DRV_HIGH | PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST),
|
||||
},
|
||||
{
|
||||
EFIKAMX_USB_PHY_RESET, IOMUX_CONFIG_ALT1,
|
||||
(PAD_CTL_DRV_HIGH | PAD_CTL_HYS_NONE | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_NONE |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST),
|
||||
},
|
||||
};
|
||||
|
||||
void mx51_efikamx_usb_hub_reset(void)
|
||||
{
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_USB_HUB_RESET), 1);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_USB_HUB_RESET), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKAMX_USB_HUB_RESET), 1);
|
||||
}
|
||||
|
||||
void mx51_efikamx_usb_phy_reset(void)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_USB_PHY_RESET), 1);
|
||||
}
|
||||
|
||||
void __init mx51_efikamx_init_usb(void)
|
||||
{
|
||||
DBG(("IOMUX for USB (%d pins)\n", ARRAY_SIZE(mx51_efikamx_usb_iomux_pins)));
|
||||
CONFIG_IOMUX(mx51_efikamx_usb_iomux_pins);
|
||||
CONFIG_IOMUX(mx51_efikamx_usb_control_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), "usb_hub_reset");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_USB_HUB_RESET), "usb:hub_reset");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_USB_HUB_RESET), 1);
|
||||
|
||||
/* enable BlueTooth */
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), "bluetooth_enable");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 0);
|
||||
msleep(10);
|
||||
gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 1);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKAMX_USB_PHY_RESET), "usb:phy_reset");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKAMX_USB_PHY_RESET), 0);
|
||||
|
||||
/* pull low wlan_on# */
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_A22), "wlan_on");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A22), 0);
|
||||
msleep(10);
|
||||
mx51_efikamx_usb_hub_reset();
|
||||
|
||||
/* pull low-high pulse wlan_rst# */
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), "wlan_rst");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 0);
|
||||
msleep(10);
|
||||
gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 1);
|
||||
mx51_efikamx_bluetooth_power(POWER_ON);
|
||||
mx51_efikamx_wifi_power(POWER_ON);
|
||||
mx51_efikamx_wifi_reset();
|
||||
|
||||
/* De-assert USB PHY RESETB */
|
||||
gpio_request(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), "usb_phy_resetb");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), 1);
|
||||
mx51_efikamx_usb_phy_reset();
|
||||
|
||||
if (machine_is_mx51_efikasb()) {
|
||||
mx51_efikamx_wwan_power(POWER_ON);
|
||||
mx51_efikamx_camera_power(POWER_ON);
|
||||
}
|
||||
|
||||
mx5_usb_dr_init();
|
||||
mx5_usbh1_init();
|
||||
|
||||
if (machine_is_mx51_efikasb()) {
|
||||
mx51_usbh2_init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
@@ -38,7 +39,7 @@
|
||||
#define EFIKASB_WWAN_POWER MX51_PIN_CSI2_D13
|
||||
#define EFIKASB_WWAN_SIM MX51_PIN_EIM_CS1
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_wwan_iomux_pins[] = {
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikamx_wwan_iomux_pins[] = {
|
||||
{ EFIKASB_WWAN_WAKEUP, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_WWAN_POWER, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_WWAN_SIM, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION, PAD_CTL_PKE_NONE },
|
||||
@@ -46,7 +47,7 @@ static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_wwan_iomux_pins[] = {
|
||||
|
||||
|
||||
|
||||
void mx51_efikasb_wwan_power(int state)
|
||||
void mx51_efikamx_wwan_power(int state)
|
||||
{
|
||||
gpio_set_value(IOMUX_TO_GPIO(EFIKASB_WWAN_POWER), !state);
|
||||
}
|
||||
@@ -54,14 +55,14 @@ void mx51_efikasb_wwan_power(int state)
|
||||
|
||||
|
||||
|
||||
int mx51_efikasb_wwan_sim_status(void)
|
||||
int mx51_efikamx_wwan_sim_status(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(EFIKASB_WWAN_SIM));
|
||||
}
|
||||
|
||||
static irqreturn_t mx51_efikasb_sim_handler(int irq, void *dev_id)
|
||||
static irqreturn_t mx51_efikamx_sim_handler(int irq, void *dev_id)
|
||||
{
|
||||
if(mx51_efikasb_wwan_sim_status()) {
|
||||
if(mx51_efikamx_wwan_sim_status()) {
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
} else {
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
@@ -73,14 +74,14 @@ static irqreturn_t mx51_efikasb_sim_handler(int irq, void *dev_id)
|
||||
|
||||
|
||||
|
||||
int mx51_efikasb_wwan_wakeup_status(void)
|
||||
int mx51_efikamx_wwan_wakeup_status(void)
|
||||
{
|
||||
return gpio_get_value(IOMUX_TO_GPIO(EFIKASB_WWAN_WAKEUP));
|
||||
}
|
||||
|
||||
static irqreturn_t mx51_efikasb_wwan_wakeup(int irq, void *dev_id)
|
||||
static irqreturn_t mx51_efikamx_wwan_wakeup(int irq, void *dev_id)
|
||||
{
|
||||
if(mx51_efikasb_wwan_wakeup_status())
|
||||
if(mx51_efikamx_wwan_wakeup_status())
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
@@ -90,39 +91,41 @@ static irqreturn_t mx51_efikasb_wwan_wakeup(int irq, void *dev_id)
|
||||
|
||||
|
||||
|
||||
void __init mx51_efikasb_init_wwan(void)
|
||||
void __init mx51_efikamx_init_wwan(void)
|
||||
{
|
||||
int irq, ret;
|
||||
|
||||
CONFIG_IOMUX(mx51_efikasb_wwan_iomux_pins);
|
||||
if (machine_is_mx51_efikasb()) {
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_WAKEUP), "wwan:wakeup");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_WWAN_WAKEUP));
|
||||
CONFIG_IOMUX(mx51_efikamx_wwan_iomux_pins);
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_POWER), "wwan:power");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_WWAN_POWER), 0);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_WAKEUP), "wwan:wakeup");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_WWAN_WAKEUP));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_SIM), "wwan:simcard");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_WWAN_SIM));
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_POWER), "wwan:power");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_WWAN_POWER), 0);
|
||||
|
||||
irq = IOMUX_TO_IRQ(EFIKASB_WWAN_WAKEUP);
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_WWAN_SIM), "wwan:simcard");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(EFIKASB_WWAN_SIM));
|
||||
|
||||
if (mx51_efikasb_wwan_wakeup_status())
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
irq = IOMUX_TO_IRQ(EFIKASB_WWAN_WAKEUP);
|
||||
|
||||
ret = request_irq(irq, mx51_efikasb_wwan_wakeup, 0, "wwan-wakeup", 0);
|
||||
if(!ret)
|
||||
enable_irq_wake(irq);
|
||||
if (mx51_efikamx_wwan_wakeup_status())
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
|
||||
irq = IOMUX_TO_IRQ(EFIKASB_WWAN_SIM);
|
||||
ret = request_irq(irq, mx51_efikamx_wwan_wakeup, 0, "wwan-wakeup", 0);
|
||||
if(!ret)
|
||||
enable_irq_wake(irq);
|
||||
|
||||
if (mx51_efikasb_wwan_sim_status()) /* ron: low active */
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
irq = IOMUX_TO_IRQ(EFIKASB_WWAN_SIM);
|
||||
|
||||
ret = request_irq(irq, mx51_efikasb_sim_handler, 0, "sim-detect", 0);
|
||||
if (mx51_efikamx_wwan_sim_status()) /* ron: low active */
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
|
||||
ret = request_irq(irq, mx51_efikamx_sim_handler, 0, "sim-detect", 0);
|
||||
}
|
||||
}
|
||||
@@ -49,32 +49,6 @@
|
||||
#include "usb.h"
|
||||
#include <mach/clock.h>
|
||||
|
||||
/*!
|
||||
* @file mach-mx51/mx51_efikasb.c
|
||||
*
|
||||
* @brief This file contains the board specific initialization routines.
|
||||
*
|
||||
* @ingroup MSL_MX51
|
||||
*/
|
||||
extern void __init mx51_efikasb_io_init(void);
|
||||
|
||||
extern int mxc_get_memory_id(void);
|
||||
extern unsigned int mxc_get_pcb_id(void);
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* Board specific fixup function. It is called by \b setup_arch() in
|
||||
* setup.c file very early on during kernel starts. It allows the user to
|
||||
* statically fill in the proper values for the passed-in parameters. None of
|
||||
* the parameters is used currently.
|
||||
*
|
||||
* @param desc pointer to \b struct \b machine_desc
|
||||
* @param tags pointer to \b struct \b tag
|
||||
* @param cmdline pointer to the command line
|
||||
* @param mi pointer to \b struct \b meminfo
|
||||
*/
|
||||
static void __init mx51_efikasb_fixup(struct machine_desc *desc, struct tag *tags,
|
||||
char **cmdline, struct meminfo *mi)
|
||||
{
|
||||
@@ -135,47 +109,18 @@ static void __init mx51_efikasb_fixup(struct machine_desc *desc, struct tag *tag
|
||||
}
|
||||
}
|
||||
|
||||
#define PWGT1SPIEN (1<<15)
|
||||
#define PWGT2SPIEN (1<<16)
|
||||
#define USEROFFSPI (1<<3)
|
||||
|
||||
static void mxc_power_off(void)
|
||||
{
|
||||
/* We can do power down one of two ways:
|
||||
Set the power gating
|
||||
Set USEROFFSPI */
|
||||
gpio_set_value(IOMUX_TO_GPIO(USB_PHY_RESET_PIN), 0);
|
||||
msleep(10);
|
||||
/* Set the power gate bits to power down */
|
||||
pmic_write_reg(REG_POWER_MISC, (PWGT1SPIEN|PWGT2SPIEN),
|
||||
(PWGT1SPIEN|PWGT2SPIEN));
|
||||
|
||||
mxc_wd_reset();
|
||||
|
||||
//robin: CLR_DFF
|
||||
mxc_request_iomux(SYS_PWROFF_PIN, IOMUX_CONFIG_GPIO);
|
||||
gpio_direction_output(IOMUX_TO_GPIO(SYS_PWROFF_PIN), 0);
|
||||
gpio_set_value(IOMUX_TO_GPIO(SYS_PWROFF_PIN), 0);
|
||||
msleep(10);
|
||||
gpio_set_value(IOMUX_TO_GPIO(SYS_PWROFF_PIN), 1);
|
||||
}
|
||||
|
||||
int mx51_efikamx_revision(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __init mx51_efikasb_board_init(void)
|
||||
{
|
||||
mxc_cpu_common_init();
|
||||
|
||||
mxc_register_gpios();
|
||||
mx51_efikasb_io_init();
|
||||
mx51_efikamx_board_id();
|
||||
|
||||
mx51_efikamx_init_uart();
|
||||
mx51_efikamx_init_soc();
|
||||
|
||||
mx51_efikasb_init_pmic();
|
||||
mx51_efikamx_init_pmic();
|
||||
mx51_efikamx_init_nor();
|
||||
mx51_efikamx_init_spi();
|
||||
mx51_efikamx_init_i2c();
|
||||
@@ -185,18 +130,21 @@ static void __init mx51_efikasb_board_init(void)
|
||||
|
||||
mx51_efikamx_init_display();
|
||||
|
||||
mx51_efikasb_init_leds();
|
||||
|
||||
pm_power_off = mxc_power_off;
|
||||
mx51_efikamx_init_input();
|
||||
mx51_efikamx_init_usb();
|
||||
mx51_efikamx_init_wwan();
|
||||
mx51_efikamx_init_leds();
|
||||
|
||||
mx51_efikamx_init_audio();
|
||||
mx51_efikasb_init_battery();
|
||||
|
||||
mx51_efikasb_init_wwan();
|
||||
pm_power_off = mx51_efikamx_power_off;
|
||||
|
||||
mx5_usb_dr_init();
|
||||
mx5_usbh1_init();
|
||||
mx51_usbh2_init();
|
||||
/* dastardly code to give us 1.3 or 2.0 out of "1" or "2" */
|
||||
DBG(("Smartbook Revision %u.%u\n",
|
||||
mx51_efikamx_revision(),
|
||||
((mx51_efikamx_revision() == 1) ? 3 : 0) ));
|
||||
DBG(("Memory type %s\n", mx51_efikamx_memory() ));
|
||||
}
|
||||
|
||||
static struct sys_timer mx51_efikasb_timer = {
|
||||
|
||||
@@ -43,37 +43,6 @@
|
||||
#define MXC_LL_UART_PADDR UART1_BASE_ADDR
|
||||
#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
|
||||
|
||||
#define HUB_RESET_PIN MX51_PIN_GPIO1_5
|
||||
#define PMIC_INT_PIN MX51_PIN_GPIO1_6
|
||||
#define USB_PHY_RESET_PIN MX51_PIN_EIM_D27
|
||||
|
||||
#define WIRELESS_SW_PIN MX51_PIN_DI1_PIN12
|
||||
#define WLAN_PWRON_PIN MX51_PIN_EIM_A22
|
||||
#define WLAN_RESET_PIN MX51_PIN_EIM_A16
|
||||
#define BT_PWRON_PIN MX51_PIN_EIM_A17
|
||||
|
||||
#define CAM_PWRON_PIN MX51_PIN_NANDF_CS0
|
||||
|
||||
#define LID_SW_PIN MX51_PIN_CSI1_VSYNC /* Low: close, High: open */
|
||||
|
||||
#define POWER_BTN_PIN MX51_PIN_EIM_DTACK
|
||||
#define SYS_PWROFF_PIN MX51_PIN_CSI2_VSYNC
|
||||
#define SYS_PWRGD_PIN MX51_PIN_CSI2_PIXCLK
|
||||
|
||||
/* ron: R1.2 borad GPIO definition */
|
||||
#define MEM_ID0_PIN MX51_PIN_EIM_LBA /* MX51_PIN_GPIO1_4 */
|
||||
#define MEM_ID1_PIN MX51_PIN_EIM_CRE
|
||||
|
||||
#define AGPS_PWRON_PIN MX51_PIN_CSI2_D12
|
||||
#define AGPS_RESET_PIN MX51_PIN_CSI2_D18
|
||||
#define AGPS_PWRSW_PIN MX51_PIN_NANDF_CS1 /* ron: R1.3 add AGPS_PWRSW */
|
||||
|
||||
/* ron: R1.3 board GPIO definition */
|
||||
#define PCB_ID0_PIN MX51_PIN_EIM_CS3
|
||||
#define PCB_ID1_PIN MX51_PIN_EIM_CS4
|
||||
|
||||
#define WDOG_PIN MX51_PIN_GPIO1_4
|
||||
|
||||
/* here today, gone tomorrow */
|
||||
/* cpu */
|
||||
extern struct cpu_wp *(*get_cpu_wp)(int *wp);
|
||||
@@ -83,23 +52,34 @@ extern void mx51_efikamx_set_num_cpu_wp(int num);
|
||||
|
||||
extern void __init mx51_efikamx_timer_init(void);
|
||||
|
||||
extern int mx51_efikamx_revision(void);
|
||||
extern void __init mx51_efikasb_io_init(void);
|
||||
extern void __init mx51_efikasb_init_battery(void);
|
||||
|
||||
extern void __init mx51_efikamx_init_uart(void);
|
||||
extern void __init mx51_efikamx_init_soc(void);
|
||||
extern void __init mx51_efikamx_init_mmc(void);
|
||||
extern void __init mx51_efikamx_init_audio(void);
|
||||
extern void __init mx51_efikamx_init_pata(void);
|
||||
extern void __init mx51_efikasb_init_leds(void);
|
||||
extern void __init mx51_efikamx_init_leds(void);
|
||||
extern void __init mx51_efikamx_init_spi(void);
|
||||
extern void __init mx51_efikamx_init_nor(void);
|
||||
extern void __init mx51_efikamx_init_display(void);
|
||||
extern void __init mx51_efikamx_init_i2c(void);
|
||||
extern void __init mx51_efikasb_init_battery(void);
|
||||
extern void __init mx51_efikasb_init_wwan(void);
|
||||
extern int __init mx51_efikasb_init_pmic(void);
|
||||
extern void __init mx51_efikamx_init_wwan(void);
|
||||
extern void __init mx51_efikamx_init_input(void);
|
||||
extern int __init mx51_efikamx_init_pmic(void);
|
||||
extern int __init mx51_efikamx_init_usb(void);
|
||||
|
||||
/* io */
|
||||
extern void mx51_efikamx_board_id(void);
|
||||
extern int mx51_efikamx_revision(void);
|
||||
extern char *mx51_efikamx_memory(void);
|
||||
|
||||
extern void mx51_efikamx_power_off(void);
|
||||
|
||||
|
||||
extern void mx51_efikamx_display_adjust_mem(int gpu_start, int gpu_mem, int fb_mem);
|
||||
#define DBG(x) { printk(KERN_INFO "Efika MX: "); printk x ; }
|
||||
|
||||
// DBG(("iomux [%u] %u,%u,%u,%u,%u\n", i, pins[i].pin, pins[i].mux_mode, pins[i].pad_cfg, pins[i].in_select, pins[i].in_mode));
|
||||
|
||||
@@ -115,5 +95,10 @@ extern void mx51_efikamx_display_adjust_mem(int gpu_start, int gpu_mem, int fb_m
|
||||
} \
|
||||
}
|
||||
|
||||
extern void mx51_efikamx_wifi_power(int state);
|
||||
extern void mx51_efikamx_wifi_reset(void);
|
||||
extern void mx51_efikamx_bluetooth_power(int state);
|
||||
extern void mx51_efikamx_camera_power(int state);
|
||||
extern void mx51_efikamx_wwan_power(int state);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,406 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/io.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include "mx51_efikasb.h"
|
||||
#include "iomux.h"
|
||||
#include "mx51_pins.h"
|
||||
|
||||
/*!
|
||||
* @file mach-mx51/mx51_efikasb_gpio.c
|
||||
*
|
||||
* @brief This file contains all the GPIO setup functions for the board.
|
||||
*
|
||||
* @ingroup GPIO
|
||||
*/
|
||||
|
||||
void mxc_power_on_wlan(int);
|
||||
void mxc_power_on_bt(int);
|
||||
void mxc_power_on_camera(int);
|
||||
void mxc_reset_wlan(void);
|
||||
void mxc_reset_usb_hub(void);
|
||||
void mxc_reset_usb_phy(void);
|
||||
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mxc_iomux_pins[] = {
|
||||
/* USBH2_DATA0 */
|
||||
{
|
||||
MX51_PIN_EIM_D16, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_ODE_OPENDRAIN_NONE |
|
||||
PAD_CTL_100K_PU | PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
|
||||
PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA1 */
|
||||
{
|
||||
MX51_PIN_EIM_D17, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA2 */
|
||||
{
|
||||
MX51_PIN_EIM_D18, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA3 */
|
||||
{
|
||||
MX51_PIN_EIM_D19, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA4 */
|
||||
{
|
||||
MX51_PIN_EIM_D20, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA5 */
|
||||
{
|
||||
MX51_PIN_EIM_D21, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA6 */
|
||||
{
|
||||
MX51_PIN_EIM_D22, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DATA7 */
|
||||
{
|
||||
MX51_PIN_EIM_D23, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* ron: GPIO2_10 WLAN Reset*/
|
||||
MX51_PIN_EIM_A16, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
{ /* ron: GPIO2_11 BT Power On */
|
||||
MX51_PIN_EIM_A17, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
{
|
||||
MX51_PIN_EIM_A18, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
{
|
||||
MX51_PIN_EIM_A19, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
{
|
||||
MX51_PIN_EIM_A20, IOMUX_CONFIG_GPIO,
|
||||
(PAD_CTL_PKE_ENABLE),
|
||||
},
|
||||
{
|
||||
MX51_PIN_EIM_A21, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
{ /* ron: GPIO2_16 WLAN Power On */
|
||||
MX51_PIN_EIM_A22, IOMUX_CONFIG_GPIO,
|
||||
},
|
||||
/* USBH2_CLK */
|
||||
{
|
||||
MX51_PIN_EIM_A24, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_DIR */
|
||||
{
|
||||
MX51_PIN_EIM_A25, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_STP */
|
||||
{
|
||||
MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
/* USBH2_NXT */
|
||||
{
|
||||
MX51_PIN_EIM_A27, IOMUX_CONFIG_ALT2,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* ron: GPIO2_24 CPU 22.5792M OSC enable */
|
||||
MX51_PIN_EIM_OE, IOMUX_CONFIG_ALT1,
|
||||
(PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE),
|
||||
},
|
||||
{ /*ron: GPIO2_31 Power Button*/
|
||||
MX51_PIN_EIM_DTACK, IOMUX_CONFIG_GPIO,
|
||||
(PAD_CTL_PKE_ENABLE | PAD_CTL_100K_PU),
|
||||
},
|
||||
{
|
||||
MX51_PIN_DI_GP4, IOMUX_CONFIG_ALT4,
|
||||
},
|
||||
{ /* USBH1_STP */
|
||||
MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_CLK */
|
||||
MX51_PIN_USBH1_CLK, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_DDR_INPUT_CMOS),
|
||||
},
|
||||
{ /* USBH1_DIR */
|
||||
MX51_PIN_USBH1_DIR, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_DDR_INPUT_CMOS),
|
||||
},
|
||||
{ /* USBH1_NXT */
|
||||
MX51_PIN_USBH1_NXT, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE | PAD_CTL_DDR_INPUT_CMOS),
|
||||
},
|
||||
{ /* USBH1_DATA0 */
|
||||
MX51_PIN_USBH1_DATA0, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA1 */
|
||||
MX51_PIN_USBH1_DATA1, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA2 */
|
||||
MX51_PIN_USBH1_DATA2, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA3 */
|
||||
MX51_PIN_USBH1_DATA3, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA4 */
|
||||
MX51_PIN_USBH1_DATA4, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA5 */
|
||||
MX51_PIN_USBH1_DATA5, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA6 */
|
||||
MX51_PIN_USBH1_DATA6, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* USBH1_DATA7 */
|
||||
MX51_PIN_USBH1_DATA7, IOMUX_CONFIG_ALT0,
|
||||
(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU |
|
||||
PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE),
|
||||
},
|
||||
{ /* ron: GPIO1_6 PMIC Interrupt */
|
||||
MX51_PIN_GPIO1_6, IOMUX_CONFIG_GPIO | IOMUX_CONFIG_SION,
|
||||
(PAD_CTL_SRE_SLOW | PAD_CTL_DRV_MEDIUM | PAD_CTL_100K_PU |
|
||||
PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_VOT_HIGH),
|
||||
},
|
||||
{
|
||||
MX51_PIN_EIM_D25, IOMUX_CONFIG_ALT4,
|
||||
(PAD_CTL_HYS_NONE | PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST),
|
||||
},
|
||||
{ /* ron: GPIO3_0 Battery Low */
|
||||
MX51_PIN_DI1_PIN11, IOMUX_CONFIG_ALT4,
|
||||
},
|
||||
{ /* ron: GPIO3_1 Wireless SW */
|
||||
MX51_PIN_DI1_PIN12, IOMUX_CONFIG_ALT4,
|
||||
},
|
||||
{ /* ron: GPIO3_2 Watchdog ? GPIO conflict with EIM_CRE*/
|
||||
MX51_PIN_DI1_PIN13, IOMUX_CONFIG_ALT4,
|
||||
},
|
||||
{ /* ron: GPIO4_15 Power Good */
|
||||
MX51_PIN_CSI2_PIXCLK, IOMUX_CONFIG_ALT3,
|
||||
},
|
||||
};
|
||||
|
||||
static void power_on_bt_handler(struct work_struct *work)
|
||||
{
|
||||
mxc_power_on_bt(1);
|
||||
}
|
||||
|
||||
static DECLARE_DELAYED_WORK(power_on_bt_work, power_on_bt_handler);
|
||||
|
||||
void __init mx51_efikasb_io_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mxc_iomux_pins); i++) {
|
||||
mxc_request_iomux(mxc_iomux_pins[i].pin,
|
||||
mxc_iomux_pins[i].mux_mode);
|
||||
if (mxc_iomux_pins[i].pad_cfg)
|
||||
mxc_iomux_set_pad(mxc_iomux_pins[i].pin,
|
||||
mxc_iomux_pins[i].pad_cfg);
|
||||
if (mxc_iomux_pins[i].in_select)
|
||||
mxc_iomux_set_input(mxc_iomux_pins[i].in_select,
|
||||
mxc_iomux_pins[i].in_mode);
|
||||
}
|
||||
|
||||
/* ron: USB Phy Reset */
|
||||
mxc_request_iomux(USB_PHY_RESET_PIN, IOMUX_CONFIG_ALT1);
|
||||
mxc_iomux_set_pad(USB_PHY_RESET_PIN, PAD_CTL_DRV_HIGH |
|
||||
PAD_CTL_HYS_NONE | PAD_CTL_PUE_KEEPER |
|
||||
PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_NONE |
|
||||
PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
|
||||
gpio_request(IOMUX_TO_GPIO(USB_PHY_RESET_PIN), "usb_phy_reset");
|
||||
mxc_reset_usb_phy();
|
||||
|
||||
/* ron: PMIC interrupt*/
|
||||
gpio_request(IOMUX_TO_GPIO(PMIC_INT_PIN), "pmic_int");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(PMIC_INT_PIN));
|
||||
|
||||
/* Lid Switch */
|
||||
mxc_request_iomux(LID_SW_PIN, IOMUX_CONFIG_GPIO /* | IOMUX_CONFIG_SION */);
|
||||
gpio_request(IOMUX_TO_GPIO(LID_SW_PIN), "lid_sw");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(LID_SW_PIN));
|
||||
|
||||
/* Wireless*/
|
||||
mxc_power_on_wlan(1);
|
||||
mxc_reset_wlan();
|
||||
/* mxc_power_on_bt(1); */
|
||||
/* ron: workaround the bluetooth detect fail */
|
||||
schedule_delayed_work(&power_on_bt_work, msecs_to_jiffies(500));
|
||||
|
||||
/* Camera */
|
||||
mxc_request_iomux(CAM_PWRON_PIN, IOMUX_CONFIG_GPIO);
|
||||
mxc_power_on_camera(1);
|
||||
|
||||
/* ron: for R12 borad gpio */
|
||||
/* Memory ID pin */
|
||||
mxc_request_iomux(MEM_ID0_PIN, IOMUX_CONFIG_GPIO);
|
||||
gpio_request(IOMUX_TO_GPIO(MEM_ID0_PIN), "mem_id");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(MEM_ID0_PIN));
|
||||
mxc_request_iomux(MEM_ID1_PIN, IOMUX_CONFIG_GPIO);
|
||||
gpio_request(IOMUX_TO_GPIO(MEM_ID1_PIN), "mem_id");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(MEM_ID1_PIN));
|
||||
|
||||
/* Watchdog */
|
||||
mxc_request_iomux(WDOG_PIN, IOMUX_CONFIG_ALT2);
|
||||
|
||||
/* PCB ID */
|
||||
mxc_request_iomux(PCB_ID0_PIN, IOMUX_CONFIG_GPIO);
|
||||
mxc_request_iomux(PCB_ID1_PIN, IOMUX_CONFIG_GPIO);
|
||||
gpio_request(IOMUX_TO_GPIO(PCB_ID0_PIN), "pcb_id");
|
||||
gpio_request(IOMUX_TO_GPIO(PCB_ID1_PIN), "pcb_id");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(PCB_ID0_PIN));
|
||||
gpio_direction_input(IOMUX_TO_GPIO(PCB_ID1_PIN));
|
||||
|
||||
}
|
||||
|
||||
void mxc_power_on_wlan(int on)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(WLAN_PWRON_PIN), 0);
|
||||
if (on)
|
||||
gpio_set_value(IOMUX_TO_GPIO(WLAN_PWRON_PIN), 1);
|
||||
else
|
||||
gpio_set_value(IOMUX_TO_GPIO(WLAN_PWRON_PIN), 0);
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_power_on_wlan);
|
||||
|
||||
void mxc_power_on_bt(int on)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(BT_PWRON_PIN), 0);
|
||||
if (on)
|
||||
gpio_set_value(IOMUX_TO_GPIO(BT_PWRON_PIN), 1);
|
||||
else
|
||||
gpio_set_value(IOMUX_TO_GPIO(BT_PWRON_PIN), 0);
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_power_on_bt);
|
||||
|
||||
void mxc_power_on_camera(int on)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(CAM_PWRON_PIN), 0);
|
||||
if(on)
|
||||
gpio_set_value(IOMUX_TO_GPIO(CAM_PWRON_PIN), 0); /* low active */
|
||||
else
|
||||
gpio_set_value(IOMUX_TO_GPIO(CAM_PWRON_PIN), 1);
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_power_on_camera);
|
||||
|
||||
void mxc_reset_wlan(void)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(WLAN_RESET_PIN), 1);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(WLAN_RESET_PIN), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(WLAN_RESET_PIN), 1);
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_reset_wlan);
|
||||
|
||||
void mxc_reset_usb_hub(void)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(HUB_RESET_PIN), 1);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(HUB_RESET_PIN), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(HUB_RESET_PIN), 1);
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_reset_usb_hub);
|
||||
|
||||
|
||||
void mxc_reset_usb_phy(void)
|
||||
{
|
||||
gpio_direction_output(IOMUX_TO_GPIO(USB_PHY_RESET_PIN), 0);
|
||||
msleep(1);
|
||||
gpio_set_value(IOMUX_TO_GPIO(USB_PHY_RESET_PIN), 1);
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_reset_usb_phy);
|
||||
|
||||
/* ron: 00 Nanya DDR2
|
||||
10 Micron DDR2
|
||||
01 Hynix DDR2 */
|
||||
int mxc_get_memory_id(void)
|
||||
{
|
||||
int id;
|
||||
|
||||
id = gpio_get_value(IOMUX_TO_GPIO(MEM_ID0_PIN));
|
||||
id |= gpio_get_value(IOMUX_TO_GPIO(MEM_ID1_PIN)) << 1;
|
||||
|
||||
return id;
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_get_memory_id);
|
||||
|
||||
int mxc_get_wireless_sw_status(void)
|
||||
{
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(WIRELESS_SW_PIN));
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_get_wireless_sw_status);
|
||||
|
||||
int mxc_get_lid_sw_status(void)
|
||||
{
|
||||
/* ron: 0:open 1:close */
|
||||
return !gpio_get_value(IOMUX_TO_GPIO(LID_SW_PIN));
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_get_lid_sw_status);
|
||||
|
||||
/* ron: 01 R1.3 board
|
||||
10 R2.0 board */
|
||||
int mxc_get_pcb_id(void)
|
||||
{
|
||||
int id;
|
||||
|
||||
id = gpio_get_value(IOMUX_TO_GPIO(PCB_ID0_PIN));
|
||||
id |= gpio_get_value(IOMUX_TO_GPIO(PCB_ID1_PIN)) << 1;
|
||||
|
||||
return id;
|
||||
}
|
||||
EXPORT_SYMBOL(mxc_get_pcb_id);
|
||||
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/pci_ids.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
#include "mx51_efikasb.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
int lid_wake_enable = 0;
|
||||
extern int mxc_get_lid_sw_status(void);
|
||||
|
||||
static struct input_dev *efikasb_lid_inputdev;
|
||||
|
||||
static struct platform_device efikasb_lid_dev = {
|
||||
.name = "efikasb_lid",
|
||||
};
|
||||
|
||||
static irqreturn_t lid_sw_int(int irq, void *dev_id)
|
||||
{
|
||||
int lid_close;
|
||||
|
||||
lid_close = mxc_get_lid_sw_status();
|
||||
if(lid_close) {
|
||||
pr_info("Lid Switch Close\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
|
||||
if(lid_wake_enable)
|
||||
enable_irq_wake(irq);
|
||||
|
||||
input_report_switch(efikasb_lid_inputdev, SW_LID, lid_close);
|
||||
input_sync(efikasb_lid_inputdev);
|
||||
|
||||
} else {
|
||||
pr_info("Lid Switch Open\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
|
||||
input_report_switch(efikasb_lid_inputdev, SW_LID, lid_close);
|
||||
input_sync(efikasb_lid_inputdev);
|
||||
|
||||
if(lid_wake_enable)
|
||||
disable_irq_wake(irq);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int mxc_init_lid_sw(void)
|
||||
{
|
||||
int irq, ret;
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(LID_SW_PIN), "lid_sw");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(LID_SW_PIN));
|
||||
irq = IOMUX_TO_IRQ(LID_SW_PIN);
|
||||
|
||||
if(mxc_get_lid_sw_status()) {
|
||||
pr_info("Lid Switch Close\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
} else {
|
||||
pr_info("Lid Switch Open\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
}
|
||||
|
||||
ret = request_irq(irq, lid_sw_int, 0, "lid-sw", 0);
|
||||
if(ret)
|
||||
pr_info("register lid switch interrupt failed\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t lid_status_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%d\n", mxc_get_lid_sw_status());
|
||||
}
|
||||
|
||||
static ssize_t lid_wake_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%s\n", lid_wake_enable ? "on": "off");
|
||||
}
|
||||
|
||||
static ssize_t lid_wake_store(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
if(strncmp(buf, "on", 2) == 0)
|
||||
lid_wake_enable = 1;
|
||||
else if (strncmp(buf, "off", 3) == 0)
|
||||
lid_wake_enable = 0;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct kobj_attribute lid_status_attribute =
|
||||
__ATTR(lid, S_IFREG | S_IRUGO, lid_status_show, NULL);
|
||||
static struct kobj_attribute lid_wake_attribute =
|
||||
__ATTR(lid_wake, 0666, lid_wake_show, lid_wake_store);
|
||||
|
||||
static struct attribute *status_attrs[] = {
|
||||
&lid_status_attribute.attr,
|
||||
&lid_wake_attribute.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group status_attr_group = {
|
||||
.attrs = status_attrs,
|
||||
};
|
||||
|
||||
static void __init lid_wake_setup(char **p)
|
||||
{
|
||||
if(memcmp(*p, "on", 2) == 0) {
|
||||
lid_wake_enable = 1;
|
||||
*p += 2;
|
||||
} else if(memcmp(*p, "off", 3) == 0) {
|
||||
lid_wake_enable = 0;
|
||||
*p += 3;
|
||||
}
|
||||
}
|
||||
|
||||
__early_param("lid_wake=", lid_wake_setup);
|
||||
|
||||
static int __init mxc_init_efikasb_lid(void)
|
||||
{
|
||||
int ret ;
|
||||
struct kobject *lid_kobj;
|
||||
|
||||
platform_device_register(&efikasb_lid_dev);
|
||||
|
||||
lid_kobj = kobject_create_and_add("status", &efikasb_lid_dev.dev.kobj);
|
||||
if(!lid_kobj) {
|
||||
ret = -ENOMEM;
|
||||
goto err3;
|
||||
}
|
||||
|
||||
ret = sysfs_create_group(lid_kobj, &status_attr_group);
|
||||
if(ret) {
|
||||
goto err2;
|
||||
}
|
||||
|
||||
efikasb_lid_inputdev = input_allocate_device();
|
||||
if(!efikasb_lid_inputdev) {
|
||||
pr_err("Failed to allocate lid input device\n");
|
||||
ret = -ENOMEM;
|
||||
goto err2;
|
||||
}
|
||||
|
||||
efikasb_lid_inputdev->name = "Efika MX Smartbook Lid Switch";
|
||||
efikasb_lid_inputdev->phys = "efikasb/input1";
|
||||
efikasb_lid_inputdev->uniq = "efikasb";
|
||||
efikasb_lid_inputdev->id.bustype = BUS_HOST;
|
||||
efikasb_lid_inputdev->id.vendor = PCI_VENDOR_ID_FREESCALE;
|
||||
|
||||
set_bit(EV_SW, efikasb_lid_inputdev->evbit);
|
||||
set_bit(SW_LID, efikasb_lid_inputdev->swbit);
|
||||
|
||||
/* ron: 0:open 1:close */
|
||||
if(mxc_get_lid_sw_status())
|
||||
set_bit(SW_LID, efikasb_lid_inputdev->sw);
|
||||
|
||||
ret = input_register_device(efikasb_lid_inputdev);
|
||||
if(ret) {
|
||||
pr_err("Failed to register Efika MX Smartbook lid input device\n");
|
||||
ret = -ENODEV;
|
||||
goto err1;
|
||||
}
|
||||
|
||||
mxc_init_lid_sw();
|
||||
|
||||
return ret;
|
||||
|
||||
err1:
|
||||
input_free_device(efikasb_lid_inputdev);
|
||||
err2:
|
||||
kobject_put(lid_kobj);
|
||||
err3:
|
||||
platform_device_unregister(&efikasb_lid_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
late_initcall(mxc_init_efikasb_lid);
|
||||
@@ -1,423 +0,0 @@
|
||||
/*
|
||||
* mx51_efikasb_pmic.c -- Efika MX Smartbook Driver for Atlas MC13892 PMIC
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/pmic_external.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/mfd/mc13892/core.h>
|
||||
#include <mach/irqs.h>
|
||||
#include "iomux.h"
|
||||
#include "mx51_pins.h"
|
||||
|
||||
/*
|
||||
* Convenience conversion.
|
||||
* Here atm, maybe there is somewhere better for this.
|
||||
*/
|
||||
#define mV_to_uV(mV) (mV * 1000)
|
||||
#define uV_to_mV(uV) (uV / 1000)
|
||||
#define V_to_uV(V) (mV_to_uV(V * 1000))
|
||||
#define uV_to_V(uV) (uV_to_mV(uV) / 1000)
|
||||
|
||||
/* Coin cell charger enable */
|
||||
#define COINCHEN_LSH 23
|
||||
#define COINCHEN_WID 1
|
||||
/* Coin cell charger voltage setting */
|
||||
#define VCOIN_LSH 20
|
||||
#define VCOIN_WID 3
|
||||
|
||||
/* Coin Charger voltage */
|
||||
#define VCOIN_2_5V 0x0
|
||||
#define VCOIN_2_7V 0x1
|
||||
#define VCOIN_2_8V 0x2
|
||||
#define VCOIN_2_9V 0x3
|
||||
#define VCOIN_3_0V 0x4
|
||||
#define VCOIN_3_1V 0x5
|
||||
#define VCOIN_3_2V 0x6
|
||||
#define VCOIN_3_3V 0x7
|
||||
|
||||
/* regulator standby mask */
|
||||
#define GEN1_STBY_MASK (1 << 1)
|
||||
#define IOHI_STBY_MASK (1 << 4)
|
||||
#define DIG_STBY_MASK (1 << 10)
|
||||
#define GEN2_STBY_MASK (1 << 13)
|
||||
#define PLL_STBY_MASK (1 << 16)
|
||||
#define USB2_STBY_MASK (1 << 19)
|
||||
|
||||
#define GEN3_STBY_MASK (1 << 1)
|
||||
#define CAM_STBY_MASK (1 << 7)
|
||||
#define VIDEO_STBY_MASK (1 << 13)
|
||||
#define AUDIO_STBY_MASK (1 << 16)
|
||||
#define SD_STBY_MASK (1 << 19)
|
||||
|
||||
/* 0x92412 */
|
||||
#define REG_MODE_0_ALL_MASK (GEN1_STBY_MASK |\
|
||||
DIG_STBY_MASK | GEN2_STBY_MASK |\
|
||||
PLL_STBY_MASK)
|
||||
/* 0x92082 */
|
||||
#define REG_MODE_1_ALL_MASK (CAM_STBY_MASK | VIDEO_STBY_MASK |\
|
||||
AUDIO_STBY_MASK | SD_STBY_MASK)
|
||||
|
||||
/* switch mode setting */
|
||||
#define SW1MODE_LSB 0
|
||||
#define SW2MODE_LSB 10
|
||||
#define SW3MODE_LSB 0
|
||||
#define SW4MODE_LSB 8
|
||||
|
||||
#define SWMODE_MASK 0xF
|
||||
#define SWMODE_AUTO 0x8
|
||||
|
||||
#define PWGT1SPIEN (1 << 15)
|
||||
#define PWGT2SPIEN (1 << 16)
|
||||
|
||||
/* CPU */
|
||||
static struct regulator_consumer_supply sw1_consumers[] = {
|
||||
{
|
||||
.supply = "cpu_vcc",
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_consumer_supply vdig_consumers[] = {
|
||||
{
|
||||
/* sgtl5000 */
|
||||
.supply = "VDDA",
|
||||
.dev_name = "1-000a",
|
||||
},
|
||||
{
|
||||
/* sgtl5000 */
|
||||
.supply = "VDDD",
|
||||
.dev_name = "1-000a",
|
||||
},
|
||||
};
|
||||
|
||||
static struct regulator_consumer_supply vvideo_consumers[] = {
|
||||
{
|
||||
/* sgtl5000 */
|
||||
.supply = "VDDIO",
|
||||
.dev_name = "1-000a",
|
||||
},
|
||||
};
|
||||
|
||||
struct mc13892;
|
||||
|
||||
static struct regulator_init_data sw1_init = {
|
||||
.constraints = {
|
||||
.name = "SW1",
|
||||
.min_uV = mV_to_uV(600),
|
||||
.max_uV = mV_to_uV(1375),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.valid_modes_mask = 0,
|
||||
.always_on = 1,
|
||||
.boot_on = 1,
|
||||
.initial_state = PM_SUSPEND_MEM,
|
||||
.state_mem = {
|
||||
.uV = 850000,
|
||||
.mode = REGULATOR_MODE_NORMAL,
|
||||
.enabled = 1,
|
||||
},
|
||||
},
|
||||
.num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
|
||||
.consumer_supplies = sw1_consumers,
|
||||
};
|
||||
|
||||
static struct regulator_init_data sw2_init = {
|
||||
.constraints = {
|
||||
.name = "SW2",
|
||||
.min_uV = mV_to_uV(900),
|
||||
.max_uV = mV_to_uV(1850),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
.boot_on = 1,
|
||||
.initial_state = PM_SUSPEND_MEM,
|
||||
.state_mem = {
|
||||
.uV = 950000,
|
||||
.mode = REGULATOR_MODE_NORMAL,
|
||||
.enabled = 1,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data sw3_init = {
|
||||
.constraints = {
|
||||
.name = "SW3",
|
||||
.min_uV = mV_to_uV(1100),
|
||||
.max_uV = mV_to_uV(1850),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
.boot_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data sw4_init = {
|
||||
.constraints = {
|
||||
.name = "SW4",
|
||||
.min_uV = mV_to_uV(1100),
|
||||
.max_uV = mV_to_uV(1850),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
.boot_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data viohi_init = {
|
||||
.constraints = {
|
||||
.name = "VIOHI",
|
||||
.always_on = 1,
|
||||
.boot_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vusb_init = {
|
||||
.constraints = {
|
||||
.name = "VUSB",
|
||||
.boot_on = 1,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data swbst_init = {
|
||||
.constraints = {
|
||||
.name = "SWBST",
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vdig_init = {
|
||||
.constraints = {
|
||||
.name = "VDIG",
|
||||
.min_uV = mV_to_uV(1650),
|
||||
.max_uV = mV_to_uV(1650),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.boot_on = 1,
|
||||
},
|
||||
.num_consumer_supplies = ARRAY_SIZE(vdig_consumers),
|
||||
.consumer_supplies = vdig_consumers,
|
||||
};
|
||||
|
||||
static struct regulator_init_data vpll_init = {
|
||||
.constraints = {
|
||||
.name = "VPLL",
|
||||
.min_uV = mV_to_uV(1050),
|
||||
.max_uV = mV_to_uV(1800),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.boot_on = 1,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vusb2_init = {
|
||||
.constraints = {
|
||||
.name = "VUSB2",
|
||||
.min_uV = mV_to_uV(2400),
|
||||
.max_uV = mV_to_uV(2775),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.boot_on = 1,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vvideo_init = {
|
||||
.constraints = {
|
||||
.name = "VVIDEO",
|
||||
.min_uV = mV_to_uV(2775),
|
||||
.max_uV = mV_to_uV(2775),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.apply_uV =1,
|
||||
},
|
||||
.num_consumer_supplies = ARRAY_SIZE(vvideo_consumers),
|
||||
.consumer_supplies = vvideo_consumers,
|
||||
};
|
||||
|
||||
static struct regulator_init_data vaudio_init = {
|
||||
.constraints = {
|
||||
.name = "VAUDIO",
|
||||
.min_uV = mV_to_uV(2300),
|
||||
.max_uV = mV_to_uV(3000),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vsd_init = {
|
||||
.constraints = {
|
||||
.name = "VSD",
|
||||
.min_uV = mV_to_uV(1800),
|
||||
.max_uV = mV_to_uV(3150),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vcam_init = {
|
||||
.constraints = {
|
||||
.name = "VCAM",
|
||||
.min_uV = mV_to_uV(2500),
|
||||
.max_uV = mV_to_uV(3000),
|
||||
.valid_ops_mask =
|
||||
REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
|
||||
.valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vgen1_init = {
|
||||
.constraints = {
|
||||
.name = "VGEN1",
|
||||
.min_uV = mV_to_uV(1200),
|
||||
.max_uV = mV_to_uV(1200),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vgen2_init = {
|
||||
.constraints = {
|
||||
.name = "VGEN2",
|
||||
.min_uV = mV_to_uV(1200),
|
||||
.max_uV = mV_to_uV(3150),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data vgen3_init = {
|
||||
.constraints = {
|
||||
.name = "VGEN3",
|
||||
.min_uV = mV_to_uV(1800),
|
||||
.max_uV = mV_to_uV(2900),
|
||||
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
||||
.always_on = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data gpo1_init = {
|
||||
.constraints = {
|
||||
.name = "GPO1",
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data gpo2_init = {
|
||||
.constraints = {
|
||||
.name = "GPO2",
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data gpo3_init = {
|
||||
.constraints = {
|
||||
.name = "GPO3",
|
||||
}
|
||||
};
|
||||
|
||||
static struct regulator_init_data gpo4_init = {
|
||||
.constraints = {
|
||||
.name = "GPO4",
|
||||
}
|
||||
};
|
||||
|
||||
static int mc13892_regulator_init(struct mc13892 *mc13892)
|
||||
{
|
||||
unsigned int value, register_mask;
|
||||
|
||||
printk("Initializing regulators for Efika MX Smartbook\n");
|
||||
if (mxc_cpu_is_rev(CHIP_REV_2_0) < 0)
|
||||
sw2_init.constraints.state_mem.uV = 1100000;
|
||||
else if (mxc_cpu_is_rev(CHIP_REV_2_0) == 1) {
|
||||
sw2_init.constraints.state_mem.uV = 1250000;
|
||||
sw1_init.constraints.state_mem.uV = 1000000;
|
||||
}
|
||||
|
||||
/* enable standby controll for all regulators */
|
||||
pmic_read_reg(REG_MODE_0, &value, 0xffffff);
|
||||
value |= REG_MODE_0_ALL_MASK;
|
||||
pmic_write_reg(REG_MODE_0, value, 0xffffff);
|
||||
|
||||
pmic_read_reg(REG_MODE_1, &value, 0xffffff);
|
||||
value |= REG_MODE_1_ALL_MASK;
|
||||
pmic_write_reg(REG_MODE_1, value, 0xffffff);
|
||||
|
||||
/* enable switch audo mode */
|
||||
pmic_read_reg(REG_IDENTIFICATION, &value, 0xffffff);
|
||||
/* only for mc13892 2.0A */
|
||||
if ((value & 0x0000FFFF) == 0x45d0) {
|
||||
pmic_read_reg(REG_SW_4, &value, 0xffffff);
|
||||
register_mask = (SWMODE_MASK << SW1MODE_LSB) |
|
||||
(SWMODE_MASK << SW2MODE_LSB);
|
||||
value &= ~register_mask;
|
||||
value |= (SWMODE_AUTO << SW1MODE_LSB) |
|
||||
(SWMODE_AUTO << SW2MODE_LSB);
|
||||
pmic_write_reg(REG_SW_4, value, 0xffffff);
|
||||
|
||||
pmic_read_reg(REG_SW_5, &value, 0xffffff);
|
||||
register_mask = (SWMODE_MASK << SW3MODE_LSB) |
|
||||
(SWMODE_MASK << SW4MODE_LSB);
|
||||
value &= ~register_mask;
|
||||
value |= (SWMODE_AUTO << SW3MODE_LSB) |
|
||||
(SWMODE_AUTO << SW4MODE_LSB);
|
||||
pmic_write_reg(REG_SW_5, value, 0xffffff);
|
||||
}
|
||||
|
||||
mc13892_register_regulator(mc13892, MC13892_SW1, &sw1_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_SW2, &sw2_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_SW3, &sw3_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_SW4, &sw4_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_SWBST, &swbst_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VIOHI, &viohi_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VPLL, &vpll_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VDIG, &vdig_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VSD, &vsd_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VUSB2, &vusb2_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VVIDEO, &vvideo_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VAUDIO, &vaudio_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VCAM, &vcam_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VGEN1, &vgen1_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VGEN2, &vgen2_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VGEN3, &vgen3_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_VUSB, &vusb_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_GPO1, &gpo1_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_GPO2, &gpo2_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_GPO3, &gpo3_init);
|
||||
mc13892_register_regulator(mc13892, MC13892_GPO4, &gpo4_init);
|
||||
|
||||
regulator_has_full_constraints();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct mc13892_platform_data mc13892_plat = {
|
||||
.init = mc13892_regulator_init,
|
||||
};
|
||||
|
||||
static struct spi_board_info __initdata mc13892_spi_device = {
|
||||
.modalias = "pmic_spi",
|
||||
/*
|
||||
.irq = IOMUX_TO_IRQ(MX51_PIN_GPIO1_8),
|
||||
*/
|
||||
.irq = IOMUX_TO_IRQ(MX51_PIN_GPIO1_6),
|
||||
.max_speed_hz = 1000000, /* max spi SCK clock speed in HZ */
|
||||
.bus_num = 1,
|
||||
.chip_select = 0,
|
||||
.platform_data = &mc13892_plat,
|
||||
};
|
||||
|
||||
|
||||
int __init mx51_efikasb_init_pmic(void)
|
||||
{
|
||||
/* ron: disable power gate */
|
||||
pmic_write_reg(REG_POWER_MISC, ~(PWGT1SPIEN|PWGT2SPIEN),
|
||||
(PWGT1SPIEN|PWGT2SPIEN));
|
||||
|
||||
return spi_register_board_info(&mc13892_spi_device, 1);
|
||||
}
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/pci_ids.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/gpio.h>
|
||||
|
||||
#include "mx51_efikasb.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
int wireless_sw_state;
|
||||
|
||||
extern int mxc_get_wireless_sw_status(void);
|
||||
extern int mxc_get_sim_card_status(void);
|
||||
|
||||
extern void mxc_power_on_wlan(int on);
|
||||
extern void efikasb_power_on_wwan(int val);
|
||||
extern void efikasb_power_on_bt(int val);
|
||||
|
||||
extern int lid_wake_enable;
|
||||
extern int mxc_get_lid_sw_status(void);
|
||||
|
||||
extern void kernel_power_off(void);
|
||||
|
||||
static struct input_dev *efikasb_inputdev;
|
||||
static int system_is_resuming = 0;
|
||||
|
||||
|
||||
/*!
|
||||
* Power Key interrupt handler.
|
||||
*/
|
||||
static irqreturn_t power_key_int(int irq, void *dev_id)
|
||||
{
|
||||
static int key_pressed = 0;
|
||||
int pk_pressed;
|
||||
|
||||
/* ron: Don't report power key event if system is resuming */
|
||||
if(system_is_resuming)
|
||||
return IRQ_HANDLED;
|
||||
|
||||
pk_pressed = !gpio_get_value(IOMUX_TO_GPIO(POWER_BTN_PIN));
|
||||
if (pk_pressed) {
|
||||
if (key_pressed)
|
||||
return 0;
|
||||
key_pressed = 1;
|
||||
pr_info("PWR key pressed\n");
|
||||
/* ron: input_report_key(pk_dev, KEY_POWER, pk_pressed); */
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING); /* ron: detect falling edge */
|
||||
|
||||
if(lid_wake_enable)
|
||||
enable_irq_wake(IOMUX_TO_IRQ(LID_SW_PIN));
|
||||
|
||||
input_report_key(efikasb_inputdev, KEY_POWER, 1);
|
||||
input_sync(efikasb_inputdev);
|
||||
} else {
|
||||
if (!key_pressed)
|
||||
return 0;
|
||||
key_pressed = 0;
|
||||
pr_info("PWR Key released\n");
|
||||
/* ron: input_report_key(pk_dev, KEY_POWER, pk_released); */
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING); /* ron: detect falling edge */
|
||||
input_report_key(efikasb_inputdev, KEY_POWER, 0);
|
||||
input_sync(efikasb_inputdev);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int mxc_init_power_key(void)
|
||||
{
|
||||
int ret;
|
||||
int irq;
|
||||
|
||||
/* ron: set power key as wakeup source */
|
||||
gpio_request(IOMUX_TO_GPIO(POWER_BTN_PIN), "power_btn");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(POWER_BTN_PIN));
|
||||
irq = IOMUX_TO_IRQ(POWER_BTN_PIN);
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING); /* ron: detect rising & falling edge */
|
||||
|
||||
ret = request_irq(irq, power_key_int, 0, "power_key", 0);
|
||||
if (ret)
|
||||
pr_info("register on-off key interrupt failed\n");
|
||||
else
|
||||
enable_irq_wake(irq);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
#define KEY_RESUME KEY_WAKEUP
|
||||
|
||||
static int pm_notifier_call(struct notifier_block *nb, unsigned long event, void *dummy)
|
||||
{
|
||||
switch (event) {
|
||||
case PM_SUSPEND_PREPARE:
|
||||
printk("System Suspending .....\n");
|
||||
system_is_resuming = 1;
|
||||
return NOTIFY_OK;
|
||||
|
||||
case PM_POST_SUSPEND:
|
||||
printk("System Resumed\n");
|
||||
system_is_resuming = 0;
|
||||
input_event(efikasb_inputdev, EV_PWR, KEY_RESUME, 1);
|
||||
input_sync(efikasb_inputdev);
|
||||
|
||||
return NOTIFY_OK;
|
||||
|
||||
}
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
|
||||
static struct notifier_block pm_nb = {
|
||||
.notifier_call = pm_notifier_call,
|
||||
};
|
||||
|
||||
|
||||
static irqreturn_t wireless_sw_int(int irq, void *dev_id)
|
||||
{
|
||||
wireless_sw_state = gpio_get_value(IOMUX_TO_GPIO(WIRELESS_SW_PIN));
|
||||
|
||||
if (wireless_sw_state) {
|
||||
pr_info("Wireless SW Off\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
input_report_switch(efikasb_inputdev, SW_RFKILL_ALL, 0);
|
||||
input_sync(efikasb_inputdev);
|
||||
// power off WLAN, WWAN and BT by H/W
|
||||
} else {
|
||||
pr_info("Wireless SW On\n");
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
input_report_switch(efikasb_inputdev, SW_RFKILL_ALL, 1);
|
||||
input_sync(efikasb_inputdev);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int mxc_init_wireless_sw(void)
|
||||
{
|
||||
int irq, ret;
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(WIRELESS_SW_PIN), "wireless_sw");
|
||||
gpio_direction_input(IOMUX_TO_GPIO(WIRELESS_SW_PIN));
|
||||
irq = IOMUX_TO_IRQ(WIRELESS_SW_PIN);
|
||||
|
||||
if (gpio_get_value(IOMUX_TO_GPIO(WIRELESS_SW_PIN)))
|
||||
set_irq_type(irq, IRQF_TRIGGER_FALLING);
|
||||
else
|
||||
set_irq_type(irq, IRQF_TRIGGER_RISING);
|
||||
|
||||
ret = request_irq(irq, wireless_sw_int, 0, "wireless-sw", 0);
|
||||
|
||||
if (ret)
|
||||
pr_info("register wireless switch interrupt failed\n");
|
||||
|
||||
wireless_sw_state = gpio_get_value(IOMUX_TO_GPIO(WIRELESS_SW_PIN));
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static struct platform_device mxc_efikasb_input_dev = {
|
||||
.name = "efikasb_input",
|
||||
};
|
||||
|
||||
static int __init mxc_init_efikasb_inputdev(void)
|
||||
{
|
||||
int ret;
|
||||
struct kobject *efikasb_input_kobj;
|
||||
|
||||
platform_device_register(&mxc_efikasb_input_dev);
|
||||
|
||||
efikasb_input_kobj = kobject_create_and_add("status", &mxc_efikasb_input_dev.dev.kobj);
|
||||
if(!efikasb_input_kobj)
|
||||
return -ENOMEM;
|
||||
|
||||
efikasb_inputdev = input_allocate_device();
|
||||
if (!efikasb_inputdev) {
|
||||
pr_err("Failed to allocate hotkey input device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
efikasb_inputdev->name = "Genesi Efika MX Smartbook Extra Buttons";
|
||||
efikasb_inputdev->phys = "genesi-efikasb/input0";
|
||||
efikasb_inputdev->uniq = "genesi-efikasb";
|
||||
efikasb_inputdev->id.bustype = BUS_HOST;
|
||||
efikasb_inputdev->id.vendor = PCI_VENDOR_ID_FREESCALE;
|
||||
set_bit(KEY_POWER, efikasb_inputdev->keybit);
|
||||
set_bit(KEY_SLEEP, efikasb_inputdev->keybit);
|
||||
set_bit(KEY_WAKEUP, efikasb_inputdev->keybit);
|
||||
set_bit(EV_KEY, efikasb_inputdev->evbit);
|
||||
set_bit(EV_PWR, efikasb_inputdev->evbit);
|
||||
|
||||
set_bit(SW_RFKILL_ALL, efikasb_inputdev->swbit);
|
||||
if(mxc_get_wireless_sw_status())
|
||||
set_bit(SW_RFKILL_ALL, efikasb_inputdev->sw);
|
||||
|
||||
ret = input_register_device(efikasb_inputdev);
|
||||
if (ret) {
|
||||
input_free_device(efikasb_inputdev);
|
||||
pr_err("Failed to register hotkey input device\n");
|
||||
kobject_put(efikasb_input_kobj);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
mxc_init_power_key();
|
||||
|
||||
mxc_init_wireless_sw();
|
||||
|
||||
register_pm_notifier(&pm_nb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
late_initcall(mxc_init_efikasb_inputdev);
|
||||
|
||||
Reference in New Issue
Block a user