aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-06-14 18:17:54 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-06-14 18:17:54 +0000
commitaf8ae399de33752a9bba274c7016404cc084fa2d (patch)
tree15f7585e204ebea56fa8a7dc324eed1202e306b4
parent92cb7d4cf32e3b2d6569e492965e1da097799dc8 (diff)
downloadupstream-af8ae399de33752a9bba274c7016404cc084fa2d.tar.gz
upstream-af8ae399de33752a9bba274c7016404cc084fa2d.tar.bz2
upstream-af8ae399de33752a9bba274c7016404cc084fa2d.zip
remove broken targets
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@45977 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/omap24xx/Makefile26
-rw-r--r--target/linux/omap24xx/base-files/etc/config/fstab13
-rw-r--r--target/linux/omap24xx/base-files/etc/config/network15
-rw-r--r--target/linux/omap24xx/base-files/etc/config/wireless20
-rw-r--r--target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image15
-rw-r--r--target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom30
-rwxr-xr-xtarget/linux/omap24xx/base-files/etc/init.d/watchdog17
-rw-r--r--target/linux/omap24xx/base-files/etc/inittab5
-rw-r--r--target/linux/omap24xx/base-files/etc/pointercal1
-rw-r--r--target/linux/omap24xx/base-files/lib/firmware/bc4fw.binbin2034 -> 0 bytes
-rw-r--r--target/linux/omap24xx/image/Makefile27
-rw-r--r--target/linux/omap24xx/modules.mk83
-rw-r--r--target/linux/omap24xx/patches-3.3/200-omap-platform.patch897
-rw-r--r--target/linux/omap24xx/patches-3.3/250-cbus.patch3463
-rw-r--r--target/linux/omap24xx/patches-3.3/251-cbus-tahvo-lock-fix.patch12
-rw-r--r--target/linux/omap24xx/patches-3.3/252-cbus-retu-tahvo-ack-fix.patch142
-rw-r--r--target/linux/omap24xx/patches-3.3/254-cbus-retu-tahvo-irq-mask-init-fix.patch24
-rw-r--r--target/linux/omap24xx/patches-3.3/300-cbus-platform.patch175
-rw-r--r--target/linux/omap24xx/patches-3.3/309-omapfb-circular-mutex-workaround.patch41
-rw-r--r--target/linux/omap24xx/patches-3.3/310-n810-lcd.patch368
-rw-r--r--target/linux/omap24xx/patches-3.3/311-omapfb-clock-fixes.patch30
-rw-r--r--target/linux/omap24xx/patches-3.3/312-no-hwmod-reset.patch28
-rw-r--r--target/linux/omap24xx/patches-3.3/315-n800-touchscreen-and-keypad-drivers.patch2791
-rw-r--r--target/linux/omap24xx/patches-3.3/320-nokia-various.patch194
-rw-r--r--target/linux/omap24xx/patches-3.3/330-n800-tsc2301-platform.patch212
-rw-r--r--target/linux/omap24xx/patches-3.3/350-n8x0-gpioswitch-input.patch98
-rw-r--r--target/linux/omap24xx/patches-3.3/400-bluetooth-hci_h4p.patch1946
-rw-r--r--target/linux/omap24xx/patches-3.3/410-hci-h4p-fixes.patch46
-rw-r--r--target/linux/omap24xx/patches-3.3/420-hci-h4p-interrupt-workaround.patch36
-rw-r--r--target/linux/omap24xx/patches-3.3/597-cbus-tahvo-usb-platform.patch34
-rw-r--r--target/linux/omap24xx/patches-3.3/710-evdev-events-without-grab.patch31
-rw-r--r--target/linux/omap24xx/patches-3.3/810-mmc-fixes.patch50
-rw-r--r--target/linux/omap24xx/patches-3.3/830-omap2-serial-fixes.patch23
-rw-r--r--target/linux/omap24xx/patches-3.3/850-musb-tusb-modular-fixes.patch135
-rw-r--r--target/linux/omap24xx/patches-3.3/900-n810-battery-management.patch1917
-rw-r--r--target/linux/omap24xx/patches-3.3/910-omap-fix-section-mismatch-warnings.patch116
-rw-r--r--target/linux/omap24xx/profiles/100-n810.mk31
-rw-r--r--target/linux/omap24xx/profiles/110-n810-gui.mk22
-rw-r--r--target/linux/orion/Makefile24
-rw-r--r--target/linux/orion/base-files/etc/hotplug.d/usb/10-usb54
-rw-r--r--target/linux/orion/base-files/etc/uci-defaults/10-network53
-rw-r--r--target/linux/orion/config-default188
-rw-r--r--target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h82
-rw-r--r--target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c445
-rw-r--r--target/linux/orion/generic/base-files/etc/uci-defaults/09_hardware54
-rw-r--r--target/linux/orion/generic/base-files/lib/upgrade/platform.sh38
-rw-r--r--target/linux/orion/generic/target.mk14
-rw-r--r--target/linux/orion/harddisk/config-default38
-rw-r--r--target/linux/orion/harddisk/target.mk14
-rw-r--r--target/linux/orion/image/Makefile12
-rw-r--r--target/linux/orion/image/generic.mk230
-rw-r--r--target/linux/orion/image/harddisk.mk57
-rw-r--r--target/linux/orion/patches/100-wrt350nv2_openwrt_partition_map.patch32
-rw-r--r--target/linux/orion/patches/101-wnr854t_partition_map.patch25
-rw-r--r--target/linux/orion/patches/200-dt2_board_support.patch26
-rw-r--r--target/linux/orion/patches/210-wn802t_support.patch78
-rw-r--r--target/linux/ppc40x/Makefile26
-rwxr-xr-xtarget/linux/ppc40x/base-files/lib/ppc40x.sh11
-rw-r--r--target/linux/ppc40x/base-files/lib/upgrade/platform.sh38
-rw-r--r--target/linux/ppc40x/config-3.18235
-rw-r--r--target/linux/ppc40x/image/Makefile72
-rw-r--r--target/linux/ppc40x/modules.mk41
-rw-r--r--target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch27
-rw-r--r--target/linux/ppc40x/patches-3.18/004-magicbox.patch446
-rw-r--r--target/linux/ppc40x/patches-3.18/005-openrb.patch447
-rw-r--r--target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch433
-rw-r--r--target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch55
-rw-r--r--target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch290
-rw-r--r--target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch110
-rw-r--r--target/linux/pxa/Makefile25
-rw-r--r--target/linux/pxa/config-3.10230
-rw-r--r--target/linux/pxa/config-3.3179
-rw-r--r--target/linux/pxa/image/Makefile43
-rw-r--r--target/linux/pxa/patches-3.10/001-gumstix_verdex_pro_arch_support.patch882
-rw-r--r--target/linux/pxa/patches-3.10/002-verdex_lcd_support.patch52
-rw-r--r--target/linux/pxa/patches-3.10/003-gumstix_h_verdex_pro_support.patch214
-rw-r--r--target/linux/pxa/patches-3.10/004-smsc911x_verdex_pro_support.patch108
-rw-r--r--target/linux/pxa/patches-3.10/005-verdex_pcmcia_support.patch209
-rw-r--r--target/linux/pxa/patches-3.10/a01-arm-debugll-printk.patch24
-rw-r--r--target/linux/pxa/patches-3.3/001-gumstix_verdex_pro_arch_support.patch882
-rw-r--r--target/linux/pxa/patches-3.3/002-verdex_lcd_support.patch52
-rw-r--r--target/linux/pxa/patches-3.3/003-gumstix_h_verdex_pro_support.patch214
-rw-r--r--target/linux/pxa/patches-3.3/004-smsc911x_verdex_pro_support.patch100
-rw-r--r--target/linux/pxa/patches-3.3/005-verdex_pcmcia_support.patch236
-rw-r--r--target/linux/pxa/patches-3.3/a01-arm-debugll-printk.patch24
-rw-r--r--target/linux/pxa/profiles/100-Default.mk17
-rw-r--r--target/linux/pxa/profiles/200-Gumstix.mk17
87 files changed, 0 insertions, 20317 deletions
diff --git a/target/linux/omap24xx/Makefile b/target/linux/omap24xx/Makefile
deleted file mode 100644
index 4570467d62..0000000000
--- a/target/linux/omap24xx/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2010-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=omap24xx
-BOARDNAME:=TI OMAP24xx
-MAINTAINER:=Michael Buesch <m@bues.ch>
-FEATURES:=targz squashfs jffs2_nand usb usbgadget display gpio audio broken
-CPU_TYPE:=arm1136j-s
-
-KERNEL_PATCHVER:=4.0
-
-define Target/Description
- TI OMAP-24xx
-endef
-
-KERNELNAME:=zImage
-
-include $(INCLUDE_DIR)/target.mk
-
-$(eval $(call BuildTarget))
diff --git a/target/linux/omap24xx/base-files/etc/config/fstab b/target/linux/omap24xx/base-files/etc/config/fstab
deleted file mode 100644
index 0910277b26..0000000000
--- a/target/linux/omap24xx/base-files/etc/config/fstab
+++ /dev/null
@@ -1,13 +0,0 @@
-config mount
- option target /maemo/initfs
- option device /dev/mtdblock3
- option fstype jffs2
- option options rw,noatime
- option enabled 0
-
-config mount
- option target /maemo/rootfs
- option device /dev/mtdblock4
- option fstype jffs2
- option options rw,noatime
- option enabled 0
diff --git a/target/linux/omap24xx/base-files/etc/config/network b/target/linux/omap24xx/base-files/etc/config/network
deleted file mode 100644
index 8207443f39..0000000000
--- a/target/linux/omap24xx/base-files/etc/config/network
+++ /dev/null
@@ -1,15 +0,0 @@
-config interface loopback
- option ifname lo
- option proto static
- option netmask 255.0.0.0
-
-config interface lan
- option proto dhcp
- option netmask 255.255.255.0
-
-config interface usb
- option ifname usb0
- option proto static
- option ipaddr 192.168.168.168
- option netmask 255.255.255.0
- option ip6addr fe80::810:1
diff --git a/target/linux/omap24xx/base-files/etc/config/wireless b/target/linux/omap24xx/base-files/etc/config/wireless
deleted file mode 100644
index b640ce6c26..0000000000
--- a/target/linux/omap24xx/base-files/etc/config/wireless
+++ /dev/null
@@ -1,20 +0,0 @@
-config wifi-device radio0
- option type mac80211
- option phy phy0
- option channel auto
- # TODO: CHANGE THE MAC-ADDRESS:
- option macaddr 00:11:22:33:44:55
- option hwmode 11g
-# option country DE
-
- # REMOVE THIS LINE TO ENABLE WIFI:
- option disabled 1
-
-config wifi-iface
- option device radio0
- option powersave 1
- option network lan
- option mode sta
- option ssid OpenWrt
-# option encryption psk2
-# option key "foobar"
diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image
deleted file mode 100644
index d03c9dee03..0000000000
--- a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-n810_cal_bme_pmm_extract() {
- [ -x /usr/bin/calvaria ] && {
- /usr/bin/calvaria -p -n bme -i last /dev/mtdblock1 >/lib/firmware/n810-cal-bme-pmm.fw ||\
- echo "CAL-BME extract: Failed to extract blob"
- }
-}
-
-[ "$FIRMWARE" = "n810-cal-bme-pmm.fw" ] && {
- [ -z "$(grep -e 'Nokia N810' /proc/cpuinfo)" ] || {
- [ -e /lib/firmware/n810-cal-bme-pmm.fw ] ||\
- n810_cal_bme_pmm_extract
- }
-}
diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom
deleted file mode 100644
index ca92f80bea..0000000000
--- a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-p54spi_eeprom_clean() {
- rm -f /tmp/wlan-iq-align /tmp/wlan-tx-gen2
-}
-
-p54spi_eeprom_die() {
- echo "$*"
- p54spi_eeprom_clean
- exit 1
-}
-
-p54spi_eeprom_extract() {
- [ -x /usr/bin/calvaria -a -x /usr/bin/cal2p54 ] && {
- /usr/bin/calvaria -p -n wlan-iq-align -i last /dev/mtdblock1 >/tmp/wlan-iq-align ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-iq-align"
- /usr/bin/calvaria -p -n wlan-tx-gen2 -i last /dev/mtdblock1 >/tmp/wlan-tx-gen2 ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-tx-gen2"
- /usr/bin/cal2p54 /tmp/wlan-tx-gen2 /tmp/wlan-iq-align >/lib/firmware/3826.eeprom ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to generate EEPROM"
- p54spi_eeprom_clean
- }
-}
-
-[ "$FIRMWARE" = "3826.eeprom" ] && {
- [ -z "$(grep -e 'Nokia N810' /proc/cpuinfo)" ] || {
- [ -e /lib/firmware/3826.eeprom ] ||\
- p54spi_eeprom_extract
- }
-}
diff --git a/target/linux/omap24xx/base-files/etc/init.d/watchdog b/target/linux/omap24xx/base-files/etc/init.d/watchdog
deleted file mode 100755
index 0d042c64ea..0000000000
--- a/target/linux/omap24xx/base-files/etc/init.d/watchdog
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2008-2010 OpenWrt.org
-
-START=25
-
-start() {
- [ -c /dev/watchdog -a -x /sbin/watchdog ] || {
- echo "WARNING: Watchdog not available. System will reboot soon!"
- return 1
- }
- /sbin/watchdog -T 63 -t 50 /dev/watchdog
- [ -x /usr/bin/schedtool ] && /usr/bin/schedtool -R -p 60 -n -20 $(pidof watchdog)
-}
-
-stop() {
- killall -q watchdog
-}
diff --git a/target/linux/omap24xx/base-files/etc/inittab b/target/linux/omap24xx/base-files/etc/inittab
deleted file mode 100644
index 1360dc9e28..0000000000
--- a/target/linux/omap24xx/base-files/etc/inittab
+++ /dev/null
@@ -1,5 +0,0 @@
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-tts/0::askfirst:/bin/ash --login
-ttyO2::askfirst:/bin/ash --login
-tty1::askfirst:/bin/ash --login
diff --git a/target/linux/omap24xx/base-files/etc/pointercal b/target/linux/omap24xx/base-files/etc/pointercal
deleted file mode 100644
index eba5ab6aa6..0000000000
--- a/target/linux/omap24xx/base-files/etc/pointercal
+++ /dev/null
@@ -1 +0,0 @@
-14706 -12 -3754952 36 -9898 35656000 65536
diff --git a/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin b/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin
deleted file mode 100644
index b7335db148..0000000000
--- a/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin
+++ /dev/null
Binary files differ
diff --git a/target/linux/omap24xx/image/Makefile b/target/linux/omap24xx/image/Makefile
deleted file mode 100644
index 7a3429fa6c..0000000000
--- a/target/linux/omap24xx/image/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-NAND_BLOCKSIZE=2048-128k
-
-define Image/BuildKernel
- $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
- chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-zImage
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1))
-endef
-
-define Image/Build
- $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-root.$(1)
- $(call Image/Build/$(1),$(1))
-endef
-
-
-$(eval $(call BuildImage))
diff --git a/target/linux/omap24xx/modules.mk b/target/linux/omap24xx/modules.mk
deleted file mode 100644
index 6a6829ddfc..0000000000
--- a/target/linux/omap24xx/modules.mk
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/sound-soc-omap
- TITLE:=OMAP SoC sound support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC
- FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap.ko
- AUTOLOAD:=$(call AutoLoad,60,snd-soc-omap)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-core
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-omap))
-
-
-define KernelPackage/sound-soc-omap-mcbsp
- TITLE:=OMAP SoC MCBSP support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC_MCBSP
- FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap-mcbsp.ko
- AUTOLOAD:=$(call AutoLoad,61,snd-soc-omap-mcbsp)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-omap-mcbsp))
-
-
-define KernelPackage/sound-soc-n810
- TITLE:=Nokia n810 SoC sound support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC_N810
- FILES:= \
- $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \
- $(LINUX_DIR)/sound/soc/omap/snd-soc-n810.ko
- AUTOLOAD:=$(call AutoLoad,65,snd-soc-tlv320aic3x snd-soc-n810)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap +kmod-sound-soc-omap-mcbsp
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-n810))
-
-
-define KernelPackage/n810bm
- SUBMENU:=$(OTHER_MENU)
- TITLE:=Nokia N810 battery management driver
- DEPENDS:=@TARGET_omap24xx
- KCONFIG:=CONFIG_N810BM
- FILES:=$(LINUX_DIR)/drivers/cbus/n810bm.ko
- AUTOLOAD:=$(call AutoLoad,01,n810bm)
-endef
-
-define KernelPackage/n810bm/description
- Nokia N810 battery management driver.
- Controls battery power management and battery charging.
-endef
-
-$(eval $(call KernelPackage,n810bm))
-
-
-define KernelPackage/usb-tahvo
- TITLE:=Support for Tahvo (Nokia n810) USB
- KCONFIG:= \
- CONFIG_TAHVO_USB \
- CONFIG_TAHVO_USB_HOST_BY_DEFAULT=n \
- CONFIG_USB_OHCI_HCD_OMAP1=y \
- CONFIG_USB_GADGET_DEBUG_FS=n
- DEPENDS:=@TARGET_omap24xx +kmod-usb-musb-tusb6010
- FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-tahvo.ko
- AUTOLOAD:=$(call AutoLoad,45,phy-tahvo)
- $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-tahvo/description
- Kernel support for Nokia n810 USB OHCI controller.
-endef
-
-$(eval $(call KernelPackage,usb-tahvo))
diff --git a/target/linux/omap24xx/patches-3.3/200-omap-platform.patch b/target/linux/omap24xx/patches-3.3/200-omap-platform.patch
deleted file mode 100644
index 6c215bdbed..0000000000
--- a/target/linux/omap24xx/patches-3.3/200-omap-platform.patch
+++ /dev/null
@@ -1,897 +0,0 @@
---- /dev/null
-+++ b/arch/arm/plat-omap/bootreason.c
-@@ -0,0 +1,79 @@
-+/*
-+ * linux/arch/arm/plat-omap/bootreason.c
-+ *
-+ * OMAP Bootreason passing
-+ *
-+ * Copyright (c) 2004 Nokia
-+ *
-+ * Written by David Weinehall <david.weinehall@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License as published by the
-+ * Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ *
-+ * You should have received a copy of the GNU General Public License along
-+ * with this program; if not, write to the Free Software Foundation, Inc.,
-+ * 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
-+#include <linux/proc_fs.h>
-+#include <linux/errno.h>
-+#include <plat/board.h>
-+
-+static char boot_reason[16];
-+
-+static int omap_bootreason_read_proc(char *page, char **start, off_t off,
-+ int count, int *eof, void *data)
-+{
-+ int len = 0;
-+
-+ len += sprintf(page + len, "%s\n", boot_reason);
-+
-+ *start = page + off;
-+
-+ if (len > off)
-+ len -= off;
-+ else
-+ len = 0;
-+
-+ return len < count ? len : count;
-+}
-+
-+static int __init bootreason_init(void)
-+{
-+ const struct omap_boot_reason_config *cfg;
-+ int reason_valid = 0;
-+
-+ cfg = omap_get_config(OMAP_TAG_BOOT_REASON, struct omap_boot_reason_config);
-+ if (cfg != NULL) {
-+ strncpy(boot_reason, cfg->reason_str, sizeof(cfg->reason_str));
-+ boot_reason[sizeof(cfg->reason_str)] = 0;
-+ reason_valid = 1;
-+ } else {
-+ /* Read the boot reason from the OMAP registers */
-+ }
-+
-+ if (!reason_valid)
-+ return -ENOENT;
-+
-+ printk(KERN_INFO "Bootup reason: %s\n", boot_reason);
-+
-+ if (!create_proc_read_entry("bootreason", S_IRUGO, NULL,
-+ omap_bootreason_read_proc, NULL))
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+late_initcall(bootreason_init);
---- a/arch/arm/plat-omap/common.c
-+++ b/arch/arm/plat-omap/common.c
-@@ -24,18 +24,90 @@
-
- #include <plat/omap-secure.h>
-
-+#include <asm/setup.h>
-+
-
- #define NO_LENGTH_CHECK 0xffffffff
-
- struct omap_board_config_kernel *omap_board_config __initdata;
- int omap_board_config_size;
-
-+unsigned char omap_bootloader_tag[1024];
-+int omap_bootloader_tag_len;
-+
-+/* used by omap-smp.c and board-4430sdp.c */
-+void __iomem *gic_cpu_base_addr;
-+
-+#ifdef CONFIG_OMAP_BOOT_TAG
-+
-+static int __init parse_tag_omap(const struct tag *tag)
-+{
-+ u32 size = tag->hdr.size - (sizeof(tag->hdr) >> 2);
-+
-+ size <<= 2;
-+ if (size > sizeof(omap_bootloader_tag))
-+ return -1;
-+
-+ memcpy(omap_bootloader_tag, tag->u.omap.data, size);
-+ omap_bootloader_tag_len = size;
-+
-+ return 0;
-+}
-+
-+__tagtable(ATAG_BOARD, parse_tag_omap);
-+
-+#endif
-+
- static const void *__init get_config(u16 tag, size_t len,
- int skip, size_t *len_out)
- {
- struct omap_board_config_kernel *kinfo = NULL;
- int i;
-
-+#ifdef CONFIG_OMAP_BOOT_TAG
-+ struct omap_board_config_entry *info = NULL;
-+
-+ if (omap_bootloader_tag_len > 4)
-+ info = (struct omap_board_config_entry *) omap_bootloader_tag;
-+ while (info != NULL) {
-+ u8 *next;
-+
-+ if (info->tag == tag) {
-+ if (skip == 0)
-+ break;
-+ skip--;
-+ }
-+
-+ if ((info->len & 0x03) != 0) {
-+ /* We bail out to avoid an alignment fault */
-+ printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
-+ info->len, info->tag);
-+ return NULL;
-+ }
-+ next = (u8 *) info + sizeof(*info) + info->len;
-+ if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
-+ info = NULL;
-+ else
-+ info = (struct omap_board_config_entry *) next;
-+ }
-+ if (info != NULL) {
-+ /* Check the length as a lame attempt to check for
-+ * binary inconsistency. */
-+ if (len != NO_LENGTH_CHECK) {
-+ /* Word-align len */
-+ if (len & 0x03)
-+ len = (len + 3) & ~0x03;
-+ if (info->len != len) {
-+ printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
-+ tag, len, info->len);
-+ return NULL;
-+ }
-+ }
-+ if (len_out != NULL)
-+ *len_out = info->len;
-+ return info->data;
-+ }
-+#endif
- /* Try to find the config from the board-specific structures
- * in the kernel. */
- for (i = 0; i < omap_board_config_size; i++) {
---- /dev/null
-+++ b/arch/arm/plat-omap/component-version.c
-@@ -0,0 +1,64 @@
-+/*
-+ * linux/arch/arm/plat-omap/component-version.c
-+ *
-+ * Copyright (C) 2005 Nokia Corporation
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/err.h>
-+#include <linux/proc_fs.h>
-+#include <plat/board.h>
-+
-+static int component_version_read_proc(char *page, char **start, off_t off,
-+ int count, int *eof, void *data)
-+{
-+ int len, i;
-+ const struct omap_version_config *ver;
-+ char *p;
-+
-+ i = 0;
-+ p = page;
-+ while ((ver = omap_get_nr_config(OMAP_TAG_VERSION_STR,
-+ struct omap_version_config, i)) != NULL) {
-+ p += sprintf(p, "%-12s%s\n", ver->component, ver->version);
-+ i++;
-+ }
-+
-+ len = (p - page) - off;
-+ if (len < 0)
-+ len = 0;
-+
-+ *eof = (len <= count) ? 1 : 0;
-+ *start = page + off;
-+
-+ return len;
-+}
-+
-+static int __init component_version_init(void)
-+{
-+ if (omap_get_config(OMAP_TAG_VERSION_STR, struct omap_version_config) == NULL)
-+ return -ENODEV;
-+ if (!create_proc_read_entry("component_version", S_IRUGO, NULL,
-+ component_version_read_proc, NULL))
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+static void __exit component_version_exit(void)
-+{
-+ remove_proc_entry("component_version", NULL);
-+}
-+
-+late_initcall(component_version_init);
-+module_exit(component_version_exit);
-+
-+MODULE_AUTHOR("Juha Yrjölä <juha.yrjola@nokia.com>");
-+MODULE_DESCRIPTION("Component version driver");
-+MODULE_LICENSE("GPL");
---- a/arch/arm/plat-omap/Kconfig
-+++ b/arch/arm/plat-omap/Kconfig
-@@ -84,6 +84,38 @@ config OMAP_RESET_CLOCKS
- probably do not want this option enabled until your
- device drivers work properly.
-
-+config OMAP_BOOT_TAG
-+ bool "OMAP bootloader information passing"
-+ depends on ARCH_OMAP
-+ default n
-+ help
-+ Say Y, if you have a bootloader which passes information
-+ about your board and its peripheral configuration.
-+
-+config OMAP_BOOT_REASON
-+ bool "Support for boot reason"
-+ depends on OMAP_BOOT_TAG
-+ default n
-+ help
-+ Say Y, if you want to have a procfs entry for reading the boot
-+ reason in user-space.
-+
-+config OMAP_COMPONENT_VERSION
-+ bool "Support for component version display"
-+ depends on OMAP_BOOT_TAG && PROC_FS
-+ default n
-+ help
-+ Say Y, if you want to have a procfs entry for reading component
-+ versions (supplied by the bootloader) in user-space.
-+
-+config OMAP_GPIO_SWITCH
-+ bool "GPIO switch support"
-+ help
-+ Say Y, if you want to have support for reporting of GPIO
-+ switches (e.g. cover switches) via sysfs. Your bootloader has
-+ to provide information about the switches to the kernel via the
-+ ATAG_BOARD mechanism if they're not defined by the board config.
-+
- config OMAP_MUX
- bool "OMAP multiplexing support"
- depends on ARCH_OMAP
---- a/arch/arm/plat-omap/Makefile
-+++ b/arch/arm/plat-omap/Makefile
-@@ -20,6 +20,9 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_device.
- obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
-
- obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
-+obj-$(CONFIG_OMAP_BOOT_REASON) += bootreason.o
-+obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o
-+obj-$(CONFIG_OMAP_GPIO_SWITCH) += gpio-switch.o
- obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
- obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
- i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
---- a/arch/arm/include/asm/setup.h
-+++ b/arch/arm/include/asm/setup.h
-@@ -136,6 +136,13 @@ struct tag_acorn {
- __u8 adfsdrives;
- };
-
-+/* TI OMAP specific information */
-+#define ATAG_BOARD 0x414f4d50
-+
-+struct tag_omap {
-+ u8 data[0];
-+};
-+
- /* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
- #define ATAG_MEMCLK 0x41000402
-
-@@ -162,6 +169,11 @@ struct tag {
- struct tag_acorn acorn;
-
- /*
-+ * OMAP specific
-+ */
-+ struct tag_omap omap;
-+
-+ /*
- * DC21285 specific
- */
- struct tag_memclk memclk;
---- /dev/null
-+++ b/arch/arm/plat-omap/gpio-switch.c
-@@ -0,0 +1,554 @@
-+/*
-+ * linux/arch/arm/plat-omap/gpio-switch.c
-+ *
-+ * Copyright (C) 2004-2006 Nokia Corporation
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>
-+ * and Paul Mundt <paul.mundt@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/sched.h>
-+#include <linux/init.h>
-+#include <linux/list.h>
-+#include <linux/irq.h>
-+#include <linux/interrupt.h>
-+#include <linux/module.h>
-+#include <linux/platform_device.h>
-+#include <linux/timer.h>
-+#include <linux/err.h>
-+#include <linux/slab.h>
-+#include <linux/gpio.h>
-+#include <plat/hardware.h>
-+#include <plat/irqs.h>
-+#include <plat/mux.h>
-+#include <plat/board.h>
-+#include <plat/gpio-switch.h>
-+
-+struct gpio_switch {
-+ char name[14];
-+ u16 gpio;
-+ unsigned flags:4;
-+ unsigned type:4;
-+ unsigned state:1;
-+ unsigned both_edges:1;
-+
-+ u16 debounce_rising;
-+ u16 debounce_falling;
-+
-+ void (* notify)(void *data, int state);
-+ void *notify_data;
-+
-+ struct work_struct work;
-+ struct timer_list timer;
-+ struct platform_device pdev;
-+
-+ struct list_head node;
-+};
-+
-+static LIST_HEAD(gpio_switches);
-+static struct platform_device *gpio_sw_platform_dev;
-+static struct platform_driver gpio_sw_driver;
-+
-+static const struct omap_gpio_switch *board_gpio_sw_table;
-+static int board_gpio_sw_count;
-+
-+static const char *cover_str[2] = { "open", "closed" };
-+static const char *connection_str[2] = { "disconnected", "connected" };
-+static const char *activity_str[2] = { "inactive", "active" };
-+
-+/*
-+ * GPIO switch state default debounce delay in ms
-+ */
-+#define OMAP_GPIO_SW_DEFAULT_DEBOUNCE 10
-+
-+static const char **get_sw_str(struct gpio_switch *sw)
-+{
-+ switch (sw->type) {
-+ case OMAP_GPIO_SWITCH_TYPE_COVER:
-+ return cover_str;
-+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
-+ return connection_str;
-+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
-+ return activity_str;
-+ default:
-+ BUG();
-+ return NULL;
-+ }
-+}
-+
-+static const char *get_sw_type(struct gpio_switch *sw)
-+{
-+ switch (sw->type) {
-+ case OMAP_GPIO_SWITCH_TYPE_COVER:
-+ return "cover";
-+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
-+ return "connection";
-+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
-+ return "activity";
-+ default:
-+ BUG();
-+ return NULL;
-+ }
-+}
-+
-+static void print_sw_state(struct gpio_switch *sw, int state)
-+{
-+ const char **str;
-+
-+ str = get_sw_str(sw);
-+ if (str != NULL)
-+ printk(KERN_INFO "%s (GPIO %d) is now %s\n", sw->name, sw->gpio, str[state]);
-+}
-+
-+static int gpio_sw_get_state(struct gpio_switch *sw)
-+{
-+ int state;
-+
-+ state = gpio_get_value(sw->gpio);
-+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
-+ state = !state;
-+
-+ return state;
-+}
-+
-+static ssize_t gpio_sw_state_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf,
-+ size_t count)
-+{
-+ struct gpio_switch *sw = dev_get_drvdata(dev);
-+ const char **str;
-+ char state[16];
-+ int enable;
-+
-+ if (!(sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT))
-+ return -EPERM;
-+
-+ if (sscanf(buf, "%15s", state) != 1)
-+ return -EINVAL;
-+
-+ str = get_sw_str(sw);
-+ if (strcmp(state, str[0]) == 0)
-+ sw->state = enable = 0;
-+ else if (strcmp(state, str[1]) == 0)
-+ sw->state = enable = 1;
-+ else
-+ return -EINVAL;
-+
-+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
-+ enable = !enable;
-+ gpio_set_value(sw->gpio, enable);
-+
-+ return count;
-+}
-+
-+static ssize_t gpio_sw_state_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct gpio_switch *sw = dev_get_drvdata(dev);
-+ const char **str;
-+
-+ str = get_sw_str(sw);
-+ return sprintf(buf, "%s\n", str[sw->state]);
-+}
-+
-+static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, gpio_sw_state_show,
-+ gpio_sw_state_store);
-+
-+static ssize_t gpio_sw_type_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct gpio_switch *sw = dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%s\n", get_sw_type(sw));
-+}
-+
-+static DEVICE_ATTR(type, S_IRUGO, gpio_sw_type_show, NULL);
-+
-+static ssize_t gpio_sw_direction_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct gpio_switch *sw = dev_get_drvdata(dev);
-+ int is_output;
-+
-+ is_output = sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT;
-+ return sprintf(buf, "%s\n", is_output ? "output" : "input");
-+}
-+
-+static DEVICE_ATTR(direction, S_IRUGO, gpio_sw_direction_show, NULL);
-+
-+
-+static irqreturn_t gpio_sw_irq_handler(int irq, void *arg)
-+{
-+ struct gpio_switch *sw = arg;
-+ unsigned long timeout;
-+ int state;
-+
-+ if (!sw->both_edges) {
-+ if (gpio_get_value(sw->gpio))
-+ irq_set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQ_TYPE_EDGE_FALLING);
-+ else
-+ irq_set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQ_TYPE_EDGE_RISING);
-+ }
-+
-+ state = gpio_sw_get_state(sw);
-+ if (sw->state == state)
-+ return IRQ_HANDLED;
-+
-+ if (state)
-+ timeout = sw->debounce_rising;
-+ else
-+ timeout = sw->debounce_falling;
-+ if (!timeout)
-+ schedule_work(&sw->work);
-+ else
-+ mod_timer(&sw->timer, jiffies + msecs_to_jiffies(timeout));
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static void gpio_sw_timer(unsigned long arg)
-+{
-+ struct gpio_switch *sw = (struct gpio_switch *) arg;
-+
-+ schedule_work(&sw->work);
-+}
-+
-+static void gpio_sw_handler(struct work_struct *work)
-+{
-+ struct gpio_switch *sw = container_of(work, struct gpio_switch, work);
-+ int state;
-+
-+ state = gpio_sw_get_state(sw);
-+ if (sw->state == state)
-+ return;
-+
-+ sw->state = state;
-+ if (sw->notify != NULL)
-+ sw->notify(sw->notify_data, state);
-+ sysfs_notify(&sw->pdev.dev.kobj, NULL, "state");
-+ print_sw_state(sw, state);
-+}
-+
-+static int __init can_do_both_edges(struct gpio_switch *sw)
-+{
-+ if (!cpu_class_is_omap1())
-+ return 1;
-+ if (OMAP_GPIO_IS_MPUIO(sw->gpio))
-+ return 0;
-+ else
-+ return 1;
-+}
-+
-+static void gpio_sw_release(struct device *dev)
-+{
-+}
-+
-+static int __init new_switch(struct gpio_switch *sw)
-+{
-+ int r, direction, trigger;
-+
-+ switch (sw->type) {
-+ case OMAP_GPIO_SWITCH_TYPE_COVER:
-+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
-+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
-+ break;
-+ default:
-+ printk(KERN_ERR "invalid GPIO switch type: %d\n", sw->type);
-+ return -EINVAL;
-+ }
-+
-+ sw->pdev.name = sw->name;
-+ sw->pdev.id = -1;
-+
-+ sw->pdev.dev.parent = &gpio_sw_platform_dev->dev;
-+ sw->pdev.dev.driver = &gpio_sw_driver.driver;
-+ sw->pdev.dev.release = gpio_sw_release;
-+
-+ r = platform_device_register(&sw->pdev);
-+ if (r) {
-+ printk(KERN_ERR "gpio-switch: platform device registration "
-+ "failed for %s", sw->name);
-+ return r;
-+ }
-+ dev_set_drvdata(&sw->pdev.dev, sw);
-+
-+ r = gpio_request(sw->gpio, "gpio-switch");
-+ if (r < 0) {
-+ platform_device_unregister(&sw->pdev);
-+ return r;
-+ }
-+
-+ /* input: 1, output: 0 */
-+ direction = !(sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT);
-+ if (direction)
-+ gpio_direction_input(sw->gpio);
-+ else
-+ gpio_direction_output(sw->gpio, 0);
-+
-+ sw->state = gpio_sw_get_state(sw);
-+
-+ r = 0;
-+ r |= device_create_file(&sw->pdev.dev, &dev_attr_state);
-+ r |= device_create_file(&sw->pdev.dev, &dev_attr_type);
-+ r |= device_create_file(&sw->pdev.dev, &dev_attr_direction);
-+ if (r)
-+ printk(KERN_ERR "gpio-switch: attribute file creation "
-+ "failed for %s\n", sw->name);
-+
-+ if (!direction)
-+ return 0;
-+
-+ if (can_do_both_edges(sw)) {
-+ trigger = IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING;
-+ sw->both_edges = 1;
-+ } else {
-+ if (gpio_get_value(sw->gpio))
-+ trigger = IRQF_TRIGGER_FALLING;
-+ else
-+ trigger = IRQF_TRIGGER_RISING;
-+ }
-+ r = request_irq(OMAP_GPIO_IRQ(sw->gpio), gpio_sw_irq_handler,
-+ IRQF_SHARED | trigger, sw->name, sw);
-+ if (r < 0) {
-+ printk(KERN_ERR "gpio-switch: request_irq() failed "
-+ "for GPIO %d\n", sw->gpio);
-+ platform_device_unregister(&sw->pdev);
-+ gpio_free(sw->gpio);
-+ return r;
-+ }
-+
-+ INIT_WORK(&sw->work, gpio_sw_handler);
-+ init_timer(&sw->timer);
-+
-+ sw->timer.function = gpio_sw_timer;
-+ sw->timer.data = (unsigned long)sw;
-+
-+ list_add(&sw->node, &gpio_switches);
-+
-+ return 0;
-+}
-+
-+static int __init add_atag_switches(void)
-+{
-+ const struct omap_gpio_switch_config *cfg;
-+ struct gpio_switch *sw;
-+ int i, r;
-+
-+ for (i = 0; ; i++) {
-+ cfg = omap_get_nr_config(OMAP_TAG_GPIO_SWITCH,
-+ struct omap_gpio_switch_config, i);
-+ if (cfg == NULL)
-+ break;
-+ sw = kzalloc(sizeof(*sw), GFP_KERNEL);
-+ if (sw == NULL) {
-+ printk(KERN_ERR "gpio-switch: kmalloc failed\n");
-+ return -ENOMEM;
-+ }
-+ strncpy(sw->name, cfg->name, sizeof(cfg->name));
-+ sw->gpio = cfg->gpio;
-+ sw->flags = cfg->flags;
-+ sw->type = cfg->type;
-+ sw->debounce_rising = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
-+ sw->debounce_falling = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
-+ if ((r = new_switch(sw)) < 0) {
-+ kfree(sw);
-+ return r;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static struct gpio_switch * __init find_switch(int gpio, const char *name)
-+{
-+ struct gpio_switch *sw;
-+
-+ list_for_each_entry(sw, &gpio_switches, node) {
-+ if ((gpio < 0 || sw->gpio != gpio) &&
-+ (name == NULL || strcmp(sw->name, name) != 0))
-+ continue;
-+
-+ if (gpio < 0 || name == NULL)
-+ goto no_check;
-+
-+ if (strcmp(sw->name, name) != 0)
-+ printk("gpio-switch: name mismatch for %d (%s, %s)\n",
-+ gpio, name, sw->name);
-+ else if (sw->gpio != gpio)
-+ printk("gpio-switch: GPIO mismatch for %s (%d, %d)\n",
-+ name, gpio, sw->gpio);
-+no_check:
-+ return sw;
-+ }
-+ return NULL;
-+}
-+
-+static int __init add_board_switches(void)
-+{
-+ int i;
-+
-+ for (i = 0; i < board_gpio_sw_count; i++) {
-+ const struct omap_gpio_switch *cfg;
-+ struct gpio_switch *sw;
-+ int r;
-+
-+ cfg = board_gpio_sw_table + i;
-+ if (strlen(cfg->name) > sizeof(sw->name) - 1)
-+ return -EINVAL;
-+ /* Check whether we only update an existing switch
-+ * or add a new switch. */
-+ sw = find_switch(cfg->gpio, cfg->name);
-+ if (sw != NULL) {
-+ sw->debounce_rising = cfg->debounce_rising;
-+ sw->debounce_falling = cfg->debounce_falling;
-+ sw->notify = cfg->notify;
-+ sw->notify_data = cfg->notify_data;
-+ continue;
-+ } else {
-+ if (cfg->gpio < 0 || cfg->name == NULL) {
-+ printk("gpio-switch: required switch not "
-+ "found (%d, %s)\n", cfg->gpio,
-+ cfg->name);
-+ continue;
-+ }
-+ }
-+ sw = kzalloc(sizeof(*sw), GFP_KERNEL);
-+ if (sw == NULL) {
-+ printk(KERN_ERR "gpio-switch: kmalloc failed\n");
-+ return -ENOMEM;
-+ }
-+ strlcpy(sw->name, cfg->name, sizeof(sw->name));
-+ sw->gpio = cfg->gpio;
-+ sw->flags = cfg->flags;
-+ sw->type = cfg->type;
-+ sw->debounce_rising = cfg->debounce_rising;
-+ sw->debounce_falling = cfg->debounce_falling;
-+ sw->notify = cfg->notify;
-+ sw->notify_data = cfg->notify_data;
-+ if ((r = new_switch(sw)) < 0) {
-+ kfree(sw);
-+ return r;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static void gpio_sw_cleanup(void)
-+{
-+ struct gpio_switch *sw = NULL, *old = NULL;
-+
-+ list_for_each_entry(sw, &gpio_switches, node) {
-+ if (old != NULL)
-+ kfree(old);
-+ flush_scheduled_work();
-+ del_timer_sync(&sw->timer);
-+
-+ free_irq(OMAP_GPIO_IRQ(sw->gpio), sw);
-+
-+ device_remove_file(&sw->pdev.dev, &dev_attr_state);
-+ device_remove_file(&sw->pdev.dev, &dev_attr_type);
-+ device_remove_file(&sw->pdev.dev, &dev_attr_direction);
-+
-+ platform_device_unregister(&sw->pdev);
-+ gpio_free(sw->gpio);
-+ old = sw;
-+ }
-+ kfree(old);
-+}
-+
-+static void __init report_initial_state(void)
-+{
-+ struct gpio_switch *sw;
-+
-+ list_for_each_entry(sw, &gpio_switches, node) {
-+ int state;
-+
-+ state = gpio_get_value(sw->gpio);
-+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
-+ state = !state;
-+ if (sw->notify != NULL)
-+ sw->notify(sw->notify_data, state);
-+ print_sw_state(sw, state);
-+ }
-+}
-+
-+static int gpio_sw_remove(struct platform_device *dev)
-+{
-+ return 0;
-+}
-+
-+static struct platform_driver gpio_sw_driver = {
-+ .remove = gpio_sw_remove,
-+ .driver = {
-+ .name = "gpio-switch",
-+ },
-+};
-+
-+void __init omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
-+ int count)
-+{
-+ BUG_ON(board_gpio_sw_table != NULL);
-+
-+ board_gpio_sw_table = tbl;
-+ board_gpio_sw_count = count;
-+}
-+
-+static int __init gpio_sw_init(void)
-+{
-+ int r;
-+
-+ printk(KERN_INFO "OMAP GPIO switch handler initializing\n");
-+
-+ r = platform_driver_register(&gpio_sw_driver);
-+ if (r)
-+ return r;
-+
-+ gpio_sw_platform_dev = platform_device_register_simple("gpio-switch",
-+ -1, NULL, 0);
-+ if (IS_ERR(gpio_sw_platform_dev)) {
-+ r = PTR_ERR(gpio_sw_platform_dev);
-+ goto err1;
-+ }
-+
-+ r = add_atag_switches();
-+ if (r < 0)
-+ goto err2;
-+
-+ r = add_board_switches();
-+ if (r < 0)
-+ goto err2;
-+
-+ report_initial_state();
-+
-+ return 0;
-+err2:
-+ gpio_sw_cleanup();
-+ platform_device_unregister(gpio_sw_platform_dev);
-+err1:
-+ platform_driver_unregister(&gpio_sw_driver);
-+ return r;
-+}
-+
-+static void __exit gpio_sw_exit(void)
-+{
-+ gpio_sw_cleanup();
-+ platform_device_unregister(gpio_sw_platform_dev);
-+ platform_driver_unregister(&gpio_sw_driver);
-+}
-+
-+#ifndef MODULE
-+late_initcall(gpio_sw_init);
-+#else
-+module_init(gpio_sw_init);
-+#endif
-+module_exit(gpio_sw_exit);
-+
-+MODULE_AUTHOR("Juha Yrjölä <juha.yrjola@nokia.com>, Paul Mundt <paul.mundt@nokia.com");
-+MODULE_DESCRIPTION("GPIO switch driver");
-+MODULE_LICENSE("GPL");
---- a/arch/arm/plat-omap/include/plat/board.h
-+++ b/arch/arm/plat-omap/include/plat/board.h
-@@ -151,6 +151,14 @@ struct omap_board_config_kernel {
- const void *data;
- };
-
-+struct omap_gpio_switch_config {
-+ char name[12];
-+ u16 gpio;
-+ int flags:4;
-+ int type:4;
-+ int key_code:24; /* Linux key code */
-+};
-+
- extern const void *__init __omap_get_config(u16 tag, size_t len, int nr);
-
- #define omap_get_config(tag, type) \
diff --git a/target/linux/omap24xx/patches-3.3/250-cbus.patch b/target/linux/omap24xx/patches-3.3/250-cbus.patch
deleted file mode 100644
index b152a00b5b..0000000000
--- a/target/linux/omap24xx/patches-3.3/250-cbus.patch
+++ /dev/null
@@ -1,3463 +0,0 @@
---- /dev/null
-+++ b/drivers/cbus/cbus.c
-@@ -0,0 +1,335 @@
-+/*
-+ * drivers/cbus/cbus.c
-+ *
-+ * Support functions for CBUS serial protocol
-+ *
-+ * Copyright (C) 2004-2010 Nokia Corporation
-+ * Contact: Felipe Balbi <felipe.balbi@nokia.com>
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
-+ * David Weinehall <david.weinehall@nokia.com>, and
-+ * Mikko Ylinen <mikko.k.ylinen@nokia.com>
-+ *
-+ * Several updates and cleanups by Felipe Balbi <felipe.balbi@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/device.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/export.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+#include <linux/spinlock.h>
-+#include <linux/gpio.h>
-+#include <linux/platform_device.h>
-+#include <linux/platform_data/cbus.h>
-+
-+#include "cbus.h"
-+
-+#define CBUS_XFER_READ 1
-+#define CBUS_XFER_WRITE 0
-+
-+struct cbus_host {
-+ /* host lock */
-+ spinlock_t lock;
-+
-+ struct device *dev;
-+
-+ int clk_gpio;
-+ int dat_gpio;
-+ int sel_gpio;
-+};
-+
-+/**
-+ * cbus_send_bit - sends one bit over the bus
-+ * @host: the host we're using
-+ * @bit: one bit of information to send
-+ * @input: whether to set data pin as input after sending
-+ */
-+static int cbus_send_bit(struct cbus_host *host, unsigned bit,
-+ unsigned input)
-+{
-+ int ret = 0;
-+
-+ gpio_set_value(host->dat_gpio, bit ? 1 : 0);
-+ gpio_set_value(host->clk_gpio, 1);
-+
-+ /* The data bit is read on the rising edge of CLK */
-+ if (input)
-+ ret = gpio_direction_input(host->dat_gpio);
-+
-+ gpio_set_value(host->clk_gpio, 0);
-+
-+ return ret;
-+}
-+
-+/**
-+ * cbus_send_data - sends @len amount of data over the bus
-+ * @host: the host we're using
-+ * @data: the data to send
-+ * @len: size of the transfer
-+ * @input: whether to set data pin as input after sending
-+ */
-+static int cbus_send_data(struct cbus_host *host, unsigned data, unsigned len,
-+ unsigned input)
-+{
-+ int ret = 0;
-+ int i;
-+
-+ for (i = len; i > 0; i--) {
-+ ret = cbus_send_bit(host, data & (1 << (i - 1)),
-+ input && (i == 1));
-+ if (ret < 0)
-+ goto out;
-+ }
-+
-+out:
-+ return ret;
-+}
-+
-+/**
-+ * cbus_receive_bit - receives one bit from the bus
-+ * @host: the host we're using
-+ */
-+static int cbus_receive_bit(struct cbus_host *host)
-+{
-+ int ret;
-+
-+ gpio_set_value(host->clk_gpio, 1);
-+ ret = gpio_get_value(host->dat_gpio);
-+ if (ret < 0)
-+ goto out;
-+ gpio_set_value(host->clk_gpio, 0);
-+
-+out:
-+ return ret;
-+}
-+
-+/**
-+ * cbus_receive_data - receives @len data from the bus
-+ * @host: the host we're using
-+ * @len: the length of data to receive
-+ */
-+static int cbus_receive_data(struct cbus_host *host, unsigned len)
-+{
-+ int ret = 0;
-+ int i;
-+
-+ for (i = 16; i > 0; i--) {
-+ int bit = cbus_receive_bit(host);
-+
-+ if (bit < 0)
-+ goto out;
-+
-+ if (bit)
-+ ret |= 1 << (i - 1);
-+ }
-+
-+out:
-+ return ret;
-+}
-+
-+/**
-+ * cbus_transfer - transfers data over the bus
-+ * @host: the host we're using
-+ * @rw: read/write flag
-+ * @dev: device address
-+ * @reg: register address
-+ * @data: if @rw == 0 data to send otherwise 0
-+ */
-+static int cbus_transfer(struct cbus_host *host, unsigned rw, unsigned dev,
-+ unsigned reg, unsigned data)
-+{
-+ unsigned long flags;
-+ int input = 0;
-+ int ret = 0;
-+
-+ /* We don't want interrupts disturbing our transfer */
-+ spin_lock_irqsave(&host->lock, flags);
-+
-+ /* Reset state and start of transfer, SEL stays down during transfer */
-+ gpio_set_value(host->sel_gpio, 0);
-+
-+ /* Set the DAT pin to output */
-+ gpio_direction_output(host->dat_gpio, 1);
-+
-+ /* Send the device address */
-+ ret = cbus_send_data(host, dev, 3, 0);
-+ if (ret < 0) {
-+ dev_dbg(host->dev, "failed sending device addr\n");
-+ goto out;
-+ }
-+
-+ /* Send the rw flag */
-+ ret = cbus_send_bit(host, rw, 0);
-+ if (ret < 0) {
-+ dev_dbg(host->dev, "failed sending read/write flag\n");
-+ goto out;
-+ }
-+
-+ /* Send the register address */
-+ if (rw)
-+ input = true;
-+
-+ ret = cbus_send_data(host, reg, 5, input);
-+ if (ret < 0) {
-+ dev_dbg(host->dev, "failed sending register addr\n");
-+ goto out;
-+ }
-+
-+ if (!rw) {
-+ ret = cbus_send_data(host, data, 16, 0);
-+ if (ret < 0) {
-+ dev_dbg(host->dev, "failed sending data\n");
-+ goto out;
-+ }
-+ } else {
-+ gpio_set_value(host->clk_gpio, 1);
-+
-+ ret = cbus_receive_data(host, 16);
-+ if (ret < 0) {
-+ dev_dbg(host->dev, "failed receiving data\n");
-+ goto out;
-+ }
-+ }
-+
-+ /* Indicate end of transfer, SEL goes up until next transfer */
-+ gpio_set_value(host->sel_gpio, 1);
-+ gpio_set_value(host->clk_gpio, 1);
-+ gpio_set_value(host->clk_gpio, 0);
-+
-+out:
-+ spin_unlock_irqrestore(&host->lock, flags);
-+
-+ return ret;
-+}
-+
-+/**
-+ * cbus_read_reg - reads a given register from the device
-+ * @child: the child device
-+ * @dev: device address
-+ * @reg: register address
-+ */
-+int cbus_read_reg(struct device *child, unsigned dev, unsigned reg)
-+{
-+ struct cbus_host *host = dev_get_drvdata(child->parent);
-+
-+ return cbus_transfer(host, CBUS_XFER_READ, dev, reg, 0);
-+}
-+EXPORT_SYMBOL(cbus_read_reg);
-+
-+/**
-+ * cbus_write_reg - writes to a given register of the device
-+ * @child: the child device
-+ * @dev: device address
-+ * @reg: register address
-+ * @val: data to be written to @reg
-+ */
-+int cbus_write_reg(struct device *child, unsigned dev, unsigned reg,
-+ unsigned val)
-+{
-+ struct cbus_host *host = dev_get_drvdata(child->parent);
-+
-+ return cbus_transfer(host, CBUS_XFER_WRITE, dev, reg, val);
-+}
-+EXPORT_SYMBOL(cbus_write_reg);
-+
-+static int __init cbus_bus_probe(struct platform_device *pdev)
-+{
-+ struct cbus_host *chost;
-+ struct cbus_host_platform_data *pdata = pdev->dev.platform_data;
-+ int ret;
-+
-+ chost = kzalloc(sizeof(*chost), GFP_KERNEL);
-+ if (chost == NULL)
-+ return -ENOMEM;
-+
-+ spin_lock_init(&chost->lock);
-+
-+ chost->clk_gpio = pdata->clk_gpio;
-+ chost->dat_gpio = pdata->dat_gpio;
-+ chost->sel_gpio = pdata->sel_gpio;
-+ chost->dev = &pdev->dev;
-+
-+ ret = gpio_request(chost->clk_gpio, "CBUS clk");
-+ if (ret < 0)
-+ goto exit1;
-+
-+ ret = gpio_request(chost->dat_gpio, "CBUS data");
-+ if (ret < 0)
-+ goto exit2;
-+
-+ ret = gpio_request(chost->sel_gpio, "CBUS sel");
-+ if (ret < 0)
-+ goto exit3;
-+
-+ gpio_direction_output(chost->clk_gpio, 0);
-+ gpio_direction_input(chost->dat_gpio);
-+ gpio_direction_output(chost->sel_gpio, 1);
-+
-+ gpio_set_value(chost->clk_gpio, 1);
-+ gpio_set_value(chost->clk_gpio, 0);
-+
-+ platform_set_drvdata(pdev, chost);
-+
-+ return 0;
-+exit3:
-+ gpio_free(chost->dat_gpio);
-+exit2:
-+ gpio_free(chost->clk_gpio);
-+exit1:
-+ kfree(chost);
-+
-+ return ret;
-+}
-+
-+static void __exit cbus_bus_remove(struct platform_device *pdev)
-+{
-+ struct cbus_host *chost = platform_get_drvdata(pdev);
-+
-+ gpio_free(chost->sel_gpio);
-+ gpio_free(chost->dat_gpio);
-+ gpio_free(chost->clk_gpio);
-+
-+ kfree(chost);
-+}
-+
-+static struct platform_driver cbus_driver = {
-+ .remove = __exit_p(cbus_bus_remove),
-+ .driver = {
-+ .name = "cbus",
-+ },
-+};
-+
-+static int __init cbus_bus_init(void)
-+{
-+ return platform_driver_probe(&cbus_driver, cbus_bus_probe);
-+}
-+subsys_initcall(cbus_bus_init);
-+
-+static void __exit cbus_bus_exit(void)
-+{
-+ platform_driver_unregister(&cbus_driver);
-+}
-+module_exit(cbus_bus_exit);
-+
-+MODULE_DESCRIPTION("CBUS serial protocol");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Juha Yrjölä");
-+MODULE_AUTHOR("David Weinehall");
-+MODULE_AUTHOR("Mikko Ylinen");
-+MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
-+
---- /dev/null
-+++ b/drivers/cbus/cbus.h
-@@ -0,0 +1,30 @@
-+/*
-+ * drivers/cbus/cbus.h
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
-+ * David Weinehall <david.weinehall@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef __DRIVERS_CBUS_CBUS_H
-+#define __DRIVERS_CBUS_CBUS_H
-+
-+extern int cbus_read_reg(struct device *, unsigned dev, unsigned reg);
-+extern int cbus_write_reg(struct device *, unsigned dev, unsigned reg,
-+ unsigned val);
-+
-+#endif /* __DRIVERS_CBUS_CBUS_H */
---- /dev/null
-+++ b/drivers/cbus/Kconfig
-@@ -0,0 +1,86 @@
-+#
-+# CBUS device configuration
-+#
-+
-+menu "CBUS support"
-+
-+config CBUS
-+ bool "CBUS support on OMAP"
-+ ---help---
-+ CBUS is a proprietary serial protocol by Nokia. It is mainly
-+ used for accessing Energy Management auxiliary chips.
-+
-+ If you want CBUS support, you should say Y here.
-+
-+config CBUS_TAHVO
-+ depends on CBUS
-+ bool "Support for Tahvo"
-+ ---help---
-+ Tahvo is a mixed signal ASIC with some system features
-+
-+ If you want Tahvo support, you should say Y here.
-+
-+if CBUS_TAHVO
-+
-+config CBUS_TAHVO_USB
-+ depends on USB
-+ depends on ARCH_OMAP
-+ select USB_OTG_UTILS
-+ tristate "Support for Tahvo USB transceiver"
-+ ---help---
-+ If you want Tahvo support for USB transceiver, say Y or M here.
-+
-+config CBUS_TAHVO_USB_HOST_BY_DEFAULT
-+ depends on CBUS_TAHVO_USB && USB_OTG
-+ boolean "Device in USB host mode by default"
-+ ---help---
-+ Say Y here, if you want the device to enter USB host mode
-+ by default on bootup.
-+
-+endif # CBUS_TAHVO
-+
-+config CBUS_RETU
-+ depends on CBUS
-+ bool "Support for Retu"
-+ ---help---
-+ Retu is a mixed signal ASIC with some system features
-+
-+ If you want Retu support, you should say Y here.
-+
-+if CBUS_RETU
-+
-+config CBUS_RETU_POWERBUTTON
-+ depends on INPUT
-+ bool "Support for Retu power button"
-+ ---help---
-+ The power button on Nokia 770 is connected to the Retu ASIC.
-+
-+ If you want support for the Retu power button, you should say Y here.
-+
-+config CBUS_RETU_RTC
-+ depends on RTC_CLASS
-+ depends on ARCH_OMAP
-+ tristate "Support for Retu pseudo-RTC"
-+ ---help---
-+ Say Y here if you want support for the device that alleges to be an
-+ RTC in Retu. This will expose a sysfs interface for it.
-+
-+config CBUS_RETU_WDT
-+ depends on SYSFS && WATCHDOG
-+ depends on ARCH_OMAP
-+ tristate "Support for Retu watchdog timer"
-+ ---help---
-+ Say Y here if you want support for the watchdog in Retu. This will
-+ expose a sysfs interface to grok it.
-+
-+config CBUS_RETU_HEADSET
-+ depends on SYSFS
-+ tristate "Support for headset detection with Retu/Vilma"
-+ ---help---
-+ Say Y here if you want support detecting a headset that's connected
-+ to Retu/Vilma. Detection state and events are exposed through
-+ sysfs.
-+
-+endif # CBUS_RETU
-+
-+endmenu
---- /dev/null
-+++ b/drivers/cbus/Makefile
-@@ -0,0 +1,13 @@
-+#
-+# Makefile for CBUS.
-+#
-+
-+obj-$(CONFIG_CBUS) += cbus.o
-+obj-$(CONFIG_CBUS_TAHVO) += tahvo.o
-+obj-$(CONFIG_CBUS_RETU) += retu.o
-+obj-$(CONFIG_CBUS_TAHVO_USB) += tahvo-usb.o
-+
-+obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += retu-pwrbutton.o
-+obj-$(CONFIG_CBUS_RETU_RTC) += retu-rtc.o
-+obj-$(CONFIG_CBUS_RETU_WDT) += retu-wdt.o
-+obj-$(CONFIG_CBUS_RETU_HEADSET) += retu-headset.o
---- /dev/null
-+++ b/drivers/cbus/retu.c
-@@ -0,0 +1,549 @@
-+/**
-+ * drivers/cbus/retu.c
-+ *
-+ * Support functions for Retu ASIC
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
-+ * David Weinehall <david.weinehall@nokia.com>, and
-+ * Mikko Ylinen <mikko.k.ylinen@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+
-+#include <linux/slab.h>
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/device.h>
-+#include <linux/mutex.h>
-+#include <linux/irq.h>
-+#include <linux/interrupt.h>
-+#include <linux/platform_device.h>
-+#include <linux/platform_data/cbus.h>
-+
-+#include <asm/bitops.h>
-+
-+#include "cbus.h"
-+#include "retu.h"
-+
-+struct retu {
-+ /* Device lock */
-+ struct mutex mutex;
-+ struct device *dev;
-+
-+ int devid;
-+
-+ int irq_base;
-+ int irq_end;
-+
-+ int irq;
-+
-+ int ack;
-+ bool ack_pending;
-+
-+ int mask;
-+ bool mask_pending;
-+
-+ bool is_vilma;
-+};
-+
-+static struct retu *the_retu;
-+
-+/**
-+ * __retu_read_reg - Read a value from a register in Retu
-+ * @retu: pointer to retu structure
-+ * @reg: the register address to read from
-+ */
-+static int __retu_read_reg(struct retu *retu, unsigned reg)
-+{
-+ return cbus_read_reg(retu->dev, retu->devid, reg);
-+}
-+
-+/**
-+ * __retu_write_reg - Writes a value to a register in Retu
-+ * @retu: pointer to retu structure
-+ * @reg: the register address to write to
-+ * @val: the value to write to the register
-+ */
-+static void __retu_write_reg(struct retu *retu, unsigned reg, u16 val)
-+{
-+ cbus_write_reg(retu->dev, retu->devid, reg, val);
-+}
-+
-+/**
-+ * retu_read_reg - Read a value from a register in Retu
-+ * @child: device pointer for the calling child
-+ * @reg: the register to read from
-+ *
-+ * This function returns the contents of the specified register
-+ */
-+int retu_read_reg(struct device *child, unsigned reg)
-+{
-+ struct retu *retu = dev_get_drvdata(child->parent);
-+
-+ return __retu_read_reg(retu, reg);
-+}
-+EXPORT_SYMBOL_GPL(retu_read_reg);
-+
-+/**
-+ * retu_write_reg - Write a value to a register in Retu
-+ * @child: the pointer to our calling child
-+ * @reg: the register to write to
-+ * @val: the value to write to the register
-+ *
-+ * This function writes a value to the specified register
-+ */
-+void retu_write_reg(struct device *child, unsigned reg, u16 val)
-+{
-+ struct retu *retu = dev_get_drvdata(child->parent);
-+
-+ mutex_lock(&retu->mutex);
-+ __retu_write_reg(retu, reg, val);
-+ mutex_unlock(&retu->mutex);
-+}
-+EXPORT_SYMBOL_GPL(retu_write_reg);
-+
-+/**
-+ * retu_set_clear_reg_bits - helper function to read/set/clear bits
-+ * @child: device pointer to calling child
-+ * @reg: the register address
-+ * @set: mask for setting bits
-+ * @clear: mask for clearing bits
-+ */
-+void retu_set_clear_reg_bits(struct device *child, unsigned reg, u16 set,
-+ u16 clear)
-+{
-+ struct retu *retu = dev_get_drvdata(child->parent);
-+ u16 w;
-+
-+ mutex_lock(&retu->mutex);
-+ w = __retu_read_reg(retu, reg);
-+ w &= ~clear;
-+ w |= set;
-+ __retu_write_reg(retu, reg, w);
-+ mutex_unlock(&retu->mutex);
-+}
-+EXPORT_SYMBOL_GPL(retu_set_clear_reg_bits);
-+
-+#define ADC_MAX_CHAN_NUMBER 13
-+
-+/**
-+ * retu_read_adc - Reads AD conversion result
-+ * @child: device pointer to calling child
-+ * @channel: the ADC channel to read from
-+ */
-+int retu_read_adc(struct device *child, int channel)
-+{
-+ struct retu *retu = dev_get_drvdata(child->parent);
-+ int res;
-+
-+ if (!retu)
-+ return -ENODEV;
-+
-+ if (channel < 0 || channel > ADC_MAX_CHAN_NUMBER)
-+ return -EINVAL;
-+
-+ mutex_lock(&retu->mutex);
-+
-+ if ((channel == 8) && retu->is_vilma) {
-+ int scr = __retu_read_reg(retu, RETU_REG_ADCSCR);
-+ int ch = (__retu_read_reg(retu, RETU_REG_ADCR) >> 10) & 0xf;
-+ if (((scr & 0xff) != 0) && (ch != 8))
-+ __retu_write_reg(retu, RETU_REG_ADCSCR, (scr & ~0xff));
-+ }
-+
-+ /* Select the channel and read result */
-+ __retu_write_reg(retu, RETU_REG_ADCR, channel << 10);
-+ res = __retu_read_reg(retu, RETU_REG_ADCR) & 0x3ff;
-+
-+ if (retu->is_vilma)
-+ __retu_write_reg(retu, RETU_REG_ADCR, (1 << 13));
-+
-+ /* Unlock retu */
-+ mutex_unlock(&retu->mutex);
-+
-+ return res;
-+}
-+EXPORT_SYMBOL_GPL(retu_read_adc);
-+
-+static irqreturn_t retu_irq_handler(int irq, void *_retu)
-+{
-+ struct retu *retu = _retu;
-+
-+ u16 idr;
-+ u16 imr;
-+
-+ mutex_lock(&retu->mutex);
-+ idr = __retu_read_reg(retu, RETU_REG_IDR);
-+ imr = __retu_read_reg(retu, RETU_REG_IMR);
-+ mutex_unlock(&retu->mutex);
-+
-+ idr &= ~imr;
-+ if (!idr) {
-+ dev_vdbg(retu->dev, "No IRQ, spurious?\n");
-+ return IRQ_NONE;
-+ }
-+
-+ while (idr) {
-+ unsigned long pending = __ffs(idr);
-+ unsigned int irq;
-+
-+ idr &= ~BIT(pending);
-+ irq = pending + retu->irq_base;
-+ handle_nested_irq(irq);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/* -------------------------------------------------------------------------- */
-+
-+static void retu_irq_mask(struct irq_data *data)
-+{
-+ struct retu *retu = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ retu->mask |= (1 << (irq - retu->irq_base));
-+ retu->mask_pending = true;
-+}
-+
-+static void retu_irq_unmask(struct irq_data *data)
-+{
-+ struct retu *retu = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ retu->mask &= ~(1 << (irq - retu->irq_base));
-+ retu->mask_pending = true;
-+
-+}
-+
-+static void retu_irq_ack(struct irq_data *data)
-+{
-+ struct retu *retu = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ retu->ack |= (1 << (irq - retu->irq_base));
-+ retu->ack_pending = true;
-+}
-+
-+static void retu_bus_lock(struct irq_data *data)
-+{
-+ struct retu *retu = irq_data_get_irq_chip_data(data);
-+
-+ mutex_lock(&retu->mutex);
-+}
-+
-+static void retu_bus_sync_unlock(struct irq_data *data)
-+{
-+ struct retu *retu = irq_data_get_irq_chip_data(data);
-+
-+ if (retu->mask_pending) {
-+ __retu_write_reg(retu, RETU_REG_IMR, retu->mask);
-+ retu->mask_pending = false;
-+ }
-+
-+ if (retu->ack_pending) {
-+ __retu_write_reg(retu, RETU_REG_IDR, retu->ack);
-+ retu->ack_pending = false;
-+ }
-+
-+ mutex_unlock(&retu->mutex);
-+}
-+
-+static struct irq_chip retu_irq_chip = {
-+ .name = "retu",
-+ .irq_bus_lock = retu_bus_lock,
-+ .irq_bus_sync_unlock = retu_bus_sync_unlock,
-+ .irq_mask = retu_irq_mask,
-+ .irq_unmask = retu_irq_unmask,
-+ .irq_ack = retu_irq_ack,
-+};
-+
-+static inline void retu_irq_setup(int irq)
-+{
-+#ifdef CONFIG_ARM
-+ set_irq_flags(irq, IRQF_VALID);
-+#else
-+ irq_set_noprobe(irq);
-+#endif
-+}
-+
-+static void retu_irq_init(struct retu *retu)
-+{
-+ int base = retu->irq_base;
-+ int end = retu->irq_end;
-+ int irq;
-+
-+ for (irq = base; irq < end; irq++) {
-+ irq_set_chip_data(irq, retu);
-+ irq_set_chip_and_handler(irq, &retu_irq_chip,
-+ handle_simple_irq);
-+ irq_set_nested_thread(irq, 1);
-+ retu_irq_setup(irq);
-+ }
-+}
-+
-+static void retu_irq_exit(struct retu *retu)
-+{
-+ int base = retu->irq_base;
-+ int end = retu->irq_end;
-+ int irq;
-+
-+ for (irq = base; irq < end; irq++) {
-+#ifdef CONFIG_ARM
-+ set_irq_flags(irq, 0);
-+#endif
-+ irq_set_chip_and_handler(irq, NULL, NULL);
-+ irq_set_chip_data(irq, NULL);
-+ }
-+}
-+
-+/* -------------------------------------------------------------------------- */
-+
-+/**
-+ * retu_power_off - Shut down power to system
-+ *
-+ * This function puts the system in power off state
-+ */
-+static void retu_power_off(void)
-+{
-+ struct retu *retu = the_retu;
-+ unsigned reg;
-+
-+ reg = __retu_read_reg(retu, RETU_REG_CC1);
-+
-+ /* Ignore power button state */
-+ __retu_write_reg(retu, RETU_REG_CC1, reg | 2);
-+ /* Expire watchdog immediately */
-+ __retu_write_reg(retu, RETU_REG_WATCHDOG, 0);
-+ /* Wait for poweroff*/
-+ for (;;);
-+}
-+
-+static struct resource generic_resources[] = {
-+ {
-+ .start = -EINVAL, /* fixed later */
-+ .flags = IORESOURCE_IRQ,
-+ },
-+ {
-+ .start = -EINVAL, /* fixed later */
-+ .flags = IORESOURCE_IRQ,
-+ },
-+};
-+
-+/**
-+ * retu_allocate_child - Allocates one Retu child
-+ * @name: name of new child
-+ * @parent: parent device for this child
-+ */
-+static struct device *retu_allocate_child(char *name, struct device *parent,
-+ int irq_base, int irq1, int irq2, int num)
-+{
-+ struct platform_device *pdev;
-+ int status;
-+
-+ pdev = platform_device_alloc(name, -1);
-+ if (!pdev) {
-+ dev_dbg(parent, "can't allocate %s\n", name);
-+ goto err;
-+ }
-+
-+ pdev->dev.parent = parent;
-+
-+ if (num) {
-+ generic_resources[0].start = irq_base + irq1;
-+ generic_resources[1].start = irq_base + irq2;
-+
-+ status = platform_device_add_resources(pdev,
-+ generic_resources, num);
-+ if (status < 0) {
-+ dev_dbg(parent, "can't add resources to %s\n", name);
-+ goto err;
-+ }
-+ }
-+
-+ status = platform_device_add(pdev);
-+ if (status < 0) {
-+ dev_dbg(parent, "can't add %s\n", name);
-+ goto err;
-+ }
-+
-+ return &pdev->dev;
-+
-+err:
-+ platform_device_put(pdev);
-+
-+ return NULL;
-+}
-+
-+/**
-+ * retu_allocate_children - Allocates Retu's children
-+ */
-+static int retu_allocate_children(struct device *parent, int irq_base)
-+{
-+ struct device *child;
-+
-+ child = retu_allocate_child("retu-pwrbutton", parent, irq_base,
-+ RETU_INT_PWR, -1, 1);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ child = retu_allocate_child("retu-headset", parent, irq_base,
-+ RETU_INT_HOOK, -1, 1);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ child = retu_allocate_child("retu-rtc", parent, irq_base,
-+ RETU_INT_RTCS, RETU_INT_RTCA, 2);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ child = retu_allocate_child("retu-wdt", parent, -1, -1, -1, 0);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+/**
-+ * retu_probe - Probe for Retu ASIC
-+ * @dev: the Retu device
-+ *
-+ * Probe for the Retu ASIC and allocate memory
-+ * for its device-struct if found
-+ */
-+static int __devinit retu_probe(struct platform_device *pdev)
-+{
-+ struct retu *retu;
-+ struct cbus_retu_platform_data *pdata = pdev->dev.platform_data;
-+
-+ int ret = -ENOMEM;
-+ int rev;
-+
-+ retu = kzalloc(sizeof(*retu), GFP_KERNEL);
-+ if (!retu) {
-+ dev_err(&pdev->dev, "not enough memory\n");
-+ goto err0;
-+ }
-+
-+ platform_set_drvdata(pdev, retu);
-+
-+ ret = irq_alloc_descs(-1, 0, MAX_RETU_IRQ_HANDLERS, 0);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "failed to allocate IRQ descs\n");
-+ goto err1;
-+ }
-+
-+ retu->irq = platform_get_irq(pdev, 0);
-+ retu->irq_base = ret;
-+ retu->irq_end = ret + MAX_RETU_IRQ_HANDLERS;
-+ retu->devid = pdata->devid;
-+ retu->dev = &pdev->dev;
-+ the_retu = retu;
-+
-+ mutex_init(&retu->mutex);
-+
-+ retu_irq_init(retu);
-+
-+ rev = __retu_read_reg(retu, RETU_REG_ASICR) & 0xff;
-+ if (rev & (1 << 7))
-+ retu->is_vilma = true;
-+
-+ dev_info(&pdev->dev, "%s v%d.%d found\n",
-+ retu->is_vilma ? "Vilma" : "Retu",
-+ (rev >> 4) & 0x07, rev & 0x0f);
-+
-+ /* Mask all RETU interrupts */
-+ __retu_write_reg(retu, RETU_REG_IMR, 0xffff);
-+
-+ ret = request_threaded_irq(retu->irq, NULL, retu_irq_handler,
-+ IRQF_ONESHOT, "retu", retu);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "Unable to register IRQ handler\n");
-+ goto err2;
-+ }
-+
-+ irq_set_irq_wake(retu->irq, 1);
-+
-+ /* Register power off function */
-+ pm_power_off = retu_power_off;
-+
-+ ret = retu_allocate_children(&pdev->dev, retu->irq_base);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "Unable to allocate Retu children\n");
-+ goto err3;
-+ }
-+
-+ return 0;
-+
-+err3:
-+ pm_power_off = NULL;
-+ free_irq(retu->irq, retu);
-+
-+err2:
-+ retu_irq_exit(retu);
-+ irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS);
-+
-+err1:
-+ kfree(retu);
-+ the_retu = NULL;
-+
-+err0:
-+ return ret;
-+}
-+
-+static int __devexit retu_remove(struct platform_device *pdev)
-+{
-+ struct retu *retu = platform_get_drvdata(pdev);
-+
-+ pm_power_off = NULL;
-+ the_retu = NULL;
-+
-+ free_irq(retu->irq, retu);
-+ retu_irq_exit(retu);
-+ irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS);
-+ kfree(retu);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver retu_driver = {
-+ .probe = retu_probe,
-+ .remove = __devexit_p(retu_remove),
-+ .driver = {
-+ .name = "retu",
-+ },
-+};
-+
-+static int __init retu_init(void)
-+{
-+ return platform_driver_register(&retu_driver);
-+}
-+subsys_initcall(retu_init);
-+
-+static void __exit retu_exit(void)
-+{
-+ platform_driver_unregister(&retu_driver);
-+}
-+module_exit(retu_exit);
-+
-+MODULE_DESCRIPTION("Retu ASIC control");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Juha Yrjölä");
-+MODULE_AUTHOR("David Weinehall");
-+MODULE_AUTHOR("Mikko Ylinen");
---- /dev/null
-+++ b/drivers/cbus/retu.h
-@@ -0,0 +1,85 @@
-+/**
-+ * drivers/cbus/retu.h
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
-+ * David Weinehall <david.weinehall@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef __DRIVERS_CBUS_RETU_H
-+#define __DRIVERS_CBUS_RETU_H
-+
-+#include <linux/types.h>
-+
-+/* Registers */
-+#define RETU_REG_ASICR 0x00 /* ASIC ID & revision */
-+#define RETU_REG_IDR 0x01 /* Interrupt ID */
-+#define RETU_REG_IMR 0x02 /* Interrupt mask */
-+#define RETU_REG_RTCDSR 0x03 /* RTC seconds register */
-+#define RETU_REG_RTCHMR 0x04 /* RTC hours and minutes register */
-+#define RETU_REG_RTCHMAR 0x05 /* RTC hours and minutes alarm and time set register */
-+#define RETU_REG_RTCCALR 0x06 /* RTC calibration register */
-+#define RETU_REG_ADCR 0x08 /* ADC result */
-+#define RETU_REG_ADCSCR 0x09 /* ADC sample ctrl */
-+#define RETU_REG_CC1 0x0d /* Common control register 1 */
-+#define RETU_REG_CC2 0x0e /* Common control register 2 */
-+#define RETU_REG_CTRL_CLR 0x0f /* Regulator clear register */
-+#define RETU_REG_CTRL_SET 0x10 /* Regulator set register */
-+#define RETU_REG_STATUS 0x16 /* Status register */
-+#define RETU_REG_STATUS_BATAVAIL 0x0100 /* Battery available */
-+#define RETU_REG_STATUS_CHGPLUG 0x1000 /* Charger is plugged in */
-+#define RETU_REG_WATCHDOG 0x17 /* Watchdog register */
-+#define RETU_REG_AUDTXR 0x18 /* Audio Codec Tx register */
-+#define RETU_REG_MAX 0x1f
-+
-+/* Interrupt sources */
-+#define RETU_INT_PWR 0
-+#define RETU_INT_CHAR 1
-+#define RETU_INT_RTCS 2
-+#define RETU_INT_RTCM 3
-+#define RETU_INT_RTCD 4
-+#define RETU_INT_RTCA 5
-+#define RETU_INT_HOOK 6
-+#define RETU_INT_HEAD 7
-+#define RETU_INT_ADCS 8
-+
-+#define MAX_RETU_IRQ_HANDLERS 16
-+
-+/* ADC channels */
-+#define RETU_ADC_GND 0x00 /* Ground */
-+#define RETU_ADC_BSI 0x01 /* Battery Size Indicator */
-+#define RETU_ADC_BATTEMP 0x02 /* Battery temperature */
-+#define RETU_ADC_CHGVOLT 0x03 /* Charger voltage */
-+#define RETU_ADC_HEADSET 0x04 /* Headset detection */
-+#define RETU_ADC_HOOKDET 0x05 /* Hook detection */
-+#define RETU_ADC_RFGP 0x06 /* RF GP */
-+#define RETU_ADC_WBTX 0x07 /* Wideband Tx detection */
-+#define RETU_ADC_BATTVOLT 0x08 /* Battery voltage measurement */
-+#define RETU_ADC_GND2 0x09 /* Ground */
-+#define RETU_ADC_LIGHTSENS 0x0A /* Light sensor */
-+#define RETU_ADC_LIGHTTEMP 0x0B /* Light sensor temperature */
-+#define RETU_ADC_BKUPVOLT 0x0C /* Backup battery voltage */
-+#define RETU_ADC_TEMP 0x0D /* RETU temperature */
-+
-+
-+int retu_read_reg(struct device *child, unsigned reg);
-+void retu_write_reg(struct device *child, unsigned reg, u16 val);
-+void retu_set_clear_reg_bits(struct device *child, unsigned reg, u16 set,
-+ u16 clear);
-+int retu_read_adc(struct device *child, int channel);
-+
-+#endif /* __DRIVERS_CBUS_RETU_H */
---- /dev/null
-+++ b/drivers/cbus/retu-headset.c
-@@ -0,0 +1,359 @@
-+/**
-+ * Retu/Vilma headset detection
-+ *
-+ * Copyright (C) 2006 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/irq.h>
-+#include <linux/interrupt.h>
-+#include <linux/slab.h>
-+#include <linux/delay.h>
-+#include <linux/input.h>
-+#include <linux/platform_device.h>
-+
-+#include "retu.h"
-+
-+#define RETU_ADC_CHANNEL_HOOKDET 0x05
-+
-+#define RETU_HEADSET_KEY KEY_PHONE
-+
-+struct retu_headset {
-+ spinlock_t lock;
-+ struct mutex mutex;
-+ struct device *dev;
-+ struct input_dev *idev;
-+ unsigned bias_enabled;
-+ unsigned detection_enabled;
-+ unsigned pressed;
-+ struct timer_list enable_timer;
-+ struct timer_list detect_timer;
-+ int irq;
-+};
-+
-+static void retu_headset_set_bias(struct retu_headset *hs, int enable)
-+{
-+ if (enable) {
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR,
-+ (1 << 0) | (1 << 1), 0);
-+ msleep(2);
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR,
-+ 1 << 3, 0);
-+ } else {
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR, 0,
-+ (1 << 0) | (1 << 1) | (1 << 3));
-+ }
-+}
-+
-+static void retu_headset_enable(struct retu_headset *hs)
-+{
-+ mutex_lock(&hs->mutex);
-+ if (!hs->bias_enabled) {
-+ hs->bias_enabled = 1;
-+ retu_headset_set_bias(hs, 1);
-+ }
-+ mutex_unlock(&hs->mutex);
-+}
-+
-+static void retu_headset_disable(struct retu_headset *hs)
-+{
-+ mutex_lock(&hs->mutex);
-+ if (hs->bias_enabled) {
-+ hs->bias_enabled = 0;
-+ retu_headset_set_bias(hs, 0);
-+ }
-+ mutex_unlock(&hs->mutex);
-+}
-+
-+static void retu_headset_det_enable(struct retu_headset *hs)
-+{
-+ mutex_lock(&hs->mutex);
-+ if (!hs->detection_enabled) {
-+ hs->detection_enabled = 1;
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1,
-+ (1 << 10) | (1 << 8), 0);
-+ }
-+ mutex_unlock(&hs->mutex);
-+}
-+
-+static void retu_headset_det_disable(struct retu_headset *hs)
-+{
-+ unsigned long flags;
-+
-+ mutex_lock(&hs->mutex);
-+ if (hs->detection_enabled) {
-+ hs->detection_enabled = 0;
-+ del_timer_sync(&hs->enable_timer);
-+ del_timer_sync(&hs->detect_timer);
-+ spin_lock_irqsave(&hs->lock, flags);
-+ if (hs->pressed)
-+ input_report_key(hs->idev, RETU_HEADSET_KEY, 0);
-+ spin_unlock_irqrestore(&hs->lock, flags);
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1, 0,
-+ (1 << 10) | (1 << 8));
-+ }
-+ mutex_unlock(&hs->mutex);
-+}
-+
-+static ssize_t retu_headset_hookdet_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ int val;
-+
-+ val = retu_read_adc(dev, RETU_ADC_CHANNEL_HOOKDET);
-+ return sprintf(buf, "%d\n", val);
-+}
-+
-+static DEVICE_ATTR(hookdet, S_IRUGO, retu_headset_hookdet_show, NULL);
-+
-+static ssize_t retu_headset_enable_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct retu_headset *hs = dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%u\n", hs->bias_enabled);
-+}
-+
-+static ssize_t retu_headset_enable_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct retu_headset *hs = dev_get_drvdata(dev);
-+ int enable;
-+
-+ if (sscanf(buf, "%u", &enable) != 1)
-+ return -EINVAL;
-+ if (enable)
-+ retu_headset_enable(hs);
-+ else
-+ retu_headset_disable(hs);
-+ return count;
-+}
-+
-+static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR | S_IWGRP,
-+ retu_headset_enable_show, retu_headset_enable_store);
-+
-+static ssize_t retu_headset_enable_det_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct retu_headset *hs = dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%u\n", hs->detection_enabled);
-+}
-+
-+static ssize_t retu_headset_enable_det_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct retu_headset *hs = dev_get_drvdata(dev);
-+ int enable;
-+
-+ if (sscanf(buf, "%u", &enable) != 1)
-+ return -EINVAL;
-+ if (enable)
-+ retu_headset_det_enable(hs);
-+ else
-+ retu_headset_det_disable(hs);
-+ return count;
-+}
-+
-+static DEVICE_ATTR(enable_det, S_IRUGO | S_IWUSR | S_IWGRP,
-+ retu_headset_enable_det_show,
-+ retu_headset_enable_det_store);
-+
-+static irqreturn_t retu_headset_hook_interrupt(int irq, void *_hs)
-+{
-+ struct retu_headset *hs = _hs;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&hs->lock, flags);
-+ if (!hs->pressed) {
-+ /* Headset button was just pressed down. */
-+ hs->pressed = 1;
-+ input_report_key(hs->idev, RETU_HEADSET_KEY, 1);
-+ }
-+ spin_unlock_irqrestore(&hs->lock, flags);
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1, 0,
-+ (1 << 10) | (1 << 8));
-+ mod_timer(&hs->enable_timer, jiffies + msecs_to_jiffies(50));
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static void retu_headset_enable_timer(unsigned long arg)
-+{
-+ struct retu_headset *hs = (struct retu_headset *) arg;
-+
-+ retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1,
-+ (1 << 10) | (1 << 8), 0);
-+ mod_timer(&hs->detect_timer, jiffies + msecs_to_jiffies(350));
-+}
-+
-+static void retu_headset_detect_timer(unsigned long arg)
-+{
-+ struct retu_headset *hs = (struct retu_headset *) arg;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&hs->lock, flags);
-+ if (hs->pressed) {
-+ hs->pressed = 0;
-+ input_report_key(hs->idev, RETU_HEADSET_KEY, 0);
-+ }
-+ spin_unlock_irqrestore(&hs->lock, flags);
-+}
-+
-+static int __init retu_headset_probe(struct platform_device *pdev)
-+{
-+ struct retu_headset *hs;
-+ int irq;
-+ int r;
-+
-+ hs = kzalloc(sizeof(*hs), GFP_KERNEL);
-+ if (hs == NULL)
-+ return -ENOMEM;
-+
-+ hs->dev = &pdev->dev;
-+
-+ hs->idev = input_allocate_device();
-+ if (hs->idev == NULL) {
-+ r = -ENOMEM;
-+ goto err1;
-+ }
-+ hs->idev->name = "retu-headset";
-+ hs->idev->dev.parent = &pdev->dev;
-+ set_bit(EV_KEY, hs->idev->evbit);
-+ set_bit(RETU_HEADSET_KEY, hs->idev->keybit);
-+ r = input_register_device(hs->idev);
-+ if (r < 0)
-+ goto err2;
-+
-+ r = device_create_file(&pdev->dev, &dev_attr_hookdet);
-+ if (r < 0)
-+ goto err3;
-+ r = device_create_file(&pdev->dev, &dev_attr_enable);
-+ if (r < 0)
-+ goto err4;
-+ r = device_create_file(&pdev->dev, &dev_attr_enable_det);
-+ if (r < 0)
-+ goto err5;
-+ platform_set_drvdata(pdev, hs);
-+
-+ spin_lock_init(&hs->lock);
-+ mutex_init(&hs->mutex);
-+ setup_timer(&hs->enable_timer, retu_headset_enable_timer,
-+ (unsigned long) hs);
-+ setup_timer(&hs->detect_timer, retu_headset_detect_timer,
-+ (unsigned long) hs);
-+
-+ irq = platform_get_irq(pdev, 0);
-+ hs->irq = irq;
-+
-+ r = request_threaded_irq(irq, NULL, retu_headset_hook_interrupt, 0,
-+ "hookdet", hs);
-+ if (r != 0) {
-+ dev_err(&pdev->dev, "hookdet IRQ not available\n");
-+ goto err6;
-+ }
-+
-+ return 0;
-+err6:
-+ device_remove_file(&pdev->dev, &dev_attr_enable_det);
-+err5:
-+ device_remove_file(&pdev->dev, &dev_attr_enable);
-+err4:
-+ device_remove_file(&pdev->dev, &dev_attr_hookdet);
-+err3:
-+ input_unregister_device(hs->idev);
-+err2:
-+ input_free_device(hs->idev);
-+err1:
-+ kfree(hs);
-+ return r;
-+}
-+
-+static int retu_headset_remove(struct platform_device *pdev)
-+{
-+ struct retu_headset *hs = platform_get_drvdata(pdev);
-+
-+ device_remove_file(&pdev->dev, &dev_attr_hookdet);
-+ device_remove_file(&pdev->dev, &dev_attr_enable);
-+ device_remove_file(&pdev->dev, &dev_attr_enable_det);
-+ retu_headset_disable(hs);
-+ retu_headset_det_disable(hs);
-+ free_irq(hs->irq, hs);
-+ input_unregister_device(hs->idev);
-+ input_free_device(hs->idev);
-+
-+ return 0;
-+}
-+
-+static int retu_headset_suspend(struct platform_device *pdev,
-+ pm_message_t mesg)
-+{
-+ struct retu_headset *hs = platform_get_drvdata(pdev);
-+
-+ mutex_lock(&hs->mutex);
-+ if (hs->bias_enabled)
-+ retu_headset_set_bias(hs, 0);
-+ mutex_unlock(&hs->mutex);
-+
-+ return 0;
-+}
-+
-+static int retu_headset_resume(struct platform_device *pdev)
-+{
-+ struct retu_headset *hs = platform_get_drvdata(pdev);
-+
-+ mutex_lock(&hs->mutex);
-+ if (hs->bias_enabled)
-+ retu_headset_set_bias(hs, 1);
-+ mutex_unlock(&hs->mutex);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver retu_headset_driver = {
-+ .remove = retu_headset_remove,
-+ .suspend = retu_headset_suspend,
-+ .resume = retu_headset_resume,
-+ .driver = {
-+ .name = "retu-headset",
-+ },
-+};
-+
-+static int __init retu_headset_init(void)
-+{
-+ return platform_driver_probe(&retu_headset_driver, retu_headset_probe);
-+}
-+
-+static void __exit retu_headset_exit(void)
-+{
-+ platform_driver_unregister(&retu_headset_driver);
-+}
-+
-+module_init(retu_headset_init);
-+module_exit(retu_headset_exit);
-+
-+MODULE_DESCRIPTION("Retu/Vilma headset detection");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Juha Yrjölä");
---- /dev/null
-+++ b/drivers/cbus/retu-pwrbutton.c
-@@ -0,0 +1,165 @@
-+/**
-+ * drivers/cbus/retu-pwrbutton.c
-+ *
-+ * Driver for sending retu power button event to input-layer
-+ *
-+ * Copyright (C) 2004-2010 Nokia Corporation
-+ *
-+ * Written by
-+ * Ari Saastamoinen <ari.saastamoinen@elektrobit.com>
-+ * Juha Yrjola <juha.yrjola@solidboot.com>
-+ *
-+ * Contact: Felipe Balbi <felipe.balbi@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/input.h>
-+#include <linux/jiffies.h>
-+#include <linux/bitops.h>
-+#include <linux/irq.h>
-+#include <linux/interrupt.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+
-+#include "retu.h"
-+
-+#define RETU_STATUS_PWRONX (1 << 5)
-+
-+#define PWRBTN_DELAY 20
-+#define PWRBTN_UP 0
-+#define PWRBTN_PRESSED 1
-+
-+struct retu_pwrbutton {
-+ struct input_dev *idev;
-+ struct device *dev;
-+
-+ int state;
-+ int irq;
-+};
-+
-+static irqreturn_t retubutton_irq(int irq, void *_pwr)
-+{
-+ struct retu_pwrbutton *pwr = _pwr;
-+ int state;
-+
-+ if (retu_read_reg(pwr->dev, RETU_REG_STATUS) & RETU_STATUS_PWRONX)
-+ state = PWRBTN_UP;
-+ else
-+ state = PWRBTN_PRESSED;
-+
-+ if (pwr->state != state) {
-+ input_report_key(pwr->idev, KEY_POWER, state);
-+ input_sync(pwr->idev);
-+ pwr->state = state;
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int __init retubutton_probe(struct platform_device *pdev)
-+{
-+ struct retu_pwrbutton *pwr;
-+ int ret = 0;
-+
-+ pwr = kzalloc(sizeof(*pwr), GFP_KERNEL);
-+ if (!pwr) {
-+ dev_err(&pdev->dev, "not enough memory\n");
-+ ret = -ENOMEM;
-+ goto err0;
-+ }
-+
-+ pwr->dev = &pdev->dev;
-+ pwr->irq = platform_get_irq(pdev, 0);
-+ platform_set_drvdata(pdev, pwr);
-+
-+ ret = request_threaded_irq(pwr->irq, NULL, retubutton_irq, 0,
-+ "retu-pwrbutton", pwr);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "Cannot allocate irq\n");
-+ goto err1;
-+ }
-+
-+ pwr->idev = input_allocate_device();
-+ if (!pwr->idev) {
-+ dev_err(&pdev->dev, "can't allocate input device\n");
-+ ret = -ENOMEM;
-+ goto err2;
-+ }
-+
-+ pwr->idev->evbit[0] = BIT_MASK(EV_KEY);
-+ pwr->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
-+ pwr->idev->name = "retu-pwrbutton";
-+
-+ ret = input_register_device(pwr->idev);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "failed to register input device\n");
-+ goto err3;
-+ }
-+
-+ return 0;
-+
-+err3:
-+ input_free_device(pwr->idev);
-+
-+err2:
-+ free_irq(pwr->irq, pwr);
-+
-+err1:
-+ kfree(pwr);
-+
-+err0:
-+ return ret;
-+}
-+
-+static int __exit retubutton_remove(struct platform_device *pdev)
-+{
-+ struct retu_pwrbutton *pwr = platform_get_drvdata(pdev);
-+
-+ free_irq(pwr->irq, pwr);
-+ input_unregister_device(pwr->idev);
-+ input_free_device(pwr->idev);
-+ kfree(pwr);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver retu_pwrbutton_driver = {
-+ .remove = __exit_p(retubutton_remove),
-+ .driver = {
-+ .name = "retu-pwrbutton",
-+ },
-+};
-+
-+static int __init retubutton_init(void)
-+{
-+ return platform_driver_probe(&retu_pwrbutton_driver, retubutton_probe);
-+}
-+module_init(retubutton_init);
-+
-+static void __exit retubutton_exit(void)
-+{
-+ platform_driver_unregister(&retu_pwrbutton_driver);
-+}
-+module_exit(retubutton_exit);
-+
-+MODULE_DESCRIPTION("Retu Power Button");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Ari Saastamoinen");
-+MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
-+
---- /dev/null
-+++ b/drivers/cbus/retu-rtc.c
-@@ -0,0 +1,287 @@
-+/**
-+ * drivers/cbus/retu-rtc.c
-+ *
-+ * Support for Retu RTC
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Paul Mundt <paul.mundt@nokia.com> and
-+ * Igor Stoppa <igor.stoppa@nokia.com>
-+ *
-+ * The Retu RTC is essentially a partial read-only RTC that gives us Retu's
-+ * idea of what time actually is. It's left as a userspace excercise to map
-+ * this back to time in the real world and ensure that calibration settings
-+ * are sane to compensate for any horrible drift (on account of not being able
-+ * to set the clock to anything).
-+ *
-+ * Days are semi-writeable. Namely, Retu will only track 255 days for us
-+ * consecutively, after which the counter is explicitly stuck at 255 until
-+ * someone comes along and clears it with a write. In the event that no one
-+ * comes along and clears it, we no longer have any idea what day it is.
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/device.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/platform_device.h>
-+#include <linux/mutex.h>
-+#include <linux/rtc.h>
-+
-+#include "cbus.h"
-+#include "retu.h"
-+
-+struct retu_rtc {
-+ /* device lock */
-+ struct mutex mutex;
-+ struct device *dev;
-+ struct rtc_device *rtc;
-+
-+ u16 alarm_expired;
-+ int irq_rtcs;
-+ int irq_rtca;
-+};
-+
-+static void retu_rtc_do_reset(struct retu_rtc *rtc)
-+{
-+ u16 ccr1;
-+
-+ ccr1 = retu_read_reg(rtc->dev, RETU_REG_CC1);
-+ /* RTC in reset */
-+ retu_write_reg(rtc->dev, RETU_REG_CC1, ccr1 | 0x0001);
-+ /* RTC in normal operating mode */
-+ retu_write_reg(rtc->dev, RETU_REG_CC1, ccr1 & ~0x0001);
-+
-+ /* Disable alarm and RTC WD */
-+ retu_write_reg(rtc->dev, RETU_REG_RTCHMAR, 0x7f3f);
-+ /* Set Calibration register to default value */
-+ retu_write_reg(rtc->dev, RETU_REG_RTCCALR, 0x00c0);
-+
-+ rtc->alarm_expired = 0;
-+}
-+
-+static irqreturn_t retu_rtc_interrupt(int irq, void *_rtc)
-+{
-+ struct retu_rtc *rtc = _rtc;
-+
-+ mutex_lock(&rtc->mutex);
-+ rtc->alarm_expired = 1;
-+ retu_write_reg(rtc->dev, RETU_REG_RTCHMAR, (24 << 8) | 60);
-+ mutex_unlock(&rtc->mutex);
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int retu_rtc_init_irq(struct retu_rtc *rtc)
-+{
-+ int irq;
-+ int ret;
-+
-+ irq = platform_get_irq(to_platform_device(rtc->dev), 0);
-+ rtc->irq_rtcs = irq;
-+
-+ irq = platform_get_irq(to_platform_device(rtc->dev), 1);
-+ rtc->irq_rtca = irq;
-+
-+ ret = request_threaded_irq(rtc->irq_rtcs, NULL, retu_rtc_interrupt,
-+ 0, "RTCS", rtc);
-+ if (ret != 0)
-+ return ret;
-+
-+ ret = request_threaded_irq(rtc->irq_rtca, NULL, retu_rtc_interrupt,
-+ 0, "RTCA", rtc);
-+ if (ret != 0) {
-+ free_irq(rtc->irq_rtcs, rtc);
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+static int retu_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
-+{
-+ struct retu_rtc *rtc = dev_get_drvdata(dev);
-+ u16 chmar;
-+
-+ mutex_lock(&rtc->mutex);
-+
-+ chmar = ((alm->time.tm_hour & 0x1f) << 8) | (alm->time.tm_min & 0x3f);
-+ retu_write_reg(rtc->dev, RETU_REG_RTCHMAR, chmar);
-+
-+ mutex_unlock(&rtc->mutex);
-+
-+ return 0;
-+}
-+
-+static int retu_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
-+{
-+ struct retu_rtc *rtc = dev_get_drvdata(dev);
-+ u16 chmar;
-+
-+ mutex_lock(&rtc->mutex);
-+
-+ chmar = retu_read_reg(rtc->dev, RETU_REG_RTCHMAR);
-+
-+ alm->time.tm_hour = (chmar >> 8) & 0x1f;
-+ alm->time.tm_min = chmar & 0x3f;
-+ alm->enabled = !!rtc->alarm_expired;
-+
-+ mutex_unlock(&rtc->mutex);
-+
-+ return 0;
-+}
-+
-+static int retu_rtc_set_time(struct device *dev, struct rtc_time *tm)
-+{
-+ struct retu_rtc *rtc = dev_get_drvdata(dev);
-+ u16 dsr;
-+ u16 hmr;
-+
-+ dsr = ((tm->tm_mday & 0xff) << 8) | (tm->tm_hour & 0xff);
-+ hmr = ((tm->tm_min & 0xff) << 8) | (tm->tm_sec & 0xff);
-+
-+ mutex_lock(&rtc->mutex);
-+
-+ retu_write_reg(rtc->dev, RETU_REG_RTCDSR, dsr);
-+ retu_write_reg(rtc->dev, RETU_REG_RTCHMR, hmr);
-+
-+ mutex_unlock(&rtc->mutex);
-+
-+ return 0;
-+}
-+
-+static int retu_rtc_read_time(struct device *dev, struct rtc_time *tm)
-+{
-+ struct retu_rtc *rtc = dev_get_drvdata(dev);
-+ u16 dsr;
-+ u16 hmr;
-+
-+ /*
-+ * DSR holds days and hours
-+ * HMR hols minutes and seconds
-+ *
-+ * both are 16 bit registers with 8-bit for each field.
-+ */
-+
-+ mutex_lock(&rtc->mutex);
-+
-+ dsr = retu_read_reg(rtc->dev, RETU_REG_RTCDSR);
-+ hmr = retu_read_reg(rtc->dev, RETU_REG_RTCHMR);
-+
-+ tm->tm_sec = hmr & 0xff;
-+ tm->tm_min = hmr >> 8;
-+ tm->tm_hour = dsr & 0xff;
-+ tm->tm_mday = dsr >> 8;
-+
-+ mutex_unlock(&rtc->mutex);
-+
-+ return 0;
-+}
-+
-+static struct rtc_class_ops retu_rtc_ops = {
-+ .read_time = retu_rtc_read_time,
-+ .set_time = retu_rtc_set_time,
-+ .read_alarm = retu_rtc_read_alarm,
-+ .set_alarm = retu_rtc_set_alarm,
-+};
-+
-+static int __init retu_rtc_probe(struct platform_device *pdev)
-+{
-+ struct retu_rtc *rtc;
-+ int r;
-+
-+ rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
-+ if (!rtc) {
-+ dev_err(&pdev->dev, "not enough memory\n");
-+ r = -ENOMEM;
-+ goto err0;
-+ }
-+
-+ rtc->dev = &pdev->dev;
-+ platform_set_drvdata(pdev, rtc);
-+ mutex_init(&rtc->mutex);
-+
-+ rtc->alarm_expired = retu_read_reg(rtc->dev, RETU_REG_IDR) &
-+ (0x1 << RETU_INT_RTCA);
-+
-+ r = retu_rtc_init_irq(rtc);
-+ if (r < 0) {
-+ dev_err(&pdev->dev, "failed to request retu irq\n");
-+ goto err1;
-+ }
-+
-+ /* If the calibration register is zero, we've probably lost power */
-+ if (!(retu_read_reg(rtc->dev, RETU_REG_RTCCALR) & 0x00ff))
-+ retu_rtc_do_reset(rtc);
-+
-+ rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, &
-+ retu_rtc_ops, THIS_MODULE);
-+ if (IS_ERR(rtc->rtc)) {
-+ dev_err(&pdev->dev, "can't register RTC device\n");
-+ goto err2;
-+ }
-+
-+ return 0;
-+
-+err2:
-+ free_irq(rtc->irq_rtcs, rtc);
-+ free_irq(rtc->irq_rtca, rtc);
-+
-+err1:
-+ kfree(rtc);
-+
-+err0:
-+ return r;
-+}
-+
-+static int __devexit retu_rtc_remove(struct platform_device *pdev)
-+{
-+ struct retu_rtc *rtc = platform_get_drvdata(pdev);
-+
-+ free_irq(rtc->irq_rtcs, rtc);
-+ free_irq(rtc->irq_rtca, rtc);
-+ rtc_device_unregister(rtc->rtc);
-+ kfree(rtc);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver retu_rtc_driver = {
-+ .remove = __exit_p(retu_rtc_remove),
-+ .driver = {
-+ .name = "retu-rtc",
-+ },
-+};
-+
-+static int __init retu_rtc_init(void)
-+{
-+ return platform_driver_probe(&retu_rtc_driver, retu_rtc_probe);
-+}
-+module_init(retu_rtc_init);
-+
-+static void __exit retu_rtc_exit(void)
-+{
-+ platform_driver_unregister(&retu_rtc_driver);
-+}
-+module_exit(retu_rtc_exit);
-+
-+MODULE_DESCRIPTION("Retu RTC");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Paul Mundt");
-+MODULE_AUTHOR("Igor Stoppa");
-+MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
-+
---- /dev/null
-+++ b/drivers/cbus/retu-wdt.c
-@@ -0,0 +1,272 @@
-+/**
-+ * drivers/cbus/retu-wdt.c
-+ *
-+ * Driver for Retu watchdog
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Amit Kucheria <amit.kucheria@nokia.com>
-+ *
-+ * Cleanups by Michael Buesch <mb@bu3sch.de> (C) 2011
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/device.h>
-+#include <linux/init.h>
-+#include <linux/fs.h>
-+#include <linux/io.h>
-+#include <linux/platform_device.h>
-+
-+#include <linux/completion.h>
-+#include <linux/errno.h>
-+#include <linux/moduleparam.h>
-+#include <linux/miscdevice.h>
-+#include <linux/watchdog.h>
-+
-+#include <asm/uaccess.h>
-+
-+#include <plat/prcm.h>
-+
-+#include "cbus.h"
-+#include "retu.h"
-+
-+/* Watchdog timeout in seconds */
-+#define RETU_WDT_MIN_TIMER 0
-+#define RETU_WDT_DEFAULT_TIMER 32
-+#define RETU_WDT_MAX_TIMER 63
-+
-+struct retu_wdt_dev {
-+ struct device *dev;
-+ unsigned int period_val; /* Current period of watchdog */
-+ unsigned long users;
-+ struct miscdevice miscdev;
-+ struct delayed_work ping_work;
-+ struct mutex mutex;
-+};
-+
-+
-+static inline void _retu_modify_counter(struct retu_wdt_dev *wdev,
-+ unsigned int new)
-+{
-+ retu_write_reg(wdev->dev, RETU_REG_WATCHDOG, (u16)new);
-+}
-+
-+static int retu_modify_counter(struct retu_wdt_dev *wdev, unsigned int new)
-+{
-+ if (new < RETU_WDT_MIN_TIMER || new > RETU_WDT_MAX_TIMER)
-+ return -EINVAL;
-+
-+ mutex_lock(&wdev->mutex);
-+ wdev->period_val = new;
-+ _retu_modify_counter(wdev, wdev->period_val);
-+ mutex_unlock(&wdev->mutex);
-+
-+ return 0;
-+}
-+
-+/*
-+ * Since retu watchdog cannot be disabled in hardware, we must kick it
-+ * with a timer until userspace watchdog software takes over. Do this
-+ * unless /dev/watchdog is open or CONFIG_WATCHDOG_NOWAYOUT is set.
-+ */
-+static void retu_wdt_ping_enable(struct retu_wdt_dev *wdev)
-+{
-+ _retu_modify_counter(wdev, RETU_WDT_MAX_TIMER);
-+ schedule_delayed_work(&wdev->ping_work,
-+ round_jiffies_relative(RETU_WDT_DEFAULT_TIMER * HZ));
-+}
-+
-+static void retu_wdt_ping_disable(struct retu_wdt_dev *wdev)
-+{
-+ _retu_modify_counter(wdev, RETU_WDT_MAX_TIMER);
-+ cancel_delayed_work_sync(&wdev->ping_work);
-+}
-+
-+static void retu_wdt_ping_work(struct work_struct *work)
-+{
-+ struct retu_wdt_dev *wdev = container_of(to_delayed_work(work),
-+ struct retu_wdt_dev, ping_work);
-+ retu_wdt_ping_enable(wdev);
-+}
-+
-+static int retu_wdt_open(struct inode *inode, struct file *file)
-+{
-+ struct miscdevice *mdev = file->private_data;
-+ struct retu_wdt_dev *wdev = container_of(mdev, struct retu_wdt_dev, miscdev);
-+
-+ if (test_and_set_bit(0, &wdev->users))
-+ return -EBUSY;
-+
-+ retu_wdt_ping_disable(wdev);
-+
-+ return nonseekable_open(inode, file);
-+}
-+
-+static int retu_wdt_release(struct inode *inode, struct file *file)
-+{
-+ struct miscdevice *mdev = file->private_data;
-+ struct retu_wdt_dev *wdev = container_of(mdev, struct retu_wdt_dev, miscdev);
-+
-+#ifndef CONFIG_WATCHDOG_NOWAYOUT
-+ retu_wdt_ping_enable(wdev);
-+#endif
-+ clear_bit(0, &wdev->users);
-+
-+ return 0;
-+}
-+
-+static ssize_t retu_wdt_write(struct file *file, const char __user *data,
-+ size_t len, loff_t *ppos)
-+{
-+ struct miscdevice *mdev = file->private_data;
-+ struct retu_wdt_dev *wdev = container_of(mdev, struct retu_wdt_dev, miscdev);
-+
-+ if (len)
-+ retu_modify_counter(wdev, RETU_WDT_MAX_TIMER);
-+
-+ return len;
-+}
-+
-+static long retu_wdt_ioctl(struct file *file, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ struct miscdevice *mdev = file->private_data;
-+ struct retu_wdt_dev *wdev = container_of(mdev, struct retu_wdt_dev, miscdev);
-+ int new_margin;
-+
-+ static const struct watchdog_info ident = {
-+ .identity = "Retu Watchdog",
-+ .options = WDIOF_SETTIMEOUT,
-+ .firmware_version = 0,
-+ };
-+
-+ switch (cmd) {
-+ default:
-+ return -ENOTTY;
-+ case WDIOC_GETSUPPORT:
-+ return copy_to_user((struct watchdog_info __user *)arg, &ident,
-+ sizeof(ident));
-+ case WDIOC_GETSTATUS:
-+ return put_user(0, (int __user *)arg);
-+ case WDIOC_GETBOOTSTATUS:
-+ if (cpu_is_omap16xx())
-+ return put_user(omap_readw(ARM_SYSST),
-+ (int __user *)arg);
-+ if (cpu_is_omap24xx())
-+ return put_user(omap_prcm_get_reset_sources(),
-+ (int __user *)arg);
-+ case WDIOC_KEEPALIVE:
-+ retu_modify_counter(wdev, RETU_WDT_MAX_TIMER);
-+ break;
-+ case WDIOC_SETTIMEOUT:
-+ if (get_user(new_margin, (int __user *)arg))
-+ return -EFAULT;
-+ retu_modify_counter(wdev, new_margin);
-+ /* Fall through */
-+ case WDIOC_GETTIMEOUT:
-+ return put_user(wdev->period_val, (int __user *)arg);
-+ }
-+
-+ return 0;
-+}
-+
-+static const struct file_operations retu_wdt_fops = {
-+ .owner = THIS_MODULE,
-+ .write = retu_wdt_write,
-+ .unlocked_ioctl = retu_wdt_ioctl,
-+ .open = retu_wdt_open,
-+ .release = retu_wdt_release,
-+};
-+
-+static int __init retu_wdt_probe(struct platform_device *pdev)
-+{
-+ struct retu_wdt_dev *wdev;
-+ int ret;
-+
-+ wdev = kzalloc(sizeof(struct retu_wdt_dev), GFP_KERNEL);
-+ if (!wdev)
-+ return -ENOMEM;
-+
-+ wdev->dev = &pdev->dev;
-+ wdev->period_val = RETU_WDT_DEFAULT_TIMER;
-+ mutex_init(&wdev->mutex);
-+
-+ platform_set_drvdata(pdev, wdev);
-+
-+ wdev->miscdev.parent = &pdev->dev;
-+ wdev->miscdev.minor = WATCHDOG_MINOR;
-+ wdev->miscdev.name = "watchdog";
-+ wdev->miscdev.fops = &retu_wdt_fops;
-+
-+ ret = misc_register(&wdev->miscdev);
-+ if (ret)
-+ goto err_free_wdev;
-+
-+ INIT_DELAYED_WORK(&wdev->ping_work, retu_wdt_ping_work);
-+
-+ /* Kick the watchdog for kernel booting to finish.
-+ * If nowayout is not set, we start the ping work. */
-+#ifdef CONFIG_WATCHDOG_NOWAYOUT
-+ retu_modify_counter(wdev, RETU_WDT_MAX_TIMER);
-+#else
-+ retu_wdt_ping_enable(wdev);
-+#endif
-+
-+ return 0;
-+
-+err_free_wdev:
-+ kfree(wdev);
-+
-+ return ret;
-+}
-+
-+static int __devexit retu_wdt_remove(struct platform_device *pdev)
-+{
-+ struct retu_wdt_dev *wdev;
-+
-+ wdev = platform_get_drvdata(pdev);
-+ misc_deregister(&wdev->miscdev);
-+ cancel_delayed_work_sync(&wdev->ping_work);
-+ kfree(wdev);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver retu_wdt_driver = {
-+ .remove = __exit_p(retu_wdt_remove),
-+ .driver = {
-+ .name = "retu-wdt",
-+ },
-+};
-+
-+static int __init retu_wdt_init(void)
-+{
-+ return platform_driver_probe(&retu_wdt_driver, retu_wdt_probe);
-+}
-+
-+static void __exit retu_wdt_exit(void)
-+{
-+ platform_driver_unregister(&retu_wdt_driver);
-+}
-+
-+module_init(retu_wdt_init);
-+module_exit(retu_wdt_exit);
-+
-+MODULE_DESCRIPTION("Retu WatchDog");
-+MODULE_AUTHOR("Amit Kucheria");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/cbus/tahvo.c
-@@ -0,0 +1,423 @@
-+/**
-+ * drivers/cbus/tahvo.c
-+ *
-+ * Support functions for Tahvo ASIC
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
-+ * David Weinehall <david.weinehall@nokia.com>, and
-+ * Mikko Ylinen <mikko.k.ylinen@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+
-+#include <linux/slab.h>
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/device.h>
-+#include <linux/irq.h>
-+#include <linux/interrupt.h>
-+#include <linux/platform_device.h>
-+#include <linux/platform_data/cbus.h>
-+#include <linux/mutex.h>
-+
-+#include "cbus.h"
-+#include "tahvo.h"
-+
-+struct tahvo {
-+ /* device lock */
-+ struct mutex mutex;
-+ struct device *dev;
-+
-+ int irq_base;
-+ int irq_end;
-+ int irq;
-+
-+ int ack;
-+ int mask;
-+
-+ unsigned int mask_pending:1;
-+ unsigned int ack_pending:1;
-+ unsigned int is_betty:1;
-+};
-+
-+/**
-+ * __tahvo_read_reg - Reads a value from a register in Tahvo
-+ * @tahvo: pointer to tahvo structure
-+ * @reg: the register address to read from
-+ */
-+static int __tahvo_read_reg(struct tahvo *tahvo, unsigned reg)
-+{
-+ return cbus_read_reg(tahvo->dev, CBUS_TAHVO_DEVICE_ID, reg);
-+}
-+
-+/**
-+ * __tahvo_write_reg - Writes a value to a register in Tahvo
-+ * @tahvo: pointer to tahvo structure
-+ * @reg: register address to write to
-+ * @val: the value to be written to @reg
-+ */
-+static void __tahvo_write_reg(struct tahvo *tahvo, unsigned reg, u16 val)
-+{
-+ cbus_write_reg(tahvo->dev, CBUS_TAHVO_DEVICE_ID, reg, val);
-+}
-+
-+/**
-+ * tahvo_read_reg - Read a value from a register in Tahvo
-+ * @child: device pointer from the calling child
-+ * @reg: the register to read from
-+ *
-+ * This function returns the contents of the specified register
-+ */
-+int tahvo_read_reg(struct device *child, unsigned reg)
-+{
-+ struct tahvo *tahvo = dev_get_drvdata(child->parent);
-+
-+ return __tahvo_read_reg(tahvo, reg);
-+}
-+EXPORT_SYMBOL(tahvo_read_reg);
-+
-+/**
-+ * tahvo_write_reg - Write a value to a register in Tahvo
-+ * @child: device pointer from the calling child
-+ * @reg: the register to write to
-+ * @val : the value to write to the register
-+ *
-+ * This function writes a value to the specified register
-+ */
-+void tahvo_write_reg(struct device *child, unsigned reg, u16 val)
-+{
-+ struct tahvo *tahvo = dev_get_drvdata(child->parent);
-+
-+ __tahvo_write_reg(tahvo, reg, val);
-+}
-+EXPORT_SYMBOL(tahvo_write_reg);
-+
-+/**
-+ * tahvo_set_clear_reg_bits - set and clear register bits atomically
-+ * @child: device pointer from the calling child
-+ * @reg: the register to write to
-+ * @bits: the bits to set
-+ *
-+ * This function sets and clears the specified Tahvo register bits atomically
-+ */
-+void tahvo_set_clear_reg_bits(struct device *child, unsigned reg, u16 set,
-+ u16 clear)
-+{
-+ struct tahvo *tahvo = dev_get_drvdata(child->parent);
-+ u16 w;
-+
-+ mutex_lock(&tahvo->mutex);
-+ w = __tahvo_read_reg(tahvo, reg);
-+ w &= ~clear;
-+ w |= set;
-+ __tahvo_write_reg(tahvo, reg, w);
-+ mutex_unlock(&tahvo->mutex);
-+}
-+
-+static irqreturn_t tahvo_irq_handler(int irq, void *_tahvo)
-+{
-+ struct tahvo *tahvo = _tahvo;
-+ u16 id;
-+ u16 im;
-+
-+ id = __tahvo_read_reg(tahvo, TAHVO_REG_IDR);
-+ im = __tahvo_read_reg(tahvo, TAHVO_REG_IMR);
-+ id &= ~im;
-+
-+ if (!id) {
-+ dev_vdbg(tahvo->dev, "No IRQ, spurious ?\n");
-+ return IRQ_NONE;
-+ }
-+
-+ while (id) {
-+ unsigned long pending = __ffs(id);
-+ unsigned int irq;
-+
-+ id &= ~BIT(pending);
-+ irq = pending + tahvo->irq_base;
-+ handle_nested_irq(irq);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+/* -------------------------------------------------------------------------- */
-+
-+static void tahvo_irq_bus_lock(struct irq_data *data)
-+{
-+ struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-+
-+ mutex_lock(&tahvo->mutex);
-+}
-+
-+static void tahvo_irq_bus_sync_unlock(struct irq_data *data)
-+{
-+ struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-+
-+ if (tahvo->mask_pending) {
-+ __tahvo_write_reg(tahvo, TAHVO_REG_IMR, tahvo->mask);
-+ tahvo->mask_pending = false;
-+ }
-+
-+ if (tahvo->ack_pending) {
-+ __tahvo_write_reg(tahvo, TAHVO_REG_IDR, tahvo->ack);
-+ tahvo->ack_pending = false;
-+ }
-+
-+ mutex_unlock(&tahvo->mutex);
-+}
-+
-+static void tahvo_irq_mask(struct irq_data *data)
-+{
-+ struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ tahvo->mask |= (1 << (irq - tahvo->irq_base));
-+ tahvo->mask_pending = true;
-+}
-+
-+static void tahvo_irq_unmask(struct irq_data *data)
-+{
-+ struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ tahvo->mask &= ~(1 << (irq - tahvo->irq_base));
-+ tahvo->mask_pending = true;
-+}
-+
-+static void tahvo_irq_ack(struct irq_data *data)
-+{
-+ struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-+ int irq = data->irq;
-+
-+ tahvo->ack |= (1 << (irq - tahvo->irq_base));
-+ tahvo->ack_pending = true;
-+}
-+
-+static struct irq_chip tahvo_irq_chip = {
-+ .name = "tahvo",
-+ .irq_bus_lock = tahvo_irq_bus_lock,
-+ .irq_bus_sync_unlock = tahvo_irq_bus_sync_unlock,
-+ .irq_mask = tahvo_irq_mask,
-+ .irq_unmask = tahvo_irq_unmask,
-+ .irq_ack = tahvo_irq_ack,
-+};
-+
-+static inline void tahvo_irq_setup(int irq)
-+{
-+#ifdef CONFIG_ARM
-+ set_irq_flags(irq, IRQF_VALID);
-+#else
-+ irq_set_noprobe(irq);
-+#endif
-+}
-+
-+static void tahvo_irq_init(struct tahvo *tahvo)
-+{
-+ int base = tahvo->irq_base;
-+ int end = tahvo->irq_end;
-+ int irq;
-+
-+ for (irq = base; irq < end; irq++) {
-+ irq_set_chip_data(irq, tahvo);
-+ irq_set_chip_and_handler(irq, &tahvo_irq_chip,
-+ handle_simple_irq);
-+ irq_set_nested_thread(irq, 1);
-+ tahvo_irq_setup(irq);
-+ }
-+}
-+
-+/* -------------------------------------------------------------------------- */
-+
-+static struct resource generic_resources[] = {
-+ {
-+ .start = -EINVAL, /* fixed later */
-+ .flags = IORESOURCE_IRQ,
-+ },
-+};
-+
-+static struct device *tahvo_allocate_child(const char *name,
-+ struct device *parent, int irq)
-+{
-+ struct platform_device *pdev;
-+ int ret;
-+
-+ pdev = platform_device_alloc(name, -1);
-+ if (!pdev) {
-+ dev_dbg(parent, "can't allocate %s\n", name);
-+ goto err0;
-+ }
-+
-+ pdev->dev.parent = parent;
-+
-+ if (irq > 0) {
-+ generic_resources[0].start = irq;
-+
-+ ret = platform_device_add_resources(pdev, generic_resources,
-+ ARRAY_SIZE(generic_resources));
-+ if (ret < 0) {
-+ dev_dbg(parent, "can't add resources to %s\n", name);
-+ goto err1;
-+ }
-+ }
-+
-+ ret = platform_device_add(pdev);
-+ if (ret < 0) {
-+ dev_dbg(parent, "can't add %s\n", name);
-+ goto err1;
-+ }
-+
-+ return &pdev->dev;
-+
-+err1:
-+ platform_device_put(pdev);
-+
-+err0:
-+ return NULL;
-+}
-+
-+static int tahvo_allocate_children(struct device *parent, int irq_base)
-+{
-+ struct device *child;
-+
-+ child = tahvo_allocate_child("tahvo-usb", parent,
-+ irq_base + TAHVO_INT_VBUSON);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ child = tahvo_allocate_child("tahvo-pwm", parent, -1);
-+ if (!child)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+static int __devinit tahvo_probe(struct platform_device *pdev)
-+{
-+ struct tahvo *tahvo;
-+ int rev;
-+ int ret;
-+ int irq;
-+ int id;
-+
-+ tahvo = kzalloc(sizeof(*tahvo), GFP_KERNEL);
-+ if (!tahvo) {
-+ dev_err(&pdev->dev, "not enough memory\n");
-+ ret = -ENOMEM;
-+ goto err0;
-+ }
-+
-+ irq = platform_get_irq(pdev, 0);
-+ platform_set_drvdata(pdev, tahvo);
-+
-+ mutex_init(&tahvo->mutex);
-+
-+ ret = irq_alloc_descs(-1, 0, MAX_TAHVO_IRQ_HANDLERS, 0);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "failed to allocate IRQ descs\n");
-+ goto err1;
-+ }
-+
-+ tahvo->irq_base = ret;
-+ tahvo->irq_end = ret + MAX_TAHVO_IRQ_HANDLERS;
-+ tahvo->dev = &pdev->dev;
-+ tahvo->irq = irq;
-+
-+ tahvo_irq_init(tahvo);
-+
-+ rev = __tahvo_read_reg(tahvo, TAHVO_REG_ASICR);
-+
-+ id = (rev >> 8) & 0xff;
-+
-+ if (id == 0x0b)
-+ tahvo->is_betty = true;
-+
-+ ret = tahvo_allocate_children(&pdev->dev, tahvo->irq_base);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "failed to allocate children\n");
-+ goto err2;
-+ }
-+
-+ dev_err(&pdev->dev, "%s v%d.%d found\n",
-+ tahvo->is_betty ? "Betty" : "Tahvo",
-+ (rev >> 4) & 0x0f, rev & 0x0f);
-+
-+ /* Mask all TAHVO interrupts */
-+ __tahvo_write_reg(tahvo, TAHVO_REG_IMR, 0xffff);
-+
-+ ret = request_threaded_irq(irq, NULL, tahvo_irq_handler,
-+ IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-+ "tahvo", tahvo);
-+ if (ret < 0) {
-+ dev_err(&pdev->dev, "Unable to register IRQ handler\n");
-+ goto err2;
-+ }
-+
-+ return 0;
-+
-+err2:
-+ irq_free_descs(tahvo->irq_base, MAX_TAHVO_IRQ_HANDLERS);
-+
-+err1:
-+ kfree(tahvo);
-+
-+err0:
-+ return ret;
-+}
-+
-+static int __devexit tahvo_remove(struct platform_device *pdev)
-+{
-+ struct tahvo *tahvo = platform_get_drvdata(pdev);
-+ int irq;
-+
-+ irq = platform_get_irq(pdev, 0);
-+
-+ free_irq(irq, 0);
-+ irq_free_descs(tahvo->irq_base, MAX_TAHVO_IRQ_HANDLERS);
-+ kfree(tahvo);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver tahvo_driver = {
-+ .probe = tahvo_probe,
-+ .remove = __devexit_p(tahvo_remove),
-+ .driver = {
-+ .name = "tahvo",
-+ },
-+};
-+
-+static int __init tahvo_init(void)
-+{
-+ return platform_driver_register(&tahvo_driver);
-+}
-+subsys_initcall(tahvo_init);
-+
-+static void __exit tahvo_exit(void)
-+{
-+ platform_driver_unregister(&tahvo_driver);
-+}
-+module_exit(tahvo_exit);
-+
-+MODULE_DESCRIPTION("Tahvo ASIC control");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Juha Yrjölä");
-+MODULE_AUTHOR("David Weinehall");
-+MODULE_AUTHOR("Mikko Ylinen");
-+
---- /dev/null
-+++ b/drivers/cbus/tahvo.h
-@@ -0,0 +1,58 @@
-+/*
-+ * drivers/cbus/tahvo.h
-+ *
-+ * Copyright (C) 2004, 2005 Nokia Corporation
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
-+ * David Weinehall <david.weinehall@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef __DRIVERS_CBUS_TAHVO_H
-+#define __DRIVERS_CBUS_TAHVO_H
-+
-+#include <linux/types.h>
-+
-+/* Registers */
-+#define TAHVO_REG_ASICR 0x00 /* ASIC ID & revision */
-+#define TAHVO_REG_IDR 0x01 /* Interrupt ID */
-+#define TAHVO_REG_IDSR 0x02 /* Interrupt status */
-+#define TAHVO_REG_IMR 0x03 /* Interrupt mask */
-+#define TAHVO_REG_CHGCURR 0x04 /* Charge current control PWM (8-bit) */
-+#define TAHVO_REG_LEDPWMR 0x05 /* LED PWM */
-+#define TAHVO_REG_USBR 0x06 /* USB control */
-+#define TAHVO_REG_CHGCTL 0x08 /* Charge control register */
-+#define TAHVO_REG_CHGCTL_EN 0x0001 /* Global charge enable */
-+#define TAHVO_REG_CHGCTL_PWMOVR 0x0004 /* PWM override. Force charge PWM to 0%/100% duty cycle. */
-+#define TAHVO_REG_CHGCTL_PWMOVRZERO 0x0008 /* If set, PWM override is 0% (If unset -> 100%) */
-+#define TAHVO_REG_CHGCTL_CURMEAS 0x0040 /* Enable battery current measurement. */
-+#define TAHVO_REG_CHGCTL_CURTIMRST 0x0080 /* Current measure timer reset. */
-+#define TAHVO_REG_BATCURRTIMER 0x0c /* Battery current measure timer (8-bit) */
-+#define TAHVO_REG_BATCURR 0x0d /* Battery (dis)charge current (signed 16-bit) */
-+
-+#define TAHVO_REG_MAX 0x0d
-+
-+/* Interrupt sources */
-+#define TAHVO_INT_VBUSON 0
-+#define TAHVO_INT_BATCURR 7 /* Battery current measure timer */
-+
-+#define MAX_TAHVO_IRQ_HANDLERS 8
-+
-+int tahvo_read_reg(struct device *child, unsigned reg);
-+void tahvo_write_reg(struct device *child, unsigned reg, u16 val);
-+void tahvo_set_clear_reg_bits(struct device *child, unsigned reg, u16 set,
-+ u16 clear);
-+
-+#endif /* __DRIVERS_CBUS_TAHVO_H */
---- /dev/null
-+++ b/drivers/cbus/tahvo-usb.c
-@@ -0,0 +1,740 @@
-+/**
-+ * drivers/cbus/tahvo-usb.c
-+ *
-+ * Tahvo USB transeiver
-+ *
-+ * Copyright (C) 2005-2006 Nokia Corporation
-+ *
-+ * Parts copied from drivers/i2c/chips/isp1301_omap.c
-+ * Copyright (C) 2004 Texas Instruments
-+ * Copyright (C) 2004 David Brownell
-+ *
-+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
-+ * Tony Lindgren <tony@atomide.com>, and
-+ * Timo Teräs <timo.teras@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/io.h>
-+#include <linux/interrupt.h>
-+#include <linux/platform_device.h>
-+#include <linux/usb/ch9.h>
-+#include <linux/usb/gadget.h>
-+#include <linux/usb.h>
-+#include <linux/usb/otg.h>
-+#include <linux/i2c.h>
-+#include <linux/workqueue.h>
-+#include <linux/kobject.h>
-+#include <linux/clk.h>
-+#include <linux/mutex.h>
-+
-+#include <asm/irq.h>
-+#include <plat/usb.h>
-+
-+#include "cbus.h"
-+#include "tahvo.h"
-+
-+#define DRIVER_NAME "tahvo-usb"
-+
-+#define USBR_SLAVE_CONTROL (1 << 8)
-+#define USBR_VPPVIO_SW (1 << 7)
-+#define USBR_SPEED (1 << 6)
-+#define USBR_REGOUT (1 << 5)
-+#define USBR_MASTER_SW2 (1 << 4)
-+#define USBR_MASTER_SW1 (1 << 3)
-+#define USBR_SLAVE_SW (1 << 2)
-+#define USBR_NSUSPEND (1 << 1)
-+#define USBR_SEMODE (1 << 0)
-+
-+/* bits in OTG_CTRL */
-+
-+/* Bits that are controlled by OMAP OTG and are read-only */
-+#define OTG_CTRL_OMAP_MASK (OTG_PULLDOWN|OTG_PULLUP|OTG_DRV_VBUS|\
-+ OTG_PD_VBUS|OTG_PU_VBUS|OTG_PU_ID)
-+/* Bits that are controlled by transceiver */
-+#define OTG_CTRL_XCVR_MASK (OTG_ASESSVLD|OTG_BSESSEND|\
-+ OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID)
-+/* Bits that are controlled by system */
-+#define OTG_CTRL_SYS_MASK (OTG_A_BUSREQ|OTG_A_SETB_HNPEN|OTG_B_BUSREQ|\
-+ OTG_B_HNPEN|OTG_BUSDROP)
-+
-+#if defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OTG)
-+#error tahvo-otg.c does not work with OCHI yet!
-+#endif
-+
-+#define TAHVO_MODE_HOST 0
-+#define TAHVO_MODE_PERIPHERAL 1
-+
-+#ifdef CONFIG_USB_OTG
-+#define TAHVO_MODE(tu) (tu)->tahvo_mode
-+#elif defined(CONFIG_USB_GADGET_OMAP)
-+#define TAHVO_MODE(tu) TAHVO_MODE_PERIPHERAL
-+#else
-+#define TAHVO_MODE(tu) TAHVO_MODE_HOST
-+#endif
-+
-+struct tahvo_usb {
-+ struct device *dev;
-+ struct platform_device *pt_dev;
-+ struct otg_transceiver otg;
-+ int vbus_state;
-+ struct mutex serialize;
-+#ifdef CONFIG_USB_OTG
-+ int tahvo_mode;
-+#endif
-+ struct clk *ick;
-+
-+ int irq;
-+};
-+static struct tahvo_usb *tahvo_usb_device;
-+
-+/*
-+ * ---------------------------------------------------------------------------
-+ * OTG related functions
-+ *
-+ * These shoud be separated into omap-otg.c driver module, as they are used
-+ * by various transceivers. These functions are needed in the UDC-only case
-+ * as well. These functions are copied from GPL isp1301_omap.c
-+ * ---------------------------------------------------------------------------
-+ */
-+static struct platform_device *tahvo_otg_dev;
-+
-+static irqreturn_t omap_otg_irq(int irq, void *arg)
-+{
-+ u16 otg_irq;
-+
-+ otg_irq = omap_readw(OTG_IRQ_SRC);
-+ if (otg_irq & OPRT_CHG) {
-+ omap_writew(OPRT_CHG, OTG_IRQ_SRC);
-+ } else if (otg_irq & B_SRP_TMROUT) {
-+ omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
-+ } else if (otg_irq & B_HNP_FAIL) {
-+ omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
-+ } else if (otg_irq & A_SRP_DETECT) {
-+ omap_writew(A_SRP_DETECT, OTG_IRQ_SRC);
-+ } else if (otg_irq & A_REQ_TMROUT) {
-+ omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
-+ } else if (otg_irq & A_VBUS_ERR) {
-+ omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
-+ } else if (otg_irq & DRIVER_SWITCH) {
-+#ifdef CONFIG_USB_OTG
-+ if ((!(omap_readl(OTG_CTRL) & OTG_DRIVER_SEL)) &&
-+ tu->otg.host && tu->otg.state == OTG_STATE_A_HOST) {
-+ /* role is host */
-+ usb_bus_start_enum(tu->otg.host,
-+ tu->otg.host->otg_port);
-+ }
-+#endif
-+ omap_writew(DRIVER_SWITCH, OTG_IRQ_SRC);
-+ } else
-+ return IRQ_NONE;
-+
-+ return IRQ_HANDLED;
-+
-+}
-+
-+static int tahvo_otg_init(void)
-+{
-+ u32 l;
-+
-+#ifdef CONFIG_USB_OTG
-+ if (!tahvo_otg_dev) {
-+ printk("tahvo-usb: no tahvo_otg_dev\n");
-+ return -ENODEV;
-+ }
-+#endif
-+
-+ l = omap_readl(OTG_SYSCON_1);
-+ l &= ~OTG_IDLE_EN;
-+ omap_writel(l, OTG_SYSCON_1);
-+ udelay(100);
-+
-+ /* some of these values are board-specific... */
-+ l = omap_readl(OTG_SYSCON_2);
-+ l |= OTG_EN
-+ /* for B-device: */
-+ | SRP_GPDATA /* 9msec Bdev D+ pulse */
-+ | SRP_GPDVBUS /* discharge after VBUS pulse */
-+ // | (3 << 24) /* 2msec VBUS pulse */
-+ /* for A-device: */
-+ | (0 << 20) /* 200ms nominal A_WAIT_VRISE timer */
-+ | SRP_DPW /* detect 167+ns SRP pulses */
-+ | SRP_DATA | SRP_VBUS; /* accept both kinds of SRP pulse */
-+ omap_writel(l, OTG_SYSCON_2);
-+
-+ omap_writew(DRIVER_SWITCH | OPRT_CHG
-+ | B_SRP_TMROUT | B_HNP_FAIL
-+ | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT,
-+ OTG_IRQ_EN);
-+ l = omap_readl(OTG_SYSCON_2);
-+ l |= OTG_EN;
-+ omap_writel(l, OTG_SYSCON_2);
-+
-+ return 0;
-+}
-+
-+static int __init omap_otg_probe(struct platform_device *pdev)
-+{
-+ int ret;
-+
-+ tahvo_otg_dev = pdev;
-+ ret = tahvo_otg_init();
-+ if (ret != 0) {
-+ printk(KERN_ERR "tahvo-usb: tahvo_otg_init failed\n");
-+ return ret;
-+ }
-+
-+ return request_irq(tahvo_otg_dev->resource[1].start,
-+ omap_otg_irq, IRQF_DISABLED, DRIVER_NAME,
-+ tahvo_usb_device);
-+}
-+
-+static int __exit omap_otg_remove(struct platform_device *pdev)
-+{
-+ free_irq(tahvo_otg_dev->resource[1].start, tahvo_usb_device);
-+ tahvo_otg_dev = NULL;
-+
-+ return 0;
-+}
-+
-+struct platform_driver omap_otg_driver = {
-+ .driver = {
-+ .name = "omap_otg",
-+ },
-+ .remove = __exit_p(omap_otg_remove),
-+};
-+
-+/*
-+ * ---------------------------------------------------------------------------
-+ * Tahvo related functions
-+ * These are Nokia proprietary code, except for the OTG register settings,
-+ * which are copied from isp1301.c
-+ * ---------------------------------------------------------------------------
-+ */
-+static ssize_t vbus_state_show(struct device *device,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct tahvo_usb *tu = dev_get_drvdata(device);
-+ return sprintf(buf, "%d\n", tu->vbus_state);
-+}
-+static DEVICE_ATTR(vbus_state, 0444, vbus_state_show, NULL);
-+
-+int vbus_active = 0;
-+
-+static void check_vbus_state(struct tahvo_usb *tu)
-+{
-+ int reg, prev_state;
-+
-+ reg = tahvo_read_reg(tu->dev, TAHVO_REG_IDSR);
-+ if (reg & 0x01) {
-+ u32 l;
-+
-+ vbus_active = 1;
-+ switch (tu->otg.state) {
-+ case OTG_STATE_B_IDLE:
-+ /* Enable the gadget driver */
-+ if (tu->otg.gadget)
-+ usb_gadget_vbus_connect(tu->otg.gadget);
-+ /* Set B-session valid and not B-sessio ended to indicate
-+ * Vbus to be ok. */
-+ l = omap_readl(OTG_CTRL);
-+ l &= ~OTG_BSESSEND;
-+ l |= OTG_BSESSVLD;
-+ omap_writel(l, OTG_CTRL);
-+
-+ tu->otg.state = OTG_STATE_B_PERIPHERAL;
-+ break;
-+ case OTG_STATE_A_IDLE:
-+ /* Session is now valid assuming the USB hub is driving Vbus */
-+ tu->otg.state = OTG_STATE_A_HOST;
-+ break;
-+ default:
-+ break;
-+ }
-+ printk("USB cable connected\n");
-+ } else {
-+ switch (tu->otg.state) {
-+ case OTG_STATE_B_PERIPHERAL:
-+ if (tu->otg.gadget)
-+ usb_gadget_vbus_disconnect(tu->otg.gadget);
-+ tu->otg.state = OTG_STATE_B_IDLE;
-+ break;
-+ case OTG_STATE_A_HOST:
-+ tu->otg.state = OTG_STATE_A_IDLE;
-+ break;
-+ default:
-+ break;
-+ }
-+ printk("USB cable disconnected\n");
-+ vbus_active = 0;
-+ }
-+
-+ prev_state = tu->vbus_state;
-+ tu->vbus_state = reg & 0x01;
-+ if (prev_state != tu->vbus_state)
-+ sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
-+}
-+
-+static void tahvo_usb_become_host(struct tahvo_usb *tu)
-+{
-+ u32 l;
-+
-+ /* Clear system and transceiver controlled bits
-+ * also mark the A-session is always valid */
-+ tahvo_otg_init();
-+
-+ l = omap_readl(OTG_CTRL);
-+ l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK);
-+ l |= OTG_ASESSVLD;
-+ omap_writel(l, OTG_CTRL);
-+
-+ /* Power up the transceiver in USB host mode */
-+ tahvo_write_reg(tu->dev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
-+ USBR_MASTER_SW2 | USBR_MASTER_SW1);
-+ tu->otg.state = OTG_STATE_A_IDLE;
-+
-+ check_vbus_state(tu);
-+}
-+
-+static void tahvo_usb_stop_host(struct tahvo_usb *tu)
-+{
-+ tu->otg.state = OTG_STATE_A_IDLE;
-+}
-+
-+static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
-+{
-+ u32 l;
-+
-+ /* Clear system and transceiver controlled bits
-+ * and enable ID to mark peripheral mode and
-+ * BSESSEND to mark no Vbus */
-+ tahvo_otg_init();
-+ l = omap_readl(OTG_CTRL);
-+ l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
-+ l |= OTG_ID | OTG_BSESSEND;
-+ omap_writel(l, OTG_CTRL);
-+
-+ /* Power up transceiver and set it in USB perhiperal mode */
-+ tahvo_write_reg(tu->dev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | USBR_NSUSPEND | USBR_SLAVE_SW);
-+ tu->otg.state = OTG_STATE_B_IDLE;
-+
-+ check_vbus_state(tu);
-+}
-+
-+static void tahvo_usb_stop_peripheral(struct tahvo_usb *tu)
-+{
-+ u32 l;
-+
-+ l = omap_readl(OTG_CTRL);
-+ l &= ~OTG_BSESSVLD;
-+ l |= OTG_BSESSEND;
-+ omap_writel(l, OTG_CTRL);
-+
-+ if (tu->otg.gadget)
-+ usb_gadget_vbus_disconnect(tu->otg.gadget);
-+ tu->otg.state = OTG_STATE_B_IDLE;
-+
-+}
-+
-+static void tahvo_usb_power_off(struct tahvo_usb *tu)
-+{
-+ u32 l;
-+ int id;
-+
-+ /* Disable gadget controller if any */
-+ if (tu->otg.gadget)
-+ usb_gadget_vbus_disconnect(tu->otg.gadget);
-+
-+ /* Disable OTG and interrupts */
-+ if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
-+ id = OTG_ID;
-+ else
-+ id = 0;
-+ l = omap_readl(OTG_CTRL);
-+ l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
-+ l |= id | OTG_BSESSEND;
-+ omap_writel(l, OTG_CTRL);
-+ omap_writew(0, OTG_IRQ_EN);
-+
-+ l = omap_readl(OTG_SYSCON_2);
-+ l &= ~OTG_EN;
-+ omap_writel(l, OTG_SYSCON_2);
-+
-+ l = omap_readl(OTG_SYSCON_1);
-+ l |= OTG_IDLE_EN;
-+ omap_writel(l, OTG_SYSCON_1);
-+
-+ /* Power off transceiver */
-+ tahvo_write_reg(tu->dev, TAHVO_REG_USBR, 0);
-+ tu->otg.state = OTG_STATE_UNDEFINED;
-+}
-+
-+
-+static int tahvo_usb_set_power(struct otg_transceiver *dev, unsigned mA)
-+{
-+ struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
-+
-+ dev_dbg(&tu->pt_dev->dev, "set_power %d mA\n", mA);
-+
-+ if (dev->state == OTG_STATE_B_PERIPHERAL) {
-+ /* REVISIT: Can Tahvo charge battery from VBUS? */
-+ }
-+ return 0;
-+}
-+
-+static int tahvo_usb_set_suspend(struct otg_transceiver *dev, int suspend)
-+{
-+ struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
-+ u16 w;
-+
-+ dev_dbg(&tu->pt_dev->dev, "set_suspend\n");
-+
-+ w = tahvo_read_reg(tu->dev, TAHVO_REG_USBR);
-+ if (suspend)
-+ w &= ~USBR_NSUSPEND;
-+ else
-+ w |= USBR_NSUSPEND;
-+ tahvo_write_reg(tu->dev, TAHVO_REG_USBR, w);
-+
-+ return 0;
-+}
-+
-+static int tahvo_usb_start_srp(struct otg_transceiver *dev)
-+{
-+ struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
-+ u32 otg_ctrl;
-+
-+ dev_dbg(&tu->pt_dev->dev, "start_srp\n");
-+
-+ if (!dev || tu->otg.state != OTG_STATE_B_IDLE)
-+ return -ENODEV;
-+
-+ otg_ctrl = omap_readl(OTG_CTRL);
-+ if (!(otg_ctrl & OTG_BSESSEND))
-+ return -EINVAL;
-+
-+ otg_ctrl |= OTG_B_BUSREQ;
-+ otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_SYS_MASK;
-+ omap_writel(otg_ctrl, OTG_CTRL);
-+ tu->otg.state = OTG_STATE_B_SRP_INIT;
-+
-+ return 0;
-+}
-+
-+static int tahvo_usb_start_hnp(struct otg_transceiver *otg)
-+{
-+ struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
-+
-+ dev_dbg(&tu->pt_dev->dev, "start_hnp\n");
-+#ifdef CONFIG_USB_OTG
-+ /* REVISIT: Add this for OTG */
-+#endif
-+ return -EINVAL;
-+}
-+
-+static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host)
-+{
-+ struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
-+ u32 l;
-+
-+ dev_dbg(&tu->pt_dev->dev, "set_host %p\n", host);
-+
-+ if (otg == NULL)
-+ return -ENODEV;
-+
-+#if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP)
-+
-+ mutex_lock(&tu->serialize);
-+
-+ if (host == NULL) {
-+ if (TAHVO_MODE(tu) == TAHVO_MODE_HOST)
-+ tahvo_usb_power_off(tu);
-+ tu->otg.host = NULL;
-+ mutex_unlock(&tu->serialize);
-+ return 0;
-+ }
-+
-+ l = omap_readl(OTG_SYSCON_1);
-+ l &= ~(OTG_IDLE_EN | HST_IDLE_EN | DEV_IDLE_EN);
-+ omap_writel(l, OTG_SYSCON_1);
-+
-+ if (TAHVO_MODE(tu) == TAHVO_MODE_HOST) {
-+ tu->otg.host = NULL;
-+ tahvo_usb_become_host(tu);
-+ }
-+
-+ tu->otg.host = host;
-+
-+ mutex_unlock(&tu->serialize);
-+#else
-+ /* No host mode configured, so do not allow host controlled to be set */
-+ return -EINVAL;
-+#endif
-+
-+ return 0;
-+}
-+
-+static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
-+{
-+ struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
-+
-+ dev_dbg(&tu->pt_dev->dev, "set_peripheral %p\n", gadget);
-+
-+ if (!otg)
-+ return -ENODEV;
-+
-+#if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP)
-+
-+ mutex_lock(&tu->serialize);
-+
-+ if (!gadget) {
-+ if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
-+ tahvo_usb_power_off(tu);
-+ tu->otg.gadget = NULL;
-+ mutex_unlock(&tu->serialize);
-+ return 0;
-+ }
-+
-+ tu->otg.gadget = gadget;
-+ if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
-+ tahvo_usb_become_peripheral(tu);
-+
-+ mutex_unlock(&tu->serialize);
-+#else
-+ /* No gadget mode configured, so do not allow host controlled to be set */
-+ return -EINVAL;
-+#endif
-+
-+ return 0;
-+}
-+
-+static irqreturn_t tahvo_usb_vbus_interrupt(int irq, void *_tu)
-+{
-+ struct tahvo_usb *tu = _tu;
-+
-+ check_vbus_state(tu);
-+
-+ return IRQ_HANDLED;
-+}
-+
-+#ifdef CONFIG_USB_OTG
-+static ssize_t otg_mode_show(struct device *device,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct tahvo_usb *tu = dev_get_drvdata(device);
-+ switch (tu->tahvo_mode) {
-+ case TAHVO_MODE_HOST:
-+ return sprintf(buf, "host\n");
-+ case TAHVO_MODE_PERIPHERAL:
-+ return sprintf(buf, "peripheral\n");
-+ }
-+ return sprintf(buf, "unknown\n");
-+}
-+
-+static ssize_t otg_mode_store(struct device *device,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct tahvo_usb *tu = dev_get_drvdata(device);
-+ int r;
-+
-+ r = strlen(buf);
-+ mutex_lock(&tu->serialize);
-+ if (strncmp(buf, "host", 4) == 0) {
-+ if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL)
-+ tahvo_usb_stop_peripheral(tu);
-+ tu->tahvo_mode = TAHVO_MODE_HOST;
-+ if (tu->otg.host) {
-+ printk(KERN_INFO "Selected HOST mode: host controller present.\n");
-+ tahvo_usb_become_host(tu);
-+ } else {
-+ printk(KERN_INFO "Selected HOST mode: no host controller, powering off.\n");
-+ tahvo_usb_power_off(tu);
-+ }
-+ } else if (strncmp(buf, "peripheral", 10) == 0) {
-+ if (tu->tahvo_mode == TAHVO_MODE_HOST)
-+ tahvo_usb_stop_host(tu);
-+ tu->tahvo_mode = TAHVO_MODE_PERIPHERAL;
-+ if (tu->otg.gadget) {
-+ printk(KERN_INFO "Selected PERIPHERAL mode: gadget driver present.\n");
-+ tahvo_usb_become_peripheral(tu);
-+ } else {
-+ printk(KERN_INFO "Selected PERIPHERAL mode: no gadget driver, powering off.\n");
-+ tahvo_usb_power_off(tu);
-+ }
-+ } else
-+ r = -EINVAL;
-+
-+ mutex_unlock(&tu->serialize);
-+ return r;
-+}
-+
-+static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
-+#endif
-+
-+static int __init tahvo_usb_probe(struct platform_device *pdev)
-+{
-+ struct tahvo_usb *tu;
-+ struct device *dev = &pdev->dev;
-+ int ret;
-+ int irq;
-+
-+ dev_dbg(dev, "probe\n");
-+
-+ /* Create driver data */
-+ tu = kzalloc(sizeof(*tu), GFP_KERNEL);
-+ if (!tu)
-+ return -ENOMEM;
-+ tahvo_usb_device = tu;
-+
-+ tu->dev = dev;
-+ tu->pt_dev = pdev;
-+#ifdef CONFIG_USB_OTG
-+ /* Default mode */
-+#ifdef CONFIG_CBUS_TAHVO_USB_HOST_BY_DEFAULT
-+ tu->tahvo_mode = TAHVO_MODE_HOST;
-+#else
-+ tu->tahvo_mode = TAHVO_MODE_PERIPHERAL;
-+#endif
-+#endif
-+
-+ mutex_init(&tu->serialize);
-+
-+ tu->ick = clk_get(NULL, "usb_l4_ick");
-+ if (IS_ERR(tu->ick)) {
-+ dev_err(dev, "Failed to get usb_l4_ick\n");
-+ ret = PTR_ERR(tu->ick);
-+ goto err_free_tu;
-+ }
-+ clk_enable(tu->ick);
-+
-+ /* Set initial state, so that we generate kevents only on
-+ * state changes */
-+ tu->vbus_state = tahvo_read_reg(tu->dev, TAHVO_REG_IDSR) & 0x01;
-+
-+ irq = platform_get_irq(pdev, 0);
-+ tu->irq = irq;
-+
-+ /* We cannot enable interrupt until omap_udc is initialized */
-+ ret = request_threaded_irq(irq, NULL, tahvo_usb_vbus_interrupt,
-+ IRQF_ONESHOT, "tahvo-vbus", tu);
-+ if (ret != 0) {
-+ printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
-+ goto err_release_clk;
-+ }
-+
-+ /* Attributes */
-+ ret = device_create_file(dev, &dev_attr_vbus_state);
-+#ifdef CONFIG_USB_OTG
-+ ret |= device_create_file(dev, &dev_attr_otg_mode);
-+#endif
-+ if (ret)
-+ printk(KERN_ERR "attribute creation failed: %d\n", ret);
-+
-+ /* Create OTG interface */
-+ tahvo_usb_power_off(tu);
-+ tu->otg.state = OTG_STATE_UNDEFINED;
-+ tu->otg.label = DRIVER_NAME;
-+ tu->otg.set_host = tahvo_usb_set_host;
-+ tu->otg.set_peripheral = tahvo_usb_set_peripheral;
-+ tu->otg.set_power = tahvo_usb_set_power;
-+ tu->otg.set_suspend = tahvo_usb_set_suspend;
-+ tu->otg.start_srp = tahvo_usb_start_srp;
-+ tu->otg.start_hnp = tahvo_usb_start_hnp;
-+
-+ ret = otg_set_transceiver(&tu->otg);
-+ if (ret < 0) {
-+ printk(KERN_ERR "Cannot register USB transceiver\n");
-+ goto err_free_irq;
-+ }
-+
-+ dev_set_drvdata(dev, tu);
-+
-+ return 0;
-+
-+err_free_irq:
-+ free_irq(tu->irq, tu);
-+err_release_clk:
-+ clk_disable(tu->ick);
-+ clk_put(tu->ick);
-+err_free_tu:
-+ kfree(tu);
-+ tahvo_usb_device = NULL;
-+
-+ return ret;
-+}
-+
-+static int __exit tahvo_usb_remove(struct platform_device *pdev)
-+{
-+ struct tahvo_usb *tu = platform_get_drvdata(pdev);
-+
-+ dev_dbg(&pdev->dev, "remove\n");
-+
-+ free_irq(tu->irq, tu);
-+ flush_scheduled_work();
-+ otg_set_transceiver(0);
-+ device_remove_file(&pdev->dev, &dev_attr_vbus_state);
-+#ifdef CONFIG_USB_OTG
-+ device_remove_file(&pdev->dev, &dev_attr_otg_mode);
-+#endif
-+ clk_disable(tu->ick);
-+ clk_put(tu->ick);
-+
-+ kfree(tu);
-+ tahvo_usb_device = NULL;
-+
-+ return 0;
-+}
-+
-+static struct platform_driver tahvo_usb_driver = {
-+ .driver = {
-+ .name = "tahvo-usb",
-+ },
-+ .remove = __exit_p(tahvo_usb_remove),
-+};
-+
-+static int __init tahvo_usb_init(void)
-+{
-+ int ret = 0;
-+
-+ ret = platform_driver_probe(&tahvo_usb_driver, tahvo_usb_probe);
-+ if (ret)
-+ return ret;
-+
-+ ret = platform_driver_probe(&omap_otg_driver, omap_otg_probe);
-+ if (ret) {
-+ platform_driver_unregister(&tahvo_usb_driver);
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+subsys_initcall(tahvo_usb_init);
-+
-+static void __exit tahvo_usb_exit(void)
-+{
-+ platform_driver_unregister(&omap_otg_driver);
-+ platform_driver_unregister(&tahvo_usb_driver);
-+}
-+module_exit(tahvo_usb_exit);
-+
-+MODULE_DESCRIPTION("Tahvo USB OTG Transceiver Driver");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Juha Yrjölä, Tony Lindgren, and Timo Teräs");
---- a/drivers/Makefile
-+++ b/drivers/Makefile
-@@ -78,7 +78,7 @@ obj-$(CONFIG_GAMEPORT) += input/gamepor
- obj-$(CONFIG_INPUT) += input/
- obj-$(CONFIG_I2O) += message/
- obj-$(CONFIG_RTC_LIB) += rtc/
--obj-y += i2c/ media/
-+obj-y += i2c/ media/ cbus/
- obj-$(CONFIG_PPS) += pps/
- obj-$(CONFIG_PTP_1588_CLOCK) += ptp/
- obj-$(CONFIG_W1) += w1/
---- a/drivers/Kconfig
-+++ b/drivers/Kconfig
-@@ -2,6 +2,8 @@ menu "Device Drivers"
-
- source "drivers/base/Kconfig"
-
-+source "drivers/cbus/Kconfig"
-+
- source "drivers/connector/Kconfig"
-
- source "drivers/mtd/Kconfig"
diff --git a/target/linux/omap24xx/patches-3.3/251-cbus-tahvo-lock-fix.patch b/target/linux/omap24xx/patches-3.3/251-cbus-tahvo-lock-fix.patch
deleted file mode 100644
index be406716ae..0000000000
--- a/target/linux/omap24xx/patches-3.3/251-cbus-tahvo-lock-fix.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/cbus/tahvo.c
-+++ b/drivers/cbus/tahvo.c
-@@ -104,7 +104,9 @@ void tahvo_write_reg(struct device *chil
- {
- struct tahvo *tahvo = dev_get_drvdata(child->parent);
-
-+ mutex_lock(&tahvo->mutex);
- __tahvo_write_reg(tahvo, reg, val);
-+ mutex_unlock(&tahvo->mutex);
- }
- EXPORT_SYMBOL(tahvo_write_reg);
-
diff --git a/target/linux/omap24xx/patches-3.3/252-cbus-retu-tahvo-ack-fix.patch b/target/linux/omap24xx/patches-3.3/252-cbus-retu-tahvo-ack-fix.patch
deleted file mode 100644
index 86f2f770e9..0000000000
--- a/target/linux/omap24xx/patches-3.3/252-cbus-retu-tahvo-ack-fix.patch
+++ /dev/null
@@ -1,142 +0,0 @@
---- a/drivers/cbus/retu.c
-+++ b/drivers/cbus/retu.c
-@@ -53,9 +53,6 @@ struct retu {
-
- int irq;
-
-- int ack;
-- bool ack_pending;
--
- int mask;
- bool mask_pending;
-
-@@ -191,9 +188,10 @@ static irqreturn_t retu_irq_handler(int
- mutex_lock(&retu->mutex);
- idr = __retu_read_reg(retu, RETU_REG_IDR);
- imr = __retu_read_reg(retu, RETU_REG_IMR);
-+ idr &= ~imr;
-+ __retu_write_reg(retu, RETU_REG_IDR, idr);
- mutex_unlock(&retu->mutex);
-
-- idr &= ~imr;
- if (!idr) {
- dev_vdbg(retu->dev, "No IRQ, spurious?\n");
- return IRQ_NONE;
-@@ -232,15 +230,6 @@ static void retu_irq_unmask(struct irq_d
-
- }
-
--static void retu_irq_ack(struct irq_data *data)
--{
-- struct retu *retu = irq_data_get_irq_chip_data(data);
-- int irq = data->irq;
--
-- retu->ack |= (1 << (irq - retu->irq_base));
-- retu->ack_pending = true;
--}
--
- static void retu_bus_lock(struct irq_data *data)
- {
- struct retu *retu = irq_data_get_irq_chip_data(data);
-@@ -257,11 +246,6 @@ static void retu_bus_sync_unlock(struct
- retu->mask_pending = false;
- }
-
-- if (retu->ack_pending) {
-- __retu_write_reg(retu, RETU_REG_IDR, retu->ack);
-- retu->ack_pending = false;
-- }
--
- mutex_unlock(&retu->mutex);
- }
-
-@@ -271,7 +255,6 @@ static struct irq_chip retu_irq_chip = {
- .irq_bus_sync_unlock = retu_bus_sync_unlock,
- .irq_mask = retu_irq_mask,
- .irq_unmask = retu_irq_unmask,
-- .irq_ack = retu_irq_ack,
- };
-
- static inline void retu_irq_setup(int irq)
-@@ -291,8 +274,7 @@ static void retu_irq_init(struct retu *r
-
- for (irq = base; irq < end; irq++) {
- irq_set_chip_data(irq, retu);
-- irq_set_chip_and_handler(irq, &retu_irq_chip,
-- handle_simple_irq);
-+ irq_set_chip(irq, &retu_irq_chip);
- irq_set_nested_thread(irq, 1);
- retu_irq_setup(irq);
- }
---- a/drivers/cbus/tahvo.c
-+++ b/drivers/cbus/tahvo.c
-@@ -48,11 +48,9 @@ struct tahvo {
- int irq_end;
- int irq;
-
-- int ack;
- int mask;
-
- unsigned int mask_pending:1;
-- unsigned int ack_pending:1;
- unsigned int is_betty:1;
- };
-
-@@ -138,9 +136,12 @@ static irqreturn_t tahvo_irq_handler(int
- u16 id;
- u16 im;
-
-+ mutex_lock(&tahvo->mutex);
- id = __tahvo_read_reg(tahvo, TAHVO_REG_IDR);
- im = __tahvo_read_reg(tahvo, TAHVO_REG_IMR);
- id &= ~im;
-+ __tahvo_write_reg(tahvo, TAHVO_REG_IDR, id);
-+ mutex_unlock(&tahvo->mutex);
-
- if (!id) {
- dev_vdbg(tahvo->dev, "No IRQ, spurious ?\n");
-@@ -177,11 +178,6 @@ static void tahvo_irq_bus_sync_unlock(st
- tahvo->mask_pending = false;
- }
-
-- if (tahvo->ack_pending) {
-- __tahvo_write_reg(tahvo, TAHVO_REG_IDR, tahvo->ack);
-- tahvo->ack_pending = false;
-- }
--
- mutex_unlock(&tahvo->mutex);
- }
-
-@@ -203,22 +199,12 @@ static void tahvo_irq_unmask(struct irq_
- tahvo->mask_pending = true;
- }
-
--static void tahvo_irq_ack(struct irq_data *data)
--{
-- struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
-- int irq = data->irq;
--
-- tahvo->ack |= (1 << (irq - tahvo->irq_base));
-- tahvo->ack_pending = true;
--}
--
- static struct irq_chip tahvo_irq_chip = {
- .name = "tahvo",
- .irq_bus_lock = tahvo_irq_bus_lock,
- .irq_bus_sync_unlock = tahvo_irq_bus_sync_unlock,
- .irq_mask = tahvo_irq_mask,
- .irq_unmask = tahvo_irq_unmask,
-- .irq_ack = tahvo_irq_ack,
- };
-
- static inline void tahvo_irq_setup(int irq)
-@@ -238,8 +224,7 @@ static void tahvo_irq_init(struct tahvo
-
- for (irq = base; irq < end; irq++) {
- irq_set_chip_data(irq, tahvo);
-- irq_set_chip_and_handler(irq, &tahvo_irq_chip,
-- handle_simple_irq);
-+ irq_set_chip(irq, &tahvo_irq_chip);
- irq_set_nested_thread(irq, 1);
- tahvo_irq_setup(irq);
- }
diff --git a/target/linux/omap24xx/patches-3.3/254-cbus-retu-tahvo-irq-mask-init-fix.patch b/target/linux/omap24xx/patches-3.3/254-cbus-retu-tahvo-irq-mask-init-fix.patch
deleted file mode 100644
index a1be6b793e..0000000000
--- a/target/linux/omap24xx/patches-3.3/254-cbus-retu-tahvo-irq-mask-init-fix.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/drivers/cbus/retu.c
-+++ b/drivers/cbus/retu.c
-@@ -451,7 +451,8 @@ static int __devinit retu_probe(struct p
- (rev >> 4) & 0x07, rev & 0x0f);
-
- /* Mask all RETU interrupts */
-- __retu_write_reg(retu, RETU_REG_IMR, 0xffff);
-+ retu->mask = 0xFFFF;
-+ __retu_write_reg(retu, RETU_REG_IMR, retu->mask);
-
- ret = request_threaded_irq(retu->irq, NULL, retu_irq_handler,
- IRQF_ONESHOT, "retu", retu);
---- a/drivers/cbus/tahvo.c
-+++ b/drivers/cbus/tahvo.c
-@@ -346,7 +346,8 @@ static int __devinit tahvo_probe(struct
- (rev >> 4) & 0x0f, rev & 0x0f);
-
- /* Mask all TAHVO interrupts */
-- __tahvo_write_reg(tahvo, TAHVO_REG_IMR, 0xffff);
-+ tahvo->mask = 0xFFFF;
-+ __tahvo_write_reg(tahvo, TAHVO_REG_IMR, tahvo->mask);
-
- ret = request_threaded_irq(irq, NULL, tahvo_irq_handler,
- IRQF_TRIGGER_RISING | IRQF_ONESHOT,
diff --git a/target/linux/omap24xx/patches-3.3/300-cbus-platform.patch b/target/linux/omap24xx/patches-3.3/300-cbus-platform.patch
deleted file mode 100644
index 7f0c7b4bfc..0000000000
--- a/target/linux/omap24xx/patches-3.3/300-cbus-platform.patch
+++ /dev/null
@@ -1,175 +0,0 @@
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -15,8 +15,11 @@
- #include <linux/delay.h>
- #include <linux/gpio.h>
- #include <linux/init.h>
-+#include <linux/irq.h>
- #include <linux/io.h>
- #include <linux/stddef.h>
-+#include <linux/platform_device.h>
-+#include <linux/platform_data/cbus.h>
- #include <linux/i2c.h>
- #include <linux/spi/spi.h>
- #include <linux/usb/musb.h>
-@@ -193,6 +196,110 @@ static struct omap_onenand_platform_data
- };
- #endif
-
-+#if defined(CONFIG_CBUS) || defined(CONFIG_CBUS_MODULE)
-+
-+static struct cbus_host_platform_data n8x0_cbus_data = {
-+ .clk_gpio = 66,
-+ .dat_gpio = 65,
-+ .sel_gpio = 64,
-+};
-+
-+static struct platform_device n8x0_cbus_device = {
-+ .name = "cbus",
-+ .id = -1,
-+ .dev = {
-+ .platform_data = &n8x0_cbus_data,
-+ },
-+};
-+
-+static struct resource retu_resource[] = {
-+ {
-+ .start = -EINVAL, /* set later */
-+ .flags = IORESOURCE_IRQ,
-+ },
-+};
-+
-+static struct cbus_retu_platform_data n8x0_retu_data = {
-+ .devid = CBUS_RETU_DEVICE_ID,
-+};
-+
-+static struct platform_device retu_device = {
-+ .name = "retu",
-+ .id = -1,
-+ .resource = retu_resource,
-+ .num_resources = ARRAY_SIZE(retu_resource),
-+ .dev = {
-+ .platform_data = &n8x0_retu_data,
-+ .parent = &n8x0_cbus_device.dev,
-+ },
-+};
-+
-+static struct resource tahvo_resource[] = {
-+ {
-+ .start = -EINVAL, /* set later */
-+ .flags = IORESOURCE_IRQ,
-+ }
-+};
-+
-+static struct platform_device tahvo_device = {
-+ .name = "tahvo",
-+ .id = -1,
-+ .resource = tahvo_resource,
-+ .num_resources = ARRAY_SIZE(tahvo_resource),
-+ .dev = {
-+ .parent = &n8x0_cbus_device.dev,
-+ },
-+};
-+
-+static void __init n8x0_cbus_init(void)
-+{
-+ int ret;
-+
-+ platform_device_register(&n8x0_cbus_device);
-+
-+ ret = gpio_request(108, "RETU irq");
-+ if (ret < 0) {
-+ pr_err("retu: Unable to reserve IRQ GPIO\n");
-+ return;
-+ }
-+
-+ ret = gpio_direction_input(108);
-+ if (ret < 0) {
-+ pr_err("retu: Unable to change gpio direction\n");
-+ gpio_free(108);
-+ return;
-+ }
-+
-+ irq_set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
-+ retu_resource[0].start = gpio_to_irq(108);
-+ platform_device_register(&retu_device);
-+
-+ ret = gpio_request(111, "TAHVO irq");
-+ if (ret) {
-+ pr_err("tahvo: Unable to reserve IRQ GPIO\n");
-+ gpio_free(108);
-+ return;
-+ }
-+
-+ /* Set the pin as input */
-+ ret = gpio_direction_input(111);
-+ if (ret) {
-+ pr_err("tahvo: Unable to change direction\n");
-+ gpio_free(108);
-+ gpio_free(111);
-+ return;
-+ }
-+
-+ tahvo_resource[0].start = gpio_to_irq(111);
-+ platform_device_register(&tahvo_device);
-+}
-+
-+#else
-+static inline void __init n8x0_cbus_init(void)
-+{
-+}
-+#endif
-+
- #if defined(CONFIG_MENELAUS) && \
- (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
-
-@@ -671,6 +778,8 @@ static inline void board_serial_init(voi
- static void __init n8x0_init_machine(void)
- {
- omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-+ n8x0_cbus_init();
-+
- /* FIXME: add n810 spi devices */
- spi_register_board_info(n800_spi_board_info,
- ARRAY_SIZE(n800_spi_board_info));
---- /dev/null
-+++ b/include/linux/platform_data/cbus.h
-@@ -0,0 +1,38 @@
-+/*
-+ * cbus.h - CBUS platform_data definition
-+ *
-+ * Copyright (C) 2004 - 2009 Nokia Corporation
-+ *
-+ * Written by Felipe Balbi <felipe.balbi@nokia.com>
-+ *
-+ * This file is subject to the terms and conditions of the GNU General
-+ * Public License. See the file "COPYING" in the main directory of this
-+ * archive for more details.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef __INCLUDE_LINUX_CBUS_H
-+#define __INCLUDE_LINUX_CBUS_H
-+
-+#define CBUS_RETU_DEVICE_ID 0x01
-+#define CBUS_TAHVO_DEVICE_ID 0x02
-+
-+struct cbus_host_platform_data {
-+ int dat_gpio;
-+ int clk_gpio;
-+ int sel_gpio;
-+};
-+
-+struct cbus_retu_platform_data {
-+ int devid;
-+};
-+
-+#endif /* __INCLUDE_LINUX_CBUS_H */
diff --git a/target/linux/omap24xx/patches-3.3/309-omapfb-circular-mutex-workaround.patch b/target/linux/omap24xx/patches-3.3/309-omapfb-circular-mutex-workaround.patch
deleted file mode 100644
index e5e083e241..0000000000
--- a/target/linux/omap24xx/patches-3.3/309-omapfb-circular-mutex-workaround.patch
+++ /dev/null
@@ -1,41 +0,0 @@
---- a/drivers/video/omap/omapfb_main.c
-+++ b/drivers/video/omap/omapfb_main.c
-@@ -420,10 +420,10 @@ static void set_fb_fix(struct fb_info *f
- fbi->screen_base = rg->vaddr;
-
- if (!from_init) {
-- mutex_lock(&fbi->mm_lock);
-+ preempt_disable();
- fix->smem_start = rg->paddr;
- fix->smem_len = rg->size;
-- mutex_unlock(&fbi->mm_lock);
-+ preempt_enable();
- } else {
- fix->smem_start = rg->paddr;
- fix->smem_len = rg->size;
-@@ -933,10 +933,10 @@ static int omapfb_setup_mem(struct fb_in
- * plane memory is dealloce'd, the other
- * screen parameters in var / fix are invalid.
- */
-- mutex_lock(&fbi->mm_lock);
-+ preempt_disable();
- fbi->fix.smem_start = 0;
- fbi->fix.smem_len = 0;
-- mutex_unlock(&fbi->mm_lock);
-+ preempt_enable();
- }
- }
- }
---- a/drivers/video/fbmem.c
-+++ b/drivers/video/fbmem.c
-@@ -1383,8 +1383,10 @@ fb_mmap(struct file *file, struct vm_are
- }
-
- /* frame buffer memory */
-+ preempt_disable();
- start = info->fix.smem_start;
- len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
-+ preempt_enable();
- if (off >= len) {
- /* memory mapped io */
- off -= len;
diff --git a/target/linux/omap24xx/patches-3.3/310-n810-lcd.patch b/target/linux/omap24xx/patches-3.3/310-n810-lcd.patch
deleted file mode 100644
index 2ee79f2de5..0000000000
--- a/target/linux/omap24xx/patches-3.3/310-n810-lcd.patch
+++ /dev/null
@@ -1,368 +0,0 @@
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -24,6 +24,7 @@
- #include <linux/spi/spi.h>
- #include <linux/usb/musb.h>
- #include <sound/tlv320aic3x.h>
-+#include <linux/spi/tsc2005.h>
-
- #include <asm/mach/arch.h>
- #include <asm/mach-types.h>
-@@ -43,6 +44,66 @@ static int slot1_cover_open;
- static int slot2_cover_open;
- static struct device *mmc_device;
-
-+#define RX51_TSC2005_RESET_GPIO 94
-+#define RX51_TSC2005_IRQ_GPIO 106
-+
-+#ifdef CONFIG_TOUCHSCREEN_TSC2005
-+static struct tsc2005_platform_data tsc2005_config;
-+static void rx51_tsc2005_set_reset(bool enable)
-+{
-+ gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
-+}
-+
-+static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
-+ .turbo_mode = 0,
-+ .single_channel = 1,
-+};
-+#endif
-+
-+static void __init tsc2005_set_config(void)
-+{
-+ const struct omap_lcd_config *conf;
-+
-+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
-+ if (conf != NULL) {
-+#ifdef CONFIG_TOUCHSCREEN_TSC2005
-+ if (strcmp(conf->panel_name, "lph8923") == 0) {
-+ tsc2005_config.ts_x_plate_ohm = 180;
-+ tsc2005_config.ts_pressure_max = 2048;
-+ tsc2005_config.ts_pressure_fudge = 2;
-+ tsc2005_config.ts_x_max = 4096;
-+ tsc2005_config.ts_x_fudge = 4;
-+ tsc2005_config.ts_y_max = 4096;
-+ tsc2005_config.ts_y_fudge = 7;
-+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
-+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
-+ tsc2005_config.ts_x_plate_ohm = 280;
-+ tsc2005_config.ts_pressure_max = 2048;
-+ tsc2005_config.ts_pressure_fudge = 2;
-+ tsc2005_config.ts_x_max = 4096;
-+ tsc2005_config.ts_x_fudge = 4;
-+ tsc2005_config.ts_y_max = 4096;
-+ tsc2005_config.ts_y_fudge = 7;
-+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
-+ } else {
-+ printk(KERN_ERR "Unknown panel type, set default "
-+ "touchscreen configuration\n");
-+ tsc2005_config.ts_x_plate_ohm = 200;
-+ }
-+#endif
-+ }
-+}
-+
-+static struct omap2_mcspi_device_config mipid_mcspi_config = {
-+ .turbo_mode = 0,
-+ .single_channel = 1,
-+};
-+
-+extern struct mipid_platform_data n8x0_mipid_platform_data;
-+
-+extern void n8x0_mipid_init(void);
-+extern void n8x0_blizzard_init(void);
-+
- #define TUSB6010_ASYNC_CS 1
- #define TUSB6010_SYNC_CS 4
- #define TUSB6010_GPIO_INT 58
-@@ -145,12 +206,29 @@ static struct omap2_mcspi_device_config
-
- static struct spi_board_info n800_spi_board_info[] __initdata = {
- {
-+ .modalias = "lcd_mipid",
-+ .bus_num = 1,
-+ .chip_select = 1,
-+ .max_speed_hz = 4000000,
-+ .controller_data= &mipid_mcspi_config,
-+ .platform_data = &n8x0_mipid_platform_data,
-+ },
-+ {
- .modalias = "p54spi",
- .bus_num = 2,
- .chip_select = 0,
- .max_speed_hz = 48000000,
- .controller_data = &p54spi_mcspi_config,
- },
-+ {
-+ .modalias = "tsc2005",
-+ .bus_num = 1,
-+ .chip_select = 0,
-+ .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
-+ .max_speed_hz = 6000000,
-+ .controller_data = &tsc2005_mcspi_config,
-+ .platform_data = &tsc2005_config,
-+ },
- };
-
- #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-@@ -781,6 +859,7 @@ static void __init n8x0_init_machine(voi
- n8x0_cbus_init();
-
- /* FIXME: add n810 spi devices */
-+ tsc2005_set_config();
- spi_register_board_info(n800_spi_board_info,
- ARRAY_SIZE(n800_spi_board_info));
- omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
-@@ -790,6 +869,8 @@ static void __init n8x0_init_machine(voi
- i2c_register_board_info(2, n810_i2c_board_info_2,
- ARRAY_SIZE(n810_i2c_board_info_2));
- board_serial_init();
-+ n8x0_mipid_init();
-+ n8x0_blizzard_init();
- omap_sdrc_init(NULL, NULL);
- gpmc_onenand_init(board_onenand_data);
- n8x0_mmc_init();
---- /dev/null
-+++ b/arch/arm/mach-omap2/board-n8x0-lcd.c
-@@ -0,0 +1,231 @@
-+/*
-+ * linux/arch/arm/mach-omap2/board-n8x0.c
-+ *
-+ * Copyright (C) 2005-2009 Nokia Corporation
-+ * Author: Juha Yrjola <juha.yrjola@nokia.com>
-+ *
-+ * Modified from mach-omap2/board-generic.c
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/clk.h>
-+#include <linux/delay.h>
-+#include <linux/gpio.h>
-+#include <linux/omapfb.h>
-+
-+#include <plat/lcd_mipid.h>
-+#include <plat/blizzard.h>
-+
-+#include "../../../drivers/cbus/tahvo.h"
-+
-+
-+struct tahvo_pwm_device {
-+ struct device *dev;
-+ int tahvo_7bit_backlight;
-+};
-+
-+static struct tahvo_pwm_device *tahvo_pwm;
-+
-+static unsigned int tahvo_pwm_get_backlight_level(struct tahvo_pwm_device *pd)
-+{
-+ unsigned int mask;
-+
-+ if (pd->tahvo_7bit_backlight)
-+ mask = 0x7f;
-+ else
-+ mask = 0x0f;
-+ return tahvo_read_reg(pd->dev, TAHVO_REG_LEDPWMR) & mask;
-+}
-+
-+static unsigned int tahvo_pwm_get_max_backlight_level(struct tahvo_pwm_device *pd)
-+{
-+ if (pd->tahvo_7bit_backlight)
-+ return 0x7f;
-+ return 0x0f;
-+}
-+
-+static void tahvo_pwm_set_backlight_level(struct tahvo_pwm_device *pd, unsigned int level)
-+{
-+ unsigned int max_level;
-+
-+ max_level = tahvo_pwm_get_max_backlight_level(pd);
-+ if (level > max_level)
-+ level = max_level;
-+ tahvo_write_reg(pd->dev, TAHVO_REG_LEDPWMR, level);
-+}
-+
-+static int __init n8x0_tahvo_pwm_probe(struct platform_device *pdev)
-+{
-+ struct tahvo_pwm_device *pd;
-+ unsigned int rev, id;
-+
-+ pd = kzalloc(sizeof(*pd), GFP_KERNEL);
-+ if (WARN_ON(!pd))
-+ return -ENOMEM;
-+ pd->dev = &pdev->dev;
-+
-+ rev = tahvo_read_reg(pd->dev, TAHVO_REG_ASICR);
-+ id = (rev >> 8) & 0xff;
-+ if (id == 0x03) {
-+ if ((rev & 0xff) >= 0x50)
-+ pd->tahvo_7bit_backlight = 1;
-+ } else if (id == 0x0b)
-+ pd->tahvo_7bit_backlight = 1;
-+
-+ dev_set_drvdata(pd->dev, pd);
-+ tahvo_pwm = pd;
-+
-+ return 0;
-+}
-+
-+static struct platform_driver n8x0_tahvo_pwm_driver = {
-+ .driver = {
-+ .name = "tahvo-pwm",
-+ },
-+};
-+
-+static int __init n8x0_tahvo_pwm_init(void)
-+{
-+ return platform_driver_probe(&n8x0_tahvo_pwm_driver, n8x0_tahvo_pwm_probe);
-+}
-+fs_initcall(n8x0_tahvo_pwm_init);
-+
-+static int n8x0_get_backlight_level(struct mipid_platform_data *pdata)
-+{
-+ return tahvo_pwm_get_backlight_level(tahvo_pwm);
-+}
-+
-+static int n8x0_get_max_backlight_level(struct mipid_platform_data *pdata)
-+{
-+ return tahvo_pwm_get_max_backlight_level(tahvo_pwm);
-+}
-+
-+static void n8x0_set_backlight_level(struct mipid_platform_data *pdata, int level)
-+{
-+ tahvo_pwm_set_backlight_level(tahvo_pwm, level);
-+}
-+
-+#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
-+
-+// MIPID LCD Panel
-+
-+static void mipid_shutdown(struct mipid_platform_data *pdata)
-+{
-+ if (pdata->nreset_gpio != -1) {
-+ pr_info("shutdown LCD\n");
-+ gpio_set_value(pdata->nreset_gpio, 0);
-+ msleep(120);
-+ }
-+}
-+
-+struct mipid_platform_data n8x0_mipid_platform_data = {
-+ .shutdown = mipid_shutdown,
-+ .get_bklight_level = n8x0_get_backlight_level,
-+ .set_bklight_level = n8x0_set_backlight_level,
-+ .get_bklight_max = n8x0_get_max_backlight_level,
-+};
-+
-+void __init n8x0_mipid_init(void)
-+{
-+ const struct omap_lcd_config *conf;
-+ int err;
-+
-+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
-+ if (conf != NULL) {
-+ n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
-+ n8x0_mipid_platform_data.data_lines = conf->data_lines;
-+ if (conf->nreset_gpio != -1) {
-+ err = gpio_request(conf->nreset_gpio, "MIPID nreset");
-+ if (err) {
-+ printk(KERN_ERR "N8x0 MIPID failed to request nreset GPIO %d\n",
-+ conf->nreset_gpio);
-+ } else {
-+ err = gpio_direction_output(conf->nreset_gpio, 1);
-+ if (err) {
-+ printk(KERN_ERR "N8x0 MIPID failed to set nreset GPIO %d\n",
-+ conf->nreset_gpio);
-+ }
-+ }
-+ }
-+ printk(KERN_INFO "N8x0 MIPID config loaded");
-+ }
-+ else
-+ printk(KERN_INFO "N8x0 MIPID config not provided");
-+}
-+
-+
-+// Epson Blizzard LCD Controller
-+
-+static struct {
-+ struct clk *sys_ck;
-+} blizzard;
-+
-+static int blizzard_get_clocks(void)
-+{
-+ blizzard.sys_ck = clk_get(0, "osc_ck");
-+ if (IS_ERR(blizzard.sys_ck)) {
-+ printk(KERN_ERR "can't get Blizzard clock\n");
-+ return PTR_ERR(blizzard.sys_ck);
-+ }
-+ return 0;
-+}
-+
-+static unsigned long blizzard_get_clock_rate(struct device *dev)
-+{
-+ return clk_get_rate(blizzard.sys_ck);
-+}
-+
-+static void blizzard_enable_clocks(int enable)
-+{
-+ if (enable)
-+ clk_enable(blizzard.sys_ck);
-+ else
-+ clk_disable(blizzard.sys_ck);
-+}
-+
-+static void blizzard_power_up(struct device *dev)
-+{
-+ /* Vcore to 1.475V */
-+ tahvo_set_clear_reg_bits(tahvo_pwm->dev, 0x07, 0, 0xf);
-+ msleep(10);
-+
-+ blizzard_enable_clocks(1);
-+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
-+}
-+
-+static void blizzard_power_down(struct device *dev)
-+{
-+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
-+ blizzard_enable_clocks(0);
-+
-+ /* Vcore to 1.005V */
-+ tahvo_set_clear_reg_bits(tahvo_pwm->dev, 0x07, 0xf, 0);
-+}
-+
-+static struct blizzard_platform_data n8x0_blizzard_data = {
-+ .power_up = blizzard_power_up,
-+ .power_down = blizzard_power_down,
-+ .get_clock_rate = blizzard_get_clock_rate,
-+ .te_connected = 1,
-+};
-+
-+void __init n8x0_blizzard_init(void)
-+{
-+ int r;
-+
-+ r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
-+ if (r < 0)
-+ {
-+ printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
-+ return;
-+ }
-+ gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
-+
-+ blizzard_get_clocks();
-+ omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
-+
-+ printk(KERN_INFO "N8x0 Blizzard initialized");
-+}
---- a/arch/arm/mach-omap2/Makefile
-+++ b/arch/arm/mach-omap2/Makefile
-@@ -205,6 +205,7 @@ obj-$(CONFIG_MACH_OMAP3EVM) += board-om
- obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
- obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o
- obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
-+obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0-lcd.o
- obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \
- sdram-nokia.o
- obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
diff --git a/target/linux/omap24xx/patches-3.3/311-omapfb-clock-fixes.patch b/target/linux/omap24xx/patches-3.3/311-omapfb-clock-fixes.patch
deleted file mode 100644
index 6df6958204..0000000000
--- a/target/linux/omap24xx/patches-3.3/311-omapfb-clock-fixes.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/drivers/video/omap/dispc.c
-+++ b/drivers/video/omap/dispc.c
-@@ -923,14 +923,14 @@ static int get_dss_clocks(void)
- return PTR_ERR(dispc.dss_ick);
- }
-
-- dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "fck");
-+ dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
- if (IS_ERR(dispc.dss1_fck)) {
- dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
- clk_put(dispc.dss_ick);
- return PTR_ERR(dispc.dss1_fck);
- }
-
-- dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_clk");
-+ dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss_54m_fck");
- if (IS_ERR(dispc.dss_54m_fck)) {
- dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
- clk_put(dispc.dss_ick);
---- a/drivers/video/omap/rfbi.c
-+++ b/drivers/video/omap/rfbi.c
-@@ -90,7 +90,7 @@ static int rfbi_get_clocks(void)
- return PTR_ERR(rfbi.dss_ick);
- }
-
-- rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "fck");
-+ rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck");
- if (IS_ERR(rfbi.dss1_fck)) {
- dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
- clk_put(rfbi.dss_ick);
diff --git a/target/linux/omap24xx/patches-3.3/312-no-hwmod-reset.patch b/target/linux/omap24xx/patches-3.3/312-no-hwmod-reset.patch
deleted file mode 100644
index 65c14ab3a7..0000000000
--- a/target/linux/omap24xx/patches-3.3/312-no-hwmod-reset.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/arch/arm/mach-omap2/omap_hwmod.c
-+++ b/arch/arm/mach-omap2/omap_hwmod.c
-@@ -146,6 +146,8 @@
- #include <plat/omap_hwmod.h>
- #include <plat/prcm.h>
-
-+#include <asm/mach-types.h>
-+
- #include "cm2xxx_3xxx.h"
- #include "cminst44xx.h"
- #include "prm2xxx_3xxx.h"
-@@ -1769,6 +1771,16 @@ static int _setup(struct omap_hwmod *oh,
-
- oh->_state = _HWMOD_STATE_INITIALIZED;
-
-+ if (machine_is_nokia770() ||
-+ machine_is_nokia_n800() ||
-+ machine_is_nokia_n810() ||
-+ machine_is_nokia_n810_wimax()) {
-+ /* Nokia N-series workaround: Don't reset any hwmod. Some drivers expect
-+ * the NOLO bootloader initializations to be effective. */
-+ oh->flags |= HWMOD_INIT_NO_RESET;
-+ printk_once(KERN_INFO "Nokia N-series HWMOD_INIT_NO_RESET workaround enabled\n");
-+ }
-+
- /*
- * In the case of hwmod with hardreset that should not be
- * de-assert at boot time, we have to keep the module
diff --git a/target/linux/omap24xx/patches-3.3/315-n800-touchscreen-and-keypad-drivers.patch b/target/linux/omap24xx/patches-3.3/315-n800-touchscreen-and-keypad-drivers.patch
deleted file mode 100644
index 106a5d80c8..0000000000
--- a/target/linux/omap24xx/patches-3.3/315-n800-touchscreen-and-keypad-drivers.patch
+++ /dev/null
@@ -1,2791 +0,0 @@
-From 63e56392b9024aceb610d7b4e1979e2d2cebd217 Mon Sep 17 00:00:00 2001
-From: Marat Radchenko <marat@slonopotamus.org>
-Date: Tue, 18 Oct 2011 21:48:23 +0400
-Subject: [PATCH 1/2] TSC2301 driver (touchscreen and keypad)
-
-This patch adds support for TSC2301 touchscreen/keypad/audio chip found on Nokia N800.
-Touchscreen and keypad are fully functional, audio part only provides power management.
----
- drivers/input/keyboard/Kconfig | 6 +
- drivers/input/keyboard/Makefile | 1 +
- drivers/input/keyboard/tsc2301_kp.c | 475 +++++++++++++++
- drivers/input/touchscreen/Kconfig | 6 +
- drivers/input/touchscreen/Makefile | 1 +
- drivers/input/touchscreen/tsc2301_ts.c | 676 +++++++++++++++++++++
- drivers/spi/Kconfig | 22 +
- drivers/spi/Makefile | 3 +
- drivers/spi/tsc2301-core.c | 297 ++++++++++
- drivers/spi/tsc2301-mixer.c | 1003 ++++++++++++++++++++++++++++++++
- include/linux/spi/tsc2301.h | 208 +++++++
- 11 files changed, 2698 insertions(+), 0 deletions(-)
- create mode 100644 drivers/input/keyboard/tsc2301_kp.c
- create mode 100644 drivers/input/touchscreen/tsc2301_ts.c
- create mode 100644 drivers/spi/tsc2301-core.c
- create mode 100644 drivers/spi/tsc2301-mixer.c
- create mode 100644 include/linux/spi/tsc2301.h
-
---- a/drivers/input/keyboard/Kconfig
-+++ b/drivers/input/keyboard/Kconfig
-@@ -547,6 +547,12 @@ config KEYBOARD_TNETV107X
- To compile this driver as a module, choose M here: the
- module will be called tnetv107x-keypad.
-
-+config KEYBOARD_TSC2301
-+ tristate "TSC2301 keypad support"
-+ depends on SPI_TSC2301
-+ help
-+ Say Y here for if you are using the keypad features of TSC2301.
-+
- config KEYBOARD_TWL4030
- tristate "TI TWL4030/TWL5030/TPS659x0 keypad support"
- depends on TWL4030_CORE
---- a/drivers/input/keyboard/Makefile
-+++ b/drivers/input/keyboard/Makefile
-@@ -49,6 +49,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd
- obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o
- obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o
- obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o
-+obj-$(CONFIG_KEYBOARD_TSC2301) += tsc2301_kp.o
- obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o
- obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
- obj-$(CONFIG_KEYBOARD_W90P910) += w90p910_keypad.o
---- /dev/null
-+++ b/drivers/input/keyboard/tsc2301_kp.c
-@@ -0,0 +1,475 @@
-+/*
-+ * TSC2301 keypad driver
-+ *
-+ * Copyright (C) 2005-2006 Nokia Corporation
-+ *
-+ * Written by Jarkko Oikarinen
-+ * Rewritten by Juha Yrjola <juha.yrjola@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/input.h>
-+#include <linux/interrupt.h>
-+#include <linux/irq.h>
-+#include <linux/delay.h>
-+#include <linux/spi/spi.h>
-+
-+#include <linux/spi/tsc2301.h>
-+
-+#define TSC2301_KEYBOARD_PRODUCT_ID 0x0051
-+#define TSC2301_KEYBOARD_PRODUCT_VERSION 0x0001
-+#define TSC2301_DEBOUNCE_TIME_2MS 0x0000
-+#define TSC2301_DEBOUNCE_TIME_10MS 0x0800
-+#define TSC2301_DEBOUNCE_TIME_20MS 0x1000
-+#define TSC2301_DEBOUNCE_TIME_50MS 0x1800
-+#define TSC2301_DEBOUNCE_TIME_60MS 0x2000
-+#define TSC2301_DEBOUNCE_TIME_80MS 0x2800
-+#define TSC2301_DEBOUNCE_TIME_100MS 0x3000
-+#define TSC2301_DEBOUNCE_TIME_120MS 0x3800
-+
-+#define TSC2301_DEBOUNCE_TIME TSC2301_DEBOUNCE_TIME_20MS
-+
-+#define TSC2301_RELEASE_TIMEOUT 50
-+
-+struct tsc2301_kp {
-+ struct input_dev *idev;
-+ char phys[32];
-+ spinlock_t lock;
-+ struct mutex mutex;
-+ struct timer_list timer;
-+ u16 keys_pressed;
-+ unsigned pending:1;
-+ unsigned user_disabled:1;
-+ unsigned disable_depth;
-+
-+ struct spi_transfer read_xfer[4];
-+ struct spi_message read_msg;
-+
-+ u16 data;
-+ u16 mask;
-+
-+ int irq;
-+ s16 keymap[16];
-+};
-+
-+static inline int tsc2301_kp_disabled(struct tsc2301 *tsc)
-+{
-+ return tsc->kp->disable_depth != 0;
-+}
-+
-+static void tsc2301_kp_send_key_events(struct tsc2301 *tsc,
-+ u16 prev_state,
-+ u16 new_state)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+ u16 common, released, pressed;
-+ int i;
-+
-+ common = prev_state & new_state;
-+ released = common ^ prev_state;
-+ pressed = common ^ new_state;
-+ if (!released && !pressed)
-+ return;
-+ for (i = 0; i < 16 && (released || pressed); i++) {
-+ if (released & 1) {
-+ dev_dbg(&tsc->spi->dev, "key %d released\n", i);
-+ input_report_key(kp->idev, kp->keymap[i], 0);
-+ }
-+ released >>= 1;
-+ if (pressed & 1) {
-+ dev_dbg(&tsc->spi->dev, "key %d pressed\n", i);
-+ input_report_key(kp->idev, kp->keymap[i], 1);
-+ }
-+ pressed >>= 1;
-+ }
-+ input_sync(kp->idev);
-+}
-+
-+static inline void _filter_out(struct tsc2301 *tsc, u16 prev_state,
-+ u16 *new_state, int row1, int row2, u8 rect_pat)
-+{
-+ u16 mask;
-+
-+ mask = (rect_pat << (row1 * 4)) | (rect_pat << (row2 * 4));
-+ mask &= ~prev_state;
-+ *new_state &= ~mask;
-+ dev_dbg(&tsc->spi->dev, "filtering ghost keys %02x\n", mask);
-+}
-+
-+static void tsc2301_filter_ghost_keys(struct tsc2301 *tsc, u16 prev_state,
-+ u16 *new_state)
-+{
-+ int row1, row2;
-+ u16 key_map;
-+ u16 row1_map;
-+ static const u8 rect_pat[] = {
-+ 0x3, 0x5, 0x9, 0x6, 0xa, 0xc, 0,
-+ };
-+
-+ key_map = *new_state;
-+ for (row1 = 0; row1 < 4; row1++) {
-+ row1_map = (key_map >> (row1 * 4)) & 0xf;
-+ if (!row1_map)
-+ continue;
-+ for (row2 = row1 + 1; row2 < 4; row2++) {
-+ u16 rect_map = (key_map >> (row2 * 4)) & 0xf;
-+ const u8 *rp;
-+
-+ rect_map &= row1_map;
-+ if (!rect_map)
-+ continue;
-+ for (rp = rect_pat; *rp; rp++)
-+ if ((rect_map & *rp) == *rp)
-+ _filter_out(tsc, prev_state, new_state,
-+ row1, row2, *rp);
-+ }
-+ }
-+}
-+
-+static void tsc2301_kp_timer(unsigned long arg)
-+{
-+ struct tsc2301 *tsc = (void *) arg;
-+ struct tsc2301_kp *kp = tsc->kp;
-+ unsigned long flags;
-+
-+ tsc2301_kp_send_key_events(tsc, kp->keys_pressed, 0);
-+ spin_lock_irqsave(&kp->lock, flags);
-+ kp->keys_pressed = 0;
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+}
-+
-+static void tsc2301_kp_rx(void *arg)
-+{
-+ struct tsc2301 *tsc = arg;
-+ struct tsc2301_kp *kp = tsc->kp;
-+ unsigned long flags;
-+ u16 kp_data;
-+
-+ kp_data = kp->data;
-+ dev_dbg(&tsc->spi->dev, "KP data %04x\n", kp_data);
-+
-+ tsc2301_filter_ghost_keys(tsc, kp->keys_pressed, &kp_data);
-+ tsc2301_kp_send_key_events(tsc, kp->keys_pressed, kp_data);
-+ spin_lock_irqsave(&kp->lock, flags);
-+ kp->keys_pressed = kp_data;
-+ kp->pending = 0;
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+}
-+
-+static irqreturn_t tsc2301_kp_irq_handler(int irq, void *dev_id)
-+{
-+ struct tsc2301 *tsc = dev_id;
-+ struct tsc2301_kp *kp = tsc->kp;
-+ unsigned long flags;
-+ int r;
-+
-+ spin_lock_irqsave(&kp->lock, flags);
-+ if (tsc2301_kp_disabled(tsc)) {
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+ return IRQ_HANDLED;
-+ }
-+ kp->pending = 1;
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+ mod_timer(&kp->timer,
-+ jiffies + msecs_to_jiffies(TSC2301_RELEASE_TIMEOUT));
-+ r = spi_async(tsc->spi, &tsc->kp->read_msg);
-+ if (r)
-+ dev_err(&tsc->spi->dev, "kp: spi_async() failed");
-+ return IRQ_HANDLED;
-+}
-+
-+static void tsc2301_kp_start_scan(struct tsc2301 *tsc)
-+{
-+ tsc2301_write_reg(tsc, TSC2301_REG_KPMASK, tsc->kp->mask);
-+ tsc2301_write_reg(tsc, TSC2301_REG_KEY, TSC2301_DEBOUNCE_TIME);
-+}
-+
-+static void tsc2301_kp_stop_scan(struct tsc2301 *tsc)
-+{
-+ tsc2301_write_reg(tsc, TSC2301_REG_KEY, 1 << 14);
-+}
-+
-+/* Must be called with the mutex held */
-+static void tsc2301_kp_enable(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&kp->lock, flags);
-+ BUG_ON(!tsc2301_kp_disabled(tsc));
-+ if (--kp->disable_depth != 0) {
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+ return;
-+ }
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+
-+ irq_set_irq_type(kp->irq, IRQ_TYPE_EDGE_FALLING);
-+ tsc2301_kp_start_scan(tsc);
-+ enable_irq(kp->irq);
-+}
-+
-+/* Must be called with the mutex held */
-+static int tsc2301_kp_disable(struct tsc2301 *tsc, int release_keys)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&kp->lock, flags);
-+ if (kp->disable_depth++ != 0) {
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+ goto out;
-+ }
-+ disable_irq_nosync(kp->irq);
-+ irq_set_irq_type(kp->irq, IRQ_TYPE_NONE);
-+ spin_unlock_irqrestore(&kp->lock, flags);
-+
-+ while (kp->pending) {
-+ msleep(1);
-+ }
-+
-+ tsc2301_kp_stop_scan(tsc);
-+out:
-+ if (!release_keys)
-+ del_timer(&kp->timer); /* let timeout release keys */
-+
-+ return 0;
-+}
-+
-+/* The following workaround is needed for a HW bug triggered by the
-+ * following:
-+ * 1. keep any key pressed
-+ * 2. disable keypad
-+ * 3. release all keys
-+ * 4. reenable keypad
-+ * 5. disable touch screen controller
-+ *
-+ * After this the keypad scanner will get stuck in busy state and won't
-+ * report any interrupts for further keypresses. One way to recover is to
-+ * restart the keypad scanner whenever we enable / disable the
-+ * touchscreen controller.
-+ */
-+void tsc2301_kp_restart(struct tsc2301 *tsc)
-+{
-+ if (!tsc2301_kp_disabled(tsc)) {
-+ tsc2301_kp_start_scan(tsc);
-+ }
-+}
-+
-+static ssize_t tsc2301_kp_disable_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%u\n", tsc2301_kp_disabled(tsc) ? 1 : 0);
-+}
-+
-+static ssize_t tsc2301_kp_disable_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_kp *kp = tsc->kp;
-+ char *endp;
-+ int i;
-+
-+ i = simple_strtoul(buf, &endp, 10);
-+ i = i ? 1 : 0;
-+
-+ mutex_lock(&kp->mutex);
-+ if (i == kp->user_disabled) {
-+ mutex_unlock(&kp->mutex);
-+ return count;
-+ }
-+ kp->user_disabled = i;
-+
-+ if (i)
-+ tsc2301_kp_disable(tsc, 1);
-+ else
-+ tsc2301_kp_enable(tsc);
-+ mutex_unlock(&kp->mutex);
-+
-+ return count;
-+}
-+
-+static DEVICE_ATTR(disable_kp, 0664, tsc2301_kp_disable_show,
-+ tsc2301_kp_disable_store);
-+
-+static const u16 tsc2301_kp_read_data = 0x8000 | TSC2301_REG_KPDATA;
-+
-+static void tsc2301_kp_setup_spi_xfer(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+ struct spi_message *m = &kp->read_msg;
-+ struct spi_transfer *x = &kp->read_xfer[0];
-+
-+ spi_message_init(&kp->read_msg);
-+
-+ x->tx_buf = &tsc2301_kp_read_data;
-+ x->len = 2;
-+ spi_message_add_tail(x, m);
-+ x++;
-+
-+ x->rx_buf = &kp->data;
-+ x->len = 2;
-+ spi_message_add_tail(x, m);
-+
-+ m->complete = tsc2301_kp_rx;
-+ m->context = tsc;
-+}
-+
-+#ifdef CONFIG_PM
-+int tsc2301_kp_suspend(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+
-+ mutex_lock(&kp->mutex);
-+ tsc2301_kp_disable(tsc, 1);
-+ mutex_unlock(&kp->mutex);
-+ return 0;
-+}
-+
-+void tsc2301_kp_resume(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+
-+ mutex_lock(&kp->mutex);
-+ tsc2301_kp_enable(tsc);
-+ mutex_unlock(&kp->mutex);
-+}
-+#endif
-+
-+int __devinit tsc2301_kp_init(struct tsc2301 *tsc,
-+ struct tsc2301_platform_data *pdata)
-+{
-+ struct input_dev *idev;
-+ struct tsc2301_kp *kp;
-+ int r, i;
-+ u16 mask;
-+
-+ if (pdata->keyb_int < 0) {
-+ dev_err(&tsc->spi->dev, "need kbirq");
-+ return -EINVAL;
-+ }
-+
-+ kp = kzalloc(sizeof(*kp), GFP_KERNEL);
-+ if (kp == NULL)
-+ return -ENOMEM;
-+ tsc->kp = kp;
-+
-+ kp->irq = pdata->keyb_int;
-+ spin_lock_init(&kp->lock);
-+ mutex_init(&kp->mutex);
-+
-+ init_timer(&kp->timer);
-+ kp->timer.data = (unsigned long) tsc;
-+ kp->timer.function = tsc2301_kp_timer;
-+
-+ idev = input_allocate_device();
-+ if (idev == NULL) {
-+ r = -ENOMEM;
-+ goto err1;
-+ }
-+ if (pdata->keyb_name)
-+ idev->name = pdata->keyb_name;
-+ else
-+ idev->name = "TSC2301 keypad";
-+ snprintf(kp->phys, sizeof(kp->phys), "%s/input-kp", dev_name(&tsc->spi->dev));
-+ idev->phys = kp->phys;
-+
-+ mask = 0;
-+ idev->evbit[0] = BIT(EV_KEY);
-+ for (i = 0; i < 16; i++) {
-+ if (pdata->keymap[i] > 0) {
-+ set_bit(pdata->keymap[i], idev->keybit);
-+ kp->keymap[i] = pdata->keymap[i];
-+ } else {
-+ kp->keymap[i] = -1;
-+ mask |= 1 << i;
-+ }
-+ }
-+
-+ if (pdata->kp_rep)
-+ set_bit(EV_REP, idev->evbit);
-+
-+ kp->idev = idev;
-+
-+ tsc2301_kp_setup_spi_xfer(tsc);
-+
-+ r = device_create_file(&tsc->spi->dev, &dev_attr_disable_kp);
-+ if (r < 0)
-+ goto err2;
-+
-+ tsc2301_kp_start_scan(tsc);
-+
-+ /* IRQ mode 0 is faulty, it can cause the KBIRQ to get stuck.
-+ * Mode 2 deasserts the IRQ at:
-+ * - HW or SW reset
-+ * - Setting SCS flag in REG_KEY register
-+ * - Releasing all keys
-+ * - Reading the REG_KPDATA
-+ */
-+ tsc2301_write_kbc(tsc, 2);
-+
-+ tsc2301_write_reg(tsc, TSC2301_REG_KPMASK, mask);
-+ kp->mask = mask;
-+
-+ irq_set_irq_type(kp->irq, IRQ_TYPE_EDGE_FALLING);
-+
-+ r = request_irq(kp->irq, tsc2301_kp_irq_handler, 0,
-+ "tsc2301-kp", tsc);
-+ if (r < 0) {
-+ dev_err(&tsc->spi->dev, "unable to get kbirq IRQ");
-+ goto err3;
-+ }
-+ irq_set_irq_wake(kp->irq, 1);
-+
-+ /* We need to read the register once..? */
-+ tsc2301_read_reg(tsc, TSC2301_REG_KPDATA);
-+
-+ r = input_register_device(idev);
-+ if (r < 0) {
-+ dev_err(&tsc->spi->dev, "can't register keypad device\n");
-+ goto err4;
-+ }
-+
-+ return 0;
-+
-+err4:
-+ free_irq(kp->irq, tsc);
-+err3:
-+ tsc2301_kp_stop_scan(tsc);
-+ device_remove_file(&tsc->spi->dev, &dev_attr_disable_kp);
-+err2:
-+ input_free_device(kp->idev);
-+err1:
-+ kfree(kp);
-+ return r;
-+}
-+
-+void __devexit tsc2301_kp_exit(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_kp *kp = tsc->kp;
-+
-+ tsc2301_kp_disable(tsc, 1);
-+ input_unregister_device(kp->idev);
-+ free_irq(kp->irq, tsc);
-+ device_remove_file(&tsc->spi->dev, &dev_attr_disable_kp);
-+
-+ kfree(kp);
-+}
---- a/drivers/input/touchscreen/Kconfig
-+++ b/drivers/input/touchscreen/Kconfig
-@@ -726,6 +726,12 @@ config TOUCHSCREEN_TSC2007
- To compile this driver as a module, choose M here: the
- module will be called tsc2007.
-
-+config TOUCHSCREEN_TSC2301
-+ tristate "TSC2301 touchscreen support"
-+ depends on SPI_TSC2301
-+ help
-+ Say Y here for if you are using the touchscreen features of TSC2301.
-+
- config TOUCHSCREEN_W90X900
- tristate "W90P910 touchscreen driver"
- depends on HAVE_CLK
---- a/drivers/input/touchscreen/Makefile
-+++ b/drivers/input/touchscreen/Makefile
-@@ -52,6 +52,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += to
- obj-$(CONFIG_TOUCHSCREEN_TSC_SERIO) += tsc40.o
- obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o
- obj-$(CONFIG_TOUCHSCREEN_TSC2007) += tsc2007.o
-+obj-$(CONFIG_TOUCHSCREEN_TSC2301) += tsc2301_ts.o
- obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
- obj-$(CONFIG_TOUCHSCREEN_WACOM_W8001) += wacom_w8001.o
- obj-$(CONFIG_TOUCHSCREEN_WM831X) += wm831x-ts.o
---- /dev/null
-+++ b/drivers/input/touchscreen/tsc2301_ts.c
-@@ -0,0 +1,676 @@
-+/*
-+ * TSC2301 touchscreen driver
-+ *
-+ * Copyright (C) 2005-2008 Nokia Corporation
-+ *
-+ * Written by Jarkko Oikarinen, Imre Deak and Juha Yrjola
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/input.h>
-+#include <linux/interrupt.h>
-+#include <linux/delay.h>
-+#include <linux/spi/spi.h>
-+
-+#include <linux/spi/tsc2301.h>
-+
-+/**
-+ * The touchscreen interface operates as follows:
-+ *
-+ * Initialize:
-+ * Request access to GPIO103 (DAV)
-+ * tsc2301_ts_irq_handler will trigger when DAV line goes down
-+ *
-+ * 1) Pen is pressed against touchscreeen
-+ * 2) TSC2301 performs AD conversion
-+ * 3) After the conversion is done TSC2301 drives DAV line down
-+ * 4) GPIO IRQ is received and tsc2301_ts_irq_handler is called
-+ * 5) tsc2301_ts_irq_handler queues up an spi transfer to fetch
-+ * the x, y, z1, z2 values
-+ * 6) SPI framework calls tsc2301_ts_rx after the coordinates are read
-+ * 7) When the penup_timer expires, there have not been DAV interrupts
-+ * during the last 20ms which means the pen has been lifted.
-+ */
-+
-+
-+#define TSC2301_TOUCHSCREEN_PRODUCT_ID 0x0052
-+#define TSC2301_TOUCHSCREEN_PRODUCT_VERSION 0x0001
-+
-+#define TSC2301_TS_PENUP_TIME 20
-+
-+#define TSC2301_ADCREG_CONVERSION_CTRL_BY_TSC2301 0x8000
-+#define TSC2301_ADCREG_CONVERSION_CTRL_BY_HOST 0x0000
-+
-+#define TSC2301_ADCREG_FUNCTION_NONE 0x0000
-+#define TSC2301_ADCREG_FUNCTION_XY 0x0400
-+#define TSC2301_ADCREG_FUNCTION_XYZ 0x0800
-+#define TSC2301_ADCREG_FUNCTION_X 0x0C00
-+#define TSC2301_ADCREG_FUNCTION_Y 0x1000
-+#define TSC2301_ADCREG_FUNCTION_Z 0x1400
-+#define TSC2301_ADCREG_FUNCTION_DAT1 0x1800
-+#define TSC2301_ADCREG_FUNCTION_DAT2 0x1C00
-+#define TSC2301_ADCREG_FUNCTION_AUX1 0x2000
-+#define TSC2301_ADCREG_FUNCTION_AUX2 0x2400
-+#define TSC2301_ADCREG_FUNCTION_TEMP 0x2800
-+
-+#define TSC2301_ADCREG_RESOLUTION_8BIT 0x0100
-+#define TSC2301_ADCREG_RESOLUTION_10BIT 0x0200
-+#define TSC2301_ADCREG_RESOLUTION_12BIT 0x0300
-+
-+#define TSC2301_ADCREG_AVERAGING_NONE 0x0000
-+#define TSC2301_ADCREG_AVERAGING_4AVG 0x0040
-+#define TSC2301_ADCREG_AVERAGING_8AVG 0x0080
-+#define TSC2301_ADCREG_AVERAGING_16AVG 0x00C0
-+
-+#define TSC2301_ADCREG_CLOCK_8MHZ 0x0000
-+#define TSC2301_ADCREG_CLOCK_4MHZ 0x0010
-+#define TSC2301_ADCREG_CLOCK_2MHZ 0x0020
-+#define TSC2301_ADCREG_CLOCK_1MHZ 0x0030
-+
-+#define TSC2301_ADCREG_VOLTAGE_STAB_0US 0x0000
-+#define TSC2301_ADCREG_VOLTAGE_STAB_100US 0x0002
-+#define TSC2301_ADCREG_VOLTAGE_STAB_500US 0x0004
-+#define TSC2301_ADCREG_VOLTAGE_STAB_1MS 0x0006
-+#define TSC2301_ADCREG_VOLTAGE_STAB_5MS 0x0008
-+#define TSC2301_ADCREG_VOLTAGE_STAB_10MS 0x000A
-+#define TSC2301_ADCREG_VOLTAGE_STAB_50MS 0x000C
-+#define TSC2301_ADCREG_VOLTAGE_STAB_100MS 0x000E
-+
-+#define TSC2301_ADCREG_STOP_CONVERSION 0x4000
-+
-+#define MAX_12BIT ((1 << 12) - 1)
-+
-+#define TS_RECT_SIZE 8
-+#define TSF_MIN_Z1 100
-+#define TSF_MAX_Z2 4000
-+
-+#define TSF_SAMPLES 4
-+
-+struct ts_filter {
-+ int sample_cnt;
-+
-+ int avg_x;
-+ int avg_y;
-+ int avg_z1;
-+ int avg_z2;
-+};
-+
-+struct ts_coords {
-+ u16 x;
-+ u16 y;
-+ u16 z1;
-+ u16 z2;
-+};
-+
-+struct tsc2301_ts {
-+ struct input_dev *idev;
-+ char phys[32];
-+ struct timer_list penup_timer;
-+ struct mutex mutex;
-+
-+ struct spi_transfer read_xfer[2];
-+ struct spi_message read_msg;
-+ struct ts_coords *coords;
-+
-+ struct ts_filter filter;
-+
-+ int hw_avg_max;
-+ u16 x;
-+ u16 y;
-+ u16 p;
-+
-+ u16 x_plate_ohm;
-+ int stab_time;
-+ int max_pressure;
-+ int touch_pressure;
-+
-+ u8 event_sent;
-+ u8 pen_down;
-+ u8 disabled;
-+ u8 disable_depth;
-+
-+ int hw_flags;
-+ int irq;
-+};
-+
-+
-+static const u16 tsc2301_ts_read_data = 0x8000 | TSC2301_REG_X;
-+
-+static int tsc2301_ts_check_config(struct tsc2301_ts *ts, int *hw_flags)
-+{
-+ int flags;
-+
-+ flags = 0;
-+ switch (ts->hw_avg_max) {
-+ case 0:
-+ flags |= TSC2301_ADCREG_AVERAGING_NONE;
-+ break;
-+ case 4:
-+ flags |= TSC2301_ADCREG_AVERAGING_4AVG;
-+ break;
-+ case 8:
-+ flags |= TSC2301_ADCREG_AVERAGING_8AVG;
-+ break;
-+ case 16:
-+ flags |= TSC2301_ADCREG_AVERAGING_16AVG;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ switch (ts->stab_time) {
-+ case 0:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_0US;
-+ break;
-+ case 100:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_100US;
-+ break;
-+ case 500:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_500US;
-+ break;
-+ case 1000:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_1MS;
-+ break;
-+ case 5000:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_5MS;
-+ break;
-+ case 10000:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_10MS;
-+ break;
-+ case 50000:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_50MS;
-+ break;
-+ case 100000:
-+ flags |= TSC2301_ADCREG_VOLTAGE_STAB_100MS;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ *hw_flags = flags;
-+ return 0;
-+}
-+
-+/*
-+ * This odd three-time initialization is to work around a bug in TSC2301.
-+ * See TSC2301 errata for details.
-+ */
-+static int tsc2301_ts_configure(struct tsc2301 *tsc, int flags)
-+{
-+ struct spi_transfer xfer[5];
-+ struct spi_transfer *x;
-+ struct spi_message m;
-+ int i;
-+ u16 val1, val2, val3;
-+ u16 data[10];
-+
-+ val1 = TSC2301_ADCREG_CONVERSION_CTRL_BY_HOST |
-+ TSC2301_ADCREG_STOP_CONVERSION |
-+ TSC2301_ADCREG_FUNCTION_NONE |
-+ TSC2301_ADCREG_RESOLUTION_12BIT |
-+ TSC2301_ADCREG_AVERAGING_NONE |
-+ TSC2301_ADCREG_CLOCK_2MHZ |
-+ TSC2301_ADCREG_VOLTAGE_STAB_100MS;
-+
-+ val2 = TSC2301_ADCREG_CONVERSION_CTRL_BY_HOST |
-+ TSC2301_ADCREG_FUNCTION_XYZ |
-+ TSC2301_ADCREG_RESOLUTION_12BIT |
-+ TSC2301_ADCREG_AVERAGING_16AVG |
-+ TSC2301_ADCREG_CLOCK_1MHZ |
-+ TSC2301_ADCREG_VOLTAGE_STAB_100MS;
-+
-+ /* Averaging and voltage stabilization settings in flags */
-+ val3 = TSC2301_ADCREG_CONVERSION_CTRL_BY_TSC2301 |
-+ TSC2301_ADCREG_FUNCTION_XYZ |
-+ TSC2301_ADCREG_RESOLUTION_12BIT |
-+ TSC2301_ADCREG_CLOCK_2MHZ |
-+ flags;
-+
-+ /* Now we prepare the command for transferring */
-+ data[0] = TSC2301_REG_ADC;
-+ data[1] = val1;
-+ data[2] = TSC2301_REG_ADC;
-+ data[3] = val2;
-+ data[4] = TSC2301_REG_ADC;
-+ data[5] = val3;
-+ data[6] = TSC2301_REG_REF;
-+ data[7] = 1 << 4 | 1 << 2 | 1; /* intref, 100uS settl, 2.5V ref */
-+ data[8] = TSC2301_REG_CONFIG;
-+ data[9] = 3 << 3 | 2 << 0; /* 340uS pre-chrg, 544us delay */
-+
-+ spi_message_init(&m);
-+ m.spi = tsc->spi;
-+
-+ memset(xfer, 0, sizeof(xfer));
-+ x = &xfer[0];
-+
-+ for (i = 0; i < 10; i += 2) {
-+ x->tx_buf = &data[i];
-+ x->len = 4;
-+ if (i != 8)
-+ x->cs_change = 1;
-+ spi_message_add_tail(x, &m);
-+ x++;
-+ }
-+ spi_sync(m.spi, &m);
-+
-+ return 0;
-+}
-+
-+static void tsc2301_ts_start_scan(struct tsc2301 *tsc)
-+{
-+ tsc2301_ts_configure(tsc, tsc->ts->hw_flags);
-+ tsc2301_kp_restart(tsc);
-+}
-+
-+static void tsc2301_ts_stop_scan(struct tsc2301 *tsc)
-+{
-+ tsc2301_write_reg(tsc, TSC2301_REG_ADC, TSC2301_ADCREG_STOP_CONVERSION);
-+ tsc2301_kp_restart(tsc);
-+}
-+
-+static void update_pen_state(struct tsc2301_ts *ts, int x, int y, int pressure)
-+{
-+ if (pressure) {
-+ input_report_abs(ts->idev, ABS_X, x);
-+ input_report_abs(ts->idev, ABS_Y, y);
-+ input_report_abs(ts->idev, ABS_PRESSURE, pressure);
-+ if (!ts->pen_down)
-+ input_report_key(ts->idev, BTN_TOUCH, 1);
-+ ts->pen_down = 1;
-+ } else {
-+ input_report_abs(ts->idev, ABS_PRESSURE, 0);
-+ if (ts->pen_down)
-+ input_report_key(ts->idev, BTN_TOUCH, 0);
-+ ts->pen_down = 0;
-+ }
-+
-+ input_sync(ts->idev);
-+
-+#ifdef VERBOSE
-+ dev_dbg(&tsc->spi->dev, "x %4d y %4d p %4d\n", x, y, pressure);
-+#endif
-+}
-+
-+static int filter(struct tsc2301_ts *ts, int x, int y, int z1, int z2)
-+{
-+ int inside_rect, pressure_limit, Rt;
-+ struct ts_filter *tsf = &ts->filter;
-+
-+ /* validate pressure and position */
-+ if (x > MAX_12BIT || y > MAX_12BIT)
-+ return 0;
-+
-+ /* skip coords if the pressure-components are out of range */
-+ if (z1 < TSF_MIN_Z1 || z2 > TSF_MAX_Z2)
-+ return 0;
-+
-+ /* Use the x,y,z1,z2 directly on the first "pen down" event */
-+ if (ts->event_sent) {
-+ tsf->avg_x += x;
-+ tsf->avg_y += y;
-+ tsf->avg_z1 += z1;
-+ tsf->avg_z2 += z2;
-+
-+ if (++tsf->sample_cnt < TSF_SAMPLES)
-+ return 0;
-+ x = tsf->avg_x / TSF_SAMPLES;
-+ y = tsf->avg_y / TSF_SAMPLES;
-+ z1 = tsf->avg_z1 / TSF_SAMPLES;
-+ z2 = tsf->avg_z2 / TSF_SAMPLES;
-+ }
-+ tsf->sample_cnt = 0;
-+ tsf->avg_x = 0;
-+ tsf->avg_y = 0;
-+ tsf->avg_z1 = 0;
-+ tsf->avg_z2 = 0;
-+
-+ pressure_limit = ts->event_sent? ts->max_pressure: ts->touch_pressure;
-+
-+ /* z1 is always at least 100: */
-+ Rt = x * (z2 - z1) / z1;
-+ Rt = Rt * ts->x_plate_ohm / 4096;
-+ if (Rt > pressure_limit)
-+ return 0;
-+
-+ /* discard the event if it still is within the previous rect - unless
-+ * if the pressure is harder, but then use previous x,y position */
-+ inside_rect = (
-+ x > (int)ts->x - TS_RECT_SIZE && x < (int)ts->x + TS_RECT_SIZE &&
-+ y > (int)ts->y - TS_RECT_SIZE && y < (int)ts->y + TS_RECT_SIZE);
-+
-+ if (!ts->event_sent || !inside_rect) {
-+ ts->x = x;
-+ ts->y = y;
-+ ts->p = Rt;
-+ return 1;
-+ } else if (Rt < ts->p) {
-+ ts->p = Rt;
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * This procedure is called by the SPI framework after the coordinates
-+ * have been read from TSC2301
-+ */
-+static void tsc2301_ts_rx(void *arg)
-+{
-+ struct tsc2301 *tsc = arg;
-+ struct tsc2301_ts *ts = tsc->ts;
-+ int send_event;
-+ int x, y, z1, z2;
-+
-+ x = ts->coords->x;
-+ y = ts->coords->y;
-+ z1 = ts->coords->z1;
-+ z2 = ts->coords->z2;
-+
-+ send_event = filter(ts, x, y, z1, z2);
-+ if (send_event) {
-+ update_pen_state(ts, ts->x, ts->y, ts->p);
-+ ts->event_sent = 1;
-+ }
-+
-+ mod_timer(&ts->penup_timer,
-+ jiffies + msecs_to_jiffies(TSC2301_TS_PENUP_TIME));
-+}
-+
-+/*
-+ * Timer is called TSC2301_TS_PENUP_TIME after pen is up
-+ */
-+static void tsc2301_ts_timer_handler(unsigned long data)
-+{
-+ struct tsc2301 *tsc = (struct tsc2301 *)data;
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ if (ts->event_sent) {
-+ ts->event_sent = 0;
-+ update_pen_state(ts, 0, 0, 0);
-+ }
-+}
-+
-+/*
-+ * This interrupt is called when pen is down and coordinates are
-+ * available. That is indicated by a falling edge on DEV line.
-+ */
-+static irqreturn_t tsc2301_ts_irq_handler(int irq, void *dev_id)
-+{
-+ struct tsc2301 *tsc = dev_id;
-+ struct tsc2301_ts *ts = tsc->ts;
-+ int r;
-+
-+ r = spi_async(tsc->spi, &ts->read_msg);
-+ if (r)
-+ dev_err(&tsc->spi->dev, "ts: spi_async() failed");
-+
-+ mod_timer(&ts->penup_timer,
-+ jiffies + msecs_to_jiffies(TSC2301_TS_PENUP_TIME));
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static void tsc2301_ts_disable(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ if (ts->disable_depth++ != 0)
-+ return;
-+
-+ disable_irq(ts->irq);
-+
-+ /* wait until penup timer expire normally */
-+ do {
-+ msleep(1);
-+ } while (ts->event_sent);
-+
-+ tsc2301_ts_stop_scan(tsc);
-+}
-+
-+static void tsc2301_ts_enable(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ if (--ts->disable_depth != 0)
-+ return;
-+
-+ enable_irq(ts->irq);
-+
-+ tsc2301_ts_start_scan(tsc);
-+}
-+
-+#ifdef CONFIG_PM
-+int tsc2301_ts_suspend(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ mutex_lock(&ts->mutex);
-+ tsc2301_ts_disable(tsc);
-+ mutex_unlock(&ts->mutex);
-+
-+ return 0;
-+}
-+
-+void tsc2301_ts_resume(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ mutex_lock(&ts->mutex);
-+ tsc2301_ts_enable(tsc);
-+ mutex_unlock(&ts->mutex);
-+}
-+#endif
-+
-+static void tsc2301_ts_setup_spi_xfer(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+ struct spi_message *m = &ts->read_msg;
-+ struct spi_transfer *x = &ts->read_xfer[0];
-+
-+ spi_message_init(m);
-+
-+ x->tx_buf = &tsc2301_ts_read_data;
-+ x->len = 2;
-+ spi_message_add_tail(x, m);
-+
-+ x++;
-+ x->rx_buf = ts->coords;
-+ x->len = 8;
-+ spi_message_add_tail(x, m);
-+
-+ m->complete = tsc2301_ts_rx;
-+ m->context = tsc;
-+}
-+
-+static ssize_t tsc2301_ts_pen_down_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%u\n", tsc->ts->pen_down);
-+}
-+
-+static DEVICE_ATTR(pen_down, S_IRUGO, tsc2301_ts_pen_down_show, NULL);
-+
-+static ssize_t tsc2301_ts_disable_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ return sprintf(buf, "%u\n", ts->disabled);
-+}
-+
-+static ssize_t tsc2301_ts_disable_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_ts *ts = tsc->ts;
-+ char *endp;
-+ int i;
-+
-+ i = simple_strtoul(buf, &endp, 10);
-+ i = i ? 1 : 0;
-+ mutex_lock(&ts->mutex);
-+ if (i == ts->disabled) goto out;
-+ ts->disabled = i;
-+
-+ if (i)
-+ tsc2301_ts_disable(tsc);
-+ else
-+ tsc2301_ts_enable(tsc);
-+out:
-+ mutex_unlock(&ts->mutex);
-+ return count;
-+}
-+
-+static DEVICE_ATTR(disable_ts, 0664, tsc2301_ts_disable_show,
-+ tsc2301_ts_disable_store);
-+
-+int __devinit tsc2301_ts_init(struct tsc2301 *tsc,
-+ struct tsc2301_platform_data *pdata)
-+{
-+ struct tsc2301_ts *ts;
-+ struct input_dev *idev;
-+ int r;
-+ int x_max, y_max;
-+ int x_fudge, y_fudge, p_fudge;
-+
-+ if (pdata->dav_int <= 0) {
-+ dev_err(&tsc->spi->dev, "need DAV IRQ");
-+ return -EINVAL;
-+ }
-+
-+ ts = kzalloc(sizeof(*ts), GFP_KERNEL);
-+ if (ts == NULL)
-+ return -ENOMEM;
-+ tsc->ts = ts;
-+
-+ ts->coords = kzalloc(sizeof(*ts->coords), GFP_KERNEL);
-+ if (ts->coords == NULL) {
-+ kfree(ts);
-+ return -ENOMEM;
-+ }
-+
-+ ts->irq = pdata->dav_int;
-+
-+ init_timer(&ts->penup_timer);
-+ setup_timer(&ts->penup_timer, tsc2301_ts_timer_handler,
-+ (unsigned long)tsc);
-+
-+ mutex_init(&ts->mutex);
-+
-+ ts->x_plate_ohm = pdata->ts_x_plate_ohm ? : 280;
-+ ts->hw_avg_max = pdata->ts_hw_avg;
-+ ts->max_pressure = pdata->ts_max_pressure ? : MAX_12BIT;
-+ ts->touch_pressure = pdata->ts_touch_pressure ? : ts->max_pressure;
-+ ts->stab_time = pdata->ts_stab_time;
-+
-+ x_max = pdata->ts_x_max ? : 4096;
-+ y_max = pdata->ts_y_max ? : 4096;
-+ x_fudge = pdata->ts_x_fudge ? : 4;
-+ y_fudge = pdata->ts_y_fudge ? : 8;
-+ p_fudge = pdata->ts_pressure_fudge ? : 2;
-+
-+ if ((r = tsc2301_ts_check_config(ts, &ts->hw_flags))) {
-+ dev_err(&tsc->spi->dev, "invalid configuration\n");
-+ goto err2;
-+ }
-+
-+ idev = input_allocate_device();
-+ if (idev == NULL) {
-+ r = -ENOMEM;
-+ goto err2;
-+ }
-+ idev->name = "TSC2301 touchscreen";
-+ snprintf(ts->phys, sizeof(ts->phys),
-+ "%s/input-ts", dev_name(&tsc->spi->dev));
-+ idev->phys = ts->phys;
-+ idev->dev.parent = &tsc->spi->dev;
-+
-+ idev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY);
-+ idev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
-+ ts->idev = idev;
-+
-+ tsc2301_ts_setup_spi_xfer(tsc);
-+
-+ /* These parameters should perhaps be configurable? */
-+ input_set_abs_params(idev, ABS_X, 0, x_max, x_fudge, 0);
-+ input_set_abs_params(idev, ABS_Y, 0, y_max, y_fudge, 0);
-+ input_set_abs_params(idev, ABS_PRESSURE, 0, ts->max_pressure,
-+ p_fudge, 0);
-+
-+ tsc2301_ts_start_scan(tsc);
-+
-+ r = request_irq(ts->irq, tsc2301_ts_irq_handler,
-+ IRQF_TRIGGER_FALLING,
-+ "tsc2301-ts", tsc);
-+ if (r < 0) {
-+ dev_err(&tsc->spi->dev, "unable to get DAV IRQ");
-+ goto err3;
-+ }
-+ irq_set_irq_wake(ts->irq, 1);
-+
-+ if (device_create_file(&tsc->spi->dev, &dev_attr_pen_down) < 0)
-+ goto err4;
-+ if (device_create_file(&tsc->spi->dev, &dev_attr_disable_ts) < 0)
-+ goto err5;
-+
-+ r = input_register_device(idev);
-+ if (r < 0) {
-+ dev_err(&tsc->spi->dev, "can't register touchscreen device\n");
-+ goto err6;
-+ }
-+
-+ return 0;
-+err6:
-+ device_remove_file(&tsc->spi->dev, &dev_attr_disable_ts);
-+err5:
-+ device_remove_file(&tsc->spi->dev, &dev_attr_pen_down);
-+err4:
-+ free_irq(ts->irq, tsc);
-+err3:
-+ tsc2301_ts_stop_scan(tsc);
-+ input_free_device(idev);
-+err2:
-+ kfree(ts->coords);
-+ kfree(ts);
-+ return r;
-+}
-+
-+void __devexit tsc2301_ts_exit(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_ts *ts = tsc->ts;
-+
-+ tsc2301_ts_disable(tsc);
-+
-+ device_remove_file(&tsc->spi->dev, &dev_attr_disable_ts);
-+ device_remove_file(&tsc->spi->dev, &dev_attr_pen_down);
-+
-+ free_irq(ts->irq, tsc);
-+ input_unregister_device(ts->idev);
-+
-+ kfree(ts->coords);
-+ kfree(ts);
-+}
-+MODULE_AUTHOR("Jarkko Oikarinen <jarkko.oikarinen@nokia.com>");
-+MODULE_LICENSE("GPL");
---- a/drivers/spi/Kconfig
-+++ b/drivers/spi/Kconfig
-@@ -433,6 +433,28 @@ config SPI_TLE62X0
- sysfs interface, with each line presented as a kind of GPIO
- exposing both switch control and diagnostic feedback.
-
-+config SPI_TSC2301
-+ tristate "TSC2301 driver"
-+ depends on SPI_MASTER
-+ help
-+ Say Y here if you have a TSC2301 chip connected to an SPI
-+ bus on your board.
-+
-+ The TSC2301 is a highly integrated PDA analog interface circuit.
-+ It contains a complete 12-bit A/D resistive touch screen
-+ converter (ADC) including drivers, touch pressure measurement
-+ capability, keypad controller, and 8-bit D/A converter (DAC) output
-+ for LCD contrast control.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called tsc2301.
-+
-+config SPI_TSC2301_AUDIO
-+ boolean "TSC2301 audio support"
-+ depends on SPI_TSC2301 && SND
-+ help
-+ Say Y here for if you are using the audio features of TSC2301.
-+
- #
- # Add new SPI protocol masters in alphabetical order above this line
- #
---- a/drivers/spi/Makefile
-+++ b/drivers/spi/Makefile
-@@ -59,4 +59,6 @@ obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x
- obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
- obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
- obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
--
-+obj-$(CONFIG_SPI_TSC2301) += tsc2301.o
-+tsc2301-objs := tsc2301-core.o
-+tsc2301-$(CONFIG_SPI_TSC2301_AUDIO) += tsc2301-mixer.o
---- /dev/null
-+++ b/drivers/spi/tsc2301-core.c
-@@ -0,0 +1,297 @@
-+/*
-+ * TSC2301 driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/device.h>
-+#include <linux/delay.h>
-+#include <linux/gpio.h>
-+#include <linux/spi/spi.h>
-+#include <linux/spi/tsc2301.h>
-+
-+u16 tsc2301_read_reg(struct tsc2301 *tsc, int reg)
-+{
-+ struct spi_transfer t[2];
-+ struct spi_message m;
-+ u16 data = 0, cmd;
-+
-+ cmd = reg;
-+ cmd |= 0x8000;
-+
-+ memset(t, 0, sizeof(t));
-+ spi_message_init(&m);
-+ m.spi = tsc->spi;
-+
-+ t[0].tx_buf = &cmd;
-+ t[0].rx_buf = NULL;
-+ t[0].len = 2;
-+ spi_message_add_tail(&t[0], &m);
-+
-+ t[1].tx_buf = NULL;
-+ t[1].rx_buf = &data;
-+ t[1].len = 2;
-+ spi_message_add_tail(&t[1], &m);
-+
-+ spi_sync(m.spi, &m);
-+
-+ return data;
-+}
-+
-+void tsc2301_write_reg(struct tsc2301 *tsc, int reg, u16 val)
-+{
-+ struct spi_transfer t;
-+ struct spi_message m;
-+ u16 data[2];
-+
-+ /* Now we prepare the command for transferring */
-+ data[0] = reg;
-+ data[1] = val;
-+
-+ spi_message_init(&m);
-+ m.spi = tsc->spi;
-+
-+ memset(&t, 0, sizeof(t));
-+ t.tx_buf = data;
-+ t.rx_buf = NULL;
-+ t.len = 4;
-+ spi_message_add_tail(&t, &m);
-+
-+ spi_sync(m.spi, &m);
-+}
-+
-+void tsc2301_write_kbc(struct tsc2301 *tsc, int val)
-+{
-+ u16 w;
-+
-+ w = tsc->config2_shadow;
-+ w &= ~(0x03 << 14);
-+ w |= (val & 0x03) << 14;
-+ tsc2301_write_reg(tsc, TSC2301_REG_CONFIG2, w);
-+ tsc->config2_shadow = w;
-+}
-+
-+void tsc2301_write_pll(struct tsc2301 *tsc,
-+ int pll_n, int pll_a, int pll_pdc, int pct_e, int pll_o)
-+{
-+ u16 w;
-+
-+ w = tsc->config2_shadow;
-+ w &= ~0x3fff;
-+ w |= (pll_n & 0x0f) | ((pll_a & 0x0f) << 4) | ((pll_pdc & 0x0f) << 8);
-+ w |= pct_e ? (1 << 12) : 0;
-+ w |= pll_o ? (1 << 13) : 0;
-+ tsc2301_write_reg(tsc, TSC2301_REG_CONFIG2, w);
-+ tsc->config2_shadow = w;
-+}
-+
-+void tsc2301_read_buf(struct tsc2301 *tsc, int reg, u16 *rx_buf, int len)
-+{
-+ struct spi_transfer t[2];
-+ struct spi_message m;
-+ u16 cmd, i;
-+
-+ cmd = reg;
-+ cmd |= 0x8000;
-+
-+ spi_message_init(&m);
-+ m.spi = tsc->spi;
-+
-+ memset(t, 0, sizeof(t));
-+ t[0].tx_buf = &cmd;
-+ t[0].rx_buf = NULL;
-+ t[0].len = 2;
-+ spi_message_add_tail(&t[0], &m);
-+
-+ t[1].tx_buf = NULL;
-+ t[1].rx_buf = rx_buf;
-+ t[1].len = 2 * len;
-+ spi_message_add_tail(&t[1], &m);
-+
-+ spi_sync(m.spi, &m);
-+
-+ for (i = 0; i < len; i++)
-+ printk(KERN_DEBUG "rx_buf[%d]: %04x\n", i, rx_buf[i]);
-+}
-+
-+static int __devinit tsc2301_probe(struct spi_device *spi)
-+{
-+ struct tsc2301 *tsc;
-+ struct tsc2301_platform_data *pdata = spi->dev.platform_data;
-+ int r;
-+ u16 w;
-+
-+ if (!pdata) {
-+ dev_dbg(&spi->dev, "no platform data?\n");
-+ return -ENODEV;
-+ }
-+
-+ tsc = kzalloc(sizeof(*tsc), GFP_KERNEL);
-+ if (tsc == NULL)
-+ return -ENOMEM;
-+
-+ dev_set_drvdata(&spi->dev, tsc);
-+ tsc->spi = spi;
-+
-+ tsc->enable_clock = pdata->enable_clock;
-+ tsc->disable_clock = pdata->disable_clock;
-+
-+ if (pdata->reset_gpio >= 0) {
-+ tsc->reset_gpio = pdata->reset_gpio;
-+ r = gpio_request(tsc->reset_gpio, "TSC2301 reset");
-+ if (r < 0)
-+ goto err1;
-+ gpio_direction_output(tsc->reset_gpio, 1);
-+ mdelay(1);
-+ gpio_set_value(tsc->reset_gpio, 0);
-+ } else
-+ tsc->reset_gpio = -1;
-+
-+ spi->mode = SPI_MODE_1;
-+ spi->bits_per_word = 16;
-+ /* The max speed might've been defined by the board-specific
-+ * struct */
-+ if (!spi->max_speed_hz)
-+ spi->max_speed_hz = TSC2301_HZ;
-+ spi_setup(spi);
-+
-+ /* Soft reset */
-+ tsc2301_write_reg(tsc, TSC2301_REG_RESET, 0xbb00);
-+ msleep(1);
-+
-+ w = tsc2301_read_reg(tsc, TSC2301_REG_ADC);
-+ if (!(w & (1 << 14))) {
-+ dev_err(&spi->dev, "invalid ADC reg value: %04x\n", w);
-+ r = -ENODEV;
-+ goto err1;
-+ }
-+
-+ w = tsc2301_read_reg(tsc, TSC2301_REG_DAC);
-+ if (!(w & (1 << 15))) {
-+ dev_err(&spi->dev, "invalid DAC reg value: %04x\n", w);
-+ r = -ENODEV;
-+ goto err1;
-+ }
-+
-+ /* Stop keypad scanning */
-+ tsc2301_write_reg(tsc, TSC2301_REG_KEY, 0x4000);
-+
-+ /* We have to cache this for read-modify-write, since we can't
-+ * read back BIT15 */
-+ w = tsc2301_read_reg(tsc, TSC2301_REG_CONFIG2);
-+ /* By default BIT15 is set */
-+ w |= 1 << 15;
-+ tsc->config2_shadow = w;
-+
-+ r = tsc2301_kp_init(tsc, pdata);
-+ if (r)
-+ goto err1;
-+ r = tsc2301_ts_init(tsc, pdata);
-+ if (r)
-+ goto err2;
-+ r = tsc2301_mixer_init(tsc, pdata);
-+ if (r)
-+ goto err3;
-+ return 0;
-+
-+err3:
-+ tsc2301_ts_exit(tsc);
-+err2:
-+ tsc2301_kp_exit(tsc);
-+err1:
-+ kfree(tsc);
-+ return r;
-+}
-+
-+static int __devexit tsc2301_remove(struct spi_device *spi)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(&spi->dev);
-+
-+ tsc2301_mixer_exit(tsc);
-+ tsc2301_ts_exit(tsc);
-+ tsc2301_kp_exit(tsc);
-+ if (tsc->reset_gpio >= 0)
-+ gpio_free(tsc->reset_gpio);
-+ kfree(tsc);
-+
-+ return 0;
-+}
-+
-+#ifdef CONFIG_PM
-+static int tsc2301_suspend(struct spi_device *spi, pm_message_t mesg)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(&spi->dev);
-+ int r;
-+
-+ if ((r = tsc2301_mixer_suspend(tsc)) < 0)
-+ return r;
-+ if ((r = tsc2301_kp_suspend(tsc)) < 0)
-+ goto err1;
-+ if ((r = tsc2301_ts_suspend(tsc)) < 0)
-+ goto err2;
-+
-+ return 0;
-+err2:
-+ tsc2301_kp_resume(tsc);
-+err1:
-+ tsc2301_mixer_resume(tsc);
-+ return r;
-+}
-+
-+static int tsc2301_resume(struct spi_device *spi)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(&spi->dev);
-+
-+ tsc2301_ts_resume(tsc);
-+ tsc2301_kp_resume(tsc);
-+ tsc2301_mixer_resume(tsc);
-+ return 0;
-+}
-+#endif
-+
-+static struct spi_driver tsc2301_driver = {
-+ .driver = {
-+ .name = "tsc2301",
-+ .bus = &spi_bus_type,
-+ .owner = THIS_MODULE,
-+ },
-+#ifdef CONFIG_PM
-+ .suspend = tsc2301_suspend,
-+ .resume = tsc2301_resume,
-+#endif
-+ .probe = tsc2301_probe,
-+ .remove = __devexit_p(tsc2301_remove),
-+};
-+
-+static int __init tsc2301_init(void)
-+{
-+ printk("TSC2301 driver initializing\n");
-+
-+ return spi_register_driver(&tsc2301_driver);
-+}
-+module_init(tsc2301_init);
-+
-+static void __exit tsc2301_exit(void)
-+{
-+ spi_unregister_driver(&tsc2301_driver);
-+}
-+module_exit(tsc2301_exit);
-+
-+MODULE_AUTHOR("Juha Yrjölä <juha.yrjola@nokia.com>");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/spi/tsc2301-mixer.c
-@@ -0,0 +1,1003 @@
-+/*
-+ * ALSA Mixer implementation for TSC2301
-+ *
-+ * Copyright (C) 2006 Nokia Corporation.
-+ *
-+ * Contact: Jarkko Nikula <jarkko.nikula@nokia.com>
-+ * Juha Yrjola
-+ *
-+ * Some notes about TSC2301:
-+ * - PLL will stop when DAC and ADC's are powered down.
-+ * - Touchscreen will stop working when audio part is powered up and if audio
-+ * MCLK is stopped. Problem is avoided if audio is powered down before
-+ * stopping MCLK.
-+ * - Audio DAC or audio outputs will activate only after 100 msec from the
-+ * chip power-up. Reason seems to be VCM since there is no this delay if the
-+ * chip and VCM (bit AVPD on PD/MISC) were not powered down. The chip will
-+ * consume about 1 mA if all other audio blocks are powered down except the
-+ * chip itself and VCM. Full power down consumes only about few uA.
-+ * - Power-down transition could happen earliest about 100 msec after the chip
-+ * power-up. Otherwise power-down will fail if there is no that 100 msec
-+ * on time before it. It's not obvious why is that since chip reports
-+ * power-up to be completed and also PLL output on GPIO_0 is active in few
-+ * milliseconds.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/device.h>
-+#include <linux/errno.h>
-+#include <linux/delay.h>
-+#include <linux/slab.h>
-+#include <linux/spi/spi.h>
-+#include <linux/spi/tsc2301.h>
-+
-+#include <sound/core.h>
-+#include <sound/control.h>
-+
-+/* shadow register indexes */
-+enum {
-+ /* audio control and volume registers */
-+ AUDCNTL_INDEX,
-+ ADCVOL_INDEX,
-+ DACVOL_INDEX,
-+ BPVOL_INDEX,
-+ /* keyclick control register (not needed here) */
-+ /* audio power control register */
-+ PD_MISC_INDEX,
-+ /* TSC2301 GPIO control register */
-+ GPIO_INDEX,
-+
-+ SHADOW_REG_COUNT,
-+};
-+
-+/* structure for driver private data */
-+struct tsc2301_mixer {
-+ struct tsc2301 *tsc;
-+ struct mutex mutex;
-+
-+ /* shadow registers holding TSC2301 audio registers. Used to hold
-+ * their states during the sleep and also to reduce communication with
-+ * the chip since get callback functions could get register values
-+ * directly from these shadow registers without needing to read them
-+ * from the chip */
-+ u16 shadow_regs[SHADOW_REG_COUNT];
-+
-+ /* audio controller driver usage of the ADC and DAC */
-+ unsigned adc_enabled:1, dac_enabled:1;
-+ unsigned pll_output:1;
-+ unsigned mclk_enabled;
-+
-+ /* latest audio power-up timestamp */
-+ unsigned long pu_jiffies;
-+
-+ /* these are used when upper layer(s) are going to power-down TSC2301
-+ * before 100 msec is passed from power-up */
-+ struct delayed_work delayed_power_down;
-+ unsigned delayed_pd_active:1;
-+
-+ int (* platform_init)(struct device *);
-+ void (* platform_cleanup)(struct device *);
-+
-+ struct tsc2301_mixer_gpio *mixer_gpios;
-+ int n_mixer_gpios;
-+};
-+
-+#define TSC2301_DAC_DELAY msecs_to_jiffies(100)
-+#define TSC2301_MIN_PU_PERIOD msecs_to_jiffies(100)
-+
-+#define TSC2301_REG_TO_PVAL(reg) \
-+ (TSC2301_REG_TO_PAGE(reg) << 6 | TSC2301_REG_TO_ADDR(reg))
-+#define TSC2301_PVAL_TO_REG(v) \
-+ (TSC2301_REG((((v) >> 6) & 3),((v) & 0x1f)))
-+
-+#define TSC2301_VOLUME_MASK 0x7f
-+#define TSC2301_MIN_ADCVOL 6
-+#define TSC2301_MIN_DACVOL 0
-+#define TSC2301_MIN_BPVOL 31
-+#define TSC2301_MUTE_LEFT_SHIFT 15
-+#define TSC2301_VOL_LEFT_SHIFT 8
-+#define TSC2301_MUTE_RIGHT_SHIFT 7
-+#define TSC2301_VOL_RIGHT_SHIFT 0
-+
-+#define TSC2301_INM_MASK 3
-+#define TSC2301_INML_SHIFT 12
-+#define TSC2301_INMR_SHIFT 10
-+
-+#define TSC2301_MICG_MASK 3
-+#define TSC2301_MICG_MIN 1 /* values 0 & 1 both mean 0 dB */
-+#define TSC2301_MICG_SHIFT 8
-+
-+#define TSC2301_REG_AUDCNTL_MCLK(v) (((v) & 3) << 6)
-+#define TSC2301_REG_AUDCNTL_I2SFS(v) (((v) & 0xf) << 2)
-+#define TSC2301_REG_AUDCNTL_I2SFM(v) (((v) & 3) << 0)
-+
-+#define TSC2301_SINGLE(xname, xindex, reg, shadow_index, shift, mask, min) \
-+{\
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
-+ .name = xname, \
-+ .index = xindex, \
-+ .info = snd_tsc2301_info_single, \
-+ .get = snd_tsc2301_get_single, \
-+ .put = snd_tsc2301_put_single, \
-+ .private_value = TSC2301_REG_TO_PVAL(reg) | \
-+ (shadow_index << 8) | (shift << 16) | (mask << 24) | \
-+ (min << 28) \
-+}
-+#define TSC2301_SINGLE_MINVAL(v) (((v) >> 28) & 15)
-+#define TSC2301_SINGLE_SHIFT(v) (((v) >> 16) & 15)
-+#define TSC2301_SINGLE_MASK(v) (((v) >> 24) & 15)
-+
-+#define TSC2301_DOUBLE(xname, xindex, reg, shadow_index, ls, rs, mask, min) \
-+{\
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
-+ .name = xname, \
-+ .index = xindex, \
-+ .info = snd_tsc2301_info_double, \
-+ .get = snd_tsc2301_get_double, \
-+ .put = snd_tsc2301_put_double, \
-+ .private_value = TSC2301_REG_TO_PVAL(reg) | \
-+ (shadow_index << 8) | (min << 11) | \
-+ (ls << 16) | (rs << 20) | (mask << 24) \
-+}
-+#define TSC2301_DOUBLE_MINVAL(v) (((v) >> 11) & 0x1f)
-+#define TSC2301_DOUBLE_LEFT_SHIFT(v) (((v) >> 16) & 15)
-+#define TSC2301_DOUBLE_RIGHT_SHIFT(v) (((v) >> 20) & 15)
-+#define TSC2301_DOUBLE_MASK(v) (((v) >> 24) & TSC2301_VOLUME_MASK)
-+
-+#define TSC2301_MUX(xname, xindex, reg, shadow_index, ls, rs, mask) \
-+{\
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
-+ .name = xname, \
-+ .index = xindex, \
-+ .info = snd_tsc2301_info_mux, \
-+ .get = snd_tsc2301_get_mux, \
-+ .put = snd_tsc2301_put_mux, \
-+ .private_value = TSC2301_REG_TO_PVAL(reg) | \
-+ (shadow_index << 8) | (ls << 16) | (rs << 20) | (mask << 24) \
-+}
-+#define TSC2301_MUX_LEFT_SHIFT(v) (((v) >> 16) & 15)
-+#define TSC2301_MUX_RIGHT_SHIFT(v) (((v) >> 20) & 15)
-+#define TSC2301_MUX_MASK(v) (((v) >> 24) & TSC2301_VOLUME_MASK)
-+
-+#define TSC2301_BOOL(xname, xindex, reg, shadow_index, shift, invert, state) \
-+{ \
-+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
-+ .name = xname, \
-+ .index = xindex, \
-+ .info = snd_tsc2301_info_bool, \
-+ .get = snd_tsc2301_get_bool, \
-+ .put = snd_tsc2301_put_bool, \
-+ .private_value = TSC2301_REG_TO_PVAL(reg) | \
-+ (shadow_index << 8) | (shift << 16) | \
-+ (invert << 24) | (state << 25) \
-+}
-+#define TSC2301_BOOL_SHIFT(v) (((v) >> 16) & 7)
-+#define TSC2301_BOOL_INVERT(v) (((v) >> 24) & 1)
-+#define TSC2301_BOOL_STATE(v) (((v) >> 25) & 1)
-+
-+#define TSC2301_SHADOW_INDEX(v) (((v) >> 8) & 7)
-+
-+/*
-+ * Power-down handler for additional GPIO mixer controls. GPIO state of GPIO
-+ * controls whose power-down flag is enabled are set to their false/deactivate
-+ * state
-+ *
-+ * Must be called tsc->mixer->mutex locked
-+ */
-+static void tsc2301_gpio_power_down(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_mixer *mix = tsc->mixer;
-+ u16 temp;
-+ int i;
-+
-+ temp = mix->shadow_regs[GPIO_INDEX];
-+ for (i = 0; i < mix->n_mixer_gpios; i++) {
-+ const struct tsc2301_mixer_gpio *mg;
-+
-+ mg = mix->mixer_gpios + i;
-+ if (mg->deactivate_on_pd) {
-+ int gpio = mg->gpio;
-+
-+ temp &= ~(1 << gpio);
-+ temp |= mg->inverted << gpio;
-+ }
-+ }
-+ tsc2301_write_reg(tsc, TSC2301_REG_GPIO, temp);
-+}
-+
-+/*
-+ * Powers down/up audio blocks which are muted or become unused.
-+ * shadow_index >= 0, changes power state of single audio block
-+ * shadow_index < 0, changes power state of all blocks
-+ *
-+ * Must be called tsc->mixer->mutex locked
-+ */
-+#define TSC2301_MUTE_MASK \
-+ ((1 << TSC2301_MUTE_LEFT_SHIFT) | (1 << TSC2301_MUTE_RIGHT_SHIFT))
-+static void tsc2301_power_ctrl(struct tsc2301 *tsc, int shadow_index,
-+ int poll_pdsts)
-+{
-+ struct tsc2301_mixer *mix = tsc->mixer;
-+ u16 pd_ctrl, pd_ctrl_old, w;
-+ unsigned long timeout;
-+ int power_up = 0;
-+
-+ if (mix->delayed_pd_active) {
-+ mix->delayed_pd_active = 0;
-+ mix->mclk_enabled--;
-+ cancel_delayed_work(&mix->delayed_power_down);
-+ }
-+
-+ pd_ctrl = pd_ctrl_old = mix->shadow_regs[PD_MISC_INDEX];
-+ /* power control helper based on used space mixer selections. See
-+ * actual power control decisions below */
-+ if (shadow_index < 0 || shadow_index == ADCVOL_INDEX) {
-+ /* ADC left and right power down control */
-+ if (mix->shadow_regs[ADCVOL_INDEX] &
-+ (1 << TSC2301_MUTE_LEFT_SHIFT))
-+ /* left ADC muted. Power down the left ADC */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_ADPDL;
-+ else
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_ADPDL;
-+ if (mix->shadow_regs[ADCVOL_INDEX] &
-+ (1 << TSC2301_MUTE_LEFT_SHIFT))
-+ /* right ADC muted. Power down the right ADC */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_ADPDR;
-+ else
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_ADPDR;
-+ }
-+ if (shadow_index < 0 || shadow_index == DACVOL_INDEX) {
-+ /* DAC power down control */
-+ if ((mix->shadow_regs[DACVOL_INDEX] &
-+ TSC2301_MUTE_MASK) == TSC2301_MUTE_MASK)
-+ /* both DACs muted. Power down the DAC */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_DAPD;
-+ else
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_DAPD;
-+ }
-+ if (shadow_index < 0 || shadow_index == BPVOL_INDEX) {
-+ /* line bypass power down control */
-+ if ((mix->shadow_regs[BPVOL_INDEX] &
-+ TSC2301_MUTE_MASK) == TSC2301_MUTE_MASK)
-+ /* both line bypasses muted. Power down the bypass
-+ * path */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_ABPD;
-+ else
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_ABPD;
-+ }
-+ if (shadow_index < 0 || shadow_index == AUDCNTL_INDEX) {
-+ /* mic bias power down control */
-+ if ((mix->shadow_regs[AUDCNTL_INDEX] &
-+ (3 << TSC2301_INML_SHIFT)) &&
-+ (mix->shadow_regs[AUDCNTL_INDEX] &
-+ (3 << TSC2301_INMR_SHIFT)))
-+ /* both ADC channels use other than mic input. Power
-+ * down the mic bias output */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_MIBPD;
-+ else
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_MIBPD;
-+ }
-+
-+ /* power control decisions based on codec usage and user space mixer
-+ * selections detected above */
-+ pd_ctrl &= ~TSC2301_REG_PD_MISC_APD; /* audio not powered down */
-+ if (mix->mclk_enabled) {
-+ if (!mix->adc_enabled) {
-+ /* ADC not used, power down both ADC's and mic bias
-+ * output independently of user space mixer
-+ * selections */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_ADPDL;
-+ pd_ctrl |= TSC2301_REG_PD_MISC_ADPDR;
-+ pd_ctrl |= TSC2301_REG_PD_MISC_MIBPD;
-+ }
-+ if (!mix->dac_enabled) {
-+ /* DAC not used, power down DAC independently of user
-+ * space mixer selections */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_DAPD;
-+ }
-+
-+ if (mix->pll_output) {
-+ /* GPIO_0 is configured as PLL output so audio
-+ * controller is expecting clock from TSC2301. Either
-+ * ADC or DAC must be active in order to keep PLL on */
-+ if ((pd_ctrl & TSC2301_REG_PD_MISC_ADPDL) &&
-+ (pd_ctrl & TSC2301_REG_PD_MISC_ADPDR) &&
-+ (pd_ctrl & TSC2301_REG_PD_MISC_DAPD)) {
-+ /* neither ADC or DAC used. Force ADC on in
-+ * order to keep PLL active */
-+ pd_ctrl &= ~(TSC2301_REG_PD_MISC_ADPDL |
-+ TSC2301_REG_PD_MISC_ADPDR);
-+ }
-+ }
-+ } else {
-+ /* audio input clock is not enabled so power down DAC and ADC
-+ * in order to shutdown PLL and to keep touchscreen and keypad
-+ * parts working. Touchscreen and keypad use audio clock when
-+ * PLL is on and internal clock otherwise */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_DAPD |
-+ TSC2301_REG_PD_MISC_ADPDL |
-+ TSC2301_REG_PD_MISC_ADPDR;
-+ }
-+
-+ if ((pd_ctrl & TSC2301_REG_PD_MISC_ADPDL) &&
-+ (pd_ctrl & TSC2301_REG_PD_MISC_ADPDR) &&
-+ (pd_ctrl & TSC2301_REG_PD_MISC_DAPD) &&
-+ (pd_ctrl & TSC2301_REG_PD_MISC_ABPD)) {
-+ /* all ADC, DAC and line bypass path unused. Power down the
-+ * whole audio part of the TSC2301 */
-+ pd_ctrl |= TSC2301_REG_PD_MISC_APD;
-+ }
-+
-+ if (pd_ctrl == pd_ctrl_old)
-+ return;
-+
-+ /* power down control changed. Update into TSC2301 */
-+ if ((pd_ctrl ^ pd_ctrl_old) & TSC2301_REG_PD_MISC_APD) {
-+ /* whole audio power state changed. Update GPIO states */
-+ if (pd_ctrl & TSC2301_REG_PD_MISC_APD) {
-+ /* power down GPIO controls before powering down
-+ * the codec */
-+ tsc2301_gpio_power_down(tsc);
-+ /* we must really ensure that codec has been on no less
-+ * than 100 msec before doing power-down */
-+ timeout = mix->pu_jiffies + TSC2301_MIN_PU_PERIOD -
-+ jiffies;
-+ if (timeout <= TSC2301_MIN_PU_PERIOD) {
-+ mix->delayed_pd_active = 1;
-+ mix->mclk_enabled++;
-+ schedule_delayed_work(&mix->delayed_power_down,
-+ timeout + 1);
-+ return;
-+ }
-+ } else
-+ /* restore GPIOs after codec is powered up */
-+ power_up = 1;
-+ }
-+ mix->shadow_regs[PD_MISC_INDEX] = pd_ctrl;
-+ tsc2301_write_reg(tsc, TSC2301_REG_PD_MISC, pd_ctrl);
-+ if (power_up)
-+ mix->pu_jiffies = jiffies;
-+ if (!poll_pdsts) {
-+ if (power_up)
-+ tsc2301_write_reg(tsc, TSC2301_REG_GPIO,
-+ mix->shadow_regs[GPIO_INDEX]);
-+ return;
-+ }
-+
-+ /* wait until power-up/-down is completed */
-+ timeout = jiffies + msecs_to_jiffies(100);
-+ w = 0;
-+ do {
-+ if (time_after(jiffies, timeout)) {
-+ /* Print a warning only if the I2S clock is not
-+ * present / out of sync. This can happen during
-+ * init time, when that clock will be turned on
-+ * by another driver like in the OMAP EAC with
-+ * external clock case.
-+ */
-+ if (w & TSC2301_REG_PD_MISC_OTSYN) {
-+ dev_warn(&tsc->spi->dev,
-+ "I2S clock not in sync or off.\n");
-+ } else {
-+ dev_err(&tsc->spi->dev,
-+ "power-up/-down timed out "
-+ "(0x%04x, 0x%04x -> 0x%04x)\n",
-+ w, pd_ctrl_old, pd_ctrl);
-+ }
-+ goto out;
-+ }
-+ w = tsc2301_read_reg(tsc, TSC2301_REG_PD_MISC);
-+ } while (!(w & TSC2301_REG_PD_MISC_PDSTS));
-+
-+out:
-+ if (((pd_ctrl ^ pd_ctrl_old) & TSC2301_REG_PD_MISC_DAPD) &&
-+ !(pd_ctrl & TSC2301_REG_PD_MISC_DAPD)) {
-+ /* DAC powered up now. Ensure that DAC and audio outputs are
-+ * activated. They are up 100 msec after the chip power-up
-+ * command */
-+ timeout = mix->pu_jiffies + TSC2301_DAC_DELAY - jiffies;
-+ if (timeout <= TSC2301_DAC_DELAY)
-+ schedule_timeout_interruptible(timeout);
-+ /* FIXME: This is lazy. We restore GPIOs only after activating
-+ * the DAC. It would be better to do some kind of delayed GPIO
-+ * restore. That ensures that we restore them also if only ADC
-+ * path is activated. But this is required only if there is
-+ * some input amplifier, bias control, etc. and their power
-+ * state is under TSC GPIO control */
-+ tsc2301_write_reg(tsc, TSC2301_REG_GPIO,
-+ mix->shadow_regs[GPIO_INDEX]);
-+ }
-+}
-+
-+static int snd_tsc2301_info_single(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_info *uinfo)
-+{
-+ int mask = TSC2301_SINGLE_MASK(kcontrol->private_value);
-+ int minval = TSC2301_SINGLE_MINVAL(kcontrol->private_value);
-+
-+ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-+ uinfo->count = 1;
-+ uinfo->value.integer.min = minval;
-+ uinfo->value.integer.max = mask;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_get_single(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int mask = TSC2301_SINGLE_MASK(priv);
-+ int shift = TSC2301_SINGLE_SHIFT(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg;
-+
-+ shadow_reg = tsc->mixer->shadow_regs[shadow_index];
-+
-+ ucontrol->value.integer.value[0] = (shadow_reg >> shift) & mask;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_put_single(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int mask = TSC2301_SINGLE_MASK(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg, shadow_reg_old;
-+ int shift = TSC2301_SINGLE_SHIFT(priv);
-+ int reg = TSC2301_PVAL_TO_REG(priv);
-+ int changed;
-+
-+ mutex_lock(&tsc->mixer->mutex);
-+ shadow_reg = shadow_reg_old = tsc->mixer->shadow_regs[shadow_index];
-+
-+ /* zero bits to be modified */
-+ shadow_reg &= ~(mask << shift);
-+ /* modify with new value */
-+ shadow_reg |= ((ucontrol->value.integer.value[0] & mask) << shift);
-+
-+ changed = (shadow_reg != shadow_reg_old);
-+ tsc->mixer->shadow_regs[shadow_index] = shadow_reg;
-+
-+ /* update into TSC2301 if necessary */
-+ if (changed)
-+ tsc2301_write_reg(tsc, reg, shadow_reg);
-+ mutex_unlock(&tsc->mixer->mutex);
-+
-+ return changed;
-+}
-+
-+static int snd_tsc2301_info_double(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_info *uinfo)
-+{
-+ /* mask == 1 : Switch
-+ * mask > 1 : Max volume */
-+ int mask = TSC2301_DOUBLE_MASK(kcontrol->private_value);
-+ int minval = TSC2301_DOUBLE_MINVAL(kcontrol->private_value);
-+
-+ uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN :
-+ SNDRV_CTL_ELEM_TYPE_INTEGER;
-+ uinfo->count = 2;
-+ uinfo->value.integer.min = minval;
-+ uinfo->value.integer.max = mask;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_get_double(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ /* mask == 1 : Switch
-+ * mask > 1 : Volume */
-+ int mask = TSC2301_DOUBLE_MASK(priv);
-+ int ls = TSC2301_DOUBLE_LEFT_SHIFT(priv);
-+ int rs = TSC2301_DOUBLE_RIGHT_SHIFT(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg;
-+
-+ shadow_reg = tsc->mixer->shadow_regs[shadow_index];
-+
-+ /* invert mute bits for the switches */
-+ if (mask == 1)
-+ shadow_reg = ~shadow_reg;
-+
-+ ucontrol->value.integer.value[0] = (shadow_reg >> ls) & mask;
-+ ucontrol->value.integer.value[1] = (shadow_reg >> rs) & mask;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_put_double(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ /* mask == 1 : Switch
-+ * mask > 1 : Volume */
-+ int mask = TSC2301_DOUBLE_MASK(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg, shadow_reg_old;
-+ int ls = TSC2301_DOUBLE_LEFT_SHIFT(priv);
-+ int rs = TSC2301_DOUBLE_RIGHT_SHIFT(priv);
-+ int reg = TSC2301_PVAL_TO_REG(priv);
-+ int changed;
-+
-+ mutex_lock(&tsc->mixer->mutex);
-+ shadow_reg = shadow_reg_old = tsc->mixer->shadow_regs[shadow_index];
-+
-+ /* zero bits to be modified */
-+ shadow_reg &= ~((mask << ls) | (mask << rs));
-+ /* modify with new value */
-+ if (mask == 1) {
-+ /* switch. Invert switch values for the mute bits */
-+ shadow_reg |=
-+ ((~ucontrol->value.integer.value[0] & mask) << ls) |
-+ ((~ucontrol->value.integer.value[1] & mask) << rs);
-+ } else {
-+ /* volume */
-+ shadow_reg |=
-+ (ucontrol->value.integer.value[0] << ls) |
-+ (ucontrol->value.integer.value[1] << rs);
-+ }
-+
-+ changed = (shadow_reg != shadow_reg_old);
-+ tsc->mixer->shadow_regs[shadow_index] = shadow_reg;
-+
-+ /* update into TSC2301 if necessary */
-+ if (changed)
-+ tsc2301_write_reg(tsc, reg, shadow_reg);
-+
-+ if (mask == 1)
-+ /* check is need to power down/up audio blocks in case of
-+ * muted state change */
-+ tsc2301_power_ctrl(tsc, shadow_index, 0);
-+ mutex_unlock(&tsc->mixer->mutex);
-+
-+ return changed;
-+}
-+
-+static int snd_tsc2301_info_mux(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_info *uinfo)
-+{
-+ static char *texts[4] = {"Mic", "Line", "Line swapped", "Line mono"};
-+
-+ uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-+ uinfo->count = 2;
-+ uinfo->value.enumerated.items = 4;
-+ if (uinfo->value.enumerated.item > 3)
-+ uinfo->value.enumerated.item = 3;
-+ strcpy(uinfo->value.enumerated.name,
-+ texts[uinfo->value.enumerated.item]);
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_get_mux(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int mask = TSC2301_MUX_MASK(priv);
-+ int ls = TSC2301_MUX_LEFT_SHIFT(priv);
-+ int rs = TSC2301_MUX_RIGHT_SHIFT(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg;
-+
-+ shadow_reg = tsc->mixer->shadow_regs[shadow_index];
-+ ucontrol->value.enumerated.item[0] = (shadow_reg >> ls) & mask;
-+ ucontrol->value.enumerated.item[1] = (shadow_reg >> rs) & mask;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_put_mux(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int mask = TSC2301_MUX_MASK(priv);
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ u16 shadow_reg, shadow_reg_old;
-+ int ls = TSC2301_MUX_LEFT_SHIFT(priv);
-+ int rs = TSC2301_MUX_RIGHT_SHIFT(priv);
-+ int reg = TSC2301_PVAL_TO_REG(priv);
-+ int changed;
-+
-+ mutex_lock(&tsc->mixer->mutex);
-+ shadow_reg = shadow_reg_old = tsc->mixer->shadow_regs[shadow_index];
-+
-+ /* zero bits to be modified */
-+ shadow_reg &= ~((mask << ls) | (mask << rs));
-+ /* modify with new value */
-+ shadow_reg |= (ucontrol->value.enumerated.item[0] << ls);
-+ shadow_reg |= (ucontrol->value.enumerated.item[1] << rs);
-+
-+ changed = (shadow_reg != shadow_reg_old);
-+
-+ /* update into TSC2301 if necessary */
-+ if (changed) {
-+ tsc->mixer->shadow_regs[shadow_index] = shadow_reg;
-+ tsc2301_write_reg(tsc, reg, shadow_reg);
-+ }
-+
-+ /* check is need to power up/down audio blocks in case of ADC input
-+ * change */
-+ tsc2301_power_ctrl(tsc, shadow_index, 0);
-+ mutex_unlock(&tsc->mixer->mutex);
-+
-+ return changed;
-+}
-+
-+static int snd_tsc2301_info_bool(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_info *uinfo)
-+{
-+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-+ uinfo->count = 1;
-+ uinfo->value.integer.min = 0;
-+ uinfo->value.integer.max = 1;
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_get_bool(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ int shift = TSC2301_BOOL_SHIFT(priv);
-+ int invert = TSC2301_BOOL_INVERT(priv);
-+ u16 shadow_reg;
-+
-+ shadow_reg = tsc->mixer->shadow_regs[shadow_index];
-+ ucontrol->value.integer.value[0] =
-+ invert ^ ((shadow_reg >> shift) & 1);
-+
-+ return 0;
-+}
-+
-+static int snd_tsc2301_put_bool(struct snd_kcontrol *kcontrol,
-+ struct snd_ctl_elem_value *ucontrol)
-+{
-+ struct tsc2301 *tsc = kcontrol->private_data;
-+ unsigned long priv = kcontrol->private_value;
-+ int shadow_index = TSC2301_SHADOW_INDEX(priv);
-+ int shift = TSC2301_BOOL_SHIFT(priv);
-+ int invert = TSC2301_BOOL_INVERT(priv);
-+ int reg = TSC2301_PVAL_TO_REG(priv);
-+ u16 shadow_reg, shadow_reg_old;
-+ int changed;
-+
-+ mutex_lock(&tsc->mixer->mutex);
-+ shadow_reg = shadow_reg_old = tsc->mixer->shadow_regs[shadow_index];
-+
-+ /* zero bit to be modified */
-+ shadow_reg &= ~(1 << shift);
-+ /* modify with new value */
-+ shadow_reg |=
-+ (invert ^ (ucontrol->value.integer.value[0] & 1)) << shift;
-+
-+ changed = (shadow_reg != shadow_reg_old);
-+
-+ /* update into TSC2301 if necessary */
-+ if (changed) {
-+ tsc->mixer->shadow_regs[shadow_index] = shadow_reg;
-+ if ((shadow_index == GPIO_INDEX) &&
-+ (tsc->mixer->shadow_regs[PD_MISC_INDEX] &
-+ TSC2301_REG_PD_MISC_APD)) {
-+ /* changing GPIO control and audio is powered down.
-+ * Update GPIO states according to their power-down
-+ * flag */
-+ tsc2301_gpio_power_down(tsc);
-+ } else
-+ tsc2301_write_reg(tsc, reg, shadow_reg);
-+ }
-+ mutex_unlock(&tsc->mixer->mutex);
-+
-+ return changed;
-+}
-+
-+/* TSC2301 internal mixer controls */
-+static struct snd_kcontrol_new snd_tsc2301_controls[] = {
-+ /* stereo ADC input switches and volumes */
-+ TSC2301_DOUBLE("Capture Switch", 0,
-+ TSC2301_REG_ADCVOL, ADCVOL_INDEX,
-+ TSC2301_MUTE_LEFT_SHIFT, TSC2301_MUTE_RIGHT_SHIFT,
-+ 1, 0),
-+ TSC2301_DOUBLE("Capture Volume", 0,
-+ TSC2301_REG_ADCVOL, ADCVOL_INDEX,
-+ TSC2301_VOL_LEFT_SHIFT, TSC2301_VOL_RIGHT_SHIFT,
-+ TSC2301_VOLUME_MASK, TSC2301_MIN_ADCVOL),
-+
-+ /* stereo DAC output switches and volumes */
-+ TSC2301_DOUBLE("PCM Playback Switch", 0,
-+ TSC2301_REG_DACVOL, DACVOL_INDEX,
-+ TSC2301_MUTE_LEFT_SHIFT, TSC2301_MUTE_RIGHT_SHIFT,
-+ 1, 0),
-+ TSC2301_DOUBLE("PCM Playback Volume", 0,
-+ TSC2301_REG_DACVOL, DACVOL_INDEX,
-+ TSC2301_VOL_LEFT_SHIFT, TSC2301_VOL_RIGHT_SHIFT,
-+ TSC2301_VOLUME_MASK, TSC2301_MIN_DACVOL),
-+
-+ /* stereo line input bypass switches and volumes */
-+ TSC2301_DOUBLE("Line Playback Switch", 0,
-+ TSC2301_REG_BPVOL, BPVOL_INDEX,
-+ TSC2301_MUTE_LEFT_SHIFT, TSC2301_MUTE_RIGHT_SHIFT,
-+ 1, 0),
-+ TSC2301_DOUBLE("Line Playback Volume", 0,
-+ TSC2301_REG_BPVOL, BPVOL_INDEX,
-+ TSC2301_VOL_LEFT_SHIFT, TSC2301_VOL_RIGHT_SHIFT,
-+ TSC2301_VOLUME_MASK, TSC2301_MIN_BPVOL),
-+
-+ /* mono microphone input gain */
-+ TSC2301_SINGLE("Mic Boost", 0,
-+ TSC2301_REG_AUDCNTL, AUDCNTL_INDEX,
-+ TSC2301_MICG_SHIFT,
-+ TSC2301_MICG_MASK, TSC2301_MICG_MIN),
-+
-+ /* ADC input sources. Both channels could be selected separately */
-+ TSC2301_MUX("Capture Source", 0,
-+ TSC2301_REG_AUDCNTL, AUDCNTL_INDEX,
-+ TSC2301_INML_SHIFT, TSC2301_INMR_SHIFT,
-+ TSC2301_INM_MASK),
-+};
-+
-+/* must be called tsc->mixer->mutex locked */
-+static void tsc2301_flush_shadow_regs(struct tsc2301 *tsc)
-+{
-+ int i, page, addr;
-+ u16 temp;
-+
-+ page = TSC2301_REG_TO_PAGE(TSC2301_REG_AUDCNTL);
-+ addr = TSC2301_REG_TO_ADDR(TSC2301_REG_AUDCNTL);
-+
-+ for (i = 0; i < 4; i++) {
-+ temp = tsc->mixer->shadow_regs[i];
-+ tsc2301_write_reg(tsc, TSC2301_REG(page, addr + i), temp);
-+ }
-+ temp = tsc->mixer->shadow_regs[GPIO_INDEX];
-+ tsc2301_write_reg(tsc, TSC2301_REG_GPIO, temp);
-+
-+ /* Update power state of all audio blocks depending are they
-+ * muted or unused. */
-+ tsc2301_power_ctrl(tsc, -1, 0);
-+}
-+
-+#ifdef CONFIG_PM
-+int tsc2301_mixer_suspend(struct tsc2301 *tsc)
-+{
-+ /* power down entire audio section inside TSC2301 in case the
-+ * chip is still powered during the system sleep. However this driver
-+ * doesn't require that chip is powered because registers are restored
-+ * in function tsc2301_mixer_resume */
-+ mutex_lock(&tsc->mixer->mutex);
-+ tsc2301_gpio_power_down(tsc);
-+ tsc->mixer->shadow_regs[PD_MISC_INDEX] |= TSC2301_REG_PD_MISC_APD;
-+ tsc2301_write_reg(tsc, TSC2301_REG_PD_MISC,
-+ tsc->mixer->shadow_regs[PD_MISC_INDEX]);
-+ mutex_unlock(&tsc->mixer->mutex);
-+ return 0;
-+}
-+
-+void tsc2301_mixer_resume(struct tsc2301 *tsc)
-+{
-+ /* power up the TSC2301 audio section and restore registers */
-+ mutex_lock(&tsc->mixer->mutex);
-+ tsc->mixer->shadow_regs[PD_MISC_INDEX] &= ~TSC2301_REG_PD_MISC_APD;
-+ tsc2301_flush_shadow_regs(tsc);
-+ mutex_unlock(&tsc->mixer->mutex);
-+}
-+#endif
-+
-+void tsc2301_mixer_enable_mclk(struct device *dev)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_mixer *mix = tsc->mixer;
-+
-+ mutex_lock(&mix->mutex);
-+ if (!mix->mclk_enabled++ && tsc->enable_clock != NULL) {
-+ tsc->enable_clock(dev);
-+ }
-+ tsc2301_power_ctrl(tsc, -1, 1);
-+ mutex_unlock(&mix->mutex);
-+}
-+
-+void tsc2301_mixer_disable_mclk(struct device *dev)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_mixer *mix = tsc->mixer;
-+
-+ mutex_lock(&mix->mutex);
-+ mix->mclk_enabled--;
-+ tsc2301_power_ctrl(tsc, -1, 1);
-+ if (!mix->mclk_enabled && tsc->disable_clock != NULL) {
-+ tsc->disable_clock(dev);
-+ }
-+ mutex_unlock(&mix->mutex);
-+}
-+
-+static void tsc2301_mixer_delayed_power_down(struct work_struct *work)
-+{
-+ struct tsc2301_mixer *mix = container_of(work, struct tsc2301_mixer,
-+ delayed_power_down.work);
-+ struct tsc2301 *tsc = mix->tsc;
-+
-+ mutex_lock(&mix->mutex);
-+ if (!mix->delayed_pd_active) {
-+ mutex_unlock(&mix->mutex);
-+ return;
-+ }
-+ mix->delayed_pd_active = 0;
-+ mutex_unlock(&mix->mutex);
-+ tsc2301_mixer_disable_mclk(&tsc->spi->dev);
-+}
-+
-+/*
-+ * Allows audio controller driver to notify its usage of ADC and DAC
-+ */
-+void tsc2301_mixer_set_power(struct device *dev, int dac, int adc)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+
-+ mutex_lock(&tsc->mixer->mutex);
-+ tsc->mixer->adc_enabled = adc;
-+ tsc->mixer->dac_enabled = dac;
-+
-+ /* update power state of all audio blocks */
-+ tsc2301_power_ctrl(tsc, -1, 1);
-+ mutex_unlock(&tsc->mixer->mutex);
-+}
-+
-+/*
-+ * Registers TSC2301 ALSA Mixer controls for the given sound card
-+ */
-+int tsc2301_mixer_register_controls(struct device *dev, struct snd_card *card)
-+{
-+ struct tsc2301 *tsc = dev_get_drvdata(dev);
-+ struct tsc2301_mixer *mix = tsc->mixer;
-+ int i, err;
-+
-+ /* Register ALSA mixer controls */
-+ for (i = 0; i < ARRAY_SIZE(snd_tsc2301_controls); i++) {
-+ err = snd_ctl_add(card,
-+ snd_ctl_new1(&snd_tsc2301_controls[i], tsc));
-+ if (err < 0)
-+ return err;
-+ }
-+
-+ if (!mix->n_mixer_gpios)
-+ return 0;
-+
-+ /* Register additional GPIO controls if defined */
-+ for (i = 0; i < mix->n_mixer_gpios; i++) {
-+ const struct tsc2301_mixer_gpio *mg = mix->mixer_gpios + i;
-+ struct snd_kcontrol *ctrlp;
-+ struct snd_kcontrol_new ctrl =
-+ TSC2301_BOOL((char *)mg->name, 0,
-+ TSC2301_REG_GPIO, GPIO_INDEX,
-+ mg->gpio, mg->inverted, mg->def_enable);
-+
-+ ctrlp = snd_ctl_new1(&ctrl, tsc);
-+ err = snd_ctl_add(card, ctrlp);
-+ if (err < 0)
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+
-+int tsc2301_mixer_init(struct tsc2301 *tsc,
-+ struct tsc2301_platform_data *pdata)
-+{
-+ struct tsc2301_mixer *mix;
-+ int err = 0;
-+ u16 w;
-+
-+ mix = kzalloc(sizeof(*mix), GFP_KERNEL);
-+ if (mix == NULL)
-+ return -ENOMEM;
-+ tsc->mixer = mix;
-+
-+ mix->tsc = tsc;
-+ mutex_init(&mix->mutex);
-+ mix->platform_init = pdata->codec_init;
-+ mix->platform_cleanup = pdata->codec_cleanup;
-+ mix->pll_output = pdata->pll_output;
-+
-+ INIT_DELAYED_WORK(&mix->delayed_power_down,
-+ tsc2301_mixer_delayed_power_down);
-+
-+ /* initialize shadow register default values */
-+ w = 0xc000;
-+ w |= (pdata->mclk_ratio << 6) | (pdata->i2s_sample_rate << 2);
-+ w |= pdata->i2s_format;
-+ mix->shadow_regs[AUDCNTL_INDEX] = w;
-+ mix->shadow_regs[ADCVOL_INDEX] = 0xd7d7;
-+ mix->shadow_regs[DACVOL_INDEX] = 0xffff;
-+ mix->shadow_regs[BPVOL_INDEX] = 0xe7e7;
-+ mix->shadow_regs[PD_MISC_INDEX] = pdata->power_down_blocks;
-+
-+ /* if extra mixer controls configured, then configure associated
-+ * GPIOs as output and drive their default state */
-+ if (pdata->n_mixer_gpios) {
-+ int i;
-+
-+ w = 0;
-+ for (i = 0; i < pdata->n_mixer_gpios; i++) {
-+ const struct tsc2301_mixer_gpio *mg;
-+ int gpio;
-+
-+ mg = pdata->mixer_gpios + i;
-+ gpio = mg->gpio;
-+ w |= (1 << gpio) << 8;
-+ w |= (mg->inverted ^ mg->def_enable) << gpio;
-+ }
-+ mix->shadow_regs[GPIO_INDEX] = w;
-+
-+ mix->mixer_gpios = kmalloc(sizeof(*pdata->mixer_gpios) *
-+ pdata->n_mixer_gpios,
-+ GFP_KERNEL);
-+ if (mix->mixer_gpios == NULL) {
-+ err = -ENOMEM;
-+ goto err1;
-+ }
-+ memcpy(mix->mixer_gpios, pdata->mixer_gpios,
-+ sizeof(*pdata->mixer_gpios) * pdata->n_mixer_gpios);
-+ mix->n_mixer_gpios = pdata->n_mixer_gpios;
-+ }
-+
-+ /* PLL control */
-+ tsc2301_write_pll(tsc, pdata->pll_n, pdata->pll_a, pdata->pll_pdc,
-+ 0, mix->pll_output ? 0 : 1);
-+
-+ tsc2301_flush_shadow_regs(tsc);
-+
-+ if (mix->platform_init != NULL) {
-+ err = mix->platform_init(&tsc->spi->dev);
-+ if (err < 0)
-+ goto err2;
-+ }
-+
-+ return 0;
-+err2:
-+ if (mix->mixer_gpios != NULL)
-+ kfree(mix->mixer_gpios);
-+err1:
-+ kfree(mix);
-+ return err;
-+}
-+
-+void tsc2301_mixer_exit(struct tsc2301 *tsc)
-+{
-+ struct tsc2301_mixer *mixer = tsc->mixer;
-+
-+ if (mixer->platform_cleanup != NULL)
-+ mixer->platform_cleanup(&tsc->spi->dev);
-+
-+ if (mixer->mixer_gpios != NULL)
-+ kfree(mixer->mixer_gpios);
-+}
-+
-+MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@nokia.com>");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/include/linux/spi/tsc2301.h
-@@ -0,0 +1,208 @@
-+#ifndef _LINUX_SPI_TSC2301_H
-+#define _LINUX_SPI_TSC2301_H
-+
-+#include <linux/types.h>
-+#include <linux/timer.h>
-+
-+struct tsc2301_platform_data {
-+ /*
-+ * Keypad
-+ */
-+ s16 reset_gpio;
-+ s16 keyb_int;
-+ s16 keymap[16]; /* Set a key to a negative value if not used */
-+ unsigned kp_rep:1; /* Enable keypad repeating */
-+ char *keyb_name; /* Keyboard device name */
-+
-+ /*
-+ * Touchscreen
-+ */
-+ s16 dav_int;
-+ u16 ts_x_plate_ohm;
-+ u32 ts_stab_time; /* voltage settling time */
-+ u8 ts_hw_avg; /* HW assiseted averaging. Can be
-+ 0, 4, 8, 16 samples per reading */
-+ u32 ts_max_pressure;/* Samples with bigger pressure value will
-+ be ignored, since the corresponding X, Y
-+ values are unreliable */
-+ u32 ts_touch_pressure; /* Pressure limit until we report a
-+ touch event. After that we switch
-+ to ts_max_pressure. */
-+ u32 ts_pressure_fudge;
-+ u32 ts_x_max;
-+ u32 ts_x_fudge;
-+ u32 ts_y_max;
-+ u32 ts_y_fudge;
-+
-+ /*
-+ * Audio
-+ */
-+ unsigned pll_pdc:4;
-+ unsigned pll_a:4;
-+ unsigned pll_n:4;
-+ unsigned pll_output:1; /* Output PLL on GPIO_0 */
-+
-+ unsigned mclk_ratio:2;
-+ unsigned i2s_sample_rate:4;
-+ unsigned i2s_format:2;
-+ /* Mask for audio blocks to be powered down */
-+ u16 power_down_blocks;
-+
-+ /* Called after codec has been initialized, can be NULL */
-+ int (* codec_init)(struct device *tsc2301_dev);
-+ /* Called when codec is being removed, can be NULL */
-+ void (* codec_cleanup)(struct device *tsc2301_dev);
-+ int (*enable_clock)(struct device *dev);
-+ void (*disable_clock)(struct device *dev);
-+
-+ const struct tsc2301_mixer_gpio {
-+ const char *name;
-+ unsigned gpio:4;
-+ unsigned inverted:1;
-+ unsigned def_enable:1; /* enable by default */
-+ unsigned deactivate_on_pd:1; /* power-down flag */
-+ } *mixer_gpios;
-+ int n_mixer_gpios;
-+};
-+
-+struct tsc2301_kp;
-+struct tsc2301_ts;
-+struct tsc2301_mixer;
-+
-+struct tsc2301 {
-+ struct spi_device *spi;
-+
-+ s16 reset_gpio;
-+ u16 config2_shadow;
-+
-+ struct tsc2301_kp *kp;
-+ struct tsc2301_ts *ts;
-+ struct tsc2301_mixer *mixer;
-+
-+ int (*enable_clock)(struct device *dev);
-+ void (*disable_clock)(struct device *dev);
-+};
-+
-+
-+#define TSC2301_HZ 33000000
-+
-+#define TSC2301_REG(page, addr) (((page) << 11) | ((addr) << 5))
-+#define TSC2301_REG_TO_PAGE(reg) (((reg) >> 11) & 0x03)
-+#define TSC2301_REG_TO_ADDR(reg) (((reg) >> 5) & 0x1f)
-+
-+#define TSC2301_REG_X TSC2301_REG(0, 0)
-+#define TSC2301_REG_Y TSC2301_REG(0, 1)
-+#define TSC2301_REG_Z1 TSC2301_REG(0, 2)
-+#define TSC2301_REG_Z2 TSC2301_REG(0, 3)
-+#define TSC2301_REG_KPDATA TSC2301_REG(0, 4)
-+#define TSC2301_REG_ADC TSC2301_REG(1, 0)
-+#define TSC2301_REG_KEY TSC2301_REG(1, 1)
-+#define TSC2301_REG_DAC TSC2301_REG(1, 2)
-+#define TSC2301_REG_REF TSC2301_REG(1, 3)
-+#define TSC2301_REG_RESET TSC2301_REG(1, 4)
-+#define TSC2301_REG_CONFIG TSC2301_REG(1, 5)
-+#define TSC2301_REG_CONFIG2 TSC2301_REG(1, 6)
-+#define TSC2301_REG_KPMASK TSC2301_REG(1, 16)
-+#define TSC2301_REG_AUDCNTL TSC2301_REG(2, 0)
-+#define TSC2301_REG_ADCVOL TSC2301_REG(2, 1)
-+#define TSC2301_REG_DACVOL TSC2301_REG(2, 2)
-+#define TSC2301_REG_BPVOL TSC2301_REG(2, 3)
-+#define TSC2301_REG_KEYCTL TSC2301_REG(2, 4)
-+#define TSC2301_REG_PD_MISC TSC2301_REG(2, 5)
-+#define TSC2301_REG_GPIO TSC2301_REG(2, 6)
-+#define TSC2301_REG_ADCLKCFG TSC2301_REG(2, 27)
-+
-+#define TSC2301_REG_PD_MISC_APD (1 << 15)
-+#define TSC2301_REG_PD_MISC_AVPD (1 << 14)
-+#define TSC2301_REG_PD_MISC_ABPD (1 << 13)
-+#define TSC2301_REG_PD_MISC_HAPD (1 << 12)
-+#define TSC2301_REG_PD_MISC_MOPD (1 << 11)
-+#define TSC2301_REG_PD_MISC_DAPD (1 << 10)
-+#define TSC2301_REG_PD_MISC_ADPDL (1 << 9)
-+#define TSC2301_REG_PD_MISC_ADPDR (1 << 8)
-+#define TSC2301_REG_PD_MISC_PDSTS (1 << 7)
-+#define TSC2301_REG_PD_MISC_MIBPD (1 << 6)
-+#define TSC2301_REG_PD_MISC_OTSYN (1 << 2)
-+
-+/* I2S sample rate */
-+#define TSC2301_I2S_SR_48000 0x00
-+#define TSC2301_I2S_SR_44100 0x01
-+#define TSC2301_I2S_SR_32000 0x02
-+#define TSC2301_I2S_SR_24000 0x03
-+#define TSC2301_I2S_SR_22050 0x04
-+#define TSC2301_I2S_SR_16000 0x05
-+#define TSC2301_I2S_SR_12000 0x06
-+#define TSC2301_I2S_SR_11050 0x07
-+#define TSC2301_I2S_SR_8000 0x08
-+
-+/* 16-bit, MSB-first. DAC Right-Justified, ADC Left-Justified */
-+#define TSC2301_I2S_FORMAT0 0x00
-+/* 20-bit, MSB-first. DAC Right-Justified, ADC Left-Justified */
-+#define TSC2301_I2S_FORMAT1 0x01
-+/* 20-bit, MSB-first. DAC Left-Justified, ADC Left-Justified */
-+#define TSC2301_I2S_FORMAT2 0x02
-+/* 20-bit, MSB-first */
-+#define TSC2301_I2S_FORMAT3 0x03
-+
-+/* Master Clock Ratio */
-+#define TSC2301_MCLK_256xFS 0x00 /* default */
-+#define TSC2301_MCLK_384xFS 0x01
-+#define TSC2301_MCLK_512xFS 0x02
-+
-+
-+extern u16 tsc2301_read_reg(struct tsc2301 *tsc, int reg);
-+extern void tsc2301_write_reg(struct tsc2301 *tsc, int reg, u16 val);
-+extern void tsc2301_write_kbc(struct tsc2301 *tsc, int val);
-+extern void tsc2301_write_pll(struct tsc2301 *tsc, int pll_n, int pll_a,
-+ int pll_pdc, int pct_e, int pll_o);
-+extern void tsc2301_read_buf(struct tsc2301 *tsc, int reg, u16 *buf, int len);
-+
-+#define TSC2301_DECL_MOD(module) \
-+extern int tsc2301_##module##_init(struct tsc2301 *tsc, \
-+ struct tsc2301_platform_data *pdata); \
-+extern void tsc2301_##module##_exit(struct tsc2301 *tsc); \
-+extern int tsc2301_##module##_suspend(struct tsc2301 *tsc); \
-+extern void tsc2301_##module##_resume(struct tsc2301 *tsc);
-+
-+#define TSC2301_DECL_EMPTY_MOD(module) \
-+static inline int tsc2301_##module##_init(struct tsc2301 *tsc, \
-+ struct tsc2301_platform_data *pdata) \
-+{ \
-+ return 0; \
-+} \
-+static inline void tsc2301_##module##_exit(struct tsc2301 *tsc) {} \
-+static inline int tsc2301_##module##_suspend(struct tsc2301 *tsc) \
-+{ \
-+ return 0; \
-+} \
-+static inline void tsc2301_##module##_resume(struct tsc2301 *tsc) {}
-+
-+#ifdef CONFIG_KEYBOARD_TSC2301
-+TSC2301_DECL_MOD(kp)
-+void tsc2301_kp_restart(struct tsc2301 *tsc);
-+#else
-+TSC2301_DECL_EMPTY_MOD(kp)
-+static inline void tsc2301_kp_restart(struct tsc2301 *tsc) {}
-+#endif
-+
-+#ifdef CONFIG_TOUCHSCREEN_TSC2301
-+TSC2301_DECL_MOD(ts)
-+#else
-+TSC2301_DECL_EMPTY_MOD(ts)
-+#endif
-+
-+#ifdef CONFIG_SPI_TSC2301_AUDIO
-+TSC2301_DECL_MOD(mixer)
-+extern void tsc2301_mixer_set_power(struct device *tsc_dev, int dac, int adc);
-+
-+struct snd_card;
-+extern int tsc2301_mixer_register_controls(struct device *tsc_dev,
-+ struct snd_card *card);
-+#else
-+TSC2301_DECL_EMPTY_MOD(mixer)
-+#endif
-+
-+extern void tsc2301_mixer_enable_mclk(struct device *tsc_dev);
-+extern void tsc2301_mixer_disable_mclk(struct device *tsc_dev);
-+
-+#endif
diff --git a/target/linux/omap24xx/patches-3.3/320-nokia-various.patch b/target/linux/omap24xx/patches-3.3/320-nokia-various.patch
deleted file mode 100644
index 5d89b8f12b..0000000000
--- a/target/linux/omap24xx/patches-3.3/320-nokia-various.patch
+++ /dev/null
@@ -1,194 +0,0 @@
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -25,6 +25,8 @@
- #include <linux/usb/musb.h>
- #include <sound/tlv320aic3x.h>
- #include <linux/spi/tsc2005.h>
-+#include <linux/input.h>
-+#include <linux/i2c/lm8323.h>
-
- #include <asm/mach/arch.h>
- #include <asm/mach-types.h>
-@@ -37,6 +39,7 @@
- #include <plat/onenand.h>
- #include <plat/mmc.h>
- #include <plat/serial.h>
-+#include <plat/gpio-switch.h>
-
- #include "mux.h"
-
-@@ -104,6 +107,152 @@ extern struct mipid_platform_data n8x0_m
- extern void n8x0_mipid_init(void);
- extern void n8x0_blizzard_init(void);
-
-+/* We map the FN key as LALT to workaround an X keycode problem.
-+ * The XKB map needs to be adjusted to support this. */
-+#define MAP_FN_AS_LEFTALT
-+
-+static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
-+ [0x01] = KEY_Q,
-+ [0x02] = KEY_K,
-+ [0x03] = KEY_O,
-+ [0x04] = KEY_P,
-+ [0x05] = KEY_BACKSPACE,
-+ [0x06] = KEY_A,
-+ [0x07] = KEY_S,
-+ [0x08] = KEY_D,
-+ [0x09] = KEY_F,
-+ [0x0a] = KEY_G,
-+ [0x0b] = KEY_H,
-+ [0x0c] = KEY_J,
-+
-+ [0x11] = KEY_W,
-+ [0x12] = KEY_F4,
-+ [0x13] = KEY_L,
-+ [0x14] = KEY_APOSTROPHE,
-+ [0x16] = KEY_Z,
-+ [0x17] = KEY_X,
-+ [0x18] = KEY_C,
-+ [0x19] = KEY_V,
-+ [0x1a] = KEY_B,
-+ [0x1b] = KEY_N,
-+ [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
-+ [0x1f] = KEY_F7,
-+
-+ [0x21] = KEY_E,
-+ [0x22] = KEY_SEMICOLON,
-+ [0x23] = KEY_MINUS,
-+ [0x24] = KEY_EQUAL,
-+#ifdef MAP_FN_AS_LEFTALT
-+ [0x2b] = KEY_LEFTALT,
-+#else
-+ [0x2b] = KEY_FN,
-+#endif
-+ [0x2c] = KEY_M,
-+ [0x2f] = KEY_F8,
-+
-+ [0x31] = KEY_R,
-+ [0x32] = KEY_RIGHTCTRL,
-+ [0x34] = KEY_SPACE,
-+ [0x35] = KEY_COMMA,
-+ [0x37] = KEY_UP,
-+ [0x3c] = KEY_COMPOSE,
-+ [0x3f] = KEY_F6,
-+
-+ [0x41] = KEY_T,
-+ [0x44] = KEY_DOT,
-+ [0x46] = KEY_RIGHT,
-+ [0x4f] = KEY_F5,
-+ [0x51] = KEY_Y,
-+ [0x53] = KEY_DOWN,
-+ [0x55] = KEY_ENTER,
-+ [0x5f] = KEY_ESC,
-+
-+ [0x61] = KEY_U,
-+ [0x64] = KEY_LEFT,
-+
-+ [0x71] = KEY_I,
-+ [0x75] = KEY_KPENTER,
-+};
-+
-+static struct lm8323_platform_data lm8323_pdata = {
-+ .repeat = 0, /* Repeat is handled in userspace for now. */
-+ .keymap = rx44_keymap,
-+ .size_x = 8,
-+ .size_y = 12,
-+ .debounce_time = 12,
-+ .active_time = 500,
-+
-+ .name = "Internal keyboard",
-+ .pwm_names[0] = "n810::keyboard",
-+ .pwm_names[1] = "n810::cover",
-+};
-+
-+#define OMAP_TAG_NOKIA_BT 0x4e01
-+
-+struct omap_bluetooth_config {
-+ u8 chip_type;
-+ u8 bt_wakeup_gpio;
-+ u8 host_wakeup_gpio;
-+ u8 reset_gpio;
-+ u8 bt_uart;
-+ u8 bd_addr[6];
-+ u8 bt_sysclk;
-+};
-+
-+static struct platform_device n8x0_bt_device = {
-+ .name = "hci_h4p",
-+ .id = -1,
-+ .num_resources = 0,
-+};
-+
-+void __init n8x0_bt_init(void)
-+{
-+ const struct omap_bluetooth_config *bt_config;
-+
-+ bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
-+ struct omap_bluetooth_config);
-+ n8x0_bt_device.dev.platform_data = (void *) bt_config;
-+ if (platform_device_register(&n8x0_bt_device) < 0)
-+ BUG();
-+}
-+
-+static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
-+ {
-+ .name = "headphone",
-+ .gpio = -1,
-+ .debounce_rising = 200,
-+ .debounce_falling = 200,
-+ }, {
-+ .name = "cam_act",
-+ .gpio = -1,
-+ .debounce_rising = 200,
-+ .debounce_falling = 200,
-+ }, {
-+ .name = "cam_turn",
-+ .gpio = -1,
-+ .debounce_rising = 100,
-+ .debounce_falling = 100,
-+ }, {
-+ .name = "slide",
-+ .gpio = -1,
-+ .debounce_rising = 200,
-+ .debounce_falling = 200,
-+ }, {
-+ .name = "kb_lock",
-+ .gpio = -1,
-+ .debounce_rising = 200,
-+ .debounce_falling = 200,
-+ },
-+};
-+
-+static void __init n8x0_gpio_switches_init(void)
-+{
-+ /* The switches are actually registered through ATAG mechanism.
-+ * This just updates the parameters (thus .gpio is -1) */
-+ omap_register_gpio_switches(n8x0_gpio_switches,
-+ ARRAY_SIZE(n8x0_gpio_switches));
-+}
-+
- #define TUSB6010_ASYNC_CS 1
- #define TUSB6010_SYNC_CS 4
- #define TUSB6010_GPIO_INT 58
-@@ -799,6 +948,11 @@ static struct aic3x_pdata n810_aic33_dat
- };
-
- static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
-+ {
-+ I2C_BOARD_INFO("lm8323", 0x45),
-+ .irq = OMAP_GPIO_IRQ(109),
-+ .platform_data = &lm8323_pdata,
-+ },
- {
- I2C_BOARD_INFO("tlv320aic3x", 0x18),
- .platform_data = &n810_aic33_data,
-@@ -856,7 +1010,9 @@ static inline void board_serial_init(voi
- static void __init n8x0_init_machine(void)
- {
- omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-+ n8x0_gpio_switches_init();
- n8x0_cbus_init();
-+ n8x0_bt_init();
-
- /* FIXME: add n810 spi devices */
- tsc2005_set_config();
diff --git a/target/linux/omap24xx/patches-3.3/330-n800-tsc2301-platform.patch b/target/linux/omap24xx/patches-3.3/330-n800-tsc2301-platform.patch
deleted file mode 100644
index 4ceada952e..0000000000
--- a/target/linux/omap24xx/patches-3.3/330-n800-tsc2301-platform.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From f0bb9e67f0f13021e5033fed3dfe8ef78fe6a538 Mon Sep 17 00:00:00 2001
-From: Marat Radchenko <marat@slonopotamus.org>
-Date: Tue, 18 Oct 2011 21:52:56 +0400
-Subject: [PATCH 2/2] N800: add TSC2301 board info
-
-This patch adds TSC2301 init logic to N800 board file
----
- arch/arm/mach-omap2/board-n8x0.c | 141 ++++++++++++++++++++++++++++++++++++--
- 1 files changed, 135 insertions(+), 6 deletions(-)
-
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -27,6 +27,7 @@
- #include <linux/spi/tsc2005.h>
- #include <linux/input.h>
- #include <linux/i2c/lm8323.h>
-+#include <linux/spi/tsc2301.h>
-
- #include <asm/mach/arch.h>
- #include <asm/mach-types.h>
-@@ -63,7 +64,75 @@ static struct omap2_mcspi_device_config
- };
- #endif
-
--static void __init tsc2005_set_config(void)
-+#ifdef CONFIG_TOUCHSCREEN_TSC2301
-+
-+#define N800_KEYB_IRQ_GPIO 109
-+
-+static struct tsc2301_platform_data tsc2301_config = {
-+ .reset_gpio = 118,
-+ .keymap = {
-+ -1, /* Event for bit 0 */
-+ KEY_UP, /* Event for bit 1 (up) */
-+ KEY_F5, /* Event for bit 2 (home) */
-+ -1, /* Event for bit 3 */
-+ KEY_LEFT, /* Event for bit 4 (left) */
-+ KEY_ENTER, /* Event for bit 5 (enter) */
-+ KEY_RIGHT, /* Event for bit 6 (right) */
-+ -1, /* Event for bit 7 */
-+ KEY_ESC, /* Event for bit 8 (cycle) */
-+ KEY_DOWN, /* Event for bit 9 (down) */
-+ KEY_F4, /* Event for bit 10 (menu) */
-+ -1, /* Event for bit 11 */
-+ KEY_F8, /* Event for bit 12 (Zoom-) */
-+ KEY_F6, /* Event for bit 13 (FS) */
-+ KEY_F7, /* Event for bit 14 (Zoom+) */
-+ -1, /* Event for bit 15 */
-+ },
-+ .kp_rep = 0,
-+ .keyb_name = "Internal keypad",
-+};
-+
-+static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
-+ .turbo_mode = 0,
-+ .single_channel = 1,
-+};
-+
-+/*
-+ TODO(Marat Radchenko): better pass GPIO to tsc2301 driver and let it
-+ allocate irq itself (as it is already done for touchscreen)
-+ */
-+static void tsc2301_dev_init(void)
-+{
-+ int r;
-+ int gpio = N800_KEYB_IRQ_GPIO;
-+
-+ r = gpio_request(gpio, "tsc2301 KBD IRQ");
-+ if (r >= 0) {
-+ gpio_direction_input(gpio);
-+ tsc2301_config.keyb_int = gpio_to_irq(gpio);
-+ } else {
-+ printk(KERN_ERR "unable to get KBD GPIO");
-+ }
-+
-+ gpio = 103;
-+ r = gpio_request(gpio, "tsc2301 DAV IRQ");
-+ if (r >= 0) {
-+ gpio_direction_input(gpio);
-+ tsc2301_config.dav_int = gpio_to_irq(gpio);
-+ } else {
-+ printk(KERN_ERR "unable to get DAV GPIO");
-+ }
-+}
-+
-+#else
-+
-+static void __init tsc2301_dev_init(void)
-+{
-+}
-+
-+#endif
-+
-+static void __init n8x0_ts_set_config(void)
- {
- const struct omap_lcd_config *conf;
-
-@@ -94,6 +163,37 @@ static void __init tsc2005_set_config(vo
- tsc2005_config.ts_x_plate_ohm = 200;
- }
- #endif
-+
-+#ifdef CONFIG_TOUCHSCREEN_TSC2301
-+ if (strcmp(conf->panel_name, "lph8923") == 0) {
-+ tsc2301_config.ts_x_plate_ohm = 180;
-+ tsc2301_config.ts_hw_avg = 8;
-+ tsc2301_config.ts_max_pressure = 2048;
-+ tsc2301_config.ts_touch_pressure = 400;
-+ tsc2301_config.ts_stab_time = 100;
-+ tsc2301_config.ts_pressure_fudge = 2;
-+ tsc2301_config.ts_x_max = 4096;
-+ tsc2301_config.ts_x_fudge = 4;
-+ tsc2301_config.ts_y_max = 4096;
-+ tsc2301_config.ts_y_fudge = 7;
-+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
-+ tsc2301_config.ts_x_plate_ohm = 280;
-+ tsc2301_config.ts_hw_avg = 8;
-+ tsc2301_config.ts_touch_pressure = 400;
-+ tsc2301_config.ts_max_pressure = 2048;
-+ tsc2301_config.ts_stab_time = 1000;
-+ tsc2301_config.ts_pressure_fudge = 2;
-+ tsc2301_config.ts_x_max = 4096;
-+ tsc2301_config.ts_x_fudge = 4;
-+ tsc2301_config.ts_y_max = 4096;
-+ tsc2301_config.ts_y_fudge = 7;
-+ } else {
-+ printk(KERN_ERR "Unknown panel type, set default "
-+ "touchscreen configuration\n");
-+ tsc2301_config.ts_x_plate_ohm = 200;
-+ tsc2301_config.ts_stab_time = 100;
-+ }
-+#endif
- }
- }
-
-@@ -347,13 +447,12 @@ static void __init n8x0_usb_init(void) {
-
- #endif /*CONFIG_USB_MUSB_TUSB6010 */
-
--
- static struct omap2_mcspi_device_config p54spi_mcspi_config = {
- .turbo_mode = 0,
- .single_channel = 1,
- };
-
--static struct spi_board_info n800_spi_board_info[] __initdata = {
-+static struct spi_board_info n8x0_common_spi_board_info[] __initdata = {
- {
- .modalias = "lcd_mipid",
- .bus_num = 1,
-@@ -369,6 +468,10 @@ static struct spi_board_info n800_spi_bo
- .max_speed_hz = 48000000,
- .controller_data = &p54spi_mcspi_config,
- },
-+};
-+
-+static struct spi_board_info n810_spi_board_info[] __initdata = {
-+#ifdef CONFIG_TOUCHSCREEN_TSC2005
- {
- .modalias = "tsc2005",
- .bus_num = 1,
-@@ -378,6 +481,20 @@ static struct spi_board_info n800_spi_bo
- .controller_data = &tsc2005_mcspi_config,
- .platform_data = &tsc2005_config,
- },
-+#endif
-+};
-+
-+static struct spi_board_info n800_spi_board_info[] __initdata = {
-+#if defined(CONFIG_TOUCHSCREEN_TSC2301)
-+ {
-+ .modalias = "tsc2301",
-+ .bus_num = 1,
-+ .chip_select = 0,
-+ .max_speed_hz = 6000000,
-+ .controller_data = &tsc2301_mcspi_config,
-+ .platform_data = &tsc2301_config,
-+ },
-+#endif
- };
-
- #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-@@ -1015,9 +1132,17 @@ static void __init n8x0_init_machine(voi
- n8x0_bt_init();
-
- /* FIXME: add n810 spi devices */
-- tsc2005_set_config();
-- spi_register_board_info(n800_spi_board_info,
-- ARRAY_SIZE(n800_spi_board_info));
-+ n8x0_ts_set_config();
-+
-+ spi_register_board_info(n8x0_common_spi_board_info,
-+ ARRAY_SIZE(n8x0_common_spi_board_info));
-+ if (machine_is_nokia_n800())
-+ spi_register_board_info(n800_spi_board_info,
-+ ARRAY_SIZE(n800_spi_board_info));
-+ else
-+ spi_register_board_info(n810_spi_board_info,
-+ ARRAY_SIZE(n810_spi_board_info));
-+
- omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
- ARRAY_SIZE(n8x0_i2c_board_info_1));
- omap_register_i2c_bus(2, 400, NULL, 0);
-@@ -1027,6 +1152,8 @@ static void __init n8x0_init_machine(voi
- board_serial_init();
- n8x0_mipid_init();
- n8x0_blizzard_init();
-+ if (machine_is_nokia_n800())
-+ tsc2301_dev_init();
- omap_sdrc_init(NULL, NULL);
- gpmc_onenand_init(board_onenand_data);
- n8x0_mmc_init();
diff --git a/target/linux/omap24xx/patches-3.3/350-n8x0-gpioswitch-input.patch b/target/linux/omap24xx/patches-3.3/350-n8x0-gpioswitch-input.patch
deleted file mode 100644
index 1a6c2812e4..0000000000
--- a/target/linux/omap24xx/patches-3.3/350-n8x0-gpioswitch-input.patch
+++ /dev/null
@@ -1,98 +0,0 @@
----
- arch/arm/mach-omap2/board-n8x0.c | 73 +++++++++++++++++++++++++++++++++++++++
- 1 file changed, 73 insertions(+)
-
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -316,6 +316,77 @@ void __init n8x0_bt_init(void)
- BUG();
- }
-
-+struct gpio_switch_input_dev {
-+ struct input_dev *idev;
-+ unsigned int swcode;
-+};
-+
-+static struct gpio_switch_input_dev *slide_input;
-+static struct gpio_switch_input_dev *kblock_input;
-+
-+static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
-+ int state)
-+{
-+ if (gdev) {
-+ input_report_switch(gdev->idev, gdev->swcode, state);
-+ input_sync(gdev->idev);
-+ }
-+}
-+
-+static void n8x0_slide_notify(void *data, int state)
-+{
-+ n8x0_gpio_switch_input_notify(slide_input, state);
-+}
-+
-+static void n8x0_kb_lock_notify(void *data, int state)
-+{
-+ n8x0_gpio_switch_input_notify(kblock_input, state);
-+}
-+
-+static struct gpio_switch_input_dev * __init gpioswitch_input_init(
-+ const char *name,
-+ unsigned int swcode)
-+{
-+ struct gpio_switch_input_dev *gdev;
-+ int err;
-+
-+ gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
-+ if (!gdev)
-+ goto error;
-+ gdev->swcode = swcode;
-+
-+ gdev->idev = input_allocate_device();
-+ if (!gdev->idev)
-+ goto err_free;
-+
-+ gdev->idev->evbit[0] = BIT_MASK(EV_SW);
-+ gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
-+ gdev->idev->name = name;
-+
-+ err = input_register_device(gdev->idev);
-+ if (err)
-+ goto err_free_idev;
-+
-+ return gdev;
-+
-+err_free_idev:
-+ input_free_device(gdev->idev);
-+err_free:
-+ kfree(gdev);
-+error:
-+ return NULL;
-+}
-+
-+static int __init n8x0_gpio_switches_input_init(void)
-+{
-+ slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
-+ kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
-+ if (WARN_ON(!slide_input || !kblock_input))
-+ return -ENODEV;
-+ return 0;
-+}
-+late_initcall(n8x0_gpio_switches_input_init);
-+
- static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
- {
- .name = "headphone",
-@@ -337,11 +408,13 @@ static struct omap_gpio_switch n8x0_gpio
- .gpio = -1,
- .debounce_rising = 200,
- .debounce_falling = 200,
-+ .notify = n8x0_slide_notify,
- }, {
- .name = "kb_lock",
- .gpio = -1,
- .debounce_rising = 200,
- .debounce_falling = 200,
-+ .notify = n8x0_kb_lock_notify,
- },
- };
-
diff --git a/target/linux/omap24xx/patches-3.3/400-bluetooth-hci_h4p.patch b/target/linux/omap24xx/patches-3.3/400-bluetooth-hci_h4p.patch
deleted file mode 100644
index 408da4a3a0..0000000000
--- a/target/linux/omap24xx/patches-3.3/400-bluetooth-hci_h4p.patch
+++ /dev/null
@@ -1,1946 +0,0 @@
----
- drivers/bluetooth/Kconfig | 10
- drivers/bluetooth/Makefile | 1
- drivers/bluetooth/hci_h4p/Makefile | 7
- drivers/bluetooth/hci_h4p/core.c | 1043 ++++++++++++++++++++++++++++++++++++
- drivers/bluetooth/hci_h4p/fw-csr.c | 149 +++++
- drivers/bluetooth/hci_h4p/fw-ti.c | 90 +++
- drivers/bluetooth/hci_h4p/fw.c | 155 +++++
- drivers/bluetooth/hci_h4p/hci_h4p.h | 183 ++++++
- drivers/bluetooth/hci_h4p/sysfs.c | 84 ++
- drivers/bluetooth/hci_h4p/uart.c | 169 +++++
- 10 files changed, 1891 insertions(+)
-
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/core.c
-@@ -0,0 +1,1043 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/module.h>
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/errno.h>
-+#include <linux/delay.h>
-+#include <linux/spinlock.h>
-+#include <linux/serial_reg.h>
-+#include <linux/skbuff.h>
-+#include <linux/timer.h>
-+#include <linux/device.h>
-+#include <linux/platform_device.h>
-+#include <linux/clk.h>
-+#include <linux/gpio.h>
-+
-+#include <mach/hardware.h>
-+#include <mach/board.h>
-+#include <mach/irqs.h>
-+#include <plat/serial.h>
-+
-+#include <net/bluetooth/bluetooth.h>
-+#include <net/bluetooth/hci_core.h>
-+#include <net/bluetooth/hci.h>
-+
-+#include "hci_h4p.h"
-+
-+#define PM_TIMEOUT 200
-+
-+struct omap_bluetooth_config {
-+ u8 chip_type;
-+ u8 bt_wakeup_gpio;
-+ u8 host_wakeup_gpio;
-+ u8 reset_gpio;
-+ u8 bt_uart;
-+ u8 bd_addr[6];
-+ u8 bt_sysclk;
-+};
-+
-+/* This should be used in function that cannot release clocks */
-+static void hci_h4p_set_clk(struct hci_h4p_info *info, int *clock, int enable)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&info->clocks_lock, flags);
-+ if (enable && !*clock) {
-+ NBT_DBG_POWER("Enabling %p\n", clock);
-+ clk_enable(info->uart_fclk);
-+#ifdef CONFIG_ARCH_OMAP2
-+ if (cpu_is_omap24xx()) {
-+ clk_enable(info->uart_iclk);
-+ //omap2_block_sleep();
-+ }
-+#endif
-+ }
-+ if (!enable && *clock) {
-+ NBT_DBG_POWER("Disabling %p\n", clock);
-+ clk_disable(info->uart_fclk);
-+#ifdef CONFIG_ARCH_OMAP2
-+ if (cpu_is_omap24xx()) {
-+ clk_disable(info->uart_iclk);
-+ //omap2_allow_sleep();
-+ }
-+#endif
-+ }
-+
-+ *clock = enable;
-+ spin_unlock_irqrestore(&info->clocks_lock, flags);
-+}
-+
-+/* Power management functions */
-+static void hci_h4p_disable_tx(struct hci_h4p_info *info)
-+{
-+ NBT_DBG_POWER("\n");
-+
-+ if (!info->pm_enabled)
-+ return;
-+
-+ mod_timer(&info->tx_pm_timer, jiffies + msecs_to_jiffies(PM_TIMEOUT));
-+}
-+
-+static void hci_h4p_enable_tx(struct hci_h4p_info *info)
-+{
-+ NBT_DBG_POWER("\n");
-+
-+ if (!info->pm_enabled)
-+ return;
-+
-+ del_timer_sync(&info->tx_pm_timer);
-+ if (info->tx_pm_enabled) {
-+ info->tx_pm_enabled = 0;
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 1);
-+ gpio_set_value(info->bt_wakeup_gpio, 1);
-+ }
-+}
-+
-+static void hci_h4p_tx_pm_timer(unsigned long data)
-+{
-+ struct hci_h4p_info *info;
-+
-+ NBT_DBG_POWER("\n");
-+
-+ info = (struct hci_h4p_info *)data;
-+
-+ if (hci_h4p_inb(info, UART_LSR) & UART_LSR_TEMT) {
-+ gpio_set_value(info->bt_wakeup_gpio, 0);
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 0);
-+ info->tx_pm_enabled = 1;
-+ }
-+ else {
-+ mod_timer(&info->tx_pm_timer, jiffies + msecs_to_jiffies(PM_TIMEOUT));
-+ }
-+}
-+
-+static void hci_h4p_disable_rx(struct hci_h4p_info *info)
-+{
-+ if (!info->pm_enabled)
-+ return;
-+
-+ mod_timer(&info->rx_pm_timer, jiffies + msecs_to_jiffies(PM_TIMEOUT));
-+}
-+
-+static void hci_h4p_enable_rx(struct hci_h4p_info *info)
-+{
-+ unsigned long flags;
-+
-+ if (!info->pm_enabled)
-+ return;
-+
-+ del_timer_sync(&info->rx_pm_timer);
-+ spin_lock_irqsave(&info->lock, flags);
-+ if (info->rx_pm_enabled) {
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 1);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) | UART_IER_RDI);
-+ __hci_h4p_set_auto_ctsrts(info, 1, UART_EFR_RTS);
-+ info->rx_pm_enabled = 0;
-+ }
-+ spin_unlock_irqrestore(&info->lock, flags);
-+}
-+
-+static void hci_h4p_rx_pm_timer(unsigned long data)
-+{
-+ unsigned long flags;
-+ struct hci_h4p_info *info = (struct hci_h4p_info *)data;
-+
-+ spin_lock_irqsave(&info->lock, flags);
-+ if (!(hci_h4p_inb(info, UART_LSR) & UART_LSR_DR)) {
-+ __hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_RTS);
-+ hci_h4p_set_rts(info, 0);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) & ~UART_IER_RDI);
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 0);
-+ info->rx_pm_enabled = 1;
-+ }
-+ else {
-+ mod_timer(&info->rx_pm_timer, jiffies + msecs_to_jiffies(PM_TIMEOUT));
-+ }
-+ spin_unlock_irqrestore(&info->lock, flags);
-+}
-+
-+/* Negotiation functions */
-+int hci_h4p_send_alive_packet(struct hci_h4p_info *info)
-+{
-+ NBT_DBG("Sending alive packet\n");
-+
-+ if (!info->alive_cmd_skb)
-+ return -EINVAL;
-+
-+ /* Keep reference to buffer so we can reuse it */
-+ info->alive_cmd_skb = skb_get(info->alive_cmd_skb);
-+
-+ skb_queue_tail(&info->txq, info->alive_cmd_skb);
-+ tasklet_schedule(&info->tx_task);
-+
-+ NBT_DBG("Alive packet sent\n");
-+
-+ return 0;
-+}
-+
-+static void hci_h4p_alive_packet(struct hci_h4p_info *info, struct sk_buff *skb)
-+{
-+ NBT_DBG("Received alive packet\n");
-+ if (skb->data[1] == 0xCC) {
-+ complete(&info->init_completion);
-+ }
-+
-+ kfree_skb(skb);
-+}
-+
-+static int hci_h4p_send_negotiation(struct hci_h4p_info *info, struct sk_buff *skb)
-+{
-+ NBT_DBG("Sending negotiation..\n");
-+
-+ hci_h4p_change_speed(info, INIT_SPEED);
-+
-+ info->init_error = 0;
-+ init_completion(&info->init_completion);
-+ skb_queue_tail(&info->txq, skb);
-+ tasklet_schedule(&info->tx_task);
-+
-+ if (!wait_for_completion_interruptible_timeout(&info->init_completion,
-+ msecs_to_jiffies(1000)))
-+ return -ETIMEDOUT;
-+
-+ NBT_DBG("Negotiation sent\n");
-+ return info->init_error;
-+}
-+
-+static void hci_h4p_negotiation_packet(struct hci_h4p_info *info,
-+ struct sk_buff *skb)
-+{
-+ int err = 0;
-+
-+ if (skb->data[1] == 0x20) {
-+ /* Change to operational settings */
-+ hci_h4p_set_rts(info, 0);
-+
-+ err = hci_h4p_wait_for_cts(info, 0, 100);
-+ if (err < 0)
-+ goto neg_ret;
-+
-+ hci_h4p_change_speed(info, MAX_BAUD_RATE);
-+
-+ err = hci_h4p_wait_for_cts(info, 1, 100);
-+ if (err < 0)
-+ goto neg_ret;
-+
-+ hci_h4p_set_auto_ctsrts(info, 1, UART_EFR_CTS | UART_EFR_RTS);
-+
-+ err = hci_h4p_send_alive_packet(info);
-+ if (err < 0)
-+ goto neg_ret;
-+ } else {
-+ dev_err(info->dev, "Could not negotiate hci_h4p settings\n");
-+ err = -EINVAL;
-+ goto neg_ret;
-+ }
-+
-+ kfree_skb(skb);
-+ return;
-+
-+neg_ret:
-+ info->init_error = err;
-+ complete(&info->init_completion);
-+ kfree_skb(skb);
-+}
-+
-+/* H4 packet handling functions */
-+static int hci_h4p_get_hdr_len(struct hci_h4p_info *info, u8 pkt_type)
-+{
-+ long retval;
-+
-+ switch (pkt_type) {
-+ case H4_EVT_PKT:
-+ retval = HCI_EVENT_HDR_SIZE;
-+ break;
-+ case H4_ACL_PKT:
-+ retval = HCI_ACL_HDR_SIZE;
-+ break;
-+ case H4_SCO_PKT:
-+ retval = HCI_SCO_HDR_SIZE;
-+ break;
-+ case H4_NEG_PKT:
-+ retval = 11;
-+ break;
-+ case H4_ALIVE_PKT:
-+ retval = 3;
-+ break;
-+ default:
-+ dev_err(info->dev, "Unknown H4 packet type 0x%.2x\n", pkt_type);
-+ retval = -1;
-+ break;
-+ }
-+
-+ return retval;
-+}
-+
-+static unsigned int hci_h4p_get_data_len(struct hci_h4p_info *info,
-+ struct sk_buff *skb)
-+{
-+ long retval = -1;
-+ struct hci_event_hdr *evt_hdr;
-+ struct hci_acl_hdr *acl_hdr;
-+ struct hci_sco_hdr *sco_hdr;
-+
-+ switch (bt_cb(skb)->pkt_type) {
-+ case H4_EVT_PKT:
-+ evt_hdr = (struct hci_event_hdr *)skb->data;
-+ retval = evt_hdr->plen;
-+ break;
-+ case H4_ACL_PKT:
-+ acl_hdr = (struct hci_acl_hdr *)skb->data;
-+ retval = le16_to_cpu(acl_hdr->dlen);
-+ break;
-+ case H4_SCO_PKT:
-+ sco_hdr = (struct hci_sco_hdr *)skb->data;
-+ retval = sco_hdr->dlen;
-+ break;
-+ case H4_NEG_PKT:
-+ retval = 0;
-+ break;
-+ case H4_ALIVE_PKT:
-+ retval = 0;
-+ break;
-+ }
-+
-+ return retval;
-+}
-+
-+static inline void hci_h4p_recv_frame(struct hci_h4p_info *info,
-+ struct sk_buff *skb)
-+{
-+
-+ if (unlikely(!test_bit(HCI_RUNNING, &info->hdev->flags))) {
-+ NBT_DBG("fw_event\n");
-+ hci_h4p_parse_fw_event(info, skb);
-+ } else {
-+ hci_recv_frame(skb);
-+ NBT_DBG("Frame sent to upper layer\n");
-+ }
-+}
-+
-+static void hci_h4p_rx_tasklet(unsigned long data)
-+{
-+ u8 byte;
-+ unsigned long flags;
-+ struct hci_h4p_info *info = (struct hci_h4p_info *)data;
-+
-+ NBT_DBG("tasklet woke up\n");
-+ NBT_DBG_TRANSFER("rx_tasklet woke up\ndata ");
-+
-+ while (hci_h4p_inb(info, UART_LSR) & UART_LSR_DR) {
-+ byte = hci_h4p_inb(info, UART_RX);
-+ if (info->garbage_bytes) {
-+ info->garbage_bytes--;
-+ continue;
-+ }
-+ if (info->rx_skb == NULL) {
-+ info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC | GFP_DMA);
-+ if (!info->rx_skb) {
-+ dev_err(info->dev, "Can't allocate memory for new packet\n");
-+ goto finish_task;
-+ }
-+ info->rx_state = WAIT_FOR_PKT_TYPE;
-+ info->rx_skb->dev = (void *)info->hdev;
-+ }
-+ info->hdev->stat.byte_rx++;
-+ NBT_DBG_TRANSFER_NF("0x%.2x ", byte);
-+ switch (info->rx_state) {
-+ case WAIT_FOR_PKT_TYPE:
-+ bt_cb(info->rx_skb)->pkt_type = byte;
-+ info->rx_count = hci_h4p_get_hdr_len(info, byte);
-+ if (info->rx_count < 0) {
-+ info->hdev->stat.err_rx++;
-+ kfree_skb(info->rx_skb);
-+ info->rx_skb = NULL;
-+ } else {
-+ info->rx_state = WAIT_FOR_HEADER;
-+ }
-+ break;
-+ case WAIT_FOR_HEADER:
-+ info->rx_count--;
-+ *skb_put(info->rx_skb, 1) = byte;
-+ if (info->rx_count == 0) {
-+ info->rx_count = hci_h4p_get_data_len(info, info->rx_skb);
-+ if (info->rx_count > skb_tailroom(info->rx_skb)) {
-+ dev_err(info->dev, "Frame is %ld bytes too long.\n",
-+ info->rx_count - skb_tailroom(info->rx_skb));
-+ kfree_skb(info->rx_skb);
-+ info->rx_skb = NULL;
-+ info->garbage_bytes = info->rx_count - skb_tailroom(info->rx_skb);
-+ break;
-+ }
-+ info->rx_state = WAIT_FOR_DATA;
-+
-+ if (bt_cb(info->rx_skb)->pkt_type == H4_NEG_PKT) {
-+ hci_h4p_negotiation_packet(info, info->rx_skb);
-+ info->rx_skb = NULL;
-+ info->rx_state = WAIT_FOR_PKT_TYPE;
-+ goto finish_task;
-+ }
-+ if (bt_cb(info->rx_skb)->pkt_type == H4_ALIVE_PKT) {
-+ hci_h4p_alive_packet(info, info->rx_skb);
-+ info->rx_skb = NULL;
-+ info->rx_state = WAIT_FOR_PKT_TYPE;
-+ goto finish_task;
-+ }
-+ }
-+ break;
-+ case WAIT_FOR_DATA:
-+ info->rx_count--;
-+ *skb_put(info->rx_skb, 1) = byte;
-+ if (info->rx_count == 0) {
-+ /* H4+ devices should allways send word aligned packets */
-+ if (!(info->rx_skb->len % 2)) {
-+ info->garbage_bytes++;
-+ }
-+ hci_h4p_recv_frame(info, info->rx_skb);
-+ info->rx_skb = NULL;
-+ }
-+ break;
-+ default:
-+ WARN_ON(1);
-+ break;
-+ }
-+ }
-+
-+finish_task:
-+ spin_lock_irqsave(&info->lock, flags);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) | UART_IER_RDI);
-+ spin_unlock_irqrestore(&info->lock, flags);
-+
-+ NBT_DBG_TRANSFER_NF("\n");
-+ NBT_DBG("rx_ended\n");
-+}
-+
-+static void hci_h4p_tx_tasklet(unsigned long data)
-+{
-+ unsigned int sent = 0;
-+ unsigned long flags;
-+ struct sk_buff *skb;
-+ struct hci_h4p_info *info = (struct hci_h4p_info *)data;
-+
-+ NBT_DBG("tasklet woke up\n");
-+ NBT_DBG_TRANSFER("tx_tasklet woke up\n data ");
-+
-+ skb = skb_dequeue(&info->txq);
-+ if (!skb) {
-+ /* No data in buffer */
-+ NBT_DBG("skb ready\n");
-+ hci_h4p_disable_tx(info);
-+ return;
-+ }
-+
-+ /* Copy data to tx fifo */
-+ while (!(hci_h4p_inb(info, UART_OMAP_SSR) & UART_OMAP_SSR_TXFULL) &&
-+ (sent < skb->len)) {
-+ NBT_DBG_TRANSFER_NF("0x%.2x ", skb->data[sent]);
-+ hci_h4p_outb(info, UART_TX, skb->data[sent]);
-+ sent++;
-+ }
-+
-+ info->hdev->stat.byte_tx += sent;
-+ NBT_DBG_TRANSFER_NF("\n");
-+ if (skb->len == sent) {
-+ kfree_skb(skb);
-+ } else {
-+ skb_pull(skb, sent);
-+ skb_queue_head(&info->txq, skb);
-+ }
-+
-+ spin_lock_irqsave(&info->lock, flags);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) | UART_IER_THRI);
-+ spin_unlock_irqrestore(&info->lock, flags);
-+}
-+
-+static irqreturn_t hci_h4p_interrupt(int irq, void *data)
-+{
-+ struct hci_h4p_info *info = (struct hci_h4p_info *)data;
-+ u8 iir, msr;
-+ int ret;
-+ unsigned long flags;
-+
-+ ret = IRQ_NONE;
-+
-+ iir = hci_h4p_inb(info, UART_IIR);
-+ if (iir & UART_IIR_NO_INT) {
-+ dev_err(info->dev, "Interrupt but no reason irq 0x%.2x\n", iir);
-+ return IRQ_HANDLED;
-+ }
-+
-+ NBT_DBG("In interrupt handler iir 0x%.2x\n", iir);
-+
-+ iir &= UART_IIR_ID;
-+
-+ if (iir == UART_IIR_MSI) {
-+ msr = hci_h4p_inb(info, UART_MSR);
-+ ret = IRQ_HANDLED;
-+ }
-+ if (iir == UART_IIR_RLSI) {
-+ hci_h4p_inb(info, UART_RX);
-+ hci_h4p_inb(info, UART_LSR);
-+ ret = IRQ_HANDLED;
-+ }
-+
-+ if (iir == UART_IIR_RDI) {
-+ spin_lock_irqsave(&info->lock, flags);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) & ~UART_IER_RDI);
-+ spin_unlock_irqrestore(&info->lock, flags);
-+ tasklet_schedule(&info->rx_task);
-+ ret = IRQ_HANDLED;
-+ }
-+
-+ if (iir == UART_IIR_THRI) {
-+ spin_lock_irqsave(&info->lock, flags);
-+ hci_h4p_outb(info, UART_IER, hci_h4p_inb(info, UART_IER) & ~UART_IER_THRI);
-+ spin_unlock_irqrestore(&info->lock, flags);
-+ tasklet_schedule(&info->tx_task);
-+ ret = IRQ_HANDLED;
-+ }
-+
-+ return ret;
-+}
-+
-+static irqreturn_t hci_h4p_wakeup_interrupt(int irq, void *dev_inst)
-+{
-+ struct hci_h4p_info *info = dev_inst;
-+ int should_wakeup;
-+ struct hci_dev *hdev;
-+
-+ if (!info->hdev)
-+ return IRQ_HANDLED;
-+
-+ hdev = info->hdev;
-+
-+ if (!test_bit(HCI_RUNNING, &hdev->flags))
-+ return IRQ_HANDLED;
-+
-+ should_wakeup = gpio_get_value(info->host_wakeup_gpio);
-+ NBT_DBG_POWER("gpio interrupt %d\n", should_wakeup);
-+ if (should_wakeup) {
-+ hci_h4p_enable_rx(info);
-+ } else {
-+ hci_h4p_disable_rx(info);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int hci_h4p_reset(struct hci_h4p_info *info)
-+{
-+ int err;
-+
-+ hci_h4p_init_uart(info);
-+ hci_h4p_set_rts(info, 0);
-+
-+ gpio_set_value(info->reset_gpio, 0);
-+ msleep(100);
-+ gpio_set_value(info->bt_wakeup_gpio, 1);
-+ gpio_set_value(info->reset_gpio, 1);
-+ msleep(100);
-+
-+ err = hci_h4p_wait_for_cts(info, 1, 10);
-+ if (err < 0) {
-+ dev_err(info->dev, "No cts from bt chip\n");
-+ return err;
-+ }
-+
-+ hci_h4p_set_rts(info, 1);
-+
-+ return 0;
-+}
-+
-+/* hci callback functions */
-+static int hci_h4p_hci_flush(struct hci_dev *hdev)
-+{
-+ struct hci_h4p_info *info;
-+ info = hdev->driver_data;
-+
-+ skb_queue_purge(&info->txq);
-+
-+ return 0;
-+}
-+
-+static int hci_h4p_hci_open(struct hci_dev *hdev)
-+{
-+ struct hci_h4p_info *info;
-+ int err;
-+ struct sk_buff *neg_cmd_skb;
-+ struct sk_buff_head fw_queue;
-+
-+ info = hdev->driver_data;
-+
-+ if (test_bit(HCI_RUNNING, &hdev->flags))
-+ return 0;
-+
-+ skb_queue_head_init(&fw_queue);
-+ err = hci_h4p_read_fw(info, &fw_queue);
-+ if (err < 0) {
-+ dev_err(info->dev, "Cannot read firmware\n");
-+ return err;
-+ }
-+ neg_cmd_skb = skb_dequeue(&fw_queue);
-+ if (!neg_cmd_skb) {
-+ err = -EPROTO;
-+ goto err_clean;
-+ }
-+ info->alive_cmd_skb = skb_dequeue(&fw_queue);
-+ if (!info->alive_cmd_skb) {
-+ err = -EPROTO;
-+ goto err_clean;
-+ }
-+
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 1);
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 1);
-+
-+ tasklet_enable(&info->tx_task);
-+ tasklet_enable(&info->rx_task);
-+ info->rx_state = WAIT_FOR_PKT_TYPE;
-+ info->rx_count = 0;
-+ info->garbage_bytes = 0;
-+ info->rx_skb = NULL;
-+ info->pm_enabled = 0;
-+ init_completion(&info->fw_completion);
-+
-+ err = hci_h4p_reset(info);
-+ if (err < 0)
-+ goto err_clean;
-+
-+ err = hci_h4p_send_negotiation(info, neg_cmd_skb);
-+ neg_cmd_skb = NULL;
-+ if (err < 0)
-+ goto err_clean;
-+
-+ err = hci_h4p_send_fw(info, &fw_queue);
-+ if (err < 0) {
-+ dev_err(info->dev, "Sending firmware failed.\n");
-+ goto err_clean;
-+ }
-+
-+ kfree_skb(info->alive_cmd_skb);
-+ info->alive_cmd_skb = NULL;
-+ info->pm_enabled = 1;
-+ info->tx_pm_enabled = 1;
-+ info->rx_pm_enabled = 0;
-+ set_bit(HCI_RUNNING, &hdev->flags);
-+
-+ NBT_DBG("hci up and running\n");
-+ return 0;
-+
-+err_clean:
-+ hci_h4p_hci_flush(hdev);
-+ tasklet_disable(&info->tx_task);
-+ tasklet_disable(&info->rx_task);
-+ hci_h4p_reset_uart(info);
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 0);
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 0);
-+ gpio_set_value(info->reset_gpio, 0);
-+ gpio_set_value(info->bt_wakeup_gpio, 0);
-+ skb_queue_purge(&fw_queue);
-+ kfree_skb(neg_cmd_skb);
-+ neg_cmd_skb = NULL;
-+ kfree_skb(info->alive_cmd_skb);
-+ info->alive_cmd_skb = NULL;
-+ kfree_skb(info->rx_skb);
-+
-+ return err;
-+}
-+
-+static int hci_h4p_hci_close(struct hci_dev *hdev)
-+{
-+ struct hci_h4p_info *info = hdev->driver_data;
-+
-+ if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
-+ return 0;
-+
-+ hci_h4p_hci_flush(hdev);
-+ del_timer_sync(&info->tx_pm_timer);
-+ del_timer_sync(&info->rx_pm_timer);
-+ tasklet_disable(&info->tx_task);
-+ tasklet_disable(&info->rx_task);
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 1);
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 1);
-+ hci_h4p_reset_uart(info);
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 0);
-+ hci_h4p_set_clk(info, &info->rx_clocks_en, 0);
-+ gpio_set_value(info->reset_gpio, 0);
-+ gpio_set_value(info->bt_wakeup_gpio, 0);
-+ kfree_skb(info->rx_skb);
-+
-+ return 0;
-+}
-+
-+static void hci_h4p_hci_destruct(struct hci_dev *hdev)
-+{
-+}
-+
-+static int hci_h4p_hci_send_frame(struct sk_buff *skb)
-+{
-+ struct hci_h4p_info *info;
-+ struct hci_dev *hdev = (struct hci_dev *)skb->dev;
-+ int err = 0;
-+
-+ if (!hdev) {
-+ printk(KERN_WARNING "hci_h4p: Frame for unknown device\n");
-+ return -ENODEV;
-+ }
-+
-+ NBT_DBG("dev %p, skb %p\n", hdev, skb);
-+
-+ info = hdev->driver_data;
-+
-+ if (!test_bit(HCI_RUNNING, &hdev->flags)) {
-+ dev_warn(info->dev, "Frame for non-running device\n");
-+ return -EIO;
-+ }
-+
-+ switch (bt_cb(skb)->pkt_type) {
-+ case HCI_COMMAND_PKT:
-+ hdev->stat.cmd_tx++;
-+ break;
-+ case HCI_ACLDATA_PKT:
-+ hdev->stat.acl_tx++;
-+ break;
-+ case HCI_SCODATA_PKT:
-+ hdev->stat.sco_tx++;
-+ break;
-+ }
-+
-+ /* Push frame type to skb */
-+ *skb_push(skb, 1) = (bt_cb(skb)->pkt_type);
-+ /* We should allways send word aligned data to h4+ devices */
-+ if (skb->len % 2) {
-+ err = skb_pad(skb, 1);
-+ }
-+ if (err)
-+ return err;
-+
-+ hci_h4p_enable_tx(info);
-+ skb_queue_tail(&info->txq, skb);
-+ tasklet_schedule(&info->tx_task);
-+
-+ return 0;
-+}
-+
-+static int hci_h4p_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
-+{
-+ return -ENOIOCTLCMD;
-+}
-+
-+static int hci_h4p_register_hdev(struct hci_h4p_info *info)
-+{
-+ struct hci_dev *hdev;
-+
-+ /* Initialize and register HCI device */
-+
-+ hdev = hci_alloc_dev();
-+ if (!hdev) {
-+ dev_err(info->dev, "Can't allocate memory for device\n");
-+ return -ENOMEM;
-+ }
-+ info->hdev = hdev;
-+
-+ hdev->dev_type = HCI_UART;
-+ hdev->driver_data = info;
-+
-+ hdev->open = hci_h4p_hci_open;
-+ hdev->close = hci_h4p_hci_close;
-+ hdev->flush = hci_h4p_hci_flush;
-+ hdev->send = hci_h4p_hci_send_frame;
-+ hdev->destruct = hci_h4p_hci_destruct;
-+ hdev->ioctl = hci_h4p_hci_ioctl;
-+
-+ hdev->owner = THIS_MODULE;
-+
-+ if (hci_register_dev(hdev) < 0) {
-+ dev_err(info->dev, "hci_h4p: Can't register HCI device %s.\n", hdev->name);
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
-+static int hci_h4p_probe(struct platform_device *pdev)
-+{
-+ struct omap_bluetooth_config *bt_config;
-+ struct hci_h4p_info *info;
-+ int irq, err;
-+
-+ dev_info(&pdev->dev, "Registering HCI H4P device\n");
-+ info = kzalloc(sizeof(struct hci_h4p_info), GFP_KERNEL);
-+ if (!info)
-+ return -ENOMEM;
-+
-+ info->dev = &pdev->dev;
-+ info->pm_enabled = 0;
-+ info->tx_pm_enabled = 0;
-+ info->rx_pm_enabled = 0;
-+ info->garbage_bytes = 0;
-+ info->tx_clocks_en = 0;
-+ info->rx_clocks_en = 0;
-+ tasklet_init(&info->tx_task, hci_h4p_tx_tasklet, (unsigned long)info);
-+ tasklet_init(&info->rx_task, hci_h4p_rx_tasklet, (unsigned long)info);
-+ /* hci_h4p_hci_open assumes that tasklet is disabled in startup */
-+ tasklet_disable(&info->tx_task);
-+ tasklet_disable(&info->rx_task);
-+ spin_lock_init(&info->lock);
-+ spin_lock_init(&info->clocks_lock);
-+ skb_queue_head_init(&info->txq);
-+ init_timer(&info->tx_pm_timer);
-+ info->tx_pm_timer.function = hci_h4p_tx_pm_timer;
-+ info->tx_pm_timer.data = (unsigned long)info;
-+ init_timer(&info->rx_pm_timer);
-+ info->rx_pm_timer.function = hci_h4p_rx_pm_timer;
-+ info->rx_pm_timer.data = (unsigned long)info;
-+
-+ if (pdev->dev.platform_data == NULL) {
-+ dev_err(&pdev->dev, "Could not get Bluetooth config data\n");
-+ return -ENODATA;
-+ }
-+
-+ bt_config = pdev->dev.platform_data;
-+ info->chip_type = bt_config->chip_type;
-+ info->bt_wakeup_gpio = bt_config->bt_wakeup_gpio;
-+ info->host_wakeup_gpio = bt_config->host_wakeup_gpio;
-+ info->reset_gpio = bt_config->reset_gpio;
-+ info->bt_sysclk = bt_config->bt_sysclk;
-+
-+ NBT_DBG("RESET gpio: %d\n", info->reset_gpio);
-+ NBT_DBG("BTWU gpio: %d\n", info->bt_wakeup_gpio);
-+ NBT_DBG("HOSTWU gpio: %d\n", info->host_wakeup_gpio);
-+ NBT_DBG("Uart: %d\n", bt_config->bt_uart);
-+ NBT_DBG("sysclk: %d\n", info->bt_sysclk);
-+
-+ err = gpio_request(info->reset_gpio, "BT reset");
-+ if (err < 0) {
-+ dev_err(&pdev->dev, "Cannot get GPIO line %d\n",
-+ info->reset_gpio);
-+ kfree(info);
-+ goto cleanup;
-+ }
-+
-+ err = gpio_request(info->bt_wakeup_gpio, "BT wakeup");
-+ if (err < 0)
-+ {
-+ dev_err(info->dev, "Cannot get GPIO line 0x%d",
-+ info->bt_wakeup_gpio);
-+ gpio_free(info->reset_gpio);
-+ kfree(info);
-+ goto cleanup;
-+ }
-+
-+ err = gpio_request(info->host_wakeup_gpio, "BT host wakeup");
-+ if (err < 0)
-+ {
-+ dev_err(info->dev, "Cannot get GPIO line %d",
-+ info->host_wakeup_gpio);
-+ gpio_free(info->reset_gpio);
-+ gpio_free(info->bt_wakeup_gpio);
-+ kfree(info);
-+ goto cleanup;
-+ }
-+
-+ gpio_direction_output(info->reset_gpio, 0);
-+ gpio_direction_output(info->bt_wakeup_gpio, 0);
-+ gpio_direction_input(info->host_wakeup_gpio);
-+
-+//FIXME
-+#if defined(CONFIG_ARCH_OMAP1)
-+# define OMAP_UART1_BASE OMAP1_UART1_BASE
-+# define OMAP_UART2_BASE OMAP1_UART2_BASE
-+# define OMAP_UART3_BASE OMAP1_UART3_BASE
-+#elif defined(CONFIG_ARCH_OMAP2)
-+# define OMAP_UART1_BASE OMAP2_UART1_BASE
-+# define OMAP_UART2_BASE OMAP2_UART2_BASE
-+# define OMAP_UART3_BASE OMAP2_UART3_BASE
-+#elif defined(CONFIG_ARCH_OMAP3)
-+# define OMAP_UART1_BASE OMAP3_UART1_BASE
-+# define OMAP_UART2_BASE OMAP3_UART2_BASE
-+# define OMAP_UART3_BASE OMAP3_UART3_BASE
-+#elif defined(CONFIG_ARCH_OMAP4)
-+# define OMAP_UART1_BASE OMAP4_UART1_BASE
-+# define OMAP_UART2_BASE OMAP4_UART2_BASE
-+# define OMAP_UART3_BASE OMAP4_UART3_BASE
-+#else
-+# error
-+#endif
-+ switch (bt_config->bt_uart) {
-+ case 1:
-+ if (cpu_is_omap16xx()) {
-+ irq = INT_UART1;
-+ info->uart_fclk = clk_get(NULL, "uart1_ck");
-+ } else if (cpu_is_omap24xx()) {
-+ irq = INT_24XX_UART1_IRQ;
-+ info->uart_iclk = clk_get(NULL, "uart1_ick");
-+ info->uart_fclk = clk_get(NULL, "uart1_fck");
-+ }
-+ /* FIXME: Use platform_get_resource for the port */
-+ info->uart_base = ioremap(OMAP_UART1_BASE, 0x16);
-+ if (!info->uart_base)
-+ goto cleanup;
-+ break;
-+ case 2:
-+ if (cpu_is_omap16xx()) {
-+ irq = INT_UART2;
-+ info->uart_fclk = clk_get(NULL, "uart2_ck");
-+ } else {
-+ irq = INT_24XX_UART2_IRQ;
-+ info->uart_iclk = clk_get(NULL, "uart2_ick");
-+ info->uart_fclk = clk_get(NULL, "uart2_fck");
-+ }
-+ /* FIXME: Use platform_get_resource for the port */
-+ info->uart_base = ioremap(OMAP_UART2_BASE, 0x16);
-+ if (!info->uart_base)
-+ goto cleanup;
-+ break;
-+ case 3:
-+ if (cpu_is_omap16xx()) {
-+ irq = INT_UART3;
-+ info->uart_fclk = clk_get(NULL, "uart3_ck");
-+ } else {
-+ irq = INT_24XX_UART3_IRQ;
-+ info->uart_iclk = clk_get(NULL, "uart3_ick");
-+ info->uart_fclk = clk_get(NULL, "uart3_fck");
-+ }
-+ /* FIXME: Use platform_get_resource for the port */
-+ info->uart_base = ioremap(OMAP_UART3_BASE, 0x16);
-+ if (!info->uart_base)
-+ goto cleanup;
-+ break;
-+ default:
-+ dev_err(info->dev, "No uart defined\n");
-+ goto cleanup;
-+ }
-+
-+ info->irq = irq;
-+ err = request_irq(irq, hci_h4p_interrupt, 0, "hci_h4p", (void *)info);
-+ if (err < 0) {
-+ dev_err(info->dev, "hci_h4p: unable to get IRQ %d\n", irq);
-+ goto cleanup;
-+ }
-+
-+ err = request_irq(gpio_to_irq(info->host_wakeup_gpio),
-+ hci_h4p_wakeup_interrupt,
-+ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-+ "hci_h4p_wkup", (void *)info);
-+ if (err < 0) {
-+ dev_err(info->dev, "hci_h4p: unable to get wakeup IRQ %d\n",
-+ gpio_to_irq(info->host_wakeup_gpio));
-+ free_irq(irq, (void *)info);
-+ goto cleanup;
-+ }
-+
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 1);
-+ hci_h4p_set_auto_ctsrts(info, 0, UART_EFR_CTS | UART_EFR_RTS);
-+ err = hci_h4p_init_uart(info);
-+ if (err < 0)
-+ goto cleanup_irq;
-+ err = hci_h4p_reset(info);
-+ if (err < 0)
-+ goto cleanup_irq;
-+ err = hci_h4p_wait_for_cts(info, 1, 10);
-+ if (err < 0)
-+ goto cleanup_irq;
-+ hci_h4p_set_clk(info, &info->tx_clocks_en, 0);
-+
-+ platform_set_drvdata(pdev, info);
-+ err = hci_h4p_sysfs_create_files(info->dev);
-+ if (err < 0)
-+ goto cleanup_irq;
-+
-+ if (hci_h4p_register_hdev(info) < 0) {
-+ dev_err(info->dev, "failed to register hci_h4p hci device\n");
-+ goto cleanup_irq;
-+ }
-+ gpio_set_value(info->reset_gpio, 0);
-+
-+ return 0;
-+
-+cleanup_irq:
-+ free_irq(irq, (void *)info);
-+ free_irq(gpio_to_irq(info->host_wakeup_gpio), (void *)info);
-+cleanup:
-+ gpio_set_value(info->reset_gpio, 0);
-+ gpio_free(info->reset_gpio);
-+ gpio_free(info->bt_wakeup_gpio);
-+ gpio_free(info->host_wakeup_gpio);
-+ kfree(info);
-+
-+ return err;
-+
-+}
-+
-+static int hci_h4p_remove(struct platform_device *dev)
-+{
-+ struct hci_h4p_info *info;
-+
-+ info = platform_get_drvdata(dev);
-+
-+ hci_h4p_hci_close(info->hdev);
-+ free_irq(gpio_to_irq(info->host_wakeup_gpio), (void *) info);
-+ hci_free_dev(info->hdev);
-+ gpio_free(info->reset_gpio);
-+ gpio_free(info->bt_wakeup_gpio);
-+ gpio_free(info->host_wakeup_gpio);
-+ free_irq(info->irq, (void *) info);
-+ kfree(info);
-+
-+ return 0;
-+}
-+
-+static struct platform_driver hci_h4p_driver = {
-+ .probe = hci_h4p_probe,
-+ .remove = hci_h4p_remove,
-+ .driver = {
-+ .name = "hci_h4p",
-+ },
-+};
-+
-+static int __init hci_h4p_init(void)
-+{
-+ int err = 0;
-+
-+ /* Register the driver with LDM */
-+ err = platform_driver_register(&hci_h4p_driver);
-+ if (err < 0)
-+ printk(KERN_WARNING "failed to register hci_h4p driver\n");
-+
-+ return err;
-+}
-+
-+static void __exit hci_h4p_exit(void)
-+{
-+ platform_driver_unregister(&hci_h4p_driver);
-+}
-+
-+module_init(hci_h4p_init);
-+module_exit(hci_h4p_exit);
-+
-+MODULE_DESCRIPTION("h4 driver with nokia extensions");
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Ville Tervo");
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/fw.c
-@@ -0,0 +1,155 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/skbuff.h>
-+#include <linux/firmware.h>
-+#include <linux/clk.h>
-+
-+#include <net/bluetooth/bluetooth.h>
-+
-+#include "hci_h4p.h"
-+
-+#define BT_CHIP_TI 2
-+#define BT_CHIP_CSR 1
-+
-+static int fw_pos;
-+
-+/* Firmware handling */
-+static int hci_h4p_open_firmware(struct hci_h4p_info *info,
-+ const struct firmware **fw_entry)
-+{
-+ int err;
-+
-+ fw_pos = 0;
-+ NBT_DBG_FW("Opening %d firmware\n", info->chip_type);
-+ switch (info->chip_type) {
-+ case BT_CHIP_TI:
-+ err = request_firmware(fw_entry, "brf6150fw.bin", info->dev);
-+ break;
-+ case BT_CHIP_CSR:
-+ err = request_firmware(fw_entry, "bc4fw.bin", info->dev);
-+ break;
-+ default:
-+ dev_err(info->dev, "Invalid chip type\n");
-+ *fw_entry = NULL;
-+ err = -EINVAL;
-+ }
-+
-+ return err;
-+}
-+
-+static void hci_h4p_close_firmware(const struct firmware *fw_entry)
-+{
-+ release_firmware(fw_entry);
-+}
-+
-+/* Read fw. Return length of the command. If no more commands in
-+ * fw 0 is returned. In error case return value is negative.
-+ */
-+static int hci_h4p_read_fw_cmd(struct hci_h4p_info *info, struct sk_buff **skb,
-+ const struct firmware *fw_entry, int how)
-+{
-+ unsigned int cmd_len;
-+
-+ if (fw_pos >= fw_entry->size) {
-+ return 0;
-+ }
-+
-+ cmd_len = fw_entry->data[fw_pos++];
-+ if (!cmd_len)
-+ return 0;
-+
-+ if (fw_pos + cmd_len > fw_entry->size) {
-+ dev_err(info->dev, "Corrupted firmware image\n");
-+ return -EMSGSIZE;
-+ }
-+
-+ *skb = bt_skb_alloc(cmd_len, how);
-+ if (!*skb) {
-+ dev_err(info->dev, "Cannot reserve memory for buffer\n");
-+ return -ENOMEM;
-+ }
-+ memcpy(skb_put(*skb, cmd_len), &fw_entry->data[fw_pos], cmd_len);
-+
-+ fw_pos += cmd_len;
-+
-+ return (*skb)->len;
-+}
-+
-+int hci_h4p_read_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue)
-+{
-+ const struct firmware *fw_entry = NULL;
-+ struct sk_buff *skb = NULL;
-+ int err;
-+
-+ err = hci_h4p_open_firmware(info, &fw_entry);
-+ if (err < 0 || !fw_entry)
-+ goto err_clean;
-+
-+ while ((err = hci_h4p_read_fw_cmd(info, &skb, fw_entry, GFP_KERNEL))) {
-+ if (err < 0 || !skb)
-+ goto err_clean;
-+
-+ skb_queue_tail(fw_queue, skb);
-+ }
-+
-+err_clean:
-+ hci_h4p_close_firmware(fw_entry);
-+ return err;
-+}
-+
-+int hci_h4p_send_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue)
-+{
-+ int err;
-+
-+ switch(info->chip_type) {
-+ case BT_CHIP_CSR:
-+ err = hci_h4p_bc4_send_fw(info, fw_queue);
-+ break;
-+ case BT_CHIP_TI:
-+ err = hci_h4p_brf6150_send_fw(info, fw_queue);
-+ break;
-+ default:
-+ dev_err(info->dev, "Don't know how to send firmware\n");
-+ err = -EINVAL;
-+ }
-+
-+ return err;
-+}
-+
-+void hci_h4p_parse_fw_event(struct hci_h4p_info *info, struct sk_buff *skb)
-+{
-+ switch (info->chip_type) {
-+ case BT_CHIP_CSR:
-+ hci_h4p_bc4_parse_fw_event(info, skb);
-+ break;
-+ case BT_CHIP_TI:
-+ hci_h4p_brf6150_parse_fw_event(info, skb);
-+ break;
-+ default:
-+ dev_err(info->dev, "Don't know how to parse fw event\n");
-+ info->fw_error = -EINVAL;
-+ }
-+
-+ return;
-+}
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/fw-csr.c
-@@ -0,0 +1,149 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/skbuff.h>
-+#include <linux/delay.h>
-+#include <linux/serial_reg.h>
-+
-+#include "hci_h4p.h"
-+
-+void hci_h4p_bc4_parse_fw_event(struct hci_h4p_info *info, struct sk_buff *skb)
-+{
-+ /* Check if this is fw packet */
-+ if (skb->data[0] != 0xff) {
-+ hci_recv_frame(skb);
-+ return;
-+ }
-+
-+ if (skb->data[11] || skb->data[12]) {
-+ dev_err(info->dev, "Firmware sending command failed\n");
-+ info->fw_error = -EPROTO;
-+ }
-+
-+ kfree_skb(skb);
-+ complete(&info->fw_completion);
-+}
-+
-+int hci_h4p_bc4_send_fw(struct hci_h4p_info *info,
-+ struct sk_buff_head *fw_queue)
-+{
-+ struct sk_buff *skb;
-+ unsigned int offset;
-+ int retries, count, i;
-+
-+ info->fw_error = 0;
-+
-+ NBT_DBG_FW("Sending firmware\n");
-+ skb = skb_dequeue(fw_queue);
-+
-+ if (!skb)
-+ return -ENOMSG;
-+
-+ info->bdaddr[0] = 0x00;
-+ info->bdaddr[1] = 0x1D;
-+ info->bdaddr[2] = 0x6E;
-+ info->bdaddr[3] = 0xD4;
-+ info->bdaddr[4] = 0xF0;
-+ info->bdaddr[5] = 0x37;
-+
-+ /* Check if this is bd_address packet */
-+ if (skb->data[15] == 0x01 && skb->data[16] == 0x00) {
-+ dev_info(info->dev, "bd_address packet found\n");
-+ offset = 21;
-+ skb->data[offset + 1] = 0x00;
-+ skb->data[offset + 5] = 0x00;
-+ skb->data[offset + 7] = info->bdaddr[0];
-+ skb->data[offset + 6] = info->bdaddr[1];
-+ skb->data[offset + 4] = info->bdaddr[2];
-+ skb->data[offset + 0] = info->bdaddr[3];
-+ skb->data[offset + 3] = info->bdaddr[4];
-+ skb->data[offset + 2] = info->bdaddr[5];
-+ }
-+
-+ for (i = 0; i < 6; i++) {
-+ if (info->bdaddr[i] != 0x00)
-+ break;
-+ }
-+
-+ /* if (i > 5) {
-+ dev_info(info->dev, "Valid bluetooth address not found.\n");
-+ kfree_skb(skb);
-+ return -ENODEV;
-+ } */
-+
-+ for (count = 1; ; count++) {
-+ NBT_DBG_FW("Sending firmware command %d\n", count);
-+ init_completion(&info->fw_completion);
-+ skb_queue_tail(&info->txq, skb);
-+ tasklet_schedule(&info->tx_task);
-+
-+ skb = skb_dequeue(fw_queue);
-+ if (!skb)
-+ break;
-+
-+ if (!wait_for_completion_timeout(&info->fw_completion,
-+ msecs_to_jiffies(1000))) {
-+ dev_err(info->dev, "No reply to fw command\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ if (info->fw_error) {
-+ dev_err(info->dev, "FW error\n");
-+ return -EPROTO;
-+ }
-+ };
-+
-+ /* Wait for chip warm reset */
-+ retries = 100;
-+ while ((!skb_queue_empty(&info->txq) ||
-+ !(hci_h4p_inb(info, UART_LSR) & UART_LSR_TEMT)) &&
-+ retries--) {
-+ msleep(10);
-+ }
-+ if (!retries) {
-+ dev_err(info->dev, "Transmitter not empty\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ hci_h4p_change_speed(info, BC4_MAX_BAUD_RATE);
-+
-+ if (hci_h4p_wait_for_cts(info, 1, 100)) {
-+ dev_err(info->dev, "cts didn't go down after final speed change\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ retries = 100;
-+ do {
-+ init_completion(&info->init_completion);
-+ hci_h4p_send_alive_packet(info);
-+ retries--;
-+ } while (!wait_for_completion_timeout(&info->init_completion, 100) &&
-+ retries > 0);
-+
-+ if (!retries) {
-+ dev_err(info->dev, "No alive reply after speed change\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/fw-ti.c
-@@ -0,0 +1,90 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/skbuff.h>
-+
-+#include "hci_h4p.h"
-+
-+void hci_h4p_brf6150_parse_fw_event(struct hci_h4p_info *info,
-+ struct sk_buff *skb)
-+{
-+ struct hci_fw_event *ev;
-+ int err = 0;
-+
-+ if (bt_cb(skb)->pkt_type != H4_EVT_PKT) {
-+ dev_err(info->dev, "Got non event fw packet.\n");
-+ err = -EPROTO;
-+ goto ret;
-+ }
-+
-+ ev = (struct hci_fw_event *)skb->data;
-+ if (ev->hev.evt != HCI_EV_CMD_COMPLETE) {
-+ dev_err(info->dev, "Got non cmd complete fw event\n");
-+ err = -EPROTO;
-+ goto ret;
-+ }
-+
-+ if (ev->status != 0) {
-+ dev_err(info->dev, "Got error status from fw command\n");
-+ err = -EPROTO;
-+ goto ret;
-+ }
-+
-+ret:
-+ info->fw_error = err;
-+ complete(&info->fw_completion);
-+}
-+
-+int hci_h4p_brf6150_send_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue)
-+{
-+ struct sk_buff *skb;
-+ int err = 0;
-+
-+ info->fw_error = 0;
-+
-+ while ((skb = skb_dequeue(fw_queue)) != NULL) {
-+ /* We should allways send word aligned data to h4+ devices */
-+ if (skb->len % 2) {
-+ err = skb_pad(skb, 1);
-+ }
-+ if (err)
-+ return err;
-+
-+ init_completion(&info->fw_completion);
-+ skb_queue_tail(&info->txq, skb);
-+ tasklet_schedule(&info->tx_task);
-+
-+ if (!wait_for_completion_timeout(&info->fw_completion, HZ)) {
-+ dev_err(info->dev, "Timeout while sending brf6150 fw\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ if (info->fw_error) {
-+ dev_err(info->dev, "There was fw_error while sending bfr6150 fw\n");
-+ return -EPROTO;
-+ }
-+ }
-+ NBT_DBG_FW("Firmware sent\n");
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/hci_h4p.h
-@@ -0,0 +1,183 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <mach/board.h>
-+
-+#include <net/bluetooth/bluetooth.h>
-+#include <net/bluetooth/hci_core.h>
-+#include <net/bluetooth/hci.h>
-+
-+#ifndef __DRIVERS_BLUETOOTH_HCI_H4P_H
-+#define __DRIVERS_BLUETOOTH_HCI_H4P_H
-+
-+#define UART_SYSC_OMAP_RESET 0x03
-+#define UART_SYSS_RESETDONE 0x01
-+#define UART_OMAP_SCR_EMPTY_THR 0x08
-+#define UART_OMAP_SCR_WAKEUP 0x10
-+#define UART_OMAP_SSR_WAKEUP 0x02
-+#define UART_OMAP_SSR_TXFULL 0x01
-+
-+#if 0
-+#define NBT_DBG(fmt, arg...) printk("%s: " fmt "" , __FUNCTION__ , ## arg)
-+#else
-+#define NBT_DBG(...)
-+#endif
-+
-+#if 0
-+#define NBT_DBG_FW(fmt, arg...) printk("%s: " fmt "" , __FUNCTION__ , ## arg)
-+#else
-+#define NBT_DBG_FW(...)
-+#endif
-+
-+#if 0
-+#define NBT_DBG_POWER(fmt, arg...) printk("%s: " fmt "" , __FUNCTION__ , ## arg)
-+#else
-+#define NBT_DBG_POWER(...)
-+#endif
-+
-+#if 0
-+#define NBT_DBG_TRANSFER(fmt, arg...) printk("%s: " fmt "" , __FUNCTION__ , ## arg)
-+#else
-+#define NBT_DBG_TRANSFER(...)
-+#endif
-+
-+#if 0
-+#define NBT_DBG_TRANSFER_NF(fmt, arg...) printk(fmt "" , ## arg)
-+#else
-+#define NBT_DBG_TRANSFER_NF(...)
-+#endif
-+
-+#if 0
-+#define NBT_DBG_DMA(fmt, arg...) printk("%s: " fmt "" , __FUNCTION__ , ## arg)
-+#else
-+#define NBT_DBG_DMA(...)
-+#endif
-+
-+struct hci_h4p_info {
-+ struct hci_dev *hdev;
-+ spinlock_t lock;
-+
-+ void __iomem *uart_base;
-+ unsigned long uart_phys_base;
-+ int irq;
-+ struct device *dev;
-+ u8 bdaddr[6];
-+ u8 chip_type;
-+ u8 bt_wakeup_gpio;
-+ u8 host_wakeup_gpio;
-+ u8 reset_gpio;
-+ u8 bt_sysclk;
-+
-+
-+ struct sk_buff_head fw_queue;
-+ struct sk_buff *alive_cmd_skb;
-+ struct completion init_completion;
-+ struct completion fw_completion;
-+ int fw_error;
-+ int init_error;
-+
-+ struct sk_buff_head txq;
-+ struct tasklet_struct tx_task;
-+
-+ struct sk_buff *rx_skb;
-+ long rx_count;
-+ unsigned long rx_state;
-+ unsigned long garbage_bytes;
-+ struct tasklet_struct rx_task;
-+
-+ int pm_enabled;
-+ int tx_pm_enabled;
-+ int rx_pm_enabled;
-+ struct timer_list tx_pm_timer;
-+ struct timer_list rx_pm_timer;
-+
-+ int tx_clocks_en;
-+ int rx_clocks_en;
-+ spinlock_t clocks_lock;
-+ struct clk *uart_iclk;
-+ struct clk *uart_fclk;
-+};
-+
-+#define MAX_BAUD_RATE 921600
-+#define BC4_MAX_BAUD_RATE 3692300
-+#define UART_CLOCK 48000000
-+#define BT_INIT_DIVIDER 320
-+#define BT_BAUDRATE_DIVIDER 384000000
-+#define BT_SYSCLK_DIV 1000
-+#define INIT_SPEED 120000
-+
-+#define H4_TYPE_SIZE 1
-+
-+/* H4+ packet types */
-+#define H4_CMD_PKT 0x01
-+#define H4_ACL_PKT 0x02
-+#define H4_SCO_PKT 0x03
-+#define H4_EVT_PKT 0x04
-+#define H4_NEG_PKT 0x06
-+#define H4_ALIVE_PKT 0x07
-+
-+/* TX states */
-+#define WAIT_FOR_PKT_TYPE 1
-+#define WAIT_FOR_HEADER 2
-+#define WAIT_FOR_DATA 3
-+
-+struct hci_fw_event {
-+ struct hci_event_hdr hev;
-+ struct hci_ev_cmd_complete cmd;
-+ u8 status;
-+} __attribute__ ((packed));
-+
-+struct hci_bc4_set_bdaddr {
-+ u8 type;
-+ struct hci_command_hdr cmd_hdr;
-+} __attribute__ ((packed));
-+
-+int hci_h4p_send_alive_packet(struct hci_h4p_info *info);
-+
-+void hci_h4p_bc4_parse_fw_event(struct hci_h4p_info *info,
-+ struct sk_buff *skb);
-+int hci_h4p_bc4_send_fw(struct hci_h4p_info *info,
-+ struct sk_buff_head *fw_queue);
-+
-+void hci_h4p_brf6150_parse_fw_event(struct hci_h4p_info *info,
-+ struct sk_buff *skb);
-+int hci_h4p_brf6150_send_fw(struct hci_h4p_info *info,
-+ struct sk_buff_head *fw_queue);
-+
-+int hci_h4p_read_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue);
-+int hci_h4p_send_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue);
-+void hci_h4p_parse_fw_event(struct hci_h4p_info *info, struct sk_buff *skb);
-+
-+int hci_h4p_sysfs_create_files(struct device *dev);
-+
-+void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val);
-+u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset);
-+void hci_h4p_set_rts(struct hci_h4p_info *info, int active);
-+int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active, int timeout_ms);
-+void __hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which);
-+void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which);
-+void hci_h4p_change_speed(struct hci_h4p_info *info, unsigned long speed);
-+int hci_h4p_reset_uart(struct hci_h4p_info *info);
-+int hci_h4p_init_uart(struct hci_h4p_info *info);
-+
-+#endif /* __DRIVERS_BLUETOOTH_HCI_H4P_H */
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/Makefile
-@@ -0,0 +1,7 @@
-+#
-+# Makefile for the Linux Bluetooth HCI device drivers.
-+#
-+
-+obj-$(CONFIG_BT_HCIH4P) += hci_h4p.o
-+
-+hci_h4p-objs := core.o fw.o uart.o sysfs.o fw-ti.o fw-csr.o
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/sysfs.c
-@@ -0,0 +1,84 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/device.h>
-+#include <linux/platform_device.h>
-+
-+#include "hci_h4p.h"
-+
-+#ifdef CONFIG_SYSFS
-+
-+static ssize_t hci_h4p_store_bdaddr(struct device *dev, struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct hci_h4p_info *info = (struct hci_h4p_info*)dev_get_drvdata(dev);
-+ unsigned int bdaddr[6];
-+ int ret, i;
-+
-+ dev_info(info->dev, "HCI_H4P_STORE_BDADDR called\n");
-+
-+ ret = sscanf(buf, "%2x:%2x:%2x:%2x:%2x:%2x\n",
-+ &bdaddr[0], &bdaddr[1], &bdaddr[2],
-+ &bdaddr[3], &bdaddr[4], &bdaddr[5]);
-+
-+ if (ret != 6) {
-+ dev_info(info->dev, "bdaddr isn't found\n");
-+ return -EINVAL;
-+ }
-+
-+ //for (i = 0; i < 6; i++)
-+ //info->bdaddr[i] = bdaddr[i] & 0xff;
-+
-+ info->bdaddr[0] = 0x00;
-+ info->bdaddr[1] = 0x1D;
-+ info->bdaddr[2] = 0x6E;
-+ info->bdaddr[3] = 0xD4;
-+ info->bdaddr[4] = 0xF0;
-+ info->bdaddr[5] = 0x37;
-+
-+ return count;
-+}
-+
-+static ssize_t hci_h4p_show_bdaddr(struct device *dev, struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct hci_h4p_info *info = (struct hci_h4p_info*)dev_get_drvdata(dev);
-+
-+ return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
-+ info->bdaddr[0],
-+ info->bdaddr[1],
-+ info->bdaddr[2],
-+ info->bdaddr[3],
-+ info->bdaddr[4],
-+ info->bdaddr[5]);
-+}
-+
-+static DEVICE_ATTR(bdaddr, S_IRUGO | S_IWUSR, hci_h4p_show_bdaddr, hci_h4p_store_bdaddr);
-+int hci_h4p_sysfs_create_files(struct device *dev)
-+{
-+ return device_create_file(dev, &dev_attr_bdaddr);
-+}
-+
-+#endif
---- /dev/null
-+++ b/drivers/bluetooth/hci_h4p/uart.c
-@@ -0,0 +1,169 @@
-+/*
-+ * This file is part of hci_h4p bluetooth driver
-+ *
-+ * Copyright (C) 2005, 2006 Nokia Corporation.
-+ *
-+ * Contact: Ville Tervo <ville.tervo@nokia.com>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * version 2 as published by the Free Software Foundation.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-+ * 02110-1301 USA
-+ *
-+ */
-+
-+#include <linux/serial_reg.h>
-+#include <linux/delay.h>
-+#include <linux/clk.h>
-+
-+#include <asm/io.h>
-+
-+#include "hci_h4p.h"
-+
-+inline void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val)
-+{
-+ offset <<= 2;
-+ __raw_writeb(val, info->uart_base + offset);
-+ //outb(val, info->uart_base + (offset << 2));
-+}
-+
-+inline u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset)
-+{
-+ offset <<= 2;
-+ return (u8)__raw_readb(info->uart_base + offset);
-+ //return (unsigned int)__raw_readb(up->membase + offset);
-+ //return inb(info->uart_base + (offset << 2));
-+}
-+
-+void hci_h4p_set_rts(struct hci_h4p_info *info, int active)
-+{
-+ u8 b;
-+
-+ b = hci_h4p_inb(info, UART_MCR);
-+ if (active)
-+ b |= UART_MCR_RTS;
-+ else
-+ b &= ~UART_MCR_RTS;
-+ hci_h4p_outb(info, UART_MCR, b);
-+}
-+
-+int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active,
-+ int timeout_ms)
-+{
-+ int okay;
-+ unsigned long timeout;
-+
-+ okay = 0;
-+ timeout = jiffies + msecs_to_jiffies(timeout_ms);
-+ for (;;) {
-+ int state;
-+
-+ state = hci_h4p_inb(info, UART_MSR) & UART_MSR_CTS;
-+ if (active) {
-+ if (state)
-+ return 0;
-+ } else {
-+ if (!state)
-+ return 0;
-+ }
-+ if (time_after(jiffies, timeout))
-+ return -ETIMEDOUT;
-+ }
-+}
-+
-+void __hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which)
-+{
-+ u8 lcr, b;
-+
-+ lcr = hci_h4p_inb(info, UART_LCR);
-+ hci_h4p_outb(info, UART_LCR, 0xbf);
-+ b = hci_h4p_inb(info, UART_EFR);
-+ if (on)
-+ b |= which;
-+ else
-+ b &= ~which;
-+ hci_h4p_outb(info, UART_EFR, b);
-+ hci_h4p_outb(info, UART_LCR, lcr);
-+}
-+
-+void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which)
-+{
-+ unsigned long flags;
-+
-+ spin_lock_irqsave(&info->lock, flags);
-+ __hci_h4p_set_auto_ctsrts(info, on, which);
-+ spin_unlock_irqrestore(&info->lock, flags);
-+}
-+
-+void hci_h4p_change_speed(struct hci_h4p_info *info, unsigned long speed)
-+{
-+ unsigned int divisor;
-+ u8 lcr, mdr1;
-+
-+ NBT_DBG("Setting speed %lu\n", speed);
-+
-+ if (speed >= 460800) {
-+ divisor = UART_CLOCK / 13 / speed;
-+ mdr1 = 3;
-+ } else {
-+ divisor = UART_CLOCK / 16 / speed;
-+ mdr1 = 0;
-+ }
-+
-+ hci_h4p_outb(info, UART_OMAP_MDR1, 7); /* Make sure UART mode is disabled */
-+ lcr = hci_h4p_inb(info, UART_LCR);
-+ hci_h4p_outb(info, UART_LCR, UART_LCR_DLAB); /* Set DLAB */
-+ hci_h4p_outb(info, UART_DLL, divisor & 0xff); /* Set speed */
-+ hci_h4p_outb(info, UART_DLM, divisor >> 8);
-+ hci_h4p_outb(info, UART_LCR, lcr);
-+ hci_h4p_outb(info, UART_OMAP_MDR1, mdr1); /* Make sure UART mode is enabled */
-+}
-+
-+int hci_h4p_reset_uart(struct hci_h4p_info *info)
-+{
-+ int count = 0;
-+
-+ /* Reset the UART */
-+ hci_h4p_outb(info, UART_OMAP_SYSC, UART_SYSC_OMAP_RESET);
-+ while (!(hci_h4p_inb(info, UART_OMAP_SYSS) & UART_SYSS_RESETDONE)) {
-+ if (count++ > 20000) {
-+ dev_err(info->dev, "hci_h4p: UART reset timeout\n");
-+ return -ENODEV;
-+ }
-+ udelay(1);
-+ }
-+
-+ return 0;
-+}
-+
-+int hci_h4p_init_uart(struct hci_h4p_info *info)
-+{
-+ int err;
-+
-+ err = hci_h4p_reset_uart(info);
-+ if (err < 0)
-+ return err;
-+
-+ /* Enable and setup FIFO */
-+ hci_h4p_outb(info, UART_LCR, UART_LCR_WLEN8);
-+ hci_h4p_outb(info, UART_OMAP_MDR1, 0x00); /* Make sure UART mode is enabled */
-+ hci_h4p_outb(info, UART_OMAP_SCR, 0x80);
-+ hci_h4p_outb(info, UART_EFR, UART_EFR_ECB);
-+ hci_h4p_outb(info, UART_MCR, UART_MCR_TCRTLR);
-+ hci_h4p_outb(info, UART_TI752_TLR, 0x1f);
-+ hci_h4p_outb(info, UART_TI752_TCR, 0xef);
-+ hci_h4p_outb(info, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
-+ UART_FCR_CLEAR_XMIT | UART_FCR_R_TRIG_00);
-+ hci_h4p_outb(info, UART_IER, UART_IER_RDI);
-+
-+ return 0;
-+}
---- a/drivers/bluetooth/Kconfig
-+++ b/drivers/bluetooth/Kconfig
-@@ -173,6 +173,16 @@ config BT_HCIBTUART
- Say Y here to compile support for HCI UART devices into the
- kernel or say M to compile it as module (btuart_cs).
-
-+config BT_HCIH4P
-+ tristate "HCI driver with H4 Nokia extensions"
-+ depends on BT && ARCH_OMAP
-+ help
-+ Bluetooth HCI driver with H4 extensions. This driver provides
-+ support for H4+ Bluetooth chip with vendor-specific H4 extensions.
-+
-+ Say Y here to compile support for h4 extended devices into the kernel
-+ or say M to compile it as module (hci_h4p).
-+
- config BT_HCIVHCI
- tristate "HCI VHCI (Virtual HCI device) driver"
- help
---- a/drivers/bluetooth/Makefile
-+++ b/drivers/bluetooth/Makefile
-@@ -11,6 +11,7 @@ obj-$(CONFIG_BT_HCIDTL1) += dtl1_cs.o
- obj-$(CONFIG_BT_HCIBT3C) += bt3c_cs.o
- obj-$(CONFIG_BT_HCIBLUECARD) += bluecard_cs.o
- obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o
-+obj-$(CONFIG_BT_HCIH4P) += hci_h4p/
-
- obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
- obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
diff --git a/target/linux/omap24xx/patches-3.3/410-hci-h4p-fixes.patch b/target/linux/omap24xx/patches-3.3/410-hci-h4p-fixes.patch
deleted file mode 100644
index 6741511a88..0000000000
--- a/target/linux/omap24xx/patches-3.3/410-hci-h4p-fixes.patch
+++ /dev/null
@@ -1,46 +0,0 @@
---- a/drivers/bluetooth/hci_h4p/core.c
-+++ b/drivers/bluetooth/hci_h4p/core.c
-@@ -36,9 +36,9 @@
- #include <linux/clk.h>
- #include <linux/gpio.h>
-
--#include <mach/hardware.h>
--#include <mach/board.h>
--#include <mach/irqs.h>
-+#include <plat/hardware.h>
-+#include <plat/board.h>
-+#include <plat/irqs.h>
- #include <plat/serial.h>
-
- #include <net/bluetooth/bluetooth.h>
---- a/drivers/bluetooth/hci_h4p/hci_h4p.h
-+++ b/drivers/bluetooth/hci_h4p/hci_h4p.h
-@@ -21,7 +21,7 @@
- *
- */
-
--#include <mach/board.h>
-+#include <plat/board.h>
-
- #include <net/bluetooth/bluetooth.h>
- #include <net/bluetooth/hci_core.h>
---- a/drivers/bluetooth/hci_h4p/sysfs.c
-+++ b/drivers/bluetooth/hci_h4p/sysfs.c
-@@ -48,15 +48,8 @@ static ssize_t hci_h4p_store_bdaddr(stru
- return -EINVAL;
- }
-
-- //for (i = 0; i < 6; i++)
-- //info->bdaddr[i] = bdaddr[i] & 0xff;
--
-- info->bdaddr[0] = 0x00;
-- info->bdaddr[1] = 0x1D;
-- info->bdaddr[2] = 0x6E;
-- info->bdaddr[3] = 0xD4;
-- info->bdaddr[4] = 0xF0;
-- info->bdaddr[5] = 0x37;
-+ for (i = 0; i < 6; i++)
-+ info->bdaddr[i] = bdaddr[i] & 0xff;
-
- return count;
- }
diff --git a/target/linux/omap24xx/patches-3.3/420-hci-h4p-interrupt-workaround.patch b/target/linux/omap24xx/patches-3.3/420-hci-h4p-interrupt-workaround.patch
deleted file mode 100644
index 0d2b4d24fd..0000000000
--- a/target/linux/omap24xx/patches-3.3/420-hci-h4p-interrupt-workaround.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
-+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
-@@ -235,7 +235,7 @@ struct omap_hwmod_irq_info omap2_timer11
- };
-
- struct omap_hwmod_irq_info omap2_uart1_mpu_irqs[] = {
-- { .irq = INT_24XX_UART1_IRQ, },
-+ { .irq = 0, },
- { .irq = -1 }
- };
-
---- a/drivers/tty/serial/omap-serial.c
-+++ b/drivers/tty/serial/omap-serial.c
-@@ -517,8 +517,10 @@ static int serial_omap_startup(struct ua
- /*
- * Allocate the IRQ
- */
-- retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
-- up->name, up);
-+ retval = 0;
-+ if (up->port.irq)
-+ retval = request_irq(up->port.irq, serial_omap_irq,
-+ up->port.irqflags, up->name, up);
- if (retval)
- return retval;
-
-@@ -629,7 +631,8 @@ static void serial_omap_shutdown(struct
- }
-
- pm_runtime_put(&up->pdev->dev);
-- free_irq(up->port.irq, up);
-+ if (up->port.irq)
-+ free_irq(up->port.irq, up);
- }
-
- static inline void
diff --git a/target/linux/omap24xx/patches-3.3/597-cbus-tahvo-usb-platform.patch b/target/linux/omap24xx/patches-3.3/597-cbus-tahvo-usb-platform.patch
deleted file mode 100644
index a635a8784c..0000000000
--- a/target/linux/omap24xx/patches-3.3/597-cbus-tahvo-usb-platform.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/arch/arm/mach-omap2/board-n8x0.c
-+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -41,6 +41,7 @@
- #include <plat/mmc.h>
- #include <plat/serial.h>
- #include <plat/gpio-switch.h>
-+#include <plat/usb.h>
-
- #include "mux.h"
-
-@@ -486,6 +487,14 @@ static struct musb_hdrc_platform_data tu
- .config = &musb_config,
- };
-
-+static struct omap_usb_config n8x0_omap_usb_config __initdata = {
-+ .otg = 1,
-+ .register_host = 1,
-+ .register_dev = 1,
-+ .hmc_mode = 16,
-+ .pins[0] = 6,
-+};
-+
- static void __init n8x0_usb_init(void)
- {
- int ret = 0;
-@@ -507,6 +516,8 @@ static void __init n8x0_usb_init(void)
- if (ret != 0)
- goto err;
-
-+ omap2_usbfs_init(&n8x0_omap_usb_config);
-+
- printk(announce);
-
- return;
diff --git a/target/linux/omap24xx/patches-3.3/710-evdev-events-without-grab.patch b/target/linux/omap24xx/patches-3.3/710-evdev-events-without-grab.patch
deleted file mode 100644
index b4637595f9..0000000000
--- a/target/linux/omap24xx/patches-3.3/710-evdev-events-without-grab.patch
+++ /dev/null
@@ -1,31 +0,0 @@
----
- drivers/input/evdev.c | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
---- a/drivers/input/evdev.c
-+++ b/drivers/input/evdev.c
-@@ -92,7 +92,7 @@ static void evdev_event(struct input_han
- unsigned int type, unsigned int code, int value)
- {
- struct evdev *evdev = handle->private;
-- struct evdev_client *client;
-+ struct evdev_client *client, *c;
- struct input_event event;
-
- do_gettimeofday(&event.time);
-@@ -103,9 +103,13 @@ static void evdev_event(struct input_han
- rcu_read_lock();
-
- client = rcu_dereference(evdev->grab);
-- if (client)
-+ if (client) {
- evdev_pass_event(client, &event);
-- else
-+ /* Also pass events to clients that did not grab the device. */
-+ list_for_each_entry_rcu(c, &evdev->client_list, node)
-+ if (c != client)
-+ evdev_pass_event(c, &event);
-+ } else
- list_for_each_entry_rcu(client, &evdev->client_list, node)
- evdev_pass_event(client, &event);
-
diff --git a/target/linux/omap24xx/patches-3.3/810-mmc-fixes.patch b/target/linux/omap24xx/patches-3.3/810-mmc-fixes.patch
deleted file mode 100644
index 3dfb11661b..0000000000
--- a/target/linux/omap24xx/patches-3.3/810-mmc-fixes.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- a/drivers/mmc/host/omap.c
-+++ b/drivers/mmc/host/omap.c
-@@ -1456,6 +1456,7 @@ static int __init mmc_omap_probe(struct
- host->dma_ch = -1;
-
- host->irq = irq;
-+ host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
- host->phys_base = host->mem_res->start;
- host->virt_base = ioremap(res->start, resource_size(res));
- if (!host->virt_base)
-@@ -1495,7 +1496,9 @@ static int __init mmc_omap_probe(struct
- }
- }
-
-- host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
-+ /* Make sure the detect workqueue was run at least once. */
-+ printk(KERN_INFO "OMAP-mmc: waiting for cards...\n");
-+ mmc_flush_scheduled_work();
-
- return 0;
-
---- a/drivers/mmc/core/core.c
-+++ b/drivers/mmc/core/core.c
-@@ -78,12 +78,13 @@ static int mmc_schedule_delayed_work(str
- }
-
- /*
-- * Internal function. Flush all scheduled work from the MMC work queue.
-+ * Flush all scheduled work from the MMC work queue.
- */
--static void mmc_flush_scheduled_work(void)
-+void mmc_flush_scheduled_work(void)
- {
- flush_workqueue(workqueue);
- }
-+EXPORT_SYMBOL(mmc_flush_scheduled_work);
-
- #ifdef CONFIG_FAIL_MMC_REQUEST
-
---- a/include/linux/mmc/host.h
-+++ b/include/linux/mmc/host.h
-@@ -445,6 +445,8 @@ static inline int mmc_boot_partition_acc
- return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
- }
-
-+void mmc_flush_scheduled_work(void);
-+
- #ifdef CONFIG_MMC_CLKGATE
- void mmc_host_clk_hold(struct mmc_host *host);
- void mmc_host_clk_release(struct mmc_host *host);
diff --git a/target/linux/omap24xx/patches-3.3/830-omap2-serial-fixes.patch b/target/linux/omap24xx/patches-3.3/830-omap2-serial-fixes.patch
deleted file mode 100644
index a80ee69411..0000000000
--- a/target/linux/omap24xx/patches-3.3/830-omap2-serial-fixes.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/arch/arm/mach-omap2/serial.c
-+++ b/arch/arm/mach-omap2/serial.c
-@@ -258,6 +258,8 @@ char *cmdline_find_option(char *str)
- return strstr(saved_command_line, str);
- }
-
-+static struct omap_uart_state statebuf[4];
-+
- static int __init omap_serial_early_init(void)
- {
- do {
-@@ -272,9 +274,9 @@ static int __init omap_serial_early_init
- if (!oh)
- break;
-
-- uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
-- if (WARN_ON(!uart))
-+ if (WARN_ON(num_uarts >= ARRAY_SIZE(statebuf)))
- return -ENODEV;
-+ uart = &statebuf[num_uarts];
-
- uart->oh = oh;
- uart->num = num_uarts++;
diff --git a/target/linux/omap24xx/patches-3.3/850-musb-tusb-modular-fixes.patch b/target/linux/omap24xx/patches-3.3/850-musb-tusb-modular-fixes.patch
deleted file mode 100644
index 55a25a4aeb..0000000000
--- a/target/linux/omap24xx/patches-3.3/850-musb-tusb-modular-fixes.patch
+++ /dev/null
@@ -1,135 +0,0 @@
---- a/drivers/usb/musb/tusb6010.c
-+++ b/drivers/usb/musb/tusb6010.c
-@@ -221,6 +221,7 @@ void musb_write_fifo(struct musb_hw_ep *
- if (len > 0)
- tusb_fifo_write_unaligned(fifo, buf, len);
- }
-+EXPORT_SYMBOL(musb_write_fifo);
-
- void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
- {
-@@ -268,6 +269,7 @@ void musb_read_fifo(struct musb_hw_ep *h
- if (len > 0)
- tusb_fifo_read_unaligned(fifo, buf, len);
- }
-+EXPORT_SYMBOL(musb_read_fifo);
-
- static struct musb *the_musb;
-
-@@ -1165,7 +1167,7 @@ static const struct musb_platform_ops tu
-
- static u64 tusb_dmamask = DMA_BIT_MASK(32);
-
--static int __init tusb_probe(struct platform_device *pdev)
-+static int tusb_probe(struct platform_device *pdev)
- {
- struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
- struct platform_device *musb;
-@@ -1245,18 +1247,18 @@ static struct platform_driver tusb_drive
- },
- };
-
--MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
--MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
--MODULE_LICENSE("GPL v2");
-+//MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
-+//MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
-+//MODULE_LICENSE("GPL v2");
-
--static int __init tusb_init(void)
-+int musb_hdrc_glue_init(void)
- {
- return platform_driver_probe(&tusb_driver, tusb_probe);
- }
--subsys_initcall(tusb_init);
-+EXPORT_SYMBOL(musb_hdrc_glue_init);
-
--static void __exit tusb_exit(void)
-+void musb_hdrc_glue_exit(void)
- {
- platform_driver_unregister(&tusb_driver);
- }
--module_exit(tusb_exit);
-+EXPORT_SYMBOL(musb_hdrc_glue_exit);
---- a/drivers/usb/musb/musb_core.c
-+++ b/drivers/usb/musb/musb_core.c
-@@ -207,7 +207,7 @@ static struct otg_io_access_ops musb_ulp
-
- /*-------------------------------------------------------------------------*/
-
--#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_BLACKFIN)
-+#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE) && !defined(CONFIG_USB_MUSB_BLACKFIN)
-
- /*
- * Load an endpoint's FIFO
-@@ -250,7 +250,7 @@ void musb_write_fifo(struct musb_hw_ep *
- }
- }
-
--#if !defined(CONFIG_USB_MUSB_AM35X)
-+#if !defined(CONFIG_USB_MUSB_AM35X) && !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
- /*
- * Unload an endpoint's FIFO
- */
-@@ -2370,8 +2370,13 @@ static struct platform_driver musb_drive
-
- /*-------------------------------------------------------------------------*/
-
-+extern int musb_hdrc_glue_init(void);
-+extern void musb_hdrc_glue_exit(void);
-+
- static int __init musb_init(void)
- {
-+ int err;
-+
- if (usb_disabled())
- return 0;
-
-@@ -2380,7 +2385,17 @@ static int __init musb_init(void)
- ", "
- "otg (peripheral+host)",
- musb_driver_name);
-- return platform_driver_probe(&musb_driver, musb_probe);
-+
-+ err = musb_hdrc_glue_init();
-+ if (err)
-+ return err;
-+ err = platform_driver_probe(&musb_driver, musb_probe);
-+ if (err) {
-+ musb_hdrc_glue_exit();
-+ return err;
-+ }
-+
-+ return 0;
- }
-
- /* make us init after usbcore and i2c (transceivers, regulators, etc)
-@@ -2391,5 +2406,6 @@ fs_initcall(musb_init);
- static void __exit musb_cleanup(void)
- {
- platform_driver_unregister(&musb_driver);
-+ musb_hdrc_glue_exit();
- }
- module_exit(musb_cleanup);
---- a/drivers/usb/Makefile
-+++ b/drivers/usb/Makefile
-@@ -51,7 +51,7 @@ obj-$(CONFIG_EARLY_PRINTK_DBGP) += early
- obj-$(CONFIG_USB_ATM) += atm/
- obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
-
--obj-$(CONFIG_USB_MUSB_HDRC) += musb/
-+obj-y += musb/
- obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/
- obj-$(CONFIG_USB_GADGET) += gadget/
-
---- a/drivers/usb/musb/Makefile
-+++ b/drivers/usb/musb/Makefile
-@@ -13,7 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_d
- # Hardware Glue Layer
- obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
- obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o
--obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o
-+musb_hdrc-$(subst m,y,$(CONFIG_USB_MUSB_TUSB6010)) += tusb6010.o
- obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o
- obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
- obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o
diff --git a/target/linux/omap24xx/patches-3.3/900-n810-battery-management.patch b/target/linux/omap24xx/patches-3.3/900-n810-battery-management.patch
deleted file mode 100644
index bdec65f777..0000000000
--- a/target/linux/omap24xx/patches-3.3/900-n810-battery-management.patch
+++ /dev/null
@@ -1,1917 +0,0 @@
---- a/drivers/cbus/Kconfig
-+++ b/drivers/cbus/Kconfig
-@@ -83,4 +83,12 @@ config CBUS_RETU_HEADSET
-
- endif # CBUS_RETU
-
-+config N810BM
-+ depends on CBUS_RETU && CBUS_TAHVO
-+ tristate "Nokia n810 battery management"
-+ ---help---
-+ Nokia n810 device battery management.
-+
-+ If unsure, say N.
-+
- endmenu
---- a/drivers/cbus/Makefile
-+++ b/drivers/cbus/Makefile
-@@ -11,3 +11,6 @@ obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += r
- obj-$(CONFIG_CBUS_RETU_RTC) += retu-rtc.o
- obj-$(CONFIG_CBUS_RETU_WDT) += retu-wdt.o
- obj-$(CONFIG_CBUS_RETU_HEADSET) += retu-headset.o
-+n810bm-y += n810bm_main.o
-+n810bm-y += lipocharge.o
-+obj-$(CONFIG_N810BM) += n810bm.o
---- /dev/null
-+++ b/drivers/cbus/n810bm_main.c
-@@ -0,0 +1,1572 @@
-+/*
-+ * Nokia n810 battery management
-+ *
-+ * WARNING: This driver is based on unconfirmed documentation.
-+ * It is possibly dangerous to use this software.
-+ * Use this software at your own risk!
-+ *
-+ * Copyright (c) 2010-2011 Michael Buesch <mb@bu3sch.de>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version 2
-+ * of the License, or (at your option) any later version.
-+ *
-+ * 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.
-+ */
-+
-+#define DEBUG
-+
-+#include <linux/module.h>
-+#include <linux/device.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+#include <linux/mutex.h>
-+#include <linux/timer.h>
-+#include <linux/firmware.h>
-+#include <linux/bitops.h>
-+#include <linux/workqueue.h>
-+#include <linux/delay.h>
-+#include <linux/interrupt.h>
-+
-+#include "cbus.h"
-+#include "retu.h"
-+#include "tahvo.h"
-+#include "lipocharge.h"
-+
-+
-+#define N810BM_PMM_BLOCK_FILENAME "n810-cal-bme-pmm.fw"
-+#define N810BM_PMM_BLOCK_SIZE 0x600
-+#define N810BM_PMM_GROUP_SIZE 0x200
-+#define N810BM_PMM_ELEM_SIZE 0x10
-+
-+#define N810BM_CHECK_INTERVAL (HZ * 2)
-+#define N810BM_MIN_VOLTAGE_THRES 3200 /* Absolute minimum voltage threshold */
-+
-+
-+/* RETU_ADC_BSI
-+ * The battery size indicator ADC measures the resistance between
-+ * the battery BSI pin and ground. This is used to detect the battery
-+ * capacity, as the BSI resistor is related to capacity.
-+ *
-+ * Manually measured lookup table.
-+ * Hard to measure, thus not very accurate.
-+ *
-+ * Resistance | ADC value
-+ * ========================
-+ * 120k | 0x3AC
-+ * 110k | 0x37C
-+ * 100k | 0x351
-+ * 90k | 0x329
-+ */
-+
-+/* RETU_ADC_BATTVOLT
-+ * Manually measured lookup table.
-+ * Hard to measure, thus not very accurate.
-+ *
-+ * Voltage | ADC value
-+ * =====================
-+ * 2.80V | 0x037
-+ * 2.90V | 0x05E
-+ * 3.00V | 0x090
-+ * 3.10V | 0x0A4
-+ * 3.20V | 0x0CC
-+ * 3.30V | 0x0EF
-+ * 3.40V | 0x115
-+ * 3.50V | 0x136
-+ * 3.60V | 0x15C
-+ * 3.70V | 0x187
-+ * 3.80V | 0x1A5
-+ * 3.90V | 0x1C9
-+ * 4.00V | 0x1ED
-+ * 4.10V | 0x212
-+ * 4.20V | 0x236
-+ */
-+
-+
-+/* PMM block ADC IDs */
-+enum n810bm_pmm_adc_id {
-+ N810BM_PMM_ADC_BATVOLT = 0x01, /* Battery voltage */
-+ N810BM_PMM_ADC_CHGVOLT = 0x02, /* Charger voltage */
-+ N810BM_PMM_ADC_GND2 = 0x03, /* Ground 0V */
-+ N810BM_PMM_ADC_BSI = 0x04, /* Battery size indicator */
-+ N810BM_PMM_ADC_BATTEMP = 0x05, /* Battery temperature */
-+ N810BM_PMM_ADC_HEADSET = 0x06, /* Headset detection */
-+ N810BM_PMM_ADC_HOOKDET = 0x07, /* Hook detection */
-+ N810BM_PMM_ADC_LIGHTSENS = 0x08, /* Light sensor */
-+ N810BM_PMM_ADC_BATCURR = 0x0E, /* Battery current */
-+ N810BM_PMM_ADC_BKUPVOLT = 0x13, /* Backup battery voltage */
-+ N810BM_PMM_ADC_LIGHTTEMP = 0x14, /* Light sensor temperature */
-+ N810BM_PMM_ADC_RFGP = 0x15, /* RF GP */
-+ N810BM_PMM_ADC_WBTX = 0x16, /* Wideband TX detection */
-+ N810BM_PMM_ADC_RETUTEMP = 0x17, /* RETU chip temperature */
-+ N810BM_PMM_ADC_0xFE = 0xFE,
-+};
-+
-+struct n810bm_adc_calib {
-+ enum n810bm_pmm_adc_id id;
-+ u8 flags;
-+ u8 adc_groupnr;
-+ u32 field1;
-+ u32 field2;
-+ u16 field3;
-+ u16 field4;
-+};
-+
-+struct n810bm_calib {
-+ struct n810bm_adc_calib adc[25];
-+};
-+
-+enum n810bm_capacity {
-+ N810BM_CAP_UNKNOWN = -1,
-+ N810BM_CAP_NONE = 0,
-+ N810BM_CAP_1500MAH = 1500, /* 1500 mAh battery */
-+};
-+
-+enum n810bm_notify_flags {
-+ N810BM_NOTIFY_charger_present,
-+ N810BM_NOTIFY_charger_state,
-+ N810BM_NOTIFY_charger_pwm,
-+};
-+
-+struct n810bm {
-+ int tahvo_irq;
-+ bool tahvo_irq_enabled;
-+
-+ bool battery_present; /* A battery is inserted */
-+ bool charger_present; /* The charger is connected */
-+ enum n810bm_capacity capacity; /* The capacity of the inserted battery (if any) */
-+
-+ bool charger_enabled; /* Want to charge? */
-+ struct lipocharge charger; /* Charger subsystem */
-+ unsigned int active_current_pwm; /* Active value of TAHVO_REG_CHGCURR */
-+ int current_measure_enabled; /* Current measure enable refcount */
-+
-+ struct platform_device *pdev;
-+ struct n810bm_calib calib; /* Calibration data */
-+
-+ bool verbose_charge_log; /* Verbose charge logging */
-+
-+ unsigned long notify_flags;
-+ struct work_struct notify_work;
-+ struct delayed_work periodic_check_work;
-+
-+ bool initialized; /* The hardware was initialized */
-+ struct mutex mutex;
-+};
-+
-+static void n810bm_notify_charger_present(struct n810bm *bm);
-+static void n810bm_notify_charger_state(struct n810bm *bm);
-+static void n810bm_notify_charger_pwm(struct n810bm *bm);
-+
-+
-+static struct platform_device *n810bm_retu_device;
-+static struct platform_device *n810bm_tahvo_device;
-+
-+
-+static inline struct n810bm * device_to_n810bm(struct device *dev)
-+{
-+ struct platform_device *pdev = to_platform_device(dev);
-+ struct n810bm *bm = platform_get_drvdata(pdev);
-+
-+ return bm;
-+}
-+
-+static inline bool n810bm_known_battery_present(struct n810bm *bm)
-+{
-+ return bm->battery_present &&
-+ bm->capacity != N810BM_CAP_UNKNOWN &&
-+ bm->capacity != N810BM_CAP_NONE;
-+}
-+
-+static void n810bm_emergency(struct n810bm *bm, const char *message) __noreturn;
-+static void n810bm_emergency(struct n810bm *bm, const char *message)
-+{
-+ printk(KERN_EMERG "n810 battery management fatal fault: %s\n", message);
-+ cbus_emergency();
-+}
-+
-+static u16 tahvo_read(struct n810bm *bm, unsigned int reg)
-+{
-+ return tahvo_read_reg(&n810bm_tahvo_device->dev, reg);
-+}
-+
-+static void tahvo_maskset(struct n810bm *bm, unsigned int reg, u16 mask, u16 set)
-+{
-+ tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, set, mask);
-+}
-+
-+static inline void tahvo_write(struct n810bm *bm, unsigned int reg, u16 value)
-+{
-+ tahvo_write_reg(&n810bm_tahvo_device->dev, reg, value);
-+}
-+
-+static inline void tahvo_set(struct n810bm *bm, unsigned int reg, u16 mask)
-+{
-+ tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, mask, mask);
-+}
-+
-+static inline void tahvo_clear(struct n810bm *bm, unsigned int reg, u16 mask)
-+{
-+ tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, 0, mask);
-+}
-+
-+static u16 retu_read(struct n810bm *bm, unsigned int reg)
-+{
-+ return retu_read_reg(&n810bm_retu_device->dev, reg);
-+}
-+
-+static void retu_maskset(struct n810bm *bm, unsigned int reg, u16 mask, u16 set)
-+{
-+ retu_set_clear_reg_bits(&n810bm_retu_device->dev, reg, set, mask);
-+}
-+
-+static inline void retu_write(struct n810bm *bm, unsigned int reg, u16 value)
-+{
-+ retu_write_reg(&n810bm_retu_device->dev, reg, value);
-+}
-+
-+static int retu_adc_average(struct n810bm *bm, unsigned int chan,
-+ unsigned int nr_passes)
-+{
-+ unsigned int i, value = 0;
-+ int ret;
-+
-+ if (WARN_ON(!nr_passes))
-+ return 0;
-+ for (i = 0; i < nr_passes; i++) {
-+ ret = retu_read_adc(&n810bm_retu_device->dev, chan);
-+ if (ret < 0)
-+ return ret;
-+ value += ret;
-+ }
-+ value /= nr_passes;
-+
-+ return value;
-+}
-+
-+static struct n810bm_adc_calib * n810bm_get_adc_calib(struct n810bm *bm,
-+ enum n810bm_pmm_adc_id id)
-+{
-+ unsigned int index = 0;
-+ struct n810bm_adc_calib *cal;
-+
-+ if (id != N810BM_PMM_ADC_0xFE)
-+ index = (unsigned int)id + 1;
-+ if (index >= ARRAY_SIZE(bm->calib.adc))
-+ return NULL;
-+
-+ cal = &bm->calib.adc[index];
-+ WARN_ON(cal->id && cal->id != id);
-+
-+ return cal;
-+}
-+
-+static int pmm_record_get(struct n810bm *bm,
-+ const struct firmware *pmm_block,
-+ void *buffer, size_t length,
-+ unsigned int group, unsigned int element, unsigned int offset)
-+{
-+ const u8 *pmm_area = pmm_block->data;
-+ u8 active_group_mask;
-+
-+ if (pmm_block->size != N810BM_PMM_BLOCK_SIZE)
-+ return -EINVAL;
-+ if (group >= N810BM_PMM_BLOCK_SIZE / N810BM_PMM_GROUP_SIZE)
-+ return -EINVAL;
-+ if (element >= N810BM_PMM_GROUP_SIZE / N810BM_PMM_ELEM_SIZE)
-+ return -EINVAL;
-+ if (offset >= N810BM_PMM_ELEM_SIZE || length > N810BM_PMM_ELEM_SIZE ||
-+ length + offset > N810BM_PMM_ELEM_SIZE)
-+ return -EINVAL;
-+
-+ active_group_mask = pmm_area[16];
-+ if (!(active_group_mask & (1 << group))) {
-+ dev_dbg(&bm->pdev->dev, "pwm_record_get: Requested group %u, "
-+ "but group is not active", group);
-+ return -ENOENT;
-+ }
-+
-+ memcpy(buffer,
-+ pmm_area + group * N810BM_PMM_GROUP_SIZE
-+ + element * N810BM_PMM_ELEM_SIZE
-+ + offset,
-+ length);
-+
-+ return 0;
-+}
-+
-+/* PMM block group 1 element */
-+struct group1_element {
-+ u8 id;
-+ u8 flags;
-+ u8 adc_groupnr;
-+ u8 _padding;
-+ __le32 field1;
-+ __le32 field2;
-+} __packed;
-+
-+static int extract_group1_elem(struct n810bm *bm,
-+ const struct firmware *pmm_block,
-+ const enum n810bm_pmm_adc_id *pmm_adc_ids, size_t nr_pmm_adc_ids,
-+ u32 field1_mask, u32 field2_mask)
-+{
-+ struct group1_element elem;
-+ int err;
-+ unsigned int i, element_nr;
-+ struct n810bm_adc_calib *adc_calib;
-+
-+ for (i = 0; i < nr_pmm_adc_ids; i++) {
-+ element_nr = (unsigned int)(pmm_adc_ids[i]) + 3;
-+
-+ err = pmm_record_get(bm, pmm_block, &elem, sizeof(elem),
-+ 1, element_nr, 0);
-+ if (err)
-+ continue;
-+ adc_calib = n810bm_get_adc_calib(bm, elem.id);
-+ if (!adc_calib) {
-+ dev_err(&bm->pdev->dev, "extract_group1_elem: "
-+ "Could not get calib element for 0x%02X",
-+ elem.id);
-+ return -EINVAL;
-+ }
-+
-+ if (adc_calib->flags == elem.flags) {
-+ adc_calib->field1 = le32_to_cpu(elem.field1) & field1_mask;
-+ adc_calib->field2 = le32_to_cpu(elem.field2) & field2_mask;
-+ } else {
-+ dev_dbg(&bm->pdev->dev, "extract_group1_elem: "
-+ "Not extracting fields due to flags mismatch: "
-+ "0x%02X vs 0x%02X",
-+ adc_calib->flags, elem.flags);
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int n810bm_parse_pmm_group1(struct n810bm *bm,
-+ const struct firmware *pmm_block)
-+{
-+ struct n810bm_adc_calib *adc_calib;
-+ struct group1_element elem;
-+ int err;
-+
-+ static const enum n810bm_pmm_adc_id pmm_adc_ids_1[] = {
-+ N810BM_PMM_ADC_BATVOLT,
-+ N810BM_PMM_ADC_CHGVOLT,
-+ N810BM_PMM_ADC_BKUPVOLT,
-+ N810BM_PMM_ADC_BATCURR,
-+ };
-+ static const enum n810bm_pmm_adc_id pmm_adc_ids_2[] = {
-+ N810BM_PMM_ADC_BSI,
-+ };
-+ static const enum n810bm_pmm_adc_id pmm_adc_ids_3[] = {
-+ N810BM_PMM_ADC_BATTEMP,
-+ };
-+
-+ /* Parse element 2 */
-+ err = pmm_record_get(bm, pmm_block, &elem, sizeof(elem),
-+ 1, 2, 0);
-+ if (err) {
-+ dev_err(&bm->pdev->dev,
-+ "PMM: Failed to get group 1 / element 2");
-+ return err;
-+ }
-+ if (elem.id == N810BM_PMM_ADC_0xFE && elem.flags == 0x05) {
-+ adc_calib = n810bm_get_adc_calib(bm, elem.id);
-+ if (!adc_calib) {
-+ dev_err(&bm->pdev->dev,
-+ "calib extract: Failed to get 0xFE calib");
-+ return -EINVAL;
-+ }
-+ adc_calib->id = elem.id;
-+ adc_calib->flags = elem.flags;
-+ adc_calib->field1 = le32_to_cpu(elem.field1);
-+ adc_calib->field2 = le32_to_cpu(elem.field2);
-+ }
-+
-+ err = extract_group1_elem(bm, pmm_block,
-+ pmm_adc_ids_1, ARRAY_SIZE(pmm_adc_ids_1),
-+ 0xFFFFFFFF, 0xFFFFFFFF);
-+ if (err)
-+ return err;
-+ err = extract_group1_elem(bm, pmm_block,
-+ pmm_adc_ids_2, ARRAY_SIZE(pmm_adc_ids_2),
-+ 0xFFFFFFFF, 0);
-+ if (err)
-+ return err;
-+ err = extract_group1_elem(bm, pmm_block,
-+ pmm_adc_ids_3, ARRAY_SIZE(pmm_adc_ids_3),
-+ 0xFFFFFFFF, 0x0000FFFF);
-+ if (err)
-+ return err;
-+
-+ return 0;
-+}
-+
-+static int n810bm_parse_pmm_group2(struct n810bm *bm,
-+ const struct firmware *pmm_block)
-+{
-+ dev_err(&bm->pdev->dev, "TODO: CAL BME PMM group 2 parser not implemented, yet");
-+ return -EOPNOTSUPP;
-+}
-+
-+static void n810bm_adc_calib_set_defaults(struct n810bm *bm)
-+{
-+ struct n810bm_adc_calib *adc_calib;
-+ unsigned int i;
-+
-+ static const struct n810bm_adc_calib defaults[] = {
-+ /* ADC group-nr 0 */
-+ {
-+ .id = N810BM_PMM_ADC_HEADSET,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_HOOKDET,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_RFGP,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_LIGHTSENS,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_WBTX,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_RETUTEMP,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ }, {
-+ .id = N810BM_PMM_ADC_GND2,
-+ .flags = 0x00,
-+ .adc_groupnr = 0,
-+ },
-+ /* ADC group-nr 1 */
-+ {
-+ .id = N810BM_PMM_ADC_0xFE,
-+ .flags = 0x05,
-+ .adc_groupnr = 1,
-+ .field1 = (u32)-2,
-+ .field2 = 13189,
-+ }, {
-+ .id = N810BM_PMM_ADC_BATVOLT,
-+ .flags = 0x01,
-+ .adc_groupnr = 1,
-+ .field1 = 2527,
-+ .field2 = 21373,
-+ }, {
-+ .id = N810BM_PMM_ADC_CHGVOLT,
-+ .flags = 0x01,
-+ .adc_groupnr = 1,
-+ .field1 = 0,
-+ .field2 = 129848,
-+ }, {
-+ .id = N810BM_PMM_ADC_BKUPVOLT,
-+ .flags = 0x01,
-+ .adc_groupnr = 1,
-+ .field1 = 0,
-+ .field2 = 20000,
-+ }, {
-+ .id = N810BM_PMM_ADC_BATCURR,
-+ .flags = 0x06,
-+ .adc_groupnr = 1,
-+ .field1 = 0,
-+ .field2 = 9660,
-+ },
-+ /* ADC group-nr 2 */
-+ {
-+ .id = N810BM_PMM_ADC_BSI,
-+ .flags = 0x02,
-+ .adc_groupnr = 2,
-+ .field1 = 1169,
-+ .field2 = 0,
-+ },
-+ /* ADC group-nr 3 */
-+ {
-+ .id = N810BM_PMM_ADC_BATTEMP,
-+ .flags = 0x03,
-+ .adc_groupnr = 3,
-+ .field1 = 265423000,
-+ .field2 = 298,
-+ },
-+ /* ADC group-nr 4 */
-+ {
-+ .id = N810BM_PMM_ADC_LIGHTTEMP,
-+ .flags = 0x04,
-+ .adc_groupnr = 4,
-+ .field1 = 19533778,
-+ .field2 = 308019670,
-+ .field3 = 4700,
-+ .field4 = 2500,
-+ },
-+ };
-+
-+ /* Clear the array */
-+ memset(&bm->calib.adc, 0, sizeof(bm->calib.adc));
-+ for (i = 0; i < ARRAY_SIZE(bm->calib.adc); i++)
-+ bm->calib.adc[i].flags = 0xFF;
-+
-+ /* Copy the defaults */
-+ for (i = 0; i < ARRAY_SIZE(defaults); i++) {
-+ adc_calib = n810bm_get_adc_calib(bm, defaults[i].id);
-+ if (WARN_ON(!adc_calib))
-+ continue;
-+ *adc_calib = defaults[i];
-+ }
-+}
-+
-+static int n810bm_parse_pmm_block(struct n810bm *bm,
-+ const struct firmware *pmm_block)
-+{
-+ u8 byte;
-+ int err;
-+ unsigned int i, count;
-+ struct n810bm_adc_calib *adc_calib;
-+
-+ /* Initialize to defaults */
-+ n810bm_adc_calib_set_defaults(bm);
-+
-+ /* Parse the PMM data */
-+ err = pmm_record_get(bm, pmm_block, &byte, sizeof(byte),
-+ 1, 0, 0); /* group 1 / element 0 */
-+ err |= (byte != 0x01);
-+ err |= pmm_record_get(bm, pmm_block, &byte, sizeof(byte),
-+ 1, 1, 0); /* group 1 / element 1 */
-+ err |= (byte != 0x01);
-+ if (err)
-+ err = n810bm_parse_pmm_group2(bm, pmm_block);
-+ else
-+ err = n810bm_parse_pmm_group1(bm, pmm_block);
-+ if (err)
-+ return err;
-+
-+ /* Sanity checks */
-+ for (i = 0, count = 0; i < ARRAY_SIZE(bm->calib.adc); i++) {
-+ adc_calib = &bm->calib.adc[i];
-+ if (adc_calib->flags == 0xFF)
-+ continue;
-+ switch (adc_calib->id) {
-+ case N810BM_PMM_ADC_BATVOLT:
-+ if (adc_calib->field1 < 2400 ||
-+ adc_calib->field1 > 2700)
-+ goto value_check_fail;
-+ if (adc_calib->field2 < 20000 ||
-+ adc_calib->field2 > 23000)
-+ goto value_check_fail;
-+ count++;
-+ break;
-+ case N810BM_PMM_ADC_BSI:
-+ if (adc_calib->field1 < 1100 ||
-+ adc_calib->field1 > 1300)
-+ goto value_check_fail;
-+ count++;
-+ break;
-+ case N810BM_PMM_ADC_BATCURR:
-+ if (adc_calib->field2 < 7000 ||
-+ adc_calib->field2 > 12000)
-+ goto value_check_fail;
-+ count++;
-+ break;
-+ case N810BM_PMM_ADC_0xFE:
-+ if ((s32)adc_calib->field1 > 14 ||
-+ (s32)adc_calib->field1 < -14)
-+ goto value_check_fail;
-+ if (adc_calib->field2 < 13000 ||
-+ adc_calib->field2 > 13350)
-+ goto value_check_fail;
-+ count++;
-+ break;
-+ case N810BM_PMM_ADC_CHGVOLT:
-+ case N810BM_PMM_ADC_BATTEMP:
-+ case N810BM_PMM_ADC_BKUPVOLT:
-+ count++;
-+ break;
-+ case N810BM_PMM_ADC_GND2:
-+ case N810BM_PMM_ADC_HOOKDET:
-+ case N810BM_PMM_ADC_LIGHTSENS:
-+ case N810BM_PMM_ADC_HEADSET:
-+ case N810BM_PMM_ADC_LIGHTTEMP:
-+ case N810BM_PMM_ADC_RFGP:
-+ case N810BM_PMM_ADC_WBTX:
-+ case N810BM_PMM_ADC_RETUTEMP:
-+ break;
-+ }
-+ dev_dbg(&bm->pdev->dev,
-+ "ADC 0x%02X calib: 0x%02X 0x%02X 0x%08X 0x%08X 0x%04X 0x%04X",
-+ adc_calib->id, adc_calib->flags, adc_calib->adc_groupnr,
-+ adc_calib->field1, adc_calib->field2,
-+ adc_calib->field3, adc_calib->field4);
-+ }
-+ if (count != 7) {
-+ dev_err(&bm->pdev->dev, "PMM sanity check: Did not find "
-+ "all required values (count=%u)", count);
-+ goto check_fail;
-+ }
-+
-+ return 0;
-+
-+value_check_fail:
-+ dev_err(&bm->pdev->dev, "PMM image sanity check failed "
-+ "(id=%02X, field1=%08X, field2=%08X)",
-+ adc_calib->id, adc_calib->field1, adc_calib->field2);
-+check_fail:
-+ return -EILSEQ;
-+}
-+
-+/* Set the current measure timer that triggers on Tahvo IRQ 7
-+ * An interval of zero disables the timer. */
-+static void n810bm_set_current_measure_timer(struct n810bm *bm,
-+ u16 millisec_interval)
-+{
-+ u16 value = millisec_interval;
-+
-+ if (value <= 0xF905) {
-+ value = ((u64)0x10624DD3 * (u64)(value + 0xF9)) >> 32;
-+ value /= 16;
-+ } else
-+ value = 0xFF;
-+
-+ tahvo_write(bm, TAHVO_REG_BATCURRTIMER, value & 0xFF);
-+
-+ tahvo_set(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_CURTIMRST);
-+ tahvo_clear(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_CURTIMRST);
-+
-+ if (millisec_interval) {
-+ if (!bm->tahvo_irq_enabled) {
-+ bm->tahvo_irq_enabled = 1;
-+ enable_irq(bm->tahvo_irq);
-+ }
-+ } else {
-+ if (bm->tahvo_irq_enabled) {
-+ bm->tahvo_irq_enabled = 0;
-+ disable_irq_nosync(bm->tahvo_irq);
-+ }
-+ }
-+
-+ //TODO also do a software timer for safety.
-+}
-+
-+static void n810bm_enable_current_measure(struct n810bm *bm)
-+{
-+ WARN_ON(bm->current_measure_enabled < 0);
-+ if (!bm->current_measure_enabled) {
-+ /* Enable the current measurement circuitry */
-+ tahvo_set(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_CURMEAS);
-+ dev_dbg(&bm->pdev->dev,
-+ "Current measurement circuitry enabled");
-+ }
-+ bm->current_measure_enabled++;
-+}
-+
-+static void n810bm_disable_current_measure(struct n810bm *bm)
-+{
-+ bm->current_measure_enabled--;
-+ WARN_ON(bm->current_measure_enabled < 0);
-+ if (!bm->current_measure_enabled) {
-+ /* Disable the current measurement circuitry */
-+ tahvo_clear(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_CURMEAS);
-+ dev_dbg(&bm->pdev->dev,
-+ "Current measurement circuitry disabled");
-+ }
-+}
-+
-+/* Measure the actual battery current. Returns a signed value in mA.
-+ * Does only work, if current measurement was enabled. */
-+static int n810bm_measure_batt_current(struct n810bm *bm)
-+{
-+ u16 retval;
-+ int adc = 0, ma, i;
-+
-+ if (WARN_ON(bm->current_measure_enabled <= 0))
-+ return 0;
-+ for (i = 0; i < 3; i++) {
-+ retval = tahvo_read(bm, TAHVO_REG_BATCURR);
-+ adc += (s16)retval; /* Value is signed */
-+ }
-+ adc /= 3;
-+
-+ //TODO convert to mA
-+ ma = adc;
-+
-+ return ma;
-+}
-+
-+/* Requires bm->mutex locked */
-+static int n810bm_measure_batt_current_async(struct n810bm *bm)
-+{
-+ int ma;
-+ bool charging = lipocharge_is_charging(&bm->charger);
-+
-+ n810bm_enable_current_measure(bm);
-+ if (!charging)
-+ WARN_ON(bm->active_current_pwm != 0);
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_EN |
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ TAHVO_REG_CHGCTL_EN |
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ (charging ? 0 : TAHVO_REG_CHGCTL_PWMOVRZERO));
-+ ma = n810bm_measure_batt_current(bm);
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_EN |
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ (charging ? TAHVO_REG_CHGCTL_EN : 0));
-+ n810bm_disable_current_measure(bm);
-+
-+ return ma;
-+}
-+
-+static int adc_sanity_check(struct n810bm *bm, unsigned int channel)
-+{
-+ int value;
-+
-+ value = retu_read_adc(&n810bm_retu_device->dev, channel);
-+ if (value < 0) {
-+ dev_err(&bm->pdev->dev, "Failed to read GND ADC channel %u",
-+ channel);
-+ return -EIO;
-+ }
-+ dev_dbg(&bm->pdev->dev,
-+ "GND ADC channel %u sanity check got value: %d",
-+ channel, value);
-+ if (value > 5) {
-+ n810bm_emergency(bm, "GND ADC sanity check failed");
-+ return -EIO;
-+ }
-+
-+ return 0;
-+}
-+
-+static int n810bm_check_adc_sanity(struct n810bm *bm)
-+{
-+ int err;
-+
-+ /* Discard one conversion */
-+ retu_write(bm, RETU_REG_ADCSCR, 0);
-+ retu_read_adc(&n810bm_retu_device->dev, RETU_ADC_GND2);
-+
-+ err = adc_sanity_check(bm, RETU_ADC_GND2);
-+ if (err)
-+ return err;
-+
-+ return 0;
-+}
-+
-+/* Measure the battery voltage. Returns the value in mV (or negative value on error). */
-+static int n810bm_measure_batt_voltage(struct n810bm *bm)
-+{
-+ int adc;
-+ unsigned int mv;
-+ const unsigned int scale = 1000;
-+
-+ adc = retu_adc_average(bm, RETU_ADC_BATTVOLT, 5);
-+ if (adc < 0)
-+ return adc;
-+ if (adc <= 0x37)
-+ return 2800;
-+ mv = 2800 + ((adc - 0x37) * (((4200 - 2800) * scale) / (0x236 - 0x37))) / scale;
-+
-+ //TODO compensate for power consumption
-+ //TODO honor calibration values
-+
-+ return mv;
-+}
-+
-+/* Measure the charger voltage. Returns the value in mV (or negative value on error). */
-+static int n810bm_measure_charger_voltage(struct n810bm *bm)
-+{
-+ int adc;
-+ unsigned int mv;
-+
-+ adc = retu_adc_average(bm, RETU_ADC_CHGVOLT, 5);
-+ if (adc < 0)
-+ return adc;
-+ //TODO convert to mV
-+ mv = adc;
-+
-+ return mv;
-+}
-+
-+/* Measure backup battery voltage. Returns the value in mV (or negative value on error). */
-+static int n810bm_measure_backup_batt_voltage(struct n810bm *bm)
-+{
-+ int adc;
-+ unsigned int mv;
-+
-+ adc = retu_adc_average(bm, RETU_ADC_BKUPVOLT, 3);
-+ if (adc < 0)
-+ return adc;
-+ //TODO convert to mV
-+ mv = adc;
-+
-+ return mv;
-+}
-+
-+/* Measure the battery temperature. Returns the value in K (or negative value on error). */
-+static int n810bm_measure_batt_temp(struct n810bm *bm)
-+{
-+ int adc;
-+ unsigned int k;
-+
-+ adc = retu_adc_average(bm, RETU_ADC_BATTEMP, 3);
-+ if (adc < 0)
-+ return adc;
-+ //TODO convert to K
-+ k = adc;
-+
-+ return k;
-+}
-+
-+/* Read the battery capacity via BSI pin. */
-+static enum n810bm_capacity n810bm_read_batt_capacity(struct n810bm *bm)
-+{
-+ int adc;
-+ const unsigned int hyst = 20;
-+
-+ adc = retu_adc_average(bm, RETU_ADC_BSI, 5);
-+ if (adc < 0) {
-+ dev_err(&bm->pdev->dev, "Failed to read BSI ADC");
-+ return N810BM_CAP_UNKNOWN;
-+ }
-+
-+ if (adc >= 0x3B5 - hyst && adc <= 0x3B5 + hyst)
-+ return N810BM_CAP_1500MAH;
-+
-+ dev_err(&bm->pdev->dev, "Capacity indicator 0x%X unknown", adc);
-+
-+ return N810BM_CAP_UNKNOWN;
-+}
-+
-+/* Convert a battery voltage (in mV) to percentage. */
-+static unsigned int n810bm_mvolt2percent(unsigned int mv)
-+{
-+ const unsigned int minv = 3700;
-+ const unsigned int maxv = 4150;
-+ unsigned int percent;
-+
-+ mv = clamp(mv, minv, maxv);
-+ percent = (mv - minv) * 100 / (maxv - minv);
-+
-+ return percent;
-+}
-+
-+static void n810bm_start_charge(struct n810bm *bm)
-+{
-+ int err;
-+
-+ WARN_ON(!bm->battery_present);
-+ WARN_ON(!bm->charger_present);
-+
-+ /* Set PWM to zero */
-+ bm->active_current_pwm = 0;
-+ tahvo_write(bm, TAHVO_REG_CHGCURR, bm->active_current_pwm);
-+
-+ /* Charge global enable */
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_EN |
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ TAHVO_REG_CHGCTL_EN);
-+
-+ WARN_ON((int)bm->capacity <= 0);
-+ bm->charger.capacity = bm->capacity;
-+ err = lipocharge_start(&bm->charger);
-+ WARN_ON(err);
-+
-+ /* Initialize current measurement circuitry */
-+ n810bm_enable_current_measure(bm);
-+ n810bm_set_current_measure_timer(bm, 250);
-+
-+ dev_info(&bm->pdev->dev, "Charging battery");
-+ n810bm_notify_charger_state(bm);
-+ n810bm_notify_charger_pwm(bm);
-+}
-+
-+static void n810bm_stop_charge(struct n810bm *bm)
-+{
-+ if (lipocharge_is_charging(&bm->charger)) {
-+ n810bm_set_current_measure_timer(bm, 0);
-+ n810bm_disable_current_measure(bm);
-+ }
-+ lipocharge_stop(&bm->charger);
-+
-+ /* Set PWM to zero */
-+ bm->active_current_pwm = 0;
-+ tahvo_write(bm, TAHVO_REG_CHGCURR, bm->active_current_pwm);
-+
-+ /* Charge global disable */
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_EN |
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ 0);
-+
-+ dev_info(&bm->pdev->dev, "Not charging battery");
-+ n810bm_notify_charger_state(bm);
-+ n810bm_notify_charger_pwm(bm);
-+}
-+
-+/* Periodic check */
-+static void n810bm_periodic_check_work(struct work_struct *work)
-+{
-+ struct n810bm *bm = container_of(to_delayed_work(work),
-+ struct n810bm, periodic_check_work);
-+ u16 status;
-+ bool battery_was_present, charger_was_present;
-+ int mv;
-+
-+ mutex_lock(&bm->mutex);
-+
-+ status = retu_read(bm, RETU_REG_STATUS);
-+ battery_was_present = bm->battery_present;
-+ charger_was_present = bm->charger_present;
-+ bm->battery_present = !!(status & RETU_REG_STATUS_BATAVAIL);
-+ bm->charger_present = !!(status & RETU_REG_STATUS_CHGPLUG);
-+
-+ if (bm->battery_present != battery_was_present) {
-+ /* Battery state changed */
-+ if (bm->battery_present) {
-+ bm->capacity = n810bm_read_batt_capacity(bm);
-+ if (bm->capacity == N810BM_CAP_UNKNOWN) {
-+ dev_err(&bm->pdev->dev, "Unknown battery detected");
-+ } else {
-+ dev_info(&bm->pdev->dev, "Detected %u mAh battery",
-+ (unsigned int)bm->capacity);
-+ }
-+ } else {
-+ bm->capacity = N810BM_CAP_NONE;
-+ dev_info(&bm->pdev->dev, "The main battery was removed");
-+ //TODO disable charging
-+ }
-+ }
-+
-+ if (bm->charger_present != charger_was_present) {
-+ /* Charger state changed */
-+ dev_info(&bm->pdev->dev, "The charger was %s",
-+ bm->charger_present ? "plugged in" : "removed");
-+ n810bm_notify_charger_present(bm);
-+ }
-+
-+ if ((bm->battery_present && !bm->charger_present) ||
-+ !n810bm_known_battery_present(bm)){
-+ /* We're draining the battery */
-+ mv = n810bm_measure_batt_voltage(bm);
-+ if (mv < 0) {
-+ n810bm_emergency(bm,
-+ "check: Failed to measure voltage");
-+ }
-+ if (mv < N810BM_MIN_VOLTAGE_THRES) {
-+ n810bm_emergency(bm,
-+ "check: Minimum voltage threshold reached");
-+ }
-+ }
-+
-+ if (bm->charger_present && n810bm_known_battery_present(bm)) {
-+ /* Known battery and charger are connected */
-+ if (bm->charger_enabled) {
-+ /* Charger is enabled */
-+ if (!lipocharge_is_charging(&bm->charger)) {
-+ //TODO start charging, if battery is below some threshold
-+ n810bm_start_charge(bm);
-+ }
-+ }
-+ }
-+
-+ if (lipocharge_is_charging(&bm->charger) && !bm->charger_present) {
-+ /* Charger was unplugged. */
-+ n810bm_stop_charge(bm);
-+ }
-+
-+ mutex_unlock(&bm->mutex);
-+ schedule_delayed_work(&bm->periodic_check_work,
-+ round_jiffies_relative(N810BM_CHECK_INTERVAL));
-+}
-+
-+/*XXX
-+static void n810bm_adc_irq_handler(unsigned long data)
-+{
-+ struct n810bm *bm = (struct n810bm *)data;
-+
-+ retu_ack_irq(RETU_INT_ADCS);
-+ //TODO
-+dev_info(&bm->pdev->dev, "ADC interrupt triggered\n");
-+}
-+*/
-+
-+static irqreturn_t n810bm_tahvo_current_measure_irq_handler(int irq, void *data)
-+{
-+ struct n810bm *bm = data;
-+ int res, ma, mv, temp;
-+
-+ mutex_lock(&bm->mutex);
-+ if (!lipocharge_is_charging(&bm->charger))
-+ goto out_unlock;
-+
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ TAHVO_REG_CHGCTL_PWMOVR);
-+ ma = n810bm_measure_batt_current(bm);
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO);
-+ msleep(10);
-+ mv = n810bm_measure_batt_voltage(bm);
-+ tahvo_maskset(bm, TAHVO_REG_CHGCTL,
-+ TAHVO_REG_CHGCTL_PWMOVR |
-+ TAHVO_REG_CHGCTL_PWMOVRZERO,
-+ 0);
-+ temp = n810bm_measure_batt_temp(bm);
-+ if (WARN_ON(mv < 0))
-+ goto out_unlock;
-+ if (WARN_ON(temp < 0))
-+ goto out_unlock;
-+
-+ if (bm->verbose_charge_log) {
-+ dev_info(&bm->pdev->dev,
-+ "Battery charge state: %d mV, %d mA (%s)",
-+ mv, ma,
-+ (ma <= 0) ? "discharging" : "charging");
-+ }
-+ res = lipocharge_update_state(&bm->charger, mv, ma, temp);
-+ if (res) {
-+ if (res > 0)
-+ dev_info(&bm->pdev->dev, "Battery fully charged");
-+ n810bm_stop_charge(bm);
-+ }
-+out_unlock:
-+ mutex_unlock(&bm->mutex);
-+
-+ return IRQ_HANDLED;
-+}
-+
-+#define DEFINE_ATTR_NOTIFY(attr_name) \
-+ void n810bm_notify_##attr_name(struct n810bm *bm) \
-+ { \
-+ set_bit(N810BM_NOTIFY_##attr_name, &bm->notify_flags); \
-+ wmb(); \
-+ schedule_work(&bm->notify_work); \
-+ }
-+
-+#define DEFINE_SHOW_INT_FUNC(name, member) \
-+ static ssize_t n810bm_attr_##name##_show(struct device *dev, \
-+ struct device_attribute *attr, \
-+ char *buf) \
-+ { \
-+ struct n810bm *bm = device_to_n810bm(dev); \
-+ ssize_t count; \
-+ \
-+ mutex_lock(&bm->mutex); \
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", (int)(bm->member)); \
-+ mutex_unlock(&bm->mutex); \
-+ \
-+ return count; \
-+ }
-+
-+#define DEFINE_STORE_INT_FUNC(name, member) \
-+ static ssize_t n810bm_attr_##name##_store(struct device *dev, \
-+ struct device_attribute *attr,\
-+ const char *buf, size_t count)\
-+ { \
-+ struct n810bm *bm = device_to_n810bm(dev); \
-+ long val; \
-+ int err; \
-+ \
-+ mutex_lock(&bm->mutex); \
-+ err = strict_strtol(buf, 0, &val); \
-+ if (!err) \
-+ bm->member = (typeof(bm->member))val; \
-+ mutex_unlock(&bm->mutex); \
-+ \
-+ return err ? err : count; \
-+ }
-+
-+#define DEFINE_ATTR_SHOW_INT(name, member) \
-+ DEFINE_SHOW_INT_FUNC(name, member) \
-+ static DEVICE_ATTR(name, S_IRUGO, \
-+ n810bm_attr_##name##_show, NULL);
-+
-+#define DEFINE_ATTR_SHOW_STORE_INT(name, member) \
-+ DEFINE_SHOW_INT_FUNC(name, member) \
-+ DEFINE_STORE_INT_FUNC(name, member) \
-+ static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, \
-+ n810bm_attr_##name##_show, \
-+ n810bm_attr_##name##_store);
-+
-+DEFINE_ATTR_SHOW_INT(battery_present, battery_present);
-+DEFINE_ATTR_SHOW_INT(charger_present, charger_present);
-+static DEFINE_ATTR_NOTIFY(charger_present);
-+DEFINE_ATTR_SHOW_INT(charger_state, charger.state);
-+static DEFINE_ATTR_NOTIFY(charger_state);
-+DEFINE_ATTR_SHOW_INT(charger_pwm, active_current_pwm);
-+static DEFINE_ATTR_NOTIFY(charger_pwm);
-+DEFINE_ATTR_SHOW_STORE_INT(charger_enable, charger_enabled);
-+DEFINE_ATTR_SHOW_STORE_INT(charger_verbose, verbose_charge_log);
-+
-+static ssize_t n810bm_attr_battery_level_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count = -ENODEV;
-+ int millivolt;
-+
-+ mutex_lock(&bm->mutex);
-+ if (!bm->battery_present || lipocharge_is_charging(&bm->charger))
-+ millivolt = 0;
-+ else
-+ millivolt = n810bm_measure_batt_voltage(bm);
-+ if (millivolt >= 0) {
-+ count = snprintf(buf, PAGE_SIZE, "%u\n",
-+ n810bm_mvolt2percent(millivolt));
-+ }
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(battery_level, S_IRUGO,
-+ n810bm_attr_battery_level_show, NULL);
-+
-+static ssize_t n810bm_attr_battery_capacity_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count;
-+ int capacity = 0;
-+
-+ mutex_lock(&bm->mutex);
-+ if (n810bm_known_battery_present(bm))
-+ capacity = (int)bm->capacity;
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", capacity);
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(battery_capacity, S_IRUGO,
-+ n810bm_attr_battery_capacity_show, NULL);
-+
-+static ssize_t n810bm_attr_battery_temp_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count = -ENODEV;
-+ int k;
-+
-+ mutex_lock(&bm->mutex);
-+ k = n810bm_measure_batt_temp(bm);
-+ if (k >= 0)
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", k);
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(battery_temp, S_IRUGO,
-+ n810bm_attr_battery_temp_show, NULL);
-+
-+static ssize_t n810bm_attr_charger_voltage_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count = -ENODEV;
-+ int mv = 0;
-+
-+ mutex_lock(&bm->mutex);
-+ if (bm->charger_present)
-+ mv = n810bm_measure_charger_voltage(bm);
-+ if (mv >= 0)
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", mv);
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(charger_voltage, S_IRUGO,
-+ n810bm_attr_charger_voltage_show, NULL);
-+
-+static ssize_t n810bm_attr_backup_battery_voltage_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count = -ENODEV;
-+ int mv;
-+
-+ mutex_lock(&bm->mutex);
-+ mv = n810bm_measure_backup_batt_voltage(bm);
-+ if (mv >= 0)
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", mv);
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(backup_battery_voltage, S_IRUGO,
-+ n810bm_attr_backup_battery_voltage_show, NULL);
-+
-+static ssize_t n810bm_attr_battery_current_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct n810bm *bm = device_to_n810bm(dev);
-+ ssize_t count = -ENODEV;
-+ int ma = 0;
-+
-+ mutex_lock(&bm->mutex);
-+ if (bm->battery_present)
-+ ma = n810bm_measure_batt_current_async(bm);
-+ count = snprintf(buf, PAGE_SIZE, "%d\n", ma);
-+ mutex_unlock(&bm->mutex);
-+
-+ return count;
-+}
-+static DEVICE_ATTR(battery_current, S_IRUGO,
-+ n810bm_attr_battery_current_show, NULL);
-+
-+static const struct device_attribute *n810bm_attrs[] = {
-+ &dev_attr_battery_present,
-+ &dev_attr_battery_level,
-+ &dev_attr_battery_current,
-+ &dev_attr_battery_capacity,
-+ &dev_attr_battery_temp,
-+ &dev_attr_backup_battery_voltage,
-+ &dev_attr_charger_present,
-+ &dev_attr_charger_state,
-+ &dev_attr_charger_verbose,
-+ &dev_attr_charger_voltage,
-+ &dev_attr_charger_enable,
-+ &dev_attr_charger_pwm,
-+};
-+
-+static void n810bm_notify_work(struct work_struct *work)
-+{
-+ struct n810bm *bm = container_of(work, struct n810bm, notify_work);
-+ unsigned long notify_flags;
-+
-+ notify_flags = xchg(&bm->notify_flags, 0);
-+ mb();
-+
-+#define do_notify(attr_name) \
-+ do { \
-+ if (notify_flags & (1 << N810BM_NOTIFY_##attr_name)) { \
-+ sysfs_notify(&bm->pdev->dev.kobj, NULL, \
-+ dev_attr_##attr_name.attr.name); \
-+ } \
-+ } while (0)
-+
-+ do_notify(charger_present);
-+ do_notify(charger_state);
-+ do_notify(charger_pwm);
-+}
-+
-+static int n810bm_charger_set_current_pwm(struct lipocharge *c,
-+ unsigned int duty_cycle)
-+{
-+ struct n810bm *bm = container_of(c, struct n810bm, charger);
-+ int err = -EINVAL;
-+
-+ WARN_ON(!mutex_is_locked(&bm->mutex));
-+ if (WARN_ON(duty_cycle > 0xFF))
-+ goto out;
-+ if (WARN_ON(!bm->charger_enabled))
-+ goto out;
-+ if (WARN_ON(!bm->battery_present || !bm->charger_present))
-+ goto out;
-+
-+ if (duty_cycle != bm->active_current_pwm) {
-+ bm->active_current_pwm = duty_cycle;
-+ tahvo_write(bm, TAHVO_REG_CHGCURR, duty_cycle);
-+ n810bm_notify_charger_pwm(bm);
-+ }
-+
-+ err = 0;
-+out:
-+
-+ return err;
-+}
-+
-+static void n810bm_charger_emergency(struct lipocharge *c)
-+{
-+ struct n810bm *bm = container_of(c, struct n810bm, charger);
-+
-+ n810bm_emergency(bm, "Battery charger fault");
-+}
-+
-+static void n810bm_hw_exit(struct n810bm *bm)
-+{
-+ n810bm_stop_charge(bm);
-+ retu_write(bm, RETU_REG_ADCSCR, 0);
-+}
-+
-+static int n810bm_hw_init(struct n810bm *bm)
-+{
-+ int err;
-+
-+ err = n810bm_check_adc_sanity(bm);
-+ if (err)
-+ return err;
-+
-+ n810bm_stop_charge(bm);
-+
-+ return 0;
-+}
-+
-+static void n810bm_cancel_and_flush_work(struct n810bm *bm)
-+{
-+ cancel_delayed_work_sync(&bm->periodic_check_work);
-+ cancel_work_sync(&bm->notify_work);
-+ flush_scheduled_work();
-+}
-+
-+static int n810bm_device_init(struct n810bm *bm)
-+{
-+ int attr_index;
-+ int err;
-+
-+ bm->charger.rate = LIPORATE_p6C;
-+ bm->charger.top_voltage = 4100;
-+ bm->charger.duty_cycle_max = 0xFF;
-+ bm->charger.set_current_pwm = n810bm_charger_set_current_pwm;
-+ bm->charger.emergency = n810bm_charger_emergency;
-+ lipocharge_init(&bm->charger, &bm->pdev->dev);
-+
-+ err = n810bm_hw_init(bm);
-+ if (err)
-+ goto error;
-+ for (attr_index = 0; attr_index < ARRAY_SIZE(n810bm_attrs); attr_index++) {
-+ err = device_create_file(&bm->pdev->dev, n810bm_attrs[attr_index]);
-+ if (err)
-+ goto err_unwind_attrs;
-+ }
-+/*XXX
-+ err = retu_request_irq(RETU_INT_ADCS,
-+ n810bm_adc_irq_handler,
-+ (unsigned long)bm, "n810bm");
-+ if (err)
-+ goto err_unwind_attrs;
-+*/
-+ bm->tahvo_irq = platform_get_irq(n810bm_tahvo_device, 0);
-+ err = request_threaded_irq(bm->tahvo_irq, NULL,
-+ n810bm_tahvo_current_measure_irq_handler,
-+ IRQF_ONESHOT, "tahvo-n810bm", bm);
-+ if (err)
-+ goto err_free_retu_irq;
-+ disable_irq_nosync(bm->tahvo_irq);
-+ bm->tahvo_irq_enabled = 0;
-+
-+ schedule_delayed_work(&bm->periodic_check_work,
-+ round_jiffies_relative(N810BM_CHECK_INTERVAL));
-+
-+ bm->initialized = 1;
-+ dev_info(&bm->pdev->dev, "Battery management initialized");
-+
-+ return 0;
-+
-+err_free_retu_irq:
-+//XXX retu_free_irq(RETU_INT_ADCS);
-+err_unwind_attrs:
-+ for (attr_index--; attr_index >= 0; attr_index--)
-+ device_remove_file(&bm->pdev->dev, n810bm_attrs[attr_index]);
-+/*err_exit:*/
-+ n810bm_hw_exit(bm);
-+error:
-+ n810bm_cancel_and_flush_work(bm);
-+
-+ return err;
-+}
-+
-+static void n810bm_device_exit(struct n810bm *bm)
-+{
-+ int i;
-+
-+ if (!bm->initialized)
-+ return;
-+
-+ lipocharge_exit(&bm->charger);
-+ free_irq(bm->tahvo_irq, bm);
-+//XXX retu_free_irq(RETU_INT_ADCS);
-+ for (i = 0; i < ARRAY_SIZE(n810bm_attrs); i++)
-+ device_remove_file(&bm->pdev->dev, n810bm_attrs[i]);
-+
-+ n810bm_cancel_and_flush_work(bm);
-+
-+ n810bm_hw_exit(bm);
-+
-+ bm->initialized = 0;
-+}
-+
-+static void n810bm_pmm_block_found(const struct firmware *fw, void *context)
-+{
-+ struct n810bm *bm = context;
-+ int err;
-+
-+ if (!fw) {
-+ dev_err(&bm->pdev->dev,
-+ "CAL PMM block image file not found");
-+ goto err_release;
-+ }
-+ if (fw->size != N810BM_PMM_BLOCK_SIZE ||
-+ memcmp(fw->data, "BME-PMM-BLOCK01", 15) != 0) {
-+ dev_err(&bm->pdev->dev,
-+ "CAL PMM block image file has an invalid format");
-+ goto err_release;
-+ }
-+
-+ err = n810bm_parse_pmm_block(bm, fw);
-+ if (err)
-+ goto err_release;
-+ release_firmware(fw);
-+
-+ err = n810bm_device_init(bm);
-+ if (err) {
-+ dev_err(&bm->pdev->dev,
-+ "Failed to initialized battery management (%d)", err);
-+ goto error;
-+ }
-+
-+ return;
-+err_release:
-+ release_firmware(fw);
-+error:
-+ return;
-+}
-+
-+static int __devinit n810bm_probe(void)
-+{
-+ struct n810bm *bm;
-+ int err;
-+
-+ if (!n810bm_retu_device || !n810bm_tahvo_device)
-+ return 0;
-+
-+ bm = kzalloc(sizeof(*bm), GFP_KERNEL);
-+ if (!bm)
-+ return -ENOMEM;
-+ bm->pdev = n810bm_retu_device;
-+ platform_set_drvdata(n810bm_retu_device, bm);
-+ platform_set_drvdata(n810bm_tahvo_device, bm);
-+ mutex_init(&bm->mutex);
-+ INIT_DELAYED_WORK(&bm->periodic_check_work, n810bm_periodic_check_work);
-+ INIT_WORK(&bm->notify_work, n810bm_notify_work);
-+
-+ dev_info(&bm->pdev->dev, "Requesting CAL BME PMM block firmware file "
-+ N810BM_PMM_BLOCK_FILENAME);
-+ err = request_firmware_nowait(THIS_MODULE, 1,
-+ N810BM_PMM_BLOCK_FILENAME,
-+ &bm->pdev->dev, GFP_KERNEL,
-+ bm, n810bm_pmm_block_found);
-+ if (err) {
-+ dev_err(&bm->pdev->dev,
-+ "Failed to request CAL PMM block image file (%d)", err);
-+ goto err_free;
-+ }
-+
-+ return 0;
-+
-+err_free:
-+ kfree(bm);
-+
-+ return err;
-+}
-+
-+static void __devexit n810bm_remove(void)
-+{
-+ struct n810bm *bm;
-+
-+ if (!n810bm_retu_device || !n810bm_tahvo_device)
-+ return;
-+ bm = platform_get_drvdata(n810bm_retu_device);
-+
-+ n810bm_device_exit(bm);
-+
-+ kfree(bm);
-+ platform_set_drvdata(n810bm_retu_device, NULL);
-+ platform_set_drvdata(n810bm_tahvo_device, NULL);
-+}
-+
-+static int __devinit n810bm_retu_probe(struct platform_device *pdev)
-+{
-+ n810bm_retu_device = pdev;
-+ return n810bm_probe();
-+}
-+
-+static int __devexit n810bm_retu_remove(struct platform_device *pdev)
-+{
-+ n810bm_remove();
-+ n810bm_retu_device = NULL;
-+ return 0;
-+}
-+
-+static int __devinit n810bm_tahvo_probe(struct platform_device *pdev)
-+{
-+ n810bm_tahvo_device = pdev;
-+ return n810bm_probe();
-+}
-+
-+static int __devexit n810bm_tahvo_remove(struct platform_device *pdev)
-+{
-+ n810bm_remove();
-+ n810bm_tahvo_device = NULL;
-+ return 0;
-+}
-+
-+static struct platform_driver n810bm_retu_driver = {
-+ .remove = __devexit_p(n810bm_retu_remove),
-+ .driver = {
-+ .name = "retu-n810bm",
-+ }
-+};
-+
-+static struct platform_driver n810bm_tahvo_driver = {
-+ .remove = __devexit_p(n810bm_tahvo_remove),
-+ .driver = {
-+ .name = "tahvo-n810bm",
-+ }
-+};
-+
-+static int __init n810bm_modinit(void)
-+{
-+ int err;
-+
-+ err = platform_driver_probe(&n810bm_retu_driver, n810bm_retu_probe);
-+ if (err)
-+ return err;
-+ err = platform_driver_probe(&n810bm_tahvo_driver, n810bm_tahvo_probe);
-+ if (err) {
-+ platform_driver_unregister(&n810bm_retu_driver);
-+ return err;
-+ }
-+
-+ return 0;
-+}
-+module_init(n810bm_modinit);
-+
-+static void __exit n810bm_modexit(void)
-+{
-+ platform_driver_unregister(&n810bm_tahvo_driver);
-+ platform_driver_unregister(&n810bm_retu_driver);
-+}
-+module_exit(n810bm_modexit);
-+
-+MODULE_DESCRIPTION("Nokia n810 battery management");
-+MODULE_FIRMWARE(N810BM_PMM_BLOCK_FILENAME);
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Michael Buesch");
---- /dev/null
-+++ b/drivers/cbus/lipocharge.c
-@@ -0,0 +1,183 @@
-+/*
-+ * Generic LIPO battery charger
-+ *
-+ * Copyright (c) 2010-2011 Michael Buesch <mb@bu3sch.de>
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License
-+ * as published by the Free Software Foundation; either version 2
-+ * of the License, or (at your option) any later version.
-+ *
-+ * 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.
-+ */
-+
-+#define DEBUG
-+
-+#include "lipocharge.h"
-+
-+#include <linux/slab.h>
-+
-+
-+/* Hysteresis constants */
-+#define CURRENT_HYST 30 /* mA */
-+#define VOLTAGE_HYST 10 /* mV */
-+
-+/* Threshold constants */
-+#define FINISH_CURRENT_PERCENT 3
-+
-+
-+/* Returns the requested first-stage charge current in mA */
-+static inline unsigned int get_stage1_charge_current(struct lipocharge *c)
-+{
-+ /* current = (capacity * C) */
-+ return c->capacity * c->rate / 1000;
-+}
-+
-+void lipocharge_init(struct lipocharge *c, struct device *dev)
-+{
-+ c->dev = dev;
-+ c->state = LIPO_IDLE;
-+}
-+
-+void lipocharge_exit(struct lipocharge *c)
-+{
-+ c->state = LIPO_IDLE;
-+}
-+
-+int lipocharge_start(struct lipocharge *c)
-+{
-+ int err;
-+
-+ if (c->state != LIPO_IDLE)
-+ return -EBUSY;
-+ if (!c->set_current_pwm || !c->emergency)
-+ return -EINVAL;
-+ if (!c->top_voltage || c->top_voltage > 4200)
-+ return -EINVAL;
-+
-+ c->active_duty_cycle = 0;
-+ err = c->set_current_pwm(c, c->active_duty_cycle);
-+ if (err)
-+ return err;
-+ c->state = LIPO_FIRST_STAGE;
-+
-+ return 0;
-+}
-+
-+void lipocharge_stop(struct lipocharge *c)
-+{
-+ if (c->state == LIPO_IDLE)
-+ return;
-+ c->state = LIPO_IDLE;
-+}
-+
-+static int lipocharge_increase_current(struct lipocharge *c,
-+ unsigned int inc_permille)
-+{
-+ int old_pwm, new_pwm;
-+
-+ if (c->active_duty_cycle >= c->duty_cycle_max)
-+ return 0;
-+
-+ old_pwm = c->active_duty_cycle;
-+ new_pwm = old_pwm + (c->duty_cycle_max * inc_permille / 1000);
-+ new_pwm = min(new_pwm, (int)c->duty_cycle_max);
-+ c->active_duty_cycle = new_pwm;
-+
-+ dev_dbg(c->dev, "lipo: Increasing duty_cycle by "
-+ "%u permille (0x%02X -> 0x%02X)",
-+ inc_permille, old_pwm, new_pwm);
-+
-+ return c->set_current_pwm(c, c->active_duty_cycle);
-+}
-+
-+static int lipocharge_decrease_current(struct lipocharge *c,
-+ unsigned int dec_permille)
-+{
-+ int old_pwm, new_pwm;
-+
-+ if (c->active_duty_cycle <= 0)
-+ return 0;
-+
-+ old_pwm = c->active_duty_cycle;
-+ new_pwm = old_pwm - (c->duty_cycle_max * dec_permille / 1000);
-+ new_pwm = max(0, new_pwm);
-+ c->active_duty_cycle = new_pwm;
-+
-+ dev_dbg(c->dev, "lipo: Decreasing duty_cycle by "
-+ "%u permille (0x%02X -> 0x%02X)",
-+ dec_permille, old_pwm, new_pwm);
-+
-+ return c->set_current_pwm(c, c->active_duty_cycle);
-+}
-+
-+/** lipocharge_update_state - Update the charge state
-+ * @c: The context.
-+ * @voltage_mV: The measured battery voltage.
-+ * @current_mA: The measured charge current.
-+ * negative -> drain.
-+ * positive -> charge.
-+ * @temp_K: Battery temperature in K.
-+ *
-+ * Returns 0 on success, -1 on error.
-+ * Returns 1, if the charging process is finished.
-+ */
-+int lipocharge_update_state(struct lipocharge *c,
-+ unsigned int voltage_mV,
-+ int current_mA,
-+ unsigned int temp_K)
-+{
-+ int requested_current, current_diff;
-+ int err;
-+ unsigned int permille;
-+
-+ //TODO temp
-+
-+restart:
-+ switch (c->state) {
-+ case LIPO_IDLE:
-+ dev_err(c->dev, "%s: called while idle", __func__);
-+ return -EINVAL;
-+ case LIPO_FIRST_STAGE: /* Constant current */
-+//printk("GOT %u %d %u\n", voltage_mV, current_mA, temp_K);
-+ if (voltage_mV >= c->top_voltage) {
-+ /* Float voltage reached.
-+ * Switch charger mode to "constant current" */
-+ c->state = LIPO_SECOND_STAGE;
-+ dev_dbg(c->dev, "Switched to second charging stage.");
-+ goto restart;
-+ }
-+ /* Float voltage not reached, yet.
-+ * Try to get the requested constant current. */
-+ requested_current = get_stage1_charge_current(c);
-+ if (current_mA < 0)
-+ current_mA = 0;
-+ current_diff = requested_current - current_mA;
-+ if (abs(requested_current - current_mA) > CURRENT_HYST) {
-+ if (current_diff > 0) {
-+ /* Increase current */
-+ permille = current_diff * 1000 / requested_current;
-+ permille /= 2;
-+ err = lipocharge_increase_current(c, permille);
-+ if (err)
-+ return err;
-+ } else {
-+ /* Decrease current */
-+ permille = (-current_diff) * 1000 / requested_current;
-+ permille /= 2;
-+ err = lipocharge_decrease_current(c, permille);
-+ if (err)
-+ return err;
-+ }
-+ }
-+ break;
-+ case LIPO_SECOND_STAGE: /* Constant voltage */
-+ //TODO
-+ break;
-+ }
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/drivers/cbus/lipocharge.h
-@@ -0,0 +1,60 @@
-+#ifndef LIPOCHARGE_H_
-+#define LIPOCHARGE_H_
-+
-+#include <linux/types.h>
-+#include <linux/device.h>
-+
-+
-+#define LIPORATE(a,b) (((a) * 1000) + ((b) * 100))
-+#define LIPORATE_p6C LIPORATE(0,6) /* 0.6C */
-+
-+enum lipocharge_state {
-+ LIPO_IDLE = 0, /* Not charging */
-+ LIPO_FIRST_STAGE, /* Charging: constant current */
-+ LIPO_SECOND_STAGE, /* Charging: constant voltage */
-+};
-+
-+/** struct lipocharge - A generic LIPO charger
-+ *
-+ * @capacity: Battery capacity in mAh.
-+ * @rate: Charge rate.
-+ * @top_voltage: Fully charged voltage, in mV.
-+ * @duty_cycle_max: Max value for duty_cycle.
-+ *
-+ * @set_charge_current: Set the charge current PWM duty cycle.
-+ * @emergency: Something went wrong. Force shutdown.
-+ */
-+struct lipocharge {
-+ unsigned int capacity;
-+ unsigned int rate;
-+ unsigned int top_voltage;
-+ unsigned int duty_cycle_max;
-+
-+ int (*set_current_pwm)(struct lipocharge *c, unsigned int duty_cycle);
-+ void (*emergency)(struct lipocharge *c);
-+
-+ /* internal */
-+ struct device *dev;
-+ enum lipocharge_state state;
-+ unsigned int active_duty_cycle;
-+
-+ //TODO implement timer to cut power after maximum charge time.
-+};
-+
-+void lipocharge_init(struct lipocharge *c, struct device *dev);
-+void lipocharge_exit(struct lipocharge *c);
-+
-+int lipocharge_start(struct lipocharge *c);
-+void lipocharge_stop(struct lipocharge *c);
-+
-+int lipocharge_update_state(struct lipocharge *c,
-+ unsigned int voltage_mV,
-+ int current_mA,
-+ unsigned int temp_K);
-+
-+static inline bool lipocharge_is_charging(struct lipocharge *c)
-+{
-+ return (c->state != LIPO_IDLE);
-+}
-+
-+#endif /* LIPOCHARGE_H_ */
---- a/drivers/cbus/cbus.c
-+++ b/drivers/cbus/cbus.c
-@@ -36,6 +36,7 @@
- #include <linux/gpio.h>
- #include <linux/platform_device.h>
- #include <linux/platform_data/cbus.h>
-+#include <linux/reboot.h>
-
- #include "cbus.h"
-
-@@ -326,6 +327,13 @@ static void __exit cbus_bus_exit(void)
- }
- module_exit(cbus_bus_exit);
-
-+void cbus_emergency(void)
-+{
-+ machine_power_off();
-+ panic("cbus: Failed to halt machine in emergency state\n");
-+}
-+EXPORT_SYMBOL(cbus_emergency);
-+
- MODULE_DESCRIPTION("CBUS serial protocol");
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Juha Yrjölä");
---- a/drivers/cbus/cbus.h
-+++ b/drivers/cbus/cbus.h
-@@ -27,4 +27,6 @@ extern int cbus_read_reg(struct device *
- extern int cbus_write_reg(struct device *, unsigned dev, unsigned reg,
- unsigned val);
-
-+void cbus_emergency(void) __noreturn;
-+
- #endif /* __DRIVERS_CBUS_CBUS_H */
---- a/drivers/cbus/retu.c
-+++ b/drivers/cbus/retu.c
-@@ -399,6 +399,11 @@ static int retu_allocate_children(struct
- if (!child)
- return -ENOMEM;
-
-+ child = retu_allocate_child("retu-n810bm", parent, irq_base,
-+ RETU_INT_ADCS, -1, 1);
-+ if (!child)
-+ return -ENOMEM;
-+
- return 0;
- }
-
---- a/drivers/cbus/tahvo.c
-+++ b/drivers/cbus/tahvo.c
-@@ -129,6 +129,7 @@ void tahvo_set_clear_reg_bits(struct dev
- __tahvo_write_reg(tahvo, reg, w);
- mutex_unlock(&tahvo->mutex);
- }
-+EXPORT_SYMBOL(tahvo_set_clear_reg_bits);
-
- static irqreturn_t tahvo_irq_handler(int irq, void *_tahvo)
- {
-@@ -292,6 +293,11 @@ static int tahvo_allocate_children(struc
- if (!child)
- return -ENOMEM;
-
-+ child = tahvo_allocate_child("tahvo-n810bm", parent,
-+ irq_base + TAHVO_INT_BATCURR);
-+ if (!child)
-+ return -ENOMEM;
-+
- return 0;
- }
-
diff --git a/target/linux/omap24xx/patches-3.3/910-omap-fix-section-mismatch-warnings.patch b/target/linux/omap24xx/patches-3.3/910-omap-fix-section-mismatch-warnings.patch
deleted file mode 100644
index a7772be4d2..0000000000
--- a/target/linux/omap24xx/patches-3.3/910-omap-fix-section-mismatch-warnings.patch
+++ /dev/null
@@ -1,116 +0,0 @@
---- a/arch/arm/plat-omap/omap_device.c
-+++ b/arch/arm/plat-omap/omap_device.c
-@@ -619,7 +619,7 @@ static void omap_device_delete(struct om
- * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
- * passes along the return value of omap_device_build_ss().
- */
--struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
-+struct platform_device *__init omap_device_build(const char *pdev_name, int pdev_id,
- struct omap_hwmod *oh, void *pdata,
- int pdata_len,
- struct omap_device_pm_latency *pm_lats,
-@@ -652,7 +652,7 @@ struct platform_device *omap_device_buil
- * platform_device record. Returns an ERR_PTR() on error, or passes
- * along the return value of omap_device_register().
- */
--struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
-+struct platform_device *__init omap_device_build_ss(const char *pdev_name, int pdev_id,
- struct omap_hwmod **ohs, int oh_cnt,
- void *pdata, int pdata_len,
- struct omap_device_pm_latency *pm_lats,
-@@ -717,7 +717,7 @@ odbs_exit:
- * platform_early_add_device() on the underlying platform_device.
- * Returns 0 by default.
- */
--static int omap_early_device_register(struct platform_device *pdev)
-+static int __init omap_early_device_register(struct platform_device *pdev)
- {
- struct platform_device *devices[1];
-
---- a/arch/arm/plat-omap/common.c
-+++ b/arch/arm/plat-omap/common.c
-@@ -29,7 +29,7 @@
-
- #define NO_LENGTH_CHECK 0xffffffff
-
--struct omap_board_config_kernel *omap_board_config __initdata;
-+struct omap_board_config_kernel *omap_board_config;
- int omap_board_config_size;
-
- unsigned char omap_bootloader_tag[1024];
-@@ -58,7 +58,7 @@ __tagtable(ATAG_BOARD, parse_tag_omap);
-
- #endif
-
--static const void *__init get_config(u16 tag, size_t len,
-+static const void *get_config(u16 tag, size_t len,
- int skip, size_t *len_out)
- {
- struct omap_board_config_kernel *kinfo = NULL;
-@@ -125,12 +125,12 @@ static const void *__init get_config(u16
- return kinfo->data;
- }
-
--const void *__init __omap_get_config(u16 tag, size_t len, int nr)
-+const void *__omap_get_config(u16 tag, size_t len, int nr)
- {
- return get_config(tag, len, nr, NULL);
- }
-
--const void *__init omap_get_var_config(u16 tag, size_t *len)
-+const void *omap_get_var_config(u16 tag, size_t *len)
- {
- return get_config(tag, NO_LENGTH_CHECK, 0, len);
- }
---- a/arch/arm/mach-omap2/devices.c
-+++ b/arch/arm/mach-omap2/devices.c
-@@ -380,7 +380,7 @@ static inline void omap_init_dmic(void)
-
- #include <plat/mcspi.h>
-
--static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
-+static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
- {
- struct platform_device *pdev;
- char *name = "omap2_mcspi";
---- a/arch/arm/mach-omap2/gpio.c
-+++ b/arch/arm/mach-omap2/gpio.c
-@@ -24,7 +24,7 @@
- #include <plat/omap_hwmod.h>
- #include <plat/omap_device.h>
-
--static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
-+static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
- {
- struct platform_device *pdev;
- struct omap_gpio_platform_data *pdata;
---- a/arch/arm/mach-omap2/mcbsp.c
-+++ b/arch/arm/mach-omap2/mcbsp.c
-@@ -122,7 +122,7 @@ static int omap3_enable_st_clock(unsigne
- return 0;
- }
-
--static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
-+static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
- {
- int id, count = 1;
- char *name = "omap-mcbsp";
---- a/arch/arm/plat-omap/include/plat/board.h
-+++ b/arch/arm/plat-omap/include/plat/board.h
-@@ -159,14 +159,14 @@ struct omap_gpio_switch_config {
- int key_code:24; /* Linux key code */
- };
-
--extern const void *__init __omap_get_config(u16 tag, size_t len, int nr);
-+extern const void * __omap_get_config(u16 tag, size_t len, int nr);
-
- #define omap_get_config(tag, type) \
- ((const type *) __omap_get_config((tag), sizeof(type), 0))
- #define omap_get_nr_config(tag, type, nr) \
- ((const type *) __omap_get_config((tag), sizeof(type), (nr)))
-
--extern const void *__init omap_get_var_config(u16 tag, size_t *len);
-+extern const void * omap_get_var_config(u16 tag, size_t *len);
-
- extern struct omap_board_config_kernel *omap_board_config;
- extern int omap_board_config_size;
diff --git a/target/linux/omap24xx/profiles/100-n810.mk b/target/linux/omap24xx/profiles/100-n810.mk
deleted file mode 100644
index 36f30866d0..0000000000
--- a/target/linux/omap24xx/profiles/100-n810.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (C) 2010-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/n810-base
- NAME:=Nokia n810 (base)
- PACKAGES:= \
- block-mount \
- gpsd \
- ip iw kmod-p54-spi wpa-supplicant \
- dnsmasq dropbear \
- pwrtray-backend \
- kmod-fs-vfat kmod-fs-msdos \
- kmod-input-evdev \
- kmod-leds-gpio \
- kmod-usb-tahvo kmod-usb-eth-gadget \
- kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-pegasus kmod-usb-net-rndis \
- kmod-usb-storage kmod-usb-hid \
- kmod-bluetooth kmod-bluetooth-hci-h4p bluez-utils bluez-hcidump \
- kmod-n810bm maemo-kexec calvaria \
- schedtool
-endef
-
-define Profile/n810-base/Description
- Minimal package set for Nokia n810 hardware.
-endef
-$(eval $(call Profile,n810-base))
-
diff --git a/target/linux/omap24xx/profiles/110-n810-gui.mk b/target/linux/omap24xx/profiles/110-n810-gui.mk
deleted file mode 100644
index 9c3c5d025a..0000000000
--- a/target/linux/omap24xx/profiles/110-n810-gui.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/n810-gui
- $(call Profile/n810-base)
- NAME:=Nokia n810 (GUI)
- PACKAGES+= \
- xserver-xorg xinit xauth xkeyboard-config xkbdata xterm \
- xf86-video-omapfb xf86-input-tslib xf86-input-evdev \
- openbox tint2 matchbox-keyboard \
- pwrtray
-endef
-
-define Profile/n810-gui/Description
- Graphical user interface package set for Nokia n810 hardware.
-endef
-$(eval $(call Profile,n810-gui))
-
diff --git a/target/linux/orion/Makefile b/target/linux/orion/Makefile
deleted file mode 100644
index 58e74b8e4a..0000000000
--- a/target/linux/orion/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2008-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=orion
-BOARDNAME:=Marvell Orion
-FEATURES:=broken
-SUBTARGETS:=generic harddisk
-MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=zImage
-
-DEFAULT_PACKAGES += kmod-ath9k kmod-crypto-mv-cesa wpad-mini kmod-i2c-core kmod-i2c-mv64xxx kmod-rtc-isl1208
-
-$(eval $(call BuildTarget))
diff --git a/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb b/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb
deleted file mode 100644
index 5572daede1..0000000000
--- a/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2009-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-usb_led=''
-usb_device=''
-
-led_set_attr() {
- [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
-}
-
-usb_led_set_timer() {
- led_set_attr "${usb_led}" 'trigger' 'timer'
- led_set_attr "${usb_led}" 'delay_on' "$1"
- led_set_attr "${usb_led}" 'delay_off' "$2"
-}
-
-usb_led_on() {
- led_set_attr "${usb_led}" 'trigger' 'none'
- led_set_attr "${usb_led}" 'brightness' 255
-}
-
-usb_led_off() {
- led_set_attr "${usb_led}" 'trigger' 'none'
- led_set_attr "${usb_led}" 'brightness' 0
-}
-
-get_usb_led() {
- local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
-
- case "${hardware}" in
- 'Linksys WRT350N v2')
- usb_led='wrt350nv2:green:usb'
- usb_device='1-1:1.0'
- ;;
- esac;
-}
-
-get_usb_led
-
-case "${ACTION}" in
- add)
- # update LEDs
- [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_on
- ;;
- remove)
- # update LEDs
- [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_off
- ;;
-esac
diff --git a/target/linux/orion/base-files/etc/uci-defaults/10-network b/target/linux/orion/base-files/etc/uci-defaults/10-network
deleted file mode 100644
index 5d5a5851f9..0000000000
--- a/target/linux/orion/base-files/etc/uci-defaults/10-network
+++ /dev/null
@@ -1,53 +0,0 @@
-config_simple() {
-cat >> /etc/config/network <<EOF
-config interface lan
- option ifname eth0
- option type bridge
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
- option ip6assign 60
-EOF
-}
-
-config_dsa() {
-cat >> /etc/config/network <<EOF
-config interface eth0
- option ifname eth0
-
-config interface wan
- option ifname wan
- option proto dhcp
- option hostname openwrt
-
-config interface lan
- option ifname "lan1 lan2 lan3 lan4"
- option type bridge
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
- option ip6assign 60
-
-config interface wan6
- option ifname wan
- option proto dhcpv6
-
-config globals globals
- option ula_prefix auto
-EOF
-}
-
-cat > /etc/config/network <<EOF
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-EOF
-
-if grep -q lan /proc/net/dev; then
- config_dsa
-else
- config_simple
-fi
diff --git a/target/linux/orion/config-default b/target/linux/orion/config-default
deleted file mode 100644
index 196310f6f7..0000000000
--- a/target/linux/orion/config-default
+++ /dev/null
@@ -1,188 +0,0 @@
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_ORION5X=y
-# CONFIG_ARCH_ORION5X_DT is not set
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARM=y
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_L1_CACHE_SHIFT=5
-CONFIG_ARM_NR_BANKS=8
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-# CONFIG_ARM_THUMB is not set
-# CONFIG_ARPD is not set
-CONFIG_ATAGS=y
-CONFIG_AUTO_ZRELADDR=y
-# CONFIG_CACHE_L2X0 is not set
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
-CONFIG_CMDLINE_FORCE=y
-CONFIG_COMMON_CLK=y
-CONFIG_CPU_32v5=y
-CONFIG_CPU_ABRT_EV5T=y
-CONFIG_CPU_CACHE_VIVT=y
-CONFIG_CPU_COPY_FEROCEON=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_FEROCEON=y
-CONFIG_CPU_FEROCEON_OLD_ID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_PABRT_LEGACY=y
-CONFIG_CPU_TLB_FEROCEON=y
-CONFIG_CPU_USE_DOMAINS=y
-CONFIG_CRYPTO_BLKCIPHER2=y
-CONFIG_CRYPTO_DEV_MV_CESA=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_HW=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set
-CONFIG_DEBUG_UART_8250_SHIFT=2
-# CONFIG_DEBUG_UART_8250_WORD is not set
-CONFIG_DEBUG_UART_PHYS=0xf1012000
-CONFIG_DEBUG_UART_VIRT=0xfe012000
-# CONFIG_DEBUG_USER is not set
-CONFIG_DNOTIFY=y
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_GENERIC_HARDIRQS=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_WORK=y
-CONFIG_KTIME_SCALAR=y
-CONFIG_LEDS_GPIO=y
-# CONFIG_MACH_BIGDISK is not set
-# CONFIG_MACH_D2NET is not set
-# CONFIG_MACH_D2NET_DT is not set
-# CONFIG_MACH_DB88F5281 is not set
-# CONFIG_MACH_DNS323 is not set
-# CONFIG_MACH_DT2 is not set
-# CONFIG_MACH_EDMINI_V2_DT is not set
-# CONFIG_MACH_KUROBOX_PRO is not set
-# CONFIG_MACH_LINKSTATION_LSCHL is not set
-# CONFIG_MACH_LINKSTATION_LS_HGL is not set
-# CONFIG_MACH_LINKSTATION_MINI is not set
-# CONFIG_MACH_LINKSTATION_PRO is not set
-# CONFIG_MACH_MSS2 is not set
-# CONFIG_MACH_MSS2_DT is not set
-# CONFIG_MACH_MV2120 is not set
-# CONFIG_MACH_NET2BIG is not set
-# CONFIG_MACH_RD88F5181L_FXO is not set
-# CONFIG_MACH_RD88F5181L_GE is not set
-# CONFIG_MACH_RD88F5182 is not set
-# CONFIG_MACH_RD88F5182_DT is not set
-# CONFIG_MACH_RD88F6183AP_GE is not set
-# CONFIG_MACH_TERASTATION_PRO2 is not set
-# CONFIG_MACH_TS209 is not set
-# CONFIG_MACH_TS409 is not set
-# CONFIG_MACH_TS78XX is not set
-CONFIG_MACH_WN802T=y
-CONFIG_MACH_WNR854T=y
-CONFIG_MACH_WRT350N_V2=y
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MV643XX_ETH=y
-CONFIG_MVEBU_MBUS=y
-CONFIG_MVMDIO=y
-# CONFIG_MVNETA is not set
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_KUSER_HELPERS=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NET_DSA=y
-CONFIG_NET_DSA_MV88E6131=y
-CONFIG_NET_DSA_MV88E6XXX=y
-CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
-CONFIG_NET_DSA_TAG_DSA=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xC0000000
-CONFIG_PCI=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PHYLIB=y
-CONFIG_PLAT_ORION=y
-CONFIG_PLAT_ORION_LEGACY=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-CONFIG_SPLIT_PTLOCK_CPUS=999999
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_UID16=y
-CONFIG_UIDGID_CONVERTED=y
-CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h"
-CONFIG_USB_ARCH_HAS_XHCI=y
-CONFIG_USB_SUPPORT=y
-CONFIG_VECTORS_BASE=0xffff0000
-# CONFIG_VFP is not set
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h
deleted file mode 100644
index a54e1883d3..0000000000
--- a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef __INC_DT2_COMMON_H
-#define __INC_DT2_COMMON_H
-
-#define ATAG_MV_UBOOT 0x41000403
-
-struct tag_mv_uboot {
- u32 uboot_version;
- u32 tclk;
- u32 sysclk;
- u32 isUsbHost;
- u32 overEthAddr;
- u8 dt2_eeprom[256];
-};
-
-#define DT2_EEPROM_ADDR 0x50
-#define DT2_EEPROM_OFFSET 0
-#define DT2_EEPROM_LENGTH 256
-
-#define DT2_SERIAL_NUMBER_DEFAULT "run on default\0"
-#define DT2_REVISION_DEFAULT_INIT 0xFF
-#define DT2_CONFIG_FLAGS_DEFAULT 0x00
-
-#define _PACKED_ __attribute__((packed))
-
-struct DT2_EEPROM_SD_CONFIG {
- unsigned int ram_1;
- unsigned int ram_2;
- unsigned int ram_3;
- unsigned int ram_4;
- unsigned char ram_5;
- unsigned char ram_6;
- unsigned short ram_7;
- unsigned int magic_id;
- } _PACKED_; // 24 Bytes in total
-
-struct DT2_EEPROM_FC_CONFIG {
- unsigned char rtc_sts_mask;
- unsigned char rtc_sts_init;
- unsigned char rtc_int_mask;
- unsigned char rtc_int_init;
- unsigned char rtc_atrim_init;
- unsigned char rtc_dtrim_init;
- unsigned char dummy1;
- unsigned char dummy2;
- unsigned char dt2_config_flags; /* 0x80 to load rtc_values to RTC */
- unsigned char dt2_revision; /* upper nibble is HW, lower nibble is FW */
- unsigned char dt2_serial_number[16]; /* Serial number of DT-2 */
- } _PACKED_; // 26 Bytes in total
-
-#define CFG_LOAD_RTC_VALUES 0x80
-
-struct DT2_EEPROM_GW_CONFIG {
- unsigned int dummy1;
- unsigned int dummy2;
- unsigned int dummy3;
- unsigned char dummy4;
- unsigned char tos_video_val1;
- unsigned char tos_video_val2;
- unsigned char tos_voip_val;
- unsigned char qos_igmp_cfg;
- unsigned char num_of_ifs;
- unsigned short vlan_ports_if[3];
- unsigned char mac_addr[3][6];
- } _PACKED_; // 42 Bytes in total
-
-#define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG))
-
-// MV = EEPROM - SD - FC - GW - CRC
-struct DT2_EEPROM_MV_CONFIG {
- unsigned int reg_addr[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
- unsigned int reg_data[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
- } _PACKED_;
-
-struct DT2_EEPROM_STRUCT {
- struct DT2_EEPROM_MV_CONFIG mv;
- struct DT2_EEPROM_SD_CONFIG sd;
- struct DT2_EEPROM_FC_CONFIG fc;
- struct DT2_EEPROM_GW_CONFIG gw;
- unsigned int crc;
- } _PACKED_;
-
-#endif
diff --git a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c
deleted file mode 100644
index b341ed66e9..0000000000
--- a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * arch/arm/mach-orion5x/dt2-setup.c
- *
- * Freecom DataTank Gateway Setup
- *
- * Copyright (C) 2009 Zintis Petersons <Zintis.Petersons@abcsolutions.lv>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/pci.h>
-#include <linux/irq.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mv643xx_eth.h>
-#include <linux/ethtool.h>
-#include <linux/if_ether.h>
-#include <net/dsa.h>
-#include <linux/ata_platform.h>
-#include <linux/i2c.h>
-#include <linux/reboot.h>
-#include <linux/interrupt.h>
-#include <asm/mach-types.h>
-#include <asm/gpio.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/pci.h>
-#include <mach/orion5x.h>
-#include "common.h"
-#include "mpp.h"
-
-/*****************************************************************************
- * DT2 local
- ****************************************************************************/
-#include <asm/setup.h>
-#include "dt2-common.h"
-
-u32 mvUbootVer = 0;
-u32 mvTclk = 166666667;
-u32 mvSysclk = 200000000;
-u32 mvIsUsbHost = 1;
-u32 overEthAddr = 0;
-u32 gBoardId = -1;
-struct DT2_EEPROM_STRUCT dt2_eeprom;
-
-/*****************************************************************************
- * DT2 Info
- ****************************************************************************/
-/*
- * PCI
- */
-
-#define DT2_PCI_SLOT0_OFFS 7
-#define DT2_PCI_SLOT0_IRQ_A_PIN 3
-#define DT2_PCI_SLOT0_IRQ_B_PIN 2
-
-#define DT2_PIN_GPIO_SYNC 25
-#define DT2_PIN_GPIO_POWER 24
-#define DT2_PIN_GPIO_UNPLUG1 23
-#define DT2_PIN_GPIO_UNPLUG2 22
-#define DT2_PIN_GPIO_RESET 4
-
-#define DT2_NOR_BOOT_BASE 0xf4000000
-#define DT2_NOR_BOOT_SIZE SZ_512K
-
-#define DT2_LEDS_BASE 0xfa000000
-#define DT2_LEDS_SIZE SZ_1K
-
-/*****************************************************************************
- * 512K NOR Flash on Device bus Boot CS
- ****************************************************************************/
-
-static struct mtd_partition dt2_partitions[] = {
- {
- .name = "u-boot",
- .size = 0x00080000,
- .offset = 0,
- },
-};
-
-static struct physmap_flash_data dt2_nor_flash_data = {
- .width = 1, /* 8 bit bus width */
- .parts = dt2_partitions,
- .nr_parts = ARRAY_SIZE(dt2_partitions)
-};
-
-static struct resource dt2_nor_flash_resource = {
- .flags = IORESOURCE_MEM,
- .start = DT2_NOR_BOOT_BASE,
- .end = DT2_NOR_BOOT_BASE + DT2_NOR_BOOT_SIZE - 1,
-};
-
-static struct platform_device dt2_nor_flash = {
- .name = "physmap-flash",
- .id = 0,
- .dev = {
- .platform_data = &dt2_nor_flash_data,
- },
- .resource = &dt2_nor_flash_resource,
- .num_resources = 1,
-};
-
-/*****************************************************************************
- * PCI
- ****************************************************************************/
-
-void __init dt2_pci_preinit(void)
-{
- int pin, irq;
-
- /*
- * Configure PCI GPIO IRQ pins
- */
- pin = DT2_PCI_SLOT0_IRQ_A_PIN;
- if (gpio_request(pin, "PCI IntA") == 0) {
- if (gpio_direction_input(pin) == 0) {
- irq = gpio_to_irq(pin);
- irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
- printk (KERN_INFO "PCI IntA IRQ: %d\n", irq);
- } else {
- printk(KERN_ERR "dt2_pci_preinit failed to "
- "irq_set_irq_type pin %d\n", pin);
- gpio_free(pin);
- }
- } else {
- printk(KERN_ERR "dt2_pci_preinit failed to request gpio %d\n", pin);
- }
-
- pin = DT2_PCI_SLOT0_IRQ_B_PIN;
- if (gpio_request(pin, "PCI IntB") == 0) {
- if (gpio_direction_input(pin) == 0) {
- irq = gpio_to_irq(pin);
- irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
- printk (KERN_INFO "PCI IntB IRQ: %d\n", irq);
- } else {
- printk(KERN_ERR "dt2_pci_preinit failed to "
- "irq_set_irq_type pin %d\n", pin);
- gpio_free(pin);
- }
- } else {
- printk(KERN_ERR "dt2_pci_preinit failed to gpio_request %d\n", pin);
- }
-}
-
-static int __init dt2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
- int irq;
-
- /*
- * Check for devices with hard-wired IRQs.
- */
- irq = orion5x_pci_map_irq(dev, slot, pin);
- if (irq != -1){
- printk(KERN_INFO "orion5x_pci_map_irq: %d\n", irq);
- return irq;
- }
-
- /*
- * PCI IRQs are connected via GPIOs
- */
- switch (slot - DT2_PCI_SLOT0_OFFS) {
- case 0:
- if (pin == 1){
- irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_A_PIN);
- printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_A_PIN: %d\n", irq);
- }
- else {
- irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_B_PIN);
- printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_B_PIN: %d\n", irq);
- }
- default:
- irq = -1;
- printk(KERN_INFO "dt2_pci_map_irq IRQ: %d\n", irq);
- }
-
- return irq;
-}
-
-static struct hw_pci dt2_pci __initdata = {
- .nr_controllers = 2,
- .preinit = dt2_pci_preinit,
- .setup = orion5x_pci_sys_setup,
- .scan = orion5x_pci_sys_scan_bus,
- .map_irq = dt2_pci_map_irq,
-};
-
-static int __init dt2_pci_init(void)
-{
- if (machine_is_dt2())
- pci_common_init(&dt2_pci);
-
- return 0;
-}
-
-subsys_initcall(dt2_pci_init);
-
-/*****************************************************************************
- * Ethernet
- ****************************************************************************/
-
-static struct mv643xx_eth_platform_data dt2_eth_data = {
- .phy_addr = MV643XX_ETH_PHY_NONE,
- .speed = SPEED_1000,
- .duplex = DUPLEX_FULL,
-};
-
-static struct dsa_chip_data dt2_switch_chip_data = {
- .port_names[0] = "wan",
- .port_names[1] = "lan1",
- .port_names[2] = "lan2",
- .port_names[3] = "cpu",
- .port_names[4] = "lan3",
- .port_names[5] = "lan4",
-};
-
-static struct dsa_platform_data dt2_switch_plat_data = {
- .nr_chips = 1,
- .chip = &dt2_switch_chip_data,
-};
-
-/*****************************************************************************
- * RTC ISL1208 on I2C bus
- ****************************************************************************/
-static struct i2c_board_info __initdata dt2_i2c_rtc = {
- I2C_BOARD_INFO("isl1208", 0x6F),
-};
-
-/*****************************************************************************
- * Sata
- ****************************************************************************/
-static struct mv_sata_platform_data dt2_sata_data = {
- .n_ports = 2,
-};
-
-/*****************************************************************************
- * General Setup
- ****************************************************************************/
-static unsigned int dt2_mpp_modes[] __initdata = {
- MPP0_GPIO, // RTC interrupt
- MPP1_GPIO, // 88e6131 interrupt
- MPP2_GPIO, // PCI_intB
- MPP3_GPIO, // PCI_intA
- MPP4_GPIO, // reset button switch
- MPP5_GPIO,
- MPP6_GPIO,
- MPP7_GPIO,
- MPP8_GPIO,
- MPP9_GIGE, /* GE_RXERR */
- MPP10_GPIO, // usb
- MPP11_GPIO, // usb
- MPP12_GIGE, // GE_TXD[4]
- MPP13_GIGE, // GE_TXD[5]
- MPP14_GIGE, // GE_TXD[6]
- MPP15_GIGE, // GE_TXD[7]
- MPP16_GIGE, // GE_RXD[4]
- MPP17_GIGE, // GE_RXD[5]
- MPP18_GIGE, // GE_RXD[6]
- MPP19_GIGE, // GE_RXD[7]
- 0,
-};
-
-/*****************************************************************************
- * LEDS
- ****************************************************************************/
-static struct platform_device dt2_leds = {
- .name = "dt2-led",
- .id = -1,
-};
-
-/****************************************************************************
- * GPIO key
- ****************************************************************************/
-static irqreturn_t dt2_reset_handler(int irq, void *dev_id)
-{
- /* This is the paper-clip reset which does an emergency reboot. */
- printk(KERN_INFO "Restarting system.\n");
- machine_restart(NULL);
-
- /* This should never be reached. */
- return IRQ_HANDLED;
-}
-
-static irqreturn_t dt2_power_handler(int irq, void *dev_id)
-{
- printk(KERN_INFO "Shutting down system.\n");
- machine_power_off();
- return IRQ_HANDLED;
-}
-
-static void __init dt2_init(void)
-{
- /*
- * Setup basic Orion functions. Need to be called early.
- */
- orion5x_init();
-
- orion5x_mpp_conf(dt2_mpp_modes);
-
- /*
- * Configure peripherals.
- */
-
- orion5x_uart0_init();
- orion5x_ehci0_init();
- orion5x_ehci1_init();
- orion5x_i2c_init();
- orion5x_sata_init(&dt2_sata_data);
- orion5x_xor_init();
-
- printk(KERN_INFO "U-Boot parameters:\n");
- printk(KERN_INFO "Sys Clk = %d, Tclk = %d, BoardID = 0x%02x\n", mvSysclk, mvTclk, gBoardId);
-
- printk(KERN_INFO "Serial: %s\n", dt2_eeprom.fc.dt2_serial_number);
- printk(KERN_INFO "Revision: %016x\n", dt2_eeprom.fc.dt2_revision);
- printk(KERN_INFO "DT2: Using MAC address %pM for port 0\n",
- dt2_eeprom.gw.mac_addr[0]);
- printk(KERN_INFO "DT2: Using MAC address %pM for port 1\n",
- dt2_eeprom.gw.mac_addr[1]);
-
- orion5x_eth_init(&dt2_eth_data);
- memcpy(dt2_eth_data.mac_addr, dt2_eeprom.gw.mac_addr[0], 6);
- orion5x_eth_switch_init(&dt2_switch_plat_data, NO_IRQ);
-
- i2c_register_board_info(0, &dt2_i2c_rtc, 1);
-
- mvebu_mbus_add_window("devbus-boot", DT2_NOR_BOOT_BASE,
- DT2_NOR_BOOT_SIZE);
-
- platform_device_register(&dt2_nor_flash);
-
- mvebu_mbus_add_window("devbus-cs0", DT2_LEDS_BASE, DT2_LEDS_SIZE);
- platform_device_register(&dt2_leds);
-
- if (request_irq(gpio_to_irq(DT2_PIN_GPIO_RESET), &dt2_reset_handler,
- IRQF_DISABLED | IRQF_TRIGGER_LOW,
- "DT2: Reset button", NULL) < 0) {
-
- printk("DT2: Reset Button IRQ %d not available\n",
- gpio_to_irq(DT2_PIN_GPIO_RESET));
- }
-
- if (request_irq(gpio_to_irq(DT2_PIN_GPIO_POWER), &dt2_power_handler,
- IRQF_DISABLED | IRQF_TRIGGER_LOW,
- "DT2: Power button", NULL) < 0) {
-
- printk(KERN_DEBUG "DT2: Power Button IRQ %d not available\n",
- gpio_to_irq(DT2_PIN_GPIO_POWER));
- }
-}
-
-static int __init parse_tag_dt2_uboot(const struct tag *t)
-{
- struct tag_mv_uboot *mv_uboot;
-
- // Get pointer to our block
- mv_uboot = (struct tag_mv_uboot*)&t->u;
- mvTclk = mv_uboot->tclk;
- mvSysclk = mv_uboot->sysclk;
- mvUbootVer = mv_uboot->uboot_version;
- mvIsUsbHost = mv_uboot->isUsbHost;
-
- // Some clock fixups
- if(mvTclk == 166000000) mvTclk = 166666667;
- else if(mvTclk == 133000000) mvTclk = 133333333;
- else if(mvSysclk == 166000000) mvSysclk = 166666667;
-
- gBoardId = (mvUbootVer & 0xff);
-
- //DT2 specific data
- memcpy(&dt2_eeprom, mv_uboot->dt2_eeprom, sizeof(struct DT2_EEPROM_STRUCT));
-
- return 0;
-}
-__tagtable(ATAG_MV_UBOOT, parse_tag_dt2_uboot);
-
-/*
- * This is OpenWrt specific fixup. It includes code from original "tag_fixup_mem32" to
- * fixup bogus memory tags and also fixes kernel cmdline by adding " init=/etc/preinit"
- * at the end. It is important to flash OpenWrt image from original Freecom firmware.
- *
- * Vanilla kernel should use "tag_fixup_mem32" function.
- */
-void __init openwrt_fixup(struct tag *t, char **from, struct meminfo *meminfo)
-{
- char *p = NULL;
- static char openwrt_init_tag[] __initdata = " init=/etc/preinit";
-
- for (; t->hdr.size; t = tag_next(t)){
- /* Locate the Freecom cmdline */
- if (t->hdr.tag == ATAG_CMDLINE) {
- p = t->u.cmdline.cmdline;
- printk("%s(%d): Found cmdline '%s' at 0x%0lx\n",
- __FUNCTION__, __LINE__, p, (unsigned long)p);
- }
- /*
- * Many orion-based systems have buggy bootloader implementations.
- * This is a common fixup for bogus memory tags.
- */
- if (t->hdr.tag == ATAG_MEM &&
- (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
- t->u.mem.start & ~PAGE_MASK)) {
- printk(KERN_WARNING
- "Clearing invalid memory bank %dKB@0x%08x\n",
- t->u.mem.size / 1024, t->u.mem.start);
- t->hdr.tag = 0;
- }
- }
-
- printk("%s(%d): End of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
-
- /* Overwrite the end of the table with a new cmdline tag. */
- t->hdr.tag = ATAG_CMDLINE;
- t->hdr.size =
- (sizeof (struct tag_header) +
- strlen(p) + strlen(openwrt_init_tag) + 1 + 4) >> 2;
-
- strlcpy(t->u.cmdline.cmdline, p, COMMAND_LINE_SIZE);
- strlcpy(t->u.cmdline.cmdline + strlen(p), openwrt_init_tag,
- COMMAND_LINE_SIZE - strlen(p));
-
- printk("%s(%d): New cmdline '%s' at 0x%0lx\n",
- __FUNCTION__, __LINE__,
- t->u.cmdline.cmdline, (unsigned long)t->u.cmdline.cmdline);
-
- t = tag_next(t);
-
- printk("%s(%d): New end of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
-
- t->hdr.tag = ATAG_NONE;
- t->hdr.size = 0;
-}
-
-/* Warning: Freecom uses their own custom bootloader with mach-type (=1500) */
-MACHINE_START(DT2, "Freecom DataTank Gateway")
- /* Maintainer: Zintis Petersons <Zintis.Petersons@abcsolutions.lv> */
- .atag_offset = 0x100,
- .init_machine = dt2_init,
- .map_io = orion5x_map_io,
- .init_irq = orion5x_init_irq,
- .init_time = orion5x_timer_init,
- .fixup = openwrt_fixup, //tag_fixup_mem32,
-MACHINE_END
diff --git a/target/linux/orion/generic/base-files/etc/uci-defaults/09_hardware b/target/linux/orion/generic/base-files/etc/uci-defaults/09_hardware
deleted file mode 100644
index 7f727eb595..0000000000
--- a/target/linux/orion/generic/base-files/etc/uci-defaults/09_hardware
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-#
-# This script sets system defaults for the hardware on firstboot
-#
-
-local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
-
-wrt350nv2_default() {
-# leds
- uci batch <<__EOF
-set system.power_led=led
-set system.power_led.name='Power LED (green)'
-set system.power_led.sysfs='wrt350nv2:green:power'
-set system.power_led.default='1'
-set system.wifi_led=led
-set system.wifi_led.name='Wireless LED (green)'
-set system.wifi_led.sysfs='wrt350nv2:green:wireless'
-set system.wifi_led.trigger='netdev'
-set system.wifi_led.dev='wlan0'
-set system.wifi_led.mode='link tx rx'
-set system.wifi_led.default='0'
-commit system
-__EOF
-
-# add mac address from U-Boot partition to lan and wan devices
- MTD=`grep -e 'u-boot' /proc/mtd`
- MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'`
- [ -n "${MTD}" ] && {
- MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'`
- MACADDR2=$(( 0x${MACADDR} + 1))
- MACADDR2=`printf "%012x" ${MACADDR2}`
-
- MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
- MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
-
- uci set network.eth0.macaddr=${MACADDR}
- uci set network.lan.macaddr=${MACADDR}
- uci set network.wan.macaddr=${MACADDR2}
- uci commit network
- }
-}
-
-case "${hardware}" in
- 'Linksys WRT350N v2')
- wrt350nv2_default
- ;;
-esac
diff --git a/target/linux/orion/generic/base-files/lib/upgrade/platform.sh b/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
deleted file mode 100644
index 9c9967e4af..0000000000
--- a/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2010-2011 OpenWrt.org
-#
-
-# use default "image" for PART_NAME
-# use default for platform_do_upgrade()
-
-platform_check_image() {
- [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
-
- local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
- local magic="$(get_magic_word "$1")"
- local magic_long="$(get_magic_long "$1")"
-
- case "${hardware}" in
- # hardware with a direct uImage partition
- # image header format as described in U-Boot's include/image.h
- # see http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/image.h
- 'Linksys WRT350N v2')
- [ "${magic_long}" != '27051956' ] && {
- echo "Invalid image type ${magic_long}."
- return 1
- }
- return 0
- ;;
- # Netgear WNR854T (has uImage as file inside a JFFS2 partition)
- 'Netgear WNR854T')
- [ "${magic}" != '8519' ] && {
- echo "Invalid image type ${magic}."
- return 1
- }
- return 0
- ;;
- esac
-
- echo "Sysupgrade is not yet supported on ${hardware}."
- return 1
-}
diff --git a/target/linux/orion/generic/target.mk b/target/linux/orion/generic/target.mk
deleted file mode 100644
index 451de4e90b..0000000000
--- a/target/linux/orion/generic/target.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (C) 2008-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-BOARDNAME:=Generic
-FEATURES:=squashfs
-
-define Target/Description
- Build firmware images for Marvell Orion based boards that boot from internal flash.
- (e.g.: Linksys WRT350N v2, Netgear WNR854T, ...)
-endef
diff --git a/target/linux/orion/harddisk/config-default b/target/linux/orion/harddisk/config-default
deleted file mode 100644
index bf6cee1715..0000000000
--- a/target/linux/orion/harddisk/config-default
+++ /dev/null
@@ -1,38 +0,0 @@
-CONFIG_ATA=y
-CONFIG_BLK_DEV_DM=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_CRC16=y
-# CONFIG_DM_CRYPT is not set
-# CONFIG_DM_MIRROR is not set
-# CONFIG_DM_SNAPSHOT is not set
-CONFIG_EXT4_FS=y
-CONFIG_FS_MBCACHE=y
-CONFIG_HWMON=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_JBD2=y
-CONFIG_MACH_DT2=y
-CONFIG_MACH_NET2BIG=y
-# CONFIG_MACH_WN802T is not set
-# CONFIG_MACH_WNR854T is not set
-# CONFIG_MACH_WRT350N_V2 is not set
-CONFIG_MD=y
-CONFIG_MD_AUTODETECT=y
-CONFIG_MD_LINEAR=y
-# CONFIG_MD_MULTIPATH is not set
-CONFIG_MD_RAID0=y
-CONFIG_MD_RAID1=y
-# CONFIG_MD_RAID10 is not set
-# CONFIG_MD_RAID456 is not set
-CONFIG_NLS=y
-CONFIG_RTC_CLASS=y
-CONFIG_SATA_MV=y
-CONFIG_SCSI=y
-CONFIG_SCSI_DMA=y
-CONFIG_USB=y
-CONFIG_USB_COMMON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_HCD_ORION=y
-CONFIG_USB_EHCI_HCD_PLATFORM=y
-CONFIG_USB_STORAGE=y
-# CONFIG_USB_UHCI_HCD is not set
diff --git a/target/linux/orion/harddisk/target.mk b/target/linux/orion/harddisk/target.mk
deleted file mode 100644
index a3a0e41c00..0000000000
--- a/target/linux/orion/harddisk/target.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (C) 2008-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-BOARDNAME:=Internal Hard-Disk
-FEATURES:=targz
-
-define Target/Description
- Build firmware images for Marvell Orion based boards that boot directly from internal disk storage.
- (e.g.: Freecom DataTank 2, ...)
-endef
diff --git a/target/linux/orion/image/Makefile b/target/linux/orion/image/Makefile
deleted file mode 100644
index 058519f720..0000000000
--- a/target/linux/orion/image/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Copyright (C) 2008-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-include $(SUBTARGET).mk
-
-$(eval $(call BuildImage))
diff --git a/target/linux/orion/image/generic.mk b/target/linux/orion/image/generic.mk
deleted file mode 100644
index 905997d8cb..0000000000
--- a/target/linux/orion/image/generic.mk
+++ /dev/null
@@ -1,230 +0,0 @@
-#
-# Copyright (C) 2008-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-### DO NOT INDENT LINES CONTAINING $(call xyz) AS THIS MAY CHANGE THE CONTEXT
-### OF THE FIRST LINE IN THE CALLED VARIABLE (NOTE: variable!)
-### see http://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
-### ACTUALLY IT IS A SIMPLE MACRO EXPANSION
-
-### use round brackets for make variables, and curly brackets for shell variables
-
-
-## Kernel mtd partition size in KiB
-KERNEL_MTD_SIZE:=1280
-
-# Netgear WNR854T: erase size is 128KiB = 0x00020000 = 131072
-ERASE_SIZE_128K:=128
-
-# Linksys WRT350N v2: erase size is 64KiB = 0x00010000 = 65536
-ERASE_SIZE_64K:=64
-
-# define JFFS2 sizes for include/image.mk
-JFFS2_BLOCKSIZE:=64k 128k
-
-
-###
-### Image/BuildKernel
-###
-
-define Image/BuildKernel
-### Dummy comment for indented calls of Image/BuildKernel
-
- ## Netgear WN802T: mach id 3306 (0x0cea)
-$(call Image/BuildKernel/ARM/zImage,wn802t,"\x0c\x1c\xa0\xe3\xea\x10\x81\xe3")
-$(call Image/BuildKernel/ARM/uImage,wn802t)
-ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
-$(call Image/BuildKernel/ARM/zImage,wn802t,"\x0c\x1c\xa0\xe3\xea\x10\x81\xe3",-initramfs)
-$(call Image/BuildKernel/ARM/uImage,wn802t,-initramfs)
-endif
- ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) # nothing more to do for a ramdisk build
-$(call Image/BuildKernel/JFFS2uImage,wn802t,$(ERASE_SIZE_64K),uImage)
-$(call Image/Default/FileSizeCheck,$(KDIR)/wn802t-uImage.jffs2,$(shell expr $(KERNEL_MTD_SIZE) \* 1024))
- endif
-
- ## Netgear WNR854T: mach id 1801 (0x0709)
-$(call Image/BuildKernel/ARM/zImage,wnr854t,"\x07\x1c\xa0\xe3\x09\x10\x81\xe3")
-$(call Image/BuildKernel/ARM/uImage,wnr854t)
-ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
-$(call Image/BuildKernel/ARM/zImage,wnr854t,"\x07\x1c\xa0\xe3\x09\x10\x81\xe3",-initramfs)
-$(call Image/BuildKernel/ARM/uImage,wnr854t,-initramfs)
-endif
- ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) # nothing more to do for a ramdisk build
-$(call Image/BuildKernel/JFFS2uImage,wnr854t,$(ERASE_SIZE_128K),uImage)
-$(call Image/Default/FileSizeCheck,$(KDIR)/wnr854t-uImage.jffs2,$(shell expr $(KERNEL_MTD_SIZE) \* 1024))
- endif
-
- ## Linksys WRT350N v2: mach id 1633 (0x0661)
-$(call Image/BuildKernel/ARM/zImage,wrt350nv2,"\x06\x1c\xa0\xe3\x61\x10\x81\xe3")
-$(call Image/BuildKernel/ARM/uImage,wrt350nv2)
-ifeq ($($CONFIG_TARGET_ROOTFS_INITRAMFS),y)
-$(call Image/BuildKernel/ARM/zImage,wrt350nv2,"\x06\x1c\xa0\xe3\x61\x10\x81\xe3",-initramfs)
-$(call Image/BuildKernel/ARM/uImage,wrt350nv2-initramfs)
-endif
- ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) # nothing more to do for a ramdisk build
-$(call Image/Default/FileSizeCheck,$(KDIR)/wrt350nv2-uImage,$(shell expr $(KERNEL_MTD_SIZE) \* 1024))
- endif
-endef
-
-define Image/BuildKernel/ARM/zImage
- # merge machine id and regular zImage into one file
- # parameters: 1 = machine name, 2 = machine id as string in quotes
- # $(BOARD) kernel zImage for $(1)
- echo -en $(2) > '$(KDIR)/$(1)-zImage$(3)'
- cat '$(KDIR)/zImage$(3)' >> '$(KDIR)/$(1)-zImage$(3)'
-endef
-
-define Image/BuildKernel/ARM/uImage
- # create uImage from zImage
- # parameters: 1 = machine name
- # $(BOARD) kernel uImage for $(1)
- '$(STAGING_DIR_HOST)/bin/mkimage' -A arm -O linux -T kernel \
- -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
- -d '$(KDIR)/$(1)-zImage$(2)' '$(KDIR)/$(1)-uImage$(2)'
- ifeq ($(2),-initramfs) # only copy uImage for ramdisk build
- cp '$(KDIR)/$(1)-uImage-initramfs' '$(BIN_DIR)/openwrt-$(1)-uImage-initramfs'
- endif
-endef
-
-define Image/BuildKernel/JFFS2uImage
- # create JFFS2 partition with uImage file (result is already padded to erase size)
- # parameters: 1 = machine name, 2 = erase size in KiB, 3 = uImage file name
- # $(BOARD) kernel uImage for $(1) in JFFS2-$(2)k partition
- rm -rf '$(TMP_DIR)/$(1)_jffs2_uimage'
- mkdir '$(TMP_DIR)/$(1)_jffs2_uimage'
- cp '$(KDIR)/$(1)-uImage' '$(TMP_DIR)/$(1)_jffs2_uimage/$(3)'
- $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --compression-mode=none --pad --little-endian --squash -e $(2)KiB -o '$(KDIR)/$(1)-uImage.jffs2' -d '$(TMP_DIR)/$(1)_jffs2_uimage'
- rm -rf '$(TMP_DIR)/$(1)_jffs2_uimage'
-endef
-
-define Image/Default/FileSizeCheck
- # parameters: 1 = file path, 2 = maximum size in bytes
- [ `stat -c %s '$(1)'` -le $(2) ] || { echo ' ERROR: $(1) too big (> $(2) bytes)'; exit 1; }
-endef
-
-
-###
-### Image/Build
-###
-
-define Image/Build
-### Dummy comment for indented calls of Image/Build with $(1)
-
- ## Prepare rootfs
-$(call Image/Build/$(1),$(1))
-
- ## Netgear WN802T
-$(call Image/Build/Default,$(1),wn802t,$(ERASE_SIZE_64K),$(KERNEL_MTD_SIZE),.jffs2,NG_WN802T)
-
- ## Netgear WNR854T
-$(call Image/Build/Default,$(1),wnr854t,$(ERASE_SIZE_128K),$(KERNEL_MTD_SIZE),.jffs2,NG_WNR854T)
-
- ## Linksys WRT350N v2
-$(call Image/Build/Linksys/wrt350nv2,$(1),wrt350nv2,$(ERASE_SIZE_64K),$(KERNEL_MTD_SIZE),)
-endef
-
-define Image/Build/squashfs
-$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
-endef
-
-## generate defines for all JFFS2 block sizes
-define Image/Build/jffs2/sub
- $(eval define Image/Build/jffs2-$(1)
- cp '$$(KDIR)/root.jffs2-$(1)' '$$(BIN_DIR)/$$(IMG_PREFIX)-root.jffs2-$(1)'
- endef)
-endef
-
-$(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/Build/jffs2/sub,$(SZ)))
-
-define Image/Build/Default
- # parameters: 1 = rootfs type, 2 = machine name, 3 = erase size in KiB, 4 = kernel mtd size in KiB, 5 = kernel file suffix, 6 = header
- ifeq ($(findstring jffs2-,$(1)),jffs2-) # JFFS2: build only image fitting to erase size
- ifeq ($(1),jffs2-$(3)k)
-$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
-$(call Image/Build/Default/factory,$(1),$(2),$(6))
- endif
- else
- ifeq ($(1),ext4) # EXT4: ignore
- # do nothing
- else # do all other images
-$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
-$(call Image/Build/Default/factory,$(1),$(2),$(6))
- endif
- endif
-endef
-
-define Image/Build/Default/sysupgrade
- # parameters: 1 = rootfs type, 2 = machine name, 3 = pad size in KiB (kernel mtd size or erase size), 4 = kernel file suffix
- # $(BOARD) $(1) sysupgrade image for $(2)
- ( \
- dd if='$(KDIR)/$(2)-uImage$(4)' bs=$(3)k conv=sync; \
- dd if='$(KDIR)/root.$(1)'; \
- ) > '$(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img'
-endef
-
-define Image/Build/Default/factory
- # parameters: 1 = rootfs type, 2 = machine name, 3 = header
- # $(BOARD) $(1) factory upgrade image for $(2)
- '$(STAGING_DIR_HOST)/bin/add_header' $(3) '$(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img' '$(BIN_DIR)/openwrt-$(2)-$(1)-factory.img'
-endef
-
-##
-## Image/Build/Linksys
-##
-
-define Image/Build/Linksys/wrt350nv2
- # parameters: 1 = rootfs type, 2 = machine name, 3 = erase size in KiB, 4 = kernel mtd size in KiB, 5 = kernel file suffix
- ifeq ($(findstring jffs2-,$(1)),jffs2-) # JFFS2: build only image fitting to erase size
- ifeq ($(1),jffs2-$(3)k)
-$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
-$(call Image/Build/Linksys/wrt350nv2-builder,$(1),$(2))
- endif
- else
- ifeq ($(1),ext4) # EXT4: ignore
- # do nothing
- else # do all other images
-$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
-$(call Image/Build/Linksys/wrt350nv2-builder,$(1),$(2))
- endif
- endif
-endef
-
-define Image/Build/Linksys/wrt350nv2-builder
- # parameters: 1 = rootfs type, 2 = machine name
- # $(BOARD) $(1) factory and recovery image for $(2) via wrt350nv2-builder
- rm -rf '$(TMP_DIR)/$(2)_factory'
- mkdir '$(TMP_DIR)/$(2)_factory'
- # create parameter file
- echo ':image 0 $(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img' > '$(TMP_DIR)/$(2)_factory/$(2).par'
- [ ! -f '$(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin' ] || ( \
- echo ':u-boot 0 $(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin' >> '$(TMP_DIR)/$(2)_factory/$(2).par'; \
- )
- echo '#version 0x2020' >> '$(TMP_DIR)/$(2)_factory/$(2).par'
- # create bin file for recovery and factory image
- ( \
- cd '$(TMP_DIR)/$(2)_factory'; \
- '$(STAGING_DIR_HOST)/bin/wrt350nv2-builder' -b '$(TMP_DIR)/$(2)_factory/$(2).par'; \
- )
- # copy bin file as recovery image
- $(CP) '$(TMP_DIR)/$(2)_factory/wrt350n.bin' '$(BIN_DIR)/openwrt-$(2)-$(1)-recovery.bin'
- # create factory image for stock firmware update mechanism
- ( \
- cd '$(TMP_DIR)/$(2)_factory'; \
- zip 'wrt350n.zip' 'wrt350n.bin'; \
- )
- '$(STAGING_DIR_HOST)/bin/wrt350nv2-builder' -z '$(TMP_DIR)/$(2)_factory/wrt350n.zip' '$(BIN_DIR)/openwrt-$(2)-$(1)-factory.img'
- rm -rf '$(TMP_DIR)/$(2)_factory'
-endef
-
-
-###
-### Image/PreReq
-###
-
-## Dependency for WRT350N v2 factory image
-$(eval $(call RequireCommand,zip, \
- Please install zip. \
-))
diff --git a/target/linux/orion/image/harddisk.mk b/target/linux/orion/image/harddisk.mk
deleted file mode 100644
index fb2f351b7f..0000000000
--- a/target/linux/orion/image/harddisk.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Copyright (C) 2008-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Image/BuildKernelMachId
- echo -en "\x$(2)\x1c\xa0\xe3\x$(3)\x10\x81\xe3" > $(KDIR)/$(1)-zImage
- cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/$(1)-zImage
- $(STAGING_DIR_HOST)/bin/mkimage -A arm -O linux -T kernel \
- -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
- -d $(KDIR)/$(1)-zImage $(KDIR)/$(1)-uImage
- cp $(KDIR)/$(1)-uImage $(BIN_DIR)/openwrt-$(1)-uImage
-endef
-
-define Image/BuildKernel
- # Orion Kernel uImages
- # DT2: mach id 1514 (0x5EA)
- $(call Image/BuildKernelMachId,dt2,05,ea)
- # LaCie 2big Network: mach id 2342 (0x926)
- $(call Image/BuildKernelMachId,net2big,09,26)
-endef
-
-define Image/Build/Freecom
- # Orion Freecom Images
- # backup unwanted files
- rm -rf ${TMP_DIR}/$2_backup
- mkdir ${TMP_DIR}/$2_backup
- -mv $(TARGET_DIR)/{var,jffs,rom} ${TMP_DIR}/$2_backup
- # add extra files
- $(INSTALL_DIR) $(TARGET_DIR)/boot
- # TODO: Add special CMDLINE shim for webupgrade image here
- $(CP) $(KDIR)/dt2-uImage $(TARGET_DIR)/boot/uImage
- $(INSTALL_DIR) $(TARGET_DIR)/var
- # create image
- $(TAR) cfj $(BIN_DIR)/openwrt-$(2)-$(1).img --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
- $(STAGING_DIR_HOST)/bin/encode_crc $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img $(3)
- # remove extra files
- rm -rf $(TARGET_DIR)/{boot,var}
- # recover unwanted files
- -mv ${TMP_DIR}/$2_backup/* $(TARGET_DIR)/
- rm -rf ${TMP_DIR}/$2_backup
-endef
-
-define Image/Build
-$(call Image/Build/$(1),$(1))
-$(call Image/Build/Freecom,$(1),dt2,DT,$(1))
-endef
-
-define Image/Build/squashfs
-$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- ( \
- dd if=$(KDIR)/uImage bs=1024k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
-endef
diff --git a/target/linux/orion/patches/100-wrt350nv2_openwrt_partition_map.patch b/target/linux/orion/patches/100-wrt350nv2_openwrt_partition_map.patch
deleted file mode 100644
index 89c2c9420b..0000000000
--- a/target/linux/orion/patches/100-wrt350nv2_openwrt_partition_map.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
-+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
-@@ -134,11 +134,11 @@ static struct mtd_partition wrt350n_v2_n
- {
- .name = "kernel",
- .offset = 0x00000000,
-- .size = 0x00760000,
-+ .size = 0x00140000, // change to kernel mtd size here (1/3)
- }, {
- .name = "rootfs",
-- .offset = 0x001a0000,
-- .size = 0x005c0000,
-+ .offset = 0x00140000, // change to kernel mtd size here (2/3)
-+ .size = 0x00610000, // adopt to kernel mtd size here (3/3) = 0x00750000 - <kernel mtd size>
- }, {
- .name = "lang",
- .offset = 0x00760000,
-@@ -151,6 +151,14 @@ static struct mtd_partition wrt350n_v2_n
- .name = "u-boot",
- .offset = 0x007c0000,
- .size = 0x00040000,
-+ }, {
-+ .name = "eRcOmM_do_not_touch",
-+ .offset = 0x00750000,
-+ .size = 0x00010000, // erasesize
-+ }, {
-+ .name = "image", // for sysupgrade
-+ .offset = 0x00000000,
-+ .size = 0x00750000,
- },
- };
-
diff --git a/target/linux/orion/patches/101-wnr854t_partition_map.patch b/target/linux/orion/patches/101-wnr854t_partition_map.patch
deleted file mode 100644
index 881cfb773e..0000000000
--- a/target/linux/orion/patches/101-wnr854t_partition_map.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/arch/arm/mach-orion5x/wnr854t-setup.c
-+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
-@@ -57,15 +57,19 @@ static struct mtd_partition wnr854t_nor_
- {
- .name = "kernel",
- .offset = 0x00000000,
-- .size = 0x00100000,
-+ .size = 0x00140000,
- }, {
- .name = "rootfs",
-- .offset = 0x00100000,
-- .size = 0x00660000,
-+ .offset = 0x00140000,
-+ .size = 0x00620000,
- }, {
- .name = "uboot",
- .offset = 0x00760000,
- .size = 0x00040000,
-+ }, {
-+ .name = "image", // for sysupgrade
-+ .offset = 0x00000000,
-+ .size = 0x00760000,
- },
- };
-
diff --git a/target/linux/orion/patches/200-dt2_board_support.patch b/target/linux/orion/patches/200-dt2_board_support.patch
deleted file mode 100644
index 6d3f55988e..0000000000
--- a/target/linux/orion/patches/200-dt2_board_support.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/arch/arm/mach-orion5x/Kconfig
-+++ b/arch/arm/mach-orion5x/Kconfig
-@@ -36,6 +36,13 @@ config MACH_RD88F5182_DT
- Say 'Y' here if you want your kernel to support the Marvell
- Orion-NAS (88F5182) RD2, Flattened Device Tree.
-
-+config MACH_DT2
-+ bool "Freecom DataTank Gateway"
-+ select I2C_BOARDINFO
-+ help
-+ Say 'Y' here if you want your kernel to support the
-+ Freecom DataTank Gateway
-+
- config MACH_KUROBOX_PRO
- bool "KuroBox Pro"
- select I2C_BOARDINFO
---- a/arch/arm/mach-orion5x/Makefile
-+++ b/arch/arm/mach-orion5x/Makefile
-@@ -14,6 +14,7 @@ obj-$(CONFIG_MACH_TS78XX) += ts78xx-setu
- obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
- obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
- obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
-+obj-$(CONFIG_MACH_DT2) += dt2-setup.o
- obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
- obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
- obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
diff --git a/target/linux/orion/patches/210-wn802t_support.patch b/target/linux/orion/patches/210-wn802t_support.patch
deleted file mode 100644
index 479498e3b8..0000000000
--- a/target/linux/orion/patches/210-wn802t_support.patch
+++ /dev/null
@@ -1,78 +0,0 @@
---- a/arch/arm/mach-orion5x/Kconfig
-+++ b/arch/arm/mach-orion5x/Kconfig
-@@ -144,10 +144,13 @@ config MACH_MSS2_DT
- Maxtor Shared Storage II platform.
-
- config MACH_WNR854T
-- bool "Netgear WNR854T"
-+ bool "Netgear WNR854T / WN802T"
- help
- Say 'Y' here if you want your kernel to support the
-- Netgear WNR854T platform.
-+ Netgear WNR854T or WN802T platform.
-+
-+config MACH_WN802T
-+ def_bool MACH_WNR854T
-
- config MACH_RD88F5181L_GE
- bool "Marvell Orion-VoIP GE Reference Design"
---- a/arch/arm/mach-orion5x/wnr854t-setup.c
-+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
-@@ -115,6 +115,15 @@ static struct dsa_platform_data wnr854t_
- .chip = &wnr854t_switch_chip_data,
- };
-
-+static struct dsa_chip_data wn802t_switch_chip_data = {
-+ .port_names[2] = "wan",
-+ .port_names[3] = "cpu",
-+};
-+
-+static struct dsa_platform_data wn802t_switch_plat_data = {
-+ .nr_chips = 1,
-+ .chip = &wn802t_switch_chip_data,
-+};
- static void __init wnr854t_init(void)
- {
- /*
-@@ -128,7 +137,12 @@ static void __init wnr854t_init(void)
- * Configure peripherals.
- */
- orion5x_eth_init(&wnr854t_eth_data);
-- orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ);
-+
-+ if (machine_is_wn802t())
-+ orion5x_eth_switch_init(&wn802t_switch_plat_data, NO_IRQ);
-+ else
-+ orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ);
-+
- orion5x_uart0_init();
-
- mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
-@@ -168,7 +182,7 @@ static struct hw_pci wnr854t_pci __initd
-
- static int __init wnr854t_pci_init(void)
- {
-- if (machine_is_wnr854t())
-+ if (machine_is_wnr854t() || machine_is_wn802t())
- pci_common_init(&wnr854t_pci);
-
- return 0;
-@@ -179,6 +193,18 @@ MACHINE_START(WNR854T, "Netgear WNR854T"
- /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
- .atag_offset = 0x100,
- .init_machine = wnr854t_init,
-+ .map_io = orion5x_map_io,
-+ .init_early = orion5x_init_early,
-+ .init_irq = orion5x_init_irq,
-+ .init_time = orion5x_timer_init,
-+ .fixup = tag_fixup_mem32,
-+ .restart = orion5x_restart,
-+MACHINE_END
-+
-+MACHINE_START(WN802T, "Netgear WN802T")
-+ /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
-+ .atag_offset = 0x100,
-+ .init_machine = wnr854t_init,
- .map_io = orion5x_map_io,
- .init_early = orion5x_init_early,
- .init_irq = orion5x_init_irq,
diff --git a/target/linux/ppc40x/Makefile b/target/linux/ppc40x/Makefile
deleted file mode 100644
index fc85b03c29..0000000000
--- a/target/linux/ppc40x/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2008-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=powerpc
-BOARD:=ppc40x
-BOARDNAME:=AMCC/IBM PPC40x
-FEATURES:=squashfs broken
-CPU_TYPE:=405
-MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-include $(INCLUDE_DIR)/target.mk
-
-define Target/Description
- Build firmware images for AMCC/IBM PPC40x based boards.
-endef
-
-KERNELNAME:=uImage cuImage.magicbox cuImage.openrb
-
-$(eval $(call BuildTarget))
diff --git a/target/linux/ppc40x/base-files/lib/ppc40x.sh b/target/linux/ppc40x/base-files/lib/ppc40x.sh
deleted file mode 100755
index 8a6c487766..0000000000
--- a/target/linux/ppc40x/base-files/lib/ppc40x.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-
-ppc40x_board_name() {
- local model
-
- model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
- echo $model
-}
diff --git a/target/linux/ppc40x/base-files/lib/upgrade/platform.sh b/target/linux/ppc40x/base-files/lib/upgrade/platform.sh
deleted file mode 100644
index b20b83cd57..0000000000
--- a/target/linux/ppc40x/base-files/lib/upgrade/platform.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-
-. /lib/ppc40x.sh
-
-PART_NAME=firmware
-RAMFS_COPY_DATA=/lib/ppc40x.sh
-
-platform_check_image() {
- local board=$(ppc40x_board_name)
- local magic="$(get_magic_word "$1")"
-
- [ "$#" -gt 1 ] && return 1
-
- case "$board" in
- kilauea | openrb | magicbox)
- [ "$magic" != "2705" ] && {
- echo "Invalid image type."
- return 1
- }
- return 0
- ;;
- esac
-
- echo "Sysupgrade is not yet supported on $board."
- return 1
-}
-
-platform_do_upgrade() {
- local board=$(ppc40x_board_name)
-
- case "$board" in
- *)
- default_do_upgrade "$ARGV"
- ;;
- esac
-}
diff --git a/target/linux/ppc40x/config-3.18 b/target/linux/ppc40x/config-3.18
deleted file mode 100644
index bf59bf132f..0000000000
--- a/target/linux/ppc40x/config-3.18
+++ /dev/null
@@ -1,235 +0,0 @@
-CONFIG_405EX=y
-CONFIG_40x=y
-# CONFIG_44x is not set
-CONFIG_4xx=y
-CONFIG_4xx_SOC=y
-# CONFIG_ACADIA is not set
-# CONFIG_ADVANCED_OPTIONS is not set
-CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ILOG2_U32=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_WALK_MEMORY=y
-CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-# CONFIG_ARCH_RANDOM is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_AUDIT_ARCH=y
-CONFIG_BOUNCE=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd"
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CONSISTENT_SIZE=0x00200000
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-# CONFIG_CRYPTO_SHA1_PPC is not set
-# CONFIG_DEFAULT_UIMAGE is not set
-CONFIG_DTC=y
-# CONFIG_E200 is not set
-CONFIG_EARLY_PRINTK=y
-# CONFIG_EP405 is not set
-# CONFIG_EPAPR_BOOT is not set
-CONFIG_EXTRA_TARGETS="uImage"
-# CONFIG_FSL_ULI1575 is not set
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-# CONFIG_GENERIC_CSUM is not set
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_GENERIC_NVRAM=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-# CONFIG_GENERIC_TBSYNC is not set
-CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_GE_FPGA is not set
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAS_RAPIDIO is not set
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IOREMAP_PROT=y
-CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-# CONFIG_HOTFOOT is not set
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_IBM_EMAC=y
-CONFIG_IBM_EMAC_EMAC4=y
-CONFIG_IBM_EMAC_POLL_WEIGHT=32
-CONFIG_IBM_EMAC_RGMII=y
-CONFIG_IBM_EMAC_RXB=256
-CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
-CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0
-CONFIG_IBM_EMAC_TXB=256
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_IOMMU_HELPER is not set
-# CONFIG_IPIC is not set
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_ISA_DMA_API=y
-CONFIG_KERNEL_START=0xc0000000
-CONFIG_KILAUEA=y
-CONFIG_LIBFDT=y
-CONFIG_LOWMEM_SIZE=0x30000000
-CONFIG_MAGICBOX=y
-# CONFIG_MAKALU is not set
-# CONFIG_MATH_EMULATION is not set
-# CONFIG_MMIO_NVRAM is not set
-CONFIG_MODULES_USE_ELF_RELA=y
-# CONFIG_MPIC is not set
-# CONFIG_MPIC_U3_HT_IRQS is not set
-# CONFIG_MPIC_WEIRD is not set
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_SPLIT_UIMAGE_FW=y
-CONFIG_NEED_DMA_MAP_STATE=y
-# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NEED_SG_DMA_LENGTH=y
-# CONFIG_NONSTATIC_KERNEL is not set
-CONFIG_NOT_COHERENT_CACHE=y
-CONFIG_NR_IRQS=512
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND=y
-CONFIG_OPENRB=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xc0000000
-CONFIG_PCI=y
-CONFIG_PCIEAER=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_MSI=y
-CONFIG_PHYSICAL_START=0x00000000
-CONFIG_PPC=y
-CONFIG_PPC32=y
-CONFIG_PPC40x_SIMPLE=y
-# CONFIG_PPC4xx_HSTA_MSI is not set
-CONFIG_PPC4xx_MSI=y
-# CONFIG_PPC4xx_OCM is not set
-CONFIG_PPC4xx_PCI_EXPRESS=y
-# CONFIG_PPC64 is not set
-# CONFIG_PPC_85xx is not set
-# CONFIG_PPC_8xx is not set
-# CONFIG_PPC_970_NAP is not set
-CONFIG_PPC_ADV_DEBUG_DACS=2
-CONFIG_PPC_ADV_DEBUG_DVCS=0
-CONFIG_PPC_ADV_DEBUG_IACS=2
-CONFIG_PPC_ADV_DEBUG_REGS=y
-# CONFIG_PPC_BOOK3S_32 is not set
-# CONFIG_PPC_CELL is not set
-# CONFIG_PPC_CELL_NATIVE is not set
-# CONFIG_PPC_COPRO_BASE is not set
-CONFIG_PPC_DCR=y
-# CONFIG_PPC_DCR_MMIO is not set
-CONFIG_PPC_DCR_NATIVE=y
-# CONFIG_PPC_DOORBELL is not set
-# CONFIG_PPC_EARLY_DEBUG is not set
-# CONFIG_PPC_EPAPR_HV_PIC is not set
-# CONFIG_PPC_I8259 is not set
-# CONFIG_PPC_ICP_HV is not set
-# CONFIG_PPC_ICP_NATIVE is not set
-# CONFIG_PPC_ICS_RTAS is not set
-CONFIG_PPC_INDIRECT_PCI=y
-CONFIG_PPC_MMU_NOHASH=y
-# CONFIG_PPC_MM_SLICES is not set
-# CONFIG_PPC_MPC106 is not set
-CONFIG_PPC_MSI_BITMAP=y
-CONFIG_PPC_OF=y
-# CONFIG_PPC_P7_NAP is not set
-CONFIG_PPC_PCI_CHOICE=y
-# CONFIG_PPC_RTAS is not set
-CONFIG_PPC_UDBG_16550=y
-CONFIG_PPC_WERROR=y
-# CONFIG_PPC_XICS is not set
-# CONFIG_PQ2ADS is not set
-# CONFIG_PREEMPT_RCU is not set
-CONFIG_RAS=y
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_OF_PLATFORM=y
-# CONFIG_SLAB is not set
-CONFIG_SLUB=y
-CONFIG_SPARSE_IRQ=y
-# CONFIG_SWIOTLB is not set
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-CONFIG_TASK_SIZE=0xc0000000
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_WALNUT is not set
-CONFIG_WORD_SIZE=32
-# CONFIG_XILINX_SYSACE is not set
-# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_XZ_DEC_POWERPC=y
diff --git a/target/linux/ppc40x/image/Makefile b/target/linux/ppc40x/image/Makefile
deleted file mode 100644
index 4070774296..0000000000
--- a/target/linux/ppc40x/image/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Copyright (C) 2008-2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-JFFS2_BLOCKSIZE=128k 64k
-
-define Image/Prepare
- $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb
-endef
-
-define Image/BuildKernel
- cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
- $(call Image/Build/Initramfs)
-endef
-
-define Image/Build
- $(call Image/Build/$(1),$(1))
-endef
-
-define Image/Build/ext2
- cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
-endef
-
-define Image/Build/jffs2-128k
- ( \
- dd if=$(KDIR)/uImage bs=1920k conv=sync; \
- dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-jffs2.img
-endef
-
-define Image/Build/jffs2-64k
- ( \
- dd if=$(KDIR)/cuImage.magicbox bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-jffs2.img
- ( \
- dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-jffs2.img
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- ( \
- dd if=$(KDIR)/uImage bs=1920k conv=sync; \
- dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-$(1).img
- ( \
- dd if=$(KDIR)/cuImage.magicbox bs=64k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-$(1).img
- ( \
- dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-$(1).img
-endef
-
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-define Image/Build/Initramfs
- cp $(KDIR)/cuImage.magicbox-initramfs $(BIN_DIR)/openwrt-$(BOARD)-magicbox-initramfs.bin
- cp $(KDIR)/cuImage.openrb-initramfs $(BIN_DIR)/openwrt-$(BOARD)-openrb-initramfs.bin
-endef
-endif
-
-$(eval $(call BuildImage))
diff --git a/target/linux/ppc40x/modules.mk b/target/linux/ppc40x/modules.mk
deleted file mode 100644
index 4db39fac76..0000000000
--- a/target/linux/ppc40x/modules.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/ata-magicbox-cf
- SUBMENU:=$(BLOCK_MENU)
- TITLE:=Magicbox v2/OpenRB Compact flash support
- DEPENDS:=@TARGET_ppc40x
- KCONFIG:=CONFIG_PATA_MAGICBOX_CF
- FILES:=$(LINUX_DIR)/drivers/ata/pata_magicbox_cf.ko
- AUTOLOAD:=$(call AutoLoad,41,pata_magicbox_cf,1)
- $(call AddDepends/ata)
-endef
-
-define KernelPackage/ata-magicbox-cf/description
- Support for Magicbox v2/OpenRB on-board CF slot.
-endef
-
-$(eval $(call KernelPackage,ata-magicbox-cf))
-
-
-define KernelPackage/usb-isp116x-hcd
- TITLE:=Support for the ISP116x USB Host Controller
- DEPENDS:=@TARGET_ppc40x
- KCONFIG:= \
- CONFIG_USB_ISP116X_HCD \
- CONFIG_USB_ISP116X_HCD_OF=y \
- CONFIG_USB_ISP116X_HCD_PLATFORM=n
- FILES:=$(LINUX_DIR)/drivers/usb/host/isp116x-hcd.ko
- AUTOLOAD:=$(call AutoLoad,50,isp116x-hcd)
- $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-isp116x-hcd/description
- Kernel support for the ISP116X USB Host Controller
-endef
-
-$(eval $(call KernelPackage,usb-isp116x-hcd))
diff --git a/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch b/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch
deleted file mode 100644
index 5c7329ddee..0000000000
--- a/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/arch/powerpc/boot/dcr.h
-+++ b/arch/powerpc/boot/dcr.h
-@@ -59,6 +59,14 @@ static const unsigned long sdram_bxcr[]
- #define EBC_BXCR(n) (n)
- #define EBC_BXCR_BAS 0xfff00000
- #define EBC_BXCR_BS 0x000e0000
-+#define EBC_BXCR_BS_1M 0x00000000
-+#define EBC_BXCR_BS_2M 0x00020000
-+#define EBC_BXCR_BS_4M 0x00040000
-+#define EBC_BXCR_BS_8M 0x00060000
-+#define EBC_BXCR_BS_16M 0x00080000
-+#define EBC_BXCR_BS_32M 0x000a0000
-+#define EBC_BXCR_BS_64M 0x000c0000
-+#define EBC_BXCR_BS_128M 0x000e0000
- #define EBC_BXCR_BANK_SIZE(reg) \
- (0x100000 << (((reg) & EBC_BXCR_BS) >> 17))
- #define EBC_BXCR_BU 0x00018000
-@@ -67,6 +75,9 @@ static const unsigned long sdram_bxcr[]
- #define EBC_BXCR_BU_WO 0x00010000
- #define EBC_BXCR_BU_RW 0x00018000
- #define EBC_BXCR_BW 0x00006000
-+#define EBC_BXCR_BW_8 0x00000000
-+#define EBC_BXCR_BW_16 0x00002000
-+#define EBC_BXCR_BW_32 0x00006000
- #define EBC_B0AP 0x10
- #define EBC_B1AP 0x11
- #define EBC_B2AP 0x12
diff --git a/target/linux/ppc40x/patches-3.18/004-magicbox.patch b/target/linux/ppc40x/patches-3.18/004-magicbox.patch
deleted file mode 100644
index 48f5912e49..0000000000
--- a/target/linux/ppc40x/patches-3.18/004-magicbox.patch
+++ /dev/null
@@ -1,446 +0,0 @@
---- /dev/null
-+++ b/arch/powerpc/boot/cuboot-magicbox.c
-@@ -0,0 +1,98 @@
-+/*
-+ * Old U-boot compatibility for Magicbox boards
-+ *
-+ * Author: Imre Kaloz <kaloz@openwrt.org>
-+ * Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include "ops.h"
-+#include "io.h"
-+#include "dcr.h"
-+#include "stdio.h"
-+#include "4xx.h"
-+#include "44x.h"
-+#include "cuboot.h"
-+
-+#define TARGET_4xx
-+#define TARGET_405EP
-+#include "ppcboot.h"
-+
-+static bd_t bd;
-+
-+static void fixup_perwe(void)
-+{
-+
-+#define DCRN_CPC0_PCI_BASE 0xf9
-+
-+ /* Turn on PerWE instead of PCIINT */
-+ mtdcr(DCRN_CPC0_PCI_BASE,
-+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
-+
-+#undef DCRN_CPC0_PCI_BASE
-+}
-+
-+static void fixup_cf_card(void)
-+{
-+
-+#define CF_CS0_BASE 0xff100000
-+#define CF_CS1_BASE 0xff200000
-+
-+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+#undef CF_CS0_BASE
-+#undef CF_CS1_BASE
-+}
-+
-+static void magicbox_fixups(void)
-+{
-+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8);
-+ ibm4xx_sdram_fixup_memsize();
-+
-+ /* Magicbox v1 has only one ethernet, one serial and no
-+ * CF slot -- detect it using it's fake enet1addr
-+ */
-+ if ((bd.bi_enet1addr[2] == 0x02) &&
-+ (bd.bi_enet1addr[3] == 0xfa) &&
-+ (bd.bi_enet1addr[4] == 0xf0) &&
-+ (bd.bi_enet1addr[5] == 0x80)) {
-+ void *devp;
-+ devp = finddevice("/plb/opb/ethernet@ef600900");
-+ del_node(devp);
-+ devp = finddevice("/plb/opb/serial@ef600400");
-+ del_node(devp);
-+ devp = finddevice("/plb/ebc/cf_card@ff100000");
-+ del_node(devp);
-+
-+ } else {
-+ fixup_perwe();
-+ fixup_cf_card();
-+ }
-+
-+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
-+}
-+
-+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
-+ unsigned long r6, unsigned long r7)
-+{
-+ CUBOOT_INIT();
-+ platform_ops.fixups = magicbox_fixups;
-+ platform_ops.exit = ibm40x_dbcr_reset;
-+ fdt_init(_dtb_start);
-+ serial_console_init();
-+}
---- /dev/null
-+++ b/arch/powerpc/boot/dts/magicbox.dts
-@@ -0,0 +1,285 @@
-+/*
-+ * Device Tree Source for Magicbox boards
-+ *
-+ * Copyright 2008-2009 Imre Kaloz <kaloz@openwrt.org>
-+ * Copyright 2009 Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * Based on walnut.dts
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without
-+ * any warranty of any kind, whether express or implied.
-+ */
-+
-+/dts-v1/;
-+
-+/ {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ model = "magicbox";
-+ compatible = "magicbox";
-+ dcr-parent = <&{/cpus/cpu@0}>;
-+
-+ aliases {
-+ ethernet0 = &EMAC0;
-+ ethernet1 = &EMAC1;
-+ serial0 = &UART0;
-+ serial1 = &UART1;
-+ };
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu@0 {
-+ device_type = "cpu";
-+ model = "PowerPC,405EP";
-+ reg = <0x00000000>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ timebase-frequency = <0>; /* Filled in by zImage */
-+ i-cache-line-size = <0x20>;
-+ d-cache-line-size = <0x20>;
-+ i-cache-size = <0x4000>;
-+ d-cache-size = <0x4000>;
-+ dcr-controller;
-+ dcr-access-method = "native";
-+ };
-+ };
-+
-+ memory {
-+ device_type = "memory";
-+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */
-+ };
-+
-+ UIC0: interrupt-controller {
-+ compatible = "ibm,uic";
-+ interrupt-controller;
-+ cell-index = <0>;
-+ dcr-reg = <0x0c0 0x009>;
-+ #address-cells = <0>;
-+ #size-cells = <0>;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ plb {
-+ compatible = "ibm,plb3";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ SDRAM0: memory-controller {
-+ compatible = "ibm,sdram-405ep";
-+ dcr-reg = <0x010 0x002>;
-+ };
-+
-+ MAL: mcmal {
-+ compatible = "ibm,mcmal-405ep", "ibm,mcmal";
-+ dcr-reg = <0x180 0x062>;
-+ num-tx-chans = <4>;
-+ num-rx-chans = <2>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xb 0x4 /* TXEOB */
-+ 0xc 0x4 /* RXEOB */
-+ 0xa 0x4 /* SERR */
-+ 0xd 0x4 /* TXDE */
-+ 0xe 0x4 /* RXDE */>;
-+ };
-+
-+ POB0: opb {
-+ compatible = "ibm,opb-405ep", "ibm,opb";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges = <0xef600000 0xef600000 0x00a00000>;
-+ dcr-reg = <0x0a0 0x005>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ UART0: serial@ef600300 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600300 0x00000008>;
-+ virtual-reg = <0xef600300>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x0 0x4>;
-+ };
-+
-+ UART1: serial@ef600400 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600400 0x00000008>;
-+ virtual-reg = <0xef600400>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1 0x4>;
-+ };
-+
-+ IIC: i2c@ef600500 {
-+ compatible = "ibm,iic-405ep", "ibm,iic";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0xef600500 0x00000011>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x2 0x4>;
-+
-+ dtt@48 {
-+ compatible = "national,lm75";
-+ reg = <0x48>;
-+ };
-+
-+ eeprom@50 {
-+ compatible = "at24,24c16";
-+ reg = <0x50>;
-+ };
-+ };
-+
-+ GPIO0: gpio-controller@ef600700 {
-+ compatible = "ibm,ppc4xx-gpio";
-+ reg = <0xef600700 0x00000020>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ EMAC0: ethernet@ef600800 {
-+ linux,network-index = <0x0>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xf 0x4 /* Ethernet */
-+ 0x9 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600800 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <0>;
-+ mal-rx-channel = <0>;
-+ cell-index = <0>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000000>;
-+ };
-+
-+ EMAC1: ethernet@ef600900 {
-+ linux,network-index = <0x1>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0x11 0x4 /* Ethernet */
-+ 0x09 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600900 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <2>;
-+ mal-rx-channel = <1>;
-+ cell-index = <1>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ mdio-device = <&EMAC0>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000001>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+ user {
-+ label = "magicbox:red:user";
-+ gpios = <&GPIO0 2 1>;
-+ };
-+ };
-+ };
-+
-+ EBC0: ebc {
-+ compatible = "ibm,ebc-405ep", "ibm,ebc";
-+ dcr-reg = <0x012 0x002>;
-+ #address-cells = <2>;
-+ #size-cells = <1>;
-+ /* The ranges property is supplied by the bootwrapper
-+ * and is based on the firmware's configuration of the
-+ * EBC bridge
-+ */
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ cf_card@ff100000 {
-+ compatible = "magicbox-cf", "pata-magicbox-cf";
-+ reg = <0x00000000 0xff100000 0x00001000
-+ 0x00000000 0xff200000 0x00001000>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ nor_flash@ffc00000 {
-+ compatible = "cfi-flash";
-+ bank-width = <2>;
-+ reg = <0x00000000 0xffc00000 0x00400000>;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ partition0@0 {
-+ label = "linux";
-+ reg = <0x0 0x160000>;
-+ };
-+ partition1@120000 {
-+ label = "rootfs";
-+ reg = <0x160000 0x260000>;
-+ };
-+ partition2@3c0000 {
-+ label = "u-boot";
-+ reg = <0x3c0000 0x30000>;
-+ read-only;
-+ };
-+ partition3@0 {
-+ label = "firmware";
-+ reg = <0x0 0x3c0000>;
-+ };
-+ };
-+ };
-+
-+ PCI0: pci@ec000000 {
-+ device_type = "pci";
-+ #interrupt-cells = <1>;
-+ #size-cells = <2>;
-+ #address-cells = <3>;
-+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
-+ primary;
-+ reg = <0xeec00000 0x00000008 /* Config space access */
-+ 0xeed80000 0x00000004 /* IACK */
-+ 0xeed80000 0x00000004 /* Special cycle */
-+ 0xef480000 0x00000040>; /* Internal registers */
-+
-+ /* Outbound ranges, one memory and one IO,
-+ * later cannot be changed. Chip supports a second
-+ * IO range but we don't use it for now
-+ */
-+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
-+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
-+
-+ /* Inbound 2GB range starting at 0 */
-+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
-+
-+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
-+ interrupt-map = <
-+ /* IDSEL 1 */
-+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
-+
-+ /* IDSEL 2 */
-+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
-+
-+ /* IDSEL 3 */
-+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
-+
-+ /* IDSEL 4 */
-+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
-+ >;
-+ };
-+ };
-+
-+ chosen {
-+ linux,stdout-path = "/plb/opb/serial@ef600300";
-+ };
-+};
---- a/arch/powerpc/boot/Makefile
-+++ b/arch/powerpc/boot/Makefile
-@@ -50,6 +50,7 @@ $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -
- $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
-+$(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
-@@ -86,7 +87,8 @@ src-plat-y := of.c epapr.c
- src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
- treeboot-walnut.c cuboot-acadia.c \
- cuboot-kilauea.c simpleboot.c \
-- virtex405-head.S virtex.c
-+ virtex405-head.S virtex.c \
-+ cuboot-magicbox.c
- src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
- cuboot-bamboo.c cuboot-sam440ep.c \
- cuboot-sequoia.c cuboot-rainier.c \
-@@ -238,6 +240,7 @@ image-$(CONFIG_HOTFOOT) += cuImage.hot
- image-$(CONFIG_WALNUT) += treeImage.walnut
- image-$(CONFIG_ACADIA) += cuImage.acadia
- image-$(CONFIG_OBS600) += uImage.obs600
-+image-$(CONFIG_MAGICBOX) += cuImage.magicbox
-
- # Board ports in arch/powerpc/platform/44x/Kconfig
- image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
---- a/arch/powerpc/platforms/40x/Kconfig
-+++ b/arch/powerpc/platforms/40x/Kconfig
-@@ -37,6 +37,16 @@ config KILAUEA
- help
- This option enables support for the AMCC PPC405EX evaluation board.
-
-+config MAGICBOX
-+ bool "Magicbox"
-+ depends on 40x
-+ default n
-+ select PPC40x_SIMPLE
-+ select 405EP
-+ select PCI
-+ help
-+ This option enables support for the Magicbox boards.
-+
- config MAKALU
- bool "Makalu"
- depends on 40x
---- a/arch/powerpc/platforms/40x/ppc40x_simple.c
-+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
-@@ -58,6 +58,7 @@ static const char * const board[] __init
- "apm,klondike",
- "est,hotfoot",
- "plathome,obs600",
-+ "magicbox",
- NULL
- };
-
diff --git a/target/linux/ppc40x/patches-3.18/005-openrb.patch b/target/linux/ppc40x/patches-3.18/005-openrb.patch
deleted file mode 100644
index a21d9fa725..0000000000
--- a/target/linux/ppc40x/patches-3.18/005-openrb.patch
+++ /dev/null
@@ -1,447 +0,0 @@
---- /dev/null
-+++ b/arch/powerpc/boot/cuboot-openrb.c
-@@ -0,0 +1,94 @@
-+/*
-+ * Old U-boot compatibility for OpenRB boards
-+ *
-+ * Author: Gabor Juhos <juhosg@openwrt.org>
-+ * Imre Kaloz <kaloz@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include "ops.h"
-+#include "io.h"
-+#include "dcr.h"
-+#include "stdio.h"
-+#include "4xx.h"
-+#include "44x.h"
-+#include "cuboot.h"
-+
-+#define TARGET_4xx
-+#define TARGET_405EP
-+#include "ppcboot.h"
-+
-+static bd_t bd;
-+
-+static void fixup_perwe(void)
-+{
-+#define DCRN_CPC0_PCI_BASE 0xf9
-+
-+ /* Turn on PerWE instead of PCIINT */
-+ mtdcr(DCRN_CPC0_PCI_BASE,
-+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
-+
-+#undef DCRN_CPC0_PCI_BASE
-+}
-+
-+static void fixup_cf_card(void)
-+{
-+#define CF_CS0_BASE 0xff100000
-+#define CF_CS1_BASE 0xff200000
-+
-+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+#undef CF_CS0_BASE
-+#undef CF_CS1_BASE
-+}
-+
-+static void fixup_isp116x(void)
-+{
-+#define ISP116X_CS_BASE 0xf0000000
-+
-+ /* PerCS3 (ISP1160's CS): base 0xf0000000, size 32MB, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, ISP116X_CS_BASE | EBC_BXCR_BS_32M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x03016600);
-+
-+#undef ISP116X_CS_BASE
-+}
-+
-+static void openrb_fixups(void)
-+{
-+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8);
-+ ibm4xx_sdram_fixup_memsize();
-+
-+ fixup_perwe();
-+ fixup_cf_card();
-+ fixup_isp116x();
-+
-+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
-+}
-+
-+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
-+ unsigned long r6, unsigned long r7)
-+{
-+ CUBOOT_INIT();
-+ platform_ops.fixups = openrb_fixups;
-+ platform_ops.exit = ibm40x_dbcr_reset;
-+ fdt_init(_dtb_start);
-+ serial_console_init();
-+}
---- /dev/null
-+++ b/arch/powerpc/boot/dts/openrb.dts
-@@ -0,0 +1,291 @@
-+/*
-+ * Device Tree Source for OpenRB boards
-+ *
-+ * Copyright 2009 Gabor Juhos <juhosg@openwrt.org>
-+ * Copyright 2009 Imre Kaloz <kaloz@openwrt.org>
-+ *
-+ * Based on walnut.dts
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without
-+ * any warranty of any kind, whether express or implied.
-+ */
-+
-+/dts-v1/;
-+
-+/ {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ model = "openrb";
-+ compatible = "openrb";
-+ dcr-parent = <&{/cpus/cpu@0}>;
-+
-+ aliases {
-+ ethernet0 = &EMAC0;
-+ ethernet1 = &EMAC1;
-+ serial0 = &UART0;
-+ serial1 = &UART1;
-+ };
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu@0 {
-+ device_type = "cpu";
-+ model = "PowerPC,405EP";
-+ reg = <0x00000000>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ timebase-frequency = <0>; /* Filled in by zImage */
-+ i-cache-line-size = <0x20>;
-+ d-cache-line-size = <0x20>;
-+ i-cache-size = <0x4000>;
-+ d-cache-size = <0x4000>;
-+ dcr-controller;
-+ dcr-access-method = "native";
-+ };
-+ };
-+
-+ memory {
-+ device_type = "memory";
-+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */
-+ };
-+
-+ UIC0: interrupt-controller {
-+ compatible = "ibm,uic";
-+ interrupt-controller;
-+ cell-index = <0>;
-+ dcr-reg = <0x0c0 0x009>;
-+ #address-cells = <0>;
-+ #size-cells = <0>;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ plb {
-+ compatible = "ibm,plb3";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ SDRAM0: memory-controller {
-+ compatible = "ibm,sdram-405ep";
-+ dcr-reg = <0x010 0x002>;
-+ };
-+
-+ MAL: mcmal {
-+ compatible = "ibm,mcmal-405ep", "ibm,mcmal";
-+ dcr-reg = <0x180 0x062>;
-+ num-tx-chans = <4>;
-+ num-rx-chans = <2>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xb 0x4 /* TXEOB */
-+ 0xc 0x4 /* RXEOB */
-+ 0xa 0x4 /* SERR */
-+ 0xd 0x4 /* TXDE */
-+ 0xe 0x4 /* RXDE */>;
-+ };
-+
-+ POB0: opb {
-+ compatible = "ibm,opb-405ep", "ibm,opb";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges = <0xef600000 0xef600000 0x00a00000>;
-+ dcr-reg = <0x0a0 0x005>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ UART0: serial@ef600300 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600300 0x00000008>;
-+ virtual-reg = <0xef600300>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x0 0x4>;
-+ };
-+
-+ UART1: serial@ef600400 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600400 0x00000008>;
-+ virtual-reg = <0xef600400>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1 0x4>;
-+ };
-+
-+ IIC: i2c@ef600500 {
-+ compatible = "ibm,iic-405ep", "ibm,iic";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0xef600500 0x00000011>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x2 0x4>;
-+
-+ eeprom@50 {
-+ compatible = "at24,24c16";
-+ reg = <0x50>;
-+ };
-+ };
-+
-+ GPIO0: gpio-controller@ef600700 {
-+ compatible = "ibm,ppc4xx-gpio";
-+ reg = <0xef600700 0x00000020>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ EMAC0: ethernet@ef600800 {
-+ linux,network-index = <0x0>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xf 0x4 /* Ethernet */
-+ 0x9 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600800 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <0>;
-+ mal-rx-channel = <0>;
-+ cell-index = <0>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000000>;
-+ };
-+
-+ EMAC1: ethernet@ef600900 {
-+ linux,network-index = <0x1>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0x11 0x4 /* Ethernet */
-+ 0x09 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600900 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <2>;
-+ mal-rx-channel = <1>;
-+ cell-index = <1>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ mdio-device = <&EMAC0>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000001>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+ user {
-+ label = "openrb:green:user";
-+ gpios = <&GPIO0 2 1>;
-+ };
-+ };
-+ };
-+
-+ EBC0: ebc {
-+ compatible = "ibm,ebc-405ep", "ibm,ebc";
-+ dcr-reg = <0x012 0x002>;
-+ #address-cells = <2>;
-+ #size-cells = <1>;
-+ /* The ranges property is supplied by the bootwrapper
-+ * and is based on the firmware's configuration of the
-+ * EBC bridge
-+ */
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ isp116x@f0000000 {
-+ compatible = "isp116x-hcd";
-+ oc_enable;
-+ int_act_high;
-+ int_edge_triggered;
-+ reg = <0x00000000 0xf0000000 0x00000002 /* data */
-+ 0x00000000 0xf1000000 0x00000002 /* addr */ >;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1b 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ cf_card@ff100000 {
-+ compatible = "magicbox-cf", "pata-magicbox-cf";
-+ reg = <0x00000000 0xff100000 0x00001000
-+ 0x00000000 0xff200000 0x00001000>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ nor_flash@ff800000 {
-+ compatible = "cfi-flash";
-+ bank-width = <2>;
-+ reg = <0x00000000 0xff800000 0x00800000>;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ partition0@0 {
-+ label = "linux";
-+ reg = <0x0 0x160000>;
-+ };
-+ partition1@120000 {
-+ label = "rootfs";
-+ reg = <0x160000 0x660000>;
-+ };
-+ partition2@7c0000 {
-+ label = "u-boot";
-+ reg = <0x7c0000 0x30000>;
-+ read-only;
-+ };
-+ partition3@0 {
-+ label = "firmware";
-+ reg = <0x0 0x7c0000>;
-+ };
-+ };
-+ };
-+
-+ PCI0: pci@ec000000 {
-+ device_type = "pci";
-+ #interrupt-cells = <1>;
-+ #size-cells = <2>;
-+ #address-cells = <3>;
-+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
-+ primary;
-+ reg = <0xeec00000 0x00000008 /* Config space access */
-+ 0xeed80000 0x00000004 /* IACK */
-+ 0xeed80000 0x00000004 /* Special cycle */
-+ 0xef480000 0x00000040>; /* Internal registers */
-+
-+ /* Outbound ranges, one memory and one IO,
-+ * later cannot be changed. Chip supports a second
-+ * IO range but we don't use it for now
-+ */
-+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
-+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
-+
-+ /* Inbound 2GB range starting at 0 */
-+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
-+
-+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
-+ interrupt-map = <
-+ /* IDSEL 1 */
-+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
-+
-+ /* IDSEL 2 */
-+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
-+
-+ /* IDSEL 3 */
-+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
-+
-+ /* IDSEL 4 */
-+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
-+ >;
-+ };
-+ };
-+
-+ chosen {
-+ linux,stdout-path = "/plb/opb/serial@ef600300";
-+ };
-+};
---- a/arch/powerpc/boot/Makefile
-+++ b/arch/powerpc/boot/Makefile
-@@ -51,6 +51,7 @@ $(obj)/cuboot-taishan.o: BOOTCFLAGS += -
- $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
- $(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405
-+$(obj)/cuboot-openrb.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
-@@ -88,7 +89,7 @@ src-plat-$(CONFIG_40x) += fixed-head.S e
- treeboot-walnut.c cuboot-acadia.c \
- cuboot-kilauea.c simpleboot.c \
- virtex405-head.S virtex.c \
-- cuboot-magicbox.c
-+ cuboot-magicbox.c cuboot-openrb
- src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
- cuboot-bamboo.c cuboot-sam440ep.c \
- cuboot-sequoia.c cuboot-rainier.c \
-@@ -241,6 +242,7 @@ image-$(CONFIG_WALNUT) += treeImage.wa
- image-$(CONFIG_ACADIA) += cuImage.acadia
- image-$(CONFIG_OBS600) += uImage.obs600
- image-$(CONFIG_MAGICBOX) += cuImage.magicbox
-+image-$(CONFIG_OPENRB) += cuImage.openrb
-
- # Board ports in arch/powerpc/platform/44x/Kconfig
- image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
---- a/arch/powerpc/platforms/40x/Kconfig
-+++ b/arch/powerpc/platforms/40x/Kconfig
-@@ -47,6 +47,16 @@ config MAGICBOX
- help
- This option enables support for the Magicbox boards.
-
-+config OPENRB
-+ bool "OpenRB"
-+ depends on 40x
-+ default n
-+ select PPC40x_SIMPLE
-+ select 405EP
-+ select PCI
-+ help
-+ This option enables support for the OpenRB boards.
-+
- config MAKALU
- bool "Makalu"
- depends on 40x
---- a/arch/powerpc/platforms/40x/ppc40x_simple.c
-+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
-@@ -59,6 +59,7 @@ static const char * const board[] __init
- "est,hotfoot",
- "plathome,obs600",
- "magicbox",
-+ "openrb",
- NULL
- };
-
diff --git a/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch b/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch
deleted file mode 100644
index d0e89b7139..0000000000
--- a/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch
+++ /dev/null
@@ -1,433 +0,0 @@
---- a/drivers/ata/Kconfig
-+++ b/drivers/ata/Kconfig
-@@ -234,6 +234,16 @@ config PDC_ADMA
-
- If unsure, say N.
-
-+config PATA_MAGICBOX_CF
-+ tristate "Magicbox/OpenRB Compact Flash support"
-+ depends on MAGICBOX || OPENRB
-+ help
-+ This option enables support for a Compact Flash conected on
-+ the ppc405ep expansion bus. This driver had been written for
-+ the Magicbox v2 and OpenRB boards.
-+
-+ If unsure, say N.
-+
- config PATA_OCTEON_CF
- tristate "OCTEON Boot Bus Compact Flash support"
- depends on CAVIUM_OCTEON_SOC
---- a/drivers/ata/Makefile
-+++ b/drivers/ata/Makefile
-@@ -91,6 +91,7 @@ obj-$(CONFIG_PATA_AT91) += pata_at91.o
- obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o
- obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o
- obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
-+obj-$(CONFIG_PATA_MAGICBOX_CF) += pata_magicbox_cf.o
- obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o
- obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o
- obj-$(CONFIG_PATA_OPTI) += pata_opti.o
---- /dev/null
-+++ b/drivers/ata/pata_magicbox_cf.c
-@@ -0,0 +1,401 @@
-+/*
-+ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards.
-+ *
-+ * Copyright (C) 2009,2012 Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * Based on the IDE driver by Wojtek Kaniewski <wojtekka@toxygen.net>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+#include <linux/types.h>
-+#include <linux/ioport.h>
-+#include <linux/libata.h>
-+#include <linux/irq.h>
-+//#include <linux/of.h>
-+//#include <linux/of_device.h>
-+#include <linux/of_platform.h>
-+#include <scsi/scsi_host.h>
-+
-+#define DRV_DESC "PATA/CompactFlash driver for Magicbox/OpenRB boards"
-+#define DRV_NAME "pata_magicbox_cf"
-+#define DRV_VERSION "0.1.0"
-+
-+#define MAGICBOX_CF_REG_CMD (2 * ATA_REG_CMD)
-+#define MAGICBOX_CF_REG_DATA (2 * ATA_REG_DATA)
-+#define MAGICBOX_CF_REG_ERR (2 * ATA_REG_ERR)
-+#define MAGICBOX_CF_REG_FEATURE (2 * ATA_REG_FEATURE)
-+#define MAGICBOX_CF_REG_NSECT (2 * ATA_REG_NSECT)
-+#define MAGICBOX_CF_REG_LBAL (2 * ATA_REG_LBAL)
-+#define MAGICBOX_CF_REG_LBAM (2 * ATA_REG_LBAM)
-+#define MAGICBOX_CF_REG_LBAH (2 * ATA_REG_LBAH)
-+#define MAGICBOX_CF_REG_DEVICE (2 * ATA_REG_DEVICE)
-+#define MAGICBOX_CF_REG_STATUS (2 * ATA_REG_STATUS)
-+#define MAGICBOX_CF_REG_ALTSTATUS (2 * 6)
-+#define MAGICBOX_CF_REG_CTL (2 * 6)
-+
-+#define MAGICBOX_CF_MAXPORTS 1
-+
-+struct magicbox_cf_info {
-+ void __iomem *base;
-+ void __iomem *ctrl;
-+};
-+
-+static inline u8 magicbox_cf_inb(void __iomem *port)
-+{
-+ return (u8) (readw(port) >> 8) & 0xff;
-+}
-+
-+static inline void magicbox_cf_outb(void __iomem *port, u8 value)
-+{
-+ writew(value << 8, port);
-+}
-+
-+static int magicbox_cf_set_mode(struct ata_link *link,
-+ struct ata_device **error)
-+{
-+ struct ata_device *dev;
-+
-+ ata_for_each_dev(dev, link, ENABLED) {
-+ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
-+ dev->pio_mode = XFER_PIO_0;
-+ dev->xfer_mode = XFER_PIO_0;
-+ dev->xfer_shift = ATA_SHIFT_PIO;
-+ dev->flags |= ATA_DFLAG_PIO;
-+ }
-+
-+ return 0;
-+}
-+
-+static void magicbox_cf_exec_command(struct ata_port *ap,
-+ const struct ata_taskfile *tf)
-+{
-+ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
-+
-+ magicbox_cf_outb(ap->ioaddr.command_addr, tf->command);
-+ ata_sff_pause(ap);
-+}
-+
-+static u8 magicbox_cf_check_status(struct ata_port *ap)
-+{
-+ u8 status;
-+
-+ status = magicbox_cf_inb(ap->ioaddr.status_addr);
-+
-+ DPRINTK("ata%u: status 0x%X, from %p\n", ap->print_id, status,
-+ ap->ioaddr.status_addr);
-+
-+ return status;
-+}
-+
-+static u8 magicbox_cf_check_altstatus(struct ata_port *ap)
-+{
-+ u8 altstatus;
-+
-+ altstatus = magicbox_cf_inb(ap->ioaddr.altstatus_addr);
-+
-+ DPRINTK("ata%u: altstatus 0x%X, from %p\n", ap->print_id,
-+ altstatus, ap->ioaddr.altstatus_addr);
-+
-+ return altstatus;
-+}
-+
-+static void magicbox_cf_dev_select(struct ata_port *ap, unsigned int device)
-+{
-+ /* Nothing to do. We are supporting one device only. */
-+}
-+
-+static void magicbox_cf_tf_load(struct ata_port *ap,
-+ const struct ata_taskfile *tf)
-+{
-+ struct ata_ioports *ioaddr = &ap->ioaddr;
-+ unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
-+
-+ if (tf->ctl != ap->last_ctl) {
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl);
-+ ap->last_ctl = tf->ctl;
-+ ata_wait_idle(ap);
-+ }
-+
-+ if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
-+ magicbox_cf_outb(ioaddr->feature_addr, tf->hob_feature);
-+ magicbox_cf_outb(ioaddr->nsect_addr, tf->hob_nsect);
-+ magicbox_cf_outb(ioaddr->lbal_addr, tf->hob_lbal);
-+ magicbox_cf_outb(ioaddr->lbam_addr, tf->hob_lbam);
-+ magicbox_cf_outb(ioaddr->lbah_addr, tf->hob_lbah);
-+ VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-+ tf->hob_feature,
-+ tf->hob_nsect,
-+ tf->hob_lbal,
-+ tf->hob_lbam,
-+ tf->hob_lbah);
-+ }
-+
-+ if (is_addr) {
-+ magicbox_cf_outb(ioaddr->feature_addr, tf->feature);
-+ magicbox_cf_outb(ioaddr->nsect_addr, tf->nsect);
-+ magicbox_cf_outb(ioaddr->lbal_addr, tf->lbal);
-+ magicbox_cf_outb(ioaddr->lbam_addr, tf->lbam);
-+ magicbox_cf_outb(ioaddr->lbah_addr, tf->lbah);
-+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+ }
-+
-+ if (tf->flags & ATA_TFLAG_DEVICE) {
-+ magicbox_cf_outb(ioaddr->device_addr, tf->device);
-+ VPRINTK("device 0x%X\n", tf->device);
-+ }
-+
-+ ata_wait_idle(ap);
-+}
-+
-+static void magicbox_cf_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
-+{
-+ struct ata_ioports *ioaddr = &ap->ioaddr;
-+
-+ tf->command = magicbox_cf_inb(ap->ioaddr.status_addr);
-+ tf->feature = magicbox_cf_inb(ioaddr->error_addr);
-+ tf->nsect = magicbox_cf_inb(ioaddr->nsect_addr);
-+ tf->lbal = magicbox_cf_inb(ioaddr->lbal_addr);
-+ tf->lbam = magicbox_cf_inb(ioaddr->lbam_addr);
-+ tf->lbah = magicbox_cf_inb(ioaddr->lbah_addr);
-+ tf->device = magicbox_cf_inb(ioaddr->device_addr);
-+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+
-+ if (tf->flags & ATA_TFLAG_LBA48) {
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl | ATA_HOB);
-+ tf->hob_feature = magicbox_cf_inb(ioaddr->error_addr);
-+ tf->hob_nsect = magicbox_cf_inb(ioaddr->nsect_addr);
-+ tf->hob_lbal = magicbox_cf_inb(ioaddr->lbal_addr);
-+ tf->hob_lbam = magicbox_cf_inb(ioaddr->lbam_addr);
-+ tf->hob_lbah = magicbox_cf_inb(ioaddr->lbah_addr);
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl);
-+ ap->last_ctl = tf->ctl;
-+ VPRINTK("hob: feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+ }
-+}
-+
-+static unsigned int magicbox_cf_data_xfer(struct ata_device *dev,
-+ unsigned char *buf,
-+ unsigned int buflen, int rw)
-+{
-+ struct ata_port *ap = dev->link->ap;
-+ unsigned int words = buflen >> 1;
-+ unsigned int i;
-+ u16 *buf16 = (u16 *) buf;
-+ void __iomem *mmio = ap->ioaddr.data_addr;
-+
-+ /* Transfer multiple of 2 bytes */
-+ if (rw == READ)
-+ for (i = 0; i < words; i++)
-+ buf16[i] = readw(mmio);
-+ else
-+ for (i = 0; i < words; i++)
-+ writew(buf16[i], mmio);
-+
-+ /* Transfer trailing 1 byte, if any. */
-+ if (unlikely(buflen & 0x01)) {
-+ u16 align_buf[1] = { 0 };
-+ unsigned char *trailing_buf = buf + buflen - 1;
-+
-+ if (rw == READ) {
-+ align_buf[0] = readw(mmio);
-+ memcpy(trailing_buf, align_buf, 1);
-+ } else {
-+ memcpy(align_buf, trailing_buf, 1);
-+ writew(align_buf[0], mmio);
-+ }
-+ words++;
-+ }
-+
-+ return words << 1;
-+}
-+
-+static void magicbox_cf_irq_on(struct ata_port *ap)
-+{
-+ /* Nothing to do. */
-+}
-+
-+static void magicbox_cf_irq_clear(struct ata_port *ap)
-+{
-+ /* Nothing to do. */
-+}
-+
-+static struct ata_port_operations magicbox_cf_port_ops = {
-+ .inherits = &ata_sff_port_ops,
-+
-+ .cable_detect = ata_cable_40wire,
-+ .set_mode = magicbox_cf_set_mode,
-+
-+ .sff_exec_command = magicbox_cf_exec_command,
-+ .sff_check_status = magicbox_cf_check_status,
-+ .sff_check_altstatus = magicbox_cf_check_altstatus,
-+ .sff_dev_select = magicbox_cf_dev_select,
-+ .sff_tf_load = magicbox_cf_tf_load,
-+ .sff_tf_read = magicbox_cf_tf_read,
-+ .sff_data_xfer = magicbox_cf_data_xfer,
-+
-+ .sff_irq_on = magicbox_cf_irq_on,
-+ .sff_irq_clear = magicbox_cf_irq_clear,
-+
-+ .port_start = ATA_OP_NULL,
-+};
-+
-+static struct scsi_host_template magicbox_cf_sht = {
-+ ATA_PIO_SHT(DRV_NAME),
-+};
-+
-+static inline void magicbox_cf_setup_port(struct ata_host *host)
-+{
-+ struct magicbox_cf_info *info = host->private_data;
-+ struct ata_port *ap;
-+
-+ ap = host->ports[0];
-+
-+ ap->ops = &magicbox_cf_port_ops;
-+ ap->pio_mask = ATA_PIO4;
-+ ap->flags |= ATA_FLAG_NO_ATAPI;
-+
-+ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD;
-+ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA;
-+ ap->ioaddr.error_addr = info->base + MAGICBOX_CF_REG_ERR;
-+ ap->ioaddr.feature_addr = info->base + MAGICBOX_CF_REG_FEATURE;
-+ ap->ioaddr.nsect_addr = info->base + MAGICBOX_CF_REG_NSECT;
-+ ap->ioaddr.lbal_addr = info->base + MAGICBOX_CF_REG_LBAL;
-+ ap->ioaddr.lbam_addr = info->base + MAGICBOX_CF_REG_LBAM;
-+ ap->ioaddr.lbah_addr = info->base + MAGICBOX_CF_REG_LBAH;
-+ ap->ioaddr.device_addr = info->base + MAGICBOX_CF_REG_DEVICE;
-+ ap->ioaddr.status_addr = info->base + MAGICBOX_CF_REG_STATUS;
-+ ap->ioaddr.command_addr = info->base + MAGICBOX_CF_REG_CMD;
-+
-+ ap->ioaddr.altstatus_addr = info->ctrl + MAGICBOX_CF_REG_ALTSTATUS;
-+ ap->ioaddr.ctl_addr = info->ctrl + MAGICBOX_CF_REG_CTL;
-+
-+ ata_port_desc(ap, "cmd 0x%p ctl 0x%p", ap->ioaddr.cmd_addr,
-+ ap->ioaddr.ctl_addr);
-+}
-+
-+static int magicbox_cf_of_probe(struct platform_device *op)
-+{
-+ struct magicbox_cf_info *info;
-+ struct ata_host *host;
-+ int irq;
-+ int ret = 0;
-+
-+ info = kzalloc(sizeof(struct magicbox_cf_info), GFP_KERNEL);
-+ if (info == NULL) {
-+ ret = -ENOMEM;
-+ goto err_exit;
-+ }
-+
-+ irq = irq_of_parse_and_map(op->dev.of_node, 0);
-+ if (irq < 0) {
-+ dev_err(&op->dev, "invalid irq\n");
-+ ret = -EINVAL;
-+ goto err_free_info;
-+ }
-+
-+ info->base = of_iomap(op->dev.of_node, 0);
-+ if (info->base == NULL) {
-+ ret = -ENOMEM;
-+ goto err_free_info;
-+ }
-+
-+ info->ctrl = of_iomap(op->dev.of_node, 1);
-+ if (info->ctrl == NULL) {
-+ ret = -ENOMEM;
-+ goto err_unmap_base;
-+ }
-+
-+ host = ata_host_alloc(&op->dev, MAGICBOX_CF_MAXPORTS);
-+ if (host == NULL) {
-+ ret = -ENOMEM;
-+ goto err_unmap_ctrl;
-+ }
-+
-+ host->private_data = info;
-+ magicbox_cf_setup_port(host);
-+
-+ ret = ata_host_activate(host, irq, ata_sff_interrupt,
-+ IRQF_TRIGGER_RISING, &magicbox_cf_sht);
-+ if (ret)
-+ goto err_unmap_ctrl;
-+
-+ dev_set_drvdata(&op->dev, host);
-+ return 0;
-+
-+ err_unmap_ctrl:
-+ iounmap(info->ctrl);
-+ err_unmap_base:
-+ iounmap(info->base);
-+ err_free_info:
-+ kfree(info);
-+ err_exit:
-+ return ret;
-+}
-+
-+static int magicbox_cf_of_remove(struct platform_device *op)
-+{
-+ struct ata_host *host = dev_get_drvdata(&op->dev);
-+ struct magicbox_cf_info *info = host->private_data;
-+
-+ ata_host_detach(host);
-+ iounmap(info->ctrl);
-+ iounmap(info->base);
-+ kfree(info);
-+
-+ return 0;
-+}
-+
-+static struct of_device_id magicbox_cf_of_match[] = {
-+ { .compatible = "pata-magicbox-cf", },
-+ {},
-+};
-+
-+static struct platform_driver magicbox_cf_of_platform_driver = {
-+ .probe = magicbox_cf_of_probe,
-+ .remove = magicbox_cf_of_remove,
-+ .driver = {
-+ .name = DRV_NAME,
-+ .owner = THIS_MODULE,
-+ .of_match_table = magicbox_cf_of_match,
-+ },
-+};
-+
-+static int __init magicbox_cf_init(void)
-+{
-+ return platform_driver_register(&magicbox_cf_of_platform_driver);
-+}
-+
-+static void __exit magicbox_cf_exit(void)
-+{
-+ platform_driver_unregister(&magicbox_cf_of_platform_driver);
-+}
-+
-+module_init(magicbox_cf_init);
-+module_exit(magicbox_cf_exit);
-+
-+MODULE_DESCRIPTION(DRV_DESC);
-+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-+MODULE_LICENSE("GPL v2");
-+MODULE_VERSION(DRV_VERSION);
-+MODULE_DEVICE_TABLE(of, magicbox_cf_of_match);
diff --git a/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch b/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch
deleted file mode 100644
index ab44a2d572..0000000000
--- a/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch
+++ /dev/null
@@ -1,55 +0,0 @@
---- a/arch/powerpc/boot/dts/kilauea.dts
-+++ b/arch/powerpc/boot/dts/kilauea.dts
-@@ -102,8 +102,8 @@
- compatible = "ibm,sdram-405ex", "ibm,sdram-4xx-ddr2";
- dcr-reg = <0x010 0x002>;
- interrupt-parent = <&UIC2>;
-- interrupts = <0x5 0x4 /* ECC DED Error */
-- 0x6 0x4>; /* ECC SEC Error */
-+ interrupts = <0x5 0x4 /* ECC DED Error */
-+ 0x6 0x4>; /* ECC SEC Error */
- };
-
- CRYPTO: crypto@ef700000 {
-@@ -157,30 +157,30 @@
- reg = <0x00000000 0x00000000 0x04000000>;
- #address-cells = <1>;
- #size-cells = <1>;
-- partition@0 {
-+ partition0@0 {
- label = "kernel";
- reg = <0x00000000 0x001e0000>;
- };
-- partition@1e0000 {
-+ partition1@1e0000 {
- label = "dtb";
- reg = <0x001e0000 0x00020000>;
- };
-- partition@200000 {
-- label = "root";
-- reg = <0x00200000 0x00200000>;
-- };
-- partition@400000 {
-- label = "user";
-- reg = <0x00400000 0x03b60000>;
-+ partition2@200000 {
-+ label = "rootfs";
-+ reg = <0x00200000 0x03d60000>;
- };
-- partition@3f60000 {
-+ partition3@3f60000 {
- label = "env";
- reg = <0x03f60000 0x00040000>;
- };
-- partition@3fa0000 {
-+ partition4@3fa0000 {
- label = "u-boot";
- reg = <0x03fa0000 0x00060000>;
- };
-+ partition5@0 {
-+ label = "firmware";
-+ reg = <0x00000000 0x03f60000>;
-+ };
- };
-
- ndfc@1,0 {
diff --git a/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch b/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch
deleted file mode 100644
index e7639d6b4c..0000000000
--- a/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch
+++ /dev/null
@@ -1,290 +0,0 @@
---- a/drivers/usb/host/isp116x-hcd.c
-+++ b/drivers/usb/host/isp116x-hcd.c
-@@ -1533,6 +1533,7 @@ static struct hc_driver isp116x_hc_drive
-
- /*----------------------------------------------------------------*/
-
-+#ifdef CONFIG_USB_ISP116X_HCD_PLATFORM
- static int isp116x_remove(struct platform_device *pdev)
- {
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
-@@ -1711,4 +1712,251 @@ static struct platform_driver isp116x_dr
- },
- };
-
--module_platform_driver(isp116x_driver);
-+static inline int isp116x_platform_register(void)
-+{
-+ return platform_driver_register(&isp116x_driver);
-+}
-+
-+static inline void isp116x_platform_unregister(void)
-+{
-+ platform_driver_unregister(&isp116x_driver);
-+}
-+#else
-+static inline int isp116x_platform_register(void) { return 0; };
-+static void isp116x_platform_unregister(void) {};
-+#endif /* CONFIG_USB_ISP116X_PLATFORM */
-+
-+/*-----------------------------------------------------------------*/
-+
-+#ifdef CONFIG_USB_ISP116X_HCD_OF
-+
-+/* TODO: rework platform probe instead of using a separate probe */
-+
-+#include <linux/of_platform.h>
-+
-+#ifdef USE_PLATFORM_DELAY
-+static void isp116x_of_delay(struct device *ddev, int delay)
-+{
-+ ndelay(delay);
-+}
-+#else
-+#define isp116x_of_delay NULL
-+#endif
-+
-+static int isp116x_of_probe(struct platform_device *op)
-+{
-+ struct device_node *dn = op->dev.of_node;
-+ struct usb_hcd *hcd;
-+ struct isp116x *isp116x;
-+ struct resource addr, data;
-+ struct isp116x_platform_data *board;
-+ void __iomem *addr_reg;
-+ void __iomem *data_reg;
-+ int irq;
-+ int ret = 0;
-+ unsigned long irqflags;
-+
-+ ret = of_address_to_resource(dn, 0, &data);
-+ if (ret)
-+ return ret;
-+
-+ ret = of_address_to_resource(dn, 1, &addr);
-+ if (ret)
-+ return ret;
-+
-+ board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL);
-+ if (board == NULL)
-+ return -ENOMEM;
-+
-+ if (!request_mem_region(addr.start, resource_size(&addr), hcd_name)) {
-+ ret = -EBUSY;
-+ goto err_free_board;
-+ }
-+
-+ addr_reg = ioremap_nocache(addr.start, resource_size(&addr));
-+ if (addr_reg == NULL) {
-+ ret = -ENOMEM;
-+ goto err_release_addr;
-+ }
-+
-+ if (!request_mem_region(data.start, resource_size(&data), hcd_name)) {
-+ ret = -EBUSY;
-+ goto err_unmap_addr;
-+ }
-+
-+ data_reg = ioremap_nocache(data.start, resource_size(&data));
-+ if (data_reg == NULL) {
-+ ret = -ENOMEM;
-+ goto err_release_data;
-+ }
-+
-+ irq = irq_of_parse_and_map(dn, 0);
-+ if (irq == NO_IRQ) {
-+ ret = -EINVAL;
-+ goto err_unmap_data;
-+ }
-+
-+ /* allocate and initialize hcd */
-+ hcd = usb_create_hcd(&isp116x_hc_driver, &op->dev, dev_name(&op->dev));
-+ if (!hcd) {
-+ ret = -ENOMEM;
-+ goto err_irq_dispose;
-+ }
-+
-+ /* this rsrc_start is bogus */
-+ hcd->rsrc_start = addr.start;
-+ isp116x = hcd_to_isp116x(hcd);
-+ isp116x->data_reg = data_reg;
-+ isp116x->addr_reg = addr_reg;
-+ isp116x->board = board;
-+ spin_lock_init(&isp116x->lock);
-+ INIT_LIST_HEAD(&isp116x->async);
-+
-+ board->delay = isp116x_of_delay;
-+ if (of_get_property(dn, "sel15Kres", NULL))
-+ board->sel15Kres = 1;
-+ if (of_get_property(dn, "oc_enable", NULL))
-+ board->oc_enable = 1;
-+ if (of_get_property(dn, "remote_wakeup_enable", NULL))
-+ board->remote_wakeup_enable = 1;
-+
-+ if (of_get_property(dn, "int_act_high", NULL))
-+ board->int_act_high = 1;
-+ if (of_get_property(dn, "int_edge_triggered", NULL))
-+ board->int_edge_triggered = 1;
-+
-+ if (board->int_edge_triggered)
-+ irqflags = board->int_act_high ? IRQF_TRIGGER_RISING :
-+ IRQF_TRIGGER_FALLING;
-+ else
-+ irqflags = board->int_act_high ? IRQF_TRIGGER_HIGH :
-+ IRQF_TRIGGER_LOW;
-+
-+ ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED);
-+ if (ret)
-+ goto err_put_hcd;
-+
-+ ret = create_debug_file(isp116x);
-+ if (ret) {
-+ ERR("Couldn't create debugfs entry\n");
-+ goto err_remove_hcd;
-+ }
-+
-+ return 0;
-+
-+ err_remove_hcd:
-+ usb_remove_hcd(hcd);
-+ err_put_hcd:
-+ usb_put_hcd(hcd);
-+ err_irq_dispose:
-+ irq_dispose_mapping(irq);
-+ err_unmap_data:
-+ iounmap(data_reg);
-+ err_release_data:
-+ release_mem_region(data.start, resource_size(&data));
-+ err_unmap_addr:
-+ iounmap(addr_reg);
-+ err_release_addr:
-+ release_mem_region(addr.start, resource_size(&addr));
-+ err_free_board:
-+ kfree(board);
-+ return ret;
-+}
-+
-+static int isp116x_of_remove(struct platform_device *op)
-+{
-+ struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
-+ struct isp116x *isp116x;
-+ struct resource res;
-+
-+ if (!hcd)
-+ return 0;
-+
-+ dev_set_drvdata(&op->dev, NULL);
-+
-+ isp116x = hcd_to_isp116x(hcd);
-+ remove_debug_file(isp116x);
-+ usb_remove_hcd(hcd);
-+
-+ irq_dispose_mapping(hcd->irq);
-+
-+ iounmap(isp116x->data_reg);
-+ (void) of_address_to_resource(op->dev.of_node, 0, &res);
-+ release_mem_region(res.start, resource_size(&res));
-+
-+ iounmap(isp116x->addr_reg);
-+ (void) of_address_to_resource(op->dev.of_node, 1, &res);
-+ release_mem_region(res.start, resource_size(&res));
-+
-+ kfree(isp116x->board);
-+ usb_put_hcd(hcd);
-+
-+ return 0;
-+}
-+
-+static struct of_device_id isp116x_of_match[] = {
-+ { .compatible = "isp116x-hcd", },
-+ {},
-+};
-+
-+static struct platform_driver isp116x_of_platform_driver = {
-+ .probe = isp116x_of_probe,
-+ .remove = isp116x_of_remove,
-+ .driver = {
-+ .name = "isp116x-hcd-of",
-+ .owner = THIS_MODULE,
-+ .of_match_table = isp116x_of_match,
-+ },
-+};
-+
-+static int __init isp116x_of_register(void)
-+{
-+ return platform_driver_register(&isp116x_of_platform_driver);
-+}
-+
-+static void __exit isp116x_of_unregister(void)
-+{
-+ platform_driver_unregister(&isp116x_of_platform_driver);
-+}
-+
-+MODULE_DEVICE_TABLE(of, isp116x_of_match);
-+
-+#else
-+static inline int isp116x_of_register(void) { return 0; };
-+static void isp116x_of_unregister(void) {};
-+#endif /* CONFIG_USB_ISP116X_HCD_OF */
-+
-+/*-----------------------------------------------------------------*/
-+
-+static int __init isp116x_init(void)
-+{
-+ int ret;
-+
-+ if (usb_disabled())
-+ return -ENODEV;
-+
-+ INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
-+ ret = isp116x_platform_register();
-+ if (ret)
-+ return ret;
-+
-+ ret = isp116x_of_register();
-+ if (ret)
-+ goto err_platform_unregister;
-+
-+ return 0;
-+
-+ err_platform_unregister:
-+ isp116x_platform_unregister();
-+ return ret;
-+}
-+
-+module_init(isp116x_init);
-+
-+static void __exit isp116x_cleanup(void)
-+{
-+ isp116x_of_unregister();
-+ isp116x_platform_unregister();
-+}
-+
-+module_exit(isp116x_cleanup);
---- a/drivers/usb/host/Kconfig
-+++ b/drivers/usb/host/Kconfig
-@@ -327,6 +327,24 @@ config USB_ISP116X_HCD
- To compile this driver as a module, choose M here: the
- module will be called isp116x-hcd.
-
-+config USB_ISP116X_HCD_PLATFORM
-+ bool "ISP116X support for controllers on platform bus"
-+ depends on USB_ISP116X_HCD
-+ default n if PPC_OF
-+ default y
-+ ---help---
-+ Enables support for the ISP116x USB controller present on the
-+ platform bus.
-+
-+config USB_ISP116X_HCD_OF
-+ bool "ISP116X support for controllers on OF platform bus"
-+ depends on USB_ISP116X_HCD && PPC_OF
-+ default y if PPC_OF
-+ default n
-+ ---help---
-+ Enables support for the ISP116x USB controller present on the
-+ OpenFirmware platform bus.
-+
- config USB_ISP1760_HCD
- tristate "ISP 1760 HCD support"
- ---help---
diff --git a/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch b/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch
deleted file mode 100644
index 4fb47181bc..0000000000
--- a/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch
+++ /dev/null
@@ -1,110 +0,0 @@
---- a/drivers/usb/host/isp116x.h
-+++ b/drivers/usb/host/isp116x.h
-@@ -354,21 +354,63 @@ struct isp116x_ep {
- #define isp116x_check_platform_delay(h) 0
- #endif
-
-+#ifdef CONFIG_PPC
-+static inline void isp116x_writew(u16 val, void __iomem *addr)
-+{
-+ writew(cpu_to_le16(val), addr);
-+}
-+
-+static inline u16 isp116x_readw(void __iomem *addr)
-+{
-+ return le16_to_cpu(readw(addr));
-+}
-+
-+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
-+{
-+ writew(cpu_to_le16(val), addr);
-+}
-+
-+static inline u16 isp116x_raw_readw(void __iomem *addr)
-+{
-+ return le16_to_cpu(readw(addr));
-+}
-+#else
-+static inline void isp116x_writew(u16 val, void __iomem *addr)
-+{
-+ writew(val, addr);
-+}
-+
-+static inline u16 isp116x_readw(void __iomem *addr)
-+{
-+ return readw(addr);
-+}
-+
-+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
-+{
-+ __raw_writew(val, addr);
-+}
-+
-+static inline u16 isp116x_raw_readw(void __iomem *addr)
-+{
-+ return __raw_readw(addr);
-+}
-+#endif
-+
- static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
- {
-- writew(reg & 0xff, isp116x->addr_reg);
-+ isp116x_writew(reg & 0xff, isp116x->addr_reg);
- isp116x_delay(isp116x, 300);
- }
-
- static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val)
- {
-- writew(val, isp116x->data_reg);
-+ isp116x_writew(val, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
- static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val)
- {
-- __raw_writew(val, isp116x->data_reg);
-+ isp116x_raw_writew(val, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
-@@ -376,7 +418,7 @@ static inline u16 isp116x_read_data16(st
- {
- u16 val;
-
-- val = readw(isp116x->data_reg);
-+ val = isp116x_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- return val;
- }
-@@ -385,16 +427,16 @@ static inline u16 isp116x_raw_read_data1
- {
- u16 val;
-
-- val = __raw_readw(isp116x->data_reg);
-+ val = isp116x_raw_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- return val;
- }
-
- static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val)
- {
-- writew(val & 0xffff, isp116x->data_reg);
-+ isp116x_writew(val & 0xffff, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
-- writew(val >> 16, isp116x->data_reg);
-+ isp116x_writew(val >> 16, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
-@@ -402,9 +444,9 @@ static inline u32 isp116x_read_data32(st
- {
- u32 val;
-
-- val = (u32) readw(isp116x->data_reg);
-+ val = (u32) isp116x_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
-- val |= ((u32) readw(isp116x->data_reg)) << 16;
-+ val |= ((u32) isp116x_readw(isp116x->data_reg)) << 16;
- isp116x_delay(isp116x, 150);
- return val;
- }
diff --git a/target/linux/pxa/Makefile b/target/linux/pxa/Makefile
deleted file mode 100644
index 8536169ef1..0000000000
--- a/target/linux/pxa/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2006-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=pxa
-BOARDNAME:=Marvell/Intel PXA2xx
-FEATURES:=squashfs broken
-MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
-
-KERNEL_PATCHVER:=3.3
-
-include $(INCLUDE_DIR)/target.mk
-
-define Target/Description
- Build images for PXA2xx systems, eg. Gumstix.
-endef
-
-KERNELNAME:=uImage
-
-$(eval $(call BuildTarget))
diff --git a/target/linux/pxa/config-3.10 b/target/linux/pxa/config-3.10
deleted file mode 100644
index eff5a31faf..0000000000
--- a/target/linux/pxa/config-3.10
+++ /dev/null
@@ -1,230 +0,0 @@
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_GUMSTIX=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_CPUFREQ=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-# CONFIG_ARCH_LUBBOCK is not set
-CONFIG_ARCH_MTD_XIP=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_PXA=y
-# CONFIG_ARCH_PXA_ESERIES is not set
-# CONFIG_ARCH_PXA_IDP is not set
-# CONFIG_ARCH_PXA_PALM is not set
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_ARCH_VIPER is not set
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARM=y
-# CONFIG_ARM_APPENDED_DTB is not set
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_L1_CACHE_SHIFT=5
-CONFIG_ARM_NR_BANKS=8
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-# CONFIG_ARM_THUMB is not set
-# CONFIG_ARPD is not set
-CONFIG_ATAGS=y
-CONFIG_AUTO_ZRELADDR=y
-# CONFIG_BLK_DEV_INITRD is not set
-# CONFIG_CACHE_L2X0 is not set
-CONFIG_CACHE_XSC3L2=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
-CONFIG_CMDLINE_FROM_BOOTLOADER=y
-CONFIG_CPU_32v5=y
-CONFIG_CPU_ABRT_EV5T=y
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_VIVT=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_PABRT_LEGACY=y
-CONFIG_CPU_PXA300=y
-CONFIG_CPU_TLB_V4WBI=y
-CONFIG_CPU_USE_DOMAINS=y
-CONFIG_CPU_XSC3=y
-CONFIG_CPU_XSCALE=y
-CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_USER is not set
-CONFIG_DTC=y
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_EPOLL is not set
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_PXA=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_GENERIC_HARDIRQS=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_PWM=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_IO_36=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_WORK=y
-CONFIG_IWMMXT=y
-CONFIG_KTIME_SCALAR=y
-# CONFIG_MACH_ARCOM_ZEUS is not set
-# CONFIG_MACH_ARMCORE is not set
-# CONFIG_MACH_BALLOON3 is not set
-# CONFIG_MACH_CAPC7117 is not set
-# CONFIG_MACH_CM_X300 is not set
-# CONFIG_MACH_COLIBRI is not set
-# CONFIG_MACH_COLIBRI300 is not set
-# CONFIG_MACH_COLIBRI320 is not set
-# CONFIG_MACH_CSB726 is not set
-# CONFIG_MACH_EM_X270 is not set
-# CONFIG_MACH_EXEDA is not set
-# CONFIG_MACH_GUMSTIX_F is not set
-CONFIG_MACH_GUMSTIX_VERDEX=y
-# CONFIG_MACH_H4700 is not set
-# CONFIG_MACH_H5000 is not set
-# CONFIG_MACH_HIMALAYA is not set
-# CONFIG_MACH_ICONTROL is not set
-# CONFIG_MACH_INTELMOTE2 is not set
-# CONFIG_MACH_LITTLETON is not set
-# CONFIG_MACH_LOGICPD_PXA270 is not set
-# CONFIG_MACH_MAGICIAN is not set
-# CONFIG_MACH_MAINSTONE is not set
-# CONFIG_MACH_MIOA701 is not set
-# CONFIG_MACH_MP900C is not set
-# CONFIG_MACH_PCM027 is not set
-CONFIG_MACH_PXA3XX_DT=y
-# CONFIG_MACH_RAUMFELD_CONNECTOR is not set
-# CONFIG_MACH_RAUMFELD_RC is not set
-# CONFIG_MACH_RAUMFELD_SPEAKER is not set
-# CONFIG_MACH_SAAR is not set
-# CONFIG_MACH_STARGATE2 is not set
-# CONFIG_MACH_TAVOREVB is not set
-# CONFIG_MACH_VPAC270 is not set
-# CONFIG_MACH_XCEP is not set
-# CONFIG_MACH_ZIPIT2 is not set
-# CONFIG_MACH_ZYLONITE300 is not set
-# CONFIG_MACH_ZYLONITE320 is not set
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_PXA=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_AMDSTD is not set
-CONFIG_MTD_CFI_GEOMETRY=y
-# CONFIG_MTD_CFI_I2 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
-CONFIG_MTD_OF_PARTS=y
-CONFIG_MTD_PHYSMAP=y
-# CONFIG_MTD_PHYSMAP_OF is not set
-CONFIG_MTD_PXA2XX=y
-# CONFIG_MTD_XIP is not set
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_KUSER_HELPERS=y
-CONFIG_NEED_MACH_GPIO_H=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_DEVICE=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_OUTER_CACHE=y
-# CONFIG_PACKET is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PCI_SYSCALL is not set
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PHYLIB=y
-CONFIG_PLAT_PXA=y
-CONFIG_POWER_SUPPLY=y
-# CONFIG_PREEMPT_RCU is not set
-CONFIG_PXA27x=y
-CONFIG_PXA3xx=y
-# CONFIG_PXA_EZX is not set
-# CONFIG_PXA_SHARPSL is not set
-# CONFIG_RCU_STALL_COMMON is not set
-# CONFIG_SA1100_WATCHDOG is not set
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_PXA=y
-CONFIG_SERIAL_PXA_CONSOLE=y
-CONFIG_SMSC911X=y
-# CONFIG_SMSC911X_ARCH_HOOKS is not set
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPLIT_PTLOCK_CPUS=999999
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-# CONFIG_TRIZEPS_PXA is not set
-CONFIG_UID16=y
-CONFIG_UIDGID_CONVERTED=y
-CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h"
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-# CONFIG_USB_ARCH_HAS_XHCI is not set
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-# CONFIG_VLAN_8021Q is not set
-CONFIG_XSCALE_PMU=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/pxa/config-3.3 b/target/linux/pxa/config-3.3
deleted file mode 100644
index f6892b4f18..0000000000
--- a/target/linux/pxa/config-3.3
+++ /dev/null
@@ -1,179 +0,0 @@
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_GUMSTIX=y
-CONFIG_ARCH_HAS_CPUFREQ=y
-CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
-# CONFIG_ARCH_LUBBOCK is not set
-CONFIG_ARCH_MTD_XIP=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_PXA=y
-# CONFIG_ARCH_PXA_ESERIES is not set
-# CONFIG_ARCH_PXA_IDP is not set
-# CONFIG_ARCH_PXA_PALM is not set
-# CONFIG_ARCH_PXA_V7 is not set
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
-# CONFIG_ARCH_VIPER is not set
-CONFIG_ARM=y
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_L1_CACHE_SHIFT=5
-CONFIG_ARM_NR_BANKS=8
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-# CONFIG_ARM_THUMB is not set
-# CONFIG_ARPD is not set
-CONFIG_AUTO_ZRELADDR=y
-# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_BLK_DEV_INITRD is not set
-# CONFIG_CACHE_L2X0 is not set
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CMDLINE="rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
-CONFIG_CMDLINE_FROM_BOOTLOADER=y
-CONFIG_CPU_32v5=y
-CONFIG_CPU_ABRT_EV5T=y
-CONFIG_CPU_CACHE_VIVT=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_HAS_PMU=y
-CONFIG_CPU_PABRT_LEGACY=y
-CONFIG_CPU_TLB_V4WBI=y
-CONFIG_CPU_USE_DOMAINS=y
-CONFIG_CPU_XSCALE=y
-CONFIG_DEBUG_BUGVERBOSE=y
-# CONFIG_DEBUG_LL_UART_NONE is not set
-# CONFIG_DEBUG_USER is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_EPOLL is not set
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_GPIO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_PXA=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-CONFIG_HAVE_AOUT=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_GENERIC_HARDIRQS=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_WORK=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SCHED_CLOCK=y
-CONFIG_HAVE_SPARSE_IRQ=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_PXA_SLAVE=y
-CONFIG_IWMMXT=y
-CONFIG_KTIME_SCALAR=y
-# CONFIG_MACH_ARCOM_ZEUS is not set
-# CONFIG_MACH_ARMCORE is not set
-# CONFIG_MACH_BALLOON3 is not set
-# CONFIG_MACH_CAPC7117 is not set
-# CONFIG_MACH_CM_X300 is not set
-# CONFIG_MACH_COLIBRI is not set
-# CONFIG_MACH_COLIBRI300 is not set
-# CONFIG_MACH_COLIBRI320 is not set
-# CONFIG_MACH_CSB726 is not set
-# CONFIG_MACH_EM_X270 is not set
-# CONFIG_MACH_EXEDA is not set
-# CONFIG_MACH_GUMSTIX_F is not set
-CONFIG_MACH_GUMSTIX_VERDEX=y
-# CONFIG_MACH_H4700 is not set
-# CONFIG_MACH_H5000 is not set
-# CONFIG_MACH_HIMALAYA is not set
-# CONFIG_MACH_ICONTROL is not set
-# CONFIG_MACH_INTELMOTE2 is not set
-# CONFIG_MACH_LITTLETON is not set
-# CONFIG_MACH_LOGICPD_PXA270 is not set
-# CONFIG_MACH_MAGICIAN is not set
-# CONFIG_MACH_MAINSTONE is not set
-# CONFIG_MACH_MIOA701 is not set
-# CONFIG_MACH_MP900C is not set
-# CONFIG_MACH_PCM027 is not set
-# CONFIG_MACH_RAUMFELD_CONNECTOR is not set
-# CONFIG_MACH_RAUMFELD_RC is not set
-# CONFIG_MACH_RAUMFELD_SPEAKER is not set
-# CONFIG_MACH_SAAR is not set
-# CONFIG_MACH_STARGATE2 is not set
-# CONFIG_MACH_TAVOREVB is not set
-# CONFIG_MACH_VPAC270 is not set
-# CONFIG_MACH_XCEP is not set
-# CONFIG_MACH_ZIPIT2 is not set
-# CONFIG_MACH_ZYLONITE300 is not set
-# CONFIG_MACH_ZYLONITE320 is not set
-CONFIG_MDIO_BOARDINFO=y
-# CONFIG_MFD_T7L66XB is not set
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_PXA=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_AMDSTD is not set
-CONFIG_MTD_CFI_GEOMETRY=y
-# CONFIG_MTD_CFI_I2 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PXA2XX=y
-# CONFIG_MTD_XIP is not set
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
-# CONFIG_PACKET is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PATA_PXA is not set
-# CONFIG_PCI_SYSCALL is not set
-CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PHYLIB=y
-CONFIG_PLAT_PXA=y
-# CONFIG_PREEMPT_RCU is not set
-CONFIG_PXA27x=y
-# CONFIG_PXA_EZX is not set
-# CONFIG_PXA_SHARPSL is not set
-# CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_PROC_FS is not set
-# CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_PXA=y
-CONFIG_SERIAL_PXA_CONSOLE=y
-CONFIG_SMSC911X=y
-# CONFIG_SMSC911X_ARCH_HOOKS is not set
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPLIT_PTLOCK_CPUS=999999
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-# CONFIG_TRIZEPS_PXA is not set
-CONFIG_UID16=y
-CONFIG_VECTORS_BASE=0xffff0000
-# CONFIG_VLAN_8021Q is not set
-CONFIG_XSCALE_PMU=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/pxa/image/Makefile b/target/linux/pxa/image/Makefile
deleted file mode 100644
index b8723363da..0000000000
--- a/target/linux/pxa/image/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2008-2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Image/BuildKernel
- cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
-endef
-
-# Build a fake flash image for usage in Qemu
-define Image/Build/Gumstix
- dd if=/dev/zero bs=128k count=256 of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-qemu-flash.img
- dd if=$(BIN_DIR)/openwrt-pxa-gumstix-u-boot.bin conv=notrunc bs=128k \
- of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-qemu-flash.img
- dd if=$(KDIR)/root.$(1) conv=notrunc bs=128k seek=2 \
- of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-qemu-flash.img
- dd if=$(KDIR)/uImage conv=notrunc bs=128k seek=248 \
- of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-qemu-flash.img
-endef
-
-define Image/Build
- $(call Image/Build/$(1),$(1))
- $(call Image/Build/$(PROFILE),$(1))
-endef
-
-define Image/Build/jffs2-64k
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=64k conv=sync
-endef
-
-define Image/Build/jffs2-128k
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=128k conv=sync
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/pxa/patches-3.10/001-gumstix_verdex_pro_arch_support.patch b/target/linux/pxa/patches-3.10/001-gumstix_verdex_pro_arch_support.patch
deleted file mode 100644
index 531d60d89b..0000000000
--- a/target/linux/pxa/patches-3.10/001-gumstix_verdex_pro_arch_support.patch
+++ /dev/null
@@ -1,882 +0,0 @@
-From 4f4bb58cba3a6c44e9f9f113609287d9d50be9c4 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:11:28 -0400
-Subject: [PATCH] [ARM] Gumstix Verdex Pro arch support
-
-add an option for Verdex Pro when ARCH_GUMSTIX is selected, and
-factor earlier Gumstix support into a seperate option
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- arch/arm/mach-pxa/Kconfig | 29 +-
- arch/arm/mach-pxa/Makefile | 3 +-
- arch/arm/mach-pxa/gumstix-verdex.c | 749 +++++++++++++++++++++++++++
- arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 1 +
- 4 files changed, 772 insertions(+), 10 deletions(-)
- create mode 100644 arch/arm/mach-pxa/gumstix-verdex.c
-
---- a/arch/arm/mach-pxa/Kconfig
-+++ b/arch/arm/mach-pxa/Kconfig
-@@ -129,23 +129,34 @@ config MACH_CAPC7117
- select PXA3xx
-
- config ARCH_GUMSTIX
-- bool "Gumstix XScale 255 boards"
-- select PXA25x
-+ bool "Gumstix boards"
- help
-- Say Y here if you intend to run this kernel on
-- Basix, Connex, ws-200ax, ws-400ax systems
-+ Say Y here if you intend to run this kernel on a
-+ gumstix computer.
-
--choice
-- prompt "Gumstix Carrier/Expansion Board"
- depends on ARCH_GUMSTIX
-
--config GUMSTIX_AM200EPD
-+config MACH_GUMSTIX_F
-+ bool "Gumstix Basix/Connex ..."
-+ depends on ARCH_GUMSTIX
-+ select PXA25x
-+
-+ choice
-+ prompt "Gumstix Carrier/Expansion Board"
-+ depends on MACH_GUMSTIX_F
-+
-+ config GUMSTIX_AM200EPD
- bool "Enable AM200EPD board support"
-
--config GUMSTIX_AM300EPD
-+ config GUMSTIX_AM300EPD
- bool "Enable AM300EPD board support"
-
--endchoice
-+ endchoice
-+
-+config MACH_GUMSTIX_VERDEX
-+ bool "Gumstix VERDEX ..."
-+ depends on ARCH_GUMSTIX
-+ select PXA27x
-
- config MACH_INTELMOTE2
- bool "Intel Mote 2 Platform"
---- a/arch/arm/mach-pxa/Makefile
-+++ b/arch/arm/mach-pxa/Makefile
-@@ -45,7 +45,8 @@ endif
- obj-$(CONFIG_MACH_EM_X270) += em-x270.o
- obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
- obj-$(CONFIG_MACH_CAPC7117) += capc7117.o mxm8x10.o
--obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
-+obj-$(CONFIG_MACH_GUMSTIX_F) += gumstix.o
-+obj-$(CONFIG_MACH_GUMSTIX_VERDEX) += gumstix-verdex.o
- obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
- obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o
- obj-$(CONFIG_MACH_INTELMOTE2) += stargate2.o
---- /dev/null
-+++ b/arch/arm/mach-pxa/gumstix-verdex.c
-@@ -0,0 +1,794 @@
-+/*
-+ * linux/arch/arm/mach-pxa/gumstix-verdex.c
-+ *
-+ * Support for the Gumstix verdex motherboard.
-+ *
-+ * Original Author: Craig Hughes
-+ * Created: Feb 14, 2008
-+ * Copyright: Craig Hughes
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
-+ * Hughes
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/interrupt.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/mtd/partitions.h>
-+#include <linux/i2c/tsc2007.h>
-+#include <linux/i2c/pxa-i2c.h>
-+#include <linux/gpio.h>
-+#include <linux/gpio-pxa.h>
-+
-+#include <asm/setup.h>
-+#include <asm/memory.h>
-+#include <asm/mach-types.h>
-+#include <asm/irq.h>
-+#include <asm/sizes.h>
-+#include <asm/io.h>
-+
-+#include <asm/mach/arch.h>
-+#include <asm/mach/map.h>
-+#include <asm/mach/irq.h>
-+#include <asm/mach/flash.h>
-+
-+#include <linux/platform_data/mmc-pxamci.h>
-+#include <mach/udc.h>
-+#include <linux/platform_data/video-pxafb.h>
-+#include <linux/platform_data/usb-ohci-pxa27x.h>
-+#include <mach/pxa27x.h>
-+#include <mach/pxa27x-udc.h>
-+#include <mach/gpio.h>
-+
-+#include <mach/gumstix.h>
-+
-+#include "generic.h"
-+
-+#include <linux/delay.h>
-+
-+static struct resource flash_resource = {
-+ .start = 0x00000000,
-+ .end = SZ_64M - 1,
-+ .flags = IORESOURCE_MEM,
-+};
-+
-+static struct mtd_partition gumstix_partitions[] = {
-+ {
-+ .name = "u-boot",
-+ .size = 0x00040000,
-+ .offset = 0,
-+ .mask_flags = MTD_WRITEABLE /* force read-only */
-+ } , {
-+ .name = "rootfs",
-+ .size = 0x01ec0000,
-+ .offset = 0x00040000
-+ } , {
-+ .name = "kernel",
-+ .size = 0x00100000,
-+ .offset = 0x01f00000
-+ }
-+};
-+
-+static struct flash_platform_data gumstix_flash_data = {
-+ .map_name = "cfi_probe",
-+ .parts = gumstix_partitions,
-+ .nr_parts = ARRAY_SIZE(gumstix_partitions),
-+ .width = 2,
-+};
-+
-+static struct platform_device gumstix_flash_device = {
-+ .name = "pxa2xx-flash",
-+ .id = 0,
-+ .dev = {
-+ .platform_data = &gumstix_flash_data,
-+ },
-+ .resource = &flash_resource,
-+ .num_resources = 1,
-+};
-+
-+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) \
-+ || defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+
-+#include <linux/smsc911x.h>
-+
-+static struct resource verdex_smsc911x_resources[] = {
-+ [0] = {
-+ .name = "smsc911x-memory",
-+ .start = PXA_CS1_PHYS,
-+ .end = PXA_CS1_PHYS + 0x000fffff,
-+ .flags = IORESOURCE_MEM,
-+ },
-+ [1] = {
-+ .start = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
-+ .end = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
-+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
-+ },
-+};
-+
-+static struct smsc911x_platform_config verdex_smsc911x_config = {
-+ .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-+ .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
-+ .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
-+ .phy_interface = PHY_INTERFACE_MODE_MII,
-+};
-+
-+static struct platform_device verdex_smsc911x_device = {
-+ .name = "smsc911x",
-+ .id = -1,
-+ .num_resources = ARRAY_SIZE(verdex_smsc911x_resources),
-+ .resource = verdex_smsc911x_resources,
-+ .dev = {
-+ .platform_data = &verdex_smsc911x_config,
-+ },
-+};
-+#endif
-+
-+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
-+static void __init verdex_init_smsc911x(void)
-+{
-+
-+ printk(KERN_INFO "Initializing Gumstix verdex smsc911x\n");
-+
-+ if (gpio_request(GPIO_GUMSTIX_ETH0_RST, "SMSC911x_ETH0_RST") != 0) {
-+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_RST\n");
-+ goto err_request_gpio_eth0_rst;
-+ }
-+
-+ if (gpio_request(GPIO_GUMSTIX_ETH0, "SMSC911x_ETH0_IRQ") != 0) {
-+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_IRQ\n");
-+ goto err_request_gpio_eth0_irq;
-+ }
-+
-+ if (gpio_direction_output(GPIO_GUMSTIX_ETH0_RST, 0) != 0) {
-+ printk(KERN_ERR "could not set SMSC911x_ETH0_RST pin to output\n");
-+ goto err_dir;
-+ }
-+
-+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 0);
-+
-+ msleep(500); // Hold RESET for at least 200ms
-+
-+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 1);
-+
-+ msleep(50);
-+
-+ if (gpio_direction_input(GPIO_GUMSTIX_ETH0) != 0) {
-+ printk(KERN_ERR "could not set SMSC911x_ETH0_IRQ pin to input\n");
-+ goto err_dir;
-+ }
-+
-+ gpio_export(GPIO_GUMSTIX_ETH0, 0);
-+ platform_device_register(&verdex_smsc911x_device);
-+ return;
-+
-+err_dir:
-+ gpio_free(GPIO_GUMSTIX_ETH0_RST);
-+
-+err_request_gpio_eth0_irq:
-+ gpio_free(GPIO_GUMSTIX_ETH0);
-+
-+err_request_gpio_eth0_rst:
-+ return;
-+}
-+
-+#else
-+static void __init verdex_init_smsc911x(void) { return; }
-+#endif
-+
-+static unsigned long verdex_pin_config[] = {
-+ /* MMC */
-+ GPIO32_MMC_CLK,
-+ GPIO112_MMC_CMD,
-+ GPIO92_MMC_DAT_0,
-+ GPIO109_MMC_DAT_1,
-+ GPIO110_MMC_DAT_2,
-+ GPIO111_MMC_DAT_3,
-+
-+ /* BTUART */
-+ GPIO42_BTUART_RXD,
-+ GPIO43_BTUART_TXD,
-+ GPIO44_BTUART_CTS,
-+ GPIO45_BTUART_RTS,
-+
-+ /* STUART */
-+ GPIO46_STUART_RXD,
-+ GPIO47_STUART_TXD,
-+
-+ /* FFUART */
-+ GPIO34_FFUART_RXD,
-+ GPIO39_FFUART_TXD,
-+
-+ /* SSP 2 */
-+ GPIO19_SSP2_SCLK,
-+ GPIO14_SSP2_SFRM,
-+ GPIO13_SSP2_TXD,
-+ GPIO11_SSP2_RXD,
-+
-+ /* SDRAM and local bus */
-+ GPIO49_nPWE,
-+ GPIO15_nCS_1,
-+
-+ /* I2C */
-+ GPIO117_I2C_SCL,
-+ GPIO118_I2C_SDA,
-+
-+ /* PWM 0 */
-+ GPIO16_PWM0_OUT,
-+
-+ /* BRIGHTNESS */
-+ GPIO17_PWM1_OUT,
-+
-+ /* LCD */
-+ GPIO58_LCD_LDD_0,
-+ GPIO59_LCD_LDD_1,
-+ GPIO60_LCD_LDD_2,
-+ GPIO61_LCD_LDD_3,
-+ GPIO62_LCD_LDD_4,
-+ GPIO63_LCD_LDD_5,
-+ GPIO64_LCD_LDD_6,
-+ GPIO65_LCD_LDD_7,
-+ GPIO66_LCD_LDD_8,
-+ GPIO67_LCD_LDD_9,
-+ GPIO68_LCD_LDD_10,
-+ GPIO69_LCD_LDD_11,
-+ GPIO70_LCD_LDD_12,
-+ GPIO71_LCD_LDD_13,
-+ GPIO72_LCD_LDD_14,
-+ GPIO73_LCD_LDD_15,
-+ GPIO74_LCD_FCLK,
-+ GPIO75_LCD_LCLK,
-+ GPIO76_LCD_PCLK,
-+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
-+ /* DISP must be always high while screen is on */
-+ /* Done below in verdex_init */
-+#else
-+ GPIO77_LCD_BIAS,
-+#endif
-+};
-+
-+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+
-+static unsigned long gpio_ntschg_0[] = {
-+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
-+};
-+
-+static unsigned long gpio_ntschg_1[] = {
-+ GPIO18_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_1_MD);
-+ GPIO36_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_1_MD);
-+ GPIO27_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_1_MD);
-+};
-+
-+static unsigned long gpio_prdy_nbsy_old[] = {
-+ GPIO111_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_0_MD);
-+ GPIO109_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD);
-+};
-+
-+static unsigned long gpio_prdy_nbsy[] = {
-+ GPIO96_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_MD);
-+};
-+
-+static unsigned long gpio_nhw_init[] = {
-+ GPIO48_nPOE, // pxa_gpio_mode(GPIO_GUMSTIX_nPOE_MD);
-+ GPIO102_nPCE_1, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_1_MD);
-+ GPIO105_nPCE_2, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_2_MD);
-+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
-+
-+ GPIO49_nPWE, // pxa_gpio_mode(GPIO_GUMSTIX_nPWE_MD);
-+ GPIO50_nPIOR, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOR_MD);
-+ GPIO51_nPIOW, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOW_MD);
-+ GPIO79_PSKTSEL, // pxa_gpio_mode(GPIO_GUMSTIX_pSKTSEL_MD);
-+ GPIO55_nPREG, // pxa_gpio_mode(GPIO_GUMSTIX_nPREG_MD);
-+ GPIO56_nPWAIT, // pxa_gpio_mode(GPIO_GUMSTIX_nPWAIT_MD);
-+ GPIO57_nIOIS16, // pxa_gpio_mode(GPIO_GUMSTIX_nIOIS16_MD);
-+};
-+
-+static int net_cf_vx_mode = 0;
-+static int pcmcia_cf_nr = 2;
-+
-+inline void __init gumstix_pcmcia_cpld_clk(void)
-+{
-+ gpio_set_value(GPIO_GUMSTIX_nPOE, 0);
-+ gpio_set_value(GPIO_GUMSTIX_nPOE, 1);
-+}
-+
-+inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
-+{
-+ unsigned char result = 0;
-+ unsigned int shift = 0;
-+ while(bits--)
-+ {
-+ result |= !!(gpio_get_value(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
-+ shift ++;
-+ gumstix_pcmcia_cpld_clk();
-+ }
-+ printk("CPLD responded with: %02x\n",result);
-+ return result;
-+}
-+
-+/* We use the CPLD on the CF-CF card to read a value from a shift register. If we can read that
-+ * magic sequence, then we have 2 CF cards; otherwise we assume just one
-+ * The CPLD will send the value of the shift register on GPIO11 (the CD line for slot 0)
-+ * when RESET is held in reset. We use GPIO48 (nPOE) as a clock signal,
-+ * GPIO52/53 (card enable for both cards) to control read/write to the shift register
-+ */
-+static void __init gumstix_count_cards(void)
-+{
-+ if ((gpio_request(GPIO_GUMSTIX_nPOE, "GPIO_GUMSTIX_nPOE") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPOE, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPOE, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPOE\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nPCE_1, "GPIO_GUMSTIX_nPCE_1") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_1, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPCE_1, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_1\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nPCE_2, "GPIO_GUMSTIX_nPCE_2") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_2, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPCE_2, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_2\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nCD_0, "GPIO_GUMSTIX_nCD_0") == 0) &&
-+ (gpio_direction_input(GPIO_GUMSTIX_nCD_0) == 0))
-+ gpio_export(GPIO_GUMSTIX_nCD_0, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nCD_0\n");
-+
-+ if (net_cf_vx_mode) {
-+ if ((gpio_request(GPIO_GUMSTIX_CF_OLD_RESET, "GPIO_GUMSTIX_CF_OLD_RESET") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_CF_OLD_RESET, 1) == 0)) {
-+ gpio_export(GPIO_GUMSTIX_CF_OLD_RESET, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_OLD_RESET\n");
-+ }
-+ } else {
-+ if ((gpio_request(GPIO_GUMSTIX_CF_RESET, "GPIO_GUMSTIX_CF_RESET") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_CF_RESET, 1) == 0)) {
-+ gpio_export(GPIO_GUMSTIX_CF_RESET, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_RESET\n");
-+ }
-+ }
-+
-+ // Setup the shift register
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 1);
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 0);
-+
-+ // Tick the clock to program the shift register
-+ gumstix_pcmcia_cpld_clk();
-+
-+ // Now set shift register into read mode
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 0);
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 1);
-+
-+ // We can read the bits now -- 0xC2 means "Dual compact flash"
-+ if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
-+ {
-+ // We do not have 2 CF slots
-+ pcmcia_cf_nr = 1;
-+ }
-+
-+ udelay(50);
-+
-+ if (net_cf_vx_mode) {
-+ gpio_set_value(GPIO_GUMSTIX_CF_OLD_RESET, 0);
-+ gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
-+ } else {
-+ gpio_set_value(GPIO_GUMSTIX_CF_RESET, 0);
-+ gpio_free(GPIO_GUMSTIX_CF_RESET);
-+ }
-+
-+ printk(KERN_INFO "found %d CF slots\n", pcmcia_cf_nr);
-+
-+ gpio_free(GPIO_GUMSTIX_nPCE_2);
-+ gpio_free(GPIO_GUMSTIX_nPCE_1);
-+ gpio_free(GPIO_GUMSTIX_nPOE);
-+ return;
-+}
-+
-+#define SMC_IO_EXTENT 16
-+#define BANK_SELECT 14
-+
-+static void __init verdex_pcmcia_pin_config(void)
-+{
-+ struct resource *res;
-+ void *network_controller_memory;
-+ struct platform_device *pdev = &verdex_smsc911x_device;
-+
-+ printk(KERN_INFO "Initializing Gumstix verdex pcmcia\n");
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ if (res == NULL) {
-+ printk(KERN_ERR "no memory resource defined\n");
-+ goto err_done;
-+ }
-+
-+ res = request_mem_region(res->start, SMC_IO_EXTENT, "smc91x probe");
-+ if (res == NULL) {
-+ printk(KERN_ERR "failed to request memory resource\n");
-+ goto err_done;
-+ }
-+
-+ // We check for the possibility of SMSC91c111 (reg base offset 0x300 from CS1 base)
-+ network_controller_memory = ioremap(res->start + 0x300, SMC_IO_EXTENT);
-+ if (network_controller_memory == NULL) {
-+ printk(KERN_ERR "failed to ioremap() registers\n");
-+ goto err_free_mem;
-+ }
-+
-+ // Look for the special 91c111 value in the bank select register
-+ if((0xff00 & readw(network_controller_memory+BANK_SELECT)) == 0x3300) {
-+ printk(KERN_INFO "Detected netCF-vx board: pcmcia using older GPIO configuration\n");
-+ net_cf_vx_mode = 1;
-+ } else {
-+ printk(KERN_INFO "Not netCF-vx board: pcmcia using newer GPIO configuration\n");
-+ net_cf_vx_mode = 0;
-+ }
-+
-+ iounmap(network_controller_memory);
-+err_free_mem:
-+ release_mem_region(res->start, SMC_IO_EXTENT);
-+err_done:
-+
-+ gumstix_count_cards(); // this can update pcmcia_cf_nr
-+
-+ // If pcmcia_cf_nr is 1 then we do not have 2 CF slots
-+ // Note: logic sequence was altered from previous kernel revs
-+ // so that this works as intended now.
-+ if (pcmcia_cf_nr != 0)
-+ {
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_0));
-+
-+ if(net_cf_vx_mode)
-+ pxa2xx_mfp_config(gpio_prdy_nbsy_old, 1);
-+ else
-+ pxa2xx_mfp_config(gpio_prdy_nbsy, 1);
-+
-+ } else {
-+ // Note: this reconfigures pin GPIO18 to be GPIO-IN so make
-+ // sure that this only gets done for the old dual slot board
-+ // since that pin is an active AF1 out-mode signal (RDY) on
-+ // newer boards and changing the pin mode on the newer boards
-+ // would result in memory corruption for the NIC (and hang during
-+ // PHY test).
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_1));
-+ }
-+
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_nhw_init));
-+ return;
-+}
-+
-+int __init gumstix_get_cf_cards(void)
-+{
-+ return pcmcia_cf_nr;
-+}
-+EXPORT_SYMBOL(gumstix_get_cf_cards);
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+int __init gumstix_check_if_netCF_vx(void)
-+{
-+ return net_cf_vx_mode;
-+}
-+EXPORT_SYMBOL(gumstix_check_if_netCF_vx);
-+#endif
-+
-+#endif
-+
-+#if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+static void gumstix_lcd_backlight(int on_or_off)
-+{
-+ int err;
-+ err = gpio_request(17, "LCD BACKLIGHT");
-+ if (err) {
-+ //pr_warning("Gumstix Verdex: Failed to request LCD Backlight gpio\n");
-+ return;
-+ }
-+
-+ if(on_or_off) {
-+ gpio_direction_input(17);
-+ } else {
-+ gpio_set_value(17, 0);
-+ gpio_direction_output(17, 0);
-+ gpio_set_value(17, 0);
-+ }
-+
-+ return;
-+}
-+#endif
-+
-+#ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 300000,
-+ .xres = 240,
-+ .yres = 320,
-+ .bpp = 16,
-+ .hsync_len = 2,
-+ .left_margin = 1,
-+ .right_margin = 1,
-+ .vsync_len = 3,
-+ .upper_margin = 0,
-+ .lower_margin = 0,
-+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_PixFlEdg,
-+};
-+#elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 110000,
-+ .xres = 480,
-+ .yres = 272,
-+ .bpp = 16,
-+ .hsync_len = 41,
-+ .left_margin = 2,
-+ .right_margin = 2,
-+ .vsync_len = 10,
-+ .upper_margin = 2,
-+ .lower_margin = 2,
-+ .sync = 0, // Hsync and Vsync both active low
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
-+ .pxafb_backlight_power = &gumstix_lcd_backlight,
-+};
-+#elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 108696, // 9.2MHz typical DOTCLK from datasheet
-+ .xres = 480,
-+ .hsync_len = 41, // HLW from datasheet: 41 typ
-+ .left_margin = 4, // HBP - HLW from datasheet: 45 - 41 = 4
-+ .right_margin = 8, // HFP from datasheet: 8 typ
-+ .yres = 272,
-+ .vsync_len = 10, // VLW from datasheet: 10 typ
-+ .upper_margin = 2, // VBP - VLW from datasheet: 12 - 10 = 2
-+ .lower_margin = 4, // VFP from datasheet: 4 typ
-+ .bpp = 16,
-+ .sync = 0, // Hsync and Vsync both active low
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
-+ .pxafb_backlight_power = &gumstix_lcd_backlight,
-+};
-+#endif
-+
-+static struct platform_device verdex_audio_device = {
-+ .name = "pxa2xx-ac97",
-+ .id = -1,
-+};
-+
-+static struct platform_device *devices[] __initdata = {
-+ &gumstix_flash_device,
-+ &verdex_audio_device,
-+};
-+
-+/* PXA27x OHCI controller setup */
-+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-+static int ohci_verdex_init(struct device *dev)
-+{
-+ // Turn on port 2 in host mode
-+ UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
-+
-+ /* See drivers/usb/host/ohci-pxa27x.c for further details but
-+ ENABLE_PORT_ALL flag is equivalent to using this old sequence:
-+ UHCHR = (UHCHR) &
-+ ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
-+ */
-+ return 0;
-+}
-+
-+static struct pxaohci_platform_data verdex_ohci_platform_data = {
-+ .port_mode = PMM_PERPORT_MODE,
-+ .flags = ENABLE_PORT_ALL,
-+ .init = ohci_verdex_init,
-+};
-+
-+static void __init verdex_ohci_init(void)
-+{
-+ pxa_set_ohci_info(&verdex_ohci_platform_data);
-+}
-+#else
-+static void __init verdex_ohci_init(void) {
-+ printk(KERN_INFO "Gumstix verdex host usb ohci is disabled\n");
-+}
-+#endif
-+
-+
-+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-+static struct pxamci_platform_data verdex_mci_platform_data;
-+
-+static int verdex_mci_init(struct device *dev, irq_handler_t detect_int,
-+ void *data)
-+{
-+ /* GPIO setup for MMC on the 120-pin connector is done in verdex_init.
-+ * There is no card detect on a uSD connector so no interrupt to
-+ * register. There is no WP detect GPIO line either.
-+ */
-+
-+ return 0;
-+}
-+
-+static struct pxamci_platform_data verdex_mci_platform_data = {
-+ .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
-+ .init = verdex_mci_init,
-+ .gpio_card_detect = -1,
-+ .gpio_card_ro = -1,
-+ .gpio_power = -1,
-+};
-+
-+static void __init verdex_mmc_init(void)
-+{
-+ pxa_set_mci_info(&verdex_mci_platform_data);
-+}
-+#else
-+static void __init verdex_mmc_init(void)
-+{
-+ printk(KERN_INFO "Gumstix verdex mmc disabled\n");
-+}
-+#endif
-+
-+#if defined(CONFIG_USB_GADGET_PXA2XX) || defined(CONFIG_USB_GADGET_PXA2XX_MODULE)
-+static struct pxa2xx_udc_mach_info verdex_udc_info __initdata = {
-+ .gpio_vbus = GPIO35,
-+ .gpio_pullup = GPIO41,
-+};
-+
-+static void __init verdex_udc_init(void)
-+{
-+ pxa_set_udc_info(&verdex_udc_info);
-+}
-+#else
-+static void __init verdex_udc_init(void)
-+{
-+ printk(KERN_INFO "Gumstix verdex udc is disabled\n");
-+}
-+#endif
-+
-+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
-+
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+
-+#define VERDEX_GPIO_PENDOWN 16
-+
-+static int tsc2003_init_platform_hw(void)
-+{
-+ return 0;
-+}
-+
-+static void tsc2003_exit_platform_hw(void)
-+{
-+ return;
-+}
-+
-+static void tsc2003_clear_penirq(void)
-+{
-+ return;
-+}
-+
-+static int tsc2003_get_pendown_state(void)
-+{
-+ return !gpio_get_value(VERDEX_GPIO_PENDOWN);
-+}
-+
-+static struct tsc2007_platform_data tsc2003_config = {
-+ .model = 2003,
-+ .x_plate_ohms = 100,
-+ .get_pendown_state = tsc2003_get_pendown_state,
-+ .clear_penirq = tsc2003_clear_penirq,
-+ .init_platform_hw = tsc2003_init_platform_hw,
-+ .exit_platform_hw = tsc2003_exit_platform_hw,
-+};
-+#endif
-+
-+static struct i2c_board_info __initdata verdex_i2c_board_info[] = {
-+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
-+ {
-+ I2C_BOARD_INFO("rtc-ds1307", 0x68),
-+ },
-+#endif
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+ {
-+ I2C_BOARD_INFO("tsc2003", 0x48),
-+ .platform_data = &tsc2003_config,
-+ .irq = IRQ_GPIO(VERDEX_GPIO_PENDOWN),
-+ },
-+#endif
-+};
-+
-+static struct i2c_pxa_platform_data verdex_i2c_pwr_info = {
-+ .fast_mode = 1,
-+};
-+
-+static struct i2c_pxa_platform_data verdex_i2c_info = {
-+ .fast_mode = 1,
-+};
-+
-+static void __init verdex_i2c_init(void)
-+{
-+ printk(KERN_INFO "Initializing Gumstix verdex i2c\n");
-+
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+ if ((gpio_request(VERDEX_GPIO_PENDOWN, "TSC2003_PENDOWN") == 0) &&
-+ (gpio_direction_input(VERDEX_GPIO_PENDOWN) == 0)) {
-+ gpio_export(VERDEX_GPIO_PENDOWN, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for TSC2003_PENDOWN\n");
-+ return;
-+ }
-+#endif
-+
-+ i2c_register_board_info(0, verdex_i2c_board_info,
-+ ARRAY_SIZE(verdex_i2c_board_info));
-+ pxa_set_i2c_info(&verdex_i2c_info);
-+ pxa27x_set_i2c_power_info(&verdex_i2c_pwr_info);
-+}
-+#else
-+static inline void verdex_i2c_init(void) {}
-+#endif
-+
-+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+static void __init verdex_pcmcia_init(void)
-+{
-+ verdex_pcmcia_pin_config();
-+}
-+#else
-+static void __init verdex_pcmcia_init(void) {
-+ printk(KERN_INFO "Gumstix verdex pcmcia is disabled\n");
-+}
-+#endif
-+
-+
-+static void __init verdex_init(void)
-+{
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(verdex_pin_config));
-+
-+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
-+ /* DISP must be always high while screen is on */
-+ gpio_direction_output(GPIO77, 0);
-+ gpio_set_value(GPIO77, 1);
-+#endif
-+ verdex_udc_init();
-+ verdex_mmc_init();
-+ verdex_ohci_init();
-+ verdex_i2c_init();
-+ verdex_init_smsc911x();
-+ verdex_pcmcia_init();
-+
-+#if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) || defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+ printk(KERN_INFO "Initializing Gumstix verdex FB info\n");
-+ set_pxa_fb_info(&gumstix_fb_info);
-+#endif
-+ printk(KERN_INFO "Initializing Gumstix platform_add_devices\n");
-+ (void) platform_add_devices(devices, ARRAY_SIZE(devices));
-+}
-+
-+MACHINE_START(GUMSTIX, "Gumstix verdex")
-+ .atag_offset = 0x100, /* match u-boot bi_boot_params */
-+ .map_io = pxa27x_map_io,
-+ .init_irq = pxa27x_init_irq,
-+ .handle_irq = pxa27x_handle_irq,
-+ .init_time = pxa_timer_init,
-+ .init_machine = verdex_init,
-+ .restart = pxa_restart,
-+MACHINE_END
---- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
-+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
-@@ -109,6 +109,7 @@
- #define GPIO54_nPCE_2 MFP_CFG_OUT(GPIO54, AF2, DRIVE_HIGH)
- #define GPIO78_nPCE_2 MFP_CFG_OUT(GPIO78, AF1, DRIVE_HIGH)
- #define GPIO87_nPCE_2 MFP_CFG_IN(GPIO87, AF1)
-+#define GPIO105_nPCE_2 MFP_CFG_OUT(GPIO105, AF1, DRIVE_HIGH)
- #define GPIO55_nPREG MFP_CFG_OUT(GPIO55, AF2, DRIVE_HIGH)
- #define GPIO50_nPIOR MFP_CFG_OUT(GPIO50, AF2, DRIVE_HIGH)
- #define GPIO51_nPIOW MFP_CFG_OUT(GPIO51, AF2, DRIVE_HIGH)
diff --git a/target/linux/pxa/patches-3.10/002-verdex_lcd_support.patch b/target/linux/pxa/patches-3.10/002-verdex_lcd_support.patch
deleted file mode 100644
index bfba17e0cb..0000000000
--- a/target/linux/pxa/patches-3.10/002-verdex_lcd_support.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From eb92a178eceae4e5d18bbb442b8e44cb88457d60 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:25:57 -0400
-Subject: [PATCH] [ARM] Gumstix Verdex LCD config options
-
-add options to Kconfig for Verdex LCD support
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/video/Kconfig | 31 +++++++++++++++++++++++++++++++
- 1 files changed, 31 insertions(+), 0 deletions(-)
-
---- a/drivers/video/Kconfig
-+++ b/drivers/video/Kconfig
-@@ -1905,6 +1905,37 @@ config FB_PXA
- say M here and read <file:Documentation/kbuild/modules.txt>.
-
- If unsure, say N.
-+choice
-+ depends on FB_PXA
-+ prompt "LCD Panel"
-+ default FB_PXA_SAMSUNG_LTE430WQ_F0C
-+
-+config FB_PXA_ALPS_CDOLLAR
-+ boolean "Chris Dollar's ALPS screen"
-+ ---help---
-+ Enable definitions (over-ridable on the kernel command line if
-+ "PXA LCD command line parameters" is also selected) for an ALPS
-+ screen which Chris Dollar uses
-+
-+config FB_PXA_SHARP_LQ043_PSP
-+ boolean "SHARP LQ043... series"
-+ ---help---
-+ Enable definitions (over-ridable on the kernel command line if
-+ "PXA LCD command line parameters" is also selected) for a SHARP
-+ LQ043... screen, such as the one used by the PSP. These screens are
-+ the ones normally sold by gumstix with its boards.
-+
-+config FB_PXA_SAMSUNG_LTE430WQ_F0C
-+ boolean "Samsung LTE430WQ-F0C (standard gumstix LCD)"
-+ ---help---
-+ Enable definitions for a Samsung LTE430WQ-F0C LCD panel, such as the ones resold
-+ by gumstix for use with their "LCD-Ready" boards.
-+
-+config FB_PXA_NONEOFTHEABOVE
-+ boolean "None of the above"
-+
-+endchoice
-+
-
- config FB_PXA_OVERLAY
- bool "Support PXA27x/PXA3xx Overlay(s) as framebuffer"
diff --git a/target/linux/pxa/patches-3.10/003-gumstix_h_verdex_pro_support.patch b/target/linux/pxa/patches-3.10/003-gumstix_h_verdex_pro_support.patch
deleted file mode 100644
index 6dd291d483..0000000000
--- a/target/linux/pxa/patches-3.10/003-gumstix_h_verdex_pro_support.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From adb6abbe4e3bc17c20cdc70e4a4357f1633d4970 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:49:11 -0400
-Subject: [PATCH] [ARM] gumstix.h: Verdex Pro support
-
-Added a bunch of ifdefs to support both original gumstix boards
-as well as the Verdex Pro in gumstix.h
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- arch/arm/mach-pxa/include/mach/gumstix.h | 160 ++++++++++++++++++++++++------
- 1 files changed, 130 insertions(+), 30 deletions(-)
-
---- a/arch/arm/mach-pxa/include/mach/gumstix.h
-+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
-@@ -6,6 +6,9 @@
- * published by the Free Software Foundation.
- */
-
-+#if !defined(__ASM_ARCH_MFP_PXA27X_H) && !defined(__ASM_ARCH_MFP_PXA25X_H)
-+ #error You need to include either mfp-pxa27x.h or mfp-pxa25x.h
-+#endif
-
- /* BTRESET - Reset line to Bluetooth module, active low signal. */
- #define GPIO_GUMSTIX_BTRESET 7
-@@ -20,9 +23,18 @@ this moves to GPIO17 and GPIO37. */
- /* GPIOx - Connects to USB D+ and used as a pull-up after GPIOn
- has detected a cable insertion; driven low otherwise. */
-
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+
- #define GPIO_GUMSTIX_USB_GPIOn 35
- #define GPIO_GUMSTIX_USB_GPIOx 41
-
-+#else
-+
-+#define GPIO_GUMSTIX_USB_GPIOn 100
-+#define GPIO_GUMSTIX_USB_GPIOx 27
-+
-+#endif
-+
- /* usb state change */
- #define GUMSTIX_USB_INTR_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_USB_GPIOn)
-
-@@ -42,48 +54,136 @@ has detected a cable insertion; driven l
- * ETH_RST provides a hardware reset line to the ethernet chip
- * ETH is the IRQ line in from the ethernet chip to the PXA
- */
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
- #define GPIO_GUMSTIX_ETH0_RST 80
--#define GPIO_GUMSTIX_ETH0_RST_MD (GPIO_GUMSTIX_ETH0_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH0 36
-+#else
-+#define GPIO_GUMSTIX_ETH0_RST 107
-+#define GPIO_GUMSTIX_ETH0 99
-+#endif
- #define GPIO_GUMSTIX_ETH1_RST 52
--#define GPIO_GUMSTIX_ETH1_RST_MD (GPIO_GUMSTIX_ETH1_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH1 27
-
--#define GPIO_GUMSTIX_ETH0 36
-+#define GPIO_GUMSTIX_ETH0_RST_MD (GPIO_GUMSTIX_ETH0_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH1_RST_MD (GPIO_GUMSTIX_ETH1_RST | GPIO_OUT)
- #define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN)
--#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
--#define GPIO_GUMSTIX_ETH1 27
- #define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
--#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
--
-
--/* CF reset line */
--#define GPIO8_RESET 8
-+#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
-+#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
-
--/* CF slot 0 */
--#define GPIO4_nBVD1 4
--#define GPIO4_nSTSCHG GPIO4_nBVD1
--#define GPIO11_nCD 11
--#define GPIO26_PRDY_nBSY 26
--#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO4_nSTSCHG)
--#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO11_nCD)
--#define GUMSTIX_S0_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO26_PRDY_nBSY)
-+ /* CF reset line */
-+#define GPIO8_CF_RESET 8
-+#define GPIO97_CF_RESET 97
-+#define GPIO110_CF_RESET 110
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_CF_RESET GPIO8_CF_RESET
-+#else
-+#define GPIO_GUMSTIX_CF_RESET GPIO97_CF_RESET
-+#endif
-+
-+#define GPIO_GUMSTIX_CF_OLD_RESET GPIO110_CF_RESET
-+
-+/* CF signals shared by both sockets */
-+#define GPIO_GUMSTIX_nPOE 48
-+#define GPIO_GUMSTIX_nPWE 49
-+#define GPIO_GUMSTIX_nPIOR 50
-+#define GPIO_GUMSTIX_nPIOW 51
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nPCE_1 52
-+#define GPIO_GUMSTIX_nPCE_2 53
-+#define GPIO_GUMSTIX_pSKTSEL 54
-+#else
-+#define GPIO_GUMSTIX_nPCE_1 102
-+#define GPIO_GUMSTIX_nPCE_2 105
-+#define GPIO_GUMSTIX_pSKTSEL 79
-+#endif
-+
-+#define GPIO_GUMSTIX_nPREG 55
-+#define GPIO_GUMSTIX_nPWAIT 56
-+#define GPIO_GUMSTIX_nIOIS16 57
-+
-+/* Pin mode definitions correspond to mfp-pxa2[57]x.h */
-+#define GPIO_GUMSTIX_nPOE_MD GPIO48_nPOE
-+#define GPIO_GUMSTIX_nPWE_MD GPIO49_nPWE
-+#define GPIO_GUMSTIX_nPIOR_MD GPIO50_nPIOR
-+#define GPIO_GUMSTIX_nPIOW_MD GPIO51_nPIOW
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nPCE_1_MD GPIO52_nPCE_1
-+#define GPIO_GUMSTIX_nPCE_2_MD GPIO53_nPCE_2
-+#define GPIO_GUMSTIX_pSKTSEL_MD GPIO54_pSKTSEL
-+#else
-+#define GPIO_GUMSTIX_nPCE_1_MD GPIO102_nPCE_1
-+#define GPIO_GUMSTIX_nPCE_2_MD GPIO105_nPCE_2
-+#define GPIO_GUMSTIX_pSKTSEL_MD GPIO79_pSKTSEL
-+#endif
-+
-+#define GPIO_GUMSTIX_nPREG_MD GPIO55_nPREG
-+#define GPIO_GUMSTIX_nPWAIT_MD GPIO56_nPWAIT
-+#define GPIO_GUMSTIX_nIOIS16_MD GPIO57_nIOIS16
-+
-+ /* CF slot 0 */
-+#define GPIO4_nBVD1_0 4
-+#define GPIO4_nSTSCHG_0 GPIO4_nBVD1_0
-+#define GPIO11_nCD_0 11
-+#define GPIO26_PRDY_nBSY_0 26
-+
-+#define GPIO111_nBVD1_0 111
-+#define GPIO111_nSTSCHG_0 GPIO111_nBVD1_0
-+#define GPIO104_nCD_0 104
-+#define GPIO96_PRDY_nBSY_0 96
-+#define GPIO109_PRDY_nBSY_0 109
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nBVD1_0 GPIO4_nBVD1_0
-+#define GPIO_GUMSTIX_nSTSCHG_0 GPIO4_nSTSCHG_0
-+#define GPIO_GUMSTIX_nCD_0 GPIO11_nCD_0
-+#define GPIO_GUMSTIX_PRDY_nBSY_0 GPIO26_PRDY_nBSY_0
-+#else
-+#define GPIO_GUMSTIX_nBVD1_0 GPIO111_nBVD1_0
-+#define GPIO_GUMSTIX_nSTSCHG_0 GPIO111_nSTSCHG_0
-+#define GPIO_GUMSTIX_nCD_0 GPIO104_nCD_0
-+#define GPIO_GUMSTIX_PRDY_nBSY_0 GPIO96_PRDY_nBSY_0
-+#endif
-+
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_OLD GPIO109_PRDY_nBSY_0
-+#define GUMSTIX_S0_PRDY_nBSY_OLD_IRQ PXA_GPIO_TO_IRQ(GPIO109_PRDY_nBSY_0)
-+
-+#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nSTSCHG_0)
-+#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nCD_0)
-+#define GUMSTIX_S0_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_PRDY_nBSY_0)
-
- /* CF slot 1 */
--#define GPIO18_nBVD1 18
--#define GPIO18_nSTSCHG GPIO18_nBVD1
--#define GPIO36_nCD 36
--#define GPIO27_PRDY_nBSY 27
--#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
--#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD)
--#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
--
--/* CF GPIO line modes */
--#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
--#define GPIO8_RESET_MD (GPIO8_RESET | GPIO_OUT)
--#define GPIO11_nCD_MD (GPIO11_nCD | GPIO_IN)
--#define GPIO18_nSTSCHG_MD (GPIO18_nSTSCHG | GPIO_IN)
--#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
--#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
--#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
-+#define GPIO18_nBVD1_1 18
-+#define GPIO18_nSTSCHG_1 GPIO18_nBVD1_1
-+#define GPIO36_nCD_1 36
-+#define GPIO27_PRDY_nBSY_1 27
-+
-+#define GPIO_GUMSTIX_nBVD1_1 GPIO18_nBVD1_1
-+#define GPIO_GUMSTIX_nSTSCHG_1 GPIO18_nSTSCHG_1
-+#define GPIO_GUMSTIX_nCD_1 GPIO36_nCD_1
-+#define GPIO_GUMSTIX_PRDY_nBSY_1 GPIO27_PRDY_nBSY_1
-+
-+#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG_1)
-+#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD_1)
-+#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY_1)
-+
-+/* CF GPIO line modes - correspond to mfp-pxa2[57]x.h */
-+#define GPIO_GUMSTIX_CF_RESET_MD (GPIO_GUMSTIX_CF_RESET | GPIO_OUT)
-+#define GPIO_GUMSTIX_CF_OLD_RESET_MD (GPIO_GUMSTIX_CF_OLD_RESET | GPIO_OUT)
-+
-+#define GPIO_GUMSTIX_nSTSCHG_0_MD GPIO111_GPIO
-+#define GPIO_GUMSTIX_nCD_0_MD GPIO104_GPIO
-+
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_MD GPIO96_GPIO
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD GPIO109_GPIO
-+
-+#define GPIO_GUMSTIX_nSTSCHG_1_MD GPIO18_GPIO
-+#define GPIO_GUMSTIX_nCD_1_MD GPIO36_GPIO
-+#define GPIO_GUMSTIX_PRDY_nBSY_1_MD GPIO27_GPIO
-
- /* for expansion boards that can't be programatically detected */
- extern int am200_init(void);
diff --git a/target/linux/pxa/patches-3.10/004-smsc911x_verdex_pro_support.patch b/target/linux/pxa/patches-3.10/004-smsc911x_verdex_pro_support.patch
deleted file mode 100644
index ace44df15f..0000000000
--- a/target/linux/pxa/patches-3.10/004-smsc911x_verdex_pro_support.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 7645a459feb02f7aae4c3a5724b7800495d1b659 Mon Sep 17 00:00:00 2001
-From: Bobby Powers <bobbypowers@gmail.com>
-Date: Wed, 28 Oct 2009 22:41:31 -0400
-Subject: [PATCH] [ARM] smsc911x: Verdex Pro support
-
-Basically Joseph Kortje's patch, cleaned up to apply to Linus's
-tree. Some of the smsc911x.c had been applied already
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/net/smsc911x.c | 50 +++++++++++++++++++++++++++++++++++++--------
- drivers/net/smsc911x.h | 2 +-
- include/linux/smsc911x.h | 11 ++++++++++
- 3 files changed, 53 insertions(+), 10 deletions(-)
-
---- a/drivers/net/ethernet/smsc/smsc911x.c
-+++ b/drivers/net/ethernet/smsc/smsc911x.c
-@@ -60,6 +60,7 @@
- #include <linux/of_device.h>
- #include <linux/of_gpio.h>
- #include <linux/of_net.h>
-+#include <asm/system_info.h>
- #include "smsc911x.h"
-
- #define SMSC_CHIPNAME "smsc911x"
-@@ -1514,7 +1515,7 @@ static int smsc911x_open(struct net_devi
- SMSC_WARN(pdata, ifup,
- "Timed out waiting for EEPROM busy bit to clear");
-
-- smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
-+ smsc911x_reg_write(pdata, GPIO_CFG, GPIO_CFG_LED1_EN_ | GPIO_CFG_LED2_EN_ | (1 << 20));
-
- /* The soft reset above cleared the device's MAC address,
- * restore it from local copy (set in probe) */
-@@ -1525,8 +1526,8 @@ static int smsc911x_open(struct net_devi
- /* Initialise irqs, but leave all sources disabled */
- smsc911x_disable_irq_chip(dev);
-
-- /* Set interrupt deassertion to 100uS */
-- intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
-+ /* Set interrupt deassertion to 22*10uS */
-+ intcfg = ((22 << 24) | INT_CFG_IRQ_EN_);
-
- if (pdata->config.irq_polarity) {
- SMSC_TRACE(pdata, ifup, "irq polarity: active high");
-@@ -1552,7 +1553,7 @@ static int smsc911x_open(struct net_devi
- temp |= INT_EN_SW_INT_EN_;
- smsc911x_reg_write(pdata, INT_EN, temp);
-
-- timeout = 1000;
-+ timeout = 2000;
- while (timeout--) {
- if (pdata->software_irq_signal)
- break;
-@@ -2370,6 +2371,38 @@ static inline int smsc911x_probe_config_
- }
- #endif /* CONFIG_OF */
-
-+static inline unsigned int is_gumstix_oui(u8 *addr)
-+{
-+ return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9);
-+}
-+
-+/**
-+ * gen_serial_ether_addr - Generate software assigned Ethernet address
-+ * based on the system_serial number
-+ * @addr: Pointer to a six-byte array containing the Ethernet address
-+ *
-+ * Generate an Ethernet address (MAC) that is not multicast
-+ * and has the local assigned bit set, keyed on the system_serial
-+ */
-+static inline void gen_serial_ether_addr(u8 *addr)
-+{
-+ static u8 ether_serial_digit = 0;
-+ addr [0] = system_serial_high >> 8;
-+ addr [1] = system_serial_high;
-+ addr [2] = system_serial_low >> 24;
-+ addr [3] = system_serial_low >> 16;
-+ addr [4] = system_serial_low >> 8;
-+ addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */
-+ (1 << 4) | /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */
-+ ((ether_serial_digit++) & 0x0f); /* 15 possible interfaces of each type */
-+
-+ if(!is_gumstix_oui(addr))
-+ {
-+ addr [0] &= 0xfe; /* clear multicast bit */
-+ addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
-+ }
-+}
-+
- static int smsc911x_drv_probe(struct platform_device *pdev)
- {
- struct device_node *np = pdev->dev.of_node;
-@@ -2516,11 +2549,11 @@ static int smsc911x_drv_probe(struct pla
- SMSC_TRACE(pdata, probe,
- "Mac Address is read from LAN911x EEPROM");
- } else {
-- /* eeprom values are invalid, generate random MAC */
-- eth_hw_addr_random(dev);
-+ /* eeprom values are invalid, generate MAC from serial number */
-+ gen_serial_ether_addr(dev->dev_addr);
- smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
- SMSC_TRACE(pdata, probe,
-- "MAC Address is set to eth_random_addr");
-+ "MAC Address is derived from system serial number");
- }
- }
-
diff --git a/target/linux/pxa/patches-3.10/005-verdex_pcmcia_support.patch b/target/linux/pxa/patches-3.10/005-verdex_pcmcia_support.patch
deleted file mode 100644
index d79dd4f46b..0000000000
--- a/target/linux/pxa/patches-3.10/005-verdex_pcmcia_support.patch
+++ /dev/null
@@ -1,209 +0,0 @@
-From 76a102bd5c9d792db19c6c72eafdecea0311a0c9 Mon Sep 17 00:00:00 2001
-From: Craig Hughes <craig@gumstix.com>
-Date: Fri, 30 Oct 2009 14:16:27 -0400
-Subject: [PATCH] [ARM] pxa: Gumstix Verdex PCMCIA support
-
-Needed for the Libertas CS wireless device.
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/pcmcia/Kconfig | 3 +-
- drivers/pcmcia/Makefile | 3 +
- drivers/pcmcia/pxa2xx_gumstix.c | 194 +++++++++++++++++++++++++++++++++++++++
- 3 files changed, 199 insertions(+), 1 deletions(-)
- create mode 100644 drivers/pcmcia/pxa2xx_gumstix.c
-
---- a/drivers/pcmcia/Kconfig
-+++ b/drivers/pcmcia/Kconfig
-@@ -217,7 +217,7 @@ config PCMCIA_PXA2XX
- || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
- || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \
-- || MACH_COLIBRI320 || MACH_H4700)
-+ || MACH_COLIBRI320 || MACH_H4700 || ARCH_GUMSTIX)
- select PCMCIA_SA1111 if ARCH_LUBBOCK && SA1111
- select PCMCIA_SOC_COMMON
- help
---- a/drivers/pcmcia/Makefile
-+++ b/drivers/pcmcia/Makefile
-@@ -71,6 +71,9 @@ pxa2xx-obj-$(CONFIG_MACH_COLIBRI) += px
- pxa2xx-obj-$(CONFIG_MACH_COLIBRI320) += pxa2xx_colibri.o
- pxa2xx-obj-$(CONFIG_MACH_H4700) += pxa2xx_hx4700.o
-
-+pxa2xx-obj-$(CONFIG_MACH_GUMSTIX_VERDEX) += pxa2xx_cs.o
-+pxa2xx_cs-objs := pxa2xx_gumstix.o
-+
- obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o $(pxa2xx-obj-y)
-
- obj-$(CONFIG_PCMCIA_XXS1500) += xxs1500_ss.o
---- /dev/null
-+++ b/drivers/pcmcia/pxa2xx_gumstix.c
-@@ -0,0 +1,168 @@
-+/*
-+ * linux/drivers/pcmcia/pxa2xx_gumstix.c
-+ *
-+ * Gumstix PCMCIA specific routines. Based on Mainstone
-+ *
-+ * Copyright 2004, Craig Hughes <craig@gumstix.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/interrupt.h>
-+#include <linux/irq.h>
-+#include <linux/gpio.h>
-+
-+#include <linux/delay.h>
-+#include <linux/platform_device.h>
-+
-+#include <linux/gpio-pxa.h>
-+
-+#include <pcmcia/ss.h>
-+
-+#include <mach/hardware.h>
-+#include <asm/mach-types.h>
-+
-+#include <mach/pxa27x.h>
-+
-+#include <asm/io.h>
-+#include <mach/gpio.h>
-+#include <mach/gumstix.h>
-+#include "soc_common.h"
-+
-+#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
-+
-+#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-+#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5))
-+
-+static int net_cf_vx_mode = 0;
-+
-+static int gumstix_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
-+{
-+/* Note: The verdex_pcmcia_pin_config is moved to gumstix_verdex.c in order to use mfp_pxa2xx_config
-+ for board-specific pin configuration instead of the old deprecated pxa_gpio_mode function. Thus,
-+ only the IRQ init is still needed to be done here. */
-+ if (skt->nr == 0) {
-+ skt->socket.pci_irq = (net_cf_vx_mode == 0) ? GUMSTIX_S0_PRDY_nBSY_IRQ : GUMSTIX_S0_PRDY_nBSY_OLD_IRQ;
-+ skt->stat[SOC_STAT_CD].gpio = GUMSTIX_S0_nCD_IRQ;
-+ skt->stat[SOC_STAT_CD].name = "CF0 nCD";
-+ skt->stat[SOC_STAT_RDY].gpio = GUMSTIX_S0_nSTSCHG_IRQ;
-+ skt->stat[SOC_STAT_RDY].name = "CF0 nSTSCHG";
-+ } else {
-+ skt->socket.pci_irq = GUMSTIX_S1_PRDY_nBSY_IRQ;
-+ skt->stat[SOC_STAT_CD].gpio = GUMSTIX_S1_nCD_IRQ;
-+ skt->stat[SOC_STAT_CD].name = "CF1 nCD";
-+ skt->stat[SOC_STAT_RDY].gpio = GUMSTIX_S1_nSTSCHG_IRQ;
-+ skt->stat[SOC_STAT_RDY].name = "CF1 nSTSCHG";
-+ }
-+
-+ return 0;
-+}
-+
-+static void gumstix_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
-+{
-+ if (net_cf_vx_mode) {
-+ gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
-+ } else {
-+ gpio_free(GPIO_GUMSTIX_CF_RESET);
-+ }
-+
-+}
-+
-+static void gumstix_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
-+ struct pcmcia_state *state)
-+{
-+ unsigned int cd, prdy_nbsy, nbvd1;
-+ if(skt->nr == 0)
-+ {
-+ cd = GPIO_GUMSTIX_nCD_0;
-+ if(net_cf_vx_mode)
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_0_OLD;
-+ else
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_0;
-+ nbvd1 = GPIO_GUMSTIX_nBVD1_0;
-+ } else {
-+ cd = GPIO_GUMSTIX_nCD_1;
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_1;
-+ nbvd1 = GPIO_GUMSTIX_nBVD1_1;
-+ }
-+ state->detect = !!gpio_get_value(cd);
-+ state->ready = !!gpio_get_value(prdy_nbsy);
-+ state->bvd1 = !!gpio_get_value(nbvd1);
-+ state->bvd2 = 1;
-+ state->vs_3v = 0;
-+ state->vs_Xv = 0;
-+ state->wrprot = 0;
-+}
-+
-+static int gumstix_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
-+ const socket_state_t *state)
-+{
-+ return 0;
-+}
-+
-+static struct pcmcia_low_level gumstix_pcmcia_ops = {
-+ .owner = THIS_MODULE,
-+ .hw_init = gumstix_pcmcia_hw_init,
-+ .hw_shutdown = gumstix_pcmcia_hw_shutdown,
-+ .socket_state = gumstix_pcmcia_socket_state,
-+ .configure_socket = gumstix_pcmcia_configure_socket,
-+ .nr = 2,
-+};
-+
-+static struct platform_device *gumstix_pcmcia_device;
-+
-+extern int __init gumstix_get_cf_cards(void);
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+extern int __init gumstix_check_if_netCF_vx(void);
-+#endif
-+
-+static int __init gumstix_pcmcia_init(void)
-+{
-+ int ret;
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+ net_cf_vx_mode = gumstix_check_if_netCF_vx();
-+#endif
-+
-+ gumstix_pcmcia_ops.nr = gumstix_get_cf_cards();
-+
-+ gumstix_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
-+ if (!gumstix_pcmcia_device)
-+ return -ENOMEM;
-+
-+ ret = platform_device_add_data(gumstix_pcmcia_device, &gumstix_pcmcia_ops,
-+ sizeof(gumstix_pcmcia_ops));
-+
-+ if (ret == 0) {
-+ printk(KERN_INFO "Registering gumstix PCMCIA interface.\n");
-+ ret = platform_device_add(gumstix_pcmcia_device);
-+ }
-+
-+ if (ret)
-+ platform_device_put(gumstix_pcmcia_device);
-+
-+ return ret;
-+}
-+
-+static void __exit gumstix_pcmcia_exit(void)
-+{
-+ /*
-+ * This call is supposed to free our gumstix_pcmcia_device.
-+ * Unfortunately platform_device don't have a free method, and
-+ * we can't assume it's free of any reference at this point so we
-+ * can't free it either.
-+ */
-+ platform_device_unregister(gumstix_pcmcia_device);
-+}
-+
-+fs_initcall(gumstix_pcmcia_init);
-+module_exit(gumstix_pcmcia_exit);
-+
-+MODULE_LICENSE("GPL");
diff --git a/target/linux/pxa/patches-3.10/a01-arm-debugll-printk.patch b/target/linux/pxa/patches-3.10/a01-arm-debugll-printk.patch
deleted file mode 100644
index 874e5d302b..0000000000
--- a/target/linux/pxa/patches-3.10/a01-arm-debugll-printk.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/kernel/printk.c
-+++ b/kernel/printk.c
-@@ -48,6 +48,10 @@
-
- #include <asm/uaccess.h>
-
-+#ifdef CONFIG_DEBUG_LL
-+extern void printascii(char *);
-+#endif /* CONFIG_DEBUG_LL */
-+
- #define CREATE_TRACE_POINTS
- #include <trace/events/printk.h>
-
-@@ -1578,6 +1582,10 @@ asmlinkage int vprintk_emit(int facility
- }
- }
-
-+#ifdef CONFIG_DEBUG_LL
-+ printascii(printk_buf);
-+#endif
-+
- if (level == -1)
- level = default_message_loglevel;
-
diff --git a/target/linux/pxa/patches-3.3/001-gumstix_verdex_pro_arch_support.patch b/target/linux/pxa/patches-3.3/001-gumstix_verdex_pro_arch_support.patch
deleted file mode 100644
index 9d1c0c2321..0000000000
--- a/target/linux/pxa/patches-3.3/001-gumstix_verdex_pro_arch_support.patch
+++ /dev/null
@@ -1,882 +0,0 @@
-From 4f4bb58cba3a6c44e9f9f113609287d9d50be9c4 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:11:28 -0400
-Subject: [PATCH] [ARM] Gumstix Verdex Pro arch support
-
-add an option for Verdex Pro when ARCH_GUMSTIX is selected, and
-factor earlier Gumstix support into a seperate option
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- arch/arm/mach-pxa/Kconfig | 29 +-
- arch/arm/mach-pxa/Makefile | 3 +-
- arch/arm/mach-pxa/gumstix-verdex.c | 749 +++++++++++++++++++++++++++
- arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | 1 +
- 4 files changed, 772 insertions(+), 10 deletions(-)
- create mode 100644 arch/arm/mach-pxa/gumstix-verdex.c
-
---- a/arch/arm/mach-pxa/Kconfig
-+++ b/arch/arm/mach-pxa/Kconfig
-@@ -134,23 +134,34 @@ config MACH_CAPC7117
- select PXA3xx
-
- config ARCH_GUMSTIX
-- bool "Gumstix XScale 255 boards"
-- select PXA25x
-+ bool "Gumstix boards"
- help
-- Say Y here if you intend to run this kernel on
-- Basix, Connex, ws-200ax, ws-400ax systems
-+ Say Y here if you intend to run this kernel on a
-+ gumstix computer.
-
--choice
-- prompt "Gumstix Carrier/Expansion Board"
- depends on ARCH_GUMSTIX
-
--config GUMSTIX_AM200EPD
-+config MACH_GUMSTIX_F
-+ bool "Gumstix Basix/Connex ..."
-+ depends on ARCH_GUMSTIX
-+ select PXA25x
-+
-+ choice
-+ prompt "Gumstix Carrier/Expansion Board"
-+ depends on MACH_GUMSTIX_F
-+
-+ config GUMSTIX_AM200EPD
- bool "Enable AM200EPD board support"
-
--config GUMSTIX_AM300EPD
-+ config GUMSTIX_AM300EPD
- bool "Enable AM300EPD board support"
-
--endchoice
-+ endchoice
-+
-+config MACH_GUMSTIX_VERDEX
-+ bool "Gumstix VERDEX ..."
-+ depends on ARCH_GUMSTIX
-+ select PXA27x
-
- config MACH_INTELMOTE2
- bool "Intel Mote 2 Platform"
---- a/arch/arm/mach-pxa/Makefile
-+++ b/arch/arm/mach-pxa/Makefile
-@@ -51,7 +51,8 @@ endif
- obj-$(CONFIG_MACH_EM_X270) += em-x270.o
- obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
- obj-$(CONFIG_MACH_CAPC7117) += capc7117.o mxm8x10.o
--obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
-+obj-$(CONFIG_MACH_GUMSTIX_F) += gumstix.o
-+obj-$(CONFIG_MACH_GUMSTIX_VERDEX) += gumstix-verdex.o
- obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
- obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o
- obj-$(CONFIG_MACH_INTELMOTE2) += stargate2.o
---- /dev/null
-+++ b/arch/arm/mach-pxa/gumstix-verdex.c
-@@ -0,0 +1,794 @@
-+/*
-+ * linux/arch/arm/mach-pxa/gumstix-verdex.c
-+ *
-+ * Support for the Gumstix verdex motherboard.
-+ *
-+ * Original Author: Craig Hughes
-+ * Created: Feb 14, 2008
-+ * Copyright: Craig Hughes
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
-+ * Hughes
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+#include <linux/interrupt.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/mtd/partitions.h>
-+#include <linux/i2c/tsc2007.h>
-+#include <linux/i2c/pxa-i2c.h>
-+#include <linux/gpio.h>
-+#include <linux/gpio-pxa.h>
-+
-+#include <asm/setup.h>
-+#include <asm/memory.h>
-+#include <asm/mach-types.h>
-+#include <asm/irq.h>
-+#include <asm/sizes.h>
-+#include <asm/io.h>
-+
-+#include <asm/mach/arch.h>
-+#include <asm/mach/map.h>
-+#include <asm/mach/irq.h>
-+#include <asm/mach/flash.h>
-+
-+#include <mach/mmc.h>
-+#include <mach/udc.h>
-+#include <mach/pxafb.h>
-+#include <mach/ohci.h>
-+#include <mach/pxa27x.h>
-+#include <mach/pxa27x-udc.h>
-+#include <mach/gpio.h>
-+
-+#include <mach/gumstix.h>
-+
-+#include "generic.h"
-+
-+#include <linux/delay.h>
-+
-+static struct resource flash_resource = {
-+ .start = 0x00000000,
-+ .end = SZ_64M - 1,
-+ .flags = IORESOURCE_MEM,
-+};
-+
-+static struct mtd_partition gumstix_partitions[] = {
-+ {
-+ .name = "u-boot",
-+ .size = 0x00040000,
-+ .offset = 0,
-+ .mask_flags = MTD_WRITEABLE /* force read-only */
-+ } , {
-+ .name = "rootfs",
-+ .size = 0x01ec0000,
-+ .offset = 0x00040000
-+ } , {
-+ .name = "kernel",
-+ .size = 0x00100000,
-+ .offset = 0x01f00000
-+ }
-+};
-+
-+static struct flash_platform_data gumstix_flash_data = {
-+ .map_name = "cfi_probe",
-+ .parts = gumstix_partitions,
-+ .nr_parts = ARRAY_SIZE(gumstix_partitions),
-+ .width = 2,
-+};
-+
-+static struct platform_device gumstix_flash_device = {
-+ .name = "pxa2xx-flash",
-+ .id = 0,
-+ .dev = {
-+ .platform_data = &gumstix_flash_data,
-+ },
-+ .resource = &flash_resource,
-+ .num_resources = 1,
-+};
-+
-+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) \
-+ || defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+
-+#include <linux/smsc911x.h>
-+
-+static struct resource verdex_smsc911x_resources[] = {
-+ [0] = {
-+ .name = "smsc911x-memory",
-+ .start = PXA_CS1_PHYS,
-+ .end = PXA_CS1_PHYS + 0x000fffff,
-+ .flags = IORESOURCE_MEM,
-+ },
-+ [1] = {
-+ .start = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
-+ .end = PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0),
-+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
-+ },
-+};
-+
-+static struct smsc911x_platform_config verdex_smsc911x_config = {
-+ .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-+ .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
-+ .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
-+ .phy_interface = PHY_INTERFACE_MODE_MII,
-+};
-+
-+static struct platform_device verdex_smsc911x_device = {
-+ .name = "smsc911x",
-+ .id = -1,
-+ .num_resources = ARRAY_SIZE(verdex_smsc911x_resources),
-+ .resource = verdex_smsc911x_resources,
-+ .dev = {
-+ .platform_data = &verdex_smsc911x_config,
-+ },
-+};
-+#endif
-+
-+#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
-+static void __init verdex_init_smsc911x(void)
-+{
-+
-+ printk(KERN_INFO "Initializing Gumstix verdex smsc911x\n");
-+
-+ if (gpio_request(GPIO_GUMSTIX_ETH0_RST, "SMSC911x_ETH0_RST") != 0) {
-+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_RST\n");
-+ goto err_request_gpio_eth0_rst;
-+ }
-+
-+ if (gpio_request(GPIO_GUMSTIX_ETH0, "SMSC911x_ETH0_IRQ") != 0) {
-+ printk(KERN_ERR "could not obtain gpio for SMSC911x_ETH0_IRQ\n");
-+ goto err_request_gpio_eth0_irq;
-+ }
-+
-+ if (gpio_direction_output(GPIO_GUMSTIX_ETH0_RST, 0) != 0) {
-+ printk(KERN_ERR "could not set SMSC911x_ETH0_RST pin to output\n");
-+ goto err_dir;
-+ }
-+
-+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 0);
-+
-+ msleep(500); // Hold RESET for at least 200ms
-+
-+ gpio_set_value(GPIO_GUMSTIX_ETH0_RST, 1);
-+
-+ msleep(50);
-+
-+ if (gpio_direction_input(GPIO_GUMSTIX_ETH0) != 0) {
-+ printk(KERN_ERR "could not set SMSC911x_ETH0_IRQ pin to input\n");
-+ goto err_dir;
-+ }
-+
-+ gpio_export(GPIO_GUMSTIX_ETH0, 0);
-+ platform_device_register(&verdex_smsc911x_device);
-+ return;
-+
-+err_dir:
-+ gpio_free(GPIO_GUMSTIX_ETH0_RST);
-+
-+err_request_gpio_eth0_irq:
-+ gpio_free(GPIO_GUMSTIX_ETH0);
-+
-+err_request_gpio_eth0_rst:
-+ return;
-+}
-+
-+#else
-+static void __init verdex_init_smsc911x(void) { return; }
-+#endif
-+
-+static unsigned long verdex_pin_config[] = {
-+ /* MMC */
-+ GPIO32_MMC_CLK,
-+ GPIO112_MMC_CMD,
-+ GPIO92_MMC_DAT_0,
-+ GPIO109_MMC_DAT_1,
-+ GPIO110_MMC_DAT_2,
-+ GPIO111_MMC_DAT_3,
-+
-+ /* BTUART */
-+ GPIO42_BTUART_RXD,
-+ GPIO43_BTUART_TXD,
-+ GPIO44_BTUART_CTS,
-+ GPIO45_BTUART_RTS,
-+
-+ /* STUART */
-+ GPIO46_STUART_RXD,
-+ GPIO47_STUART_TXD,
-+
-+ /* FFUART */
-+ GPIO34_FFUART_RXD,
-+ GPIO39_FFUART_TXD,
-+
-+ /* SSP 2 */
-+ GPIO19_SSP2_SCLK,
-+ GPIO14_SSP2_SFRM,
-+ GPIO13_SSP2_TXD,
-+ GPIO11_SSP2_RXD,
-+
-+ /* SDRAM and local bus */
-+ GPIO49_nPWE,
-+ GPIO15_nCS_1,
-+
-+ /* I2C */
-+ GPIO117_I2C_SCL,
-+ GPIO118_I2C_SDA,
-+
-+ /* PWM 0 */
-+ GPIO16_PWM0_OUT,
-+
-+ /* BRIGHTNESS */
-+ GPIO17_PWM1_OUT,
-+
-+ /* LCD */
-+ GPIO58_LCD_LDD_0,
-+ GPIO59_LCD_LDD_1,
-+ GPIO60_LCD_LDD_2,
-+ GPIO61_LCD_LDD_3,
-+ GPIO62_LCD_LDD_4,
-+ GPIO63_LCD_LDD_5,
-+ GPIO64_LCD_LDD_6,
-+ GPIO65_LCD_LDD_7,
-+ GPIO66_LCD_LDD_8,
-+ GPIO67_LCD_LDD_9,
-+ GPIO68_LCD_LDD_10,
-+ GPIO69_LCD_LDD_11,
-+ GPIO70_LCD_LDD_12,
-+ GPIO71_LCD_LDD_13,
-+ GPIO72_LCD_LDD_14,
-+ GPIO73_LCD_LDD_15,
-+ GPIO74_LCD_FCLK,
-+ GPIO75_LCD_LCLK,
-+ GPIO76_LCD_PCLK,
-+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
-+ /* DISP must be always high while screen is on */
-+ /* Done below in verdex_init */
-+#else
-+ GPIO77_LCD_BIAS,
-+#endif
-+};
-+
-+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+
-+static unsigned long gpio_ntschg_0[] = {
-+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
-+};
-+
-+static unsigned long gpio_ntschg_1[] = {
-+ GPIO18_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_1_MD);
-+ GPIO36_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_1_MD);
-+ GPIO27_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_1_MD);
-+};
-+
-+static unsigned long gpio_prdy_nbsy_old[] = {
-+ GPIO111_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nSTSCHG_0_MD);
-+ GPIO109_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD);
-+};
-+
-+static unsigned long gpio_prdy_nbsy[] = {
-+ GPIO96_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_PRDY_nBSY_0_MD);
-+};
-+
-+static unsigned long gpio_nhw_init[] = {
-+ GPIO48_nPOE, // pxa_gpio_mode(GPIO_GUMSTIX_nPOE_MD);
-+ GPIO102_nPCE_1, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_1_MD);
-+ GPIO105_nPCE_2, // pxa_gpio_mode(GPIO_GUMSTIX_nPCE_2_MD);
-+ GPIO104_GPIO, // pxa_gpio_mode(GPIO_GUMSTIX_nCD_0_MD);
-+
-+ GPIO49_nPWE, // pxa_gpio_mode(GPIO_GUMSTIX_nPWE_MD);
-+ GPIO50_nPIOR, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOR_MD);
-+ GPIO51_nPIOW, // pxa_gpio_mode(GPIO_GUMSTIX_nPIOW_MD);
-+ GPIO79_PSKTSEL, // pxa_gpio_mode(GPIO_GUMSTIX_pSKTSEL_MD);
-+ GPIO55_nPREG, // pxa_gpio_mode(GPIO_GUMSTIX_nPREG_MD);
-+ GPIO56_nPWAIT, // pxa_gpio_mode(GPIO_GUMSTIX_nPWAIT_MD);
-+ GPIO57_nIOIS16, // pxa_gpio_mode(GPIO_GUMSTIX_nIOIS16_MD);
-+};
-+
-+static int net_cf_vx_mode = 0;
-+static int pcmcia_cf_nr = 2;
-+
-+inline void __init gumstix_pcmcia_cpld_clk(void)
-+{
-+ gpio_set_value(GPIO_GUMSTIX_nPOE, 0);
-+ gpio_set_value(GPIO_GUMSTIX_nPOE, 1);
-+}
-+
-+inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
-+{
-+ unsigned char result = 0;
-+ unsigned int shift = 0;
-+ while(bits--)
-+ {
-+ result |= !!(gpio_get_value(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
-+ shift ++;
-+ gumstix_pcmcia_cpld_clk();
-+ }
-+ printk("CPLD responded with: %02x\n",result);
-+ return result;
-+}
-+
-+/* We use the CPLD on the CF-CF card to read a value from a shift register. If we can read that
-+ * magic sequence, then we have 2 CF cards; otherwise we assume just one
-+ * The CPLD will send the value of the shift register on GPIO11 (the CD line for slot 0)
-+ * when RESET is held in reset. We use GPIO48 (nPOE) as a clock signal,
-+ * GPIO52/53 (card enable for both cards) to control read/write to the shift register
-+ */
-+static void __init gumstix_count_cards(void)
-+{
-+ if ((gpio_request(GPIO_GUMSTIX_nPOE, "GPIO_GUMSTIX_nPOE") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPOE, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPOE, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPOE\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nPCE_1, "GPIO_GUMSTIX_nPCE_1") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_1, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPCE_1, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_1\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nPCE_2, "GPIO_GUMSTIX_nPCE_2") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_nPCE_2, 1) == 0))
-+ gpio_export(GPIO_GUMSTIX_nPCE_2, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nPCE_2\n");
-+
-+ if ((gpio_request(GPIO_GUMSTIX_nCD_0, "GPIO_GUMSTIX_nCD_0") == 0) &&
-+ (gpio_direction_input(GPIO_GUMSTIX_nCD_0) == 0))
-+ gpio_export(GPIO_GUMSTIX_nCD_0, 0);
-+ else
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_nCD_0\n");
-+
-+ if (net_cf_vx_mode) {
-+ if ((gpio_request(GPIO_GUMSTIX_CF_OLD_RESET, "GPIO_GUMSTIX_CF_OLD_RESET") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_CF_OLD_RESET, 1) == 0)) {
-+ gpio_export(GPIO_GUMSTIX_CF_OLD_RESET, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_OLD_RESET\n");
-+ }
-+ } else {
-+ if ((gpio_request(GPIO_GUMSTIX_CF_RESET, "GPIO_GUMSTIX_CF_RESET") == 0) &&
-+ (gpio_direction_output(GPIO_GUMSTIX_CF_RESET, 1) == 0)) {
-+ gpio_export(GPIO_GUMSTIX_CF_RESET, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for GPIO_GUMSTIX_CF_RESET\n");
-+ }
-+ }
-+
-+ // Setup the shift register
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 1);
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 0);
-+
-+ // Tick the clock to program the shift register
-+ gumstix_pcmcia_cpld_clk();
-+
-+ // Now set shift register into read mode
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 0);
-+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 1);
-+
-+ // We can read the bits now -- 0xC2 means "Dual compact flash"
-+ if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
-+ {
-+ // We do not have 2 CF slots
-+ pcmcia_cf_nr = 1;
-+ }
-+
-+ udelay(50);
-+
-+ if (net_cf_vx_mode) {
-+ gpio_set_value(GPIO_GUMSTIX_CF_OLD_RESET, 0);
-+ gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
-+ } else {
-+ gpio_set_value(GPIO_GUMSTIX_CF_RESET, 0);
-+ gpio_free(GPIO_GUMSTIX_CF_RESET);
-+ }
-+
-+ printk(KERN_INFO "found %d CF slots\n", pcmcia_cf_nr);
-+
-+ gpio_free(GPIO_GUMSTIX_nPCE_2);
-+ gpio_free(GPIO_GUMSTIX_nPCE_1);
-+ gpio_free(GPIO_GUMSTIX_nPOE);
-+ return;
-+}
-+
-+#define SMC_IO_EXTENT 16
-+#define BANK_SELECT 14
-+
-+static void __init verdex_pcmcia_pin_config(void)
-+{
-+ struct resource *res;
-+ void *network_controller_memory;
-+ struct platform_device *pdev = &verdex_smsc911x_device;
-+
-+ printk(KERN_INFO "Initializing Gumstix verdex pcmcia\n");
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ if (res == NULL) {
-+ printk(KERN_ERR "no memory resource defined\n");
-+ goto err_done;
-+ }
-+
-+ res = request_mem_region(res->start, SMC_IO_EXTENT, "smc91x probe");
-+ if (res == NULL) {
-+ printk(KERN_ERR "failed to request memory resource\n");
-+ goto err_done;
-+ }
-+
-+ // We check for the possibility of SMSC91c111 (reg base offset 0x300 from CS1 base)
-+ network_controller_memory = ioremap(res->start + 0x300, SMC_IO_EXTENT);
-+ if (network_controller_memory == NULL) {
-+ printk(KERN_ERR "failed to ioremap() registers\n");
-+ goto err_free_mem;
-+ }
-+
-+ // Look for the special 91c111 value in the bank select register
-+ if((0xff00 & readw(network_controller_memory+BANK_SELECT)) == 0x3300) {
-+ printk(KERN_INFO "Detected netCF-vx board: pcmcia using older GPIO configuration\n");
-+ net_cf_vx_mode = 1;
-+ } else {
-+ printk(KERN_INFO "Not netCF-vx board: pcmcia using newer GPIO configuration\n");
-+ net_cf_vx_mode = 0;
-+ }
-+
-+ iounmap(network_controller_memory);
-+err_free_mem:
-+ release_mem_region(res->start, SMC_IO_EXTENT);
-+err_done:
-+
-+ gumstix_count_cards(); // this can update pcmcia_cf_nr
-+
-+ // If pcmcia_cf_nr is 1 then we do not have 2 CF slots
-+ // Note: logic sequence was altered from previous kernel revs
-+ // so that this works as intended now.
-+ if (pcmcia_cf_nr != 0)
-+ {
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_0));
-+
-+ if(net_cf_vx_mode)
-+ pxa2xx_mfp_config(gpio_prdy_nbsy_old, 1);
-+ else
-+ pxa2xx_mfp_config(gpio_prdy_nbsy, 1);
-+
-+ } else {
-+ // Note: this reconfigures pin GPIO18 to be GPIO-IN so make
-+ // sure that this only gets done for the old dual slot board
-+ // since that pin is an active AF1 out-mode signal (RDY) on
-+ // newer boards and changing the pin mode on the newer boards
-+ // would result in memory corruption for the NIC (and hang during
-+ // PHY test).
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_ntschg_1));
-+ }
-+
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(gpio_nhw_init));
-+ return;
-+}
-+
-+int __init gumstix_get_cf_cards(void)
-+{
-+ return pcmcia_cf_nr;
-+}
-+EXPORT_SYMBOL(gumstix_get_cf_cards);
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+int __init gumstix_check_if_netCF_vx(void)
-+{
-+ return net_cf_vx_mode;
-+}
-+EXPORT_SYMBOL(gumstix_check_if_netCF_vx);
-+#endif
-+
-+#endif
-+
-+#if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+static void gumstix_lcd_backlight(int on_or_off)
-+{
-+ int err;
-+ err = gpio_request(17, "LCD BACKLIGHT");
-+ if (err) {
-+ //pr_warning("Gumstix Verdex: Failed to request LCD Backlight gpio\n");
-+ return;
-+ }
-+
-+ if(on_or_off) {
-+ gpio_direction_input(17);
-+ } else {
-+ gpio_set_value(17, 0);
-+ gpio_direction_output(17, 0);
-+ gpio_set_value(17, 0);
-+ }
-+
-+ return;
-+}
-+#endif
-+
-+#ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 300000,
-+ .xres = 240,
-+ .yres = 320,
-+ .bpp = 16,
-+ .hsync_len = 2,
-+ .left_margin = 1,
-+ .right_margin = 1,
-+ .vsync_len = 3,
-+ .upper_margin = 0,
-+ .lower_margin = 0,
-+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_PixFlEdg,
-+};
-+#elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 110000,
-+ .xres = 480,
-+ .yres = 272,
-+ .bpp = 16,
-+ .hsync_len = 41,
-+ .left_margin = 2,
-+ .right_margin = 2,
-+ .vsync_len = 10,
-+ .upper_margin = 2,
-+ .lower_margin = 2,
-+ .sync = 0, // Hsync and Vsync both active low
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
-+ .pxafb_backlight_power = &gumstix_lcd_backlight,
-+};
-+#elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+static struct pxafb_mode_info gumstix_fb_mode = {
-+ .pixclock = 108696, // 9.2MHz typical DOTCLK from datasheet
-+ .xres = 480,
-+ .hsync_len = 41, // HLW from datasheet: 41 typ
-+ .left_margin = 4, // HBP - HLW from datasheet: 45 - 41 = 4
-+ .right_margin = 8, // HFP from datasheet: 8 typ
-+ .yres = 272,
-+ .vsync_len = 10, // VLW from datasheet: 10 typ
-+ .upper_margin = 2, // VBP - VLW from datasheet: 12 - 10 = 2
-+ .lower_margin = 4, // VFP from datasheet: 4 typ
-+ .bpp = 16,
-+ .sync = 0, // Hsync and Vsync both active low
-+};
-+
-+static struct pxafb_mach_info gumstix_fb_info = {
-+ .modes = &gumstix_fb_mode,
-+ .num_modes = 1,
-+ .lccr0 = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
-+ .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | (0 << 30),
-+ .pxafb_backlight_power = &gumstix_lcd_backlight,
-+};
-+#endif
-+
-+static struct platform_device verdex_audio_device = {
-+ .name = "pxa2xx-ac97",
-+ .id = -1,
-+};
-+
-+static struct platform_device *devices[] __initdata = {
-+ &gumstix_flash_device,
-+ &verdex_audio_device,
-+};
-+
-+/* PXA27x OHCI controller setup */
-+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-+static int ohci_verdex_init(struct device *dev)
-+{
-+ // Turn on port 2 in host mode
-+ UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
-+
-+ /* See drivers/usb/host/ohci-pxa27x.c for further details but
-+ ENABLE_PORT_ALL flag is equivalent to using this old sequence:
-+ UHCHR = (UHCHR) &
-+ ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
-+ */
-+ return 0;
-+}
-+
-+static struct pxaohci_platform_data verdex_ohci_platform_data = {
-+ .port_mode = PMM_PERPORT_MODE,
-+ .flags = ENABLE_PORT_ALL,
-+ .init = ohci_verdex_init,
-+};
-+
-+static void __init verdex_ohci_init(void)
-+{
-+ pxa_set_ohci_info(&verdex_ohci_platform_data);
-+}
-+#else
-+static void __init verdex_ohci_init(void) {
-+ printk(KERN_INFO "Gumstix verdex host usb ohci is disabled\n");
-+}
-+#endif
-+
-+
-+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-+static struct pxamci_platform_data verdex_mci_platform_data;
-+
-+static int verdex_mci_init(struct device *dev, irq_handler_t detect_int,
-+ void *data)
-+{
-+ /* GPIO setup for MMC on the 120-pin connector is done in verdex_init.
-+ * There is no card detect on a uSD connector so no interrupt to
-+ * register. There is no WP detect GPIO line either.
-+ */
-+
-+ return 0;
-+}
-+
-+static struct pxamci_platform_data verdex_mci_platform_data = {
-+ .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
-+ .init = verdex_mci_init,
-+ .gpio_card_detect = -1,
-+ .gpio_card_ro = -1,
-+ .gpio_power = -1,
-+};
-+
-+static void __init verdex_mmc_init(void)
-+{
-+ pxa_set_mci_info(&verdex_mci_platform_data);
-+}
-+#else
-+static void __init verdex_mmc_init(void)
-+{
-+ printk(KERN_INFO "Gumstix verdex mmc disabled\n");
-+}
-+#endif
-+
-+#if defined(CONFIG_USB_GADGET_PXA2XX) || defined(CONFIG_USB_GADGET_PXA2XX_MODULE)
-+static struct pxa2xx_udc_mach_info verdex_udc_info __initdata = {
-+ .gpio_vbus = GPIO35,
-+ .gpio_pullup = GPIO41,
-+};
-+
-+static void __init verdex_udc_init(void)
-+{
-+ pxa_set_udc_info(&verdex_udc_info);
-+}
-+#else
-+static void __init verdex_udc_init(void)
-+{
-+ printk(KERN_INFO "Gumstix verdex udc is disabled\n");
-+}
-+#endif
-+
-+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
-+
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+
-+#define VERDEX_GPIO_PENDOWN 16
-+
-+static int tsc2003_init_platform_hw(void)
-+{
-+ return 0;
-+}
-+
-+static void tsc2003_exit_platform_hw(void)
-+{
-+ return;
-+}
-+
-+static void tsc2003_clear_penirq(void)
-+{
-+ return;
-+}
-+
-+static int tsc2003_get_pendown_state(void)
-+{
-+ return !gpio_get_value(VERDEX_GPIO_PENDOWN);
-+}
-+
-+static struct tsc2007_platform_data tsc2003_config = {
-+ .model = 2003,
-+ .x_plate_ohms = 100,
-+ .get_pendown_state = tsc2003_get_pendown_state,
-+ .clear_penirq = tsc2003_clear_penirq,
-+ .init_platform_hw = tsc2003_init_platform_hw,
-+ .exit_platform_hw = tsc2003_exit_platform_hw,
-+};
-+#endif
-+
-+static struct i2c_board_info __initdata verdex_i2c_board_info[] = {
-+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
-+ {
-+ I2C_BOARD_INFO("rtc-ds1307", 0x68),
-+ },
-+#endif
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+ {
-+ I2C_BOARD_INFO("tsc2003", 0x48),
-+ .platform_data = &tsc2003_config,
-+ .irq = IRQ_GPIO(VERDEX_GPIO_PENDOWN),
-+ },
-+#endif
-+};
-+
-+static struct i2c_pxa_platform_data verdex_i2c_pwr_info = {
-+ .fast_mode = 1,
-+};
-+
-+static struct i2c_pxa_platform_data verdex_i2c_info = {
-+ .fast_mode = 1,
-+};
-+
-+static void __init verdex_i2c_init(void)
-+{
-+ printk(KERN_INFO "Initializing Gumstix verdex i2c\n");
-+
-+#if defined(CONFIG_TOUCHSCREEN_TSC2003) || defined(CONFIG_TOUCHSCREEN_TSC2003_MODULE)
-+ if ((gpio_request(VERDEX_GPIO_PENDOWN, "TSC2003_PENDOWN") == 0) &&
-+ (gpio_direction_input(VERDEX_GPIO_PENDOWN) == 0)) {
-+ gpio_export(VERDEX_GPIO_PENDOWN, 0);
-+ } else {
-+ printk(KERN_ERR "could not obtain gpio for TSC2003_PENDOWN\n");
-+ return;
-+ }
-+#endif
-+
-+ i2c_register_board_info(0, verdex_i2c_board_info,
-+ ARRAY_SIZE(verdex_i2c_board_info));
-+ pxa_set_i2c_info(&verdex_i2c_info);
-+ pxa27x_set_i2c_power_info(&verdex_i2c_pwr_info);
-+}
-+#else
-+static inline void verdex_i2c_init(void) {}
-+#endif
-+
-+#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
-+static void __init verdex_pcmcia_init(void)
-+{
-+ verdex_pcmcia_pin_config();
-+}
-+#else
-+static void __init verdex_pcmcia_init(void) {
-+ printk(KERN_INFO "Gumstix verdex pcmcia is disabled\n");
-+}
-+#endif
-+
-+
-+static void __init verdex_init(void)
-+{
-+ pxa2xx_mfp_config(ARRAY_AND_SIZE(verdex_pin_config));
-+
-+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
-+ /* DISP must be always high while screen is on */
-+ gpio_direction_output(GPIO77, 0);
-+ gpio_set_value(GPIO77, 1);
-+#endif
-+ verdex_udc_init();
-+ verdex_mmc_init();
-+ verdex_ohci_init();
-+ verdex_i2c_init();
-+ verdex_init_smsc911x();
-+ verdex_pcmcia_init();
-+
-+#if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) || defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
-+ printk(KERN_INFO "Initializing Gumstix verdex FB info\n");
-+ set_pxa_fb_info(&gumstix_fb_info);
-+#endif
-+ printk(KERN_INFO "Initializing Gumstix platform_add_devices\n");
-+ (void) platform_add_devices(devices, ARRAY_SIZE(devices));
-+}
-+
-+MACHINE_START(GUMSTIX, "Gumstix verdex")
-+ .atag_offset = 0x100, /* match u-boot bi_boot_params */
-+ .map_io = pxa27x_map_io,
-+ .init_irq = pxa27x_init_irq,
-+ .handle_irq = pxa27x_handle_irq,
-+ .timer = &pxa_timer,
-+ .init_machine = verdex_init,
-+ .restart = pxa_restart,
-+MACHINE_END
---- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
-+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
-@@ -109,6 +109,7 @@
- #define GPIO54_nPCE_2 MFP_CFG_OUT(GPIO54, AF2, DRIVE_HIGH)
- #define GPIO78_nPCE_2 MFP_CFG_OUT(GPIO78, AF1, DRIVE_HIGH)
- #define GPIO87_nPCE_2 MFP_CFG_IN(GPIO87, AF1)
-+#define GPIO105_nPCE_2 MFP_CFG_OUT(GPIO105, AF1, DRIVE_HIGH)
- #define GPIO55_nPREG MFP_CFG_OUT(GPIO55, AF2, DRIVE_HIGH)
- #define GPIO50_nPIOR MFP_CFG_OUT(GPIO50, AF2, DRIVE_HIGH)
- #define GPIO51_nPIOW MFP_CFG_OUT(GPIO51, AF2, DRIVE_HIGH)
diff --git a/target/linux/pxa/patches-3.3/002-verdex_lcd_support.patch b/target/linux/pxa/patches-3.3/002-verdex_lcd_support.patch
deleted file mode 100644
index 90f78547a2..0000000000
--- a/target/linux/pxa/patches-3.3/002-verdex_lcd_support.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From eb92a178eceae4e5d18bbb442b8e44cb88457d60 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:25:57 -0400
-Subject: [PATCH] [ARM] Gumstix Verdex LCD config options
-
-add options to Kconfig for Verdex LCD support
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/video/Kconfig | 31 +++++++++++++++++++++++++++++++
- 1 files changed, 31 insertions(+), 0 deletions(-)
-
---- a/drivers/video/Kconfig
-+++ b/drivers/video/Kconfig
-@@ -1892,6 +1892,37 @@ config FB_PXA
- say M here and read <file:Documentation/kbuild/modules.txt>.
-
- If unsure, say N.
-+choice
-+ depends on FB_PXA
-+ prompt "LCD Panel"
-+ default FB_PXA_SAMSUNG_LTE430WQ_F0C
-+
-+config FB_PXA_ALPS_CDOLLAR
-+ boolean "Chris Dollar's ALPS screen"
-+ ---help---
-+ Enable definitions (over-ridable on the kernel command line if
-+ "PXA LCD command line parameters" is also selected) for an ALPS
-+ screen which Chris Dollar uses
-+
-+config FB_PXA_SHARP_LQ043_PSP
-+ boolean "SHARP LQ043... series"
-+ ---help---
-+ Enable definitions (over-ridable on the kernel command line if
-+ "PXA LCD command line parameters" is also selected) for a SHARP
-+ LQ043... screen, such as the one used by the PSP. These screens are
-+ the ones normally sold by gumstix with its boards.
-+
-+config FB_PXA_SAMSUNG_LTE430WQ_F0C
-+ boolean "Samsung LTE430WQ-F0C (standard gumstix LCD)"
-+ ---help---
-+ Enable definitions for a Samsung LTE430WQ-F0C LCD panel, such as the ones resold
-+ by gumstix for use with their "LCD-Ready" boards.
-+
-+config FB_PXA_NONEOFTHEABOVE
-+ boolean "None of the above"
-+
-+endchoice
-+
-
- config FB_PXA_OVERLAY
- bool "Support PXA27x/PXA3xx Overlay(s) as framebuffer"
diff --git a/target/linux/pxa/patches-3.3/003-gumstix_h_verdex_pro_support.patch b/target/linux/pxa/patches-3.3/003-gumstix_h_verdex_pro_support.patch
deleted file mode 100644
index 6dd291d483..0000000000
--- a/target/linux/pxa/patches-3.3/003-gumstix_h_verdex_pro_support.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From adb6abbe4e3bc17c20cdc70e4a4357f1633d4970 Mon Sep 17 00:00:00 2001
-From: Joseph Kortje <jpktech@rogers.com>
-Date: Wed, 28 Oct 2009 21:49:11 -0400
-Subject: [PATCH] [ARM] gumstix.h: Verdex Pro support
-
-Added a bunch of ifdefs to support both original gumstix boards
-as well as the Verdex Pro in gumstix.h
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- arch/arm/mach-pxa/include/mach/gumstix.h | 160 ++++++++++++++++++++++++------
- 1 files changed, 130 insertions(+), 30 deletions(-)
-
---- a/arch/arm/mach-pxa/include/mach/gumstix.h
-+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
-@@ -6,6 +6,9 @@
- * published by the Free Software Foundation.
- */
-
-+#if !defined(__ASM_ARCH_MFP_PXA27X_H) && !defined(__ASM_ARCH_MFP_PXA25X_H)
-+ #error You need to include either mfp-pxa27x.h or mfp-pxa25x.h
-+#endif
-
- /* BTRESET - Reset line to Bluetooth module, active low signal. */
- #define GPIO_GUMSTIX_BTRESET 7
-@@ -20,9 +23,18 @@ this moves to GPIO17 and GPIO37. */
- /* GPIOx - Connects to USB D+ and used as a pull-up after GPIOn
- has detected a cable insertion; driven low otherwise. */
-
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+
- #define GPIO_GUMSTIX_USB_GPIOn 35
- #define GPIO_GUMSTIX_USB_GPIOx 41
-
-+#else
-+
-+#define GPIO_GUMSTIX_USB_GPIOn 100
-+#define GPIO_GUMSTIX_USB_GPIOx 27
-+
-+#endif
-+
- /* usb state change */
- #define GUMSTIX_USB_INTR_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_USB_GPIOn)
-
-@@ -42,48 +54,136 @@ has detected a cable insertion; driven l
- * ETH_RST provides a hardware reset line to the ethernet chip
- * ETH is the IRQ line in from the ethernet chip to the PXA
- */
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
- #define GPIO_GUMSTIX_ETH0_RST 80
--#define GPIO_GUMSTIX_ETH0_RST_MD (GPIO_GUMSTIX_ETH0_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH0 36
-+#else
-+#define GPIO_GUMSTIX_ETH0_RST 107
-+#define GPIO_GUMSTIX_ETH0 99
-+#endif
- #define GPIO_GUMSTIX_ETH1_RST 52
--#define GPIO_GUMSTIX_ETH1_RST_MD (GPIO_GUMSTIX_ETH1_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH1 27
-
--#define GPIO_GUMSTIX_ETH0 36
-+#define GPIO_GUMSTIX_ETH0_RST_MD (GPIO_GUMSTIX_ETH0_RST | GPIO_OUT)
-+#define GPIO_GUMSTIX_ETH1_RST_MD (GPIO_GUMSTIX_ETH1_RST | GPIO_OUT)
- #define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN)
--#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
--#define GPIO_GUMSTIX_ETH1 27
- #define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
--#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
--
-
--/* CF reset line */
--#define GPIO8_RESET 8
-+#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
-+#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
-
--/* CF slot 0 */
--#define GPIO4_nBVD1 4
--#define GPIO4_nSTSCHG GPIO4_nBVD1
--#define GPIO11_nCD 11
--#define GPIO26_PRDY_nBSY 26
--#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO4_nSTSCHG)
--#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO11_nCD)
--#define GUMSTIX_S0_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO26_PRDY_nBSY)
-+ /* CF reset line */
-+#define GPIO8_CF_RESET 8
-+#define GPIO97_CF_RESET 97
-+#define GPIO110_CF_RESET 110
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_CF_RESET GPIO8_CF_RESET
-+#else
-+#define GPIO_GUMSTIX_CF_RESET GPIO97_CF_RESET
-+#endif
-+
-+#define GPIO_GUMSTIX_CF_OLD_RESET GPIO110_CF_RESET
-+
-+/* CF signals shared by both sockets */
-+#define GPIO_GUMSTIX_nPOE 48
-+#define GPIO_GUMSTIX_nPWE 49
-+#define GPIO_GUMSTIX_nPIOR 50
-+#define GPIO_GUMSTIX_nPIOW 51
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nPCE_1 52
-+#define GPIO_GUMSTIX_nPCE_2 53
-+#define GPIO_GUMSTIX_pSKTSEL 54
-+#else
-+#define GPIO_GUMSTIX_nPCE_1 102
-+#define GPIO_GUMSTIX_nPCE_2 105
-+#define GPIO_GUMSTIX_pSKTSEL 79
-+#endif
-+
-+#define GPIO_GUMSTIX_nPREG 55
-+#define GPIO_GUMSTIX_nPWAIT 56
-+#define GPIO_GUMSTIX_nIOIS16 57
-+
-+/* Pin mode definitions correspond to mfp-pxa2[57]x.h */
-+#define GPIO_GUMSTIX_nPOE_MD GPIO48_nPOE
-+#define GPIO_GUMSTIX_nPWE_MD GPIO49_nPWE
-+#define GPIO_GUMSTIX_nPIOR_MD GPIO50_nPIOR
-+#define GPIO_GUMSTIX_nPIOW_MD GPIO51_nPIOW
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nPCE_1_MD GPIO52_nPCE_1
-+#define GPIO_GUMSTIX_nPCE_2_MD GPIO53_nPCE_2
-+#define GPIO_GUMSTIX_pSKTSEL_MD GPIO54_pSKTSEL
-+#else
-+#define GPIO_GUMSTIX_nPCE_1_MD GPIO102_nPCE_1
-+#define GPIO_GUMSTIX_nPCE_2_MD GPIO105_nPCE_2
-+#define GPIO_GUMSTIX_pSKTSEL_MD GPIO79_pSKTSEL
-+#endif
-+
-+#define GPIO_GUMSTIX_nPREG_MD GPIO55_nPREG
-+#define GPIO_GUMSTIX_nPWAIT_MD GPIO56_nPWAIT
-+#define GPIO_GUMSTIX_nIOIS16_MD GPIO57_nIOIS16
-+
-+ /* CF slot 0 */
-+#define GPIO4_nBVD1_0 4
-+#define GPIO4_nSTSCHG_0 GPIO4_nBVD1_0
-+#define GPIO11_nCD_0 11
-+#define GPIO26_PRDY_nBSY_0 26
-+
-+#define GPIO111_nBVD1_0 111
-+#define GPIO111_nSTSCHG_0 GPIO111_nBVD1_0
-+#define GPIO104_nCD_0 104
-+#define GPIO96_PRDY_nBSY_0 96
-+#define GPIO109_PRDY_nBSY_0 109
-+
-+#ifndef CONFIG_MACH_GUMSTIX_VERDEX
-+#define GPIO_GUMSTIX_nBVD1_0 GPIO4_nBVD1_0
-+#define GPIO_GUMSTIX_nSTSCHG_0 GPIO4_nSTSCHG_0
-+#define GPIO_GUMSTIX_nCD_0 GPIO11_nCD_0
-+#define GPIO_GUMSTIX_PRDY_nBSY_0 GPIO26_PRDY_nBSY_0
-+#else
-+#define GPIO_GUMSTIX_nBVD1_0 GPIO111_nBVD1_0
-+#define GPIO_GUMSTIX_nSTSCHG_0 GPIO111_nSTSCHG_0
-+#define GPIO_GUMSTIX_nCD_0 GPIO104_nCD_0
-+#define GPIO_GUMSTIX_PRDY_nBSY_0 GPIO96_PRDY_nBSY_0
-+#endif
-+
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_OLD GPIO109_PRDY_nBSY_0
-+#define GUMSTIX_S0_PRDY_nBSY_OLD_IRQ PXA_GPIO_TO_IRQ(GPIO109_PRDY_nBSY_0)
-+
-+#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nSTSCHG_0)
-+#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nCD_0)
-+#define GUMSTIX_S0_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_PRDY_nBSY_0)
-
- /* CF slot 1 */
--#define GPIO18_nBVD1 18
--#define GPIO18_nSTSCHG GPIO18_nBVD1
--#define GPIO36_nCD 36
--#define GPIO27_PRDY_nBSY 27
--#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
--#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD)
--#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
--
--/* CF GPIO line modes */
--#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
--#define GPIO8_RESET_MD (GPIO8_RESET | GPIO_OUT)
--#define GPIO11_nCD_MD (GPIO11_nCD | GPIO_IN)
--#define GPIO18_nSTSCHG_MD (GPIO18_nSTSCHG | GPIO_IN)
--#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
--#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
--#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
-+#define GPIO18_nBVD1_1 18
-+#define GPIO18_nSTSCHG_1 GPIO18_nBVD1_1
-+#define GPIO36_nCD_1 36
-+#define GPIO27_PRDY_nBSY_1 27
-+
-+#define GPIO_GUMSTIX_nBVD1_1 GPIO18_nBVD1_1
-+#define GPIO_GUMSTIX_nSTSCHG_1 GPIO18_nSTSCHG_1
-+#define GPIO_GUMSTIX_nCD_1 GPIO36_nCD_1
-+#define GPIO_GUMSTIX_PRDY_nBSY_1 GPIO27_PRDY_nBSY_1
-+
-+#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG_1)
-+#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD_1)
-+#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY_1)
-+
-+/* CF GPIO line modes - correspond to mfp-pxa2[57]x.h */
-+#define GPIO_GUMSTIX_CF_RESET_MD (GPIO_GUMSTIX_CF_RESET | GPIO_OUT)
-+#define GPIO_GUMSTIX_CF_OLD_RESET_MD (GPIO_GUMSTIX_CF_OLD_RESET | GPIO_OUT)
-+
-+#define GPIO_GUMSTIX_nSTSCHG_0_MD GPIO111_GPIO
-+#define GPIO_GUMSTIX_nCD_0_MD GPIO104_GPIO
-+
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_MD GPIO96_GPIO
-+#define GPIO_GUMSTIX_PRDY_nBSY_0_OLD_MD GPIO109_GPIO
-+
-+#define GPIO_GUMSTIX_nSTSCHG_1_MD GPIO18_GPIO
-+#define GPIO_GUMSTIX_nCD_1_MD GPIO36_GPIO
-+#define GPIO_GUMSTIX_PRDY_nBSY_1_MD GPIO27_GPIO
-
- /* for expansion boards that can't be programatically detected */
- extern int am200_init(void);
diff --git a/target/linux/pxa/patches-3.3/004-smsc911x_verdex_pro_support.patch b/target/linux/pxa/patches-3.3/004-smsc911x_verdex_pro_support.patch
deleted file mode 100644
index d2f1c1ae2c..0000000000
--- a/target/linux/pxa/patches-3.3/004-smsc911x_verdex_pro_support.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 7645a459feb02f7aae4c3a5724b7800495d1b659 Mon Sep 17 00:00:00 2001
-From: Bobby Powers <bobbypowers@gmail.com>
-Date: Wed, 28 Oct 2009 22:41:31 -0400
-Subject: [PATCH] [ARM] smsc911x: Verdex Pro support
-
-Basically Joseph Kortje's patch, cleaned up to apply to Linus's
-tree. Some of the smsc911x.c had been applied already
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/net/smsc911x.c | 50 +++++++++++++++++++++++++++++++++++++--------
- drivers/net/smsc911x.h | 2 +-
- include/linux/smsc911x.h | 11 ++++++++++
- 3 files changed, 53 insertions(+), 10 deletions(-)
-
---- a/drivers/net/ethernet/smsc/smsc911x.c
-+++ b/drivers/net/ethernet/smsc/smsc911x.c
-@@ -1485,7 +1485,7 @@ static int smsc911x_open(struct net_devi
- SMSC_WARN(pdata, ifup,
- "Timed out waiting for EEPROM busy bit to clear");
-
-- smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
-+ smsc911x_reg_write(pdata, GPIO_CFG, GPIO_CFG_LED1_EN_ | GPIO_CFG_LED2_EN_ | (1 << 20));
-
- /* The soft reset above cleared the device's MAC address,
- * restore it from local copy (set in probe) */
-@@ -1497,8 +1497,8 @@ static int smsc911x_open(struct net_devi
- smsc911x_reg_write(pdata, INT_EN, 0);
- smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
-
-- /* Set interrupt deassertion to 100uS */
-- intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
-+ /* Set interrupt deassertion to 22*10uS */
-+ intcfg = ((22 << 24) | INT_CFG_IRQ_EN_);
-
- if (pdata->config.irq_polarity) {
- SMSC_TRACE(pdata, ifup, "irq polarity: active high");
-@@ -1524,7 +1524,7 @@ static int smsc911x_open(struct net_devi
- temp |= INT_EN_SW_INT_EN_;
- smsc911x_reg_write(pdata, INT_EN, temp);
-
-- timeout = 1000;
-+ timeout = 2000;
- while (timeout--) {
- if (pdata->software_irq_signal)
- break;
-@@ -2332,6 +2332,38 @@ static inline int smsc911x_probe_config_
- }
- #endif /* CONFIG_OF */
-
-+static inline unsigned int is_gumstix_oui(u8 *addr)
-+{
-+ return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9);
-+}
-+
-+/**
-+ * gen_serial_ether_addr - Generate software assigned Ethernet address
-+ * based on the system_serial number
-+ * @addr: Pointer to a six-byte array containing the Ethernet address
-+ *
-+ * Generate an Ethernet address (MAC) that is not multicast
-+ * and has the local assigned bit set, keyed on the system_serial
-+ */
-+static inline void gen_serial_ether_addr(u8 *addr)
-+{
-+ static u8 ether_serial_digit = 0;
-+ addr [0] = system_serial_high >> 8;
-+ addr [1] = system_serial_high;
-+ addr [2] = system_serial_low >> 24;
-+ addr [3] = system_serial_low >> 16;
-+ addr [4] = system_serial_low >> 8;
-+ addr [5] = (system_serial_low & 0xc0) | /* top bits are from system serial */
-+ (1 << 4) | /* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */
-+ ((ether_serial_digit++) & 0x0f); /* 15 possible interfaces of each type */
-+
-+ if(!is_gumstix_oui(addr))
-+ {
-+ addr [0] &= 0xfe; /* clear multicast bit */
-+ addr [0] |= 0x02; /* set local assignment bit (IEEE802) */
-+ }
-+}
-+
- static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
- {
- struct device_node *np = pdev->dev.of_node;
-@@ -2481,11 +2513,11 @@ static int __devinit smsc911x_drv_probe(
- SMSC_TRACE(pdata, probe,
- "Mac Address is read from LAN911x EEPROM");
- } else {
-- /* eeprom values are invalid, generate random MAC */
-- random_ether_addr(dev->dev_addr);
-+ /* eeprom values are invalid, generate MAC from serial number */
-+ gen_serial_ether_addr(dev->dev_addr);
- smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
- SMSC_TRACE(pdata, probe,
-- "MAC Address is set to random_ether_addr");
-+ "MAC Address is derived from system serial number");
- }
- }
-
diff --git a/target/linux/pxa/patches-3.3/005-verdex_pcmcia_support.patch b/target/linux/pxa/patches-3.3/005-verdex_pcmcia_support.patch
deleted file mode 100644
index f369cf21d3..0000000000
--- a/target/linux/pxa/patches-3.3/005-verdex_pcmcia_support.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-From 76a102bd5c9d792db19c6c72eafdecea0311a0c9 Mon Sep 17 00:00:00 2001
-From: Craig Hughes <craig@gumstix.com>
-Date: Fri, 30 Oct 2009 14:16:27 -0400
-Subject: [PATCH] [ARM] pxa: Gumstix Verdex PCMCIA support
-
-Needed for the Libertas CS wireless device.
-
-Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
----
- drivers/pcmcia/Kconfig | 3 +-
- drivers/pcmcia/Makefile | 3 +
- drivers/pcmcia/pxa2xx_gumstix.c | 194 +++++++++++++++++++++++++++++++++++++++
- 3 files changed, 199 insertions(+), 1 deletions(-)
- create mode 100644 drivers/pcmcia/pxa2xx_gumstix.c
-
---- a/drivers/pcmcia/Kconfig
-+++ b/drivers/pcmcia/Kconfig
-@@ -212,7 +212,7 @@ config PCMCIA_PXA2XX
- || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
- || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \
-- || MACH_COLIBRI320)
-+ || MACH_COLIBRI320 || ARCH_GUMSTIX)
- select PCMCIA_SOC_COMMON
- help
- Say Y here to include support for the PXA2xx PCMCIA controller
---- a/drivers/pcmcia/Makefile
-+++ b/drivers/pcmcia/Makefile
-@@ -70,6 +70,9 @@ pxa2xx-obj-$(CONFIG_MACH_BALLOON3) += p
- pxa2xx-obj-$(CONFIG_MACH_COLIBRI) += pxa2xx_colibri.o
- pxa2xx-obj-$(CONFIG_MACH_COLIBRI320) += pxa2xx_colibri.o
-
-+pxa2xx-obj-$(CONFIG_MACH_GUMSTIX_VERDEX) += pxa2xx_cs.o
-+pxa2xx_cs-objs := pxa2xx_gumstix.o
-+
- obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o $(pxa2xx-obj-y)
-
- obj-$(CONFIG_PCMCIA_XXS1500) += xxs1500_ss.o
---- /dev/null
-+++ b/drivers/pcmcia/pxa2xx_gumstix.c
-@@ -0,0 +1,195 @@
-+/*
-+ * linux/drivers/pcmcia/pxa2xx_gumstix.c
-+ *
-+ * Gumstix PCMCIA specific routines. Based on Mainstone
-+ *
-+ * Copyright 2004, Craig Hughes <craig@gumstix.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/init.h>
-+#include <linux/kernel.h>
-+#include <linux/errno.h>
-+#include <linux/interrupt.h>
-+#include <linux/irq.h>
-+#include <linux/gpio.h>
-+
-+#include <linux/delay.h>
-+#include <linux/platform_device.h>
-+
-+#include <linux/gpio-pxa.h>
-+
-+#include <pcmcia/ss.h>
-+
-+#include <mach/hardware.h>
-+#include <asm/mach-types.h>
-+
-+#include <mach/pxa27x.h>
-+
-+#include <asm/io.h>
-+#include <mach/gpio.h>
-+#include <mach/gumstix.h>
-+#include "soc_common.h"
-+
-+#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
-+
-+#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-+#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5))
-+
-+static struct pcmcia_irqs gumstix_pcmcia_irqs0[] = {
-+ { 0, GUMSTIX_S0_nCD_IRQ, "CF0 nCD" },
-+ { 0, GUMSTIX_S0_nSTSCHG_IRQ, "CF0 nSTSCHG" },
-+};
-+
-+static struct pcmcia_irqs gumstix_pcmcia_irqs1[] = {
-+ { 1, GUMSTIX_S1_nCD_IRQ, "CF1 nCD" },
-+ { 1, GUMSTIX_S1_nSTSCHG_IRQ, "CF1 nSTSCHG" },
-+};
-+
-+
-+static int net_cf_vx_mode = 0;
-+
-+static int gumstix_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
-+{
-+/* Note: The verdex_pcmcia_pin_config is moved to gumstix_verdex.c in order to use mfp_pxa2xx_config
-+ for board-specific pin configuration instead of the old deprecated pxa_gpio_mode function. Thus,
-+ only the IRQ init is still needed to be done here. */
-+ skt->socket.pci_irq = (skt->nr == 0) ? ((net_cf_vx_mode == 0) ? GUMSTIX_S0_PRDY_nBSY_IRQ : GUMSTIX_S0_PRDY_nBSY_OLD_IRQ) : GUMSTIX_S1_PRDY_nBSY_IRQ;
-+
-+ return (skt->nr == 0) ? soc_pcmcia_request_irqs(skt, gumstix_pcmcia_irqs0, ARRAY_SIZE(gumstix_pcmcia_irqs0)) :
-+ soc_pcmcia_request_irqs(skt, gumstix_pcmcia_irqs1, ARRAY_SIZE(gumstix_pcmcia_irqs1));
-+}
-+
-+static void gumstix_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
-+{
-+ if(skt->nr == 0)
-+ {
-+ soc_pcmcia_free_irqs(skt, gumstix_pcmcia_irqs0, ARRAY_SIZE(gumstix_pcmcia_irqs0));
-+ } else {
-+ soc_pcmcia_free_irqs(skt, gumstix_pcmcia_irqs1, ARRAY_SIZE(gumstix_pcmcia_irqs1));
-+ }
-+
-+ if (net_cf_vx_mode) {
-+ gpio_free(GPIO_GUMSTIX_CF_OLD_RESET);
-+ } else {
-+ gpio_free(GPIO_GUMSTIX_CF_RESET);
-+ }
-+
-+}
-+
-+static void gumstix_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
-+ struct pcmcia_state *state)
-+{
-+ unsigned int cd, prdy_nbsy, nbvd1;
-+ if(skt->nr == 0)
-+ {
-+ cd = GPIO_GUMSTIX_nCD_0;
-+ if(net_cf_vx_mode)
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_0_OLD;
-+ else
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_0;
-+ nbvd1 = GPIO_GUMSTIX_nBVD1_0;
-+ } else {
-+ cd = GPIO_GUMSTIX_nCD_1;
-+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_1;
-+ nbvd1 = GPIO_GUMSTIX_nBVD1_1;
-+ }
-+ state->detect = !!gpio_get_value(cd);
-+ state->ready = !!gpio_get_value(prdy_nbsy);
-+ state->bvd1 = !!gpio_get_value(nbvd1);
-+ state->bvd2 = 1;
-+ state->vs_3v = 0;
-+ state->vs_Xv = 0;
-+ state->wrprot = 0;
-+}
-+
-+static int gumstix_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
-+ const socket_state_t *state)
-+{
-+ return 0;
-+}
-+
-+static void gumstix_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
-+{
-+ if(skt->nr) {
-+ soc_pcmcia_enable_irqs(skt, gumstix_pcmcia_irqs0, ARRAY_SIZE(gumstix_pcmcia_irqs0));
-+ } else {
-+ soc_pcmcia_enable_irqs(skt, gumstix_pcmcia_irqs1, ARRAY_SIZE(gumstix_pcmcia_irqs1));
-+ }
-+}
-+
-+static void gumstix_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
-+{
-+ if(skt->nr) {
-+ soc_pcmcia_disable_irqs(skt, gumstix_pcmcia_irqs0, ARRAY_SIZE(gumstix_pcmcia_irqs0));
-+ } else {
-+ soc_pcmcia_disable_irqs(skt, gumstix_pcmcia_irqs1, ARRAY_SIZE(gumstix_pcmcia_irqs1));
-+ }
-+}
-+
-+static struct pcmcia_low_level gumstix_pcmcia_ops = {
-+ .owner = THIS_MODULE,
-+ .hw_init = gumstix_pcmcia_hw_init,
-+ .hw_shutdown = gumstix_pcmcia_hw_shutdown,
-+ .socket_state = gumstix_pcmcia_socket_state,
-+ .configure_socket = gumstix_pcmcia_configure_socket,
-+ .socket_init = gumstix_pcmcia_socket_init,
-+ .socket_suspend = gumstix_pcmcia_socket_suspend,
-+ .nr = 2,
-+};
-+
-+static struct platform_device *gumstix_pcmcia_device;
-+
-+extern int __init gumstix_get_cf_cards(void);
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+extern int __init gumstix_check_if_netCF_vx(void);
-+#endif
-+
-+static int __init gumstix_pcmcia_init(void)
-+{
-+ int ret;
-+
-+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
-+ net_cf_vx_mode = gumstix_check_if_netCF_vx();
-+#endif
-+
-+ gumstix_pcmcia_ops.nr = gumstix_get_cf_cards();
-+
-+ gumstix_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
-+ if (!gumstix_pcmcia_device)
-+ return -ENOMEM;
-+
-+ ret = platform_device_add_data(gumstix_pcmcia_device, &gumstix_pcmcia_ops,
-+ sizeof(gumstix_pcmcia_ops));
-+
-+ if (ret == 0) {
-+ printk(KERN_INFO "Registering gumstix PCMCIA interface.\n");
-+ ret = platform_device_add(gumstix_pcmcia_device);
-+ }
-+
-+ if (ret)
-+ platform_device_put(gumstix_pcmcia_device);
-+
-+ return ret;
-+}
-+
-+static void __exit gumstix_pcmcia_exit(void)
-+{
-+ /*
-+ * This call is supposed to free our gumstix_pcmcia_device.
-+ * Unfortunately platform_device don't have a free method, and
-+ * we can't assume it's free of any reference at this point so we
-+ * can't free it either.
-+ */
-+ platform_device_unregister(gumstix_pcmcia_device);
-+}
-+
-+fs_initcall(gumstix_pcmcia_init);
-+module_exit(gumstix_pcmcia_exit);
-+
-+MODULE_LICENSE("GPL");
diff --git a/target/linux/pxa/patches-3.3/a01-arm-debugll-printk.patch b/target/linux/pxa/patches-3.3/a01-arm-debugll-printk.patch
deleted file mode 100644
index f1bf48dd54..0000000000
--- a/target/linux/pxa/patches-3.3/a01-arm-debugll-printk.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/kernel/printk.c
-+++ b/kernel/printk.c
-@@ -44,6 +44,10 @@
-
- #include <asm/uaccess.h>
-
-+#ifdef CONFIG_DEBUG_LL
-+extern void printascii(char *);
-+#endif /* CONFIG_DEBUG_LL */
-+
- /*
- * Architectures can override it:
- */
-@@ -900,6 +904,10 @@ asmlinkage int vprintk(const char *fmt,
- }
- }
-
-+#ifdef CONFIG_DEBUG_LL
-+ printascii(printk_buf);
-+#endif
-+
- /*
- * Copy the output into log_buf. If the caller didn't provide
- * the appropriate log prefix, we insert them here
diff --git a/target/linux/pxa/profiles/100-Default.mk b/target/linux/pxa/profiles/100-Default.mk
deleted file mode 100644
index 566a43f7b9..0000000000
--- a/target/linux/pxa/profiles/100-Default.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Default
- NAME:=Default Profile
- PACKAGES:=
-endef
-
-define Profile/Default/Description
- Default PXA Profile
-endef
-$(eval $(call Profile,Default))
-
diff --git a/target/linux/pxa/profiles/200-Gumstix.mk b/target/linux/pxa/profiles/200-Gumstix.mk
deleted file mode 100644
index f296414d4b..0000000000
--- a/target/linux/pxa/profiles/200-Gumstix.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Gumstix
- NAME:=Gumstix
- PACKAGES:=uboot-pxa-gumstix
-endef
-
-define Profile/Atheros-ath5k/Description
- Package set compatible with the Gumstix boards
-endef
-$(eval $(call Profile,Gumstix))
-