From 2fdd975672dedd9f28f26156ee73c2d0165ff9e7 Mon Sep 17 00:00:00 2001 From: ywj Date: Mon, 9 Sep 2013 14:32:21 +0800 Subject: [PATCH] add rk3026 support for factoryV4.0 --- arch/arm/configs/rk3026_86v_fac_defconfig | 450 ++++ arch/arm/mach-rk30/board-pmu-tps65910.c | 2 +- arch/arm/mach-rk3026/Kconfig | 4 + arch/arm/mach-rk3026/Makefile | 1 + arch/arm/mach-rk3026/board-rk3026-86v-fac.c | 2076 +++++++++++++++++++ arch/arm/plat-rk/rk-sdmmc-wifi.c | 2 +- drivers/usb/dwc_otg/usbdev_rk3026.c | 2 +- 7 files changed, 2534 insertions(+), 3 deletions(-) create mode 100644 arch/arm/configs/rk3026_86v_fac_defconfig create mode 100755 arch/arm/mach-rk3026/board-rk3026-86v-fac.c diff --git a/arch/arm/configs/rk3026_86v_fac_defconfig b/arch/arm/configs/rk3026_86v_fac_defconfig new file mode 100644 index 000000000000..e0c1570cb9b1 --- /dev/null +++ b/arch/arm/configs/rk3026_86v_fac_defconfig @@ -0,0 +1,450 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_KERNEL_LZO=y +CONFIG_LOG_BUF_SHIFT=19 +CONFIG_CGROUPS=y +CONFIG_CGROUP_DEBUG=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_RESOURCE_COUNTERS=y +CONFIG_CGROUP_SCHED=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_PANIC_TIMEOUT=1 +# CONFIG_SYSCTL_SYSCALL is not set +# CONFIG_ELF_CORE is not set +CONFIG_ASHMEM=y +# CONFIG_AIO is not set +CONFIG_EMBEDDED=y +# CONFIG_SLUB_DEBUG is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_ARCH_RK3026=y +CONFIG_DDR_FREQ=y +# CONFIG_DDR_TEST is not set +CONFIG_RK_CLOCK_PROC=y +CONFIG_CLK_SWITCH_TO_32K=y +CONFIG_RK30_I2C_INSRAM=y +CONFIG_RK_USB_UART=y +CONFIG_MACH_RK3026_86V_FAC=y +CONFIG_ARM_ERRATA_761320=y +CONFIG_ARM_ERRATA_775420=y +CONFIG_FIQ_DEBUGGER=y +CONFIG_FIQ_DEBUGGER_NO_SLEEP=y +CONFIG_FIQ_DEBUGGER_CONSOLE=y +CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_SMP=y +# CONFIG_SMP_ON_UP is not set +CONFIG_NR_CPUS=2 +CONFIG_PREEMPT=y +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +CONFIG_HIGHMEM=y +CONFIG_COMPACTION=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_CMDLINE="console=ttyFIQ0 androidboot.console=ttyFIQ0 init=/init" +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_IDLE=y +CONFIG_VFP=y +CONFIG_NEON=y +CONFIG_WAKELOCK=y +CONFIG_PM_RUNTIME=y +CONFIG_PM_DEBUG=y +CONFIG_SUSPEND_TIME=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_XFRM_USER=y +CONFIG_NET_KEY=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_INET_ESP=y +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +CONFIG_IPV6=y +CONFIG_IPV6_PRIVACY=y +CONFIG_IPV6_ROUTER_PREF=y +CONFIG_IPV6_OPTIMISTIC_DAD=y +CONFIG_INET6_AH=y +CONFIG_INET6_ESP=y +CONFIG_INET6_IPCOMP=y +CONFIG_IPV6_MIP6=y +CONFIG_IPV6_TUNNEL=y +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_NETFILTER=y +# CONFIG_BRIDGE_NETFILTER is not set +CONFIG_NF_CONNTRACK=y +CONFIG_NF_CONNTRACK_EVENTS=y +CONFIG_NF_CT_PROTO_DCCP=y +CONFIG_NF_CT_PROTO_SCTP=y +CONFIG_NF_CT_PROTO_UDPLITE=y +CONFIG_NF_CONNTRACK_AMANDA=y +CONFIG_NF_CONNTRACK_FTP=y +CONFIG_NF_CONNTRACK_H323=y +CONFIG_NF_CONNTRACK_IRC=y +CONFIG_NF_CONNTRACK_NETBIOS_NS=y +CONFIG_NF_CONNTRACK_PPTP=y +CONFIG_NF_CONNTRACK_SANE=y +CONFIG_NF_CONNTRACK_SIP=y +CONFIG_NF_CONNTRACK_TFTP=y +CONFIG_NF_CT_NETLINK=y +CONFIG_NETFILTER_TPROXY=y +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y +CONFIG_NETFILTER_XT_TARGET_CONNMARK=y +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y +CONFIG_NETFILTER_XT_TARGET_MARK=y +CONFIG_NETFILTER_XT_TARGET_NFLOG=y +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y +CONFIG_NETFILTER_XT_TARGET_TPROXY=y +CONFIG_NETFILTER_XT_TARGET_TRACE=y +CONFIG_NETFILTER_XT_MATCH_COMMENT=y +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y +CONFIG_NETFILTER_XT_MATCH_CONNMARK=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y +CONFIG_NETFILTER_XT_MATCH_HELPER=y +CONFIG_NETFILTER_XT_MATCH_IPRANGE=y +CONFIG_NETFILTER_XT_MATCH_LENGTH=y +CONFIG_NETFILTER_XT_MATCH_LIMIT=y +CONFIG_NETFILTER_XT_MATCH_MAC=y +CONFIG_NETFILTER_XT_MATCH_MARK=y +CONFIG_NETFILTER_XT_MATCH_POLICY=y +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y +CONFIG_NETFILTER_XT_MATCH_QTAGUID=y +CONFIG_NETFILTER_XT_MATCH_QUOTA=y +CONFIG_NETFILTER_XT_MATCH_QUOTA2=y +CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y +CONFIG_NETFILTER_XT_MATCH_SOCKET=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_STATISTIC=y +CONFIG_NETFILTER_XT_MATCH_STRING=y +CONFIG_NETFILTER_XT_MATCH_TIME=y +CONFIG_NETFILTER_XT_MATCH_U32=y +CONFIG_NF_CONNTRACK_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_MATCH_AH=y +CONFIG_IP_NF_MATCH_ECN=y +CONFIG_IP_NF_MATCH_TTL=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_TARGET_REJECT_SKERR=y +CONFIG_IP_NF_TARGET_LOG=y +CONFIG_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_MANGLE=y +CONFIG_IP_NF_RAW=y +CONFIG_IP_NF_ARPTABLES=y +CONFIG_IP_NF_ARPFILTER=y +CONFIG_IP_NF_ARP_MANGLE=y +CONFIG_NF_CONNTRACK_IPV6=y +CONFIG_IP6_NF_IPTABLES=y +CONFIG_IP6_NF_TARGET_LOG=y +CONFIG_IP6_NF_FILTER=y +CONFIG_IP6_NF_TARGET_REJECT=y +CONFIG_IP6_NF_TARGET_REJECT_SKERR=y +CONFIG_IP6_NF_MANGLE=y +CONFIG_IP6_NF_RAW=y +CONFIG_BRIDGE=y +# CONFIG_BRIDGE_IGMP_SNOOPING is not set +CONFIG_PHONET=y +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_HTB=y +CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_CLS_U32=y +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_U32=y +CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=y +CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_MIRRED=y +CONFIG_BT=y +CONFIG_BT_L2CAP=y +CONFIG_BT_SCO=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIBCM4325=y +CONFIG_BT_AUTOSLEEP=y +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_RFKILL=y +CONFIG_RFKILL_RK=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_NAND_IDS=y +CONFIG_MTD_RKNAND=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_MISC_DEVICES=y +CONFIG_UID_STAT=y +CONFIG_APANIC=y +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_SCSI_MULTI_LUN=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=y +CONFIG_DM_CRYPT=y +CONFIG_DM_UEVENT=y +CONFIG_NETDEVICES=y +CONFIG_PHYLIB=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETDEV_10000 is not set +CONFIG_WLAN_80211=y +CONFIG_RTL8188EU=y +CONFIG_USB_USBNET=y +CONFIG_PPP=y +CONFIG_PPP_MULTILINK=y +CONFIG_PPP_FILTER=y +CONFIG_PPP_ASYNC=y +CONFIG_PPP_SYNC_TTY=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_MPPE=y +CONFIG_PPPOLAC=y +CONFIG_PPPOPNS=y +# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_KEYRESET=y +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_TABLET=y +CONFIG_TABLET_USB_ACECAD=y +CONFIG_TABLET_USB_AIPTEK=y +CONFIG_TABLET_USB_GTCO=y +CONFIG_TABLET_USB_HANWANG=y +CONFIG_TABLET_USB_KBTAB=y +CONFIG_TABLET_USB_WACOM=y +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_GSLX680_RK3028=y +CONFIG_TOUCHSCREEN_GT811_IIC=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_KEYCHORD=y +CONFIG_INPUT_UINPUT=y +CONFIG_GS_MMA7660=y +CONFIG_GS_MMA8452=y +CONFIG_GS_LIS3DH=y +CONFIG_SENSOR_DEVICE=y +CONFIG_GSENSOR_DEVICE=y +CONFIG_GS_KXTIK=y +CONFIG_GS_MXC6225=y +CONFIG_GS_LSM303D=y +# CONFIG_SERIO is not set +# CONFIG_VT is not set +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_RK29=y +CONFIG_UART0_RK29=y +CONFIG_UART0_CTS_RTS_RK29=y +# CONFIG_HW_RANDOM is not set +CONFIG_I2C=y +# CONFIG_I2C_COMPAT is not set +CONFIG_I2C_CHARDEV=y +CONFIG_I2C0_CONTROLLER_RK30=y +CONFIG_I2C1_CONTROLLER_RK30=y +CONFIG_I2C2_CONTROLLER_RK30=y +CONFIG_I2C3_CONTROLLER_RK30=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_WM831X=y +CONFIG_EXPANDED_GPIO_NUM=0 +CONFIG_EXPANDED_GPIO_IRQ_NUM=0 +CONFIG_SPI_FPGA_GPIO_NUM=0 +CONFIG_SPI_FPGA_GPIO_IRQ_NUM=0 +CONFIG_POWER_SUPPLY=y +CONFIG_BATTERY_RK30_ADC_FAC=y +CONFIG_BATTERY_RK30_AC_CHARGE=y +CONFIG_BATTERY_RK30_VOL3V8=y +CONFIG_POWER_ON_CHARGER_DISPLAY=y +# CONFIG_HWMON is not set +CONFIG_MFD_TPS65910=y +CONFIG_MFD_WM831X_I2C=y +CONFIG_MFD_TPS65090=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_TPS65910=y +CONFIG_REGULATOR_WM831X=y +CONFIG_REGULATOR_ACT8846=y +CONFIG_RK30_PWM_REGULATOR=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_VIDEO_DEV=y +CONFIG_SOC_CAMERA=y +# CONFIG_SOC_CAMERA_OV3640 is not set +# CONFIG_SOC_CAMERA_OV5642 is not set +# CONFIG_SOC_CAMERA_OV5640 is not set +CONFIG_SOC_CAMERA_GC0308=y +CONFIG_VIDEO_RK29=y +CONFIG_VIDEO_RK29_CAMMEM_ION=y +CONFIG_ION=y +CONFIG_ION_ROCKCHIP=y +CONFIG_FB=y +CONFIG_FB_MODE_HELPERS=y +CONFIG_BACKLIGHT_LCD_SUPPORT=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +# CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_DISPLAY_SUPPORT=y +CONFIG_FB_ROCKCHIP=y +CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL=y +CONFIG_LCDC_RK3188=y +CONFIG_LCDC0_RK3188=y +CONFIG_LCD_RK3168_FAC=y +CONFIG_RK_TRSM=y +CONFIG_RGA_RK30=y +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_LOGO_LOWERPOWER_WARNING=y +CONFIG_SOUND=y +CONFIG_SND=y +# CONFIG_SND_SUPPORT_OLD_API is not set +# CONFIG_SND_VERBOSE_PROCFS is not set +# CONFIG_SND_DRIVERS is not set +# CONFIG_SND_ARM is not set +CONFIG_SND_SOC=y +CONFIG_SND_RK29_SOC=y +CONFIG_SND_I2SO_USE_DOUBLE_CHANNELS=y +CONFIG_SND_I2S_DMA_EVENT_STATIC=y +CONFIG_SND_RK29_SOC_ES8323=y +CONFIG_SND_RK29_SOC_RT5631=y +CONFIG_SND_RK_SOC_RK3026=y +CONFIG_SND_RK29_CODEC_SOC_SLAVE=y +CONFIG_UHID=y +CONFIG_HID_A4TECH=y +CONFIG_HID_ACRUX=y +CONFIG_HID_ACRUX_FF=y +CONFIG_HID_APPLE=y +CONFIG_HID_BELKIN=y +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=y +CONFIG_DRAGONRISE_FF=y +CONFIG_HID_EMS_FF=y +CONFIG_HID_ELECOM=y +CONFIG_HID_EZKEY=y +CONFIG_HID_KEYTOUCH=y +CONFIG_HID_KYE=y +CONFIG_HID_UCLOGIC=y +CONFIG_HID_WALTOP=y +CONFIG_HID_GYRATION=y +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LCPOWER=y +CONFIG_HID_LOGITECH=y +CONFIG_LOGITECH_FF=y +CONFIG_LOGIRUMBLEPAD2_FF=y +CONFIG_LOGIG940_FF=y +CONFIG_LOGIWII_FF=y +CONFIG_HID_MAGICMOUSE=y +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_MULTITOUCH=y +CONFIG_HID_NTRIG=y +CONFIG_HID_ORTEK=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PETALYNX=y +CONFIG_HID_PICOLCD=y +CONFIG_HID_QUANTA=y +CONFIG_HID_ROCCAT_ARVO=y +CONFIG_HID_ROCCAT_KONE=y +CONFIG_HID_ROCCAT_KONEPLUS=y +CONFIG_HID_ROCCAT_KOVAPLUS=y +CONFIG_HID_ROCCAT_PYRA=y +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +CONFIG_HID_SUNPLUS=y +CONFIG_HID_GREENASIA=y +CONFIG_GREENASIA_FF=y +CONFIG_HID_SMARTJOYPLUS=y +CONFIG_SMARTJOYPLUS_FF=y +CONFIG_HID_TOPSEED=y +CONFIG_HID_THRUSTMASTER=y +CONFIG_THRUSTMASTER_FF=y +CONFIG_HID_WACOM=y +CONFIG_HID_ZEROPLUS=y +CONFIG_ZEROPLUS_FF=y +CONFIG_HID_ZYDACRON=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +CONFIG_USB_DEVICEFS=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SERIAL=y +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_OPTION=y +CONFIG_USB_GADGET=y +CONFIG_USB20_HOST=y +CONFIG_USB20_OTG=y +CONFIG_DWC_OTG_BOTH_HOST_SLAVE=y +CONFIG_MMC=y +CONFIG_MMC_UNSAFE_RESUME=y +CONFIG_MMC_EMBEDDED_SDIO=y +CONFIG_MMC_PARANOID_SD_INIT=y +CONFIG_MMC_BLOCK_MINORS=12 +CONFIG_SDMMC_RK29=y +CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_SWITCH=y +CONFIG_SWITCH_GPIO=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_WM831X=y +CONFIG_TPS65910_RTC=y +CONFIG_STAGING=y +CONFIG_ANDROID=y +CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_LOGGER=y +CONFIG_ANDROID_TIMED_GPIO=y +CONFIG_ANDROID_LOW_MEMORY_KILLER=y +# CONFIG_CMMB is not set +CONFIG_EXT3_FS=y +# CONFIG_EXT3_FS_XATTR is not set +CONFIG_EXT4_FS=y +# CONFIG_EXT4_FS_XATTR is not set +# CONFIG_DNOTIFY is not set +CONFIG_FUSE_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_EFI_PARTITION=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_PRINTK_TIME=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_KERNEL=y +CONFIG_SCHEDSTATS=y +# CONFIG_DEBUG_PREEMPT is not set +# CONFIG_EVENT_POWER_TRACING_DEPRECATED is not set +CONFIG_ENABLE_DEFAULT_TRACERS=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_TWOFISH=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set diff --git a/arch/arm/mach-rk30/board-pmu-tps65910.c b/arch/arm/mach-rk30/board-pmu-tps65910.c index 74a9c8587879..032a3883e847 100755 --- a/arch/arm/mach-rk30/board-pmu-tps65910.c +++ b/arch/arm/mach-rk30/board-pmu-tps65910.c @@ -330,7 +330,7 @@ static struct regulator_consumer_supply tps65910_smps2_supply[] = { { .supply = "vdd_cpu", }, - #elif defined(CONFIG_MACH_RK3026_86V) + #elif (defined(CONFIG_MACH_RK3026_86V)||defined(CONFIG_MACH_RK3026_86V_FAC)) { .supply = "vdd_core", }, diff --git a/arch/arm/mach-rk3026/Kconfig b/arch/arm/mach-rk3026/Kconfig index 5bb8d0d0e45c..89e1e635f9e9 100755 --- a/arch/arm/mach-rk3026/Kconfig +++ b/arch/arm/mach-rk3026/Kconfig @@ -20,5 +20,9 @@ config MACH_RK3028A_86V config MACH_RK3028A_FAC bool "RK3028A Board for factory" select MACH_RK_FAC + +config MACH_RK3026_86V_FAC + bool "RK3026 86V Board for factory" + select MACH_RK_FAC endchoice diff --git a/arch/arm/mach-rk3026/Makefile b/arch/arm/mach-rk3026/Makefile index 928d1752b8ea..b0c5dc76d1b5 100755 --- a/arch/arm/mach-rk3026/Makefile +++ b/arch/arm/mach-rk3026/Makefile @@ -25,3 +25,4 @@ board-$(CONFIG_MACH_RK3026_86V) += board-rk3026-86v.o board-$(CONFIG_MACH_RK3028A_TB) += board-rk3028a-tb.o board-$(CONFIG_MACH_RK3028A_86V) += board-rk3028a-86v.o board-$(CONFIG_MACH_RK3028A_FAC) += board-rk3028a-86v-fac.o +board-$(CONFIG_MACH_RK3026_86V_FAC) += board-rk3026-86v-fac.o diff --git a/arch/arm/mach-rk3026/board-rk3026-86v-fac.c b/arch/arm/mach-rk3026/board-rk3026-86v-fac.c new file mode 100755 index 000000000000..742f075688b1 --- /dev/null +++ b/arch/arm/mach-rk3026/board-rk3026-86v-fac.c @@ -0,0 +1,2076 @@ +/* + * Copyright (C) 2013 ROCKCHIP, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_SPIM_RK29) +#include "../../../drivers/spi/rk29_spim.h" +#endif + +#ifdef CONFIG_SND_SOC_RK3026 +#include "../../../sound/soc/codecs/rk3026_codec.h" +#endif + +#if defined(CONFIG_RK_HDMI) + #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" +#endif + +#if defined(CONFIG_GPS_RK) +#include "../../../drivers/misc/gps/rk_gps/rk_gps.h" +#endif +#include "board-rk3026-86v-camera.c" +#include +#include +#include "../plat-rk/rk-fac-config.c" +#if 1 +#define INIT_ERR(name) do { printk("%s: %s init Failed: \n", __func__, (name)); } while(0) +#else +#define INIT_ERR(name) +#endif + +/*********************************************************** +* board config +************************************************************/ + +//pwm regulator +#define REG_PWM 1 // (0 ~ 2) +//pmic +#define PMU_INT_PIN RK30_PIN1_PB1 +#define PMU_SLEEP_PIN RK30_PIN1_PA1 +//ion reserve memory +#define ION_RESERVE_SIZE (80 * SZ_1M) + +static int pwm_mode[] = {PWM0, PWM1, PWM2}; +static inline int rk_gpio_request(int gpio, int direction, int value, const char *label) +{ + int ret = 0; + unsigned long flags = 0; + + if(!gpio_is_valid(gpio)) + return 0; + + if(direction == GPIOF_DIR_IN) + flags = GPIOF_IN; + else if(value == GPIO_LOW) + flags = GPIOF_OUT_INIT_LOW; + else + flags = GPIOF_OUT_INIT_HIGH; + + ret = gpio_request_one(gpio, flags, label); + if(ret < 0) + pr_err("Failed to request '%s'\n", label); + + return ret; +} +//////////////////////////////////////////////////////////////////////////////////////// +//key +//////////////////////////////////////////////////////////////////////////////////////// +#include +static struct rk29_keys_button key_button[] = { + { + .desc = "play", + .code = KEY_POWER, + .wakeup = 1, + }, + { + .desc = "vol-", + .code = KEY_VOLUMEDOWN, + }, + { + .desc = "vol+", + .code = KEY_VOLUMEUP, + }, + { + .desc = "menu", + .code = EV_MENU, + }, + { + .desc = "esc", + .code = KEY_BACK, + }, + { + .desc = "home", + .code = KEY_HOME, + }, +}; +struct rk29_keys_platform_data rk29_keys_pdata = { + .buttons = key_button, + .chn = -1, //chn: 0-7, if do not use ADC,set 'chn' -1 +}; +//////////////////////////////////////////////////////////////////////////////////////// +//Backlight +//////////////////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_BACKLIGHT_RK29_BL +static int rk29_backlight_io_init(void) +{ + int ret = 0; + printk("rk29_backlight_io_init %d\n",bl_pwm_mode); + iomux_set(bl_pwm_mode); + msleep(50); + if(bl_en== -1) + return 0; + ret = port_output_init(bl_en, 1, "bl_en"); + if(ret < 0){ + printk("%s: port output init faild\n", __func__); + return ret; + } + port_output_on(bl_en); + + return ret; + +} + +static int rk29_backlight_io_deinit(void) +{ + int ret = 0, pwm_gpio; + + if(bl_en != -1) + port_deinit(bl_en); + + pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode); + gpio_request(pwm_gpio, NULL); + gpio_direction_output(pwm_gpio, GPIO_LOW); + return ret; +} + +static int rk29_backlight_pwm_suspend(void) +{ + int ret = 0, pwm_gpio; + + pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode); + if (gpio_request(pwm_gpio, NULL)) { + printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__); + return -1; + } + gpio_direction_output(pwm_gpio, GPIO_LOW); + port_output_off(bl_en); + return ret; +} + +static int rk29_backlight_pwm_resume(void) +{ + int pwm_gpio = iomux_mode_to_gpio(bl_pwm_mode); + + gpio_free(pwm_gpio); + iomux_set(bl_pwm_mode); + msleep(30); + port_output_on(bl_en); + return 0; +} + +static struct rk29_bl_info rk29_bl_info = { + .io_init = rk29_backlight_io_init, + .io_deinit = rk29_backlight_io_deinit, + .pwm_suspend = rk29_backlight_pwm_suspend, + .pwm_resume = rk29_backlight_pwm_resume, +}; + +static struct platform_device rk29_device_backlight = { + .name = "rk29_backlight", + .id = -1, + .dev = { + .platform_data = &rk29_bl_info, + } +}; +#endif +//////////////////////////////////////////////////////////////////////////////////////// +//LCD +//////////////////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_FB_ROCKCHIP +static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting) +{ + int ret = 0; + //printk("rk_fb_io_init %x,%x,%x\n",lcd_cs,lcd_en,lcd_std); + if(lcd_cs != -1){ + ret = port_output_init(lcd_cs, 1, "lcd_cs"); + if(ret < 0) + printk("%s: port output init faild\n", __func__); + port_output_on(lcd_cs); + } + + if(lcd_en != -1){ + ret = port_output_init(lcd_en, 1, "lcd_en"); + if(ret < 0) + printk("%s: port output init faild\n", __func__); + port_output_on(lcd_en); + } + + return 0; +} +static int rk_fb_io_disable(void) +{ + if(lcd_cs != -1) + port_output_off(lcd_cs); + if(lcd_en != -1) + port_output_on(lcd_en); + return 0; +} +static int rk_fb_io_enable(void) +{ + if(lcd_en != -1) + port_output_on(lcd_en); + if(lcd_cs != -1) + port_output_on(lcd_cs); + return 0; +} + +#if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188) +struct rk29fb_info lcdc0_screen_info = { +#if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC0) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL) + .prop = EXTEND, //extend display device + .io_init = NULL, + .io_disable = NULL, + .io_enable = NULL, + .set_screen_info = hdmi_init_lcdc, +#else + .prop = PRMRY, //primary display device + .io_init = rk_fb_io_init, + .io_disable = rk_fb_io_disable, + .io_enable = rk_fb_io_enable, + .set_screen_info = set_lcd_info, +#endif +}; +#endif + +#if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188) +struct rk29fb_info lcdc1_screen_info = { +#if defined(CONFIG_RK_HDMI) && defined(CONFIG_HDMI_SOURCE_LCDC1) && defined(CONFIG_DUAL_LCDC_DUAL_DISP_IN_KERNEL) + .prop = EXTEND, //extend display device + .io_init = NULL, + .io_disable = NULL, + .io_enable = NULL, + .set_screen_info = hdmi_init_lcdc, +#else + .prop = PRMRY, //primary display device + .io_init = rk_fb_io_init, + .io_disable = rk_fb_io_disable, + .io_enable = rk_fb_io_enable, + .set_screen_info = set_lcd_info, +#endif +}; +#endif + +static struct resource resource_fb[] = { + [0] = { + .name = "fb0 buf", + .start = 0, + .end = 0,//RK30_FB0_MEM_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = "ipp buf", //for rotate + .start = 0, + .end = 0,//RK30_FB0_MEM_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [2] = { + .name = "fb2 buf", + .start = 0, + .end = 0,//RK30_FB0_MEM_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device device_fb = { + .name = "rk-fb", + .id = -1, + .num_resources = ARRAY_SIZE(resource_fb), + .resource = resource_fb, +}; +#endif + +#if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188) +static struct resource resource_lcdc0[] = { + [0] = { + .name = "lcdc0 reg", + .start = RK3026_LCDC0_PHYS, + .end = RK3026_LCDC0_PHYS + RK3026_LCDC0_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + + [1] = { + .name = "lcdc0 irq", + .start = IRQ_LCDC, + .end = IRQ_LCDC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device device_lcdc0 = { + .name = "rk30-lcdc", + .id = 0, + .num_resources = ARRAY_SIZE(resource_lcdc0), + .resource = resource_lcdc0, + .dev = { + .platform_data = &lcdc0_screen_info, + }, +}; +#endif + +#if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188) +static struct resource resource_lcdc1[] = { + [0] = { + .name = "lcdc1 reg", + .start = RK3026_LCDC1_PHYS, + .end = RK3026_LCDC1_PHYS + RK3026_LCDC1_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = "lcdc1 irq", + .start = IRQ_LCDC1, + .end = IRQ_LCDC1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device device_lcdc1 = { + .name = "rk30-lcdc", + .id = 1, + .num_resources = ARRAY_SIZE(resource_lcdc1), + .resource = resource_lcdc1, + .dev = { + .platform_data = &lcdc1_screen_info, + }, +}; +#endif + +static int rk_platform_add_display_devices(void) +{ + struct platform_device *fb = NULL; //fb + struct platform_device *lcdc0 = NULL; //lcdc0 + struct platform_device *lcdc1 = NULL; //lcdc1 + struct platform_device *bl = NULL; //backlight +#ifdef CONFIG_FB_ROCKCHIP + fb = &device_fb; +#endif + +#if defined(CONFIG_LCDC0_RK3066B) || defined(CONFIG_LCDC0_RK3188) + lcdc0 = &device_lcdc0, +#endif + +#if defined(CONFIG_LCDC1_RK3066B) || defined(CONFIG_LCDC1_RK3188) + lcdc1 = &device_lcdc1, +#endif + +#ifdef CONFIG_BACKLIGHT_RK29_BL + bl = &rk29_device_backlight, +#endif + __rk_platform_add_display_devices(fb,lcdc0,lcdc1,bl); + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////////////// +//TP +//////////////////////////////////////////////////////////////////////////////////////// +#if (defined(CONFIG_TOUCHSCREEN_GSLX680_RK3168)||defined (CONFIG_TOUCHSCREEN_GSLX680_RK3028)) +static int gslx680_init_platform_hw() + { + return 0; + } + +static struct tp_platform_data gslx680_data = { + + .init_platform_hw = gslx680_init_platform_hw, +}; +struct i2c_board_info __initdata gslx680_info = { + .type = "gslX680", + .flags = 0, + .platform_data = &gslx680_data, +}; +#endif + + +#if defined (CONFIG_TOUCHSCREEN_86V_GT811_IIC) +int gt811_init_platform_hw(int irq,int reset) +{ + int ret; + if(tp_rst!=-1){ + ret = port_output_init(tp_rst, 1, "tp_rst"); + if(ret<0) + printk("%s: port output init faild\n", __func__); + } + + port_output_off(tp_rst); + msleep(500); + port_output_off(tp_rst); + msleep(500); + port_output_on(tp_rst); + mdelay(100); + return 0; +} + + +static struct tp_platform_data gt811_data = { + .model= 811, + .init_platform_hw= gt811_init_platform_hw, +}; + +struct i2c_board_info __initdata gt811_info = { + .type = "gt811_ts", + .flags = 0, + .platform_data = >811_data, +}; +#endif +#if defined(CONFIG_TOUCHSCREEN_GT8XX) +#define TOUCH_PWR_PIN RK30_PIN0_PC5 // need to fly line by hardware engineer +static int goodix_init_platform_hw(void) +{ + int ret; + + if (TOUCH_PWR_PIN != INVALID_GPIO) { + ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin"); + if (ret != 0) { + gpio_free(TOUCH_PWR_PIN); + printk("goodix power error\n"); + return -EIO; + } + gpio_direction_output(TOUCH_PWR_PIN, 0); + gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW); + msleep(100); + } + + if(tp_rst!=-1){ + ret = port_output_init(tp_rst, 1, "tp_rst"); + if(ret<0) + printk("%s: port output init faild\n", __func__); + } + port_output_on(tp_rst); + msleep(100); + return 0; +} + +struct tp_platform_data goodix_data = { + .model = 8105, + .init_platform_hw = goodix_init_platform_hw, +}; + +struct i2c_board_info __initdata goodix_info = { + .type = "Goodix-TS", + .flags = 0, + .platform_data = &goodix_data, +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////// +//Gsensor +//////////////////////////////////////////////////////////////////////////////////////// +#if defined (CONFIG_GS_LSM303D) +static int lms303d_init_platform_hw(void) +{ + return 0; +} +static struct sensor_platform_data lms303d_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, + .init_platform_hw = lms303d_init_platform_hw, +}; +struct i2c_board_info __initdata lms303d_info = { + .type = "gs_lsm303d", + .flags = 0, + .platform_data =&lms303d_data, +}; +#endif + +#if defined (CONFIG_GS_MMA8452) +static int mma8452_init_platform_hw(void) +{ + return 0; +} + +static struct sensor_platform_data mma8452_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, + .init_platform_hw = mma8452_init_platform_hw, +}; +struct i2c_board_info __initdata mma8452_info = { + .type = "gs_mma8452", + .flags = 0, + .platform_data =&mma8452_data, +}; +#endif + +/*MMA7660 gsensor*/ +#if defined (CONFIG_GS_MMA7660) +static int mma7660_init_platform_hw(void) +{ + //rk30_mux_api_set(GPIO1B2_SPI_RXD_UART1_SIN_NAME, GPIO1B_GPIO1B2); + + return 0; +} + +static struct sensor_platform_data mma7660_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, + .init_platform_hw = mma7660_init_platform_hw, +}; +struct i2c_board_info __initdata mma7660_info = { + .type = "gs_mma7660", + .flags = 0, + .platform_data =&mma7660_data, +}; +#endif + +#if defined (CONFIG_GS_MXC6225) +static int mxc6225_init_platform_hw(void) +{ +// rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1); + return 0; +} + +static struct sensor_platform_data mxc6225_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 0, + .poll_delay_ms = 30, + .init_platform_hw = mxc6225_init_platform_hw, +}; +struct i2c_board_info __initdata mxc6225_info = { + .type = "gs_mxc6225", + .flags = 0, + .platform_data =&mxc6225_data, +}; +#endif + +#if defined (CONFIG_GS_DMT10) +static int dmt10_init_platform_hw(void) +{ + return 0; +} + +static struct sensor_platform_data dmt10_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 0, + .poll_delay_ms = 30, + .init_platform_hw = dmt10_init_platform_hw, +}; +struct i2c_board_info __initdata dmt10_info = { + .type = "gs_dmard10", + .flags = 0, + .platform_data =&dmt10_data, +}; +#endif + + +#if defined (CONFIG_GS_LIS3DH) +static int lis3dh_init_platform_hw(void) +{ + return 0; +} +static struct sensor_platform_data lis3dh_data = { + .type = SENSOR_TYPE_ACCEL, + .irq_enable = 1, + .poll_delay_ms = 30, + .init_platform_hw = lis3dh_init_platform_hw, +}; +struct i2c_board_info __initdata lis3dh_info = { + .type = "gs_lis3dh", + .flags = 0, + .platform_data =&lis3dh_data, +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////// +//battery +//////////////////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_BATTERY_RK30_ADC_FAC +static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = { + +}; + + +static struct platform_device rk30_device_adc_battery = { + .name = "rk30-battery", + .id = -1, + .dev = { + .platform_data = &rk30_adc_battery_platdata, + }, +}; +#endif + +//////////////////////////////////////////////////////////////////////////////////////// +//codec +//////////////////////////////////////////////////////////////////////////////////////// +#ifdef CONFIG_SND_SOC_RK3026 +struct rk3026_codec_pdata rk3026_codec_pdata_info={ + .spk_ctl_gpio = INVALID_GPIO, + .hp_ctl_gpio = RK2928_PIN1_PA0, +}; + +static struct resource resources_acodec[] = { + { + .start = RK2928_ACODEC_PHYS, + .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device rk3026_codec = { + .name = "rk3026-codec", + .id = -1, + .resource = resources_acodec, + .dev = { + .platform_data = &rk3026_codec_pdata_info, + } +}; +#endif + +#if defined (CONFIG_SND_RK29_SOC_RT5631) +static struct codec_platform_data rt5631_data = { +}; +struct i2c_board_info __initdata rt5631_info = { + .type = "rt5631", + .flags = 0, + .platform_data =&rt5631_data, +}; +#endif + +#if defined (CONFIG_SND_RK29_SOC_ES8323) +static struct codec_platform_data es8323_data = { +}; +struct i2c_board_info __initdata es8323_info = { + .type = "es8323", + .flags = 0, + .platform_data =&es8323_data, +}; +#endif + +#if defined(CONFIG_MFD_RK616) +#define RK616_SCL_RATE (100*1000) //i2c scl rate +static int rk616_power_on_init(void) +{ + int ret; + + if(codec_power!=-1) + { + ret = port_output_init(codec_power, 1, "codec_power"); + if(ret < 0) + printk("%s: port output init faild\n", __func__); + port_output_on(codec_power); + } + + if(codec_rst!=-1) + { + ret = port_output_init(codec_rst, 1, "codec_rst"); + if(ret < 0) + printk("%s: port output init faild\n", __func__); + port_output_on(codec_rst); + msleep(100); + port_output_off(codec_rst); + msleep(100); + port_output_on(codec_rst); + } + return 0; + +} + + +static int rk616_power_deinit(void) +{ + if(codec_power!=-1) + { + port_output_off(codec_power); + port_deinit(codec_power); + } + if(codec_rst!=-1) + { + port_output_off(codec_rst); + port_deinit(codec_rst); + } + return 0; +} + +static struct rk616_platform_data rk616_pdata = { + .power_init = rk616_power_on_init, + .power_deinit = rk616_power_deinit, + .scl_rate = RK616_SCL_RATE, + .lcd0_func = INPUT, //port lcd0 as input + .lcd1_func = INPUT, //port lcd1 as input + .lvds_ch_nr = 1, //the number of used lvds channel + //.hdmi_irq = RK30_PIN2_PD6, + //.spk_ctl_gpio = RK30_PIN2_PD7, + .hp_ctl_gpio = RK30_PIN2_PD7, +}; + +struct i2c_board_info __initdata rk616_info = { + .type = "rk616", + .flags = 0, + .platform_data = &rk616_pdata, +}; +#endif + + +//////////////////////////////////////////////////////////////////////////////////////// +//spi +//////////////////////////////////////////////////////////////////////////////////////// +static struct spi_board_info board_spi_devices[] = { +}; + + +//////////////////////////////////////////////////////////////////////////////////////// +//compass +//////////////////////////////////////////////////////////////////////////////////////// +#if defined (CONFIG_COMPASS_AK8975) +static struct sensor_platform_data akm8975_info = +{ + .type = SENSOR_TYPE_COMPASS, + .irq_enable = 1, + .poll_delay_ms = 30, + .m_layout = + { + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + } +}; + +#endif + +#if defined (CONFIG_COMPASS_AK8963) +static struct sensor_platform_data akm8963_info = +{ + .type = SENSOR_TYPE_COMPASS, + .irq_enable = 1, + .poll_delay_ms = 30, + .m_layout = + { + { + {0, 1, 0}, + {1, 0, 0}, + {0, 0, -1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + + { + {0, -1, 0}, + {-1, 0, 0}, + {0, 0, -1}, + }, + + { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + }, + } +}; + +#endif + + +#if defined(CONFIG_GYRO_L3G4200D) + +#include +#define L3G4200D_INT_PIN RK30_PIN0_PB4 + +static int l3g4200d_init_platform_hw(void) +{ + return 0; +} + +static struct sensor_platform_data l3g4200d_info = { + .type = SENSOR_TYPE_GYROSCOPE, + .irq_enable = 1, + .poll_delay_ms = 30, + .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1}, + .init_platform_hw = l3g4200d_init_platform_hw, + .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware + .y_min = 40, + .z_min = 20, +}; + +#endif + +#ifdef CONFIG_LS_CM3217 +static struct sensor_platform_data cm3217_info = { + .type = SENSOR_TYPE_LIGHT, + .irq_enable = 0, + .poll_delay_ms = 500, +}; + +#endif + +/*********************************************************** +* usb wifi +************************************************************/ +#if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) + +static void rkusb_wifi_power(int on) { + int ret=0; + struct regulator *ldo = NULL; + printk("hjc:%s[%d],on=%d\n",__func__,__LINE__,on); +#if defined(CONFIG_MFD_TPS65910) + if (pmic_is_tps65910()) + ldo = regulator_get(NULL, "vmmc"); //vccio_wl +#endif +#if defined(CONFIG_REGULATOR_ACT8931) + if(pmic_is_act8931()) + ldo = regulator_get(NULL, "act_ldo4"); //vccio_wl +#endif + + if(!on) { + + regulator_set_voltage(ldo, 3000000, 3000000); + ret = regulator_enable(ldo); + if(ret != 0){ + printk("faild to enable vmmc\n"); + } + printk("%s: vccio_wl enable\n", __func__); + } else { + printk("%s: vccio_wl disable\n", __func__); + regulator_disable(ldo); + if(ret != 0){ + printk("faild to disable vmmc\n"); + } + } + regulator_put(ldo); + udelay(100); +} + +#endif + + +/*********************************************************** +* sdmmc +************************************************************/ +#ifdef CONFIG_SDMMC_RK29 +#include "board-rk3026-86v-sdmmc-config.c" +#include "../plat-rk/rk-sdmmc-ops.c" +#include "../plat-rk/rk-sdmmc-wifi.c" +#endif //endif ---#ifdef CONFIG_SDMMC_RK29 + +#ifdef CONFIG_SDMMC0_RK29 +#define CONFIG_SDMMC0_USE_DMA +static int rk29_sdmmc0_cfg_gpio(void) +{ + rk29_sdmmc_set_iomux(0, 0xFFFF); + #if defined(CONFIG_SDMMC0_RK29_SDCARD_DET_FROM_GPIO) + iomux_set_gpio_mode(iomux_gpio_to_mode(RK29SDK_SD_CARD_DETECT_N)); + #else + iomux_set(MMC0_DETN); + #endif + + #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) + gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp"); + gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN); + #endif + return 0; +} + +struct rk29_sdmmc_platform_data default_sdmmc0_data = { + .host_ocr_avail = + (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 | + MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | + MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36), + .host_caps = + (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), + .io_init = rk29_sdmmc0_cfg_gpio, + + .set_iomux = rk29_sdmmc_set_iomux, + + .dma_name = "sd_mmc", +#ifdef CONFIG_SDMMC0_USE_DMA + .use_dma = 1, +#else + .use_dma = 0, +#endif + +#if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) && defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD) + .status = rk29sdk_wifi_mmc0_status, + .register_status_notify = rk29sdk_wifi_mmc0_status_register, +#endif + +#if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN) + .power_en = RK29SDK_SD_CARD_PWR_EN, + .power_en_level = RK29SDK_SD_CARD_PWR_EN_LEVEL, +#else + .power_en = INVALID_GPIO, + .power_en_level = GPIO_LOW, +#endif + .enable_sd_wakeup = 0, + +#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT) + .write_prt = SDMMC0_WRITE_PROTECT_PIN, + .write_prt_enalbe_level = SDMMC0_WRITE_PROTECT_ENABLE_VALUE; +#else + .write_prt = INVALID_GPIO, +#endif + + .det_pin_info = { + #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N) + .io = RK29SDK_SD_CARD_DETECT_N, //INVALID_GPIO, + .enable = RK29SDK_SD_CARD_INSERT_LEVEL, + #else + .io = INVALID_GPIO, + .enable = GPIO_LOW, + #endif + }, + +}; +#endif // CONFIG_SDMMC0_RK29 + +#ifdef CONFIG_SDMMC1_RK29 +#define CONFIG_SDMMC1_USE_DMA +static int rk29_sdmmc1_cfg_gpio(void) +{ +#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp"); + gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN); +#endif + return 0; +} + +struct rk29_sdmmc_platform_data default_sdmmc1_data = { + .host_ocr_avail = + (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 | + MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | + MMC_VDD_33_34), + +#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD) + .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ | + MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), +#else + .host_caps = + (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), +#endif + + .io_init = rk29_sdmmc1_cfg_gpio, + + .set_iomux = rk29_sdmmc_set_iomux, + + .dma_name = "sdio", +#ifdef CONFIG_SDMMC1_USE_DMA + .use_dma = 1, +#else + .use_dma = 0, +#endif + +#if defined(CONFIG_WIFI_CONTROL_FUNC) || defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) + .status = rk29sdk_wifi_status, + .register_status_notify = rk29sdk_wifi_status_register, +#endif + +#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT) + .write_prt = SDMMC1_WRITE_PROTECT_PIN, + .write_prt_enalbe_level = SDMMC1_WRITE_PROTECT_ENABLE_VALUE; +#else + .write_prt = INVALID_GPIO, +#endif + + #if defined(CONFIG_RK29_SDIO_IRQ_FROM_GPIO) + .sdio_INT_gpio = RK29SDK_WIFI_SDIO_CARD_INT, + #endif + + .det_pin_info = { + #if defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD) + #if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N) + .io = RK29SDK_SD_CARD_DETECT_N, + #else + .io = INVALID_GPIO, + #endif + + .enable = RK29SDK_SD_CARD_INSERT_LEVEL, + #else + .io = INVALID_GPIO, + .enable = GPIO_LOW, + #endif + }, + .enable_sd_wakeup = 0, +}; +#endif //endif--#ifdef CONFIG_SDMMC1_RK29 + +/*********************************************************** +* rfkill +************************************************************/ +#ifdef CONFIG_RFKILL_RK +// bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c +static struct rfkill_rk_platform_data rfkill_rk_platdata = { + .type = RFKILL_TYPE_BLUETOOTH, + + .poweron_gpio = { // BT_REG_ON + .io = INVALID_GPIO, //RK30_PIN3_PC7, + .enable = GPIO_HIGH, + .iomux = { + .name = "bt_poweron", + //.fgpio = GPIO3_C7, + }, + }, + + .reset_gpio = { // BT_RST + .io = RK30_PIN1_PB3, // set io to INVALID_GPIO for disable it + .enable = GPIO_LOW, + .iomux = { + .name = "bt_reset", + .fgpio = GPIO1_B3, + }, + }, + + .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup + .io = RK30_PIN1_PB2, // set io to INVALID_GPIO for disable it + .enable = GPIO_HIGH, + .iomux = { + .name = "bt_wake", + .fgpio = GPIO1_B2, + }, + }, + + .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep + .gpio = { + .io = RK30_PIN0_PA4, // set io to INVALID_GPIO for disable it + .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising + .iomux = { + .name = "bt_wake_host", + //.fgpio = GPIO0_A4, + }, + }, + }, + + .rts_gpio = { // UART_RTS, enable or disable BT's data coming + .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it + .enable = GPIO_LOW, + .iomux = { + .name = "bt_rts", + .fgpio = GPIO1_A3, + .fmux = UART0_RTSN, + }, + } +}; + +static struct platform_device device_rfkill_rk = { + .name = "rfkill_rk", + .id = -1, + .dev = { + .platform_data = &rfkill_rk_platdata, + }, +}; +#endif + +/*********************************************************** +* ion +************************************************************/ +#ifdef CONFIG_ION +static struct ion_platform_data rk30_ion_pdata = { + .nr = 1, + .heaps = { + { + .type = ION_HEAP_TYPE_CARVEOUT, + .id = ION_NOR_HEAP_ID, + .name = "norheap", + .size = ION_RESERVE_SIZE, + } + }, +}; + +static struct platform_device device_ion = { + .name = "ion-rockchip", + .id = 0, + .dev = { + .platform_data = &rk30_ion_pdata, + }, +}; +#endif + +/*********************************************************** +* pwm regulator +************************************************************/ +#ifdef CONFIG_RK30_PWM_REGULATOR +static int pwm_voltage_map[] = { + 800000, 825000, 850000, 875000, 900000, 925000 , + 950000, 975000, 1000000, 1025000, 1050000, 1075000, + 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, + 1250000, 1275000, 1300000, 1325000, 1350000, 1375000 +}; + +static struct regulator_consumer_supply pwm_dcdc1_consumers[] = { + { + .supply = "vdd_core", + } +}; + +struct regulator_init_data pwm_regulator_init_dcdc[1] = { + { + .constraints = { + .name = "PWM_DCDC1", + .min_uV = 600000, + .max_uV = 1800000, //0.6-1.8V + .apply_uV = true, + .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE, + }, + .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers), + .consumer_supplies = pwm_dcdc1_consumers, + }, +}; + +static struct pwm_platform_data pwm_regulator_info[1] = { + { + .pwm_id = REG_PWM, + .pwm_voltage = 1200000, + .suspend_voltage = 1050000, + .min_uV = 950000, + .max_uV = 1400000, + .coefficient = 504, //50.4% + .pwm_voltage_map = pwm_voltage_map, + .init_data = &pwm_regulator_init_dcdc[0], + }, +}; +struct platform_device pwm_regulator_device[1] = { + { + .name = "pwm-voltage-regulator", + .id = 0, + .dev = { + .platform_data = &pwm_regulator_info[0], + } + }, +}; + +static void pwm_regulator_init(void) +{ + pwm_regulator_info[0].pwm_gpio = iomux_mode_to_gpio(pwm_mode[REG_PWM]); + pwm_regulator_info[0].pwm_iomux_pwm = pwm_mode[REG_PWM]; + pwm_regulator_info[0].pwm_iomux_gpio = iomux_switch_gpio_mode(pwm_mode[REG_PWM]); +} +#endif + +int __sramdata pwm_iomux, pwm_do, pwm_dir, pwm_en; +#define grf_readl(offset) readl_relaxed(RK30_GRF_BASE + offset) +#define grf_writel(v, offset) do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0) + +#define GPIO0_D2_OFFSET 10 +void __sramfunc rk30_pwm_logic_suspend_voltage(void) +{ +#ifdef CONFIG_RK30_PWM_REGULATOR + #if 0 + /* pwm0: GPIO0_D2, pwm1: GPIO0_D3, pwm2: GPIO0_D4 */ + int off = GPIO0_D2_OFFSET + REG_PWM; + + sram_udelay(10000); + pwm_iomux = grf_readl(GRF_GPIO0D_IOMUX); + pwm_dir = grf_readl(GRF_GPIO0H_DIR); + pwm_do = grf_readl(GRF_GPIO0H_DO); + pwm__en = grf_readl(GRF_GPIO0H_EN); + + grf_writel((1<<(2 * off), GRF_GPIO0D_IOMUX); + grf_writel((1<<(16 + off))|(1<