summaryrefslogtreecommitdiff
path: root/packages/linux/linux-ezx-2.6.23/patches
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-10-25 10:31:01 +0000
committerKoen Kooi <koen@openembedded.org>2007-10-25 10:31:01 +0000
commit94c3777fa5fc58845643fd6fe384b15b269cc77c (patch)
tree804a5cb45759c0e9ae1bb6f3901d10bf6ee3919d /packages/linux/linux-ezx-2.6.23/patches
parentd3368a25f2087798de52005aacb7b532e516d380 (diff)
linux-ezx: add 2.6.23
Diffstat (limited to 'packages/linux/linux-ezx-2.6.23/patches')
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/.mtn2git_empty0
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/Makefile.OpenEZX77
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-eoc.patch20
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-flip.patch47
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-kbd.patch98
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-mci.patch124
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-pcap.patch83
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a1200-ts.patch39
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-emu.patch38
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-flip.patch46
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-kbd.patch90
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-leds.patch187
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-mci.patch125
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-pcap.patch90
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-ts.patch39
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/a780-vibrator.patch102
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/asoc-fix-loopback.patch14
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/asoc-pxa-ssp.patch755
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/binutils-buildid-arm.patch16
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/defconfig-a12001208
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/defconfig-a7801214
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/defconfig-e21189
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/defconfig-e61203
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/defconfig-e6801214
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/dmesg-a780.log299
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e6-eoc.patch20
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e6-mci.patch124
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e6-pcap.patch83
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e6-ts.patch39
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-emu.patch38
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-kbd.patch93
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-leds.patch300
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-locksw.patch45
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-mci.patch126
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-pcap.patch90
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/e680-ts.patch39
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-asoc.patch1302
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-backlight.patch203
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-bp.patch340
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-core.patch1016
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-emu.patch269
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-enable-stuart.patch99
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-eoc.patch295
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-mtd-map.patch309
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-pcap.patch849
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-pm.patch108
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/ezx-serial-bug-workaround.patch45
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-fix-init-errorpath.patch20
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-fix-makefile.patch14
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-fix-tty-driver.patch125
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-fix.patch164
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-ifdef-ezx-features.patch99
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-linux-2.6.21-fix.patch297
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-remove-flipbuffers.patch269
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-remove-get_halted_bit.patch22
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux-remove-usbh_finished_resume.patch22
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux_cli.patch5396
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/mux_debug.patch551
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/patch-2.6.23.1108
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/pcap-ts.patch363
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/pxa-kbd.patch545
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-fix-a1200.patch45
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-support.3.patch3113
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/pxa27x_overlay-r7.patch2436
-rw-r--r--packages/linux/linux-ezx-2.6.23/patches/series106
65 files changed, 27844 insertions, 0 deletions
diff --git a/packages/linux/linux-ezx-2.6.23/patches/.mtn2git_empty b/packages/linux/linux-ezx-2.6.23/patches/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/.mtn2git_empty
diff --git a/packages/linux/linux-ezx-2.6.23/patches/Makefile.OpenEZX b/packages/linux/linux-ezx-2.6.23/patches/Makefile.OpenEZX
new file mode 100644
index 0000000000..e7e9115e3c
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/Makefile.OpenEZX
@@ -0,0 +1,77 @@
+# Makefile used to build binary images of OpenEZX kernels
+#
+# If you are currently in the linux kernel toplevel dir,
+# you can call this Makefile with:
+# $ make -f path_to/Makefile.OpenEZX
+#
+# Note that you can set the CROSS_COMPILE and QUILT_PATCHES variable
+# in your environment.
+#
+
+PHONES = a780 e680 a1200 e6 e2
+
+CROSS_COMPILE ?= /home/wyrm/ezx/dev/cross/bin/arm-angstrom-linux-gnueabi-
+QUILT_PATCHES ?= patches
+
+LV ?= ezxdev# replace LOCALVERSION string
+J ?= 2 # simultaneous jobs
+SIG ?= 0 # BOOL sign md5sums file
+
+DATE = $(shell date +%Y%m%d)
+DEPLOY_SERVER ?= people.openezx.org
+DEPLOY_DIR ?= public_html/images/$(DATE)/
+
+all: $(foreach p, $(PHONES), zImage-$(p) modules-$(p).tar.gz)
+
+zImages: $(foreach p, $(PHONES), zImage-$(p))
+
+modules: $(foreach p, $(PHONES), modules-$(p).tar.gz)
+
+config: $(foreach p, $(PHONES), config-$(p))
+
+config-%: $(QUILT_PATCHES)/defconfig-%
+ cp $< .config
+ make ARCH=arm oldconfig
+ cp .config $<
+
+deploy: release
+ ssh $(DEPLOY_SERVER) \
+ mkdir -p $(DEPLOY_DIR)
+ scp ezxrelease-$(DATE).tar $(DEPLOY_SERVER):$(DEPLOY_DIR)
+ ssh $(DEPLOY_SERVER) \
+ cd $(DEPLOY_DIR)\; \
+ tar -xf ezxrelease-$(DATE).tar\; \
+ rm -f ezxrelease-$(DATE).tar
+
+release: $(foreach p, $(PHONES), tag-$(p))
+ cp md5sums.tmp md5sums
+ test "$(SIG)" = "1" && \
+ cat md5sums.tmp | gpg --clearsign > md5sums \
+ ; echo
+ tar -rf ezxrelease.tar md5sums
+ rm -f md5sums.tmp md5sums
+ mv ezxrelease.tar ezxrelease-$(DATE).tar
+
+tag-%: zImage-% modules-%.tar.gz
+ p=$(patsubst tag-%,%,$@) && \
+ tag=$(shell cat include/config/kernel.release)-$(DATE) && \
+ mv zImage-$$p zImage-$$tag-$$p && \
+ mv modules-$$p.tar.gz modules-$$tag-$$p.tar.gz && \
+ tar -rf ezxrelease.tar zImage-$$tag-$$p modules-$$tag-$$p.tar.gz && \
+ md5sum zImage-$$tag-$$p modules-$$tag-$$p.tar.gz >> md5sums.tmp && \
+ rm -f zImage-$$tag-$$p modules-$$tag-$$p.tar.gz
+
+zImage-%: $(QUILT_PATCHES)/defconfig-%
+ cat $< | sed 's/LOCALVERSION=".*"$$/LOCALVERSION="-$(LV)"/' > .config
+ make -j$(J) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
+ mv arch/arm/boot/zImage $@
+
+modules-%.tar.gz: $(QUILT_PATCHES)/defconfig-%
+ cat $< | sed 's/LOCALVERSION=".*"$$/LOCALVERSION="-$(LV)"/' > .config
+ -find . -name "*.ko" -print0 | xargs -r0 rm
+ mkdir -p Makefile.OpenEZX-tmp/$@
+ make -j$(J) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
+ make -j1 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) \
+ INSTALL_MOD_PATH=Makefile.OpenEZX-tmp/$@ modules_install
+ tar -C Makefile.OpenEZX-tmp/$@ -czf $@ .
+ rm -rf Makefile.OpenEZX-tmp/
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-eoc.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-eoc.patch
new file mode 100644
index 0000000000..77aec1c629
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-eoc.patch
@@ -0,0 +1,20 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-09-24 20:14:54.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c 2007-09-24 20:15:18.000000000 -0300
+@@ -203,8 +203,15 @@
+ },
+ };
+
++
++struct platform_device a1200_eoc_device = {
++ .name = "ezx-eoc",
++ .id = -1,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &a1200_pcap_device,
++ &a1200_eoc_device,
+ };
+
+ static void __init a1200_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-flip.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-flip.patch
new file mode 100644
index 0000000000..d932ca1605
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-flip.patch
@@ -0,0 +1,47 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-10-24 19:37:28.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c 2007-10-24 19:40:22.000000000 +0200
+@@ -16,6 +16,7 @@
+ #include <linux/mmc/host.h>
+ #include <linux/irq.h>
+ #include <linux/input.h>
++#include <linux/gpio_keys.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -292,11 +293,34 @@
+ .num_resources = ARRAY_SIZE(pcap_ts_resources),
+ .resource = pcap_ts_resources,
+ };
++/* Flip */
++#undef GPIO_FLIP_PIN
++#define GPIO_FLIP_PIN 15 /* FIXME */
++static struct gpio_keys_button a1200flip_buttons[] = {
++ [0] = {
++ .code = KEY_SLEEP,
++ .gpio = GPIO_FLIP_PIN,
++ .desc = "A1200 flip",
++ },
++};
++
++static struct gpio_keys_platform_data a1200flip_platform_data = {
++ .buttons = a1200flip_buttons,
++ .nbuttons = 1,
++};
++static struct platform_device a1200flip_device = {
++ .name = "gpio-keys",
++ .id = -1,
++ .dev = {
++ .platform_data = &a1200flip_platform_data,
++ },
++};
+
+ static struct platform_device *devices[] __initdata = {
+ &a1200_pcap_device,
+ &a1200_eoc_device,
+ &pcap_ts_device,
++ &a1200flip_device,
+ };
+
+ static void __init a1200_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-kbd.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-kbd.patch
new file mode 100644
index 0000000000..5771f6d359
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-kbd.patch
@@ -0,0 +1,98 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-09-25 00:03:01.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c 2007-09-25 02:00:40.000000000 -0300
+@@ -15,6 +15,7 @@
+ #include <linux/fb.h>
+ #include <linux/mmc/host.h>
+ #include <linux/irq.h>
++#include <linux/input.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -23,11 +24,13 @@
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
+ #include <asm/arch/mmc.h>
++#include <asm/arch/kbd.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
++extern void __init pxa_set_kbd_info(struct pxakbd_platform_data *);
+
+ #ifdef CONFIG_EZX_PCAP
+ extern int ezx_pcap_mmcsd_power(int);
+@@ -209,6 +212,63 @@
+ .id = -1,
+ };
+
++/* Keypad */
++static unsigned char a1200_keycode[] = {
++ /* row 0 */
++ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
++ /* row 1 */
++ KEY_RIGHT, KEY_DOWN, KEY_KPENTER, KEY_UP, KEY_LEFT,
++ /* row 2 */
++ KEY_PAGEDOWN, KEY_CAMERA, KEY_RECORD, KEY_HOME, KEY_PAGEUP,
++ /* row 3 */
++ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
++ /* row 4 */
++ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
++ /* row 5 */
++ KEY_RESERVED, KEY_RESERVED, KEY_MENU, KEY_RESERVED, KEY_RESERVED,
++};
++/*
++static unsigned char a1200_direct_keycode[] = {
++ KEY_CAMERA,
++};
++*/
++
++static int a1200_kbd_init(void)
++{
++ pxa_gpio_mode(100 | GPIO_ALT_FN_1_IN); /* KP_MKIN<0> */
++ pxa_gpio_mode(101 | GPIO_ALT_FN_1_IN); /* KP_MKIN<1> */
++ pxa_gpio_mode(102 | GPIO_ALT_FN_1_IN); /* KP_MKIN<2> */
++ pxa_gpio_mode(97 | GPIO_ALT_FN_3_IN); /* KP_MKIN<3> */
++ pxa_gpio_mode(98 | GPIO_ALT_FN_3_IN); /* KP_MKIN<4> */
++ pxa_gpio_mode(103 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<0> */
++ pxa_gpio_mode(104 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<1> */
++ pxa_gpio_mode(105 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<2> */
++ pxa_gpio_mode(106 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<3> */
++ pxa_gpio_mode(107 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<4> */
++ pxa_gpio_mode(108 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<5> */
++
++ PKWR = 0xEC000;
++ PGSR3 |= 0x1F80;
++ return 0;
++}
++
++static struct pxakbd_platform_data a1200_kbd_platform_data = {
++ .init = &a1200_kbd_init,
++ .scan_interval = HZ/40,
++ .matrix = {
++ .keycode = a1200_keycode,
++ .cols = 6,
++ .rows = 5,
++ },
++/*
++ .direct = {
++ .keycode = a1200_direct_keycode,
++ .num = 1,
++ },
++*/
++};
++
++
+ static struct platform_device *devices[] __initdata = {
+ &a1200_pcap_device,
+ &a1200_eoc_device,
+@@ -218,6 +278,7 @@
+ {
+ set_pxa_fb_info(&a1200_fb_info);
+ pxa_set_mci_info(&a1200_mci_platform_data);
++ pxa_set_kbd_info(&a1200_kbd_platform_data);
+
+ platform_add_devices(devices, ARRAY_SIZE(devices));
+ }
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-mci.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-mci.patch
new file mode 100644
index 0000000000..e5f3257d11
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-mci.patch
@@ -0,0 +1,124 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-10-24 18:58:55.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c 2007-10-24 19:37:21.000000000 +0200
+@@ -13,6 +13,8 @@
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+ #include <linux/fb.h>
++#include <linux/mmc/host.h>
++#include <linux/irq.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -20,12 +22,102 @@
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
++#include <asm/arch/mmc.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
+
++#ifdef CONFIG_EZX_PCAP
++extern int ezx_pcap_mmcsd_power(int);
++extern void ezx_pcap_mmcsd_voltage(u_int32_t);
++#else
++#define ezx_pcap_mmcsd_voltage(x) {}
++#define ezx_pcap_mmcsd_power(x) {}
++#endif
++
++static struct pxamci_platform_data a1200_mci_platform_data;
++
++static u_int8_t mmc_voltage[] = {
++ [ilog2(MMC_VDD_165_195)] = 6,
++ [ilog2(MMC_VDD_20_21)] = 7,
++ [ilog2(MMC_VDD_21_22)] = 8,
++ [ilog2(MMC_VDD_22_23)] = 8,
++ [ilog2(MMC_VDD_23_24)] = 9,
++ [ilog2(MMC_VDD_24_25)] = 9,
++ [ilog2(MMC_VDD_25_26)] = 10,
++ [ilog2(MMC_VDD_26_27)] = 10,
++ [ilog2(MMC_VDD_27_28)] = 11,
++ [ilog2(MMC_VDD_28_29)] = 11,
++ [ilog2(MMC_VDD_29_30)] = 12,
++ [ilog2(MMC_VDD_30_31)] = 12,
++ [ilog2(MMC_VDD_31_32)] = 13,
++ [ilog2(MMC_VDD_32_33)] = 13,
++ [ilog2(MMC_VDD_33_34)] = 14,
++ [ilog2(MMC_VDD_34_35)] = 14,
++ [ilog2(MMC_VDD_35_36)] = 15,
++};
++
++static int a1200_mci_init(struct device *dev,
++ irqreturn_t (*ezx_detect_int)(int, void *),
++ void *data)
++{
++ int err;
++
++ /* Setup GPIO for PXA27x MMC/SD controller */
++ pxa_gpio_mode(GPIO32_MMCCLK_MD);
++ pxa_gpio_mode(GPIO112_MMCCMD_MD);
++ pxa_gpio_mode(GPIO92_MMCDAT0_MD);
++ pxa_gpio_mode(GPIO109_MMCDAT1_MD);
++ pxa_gpio_mode(GPIO110_MMCDAT2_MD);
++ pxa_gpio_mode(GPIO111_MMCDAT3_MD);
++
++ ezx_pcap_mmcsd_power(1);
++
++ a1200_mci_platform_data.detect_delay = msecs_to_jiffies(250);
++
++ err = request_irq(0x49, ezx_detect_int, IRQF_DISABLED,
++ "MMC card detect", data);
++ if (err) {
++ printk(KERN_ERR "ezx_mci_detect: MMC/SD: can't request "
++ "MMC card detect IRQ\n");
++ return -1;
++ }
++
++ set_irq_type(0x0b, IRQT_BOTHEDGE);
++
++ return 0;
++}
++
++static void a1200_mci_setpower(struct device *dev, unsigned int vdd)
++{
++ struct pxamci_platform_data* p_d = dev->platform_data;
++
++ if (( 1 << vdd) & p_d->ocr_mask)
++ ezx_pcap_mmcsd_voltage(mmc_voltage[vdd]);
++
++ ezx_pcap_mmcsd_power(1);
++}
++
++static void a1200_mci_exit(struct device *dev, void *data)
++{
++ ezx_pcap_mmcsd_power(0);
++ free_irq(0x49, data);
++}
++
++static struct pxamci_platform_data a1200_mci_platform_data = {
++ .ocr_mask = MMC_VDD_165_195|MMC_VDD_20_21|MMC_VDD_21_22
++ |MMC_VDD_22_23|MMC_VDD_23_24|MMC_VDD_24_25
++ |MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28
++ |MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31
++ |MMC_VDD_31_32|MMC_VDD_32_33|MMC_VDD_33_34
++ |MMC_VDD_34_35|MMC_VDD_35_36,
++ .init = a1200_mci_init,
++ .setpower = a1200_mci_setpower,
++ .exit = a1200_mci_exit,
++};
++
+ static struct pxafb_mode_info mode_a1200 = {
+ .pixclock = 192308,
+ .xres = 240,
+@@ -118,6 +210,7 @@
+ static void __init a1200_init(void)
+ {
+ set_pxa_fb_info(&a1200_fb_info);
++ pxa_set_mci_info(&a1200_mci_platform_data);
+
+ platform_add_devices(devices, ARRAY_SIZE(devices));
+ }
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-pcap.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-pcap.patch
new file mode 100644
index 0000000000..8aa1e46d73
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-pcap.patch
@@ -0,0 +1,83 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-09-07 11:32:32.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c 2007-09-07 11:51:55.000000000 -0300
+@@ -19,6 +19,7 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
++#include <asm/arch/ezx-pcap.h>
+
+ #include "generic.h"
+
+@@ -48,7 +49,70 @@
+ .pxafb_lcd_power = &ezx_lcd_power,
+ };
+
++/* PCAP */
++static int __init a1200_pcap_init(void)
++{
++ /*
++ * FIXME: this is the PCAP INITIAL STATE.
++ * most of these writes should NOT be done here
++ * * voltage regulators, voltage enablers should be set by the
++ * driver which uses the connected hardware. Otherwise you
++ * drain power unnecessarily.
++ * * interrupt related registers should be set by the irq functions
++ * only. I think that the INT_SEL register selects on which irq
++ * pin the (ap/bp) the irq goes. This should go on ezx-pcap.c, but
++ * only if it actually makes any difference.
++ * * Only power state automatic changes should be done here.
++ * (*LOWPWR, *STBY, LOWPWR*)
++ * * I removed some writes which i consider extremelly wrong. And
++ * which i think will not break anything (they were overwritten
++ * later anyway).
++ *
++ * --WM
++ */
++ ezx_pcap_write(PCAP_REG_INT_SEL, 0x0); /* wrong */
++ ezx_pcap_write(PCAP_REG_SWCTRL, 0x2ee6); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_VREG1, 0x15778e3); /* wrong */
++ ezx_pcap_write(PCAP_REG_VREG2, 0x810234); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_AUXVREG, 0x1024bec); /* wrong */
++ ezx_pcap_write(PCAP_REG_PWR, 0x94108); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_AUXVREG_MASK, 0x214d48); /* wrong */
++ ezx_pcap_write(PCAP_REG_BUSCTRL, 0x2a0); /* wrong */
++ ezx_pcap_write(PCAP_REG_LOWPWR, 0x1d9610c);
++ ezx_pcap_write(PCAP_REG_PERIPH, 0x0); /* wrong */
++ ezx_pcap_write(PCAP_REG_GP, 0x107); /* probably unnecessary */
++
++ return 0;
++}
++
++static struct pcap_platform_data a1200_pcap_platform_data = {
++ .port = 1,
++ .cs = GPIO_SPI_CE,
++ .flags = PCAP_CS_AH | PCAP_MCI_TF,
++ .clk = 1,
++ .init = a1200_pcap_init,
++};
++
++static struct resource a1200_pcap_resources[] = {
++ [0] = {
++ .start = IRQ_GPIO1,
++ .end = IRQ_GPIO1,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device a1200_pcap_device = {
++ .name = "ezx-pcap",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(a1200_pcap_resources),
++ .resource = a1200_pcap_resources,
++ .dev = {
++ .platform_data = &a1200_pcap_platform_data,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
++ &a1200_pcap_device,
+ };
+
+ static void __init a1200_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a1200-ts.patch b/packages/linux/linux-ezx-2.6.23/patches/a1200-ts.patch
new file mode 100644
index 0000000000..bf328cd931
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a1200-ts.patch
@@ -0,0 +1,39 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a1200.c 2007-09-25 02:00:40.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-a1200.c 2007-09-25 02:00:53.000000000 -0300
+@@ -269,9 +269,34 @@
+ };
+
+
++/* PCAP_TS */
++struct resource pcap_ts_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_ADCDONE,
++ .end = EZX_IRQ_ADCDONE,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_TS,
++ .end = EZX_IRQ_TS,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++struct platform_device pcap_ts_device = {
++ .name = "pcap-ts",
++ .id = -1,
++ .dev = {
++ .parent = &a1200_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(pcap_ts_resources),
++ .resource = pcap_ts_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &a1200_pcap_device,
+ &a1200_eoc_device,
++ &pcap_ts_device,
+ };
+
+ static void __init a1200_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-emu.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-emu.patch
new file mode 100644
index 0000000000..ae9237394d
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-emu.patch
@@ -0,0 +1,38 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 23:03:48.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 23:04:03.000000000 +0200
+@@ -212,8 +212,33 @@
+ },
+ };
+
++/* EMU */
++static struct resource a780_emu_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_USB4V,
++ .end = EZX_IRQ_USB4V,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_USB1V,
++ .end = EZX_IRQ_USB1V,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device a780_emu_device = {
++ .name = "ezx-emu",
++ .id = -1,
++ .dev = {
++ .parent = &a780_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(a780_emu_resources),
++ .resource = a780_emu_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &a780_pcap_device,
++ &a780_emu_device,
+ };
+
+ static void __init a780_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-flip.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-flip.patch
new file mode 100644
index 0000000000..44b97880ca
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-flip.patch
@@ -0,0 +1,46 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:37:58.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:38:04.000000000 +0200
+@@ -18,6 +18,7 @@
+ #include <linux/irq.h>
+ #include <linux/log2.h>
+ #include <linux/input.h>
++#include <linux/gpio_keys.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -312,10 +313,33 @@
+ .resource = pcap_ts_resources,
+ };
+
++static struct gpio_keys_button a780flip_buttons[] = {
++ [0] = {
++ .code = KEY_SLEEP,
++ .gpio = GPIO_FLIP_PIN,
++ .desc = "A780 flip",
++ },
++};
++
++static struct gpio_keys_platform_data a780flip_platform_data = {
++ .buttons = a780flip_buttons,
++ .nbuttons = 1,
++};
++
++static struct platform_device a780flip_device = {
++ .name = "gpio-keys",
++ .id = -1,
++ .dev = {
++ .platform_data = &a780flip_platform_data,
++ },
++};
++
++
+ static struct platform_device *devices[] __initdata = {
+ &a780_pcap_device,
+ &a780_emu_device,
+ &pcap_ts_device,
++ &a780flip_device,
+ };
+
+ static void __init a780_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-kbd.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-kbd.patch
new file mode 100644
index 0000000000..df60384b9c
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-kbd.patch
@@ -0,0 +1,90 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:36:54.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:37:43.000000000 +0200
+@@ -17,6 +17,7 @@
+ #include <linux/mmc/host.h>
+ #include <linux/irq.h>
+ #include <linux/log2.h>
++#include <linux/input.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -25,11 +26,13 @@
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
+ #include <asm/arch/mmc.h>
++#include <asm/arch/kbd.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
++extern void __init pxa_set_kbd_info(struct pxakbd_platform_data *);
+
+ #ifdef CONFIG_EZX_PCAP
+ extern int ezx_pcap_mmcsd_power(int);
+@@ -236,6 +239,55 @@
+ .resource = a780_emu_resources,
+ };
+
++static unsigned char a780_keycode[] = {
++ /* row 0 */
++ KEY_PHONE, KEY_MENU, KEY_CANCEL, KEY_PAGEUP, KEY_UP,
++ /* row 1 */
++ KEY_KP1, KEY_KP2, KEY_KP3, KEY_ENTER, KEY_KPENTER, /*center joypad */
++ /* row 2 */
++ KEY_KP4, KEY_KP5, KEY_KP6, KEY_RECORD, KEY_LEFT,
++ /* row 3 */
++ KEY_KP7, KEY_KP8, KEY_KP9, KEY_HOME, KEY_RIGHT,
++ /* row 4 */
++ KEY_KPASTERISK, KEY_KP0, KEY_KPDOT, KEY_PAGEDOWN, KEY_DOWN,
++};
++
++static unsigned char a780_direct_keycode[] = {
++ KEY_CAMERA,
++};
++
++static int a780_kbd_init(void)
++{
++ pxa_gpio_mode(93 | GPIO_ALT_FN_1_IN); /* KP_DKIN<0>, voice_rec */
++ pxa_gpio_mode(97 | GPIO_ALT_FN_3_IN); /* KP_MKIN<3> */
++ pxa_gpio_mode(98 | GPIO_ALT_FN_3_IN); /* KP_MKIN<4> */
++ pxa_gpio_mode(100 | GPIO_ALT_FN_1_IN); /* KP_MKIN<0> */
++ pxa_gpio_mode(101 | GPIO_ALT_FN_1_IN); /* KP_MKIN<1> */
++ pxa_gpio_mode(102 | GPIO_ALT_FN_1_IN); /* KP_MKIN<2> */
++ pxa_gpio_mode(103 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<0> */
++ pxa_gpio_mode(104 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<1> */
++ pxa_gpio_mode(105 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<2> */
++ pxa_gpio_mode(106 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<3> */
++ pxa_gpio_mode(107 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<4> */
++ PKWR = 0xec400;
++ PGSR3 |= 0xf80;
++ return 0;
++}
++
++static struct pxakbd_platform_data a780_kbd_platform_data = {
++ .init = &a780_kbd_init,
++ .scan_interval = HZ/40,
++ .matrix = {
++ .keycode = a780_keycode,
++ .cols = 5,
++ .rows = 5,
++ },
++ .direct = {
++ .keycode = a780_direct_keycode,
++ .num = 1,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &a780_pcap_device,
+ &a780_emu_device,
+@@ -256,6 +308,7 @@
+
+ set_pxa_fb_info(&a780_fb_info);
+ pxa_set_mci_info(&a780_mci_platform_data);
++ pxa_set_kbd_info(&a780_kbd_platform_data);
+
+ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
+ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-leds.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-leds.patch
new file mode 100644
index 0000000000..94aae070ae
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-leds.patch
@@ -0,0 +1,187 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+Index: linux-2.6.23/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Kconfig 2007-10-23 19:35:34.000000000 +0200
++++ linux-2.6.23/drivers/leds/Kconfig 2007-10-23 19:38:13.000000000 +0200
+@@ -110,6 +110,13 @@
+ These triggers allow kernel events to drive the LEDs and can
+ be configured via sysfs. If unsure, say Y.
+
++config LEDS_A780
++ tristate "LED Support for the Motorola A780 GSM Phone"
++ depends LEDS_CLASS && PXA_EZX_A780
++ help
++ This option enables support for the LEDs on the
++ Motorola A780 GSM Phone.
++
+ config LEDS_TRIGGER_TIMER
+ tristate "LED Timer Trigger"
+ depends on LEDS_TRIGGERS
+Index: linux-2.6.23/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Makefile 2007-10-23 19:35:34.000000000 +0200
++++ linux-2.6.23/drivers/leds/Makefile 2007-10-23 19:38:13.000000000 +0200
+@@ -17,6 +17,7 @@
+ obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
+ obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
+ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
++obj-$(CONFIG_LEDS_A780) += leds-a780.o
+
+ # LED Triggers
+ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
+Index: linux-2.6.23/drivers/leds/leds-a780.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/leds/leds-a780.c 2007-10-23 19:38:09.000000000 +0200
+@@ -0,0 +1,122 @@
++/*
++ * EZX Platform LED Driver for the Motorola A780 GSM Phone
++ *
++ * Copyright 2006 Vanille-Media
++ *
++ * Author: Michael Lauer <mickey@Vanille.de>
++ *
++ * Based on keylight.c by Motorola and leds-corgi.c by Richard Purdie
++ *
++ * 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/platform_device.h>
++#include <linux/leds.h>
++#include <asm/arch/ezx-pcap.h>
++
++static void a780led_main_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if ( value > 31 ) value = 31;
++ printk( KERN_DEBUG "a780led_main_set: %d\n", value );
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL_CTRL0, value & 0x01);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL_CTRL1, value & 0x02);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL_CTRL2, value & 0x04);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL_CTRL3, value & 0x08);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL_CTRL4, value & 0x10);
++}
++
++static void a780led_aux_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if ( value > 31 ) value = 31;
++ printk( KERN_DEBUG "a780led_aux_set: %d\n", value );
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL0, value & 0x01);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL1, value & 0x02);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL2, value & 0x04);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL3, value & 0x08);
++ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL4, value & 0x10);
++}
++
++static struct led_classdev a780_main_led = {
++ .name = "a780:main",
++ .default_trigger = "none",
++ .brightness_set = a780led_main_set,
++};
++
++static struct led_classdev a780_aux_led = {
++ .name = "a780:aux",
++ .default_trigger = "none",
++ .brightness_set = a780led_aux_set,
++};
++
++#ifdef CONFIG_PM
++static int a780led_suspend(struct platform_device *dev, pm_message_t state)
++{
++ led_classdev_suspend(&a780_main_led);
++ led_classdev_suspend(&a780_aux_led);
++ return 0;
++}
++
++static int a780led_resume(struct platform_device *dev)
++{
++ led_classdev_resume(&a780_main_led);
++ led_classdev_resume(&a780_aux_led);
++ return 0;
++}
++#endif
++
++static int a780led_probe(struct platform_device *pdev)
++{
++ int ret;
++
++ ret = led_classdev_register(&pdev->dev, &a780_main_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &a780_aux_led);
++ if (ret < 0)
++ led_classdev_unregister(&a780_main_led);
++
++ return ret;
++}
++
++static int a780led_remove(struct platform_device *pdev)
++{
++ led_classdev_unregister(&a780_main_led);
++ led_classdev_unregister(&a780_aux_led);
++ return 0;
++}
++
++static struct platform_driver a780led_driver = {
++ .probe = a780led_probe,
++ .remove = a780led_remove,
++#ifdef CONFIG_PM
++ .suspend = a780led_suspend,
++ .resume = a780led_resume,
++#endif
++ .driver = {
++ .name = "a780-led",
++ },
++};
++
++static int __init a780led_init(void)
++{
++ return platform_driver_register(&a780led_driver);
++}
++
++static void __exit a780led_exit(void)
++{
++ a780led_main_set( &a780_main_led, 0 );
++ a780led_aux_set( &a780_aux_led, 0 );
++ platform_driver_unregister(&a780led_driver);
++}
++
++module_init(a780led_init);
++module_exit(a780led_exit);
++
++MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
++MODULE_DESCRIPTION("Motorola A780 LED driver");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:38:04.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:38:09.000000000 +0200
+@@ -334,12 +334,20 @@
+ },
+ };
+
++static struct platform_device a780led_device = {
++ .name = "a780-led",
++ .id = -1,
++ .dev = {
++ .parent = &a780_pcap_device.dev,
++ },
++};
+
+ static struct platform_device *devices[] __initdata = {
+ &a780_pcap_device,
+ &a780_emu_device,
+ &pcap_ts_device,
+ &a780flip_device,
++ &a780led_device,
+ };
+
+ static void __init a780_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-mci.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-mci.patch
new file mode 100644
index 0000000000..1e427b33f9
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-mci.patch
@@ -0,0 +1,125 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 12:38:08.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 12:44:42.000000000 +0200
+@@ -14,6 +14,9 @@
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+ #include <linux/fb.h>
++#include <linux/mmc/host.h>
++#include <linux/irq.h>
++#include <linux/log2.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -21,12 +24,102 @@
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
++#include <asm/arch/mmc.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
+
++#ifdef CONFIG_EZX_PCAP
++extern int ezx_pcap_mmcsd_power(int);
++extern void ezx_pcap_mmcsd_voltage(u_int32_t);
++#else
++#define ezx_pcap_mmcsd_voltage(x) {}
++#define ezx_pcap_mmcsd_power(x) {}
++#endif
++
++static struct pxamci_platform_data a780_mci_platform_data;
++
++static u_int8_t mmc_voltage[] = {
++ [ilog2(MMC_VDD_165_195)] = 6,
++ [ilog2(MMC_VDD_20_21)] = 7,
++ [ilog2(MMC_VDD_21_22)] = 8,
++ [ilog2(MMC_VDD_22_23)] = 8,
++ [ilog2(MMC_VDD_23_24)] = 9,
++ [ilog2(MMC_VDD_24_25)] = 9,
++ [ilog2(MMC_VDD_25_26)] = 10,
++ [ilog2(MMC_VDD_26_27)] = 10,
++ [ilog2(MMC_VDD_27_28)] = 11,
++ [ilog2(MMC_VDD_28_29)] = 11,
++ [ilog2(MMC_VDD_29_30)] = 12,
++ [ilog2(MMC_VDD_30_31)] = 12,
++ [ilog2(MMC_VDD_31_32)] = 13,
++ [ilog2(MMC_VDD_32_33)] = 13,
++ [ilog2(MMC_VDD_33_34)] = 14,
++ [ilog2(MMC_VDD_34_35)] = 14,
++ [ilog2(MMC_VDD_35_36)] = 15,
++};
++
++static int a780_mci_init(struct device *dev,
++ irqreturn_t (*ezx_detect_int)(int, void *),
++ void *data)
++{
++ int err;
++
++ /* Setup GPIO for PXA27x MMC/SD controller */
++ pxa_gpio_mode(GPIO32_MMCCLK_MD);
++ pxa_gpio_mode(GPIO112_MMCCMD_MD);
++ pxa_gpio_mode(GPIO92_MMCDAT0_MD);
++ pxa_gpio_mode(GPIO109_MMCDAT1_MD);
++ pxa_gpio_mode(GPIO110_MMCDAT2_MD);
++ pxa_gpio_mode(GPIO111_MMCDAT3_MD);
++
++ ezx_pcap_mmcsd_power(1);
++
++ a780_mci_platform_data.detect_delay = msecs_to_jiffies(250);
++
++ err = request_irq(0x49, ezx_detect_int, IRQF_DISABLED,
++ "MMC card detect", data);
++ if (err) {
++ printk(KERN_ERR "ezx_mci_detect: MMC/SD: can't request "
++ "MMC card detect IRQ\n");
++ return -1;
++ }
++
++ set_irq_type(0x0b, IRQT_BOTHEDGE);
++
++ return 0;
++}
++
++static void a780_mci_setpower(struct device *dev, unsigned int vdd)
++{
++ struct pxamci_platform_data* p_d = dev->platform_data;
++
++ if (( 1 << vdd) & p_d->ocr_mask)
++ ezx_pcap_mmcsd_voltage(mmc_voltage[vdd]);
++
++ ezx_pcap_mmcsd_power(1);
++}
++
++static void a780_mci_exit(struct device *dev, void *data)
++{
++ ezx_pcap_mmcsd_power(0);
++ free_irq(0x49, data);
++}
++
++static struct pxamci_platform_data a780_mci_platform_data = {
++ .ocr_mask = MMC_VDD_165_195|MMC_VDD_20_21|MMC_VDD_21_22
++ |MMC_VDD_22_23|MMC_VDD_23_24|MMC_VDD_24_25
++ |MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28
++ |MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31
++ |MMC_VDD_31_32|MMC_VDD_32_33|MMC_VDD_33_34
++ |MMC_VDD_34_35|MMC_VDD_35_36,
++ .init = a780_mci_init,
++ .setpower = a780_mci_setpower,
++ .exit = a780_mci_exit,
++};
++
+ static struct pxafb_mode_info mode_a780 = {
+ .pixclock = 150000,
+ .xres = 240,
+@@ -137,6 +230,7 @@
+ PSLR = 0x05800f00;
+
+ set_pxa_fb_info(&a780_fb_info);
++ pxa_set_mci_info(&a780_mci_platform_data);
+
+ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
+ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-pcap.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-pcap.patch
new file mode 100644
index 0000000000..afb5d9c005
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-pcap.patch
@@ -0,0 +1,90 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-a780.c 2007-08-31 22:33:03.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-a780.c 2007-08-31 23:01:17.000000000 -0300
+@@ -20,6 +20,7 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
++#include <asm/arch/ezx-pcap.h>
+
+ #include "generic.h"
+
+@@ -49,7 +50,77 @@
+ .pxafb_lcd_power = &ezx_lcd_power,
+ };
+
++/* PCAP */
++static int __init a780_pcap_init(void)
++{
++ /* initialize PCAP registers */
++ /* set SW1 sleep to keep SW1 1.3v in sync mode */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE10, 0);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE11, 0);
++
++ /* SW1 active in sync mode */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE00, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE01, 0);
++
++ /* at SW1 -core voltage to 1.30V */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW10_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW11_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW12_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW13_DVS, 0);
++
++ /* when STANDY2 PIN ACTIVE (high) set V3-- sram V8 -- pll off */
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V3_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V3_LOWPWR, 0);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V8_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V8_LOWPWR, 0);
++
++ /*
++ * when STANDY2 PIN ACTIVE (high) set V4-- lcd only for e680 V6 ---
++ * camera for e680
++ */
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V4_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V4_LOWPWR, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V6_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V6_LOWPWR, 0);
++
++ /* set Vc to low power mode when AP sleep */
++// SSP_PCAP_bit_set(PCAP_BIT_LOWPWR_CTRL_VC_STBY);
++
++ /* set VAUX2 to low power mode when AP sleep */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_VAUX2_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_VAUX2_LOWPWR, 1);
++
++ return 0;
++}
++
++static struct pcap_platform_data a780_pcap_platform_data = {
++ .port = 1,
++ .cs = GPIO_SPI_CE,
++ .flags = PCAP_MCI_TF,
++ .clk = 1,
++ .init = a780_pcap_init,
++};
++
++static struct resource a780_pcap_resources[] = {
++ [0] = {
++ .start = IRQ_GPIO1,
++ .end = IRQ_GPIO1,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device a780_pcap_device = {
++ .name = "ezx-pcap",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(a780_pcap_resources),
++ .resource = a780_pcap_resources,
++ .dev = {
++ .platform_data = &a780_pcap_platform_data,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
++ &a780_pcap_device,
+ };
+
+ static void __init a780_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-ts.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-ts.patch
new file mode 100644
index 0000000000..e1dd6ca5c6
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-ts.patch
@@ -0,0 +1,39 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:37:43.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-23 19:37:58.000000000 +0200
+@@ -288,9 +288,34 @@
+ },
+ };
+
++/* PCAP_TS */
++struct resource pcap_ts_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_ADCDONE2,
++ .end = EZX_IRQ_ADCDONE2,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_TS,
++ .end = EZX_IRQ_TS,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++struct platform_device pcap_ts_device = {
++ .name = "pcap-ts",
++ .id = -1,
++ .dev = {
++ .parent = &a780_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(pcap_ts_resources),
++ .resource = pcap_ts_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &a780_pcap_device,
+ &a780_emu_device,
++ &pcap_ts_device,
+ };
+
+ static void __init a780_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/a780-vibrator.patch b/packages/linux/linux-ezx-2.6.23/patches/a780-vibrator.patch
new file mode 100644
index 0000000000..f9fe614af6
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/a780-vibrator.patch
@@ -0,0 +1,102 @@
+Index: linux-2.6.23/drivers/leds/leds-a780.c
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/leds-a780.c 2007-10-22 22:26:07.000000000 +0200
++++ linux-2.6.23/drivers/leds/leds-a780.c 2007-10-22 22:26:46.000000000 +0200
+@@ -40,6 +40,17 @@
+ ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL4, value & 0x10);
+ }
+
++static void a780vibrator_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value > 4) value = 4;
++ printk( KERN_DEBUG "a780vibrator_set: %d\n", value );
++ ezx_pcap_vibrator_level(value-1);
++ if (value == 0)
++ ezx_pcap_bit_set(PCAP_BIT_AUXVREG_V_VIB_EN, 0);
++ else
++ ezx_pcap_bit_set(PCAP_BIT_AUXVREG_V_VIB_EN, 1);
++}
++
+ static struct led_classdev a780_main_led = {
+ .name = "a780:main",
+ .default_trigger = "none",
+@@ -52,11 +63,18 @@
+ .brightness_set = a780led_aux_set,
+ };
+
++static struct led_classdev a780_vibrator = {
++ .name = "a780:vibrator",
++ .default_trigger = "none",
++ .brightness_set = a780vibrator_set,
++};
++
+ #ifdef CONFIG_PM
+ static int a780led_suspend(struct platform_device *dev, pm_message_t state)
+ {
+ led_classdev_suspend(&a780_main_led);
+ led_classdev_suspend(&a780_aux_led);
++ led_classdev_suspend(&a780_vibrator);
+ return 0;
+ }
+
+@@ -64,6 +82,7 @@
+ {
+ led_classdev_resume(&a780_main_led);
+ led_classdev_resume(&a780_aux_led);
++ led_classdev_resume(&a780_vibrator);
+ return 0;
+ }
+ #endif
+@@ -77,8 +96,16 @@
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &a780_aux_led);
+- if (ret < 0)
++ if (ret < 0) {
++ led_classdev_unregister(&a780_main_led);
++ return ret;
++ }
++
++ ret = led_classdev_register(&pdev->dev, &a780_vibrator);
++ if (ret < 0) {
+ led_classdev_unregister(&a780_main_led);
++ led_classdev_unregister(&a780_aux_led);
++ }
+
+ return ret;
+ }
+@@ -87,6 +114,7 @@
+ {
+ led_classdev_unregister(&a780_main_led);
+ led_classdev_unregister(&a780_aux_led);
++ led_classdev_unregister(&a780_vibrator);
+ return 0;
+ }
+
+@@ -111,6 +139,7 @@
+ {
+ a780led_main_set( &a780_main_led, 0 );
+ a780led_aux_set( &a780_aux_led, 0 );
++ a780vibrator_set( &a780_vibrator, 0 );
+ platform_driver_unregister(&a780led_driver);
+ }
+
+Index: linux-2.6.23/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Kconfig 2007-10-22 22:26:42.000000000 +0200
++++ linux-2.6.23/drivers/leds/Kconfig 2007-10-22 22:26:46.000000000 +0200
+@@ -111,11 +111,11 @@
+ be configured via sysfs. If unsure, say Y.
+
+ config LEDS_A780
+- tristate "LED Support for the Motorola A780 GSM Phone"
++ tristate "LED/Vibrator Support for the Motorola A780 GSM Phone"
+ depends LEDS_CLASS && PXA_EZX_A780
+ help
+- This option enables support for the LEDs on the
+- Motorola A780 GSM Phone.
++ This option enables support for the LEDs and the
++ vibrator on the Motorola A780 GSM Phone.
+
+ config LEDS_E680
+ tristate "LED Support for the Motorola E680(i) GSM Phone"
diff --git a/packages/linux/linux-ezx-2.6.23/patches/asoc-fix-loopback.patch b/packages/linux/linux-ezx-2.6.23/patches/asoc-fix-loopback.patch
new file mode 100644
index 0000000000..feea138984
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/asoc-fix-loopback.patch
@@ -0,0 +1,14 @@
+Index: linux-2.6.21/sound/soc/pxa/pxa2xx-pcm.c
+===================================================================
+--- linux-2.6.21.orig/sound/soc/pxa/pxa2xx-pcm.c 2007-09-02 22:30:56.000000000 -0300
++++ linux-2.6.21/sound/soc/pxa/pxa2xx-pcm.c 2007-09-02 22:36:26.000000000 -0300
+@@ -153,7 +153,8 @@
+ static int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream)
+ {
+ struct pxa2xx_runtime_data *prtd = substream->runtime->private_data;
+-
++ /* no dma if on loopback */
++ if (!prtd->params) return 0;
+ DCSR(prtd->dma_ch) &= ~DCSR_RUN;
+ DCSR(prtd->dma_ch) = 0;
+ DCMD(prtd->dma_ch) = 0;
diff --git a/packages/linux/linux-ezx-2.6.23/patches/asoc-pxa-ssp.patch b/packages/linux/linux-ezx-2.6.23/patches/asoc-pxa-ssp.patch
new file mode 100644
index 0000000000..e53b61c352
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/asoc-pxa-ssp.patch
@@ -0,0 +1,755 @@
+Index: linux-2.6.23/sound/soc/pxa/pxa2xx-ssp.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/sound/soc/pxa/pxa2xx-ssp.c 2007-10-22 22:27:11.000000000 +0200
+@@ -0,0 +1,671 @@
++/*
++ * pxa2xx-ssp.c -- ALSA Soc Audio Layer
++ *
++ * Copyright 2005 Wolfson Microelectronics PLC.
++ * Author: Liam Girdwood
++ * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.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.
++ *
++ * Revision history
++ * 12th Aug 2005 Initial version.
++ *
++ * TODO:
++ * o The SSP driver _mostly_ works, however is in need of testing and
++ * someone with time to complete it.
++ * o Test network mode for > 16bit sample size
++ */
++
++#include <linux/init.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++
++#include <sound/driver.h>
++#include <sound/core.h>
++#include <sound/pcm.h>
++#include <sound/initval.h>
++#include <sound/pcm_params.h>
++#include <sound/soc.h>
++
++#include <asm/hardware.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/audio.h>
++#include <asm/arch/ssp.h>
++
++#include "pxa2xx-pcm.h"
++#include "pxa2xx-ssp.h"
++
++#define PXA_SSP_DEBUG 0
++
++/*
++ * The following should be defined in pxa-regs.h
++ */
++#define SSCR0_ACS (1 << 30) /* Audio Clock Select */
++#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass (SSCR0[ACS] must be set) */
++#define SSACD_ACPS(x) (x << 4) /* Audio clock PLL select */
++#define SSACD_ACDS(x) (x << 0) /* Audio clock divider select */
++
++/*
++ * SSP audio private data
++ */
++struct ssp_priv {
++ unsigned int sysclk;
++};
++
++static struct ssp_priv ssp_clk[3];
++static struct ssp_dev ssp[3];
++#ifdef CONFIG_PM
++static struct ssp_state ssp_state[3];
++#endif
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_mono_out = {
++ .name = "SSP1 PCM Mono out",
++ .dev_addr = __PREG(SSDR_P1),
++ .drcmr = &DRCMRTXSSDR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_mono_in = {
++ .name = "SSP1 PCM Mono in",
++ .dev_addr = __PREG(SSDR_P1),
++ .drcmr = &DRCMRRXSSDR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_stereo_out = {
++ .name = "SSP1 PCM Stereo out",
++ .dev_addr = __PREG(SSDR_P1),
++ .drcmr = &DRCMRTXSSDR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_stereo_in = {
++ .name = "SSP1 PCM Stereo in",
++ .dev_addr = __PREG(SSDR_P1),
++ .drcmr = &DRCMRRXSSDR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_mono_out = {
++ .name = "SSP2 PCM Mono out",
++ .dev_addr = __PREG(SSDR_P2),
++ .drcmr = &DRCMRTXSS2DR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_mono_in = {
++ .name = "SSP2 PCM Mono in",
++ .dev_addr = __PREG(SSDR_P2),
++ .drcmr = &DRCMRRXSS2DR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_stereo_out = {
++ .name = "SSP2 PCM Stereo out",
++ .dev_addr = __PREG(SSDR_P2),
++ .drcmr = &DRCMRTXSS2DR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_stereo_in = {
++ .name = "SSP2 PCM Stereo in",
++ .dev_addr = __PREG(SSDR_P2),
++ .drcmr = &DRCMRRXSS2DR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_mono_out = {
++ .name = "SSP3 PCM Mono out",
++ .dev_addr = __PREG(SSDR_P3),
++ .drcmr = &DRCMRTXSS3DR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_mono_in = {
++ .name = "SSP3 PCM Mono in",
++ .dev_addr = __PREG(SSDR_P3),
++ .drcmr = &DRCMRRXSS3DR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH2,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_stereo_out = {
++ .name = "SSP3 PCM Stereo out",
++ .dev_addr = __PREG(SSDR_P3),
++ .drcmr = &DRCMRTXSS3DR,
++ .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_stereo_in = {
++ .name = "SSP3 PCM Stereo in",
++ .dev_addr = __PREG(SSDR_P3),
++ .drcmr = &DRCMRRXSS3DR,
++ .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC |
++ DCMD_BURST16 | DCMD_WIDTH4,
++};
++
++static struct pxa2xx_pcm_dma_params *ssp_dma_params[3][4] = {
++ {&pxa2xx_ssp1_pcm_mono_out, &pxa2xx_ssp1_pcm_mono_in,
++ &pxa2xx_ssp1_pcm_stereo_out,&pxa2xx_ssp1_pcm_stereo_in,},
++ {&pxa2xx_ssp2_pcm_mono_out, &pxa2xx_ssp2_pcm_mono_in,
++ &pxa2xx_ssp2_pcm_stereo_out, &pxa2xx_ssp2_pcm_stereo_in,},
++ {&pxa2xx_ssp3_pcm_mono_out, &pxa2xx_ssp3_pcm_mono_in,
++ &pxa2xx_ssp3_pcm_stereo_out,&pxa2xx_ssp3_pcm_stereo_in,},
++};
++
++static int pxa2xx_ssp_startup(struct snd_pcm_substream *substream)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++ int ret = 0;
++
++ if (!rtd->dai->cpu_dai->active) {
++ ret = ssp_init (&ssp[cpu_dai->id], cpu_dai->id + 1,
++ SSP_NO_IRQ);
++ if (ret < 0)
++ return ret;
++ ssp_disable(&ssp[cpu_dai->id]);
++ }
++ return ret;
++}
++
++static void pxa2xx_ssp_shutdown(struct snd_pcm_substream *substream)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++
++ if (!cpu_dai->active) {
++ ssp_disable(&ssp[cpu_dai->id]);
++ ssp_exit(&ssp[cpu_dai->id]);
++ }
++}
++
++#if defined (CONFIG_PXA27x)
++static int cken[3] = {CKEN_SSP1, CKEN_SSP2, CKEN_SSP3};
++#else
++static int cken[3] = {CKEN_SSP, CKEN_NSSP, CKEN_ASSP};
++#endif
++
++#ifdef CONFIG_PM
++
++static int pxa2xx_ssp_suspend(struct platform_device *pdev,
++ struct snd_soc_cpu_dai *dai)
++{
++ if (!dai->active)
++ return 0;
++
++ ssp_save_state(&ssp[dai->id], &ssp_state[dai->id]);
++ pxa_set_cken(cken[dai->id], 0);
++ return 0;
++}
++
++static int pxa2xx_ssp_resume(struct platform_device *pdev,
++ struct snd_soc_cpu_dai *dai)
++{
++ if (!dai->active)
++ return 0;
++
++ pxa_set_cken(cken[dai->id], 1);
++ ssp_restore_state(&ssp[dai->id], &ssp_state[dai->id]);
++ ssp_enable(&ssp[dai->id]);
++
++ return 0;
++}
++
++#else
++#define pxa2xx_ssp_suspend NULL
++#define pxa2xx_ssp_resume NULL
++#endif
++
++/*
++ * Set the SSP ports SYSCLK.
++ */
++static int pxa2xx_ssp_set_dai_sysclk(struct snd_soc_cpu_dai *cpu_dai,
++ int clk_id, unsigned int freq, int dir)
++{
++ int port = cpu_dai->id + 1;
++ u32 sscr0 = SSCR0_P(port) &
++ ~(SSCR0_ECS | SSCR0_NCS | SSCR0_MOD | SSCR0_ACS);
++
++ switch (clk_id) {
++ case PXA2XX_SSP_CLK_PLL:
++ /* Internal PLL is fixed on pxa25x and pxa27x */
++#ifdef CONFIG_PXA27x
++ ssp_clk[cpu_dai->id].sysclk = 13000000;
++#else
++ ssp_clk[cpu_dai->id].sysclk = 1843200;
++#endif
++ break;
++ case PXA2XX_SSP_CLK_EXT:
++ ssp_clk[cpu_dai->id].sysclk = freq;
++ sscr0 |= SSCR0_ECS;
++ break;
++ case PXA2XX_SSP_CLK_NET:
++ ssp_clk[cpu_dai->id].sysclk = freq;
++ sscr0 |= SSCR0_NCS | SSCR0_MOD;
++ break;
++ case PXA2XX_SSP_CLK_AUDIO:
++ ssp_clk[cpu_dai->id].sysclk = 0;
++ SSCR0_P(port) |= SSCR0_SerClkDiv(1);
++ sscr0 |= SSCR0_ACS;
++ break;
++ default:
++ return -ENODEV;
++ }
++
++ /* the SSP CKEN clock must be disabled when changing SSP clock mode */
++ pxa_set_cken(cken[cpu_dai->id], 0);
++ SSCR0_P(port) |= sscr0;
++ pxa_set_cken(cken[cpu_dai->id], 1);
++ return 0;
++}
++
++/*
++ * Set the SSP clock dividers.
++ */
++static int pxa2xx_ssp_set_dai_clkdiv(struct snd_soc_cpu_dai *cpu_dai,
++ int div_id, int div)
++{
++ int port = cpu_dai->id + 1;
++
++ switch (div_id) {
++ case PXA2XX_SSP_AUDIO_DIV_ACDS:
++ SSACD_P(port) &= ~ 0x7;
++ SSACD_P(port) |= SSACD_ACDS(div);
++ break;
++ case PXA2XX_SSP_AUDIO_DIV_SCDB:
++ SSACD_P(port) &= ~0x8;
++ if (div == PXA2XX_SSP_CLK_SCDB_1)
++ SSACD_P(port) |= SSACD_SCDB;
++ break;
++ case PXA2XX_SSP_DIV_SCR:
++ SSCR0_P(port) &= ~SSCR0_SCR;
++ SSCR0_P(port) |= SSCR0_SerClkDiv(div);
++ break;
++ default:
++ return -ENODEV;
++ }
++
++ return 0;
++}
++
++/*
++ * Configure the PLL frequency pxa27x and (afaik - pxa320 only)
++ */
++static int pxa2xx_ssp_set_dai_pll(struct snd_soc_cpu_dai *cpu_dai,
++ int pll_id, unsigned int freq_in, unsigned int freq_out)
++{
++ int port = cpu_dai->id + 1;
++
++ SSACD_P(port) &= ~0x70;
++ switch (freq_out) {
++ case 5622000:
++ break;
++ case 11345000:
++ SSACD_P(port) |= (0x1 << 4);
++ break;
++ case 12235000:
++ SSACD_P(port) |= (0x2 << 4);
++ break;
++ case 14857000:
++ SSACD_P(port) |= (0x3 << 4);
++ break;
++ case 32842000:
++ SSACD_P(port) |= (0x4 << 4);
++ break;
++ case 48000000:
++ SSACD_P(port) |= (0x5 << 4);
++ break;
++ }
++ return 0;
++}
++
++/*
++ * Set the active slots in TDM/Network mode
++ */
++static int pxa2xx_ssp_set_dai_tdm_slot(struct snd_soc_cpu_dai *cpu_dai,
++ unsigned int mask, int slots)
++{
++ int port = cpu_dai->id + 1;
++
++ SSCR0_P(port) &= ~SSCR0_SlotsPerFrm(7);
++
++ /* set number of active slots */
++ SSCR0_P(port) |= SSCR0_SlotsPerFrm(slots);
++
++ /* set active slot mask */
++ SSTSA_P(port) = mask;
++ SSRSA_P(port) = mask;
++ return 0;
++}
++
++/*
++ * Tristate the SSP DAI lines
++ */
++static int pxa2xx_ssp_set_dai_tristate(struct snd_soc_cpu_dai *cpu_dai,
++ int tristate)
++{
++ int port = cpu_dai->id + 1;
++
++ if (tristate)
++ SSCR1_P(port) &= ~SSCR1_TTE;
++ else
++ SSCR1_P(port) |= SSCR1_TTE;
++
++ return 0;
++}
++
++/*
++ * Set up the SSP DAI format.
++ * The SSP Port must be inactive before calling this function as the
++ * physical interface format is changed.
++ */
++static int pxa2xx_ssp_set_dai_fmt(struct snd_soc_cpu_dai *cpu_dai,
++ unsigned int fmt)
++{
++ int port = cpu_dai->id + 1;
++
++ /* reset port settings */
++ SSCR0_P(port) = 0;
++ SSCR1_P(port) = 0;
++ SSPSP_P(port) = 0;
++
++ /* NOTE: I2S emulation is still very much work in progress here */
++
++ /* FIXME: this is what wince uses for msb */
++ if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_MSB) {
++ SSCR0_P(port) = SSCR0_EDSS | SSCR0_TISSP | SSCR0_DataSize(16);
++
++// SSCR1_P(port) = SSCR1_RxTresh(8) | SSCR1_TxTresh(8); /* doesn't seem to be needed */
++ return 0;
++ }
++
++ /* check for I2S emulation mode - handle it separately */
++ if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S) ||
++ ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_MSB)) {
++ /* 8.4.11 */
++
++ /* Only SSCR0[NCS] or SSCR0[ECS] bit fields settings are optional */
++ SSCR0_P(port) = SSCR0_EDSS | SSCR0_PSP | SSCR0_DataSize(16);
++
++ /* SSCR1 = 0x203C3C03 */
++ /* SSCR1[SCLKDIR] and SSCR1[SFRMDIR] must be cleared (master only ???),
++ * all other bit fields settings are optional. */
++ //SSCR1_P(port) &= ~(SSCR1_SCLKDIR | SSCR1_SFRMDIR);
++
++ /* set FIFO thresholds */
++ SSCR1_P(port) = SSCR1_RxTresh(14) | SSCR1_TxTresh(1);
++
++ /* normal: */
++ /* all bit fields must be cleared except: FSRT = 1 and
++ * SFRMWDTH = 16, DMYSTART=0,1) */
++ SSPSP_P(port) = SSPSP_FSRT | SSPSP_SFRMWDTH(16) | SSPSP_DMYSTRT(0);
++ return 0;
++ }
++
++ SSCR0_P(port) |= SSCR0_PSP;
++ SSCR1_P(port) = SSCR1_RxTresh(14) | SSCR1_TxTresh(1) |
++ SSCR1_TRAIL | SSCR1_RWOT;
++
++ switch(fmt & SND_SOC_DAIFMT_MASTER_MASK) {
++ case SND_SOC_DAIFMT_CBM_CFM:
++ SSCR1_P(port) |= (SSCR1_SCLKDIR | SSCR1_SFRMDIR);
++ break;
++ case SND_SOC_DAIFMT_CBM_CFS:
++ SSCR1_P(port) |= SSCR1_SCLKDIR;
++ break;
++ case SND_SOC_DAIFMT_CBS_CFM:
++ SSCR1_P(port) |= SSCR1_SFRMDIR;
++ break;
++ case SND_SOC_DAIFMT_CBS_CFS:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
++ case SND_SOC_DAIFMT_NB_NF:
++ SSPSP_P(port) |= SSPSP_SFRMP | SSPSP_FSRT;
++ break;
++ case SND_SOC_DAIFMT_IB_IF:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
++ case SND_SOC_DAIFMT_DSP_A:
++ SSPSP_P(port) |= SSPSP_DMYSTRT(1);
++ case SND_SOC_DAIFMT_DSP_B:
++ SSPSP_P(port) |= SSPSP_SCMODE(2);
++ break;
++ case SND_SOC_DAIFMT_I2S:
++ case SND_SOC_DAIFMT_MSB:
++ /* handled above */
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
++/*
++ * Set the SSP audio DMA parameters and sample size.
++ * Can be called multiple times by oss emulation.
++ */
++static int pxa2xx_ssp_hw_params(struct snd_pcm_substream *substream,
++ struct snd_pcm_hw_params *params)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++ int dma = 0, chn = params_channels(params);
++ int port = cpu_dai->id + 1;
++
++ /* select correct DMA params */
++ if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
++ dma = 1; /* capture DMA offset is 1,3 */
++ if (chn == 2)
++ dma += 2; /* stereo DMA offset is 2, mono is 0 */
++ cpu_dai->dma_data = ssp_dma_params[cpu_dai->id][dma];
++
++ /* we can only change the settings if the port is not in use */
++ if (SSCR0_P(port) & SSCR0_SSE)
++ return 0;
++
++ /* clear selected SSP bits */
++ SSCR0_P(port) &= ~(SSCR0_DSS | SSCR0_EDSS);
++
++ /* bit size */
++ switch(params_format(params)) {
++ case SNDRV_PCM_FORMAT_S16_LE:
++ SSCR0_P(port) |= SSCR0_DataSize(16);
++ break;
++ case SNDRV_PCM_FORMAT_S24_LE:
++ SSCR0_P(port) |=(SSCR0_EDSS | SSCR0_DataSize(8));
++ /* we must be in network mode (2 slots) for 24 bit stereo */
++ break;
++ case SNDRV_PCM_FORMAT_S32_LE:
++ SSCR0_P(port) |= (SSCR0_EDSS | SSCR0_DataSize(16));
++ /* we must be in network mode (2 slots) for 32 bit stereo */
++ break;
++ }
++
++#if PXA_SSP_DEBUG
++ printk("SSCR0 %x SSCR1 %x SSTO %x SSPSP %x SSSR %x SSACD %x\n",
++ SSCR0_P(port), SSCR1_P(port),
++ SSTO_P(port), SSPSP_P(port),
++ SSSR_P(port), SSACD_P(port));
++#endif
++ return 0;
++}
++
++static int pxa2xx_ssp_trigger(struct snd_pcm_substream *substream, int cmd)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++ int ret = 0;
++ int port = cpu_dai->id + 1;
++
++ switch (cmd) {
++ case SNDRV_PCM_TRIGGER_RESUME:
++ ssp_enable(&ssp[cpu_dai->id]);
++ break;
++ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ SSCR1_P(port) |= SSCR1_TSRE;
++ else
++ SSCR1_P(port) |= SSCR1_RSRE;
++ SSSR_P(port) |= SSSR_P(port);
++ break;
++ case SNDRV_PCM_TRIGGER_START:
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ SSCR1_P(port) |= SSCR1_TSRE;
++ else
++ SSCR1_P(port) |= SSCR1_RSRE;
++ ssp_enable(&ssp[cpu_dai->id]);
++ break;
++ case SNDRV_PCM_TRIGGER_STOP:
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ SSCR1_P(port) &= ~SSCR1_TSRE;
++ else
++ SSCR1_P(port) &= ~SSCR1_RSRE;
++ break;
++ case SNDRV_PCM_TRIGGER_SUSPEND:
++ ssp_disable(&ssp[cpu_dai->id]);
++ break;
++ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ SSCR1_P(port) &= ~SSCR1_TSRE;
++ else
++ SSCR1_P(port) &= ~SSCR1_RSRE;
++ break;
++
++ default:
++ ret = -EINVAL;
++ }
++#if PXA_SSP_DEBUG
++ printk("trig cmd %d\n", cmd);
++ printk("SSCR0 %x SSCR1 %x SSTO %x SSPSP %x SSSR %x\n",
++ SSCR0_P(port), SSCR1_P(port),
++ SSTO_P(port), SSPSP_P(port),
++ SSSR_P(port));
++#endif
++ return ret;
++}
++
++#define PXA2XX_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
++ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
++ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
++
++#define PXA2XX_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
++ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
++
++struct snd_soc_cpu_dai pxa_ssp_dai[] = {
++ { .name = "pxa2xx-ssp1",
++ .id = 0,
++ .type = SND_SOC_DAI_PCM,
++ .suspend = pxa2xx_ssp_suspend,
++ .resume = pxa2xx_ssp_resume,
++ .playback = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .capture = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .ops = {
++ .startup = pxa2xx_ssp_startup,
++ .shutdown = pxa2xx_ssp_shutdown,
++ .trigger = pxa2xx_ssp_trigger,
++ .hw_params = pxa2xx_ssp_hw_params,},
++ .dai_ops = {
++ .set_sysclk = pxa2xx_ssp_set_dai_sysclk,
++ .set_clkdiv = pxa2xx_ssp_set_dai_clkdiv,
++ .set_pll = pxa2xx_ssp_set_dai_pll,
++ .set_fmt = pxa2xx_ssp_set_dai_fmt,
++ .set_tdm_slot = pxa2xx_ssp_set_dai_tdm_slot,
++ .set_tristate = pxa2xx_ssp_set_dai_tristate,
++ },
++ },
++ { .name = "pxa2xx-ssp2",
++ .id = 1,
++ .type = SND_SOC_DAI_PCM,
++ .suspend = pxa2xx_ssp_suspend,
++ .resume = pxa2xx_ssp_resume,
++ .playback = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .capture = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .ops = {
++ .startup = pxa2xx_ssp_startup,
++ .shutdown = pxa2xx_ssp_shutdown,
++ .trigger = pxa2xx_ssp_trigger,
++ .hw_params = pxa2xx_ssp_hw_params,},
++ .dai_ops = {
++ .set_sysclk = pxa2xx_ssp_set_dai_sysclk,
++ .set_clkdiv = pxa2xx_ssp_set_dai_clkdiv,
++ .set_pll = pxa2xx_ssp_set_dai_pll,
++ .set_fmt = pxa2xx_ssp_set_dai_fmt,
++ .set_tdm_slot = pxa2xx_ssp_set_dai_tdm_slot,
++ .set_tristate = pxa2xx_ssp_set_dai_tristate,
++ },
++ },
++ { .name = "pxa2xx-ssp3",
++ .id = 2,
++ .type = SND_SOC_DAI_PCM,
++ .suspend = pxa2xx_ssp_suspend,
++ .resume = pxa2xx_ssp_resume,
++ .playback = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .capture = {
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = PXA2XX_SSP_RATES,
++ .formats = PXA2XX_SSP_FORMATS,},
++ .ops = {
++ .startup = pxa2xx_ssp_startup,
++ .shutdown = pxa2xx_ssp_shutdown,
++ .trigger = pxa2xx_ssp_trigger,
++ .hw_params = pxa2xx_ssp_hw_params,},
++ .dai_ops = {
++ .set_sysclk = pxa2xx_ssp_set_dai_sysclk,
++ .set_clkdiv = pxa2xx_ssp_set_dai_clkdiv,
++ .set_pll = pxa2xx_ssp_set_dai_pll,
++ .set_fmt = pxa2xx_ssp_set_dai_fmt,
++ .set_tdm_slot = pxa2xx_ssp_set_dai_tdm_slot,
++ .set_tristate = pxa2xx_ssp_set_dai_tristate,
++ },
++ },
++};
++EXPORT_SYMBOL_GPL(pxa_ssp_dai);
++
++/* Module information */
++MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com");
++MODULE_DESCRIPTION("pxa2xx SSP/PCM SoC Interface");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/sound/soc/pxa/pxa2xx-ssp.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/sound/soc/pxa/pxa2xx-ssp.h 2007-10-22 22:27:11.000000000 +0200
+@@ -0,0 +1,42 @@
++/*
++ * linux/sound/arm/pxa2xx-ssp.h
++ *
++ * 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.
++ */
++
++#ifndef _PXA2XX_SSP_H
++#define _PXA2XX_SSP_H
++
++/* pxa2xx DAI SSP ID's */
++#define PXA2XX_DAI_SSP1 0
++#define PXA2XX_DAI_SSP2 1
++#define PXA2XX_DAI_SSP3 2
++
++/* SSP clock sources */
++#define PXA2XX_SSP_CLK_PLL 0
++#define PXA2XX_SSP_CLK_EXT 1
++#define PXA2XX_SSP_CLK_NET 2
++#define PXA2XX_SSP_CLK_AUDIO 3
++
++/* SSP audio dividers */
++#define PXA2XX_SSP_AUDIO_DIV_ACDS 0
++#define PXA2XX_SSP_AUDIO_DIV_SCDB 1
++#define PXA2XX_SSP_DIV_SCR 2
++
++/* SSP ACDS audio dividers values */
++#define PXA2XX_SSP_CLK_AUDIO_DIV_1 0
++#define PXA2XX_SSP_CLK_AUDIO_DIV_2 1
++#define PXA2XX_SSP_CLK_AUDIO_DIV_4 2
++#define PXA2XX_SSP_CLK_AUDIO_DIV_8 3
++#define PXA2XX_SSP_CLK_AUDIO_DIV_16 4
++#define PXA2XX_SSP_CLK_AUDIO_DIV_32 5
++
++/* SSP divider bypass */
++#define PXA2XX_SSP_CLK_SCDB_4 0
++#define PXA2XX_SSP_CLK_SCDB_1 1
++
++extern struct snd_soc_cpu_dai pxa_ssp_dai[3];
++
++#endif
+Index: linux-2.6.23/sound/soc/pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/sound/soc/pxa/Kconfig 2007-10-10 09:38:42.000000000 +0200
++++ linux-2.6.23/sound/soc/pxa/Kconfig 2007-10-22 22:27:11.000000000 +0200
+@@ -18,6 +18,10 @@
+ config SND_PXA2XX_SOC_I2S
+ tristate
+
++config SND_PXA2XX_SOC_SSP
++ tristate
++ select PXA_SSP
++
+ config SND_PXA2XX_SOC_CORGI
+ tristate "SoC Audio support for Sharp Zaurus SL-C7x0"
+ depends on SND_PXA2XX_SOC && PXA_SHARP_C7xx
+Index: linux-2.6.23/sound/soc/pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/sound/soc/pxa/Makefile 2007-10-10 09:38:42.000000000 +0200
++++ linux-2.6.23/sound/soc/pxa/Makefile 2007-10-22 22:27:11.000000000 +0200
+@@ -2,10 +2,12 @@
+ snd-soc-pxa2xx-objs := pxa2xx-pcm.o
+ snd-soc-pxa2xx-ac97-objs := pxa2xx-ac97.o
+ snd-soc-pxa2xx-i2s-objs := pxa2xx-i2s.o
++snd-soc-pxa2xx-ssp-objs := pxa2xx-ssp.o
+
+ obj-$(CONFIG_SND_PXA2XX_SOC) += snd-soc-pxa2xx.o
+ obj-$(CONFIG_SND_PXA2XX_SOC_AC97) += snd-soc-pxa2xx-ac97.o
+ obj-$(CONFIG_SND_PXA2XX_SOC_I2S) += snd-soc-pxa2xx-i2s.o
++obj-$(CONFIG_SND_PXA2XX_SOC_SSP) += snd-soc-pxa2xx-ssp.o
+
+ # PXA Machine Support
+ snd-soc-corgi-objs := corgi.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/binutils-buildid-arm.patch b/packages/linux/linux-ezx-2.6.23/patches/binutils-buildid-arm.patch
new file mode 100644
index 0000000000..68e35e89e1
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/binutils-buildid-arm.patch
@@ -0,0 +1,16 @@
+---
+ arch/arm/kernel/vmlinux.lds.S | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: linux-2.6.22/arch/arm/kernel/vmlinux.lds.S
+===================================================================
+--- linux-2.6.22.orig/arch/arm/kernel/vmlinux.lds.S 2007-09-11 18:32:29.000000000 +0200
++++ linux-2.6.22/arch/arm/kernel/vmlinux.lds.S 2007-09-11 18:33:42.000000000 +0200
+@@ -94,6 +94,7 @@
+ TEXT_TEXT
+ SCHED_TEXT
+ LOCK_TEXT
++ *(.note.*)
+ #ifdef CONFIG_MMU
+ *(.fixup)
+ #endif
diff --git a/packages/linux/linux-ezx-2.6.23/patches/defconfig-a1200 b/packages/linux/linux-ezx-2.6.23/patches/defconfig-a1200
new file mode 100644
index 0000000000..4649d7ba96
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/defconfig-a1200
@@ -0,0 +1,1208 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23.1
+# Wed Oct 24 18:03:17 2007
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-ezxdev"
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_AS is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
+# CONFIG_MACH_MAINSTONE is not set
+# CONFIG_ARCH_PXA_IDP is not set
+# CONFIG_PXA_SHARPSL is not set
+# CONFIG_MACH_TRIZEPS4 is not set
+# CONFIG_MACH_EM_X270 is not set
+CONFIG_PXA_EZX=y
+# CONFIG_PXA_EZX_E680 is not set
+# CONFIG_PXA_EZX_A780 is not set
+# CONFIG_PXA_EZX_E2 is not set
+CONFIG_PXA_EZX_A1200=y
+# CONFIG_PXA_EZX_E6 is not set
+# CONFIG_EZX_BP is not set
+CONFIG_EZX_PCAP=y
+CONFIG_EZX_EOC=y
+# CONFIG_EZX_EMU is not set
+CONFIG_PXA27x=y
+CONFIG_PXA_SSP=y
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
+CONFIG_IWMMXT=y
+CONFIG_XSCALE_PMU=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_PREEMPT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug mem=32M@0xA0000000"
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=m
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management options
+#
+CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
+# CONFIG_PM_DEBUG is not set
+CONFIG_SUSPEND_UP_POSSIBLE=y
+# CONFIG_SUSPEND is not set
+CONFIG_APM_EMULATION=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIUSB is not set
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+# CONFIG_BT_HCIUART_BCSP is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=m
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_XIP=y
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_SHARP_SL is not set
+CONFIG_MTD_EZX=y
+# CONFIG_MTD_EZX_A780 is not set
+# CONFIG_MTD_EZX_A780_ALTERNATE is not set
+CONFIG_MTD_EZX_A1200=y
+# CONFIG_MTD_EZX_E2 is not set
+# CONFIG_MTD_EZX_E6 is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_NET_ETHERNET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPP_MPPE is not set
+# CONFIG_PPPOE is not set
+# CONFIG_PPPOL2TP is not set
+# CONFIG_SLIP is not set
+CONFIG_SLHC=m
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_TSDEV=y
+CONFIG_INPUT_TSDEV_SCREEN_X=240
+CONFIG_INPUT_TSDEV_SCREEN_Y=320
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_PXA=y
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+CONFIG_TOUCHSCREEN_PCAP=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=y
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_GPIO is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+CONFIG_SPI_PXA2XX=m
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_GPIO is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_EZX is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA=y
+CONFIG_FB_PXA_LCD_QVGA=y
+# CONFIG_FB_PXA_LCD_VGA is not set
+CONFIG_FB_PXA_OVERLAY=y
+CONFIG_FB_PXA_PARAMETERS=y
+# CONFIG_FB_MBX is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+CONFIG_FONT_MINI_4x6=y
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ALSA ARM devices
+#
+# CONFIG_SND_PXA2XX_AC97 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
+CONFIG_SND_SOC=y
+CONFIG_SND_PXA2XX_SOC=y
+CONFIG_SND_PXA2XX_SOC_SSP=y
+CONFIG_SND_PXA2XX_SOC_EZX=y
+
+#
+# SoC Audio support for SuperH
+#
+CONFIG_SND_SOC_PCAP2=y
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_PXA2XX is not set
+CONFIG_USB_GADGET_PXA27X=y
+CONFIG_USB_PXA27X=y
+# CONFIG_USB_PXA2XX_SMALL is not set
+# CONFIG_USB_GADGET_M66592 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_ZERO is not set
+CONFIG_USB_ETH=y
+# CONFIG_USB_ETH_RNDIS is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_PXA=y
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=m
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
diff --git a/packages/linux/linux-ezx-2.6.23/patches/defconfig-a780 b/packages/linux/linux-ezx-2.6.23/patches/defconfig-a780
new file mode 100644
index 0000000000..921fa94b69
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/defconfig-a780
@@ -0,0 +1,1214 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23.1
+# Wed Oct 24 18:00:57 2007
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-ezxdev"
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_AS is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
+# CONFIG_MACH_MAINSTONE is not set
+# CONFIG_ARCH_PXA_IDP is not set
+# CONFIG_PXA_SHARPSL is not set
+# CONFIG_MACH_TRIZEPS4 is not set
+# CONFIG_MACH_EM_X270 is not set
+CONFIG_PXA_EZX=y
+# CONFIG_PXA_EZX_E680 is not set
+CONFIG_PXA_EZX_A780=y
+# CONFIG_PXA_EZX_E2 is not set
+# CONFIG_PXA_EZX_A1200 is not set
+# CONFIG_PXA_EZX_E6 is not set
+CONFIG_EZX_BP=y
+CONFIG_EZX_PCAP=y
+# CONFIG_EZX_EOC is not set
+CONFIG_EZX_EMU=y
+CONFIG_EZX_EMU_USB=y
+# CONFIG_EZX_EMU_UART is not set
+# CONFIG_EZX_EMU_NOTHING is not set
+CONFIG_PXA27x=y
+CONFIG_PXA_SSP=y
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
+CONFIG_IWMMXT=y
+CONFIG_XSCALE_PMU=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_PREEMPT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug mem=32M@0xA0000000 mem=16M@0xAC000000"
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=m
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management options
+#
+CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
+# CONFIG_PM_DEBUG is not set
+CONFIG_SUSPEND_UP_POSSIBLE=y
+# CONFIG_SUSPEND is not set
+CONFIG_APM_EMULATION=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIUSB is not set
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+# CONFIG_BT_HCIUART_BCSP is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=m
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_XIP=y
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_SHARP_SL is not set
+CONFIG_MTD_EZX=y
+CONFIG_MTD_EZX_A780=y
+# CONFIG_MTD_EZX_A780_ALTERNATE is not set
+# CONFIG_MTD_EZX_A1200 is not set
+# CONFIG_MTD_EZX_E2 is not set
+# CONFIG_MTD_EZX_E6 is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_NET_ETHERNET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPP_MPPE is not set
+# CONFIG_PPPOE is not set
+# CONFIG_PPPOL2TP is not set
+# CONFIG_SLIP is not set
+CONFIG_SLHC=m
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_TSDEV=y
+CONFIG_INPUT_TSDEV_SCREEN_X=240
+CONFIG_INPUT_TSDEV_SCREEN_Y=320
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_PXA=y
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+CONFIG_TOUCHSCREEN_PCAP=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=y
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_TS0710_MUX=y
+CONFIG_TS0710_MUX_USB=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_GPIO is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+CONFIG_SPI_PXA2XX=m
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_GPIO is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_A780=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_EZX=y
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA=y
+CONFIG_FB_PXA_LCD_QVGA=y
+# CONFIG_FB_PXA_LCD_VGA is not set
+CONFIG_FB_PXA_OVERLAY=y
+CONFIG_FB_PXA_PARAMETERS=y
+# CONFIG_FB_MBX is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+CONFIG_FONT_MINI_4x6=y
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ALSA ARM devices
+#
+# CONFIG_SND_PXA2XX_AC97 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
+CONFIG_SND_SOC=y
+CONFIG_SND_PXA2XX_SOC=y
+CONFIG_SND_PXA2XX_SOC_SSP=y
+CONFIG_SND_PXA2XX_SOC_EZX=y
+
+#
+# SoC Audio support for SuperH
+#
+CONFIG_SND_SOC_PCAP2=y
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_PXA2XX is not set
+CONFIG_USB_GADGET_PXA27X=y
+CONFIG_USB_PXA27X=y
+# CONFIG_USB_PXA2XX_SMALL is not set
+# CONFIG_USB_GADGET_M66592 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_ZERO is not set
+CONFIG_USB_ETH=y
+# CONFIG_USB_ETH_RNDIS is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_PXA=y
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=m
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
diff --git a/packages/linux/linux-ezx-2.6.23/patches/defconfig-e2 b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e2
new file mode 100644
index 0000000000..206ae45fc7
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e2
@@ -0,0 +1,1189 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23.1
+# Wed Oct 24 18:05:01 2007
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-ezxdev"
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_AS is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
+# CONFIG_MACH_MAINSTONE is not set
+# CONFIG_ARCH_PXA_IDP is not set
+# CONFIG_PXA_SHARPSL is not set
+# CONFIG_MACH_TRIZEPS4 is not set
+# CONFIG_MACH_EM_X270 is not set
+CONFIG_PXA_EZX=y
+# CONFIG_PXA_EZX_E680 is not set
+# CONFIG_PXA_EZX_A780 is not set
+# CONFIG_PXA_EZX_E2 is not set
+CONFIG_PXA_EZX_A1200=y
+# CONFIG_PXA_EZX_E6 is not set
+# CONFIG_EZX_BP is not set
+CONFIG_EZX_PCAP=y
+CONFIG_EZX_EOC=y
+# CONFIG_EZX_EMU is not set
+CONFIG_PXA27x=y
+CONFIG_PXA_SSP=y
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
+CONFIG_IWMMXT=y
+CONFIG_XSCALE_PMU=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_PREEMPT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug mem=32M@0xA0000000"
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=m
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management options
+#
+CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
+# CONFIG_PM_DEBUG is not set
+CONFIG_SUSPEND_UP_POSSIBLE=y
+# CONFIG_SUSPEND is not set
+CONFIG_APM_EMULATION=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIUSB is not set
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+# CONFIG_BT_HCIUART_BCSP is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=m
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_XIP=y
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_SHARP_SL is not set
+# CONFIG_MTD_EZX is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_NET_ETHERNET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPP_MPPE is not set
+# CONFIG_PPPOE is not set
+# CONFIG_PPPOL2TP is not set
+# CONFIG_SLIP is not set
+CONFIG_SLHC=m
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_PXA=y
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=y
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_GPIO is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+CONFIG_SPI_PXA2XX=m
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_GPIO is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_EZX is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA=y
+CONFIG_FB_PXA_LCD_QVGA=y
+# CONFIG_FB_PXA_LCD_VGA is not set
+CONFIG_FB_PXA_OVERLAY=y
+CONFIG_FB_PXA_PARAMETERS=y
+# CONFIG_FB_MBX is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+CONFIG_FONT_MINI_4x6=y
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ALSA ARM devices
+#
+# CONFIG_SND_PXA2XX_AC97 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
+CONFIG_SND_SOC=y
+CONFIG_SND_PXA2XX_SOC=y
+CONFIG_SND_PXA2XX_SOC_SSP=y
+CONFIG_SND_PXA2XX_SOC_EZX=y
+
+#
+# SoC Audio support for SuperH
+#
+CONFIG_SND_SOC_PCAP2=y
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_PXA2XX is not set
+CONFIG_USB_GADGET_PXA27X=y
+CONFIG_USB_PXA27X=y
+# CONFIG_USB_PXA2XX_SMALL is not set
+# CONFIG_USB_GADGET_M66592 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_ZERO is not set
+CONFIG_USB_ETH=y
+# CONFIG_USB_ETH_RNDIS is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_PXA=y
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=m
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
diff --git a/packages/linux/linux-ezx-2.6.23/patches/defconfig-e6 b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e6
new file mode 100644
index 0000000000..733566adc6
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e6
@@ -0,0 +1,1203 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23.1
+# Wed Oct 24 18:07:51 2007
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-ezxdev"
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_AS is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
+# CONFIG_MACH_MAINSTONE is not set
+# CONFIG_ARCH_PXA_IDP is not set
+# CONFIG_PXA_SHARPSL is not set
+# CONFIG_MACH_TRIZEPS4 is not set
+# CONFIG_MACH_EM_X270 is not set
+CONFIG_PXA_EZX=y
+# CONFIG_PXA_EZX_E680 is not set
+# CONFIG_PXA_EZX_A780 is not set
+# CONFIG_PXA_EZX_E2 is not set
+# CONFIG_PXA_EZX_A1200 is not set
+CONFIG_PXA_EZX_E6=y
+# CONFIG_EZX_BP is not set
+CONFIG_EZX_PCAP=y
+CONFIG_EZX_EOC=y
+# CONFIG_EZX_EMU is not set
+CONFIG_PXA27x=y
+CONFIG_PXA_SSP=y
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
+CONFIG_IWMMXT=y
+CONFIG_XSCALE_PMU=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_PREEMPT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug mem=32M@0xA0000000"
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=m
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management options
+#
+CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
+# CONFIG_PM_DEBUG is not set
+CONFIG_SUSPEND_UP_POSSIBLE=y
+# CONFIG_SUSPEND is not set
+CONFIG_APM_EMULATION=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIUSB is not set
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+# CONFIG_BT_HCIUART_BCSP is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=m
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_XIP=y
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_SHARP_SL is not set
+# CONFIG_MTD_EZX is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_NET_ETHERNET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPP_MPPE is not set
+# CONFIG_PPPOE is not set
+# CONFIG_PPPOL2TP is not set
+# CONFIG_SLIP is not set
+CONFIG_SLHC=m
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_TSDEV=y
+CONFIG_INPUT_TSDEV_SCREEN_X=240
+CONFIG_INPUT_TSDEV_SCREEN_Y=320
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_PXA=y
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+CONFIG_TOUCHSCREEN_PCAP=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=y
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_GPIO is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+CONFIG_SPI_PXA2XX=m
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_GPIO is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+# CONFIG_BACKLIGHT_EZX is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA=y
+CONFIG_FB_PXA_LCD_QVGA=y
+# CONFIG_FB_PXA_LCD_VGA is not set
+CONFIG_FB_PXA_OVERLAY=y
+CONFIG_FB_PXA_PARAMETERS=y
+# CONFIG_FB_MBX is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+CONFIG_FONT_MINI_4x6=y
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ALSA ARM devices
+#
+# CONFIG_SND_PXA2XX_AC97 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
+CONFIG_SND_SOC=y
+CONFIG_SND_PXA2XX_SOC=y
+CONFIG_SND_PXA2XX_SOC_SSP=y
+CONFIG_SND_PXA2XX_SOC_EZX=y
+
+#
+# SoC Audio support for SuperH
+#
+CONFIG_SND_SOC_PCAP2=y
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_PXA2XX is not set
+CONFIG_USB_GADGET_PXA27X=y
+CONFIG_USB_PXA27X=y
+# CONFIG_USB_PXA2XX_SMALL is not set
+# CONFIG_USB_GADGET_M66592 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_ZERO is not set
+CONFIG_USB_ETH=y
+# CONFIG_USB_ETH_RNDIS is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_PXA=y
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=m
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
diff --git a/packages/linux/linux-ezx-2.6.23/patches/defconfig-e680 b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e680
new file mode 100644
index 0000000000..738e10324c
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/defconfig-e680
@@ -0,0 +1,1214 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.23.1
+# Wed Oct 24 17:55:27 2007
+#
+CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
+CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-ezxdev"
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+# CONFIG_SYSCTL_SYSCALL is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_DEFAULT_AS is not set
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="deadline"
+
+#
+# System Type
+#
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
+# CONFIG_MACH_MAINSTONE is not set
+# CONFIG_ARCH_PXA_IDP is not set
+# CONFIG_PXA_SHARPSL is not set
+# CONFIG_MACH_TRIZEPS4 is not set
+# CONFIG_MACH_EM_X270 is not set
+CONFIG_PXA_EZX=y
+CONFIG_PXA_EZX_E680=y
+# CONFIG_PXA_EZX_A780 is not set
+# CONFIG_PXA_EZX_E2 is not set
+# CONFIG_PXA_EZX_A1200 is not set
+# CONFIG_PXA_EZX_E6 is not set
+CONFIG_EZX_BP=y
+CONFIG_EZX_PCAP=y
+# CONFIG_EZX_EOC is not set
+CONFIG_EZX_EMU=y
+CONFIG_EZX_EMU_USB=y
+# CONFIG_EZX_EMU_UART is not set
+# CONFIG_EZX_EMU_NOTHING is not set
+CONFIG_PXA27x=y
+CONFIG_PXA_SSP=y
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
+CONFIG_IWMMXT=y
+CONFIG_XSCALE_PMU=y
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_PREEMPT=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext2 ip=192.168.0.202:192.168.0.200:192.168.0.200:255.255.255.0 debug mem=32M@0xA0000000 mem=16M@0xAC000000"
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=m
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management options
+#
+CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
+# CONFIG_PM_DEBUG is not set
+CONFIG_SUSPEND_UP_POSSIBLE=y
+# CONFIG_SUSPEND is not set
+CONFIG_APM_EMULATION=y
+
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIUSB is not set
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_H4=y
+# CONFIG_BT_HCIUART_BCSP is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=m
+# CONFIG_SYS_HYPERVISOR is not set
+CONFIG_CONNECTOR=m
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_XIP=y
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_SHARP_SL is not set
+CONFIG_MTD_EZX=y
+CONFIG_MTD_EZX_A780=y
+# CONFIG_MTD_EZX_A780_ALTERNATE is not set
+# CONFIG_MTD_EZX_A1200 is not set
+# CONFIG_MTD_EZX_E2 is not set
+# CONFIG_MTD_EZX_E6 is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_DATAFLASH is not set
+# CONFIG_MTD_M25P80 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+# CONFIG_BLK_DEV_RAM is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_DUMMY=y
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_NET_ETHERNET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPP_MPPE is not set
+# CONFIG_PPPOE is not set
+# CONFIG_PPPOL2TP is not set
+# CONFIG_SLIP is not set
+CONFIG_SLHC=m
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_TSDEV=y
+CONFIG_INPUT_TSDEV_SCREEN_X=240
+CONFIG_INPUT_TSDEV_SCREEN_Y=320
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_PXA=y
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_UCB1400 is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+CONFIG_TOUCHSCREEN_PCAP=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_ATI_REMOTE is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+CONFIG_INPUT_UINPUT=y
+
+#
+# Hardware I/O ports
+#
+# CONFIG_SERIO is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_TS0710_MUX=y
+CONFIG_TS0710_MUX_USB=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_GPIO is not set
+CONFIG_I2C_PXA=y
+# CONFIG_I2C_PXA_SLAVE is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# SPI support
+#
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_BITBANG is not set
+CONFIG_SPI_PXA2XX=m
+
+#
+# SPI Protocol Masters
+#
+# CONFIG_SPI_AT25 is not set
+# CONFIG_SPI_SPIDEV is not set
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_GPIO is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_E680=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
+
+#
+# Graphics support
+#
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_EZX=y
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_PXA=y
+CONFIG_FB_PXA_LCD_QVGA=y
+# CONFIG_FB_PXA_LCD_VGA is not set
+CONFIG_FB_PXA_OVERLAY=y
+CONFIG_FB_PXA_PARAMETERS=y
+# CONFIG_FB_MBX is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+CONFIG_FONT_MINI_4x6=y
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+
+#
+# Advanced Linux Sound Architecture
+#
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+# CONFIG_SND_SEQUENCER is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ALSA ARM devices
+#
+# CONFIG_SND_PXA2XX_AC97 is not set
+
+#
+# USB devices
+#
+# CONFIG_SND_USB_AUDIO is not set
+# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
+CONFIG_SND_SOC=y
+CONFIG_SND_PXA2XX_SOC=y
+CONFIG_SND_PXA2XX_SOC_SSP=y
+CONFIG_SND_PXA2XX_SOC_EZX=y
+
+#
+# SoC Audio support for SuperH
+#
+CONFIG_SND_SOC_PCAP2=y
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+
+#
+# USB Input Devices
+#
+# CONFIG_USB_HID is not set
+
+#
+# USB HID Boot Protocol drivers
+#
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+# CONFIG_USB_DEVICE_CLASS is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
+# CONFIG_USB_OTG is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_ISP116X_HCD is not set
+CONFIG_USB_OHCI_HCD=y
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
+#
+# may also be needed; see USB_STORAGE Help for more information
+#
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MON is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG_FILES is not set
+CONFIG_USB_GADGET_SELECTED=y
+# CONFIG_USB_GADGET_AMD5536UDC is not set
+# CONFIG_USB_GADGET_FSL_USB2 is not set
+# CONFIG_USB_GADGET_NET2280 is not set
+# CONFIG_USB_GADGET_PXA2XX is not set
+CONFIG_USB_GADGET_PXA27X=y
+CONFIG_USB_PXA27X=y
+# CONFIG_USB_PXA2XX_SMALL is not set
+# CONFIG_USB_GADGET_M66592 is not set
+# CONFIG_USB_GADGET_GOKU is not set
+# CONFIG_USB_GADGET_LH7A40X is not set
+# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_AT91 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
+# CONFIG_USB_GADGET_DUALSPEED is not set
+# CONFIG_USB_ZERO is not set
+CONFIG_USB_ETH=y
+# CONFIG_USB_ETH_RNDIS is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+
+#
+# MMC/SD Host Controller Drivers
+#
+CONFIG_MMC_PXA=y
+CONFIG_RTC_LIB=y
+# CONFIG_RTC_CLASS is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=m
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
+CONFIG_JBD=m
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=m
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+CONFIG_CRAMFS=m
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V2_ACL=y
+CONFIG_NFSD_V3=y
+CONFIG_NFSD_V3_ACL=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_ACL_SUPPORT=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+CONFIG_CIFS_STATS=y
+# CONFIG_CIFS_STATS2 is not set
+CONFIG_CIFS_WEAK_PW_HASH=y
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_CRC_CCITT=m
+CONFIG_CRC16=m
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=m
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
diff --git a/packages/linux/linux-ezx-2.6.23/patches/dmesg-a780.log b/packages/linux/linux-ezx-2.6.23/patches/dmesg-a780.log
new file mode 100644
index 0000000000..6b15077676
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/dmesg-a780.log
@@ -0,0 +1,299 @@
+<5>Linux version 2.6.21-ezxdev (wyrm@vault) (gcc version 4.1.1) #222 PREEMPT Tue May 8 15:19:34 BRT 2007
+<4>CPU: XScale-PXA270 [69054117] revision 7 (ARMv5TE), cr=0000397f
+<4>Machine: Motorola Ezx Platform
+<4>Memory policy: ECC disabled, Data cache writeback
+<7>On node 0 totalpages: 12288
+<7> DMA zone: 416 pages used for memmap
+<7> DMA zone: 0 pages reserved
+<7> DMA zone: 11872 pages, LIFO batch:1
+<7> Normal zone: 0 pages used for memmap
+<6>Run Mode clock: 195.00MHz (*15)
+<6>Turbo Mode clock: 292.50MHz (*1.5, active)
+<6>Memory clock: 195.00MHz (/2)
+<6>System bus clock: 195.00MHz
+<4>CPU0: D VIVT undefined 5 cache
+<4>CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
+<4>CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
+<4>Built 1 zonelists. Total pages: 11872
+<5>Kernel command line: console=tty1 noinitrd root=/dev/mmcblk0p2 rootfstype=ext3 ip=169.254.1.11:169.254.1.10:169.254.1.10:255.255.255.254:ezx:usb0:off debug mem=32M@0xA0000000 mem=16M@0xAC000000
+<4>PID hash table entries: 256 (order: 8, 1024 bytes)
+<4>Console: colour dummy device 80x30
+<4>Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
+<4>Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
+<6>Memory: 32MB 16MB = 48MB total
+<5>Memory: 46084KB available (2264K code, 217K data, 84K init)
+<7>Calibrating delay loop... 291.63 BogoMIPS (lpj=1458176)
+<4>Mount-cache hash table entries: 512
+<6>CPU: Testing write buffer coherency: ok
+<6>NET: Registered protocol family 16
+<6>usbcore: registered new interface driver usbfs
+<6>usbcore: registered new interface driver hub
+<6>usbcore: registered new device driver usb
+<6>Time: pxa_timer clocksource has been installed.
+<6>NET: Registered protocol family 2
+<4>IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
+<4>TCP established hash table entries: 2048 (order: 2, 16384 bytes)
+<4>TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
+<6>TCP: Hash tables configured (established 2048 bind 2048)
+<6>TCP reno registered
+<4>bp handshake entered!
+<4>ezx-bp: handshake step 2
+<4>BP rdy irq
+<4>bp handshake entered!
+<5>ezx-bp: handshake passed
+<4>ezx-pcap: ssp driver registered
+<6>io scheduler noop registered
+<6>io scheduler deadline registered (default)
+<4>pxa2xx-fb pxa2xx-fb: machine LCCR0 setting contains illegal bits: 00200878
+<4>pxa2xx-fb pxa2xx-fb: machine LCCR3 setting contains illegal bits: 00300008
+<4>Console: switching to colour frame buffer device 60x53
+<6>usbcore: registered new interface driver usb ipc
+<6>drivers/char/ts0710_mux_usb.c: USB Host(Bulverde) IPC driver registered.
+<6>drivers/char/ts0710_mux_usb.c: 1.0alpha1:USB IPC Driver (TS07.10 lowlevel)
+<6>pxa2xx-uart.0: ttyS0 at MMIO 0x40100000 (irq = 22) is a FFUART
+<6>pxa2xx-uart.1: ttyS1 at MMIO 0x40200000 (irq = 21) is a BTUART
+<6>pxa2xx-uart.2: ttyS2 at MMIO 0x40700000 (irq = 20) is a STUART
+<7>ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
+<6>pxa27x-ohci pxa27x-ohci: PXA27x OHCI
+<6>pxa27x-ohci pxa27x-ohci: new USB bus registered, assigned bus number 1
+<6>pxa27x-ohci pxa27x-ohci: irq 3, io mem 0x4c000000
+<6>usb usb1: configuration #1 chosen from 1 choice
+<6>hub 1-0:1.0: USB hub found
+<6>hub 1-0:1.0: 3 ports detected
+<6>pxa27x_udc: version 08-Feb-2007
+<5>USB cmd disconnect
+<5>USB cmd disconnect
+<4>ether gadget: using random self ethernet address
+<4>ether gadget: using random host ethernet address
+<6>usb0: Ethernet Gadget, version: May Day 2005
+<6>usb0: using pxa27x_udc, OUT Bulk-out-2 IN Bulk-in-1
+<6>usb0: MAC 46:86:e0:79:e7:fb
+<5>USB cmd connect
+<5>USB cmd connect
+<6>input: gpio-keys as /class/input/input0
+<6>input: pxa-keyboard as /class/input/input1
+<6>input: pcap-touchscreen as /class/input/input2
+<6>sa1100-rtc sa1100-rtc: rtc core: registered sa1100-rtc as rtc0
+<6>Registered led device: a780:main
+<6>Registered led device: a780:aux
+<6>Registered led device: a780:vibrator
+<6>TCP cubic registered
+<6>NET: Registered protocol family 1
+<6>NET: Registered protocol family 17
+<6>XScale iWMMXt coprocessor detected.
+<6>sa1100-rtc sa1100-rtc: setting the system clock to 1970-01-01 00:00:16 (16)
+<6>mmcblk0: mmc0:bffc SU02G 1985024KiB
+<6>udc: USB reset
+<6> mmcblk0:<6>usb 1-3: new full speed USB device using pxa27x-ohci and address 2
+<4> p1 p2 p3 < p5 p6 p7 >
+<6>udc: USB reset
+<3>usb 1-3: device descriptor read/64, error -62
+<6>usb0: full speed config #1: 100 mA, Ethernet Gadget, using CDC Ethernet Subset
+<3>usb 1-3: device descriptor read/64, error -62
+<6>usb 1-3: new full speed USB device using pxa27x-ohci and address 3
+<3>usb 1-3: device descriptor read/64, error -62
+<4>IP-Config: Complete:
+<4> device=usb0, addr=169.254.1.11, mask=255.255.255.254, gw=169.254.1.10,
+<4> host=ezx, domain=, nis-domain=(none),
+<4> bootserver=169.254.1.10, rootserver=169.254.1.10, rootpath=
+<6>kjournald starting. Commit interval 5 seconds
+<4>EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
+<6>EXT3 FS on mmcblk0p2, internal journal
+<6>EXT3-fs: recovery complete.
+<6>EXT3-fs: mounted filesystem with ordered data mode.
+<4>VFS: Mounted root (ext3 filesystem).
+<6>Freeing init memory: 84K
+<3>usb 1-3: device descriptor read/64, error -110
+<6>usb 1-3: new full speed USB device using pxa27x-ohci and address 4
+<3>usb 1-3: device descriptor read/8, error -62
+<4>usb 1-3: config 1 has an invalid interface number: 13 but max is 2
+<4>usb 1-3: config 1 has an invalid interface number: 6 but max is 2
+<4>usb 1-3: config 1 has an invalid interface number: 7 but max is 2
+<4>usb 1-3: config 1 has no interface number 0
+<4>usb 1-3: config 1 has no interface number 1
+<4>usb 1-3: config 1 has no interface number 2
+<6>usb 1-3: configuration #1 chosen from 1 choice
+<4>usb_ipc_probe: completed probe!
+<6>drivers/char/ts0710_mux_usb.c: usb_ipc_probe: Only two endpoints supported.
+<4>usb ipc: probe of 1-3:1.6 failed with error -1
+<6>drivers/char/ts0710_mux_usb.c: usb_ipc_probe: Only two endpoints supported.
+<4>usb ipc: probe of 1-3:1.7 failed with error -1
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2009 bytes from ts0710_mux_usb inbuf.
+<4>Read 21 bytes.
+<4>Reading max 1988 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2009 bytes from ts0710_mux_usb inbuf.
+<4>Read 21 bytes.
+<4>Reading max 1988 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2009 bytes from ts0710_mux_usb inbuf.
+<4>Read 21 bytes.
+<4>Reading max 1988 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2009 bytes from ts0710_mux_usb inbuf.
+<4>Read 21 bytes.
+<4>Reading max 1988 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2009 bytes from ts0710_mux_usb inbuf.
+<4>Read 21 bytes.
+<4>Reading max 1988 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 11 bytes.
+<4>Reading max 2037 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 17 bytes.
+<4>Reading max 2031 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 11 bytes.
+<4>Reading max 2037 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 7 bytes.
+<4>Reading max 2041 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 11 bytes.
+<4>Reading max 2037 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2016 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1984 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1952 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1920 bytes from ts0710_mux_usb inbuf.
+<4>Read 6 bytes.
+<4>Reading max 1914 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1882 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1850 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1818 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1786 bytes from ts0710_mux_usb inbuf.
+<4>Read 6 bytes.
+<4>Reading max 1780 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1748 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1716 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1684 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1652 bytes from ts0710_mux_usb inbuf.
+<4>Read 6 bytes.
+<4>Reading max 1646 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2016 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1984 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1952 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1920 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1888 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1856 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1824 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1792 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1760 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1728 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1696 bytes from ts0710_mux_usb inbuf.
+<4>Read 16 bytes.
+<4>Reading max 1680 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2016 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1984 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1952 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1920 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1888 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1856 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1824 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1792 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1760 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1728 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 1696 bytes from ts0710_mux_usb inbuf.
+<4>Read 13 bytes.
+<4>Reading max 1683 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 14 bytes.
+<4>Reading max 2034 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>Read 32 bytes.
+<4>Reading max 2016 bytes from ts0710_mux_usb inbuf.
+<4>Read 2 bytes.
+<4>Reading max 2014 bytes from ts0710_mux_usb inbuf.
+<4>Reading max 2048 bytes from ts0710_mux_usb inbuf.
+<4>nonzero read bulk status received: -104
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e6-eoc.patch b/packages/linux/linux-ezx-2.6.23/patches/e6-eoc.patch
new file mode 100644
index 0000000000..3824079c15
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e6-eoc.patch
@@ -0,0 +1,20 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-e6.c 2007-09-24 20:14:54.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c 2007-09-24 20:15:18.000000000 -0300
+@@ -203,8 +203,15 @@
+ },
+ };
+
++
++struct platform_device e6_eoc_device = {
++ .name = "ezx-eoc",
++ .id = -1,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e6_pcap_device,
++ &e6_eoc_device,
+ };
+
+ static void __init e6_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e6-mci.patch b/packages/linux/linux-ezx-2.6.23/patches/e6-mci.patch
new file mode 100644
index 0000000000..09886f42d4
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e6-mci.patch
@@ -0,0 +1,124 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e6.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e6.c 2007-10-24 19:35:51.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e6.c 2007-10-24 19:58:02.000000000 +0200
+@@ -13,6 +13,8 @@
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+ #include <linux/fb.h>
++#include <linux/mmc/host.h>
++#include <linux/irq.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -20,12 +22,102 @@
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
++#include <asm/arch/mmc.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
+
++#ifdef CONFIG_EZX_PCAP
++extern int ezx_pcap_mmcsd_power(int);
++extern void ezx_pcap_mmcsd_voltage(u_int32_t);
++#else
++#define ezx_pcap_mmcsd_voltage(x) {}
++#define ezx_pcap_mmcsd_power(x) {}
++#endif
++
++static struct pxamci_platform_data e6_mci_platform_data;
++
++static u_int8_t mmc_voltage[] = {
++ [ilog2(MMC_VDD_165_195)] = 6,
++ [ilog2(MMC_VDD_20_21)] = 7,
++ [ilog2(MMC_VDD_21_22)] = 8,
++ [ilog2(MMC_VDD_22_23)] = 8,
++ [ilog2(MMC_VDD_23_24)] = 9,
++ [ilog2(MMC_VDD_24_25)] = 9,
++ [ilog2(MMC_VDD_25_26)] = 10,
++ [ilog2(MMC_VDD_26_27)] = 10,
++ [ilog2(MMC_VDD_27_28)] = 11,
++ [ilog2(MMC_VDD_28_29)] = 11,
++ [ilog2(MMC_VDD_29_30)] = 12,
++ [ilog2(MMC_VDD_30_31)] = 12,
++ [ilog2(MMC_VDD_31_32)] = 13,
++ [ilog2(MMC_VDD_32_33)] = 13,
++ [ilog2(MMC_VDD_33_34)] = 14,
++ [ilog2(MMC_VDD_34_35)] = 14,
++ [ilog2(MMC_VDD_35_36)] = 15,
++};
++
++static int e6_mci_init(struct device *dev,
++ irqreturn_t (*ezx_detect_int)(int, void *),
++ void *data)
++{
++ int err;
++
++ /* Setup GPIO for PXA27x MMC/SD controller */
++ pxa_gpio_mode(GPIO32_MMCCLK_MD);
++ pxa_gpio_mode(GPIO112_MMCCMD_MD);
++ pxa_gpio_mode(GPIO92_MMCDAT0_MD);
++ pxa_gpio_mode(GPIO109_MMCDAT1_MD);
++ pxa_gpio_mode(GPIO110_MMCDAT2_MD);
++ pxa_gpio_mode(GPIO111_MMCDAT3_MD);
++
++ ezx_pcap_mmcsd_power(1);
++
++ e6_mci_platform_data.detect_delay = msecs_to_jiffies(250);
++
++ err = request_irq(0x49, ezx_detect_int, IRQF_DISABLED,
++ "MMC card detect", data);
++ if (err) {
++ printk(KERN_ERR "ezx_mci_detect: MMC/SD: can't request "
++ "MMC card detect IRQ\n");
++ return -1;
++ }
++
++ set_irq_type(0x0b, IRQT_BOTHEDGE);
++
++ return 0;
++}
++
++static void e6_mci_setpower(struct device *dev, unsigned int vdd)
++{
++ struct pxamci_platform_data* p_d = dev->platform_data;
++
++ if (( 1 << vdd) & p_d->ocr_mask)
++ ezx_pcap_mmcsd_voltage(mmc_voltage[vdd]);
++
++ ezx_pcap_mmcsd_power(1);
++}
++
++static void e6_mci_exit(struct device *dev, void *data)
++{
++ ezx_pcap_mmcsd_power(0);
++ free_irq(0x49, data);
++}
++
++static struct pxamci_platform_data e6_mci_platform_data = {
++ .ocr_mask = MMC_VDD_165_195|MMC_VDD_20_21|MMC_VDD_21_22
++ |MMC_VDD_22_23|MMC_VDD_23_24|MMC_VDD_24_25
++ |MMC_VDD_25_26|MMC_VDD_26_27|MMC_VDD_27_28
++ |MMC_VDD_28_29|MMC_VDD_29_30|MMC_VDD_30_31
++ |MMC_VDD_31_32|MMC_VDD_32_33|MMC_VDD_33_34
++ |MMC_VDD_34_35|MMC_VDD_35_36,
++ .init = e6_mci_init,
++ .setpower = e6_mci_setpower,
++ .exit = e6_mci_exit,
++};
++
+ static struct pxafb_mode_info mode_e6 = {
+ .pixclock = 192308,
+ .xres = 240,
+@@ -118,6 +210,7 @@
+ static void __init e6_init(void)
+ {
+ set_pxa_fb_info(&e6_fb_info);
++ pxa_set_mci_info(&e6_mci_platform_data);
+
+ platform_add_devices(devices, ARRAY_SIZE(devices));
+ }
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e6-pcap.patch b/packages/linux/linux-ezx-2.6.23/patches/e6-pcap.patch
new file mode 100644
index 0000000000..a11adbc02e
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e6-pcap.patch
@@ -0,0 +1,83 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-e6.c 2007-09-07 11:32:32.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c 2007-09-07 11:51:55.000000000 -0300
+@@ -19,6 +19,7 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
++#include <asm/arch/ezx-pcap.h>
+
+ #include "generic.h"
+
+@@ -48,7 +49,70 @@
+ .pxafb_lcd_power = &ezx_lcd_power,
+ };
+
++/* PCAP */
++static int __init e6_pcap_init(void)
++{
++ /*
++ * FIXME: this is the PCAP INITIAL STATE.
++ * most of these writes should NOT be done here
++ * * voltage regulators, voltage enablers should be set by the
++ * driver which uses the connected hardware. Otherwise you
++ * drain power unnecessarily.
++ * * interrupt related registers should be set by the irq functions
++ * only. I think that the INT_SEL register selects on which irq
++ * pin the (ap/bp) the irq goes. This should go on ezx-pcap.c, but
++ * only if it actually makes any difference.
++ * * Only power state automatic changes should be done here.
++ * (*LOWPWR, *STBY, LOWPWR*)
++ * * I removed some writes which i consider extremelly wrong. And
++ * which i think will not break anything (they were overwritten
++ * later anyway).
++ *
++ * --WM
++ */
++ ezx_pcap_write(PCAP_REG_INT_SEL, 0x0); /* wrong */
++ ezx_pcap_write(PCAP_REG_SWCTRL, 0x2ee6); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_VREG1, 0x15778e3); /* wrong */
++ ezx_pcap_write(PCAP_REG_VREG2, 0x810234); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_AUXVREG, 0x1024bec); /* wrong */
++ ezx_pcap_write(PCAP_REG_PWR, 0x94108); /* partially wrong */
++ ezx_pcap_write(PCAP_REG_AUXVREG_MASK, 0x214d48); /* wrong */
++ ezx_pcap_write(PCAP_REG_BUSCTRL, 0x2a0); /* wrong */
++ ezx_pcap_write(PCAP_REG_LOWPWR, 0x1d9610c);
++ ezx_pcap_write(PCAP_REG_PERIPH, 0x0); /* wrong */
++ ezx_pcap_write(PCAP_REG_GP, 0x107); /* probably unnecessary */
++
++ return 0;
++}
++
++static struct pcap_platform_data e6_pcap_platform_data = {
++ .port = 1,
++ .cs = GPIO_SPI_CE,
++ .flags = PCAP_CS_AH | PCAP_MCI_SD,
++ .clk = 1,
++ .init = e6_pcap_init,
++};
++
++static struct resource e6_pcap_resources[] = {
++ [0] = {
++ .start = IRQ_GPIO1,
++ .end = IRQ_GPIO1,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device e6_pcap_device = {
++ .name = "ezx-pcap",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(e6_pcap_resources),
++ .resource = e6_pcap_resources,
++ .dev = {
++ .platform_data = &e6_pcap_platform_data,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
++ &e6_pcap_device,
+ };
+
+ static void __init e6_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e6-ts.patch b/packages/linux/linux-ezx-2.6.23/patches/e6-ts.patch
new file mode 100644
index 0000000000..ad4a52eeec
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e6-ts.patch
@@ -0,0 +1,39 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-e6.c 2007-09-25 00:03:01.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c 2007-09-25 02:00:58.000000000 -0300
+@@ -209,9 +209,34 @@
+ .id = -1,
+ };
+
++/* PCAP_TS */
++struct resource pcap_ts_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_ADCDONE,
++ .end = EZX_IRQ_ADCDONE,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_TS,
++ .end = EZX_IRQ_TS,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++struct platform_device pcap_ts_device = {
++ .name = "pcap-ts",
++ .id = -1,
++ .dev = {
++ .parent = &e6_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(pcap_ts_resources),
++ .resource = pcap_ts_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e6_pcap_device,
+ &e6_eoc_device,
++ &pcap_ts_device,
+ };
+
+ static void __init e6_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-emu.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-emu.patch
new file mode 100644
index 0000000000..6302bba8c7
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-emu.patch
@@ -0,0 +1,38 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:32.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:37.000000000 +0200
+@@ -212,8 +212,33 @@
+ },
+ };
+
++/* EMU */
++static struct resource e680_emu_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_USB4V,
++ .end = EZX_IRQ_USB4V,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_USB1V,
++ .end = EZX_IRQ_USB1V,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device e680_emu_device = {
++ .name = "ezx-emu",
++ .id = -1,
++ .dev = {
++ .parent = &e680_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(e680_emu_resources),
++ .resource = e680_emu_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e680_pcap_device,
++ &e680_emu_device,
+ };
+
+ static void __init e680_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-kbd.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-kbd.patch
new file mode 100644
index 0000000000..27e33a0641
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-kbd.patch
@@ -0,0 +1,93 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:37.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:49.000000000 +0200
+@@ -15,6 +15,7 @@
+ #include <linux/fb.h>
+ #include <linux/mmc/host.h>
+ #include <linux/irq.h>
++#include <linux/input.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -23,11 +24,13 @@
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
+ #include <asm/arch/mmc.h>
++#include <asm/arch/kbd.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
++extern void __init pxa_set_kbd_info(struct pxakbd_platform_data *);
+
+ #ifdef CONFIG_EZX_PCAP
+ extern int ezx_pcap_mmcsd_power(int);
+@@ -236,6 +239,58 @@
+ .resource = e680_emu_resources,
+ };
+
++static unsigned char e680_keycode[] = {
++ /* row 0 */
++ KEY_UP, KEY_RIGHT, KEY_RESERVED, KEY_PHONE,
++ /* row 1 */
++ KEY_DOWN, KEY_LEFT, KEY_VOLUMEUP, KEY_VOLUMEDOWN,
++ /* row 2 */
++ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_KPENTER,
++};
++
++static unsigned char e680_direct_keycode[] = {
++ KEY_CAMERA,
++ KEY_RESERVED,
++ KEY_RESERVED,
++ KEY_HOME,
++ KEY_POWER,
++ KEY_MENU,
++};
++
++static int e680_kbd_init(void)
++{
++ pxa_gpio_mode(93 | GPIO_ALT_FN_1_IN); /* KP_DKIN<0>, VR Key */
++ pxa_gpio_mode(96 | GPIO_ALT_FN_1_IN); /* KP_DKIN<3>, GAME_A */
++ pxa_gpio_mode(97 | GPIO_ALT_FN_1_IN); /* KP_DKIN<4>, power key */
++ pxa_gpio_mode(98 | GPIO_ALT_FN_1_IN); /* KP_DKIN<5>, GAME_B */
++ pxa_gpio_mode(100 | GPIO_ALT_FN_1_IN); /* KP_MKIN<0> */
++ pxa_gpio_mode(101 | GPIO_ALT_FN_1_IN); /* KP_MKIN<1> */
++ pxa_gpio_mode(102 | GPIO_ALT_FN_1_IN); /* KP_MKIN<2> */
++ pxa_gpio_mode(103 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<0> */
++ pxa_gpio_mode(104 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<1> */
++ pxa_gpio_mode(105 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<2> */
++ pxa_gpio_mode(106 | GPIO_ALT_FN_2_OUT); /* KP_MKOUT<3> */
++ pxa_gpio_mode(GPIO_TC_MM_EN);
++ GPDR(GPIO_TC_MM_EN) |= GPIO_bit(GPIO_TC_MM_EN);
++ GPSR(GPIO_TC_MM_EN) = GPIO_bit(GPIO_TC_MM_EN);
++ PGSR3 |= GPIO_bit(GPIO_TC_MM_EN);
++ return 0;
++}
++
++static struct pxakbd_platform_data e680_kbd_platform_data = {
++ .init = &e680_kbd_init,
++ .scan_interval = HZ/40,
++ .matrix = {
++ .keycode = e680_keycode,
++ .cols = 4,
++ .rows = 3,
++ },
++ .direct = {
++ .keycode = e680_direct_keycode,
++ .num = 6,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e680_pcap_device,
+ &e680_emu_device,
+@@ -256,6 +311,7 @@
+
+ set_pxa_fb_info(&e680_fb_info);
+ pxa_set_mci_info(&e680_mci_platform_data);
++ pxa_set_kbd_info(&e680_kbd_platform_data);
+
+ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
+ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-leds.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-leds.patch
new file mode 100644
index 0000000000..871f99be95
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-leds.patch
@@ -0,0 +1,300 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+Index: linux-2.6.23/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Kconfig 2007-10-24 20:02:07.000000000 +0200
++++ linux-2.6.23/drivers/leds/Kconfig 2007-10-24 20:02:07.000000000 +0200
+@@ -117,6 +117,13 @@
+ This option enables support for the LEDs on the
+ Motorola A780 GSM Phone.
+
++config LEDS_E680
++ tristate "LED Support for the Motorola E680(i) GSM Phone"
++ depends LEDS_CLASS && PXA_EZX_E680
++ help
++ This options enables support for the LEDs on the
++ Motorola E680(i) GSM Phone.
++
+ config LEDS_TRIGGER_TIMER
+ tristate "LED Timer Trigger"
+ depends on LEDS_TRIGGERS
+Index: linux-2.6.23/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Makefile 2007-10-24 20:02:07.000000000 +0200
++++ linux-2.6.23/drivers/leds/Makefile 2007-10-24 20:02:07.000000000 +0200
+@@ -18,6 +18,7 @@
+ obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
+ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
+ obj-$(CONFIG_LEDS_A780) += leds-a780.o
++obj-$(CONFIG_LEDS_E680) += leds-e680.o
+
+ # LED Triggers
+ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
+Index: linux-2.6.23/drivers/leds/leds-e680.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/leds/leds-e680.c 2007-10-24 20:02:07.000000000 +0200
+@@ -0,0 +1,235 @@
++/*
++ * EZX Platform LED Driver for the Motorola E680(i) GSM Phone
++ *
++ * Copyright 2006 Vanille-Media
++ *
++ * Author: Michael Lauer <mickey@Vanille.de>
++ *
++ * Based on the Motorola 2.4 leds-e680.c and leds-corgi.c by Richard Purdie
++ *
++ * 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/delay.h>
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/leds.h>
++#include <asm/mach-types.h>
++#include <asm/arch/hardware.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx-pcap.h>
++
++//FIXME move defines to a common header file
++#define IND_CNTL_R_BUL 46
++#define IND_CNTL_G_BUL 47
++#define SSP_PCAP_LED_MASK 0x000fffe0
++#define SSP_PCAP_LED_SHIFT 5
++#define GPIO_TC_MM_EN 99
++
++extern int ezx_pcap_read(u_int8_t, u_int32_t *);
++extern int ezx_pcap_write(u_int8_t, u_int32_t);
++
++typedef struct {
++ u_int8_t ind_GPIO_red; /*Indicator Red control GPIO 46: 0 active, 1 inactive */
++ u_int8_t ind_GPIO_green; /*Indicator Green control GPIO 47: 0 inactive, 1 active */
++ u_int8_t pcap_LEDR_en; /*pcap LEDR_EN bit value: 1 =Red LED(&Green) sink circuit enabled*/
++ u_int8_t pcap_LEDG_en; /*pcap LEDG_EN bit value:1 =Green(->Blue)LED sink circuit enabled*/
++ u_int8_t pcap_LEDR_CTRL; /* 4bits Sets the timing for the red(&Green) LED sink circuit*/
++ u_int8_t pcap_LEDG_CTRL; /* 4bits Sets the timing for the GREEN (->Blue) LED sink circuit*/
++ u_int8_t pcap_LEDR_I; /* 2 bits 00 3mA,01 4mA, 10 5mA, 11 9mA, sets the pulsed current level for LEDR*/
++ u_int8_t pcap_LEDG_I; /* 2 bits 00 3mA,01 4mA, 10 5mA, 11 9mA, sets the pulsed current level for LEDG*/
++// u_int8_t pcap_SKIP_on; /*1=The ON timing sequence defined by LEDx_CTRL is executed on every other cycle*/
++} PCAP2_LED_REGISTER_VALUE;
++
++const PCAP2_LED_REGISTER_VALUE led_register_value[]=
++{
++ {0x1,0x0, 0x0,0x0, 0x0,0x0, 0x1,0x0}, /* 0 OFF */
++
++ {0x0,0x0, 0x1,0x0, 0xf,0x0, 0x1,0x0}, /* 1 RED */
++ {0x1,0x1, 0x1,0x0, 0xf,0x0, 0x1,0x0}, /* 2 GREEN */
++ {0x0,0x1, 0x1,0x0, 0xf,0x0, 0x1,0x0}, /* 3 ORANGE */
++ {0x1,0x0, 0x0,0x1, 0x0,0xf, 0x0,0x0}, /* 4 BLUE */
++ {0x0,0x0, 0x1,0x1, 0xf,0xf, 0x1,0x0}, /* 5 MAGENTA */
++ {0x1,0x1, 0x1,0x1, 0xf,0xf, 0x1,0x0}, /* 6 CYAN */
++ {0x0,0x1, 0x1,0x1, 0xf,0xf, 0x1,0x0}, /* 7 WHITE */
++};
++
++static void e680led_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ unsigned int tempValue;
++ unsigned char gpio_red, gpio_green, ledr_en, ledg_en, ledr_ctrl,
++ ledg_ctrl, ledr_i, ledg_i, skip, t, color;
++ unsigned char t_mask[2] = { 0xc, 0xc };
++
++ skip = 0;
++ if (value & 128) {
++ value &= (~128);
++ skip = 1;
++ }
++
++ /* 7 colors - simple on */
++ if (value <= 7)
++ color = value;
++ /* 4 colors - 11 timed on */
++ else if (value <= 51) {
++ value -= 7;
++ color = ((value-1)%4)+1;
++ t = ((value-1)/4)+1;
++ t_mask[0] = t;
++ t_mask[1] = t;
++ }
++ /* 3 colors - 22 change color */
++ else if (value <= 84) {
++ value -= 51;
++ color = ((value-1)%3)+5;
++ t = ((value-1)/3)+1;
++ t_mask[1] = t;
++ }
++ else if (value <= 117) {
++ value -= 84;
++ color = ((value-1)%3)+5;
++ t = ((value-1)/3)+1;
++ t_mask[0] = t;
++ }
++ /* 3 colors - alternate with blue */
++ else if (value <= 120) {
++ color = value-113;
++ t_mask[0] = 0xa;
++ t_mask[1] = 0xb;
++ }
++ /* invalid value */
++ else
++ color = 1;
++
++ gpio_red = led_register_value[color].ind_GPIO_red;
++ gpio_green = led_register_value[color].ind_GPIO_green;
++ ledr_en = led_register_value[color].pcap_LEDR_en;
++ ledg_en = led_register_value[color].pcap_LEDG_en;
++ ledr_ctrl = led_register_value[color].pcap_LEDR_CTRL & t_mask[0];
++ ledg_ctrl = led_register_value[color].pcap_LEDG_CTRL & t_mask[1];
++ ledr_i = led_register_value[color].pcap_LEDR_I;
++ ledg_i = led_register_value[color].pcap_LEDG_I;
++
++ ezx_pcap_read(PCAP_REG_PERIPH,&tempValue);
++
++ tempValue &= (~SSP_PCAP_LED_MASK);
++
++ pxa_gpio_set_value(IND_CNTL_R_BUL, gpio_red);
++ pxa_gpio_set_value(IND_CNTL_G_BUL, gpio_green);
++
++ /* Write PCAP LED Peripheral Control Register*/
++ tempValue = ((ledr_en | (ledg_en << 1) | (ledr_ctrl << 2) |
++ (ledg_ctrl << 6) | (ledr_i << 10) | (ledg_i << 12) |
++ (skip << 14)) & 0x7fff) << SSP_PCAP_LED_SHIFT;
++
++ ezx_pcap_write(PCAP_REG_PERIPH,tempValue);
++}
++
++static void e680led_keypad_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ /* this is not working yet, as there is something else missing */
++#if 0
++ printk( KERN_DEBUG "e680led_keypad_set: %d\n", value );
++
++ pxa_gpio_mode(GPIO_TC_MM_EN);
++ GPDR(GPIO_TC_MM_EN) |= GPIO_bit(GPIO_TC_MM_EN);
++ GPSR(GPIO_TC_MM_EN) = GPIO_bit(GPIO_TC_MM_EN);
++
++ udelay( 100 );
++
++ if ( value ) {
++ GPCR(GPIO_TC_MM_EN) = GPIO_bit(GPIO_TC_MM_EN);
++ PGSR3 &= ~GPIO_bit(GPIO_TC_MM_EN);
++ } else {
++ GPSR(GPIO_TC_MM_EN) = GPIO_bit(GPIO_TC_MM_EN);
++ PGSR3 |= GPIO_bit(GPIO_TC_MM_EN);
++ }
++#endif
++}
++
++static struct led_classdev e680_led = {
++ .name = "e680:led",
++ .default_trigger = "none",
++ .brightness_set = e680led_set,
++};
++
++static struct led_classdev e680_keypad = {
++ .name = "e680:keypad",
++ .default_trigger = "none",
++ .brightness_set = e680led_keypad_set,
++};
++
++#ifdef CONFIG_PM
++static int e680led_suspend(struct platform_device *dev, pm_message_t state)
++{
++ led_classdev_suspend(&e680_led);
++ led_classdev_suspend(&e680_keypad);
++ return 0;
++}
++
++static int e680led_resume(struct platform_device *dev)
++{
++ led_classdev_resume(&e680_led);
++ led_classdev_resume(&e680_keypad);
++ return 0;
++}
++#endif
++
++static int e680led_probe(struct platform_device *pdev)
++{
++ int ret;
++
++ /* configure GPIOs as output */
++ pxa_gpio_mode(IND_CNTL_R_BUL | GPIO_OUT);
++ pxa_gpio_mode(IND_CNTL_G_BUL | GPIO_OUT);
++
++ ret = led_classdev_register(&pdev->dev, &e680_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &e680_keypad);
++ if (ret < 0) {
++ led_classdev_unregister(&e680_led);
++ }
++ return ret;
++}
++
++static int e680led_remove(struct platform_device *pdev)
++{
++ led_classdev_unregister(&e680_led);
++ led_classdev_unregister(&e680_keypad);
++ return 0;
++}
++
++static struct platform_driver e680led_driver = {
++ .probe = e680led_probe,
++ .remove = e680led_remove,
++#ifdef CONFIG_PM
++ .suspend = e680led_suspend,
++ .resume = e680led_resume,
++#endif
++ .driver = {
++ .name = "e680-led",
++ },
++};
++
++static int __init e680led_init(void)
++{
++ return platform_driver_register(&e680led_driver);
++}
++
++static void __exit e680led_exit(void)
++{
++ platform_driver_unregister(&e680led_driver);
++}
++
++module_init(e680led_init);
++module_exit(e680led_exit);
++
++MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
++MODULE_DESCRIPTION("Motorola E680 LED driver");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:02:05.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:02:07.000000000 +0200
+@@ -337,11 +337,20 @@
+ },
+ };
+
++static struct platform_device e680led_device = {
++ .name = "e680-led",
++ .id = -1,
++ .dev = {
++ .parent = &e680_pcap_device.dev,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e680_pcap_device,
+ &e680_emu_device,
+ &pcap_ts_device,
+ &e680locksw_device,
++ &e680led_device,
+ };
+
+ static void __init e680_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-locksw.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-locksw.patch
new file mode 100644
index 0000000000..6bb6687400
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-locksw.patch
@@ -0,0 +1,45 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 18:58:55.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 18:59:23.000000000 +0200
+@@ -16,6 +16,7 @@
+ #include <linux/mmc/host.h>
+ #include <linux/irq.h>
+ #include <linux/input.h>
++#include <linux/gpio_keys.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -315,10 +316,32 @@
+ .resource = pcap_ts_resources,
+ };
+
++static struct gpio_keys_button e680locksw_buttons[] = {
++ [0] = {
++ .code = KEY_SLEEP,
++ .gpio = GPIO_LOCK_SCREEN_PIN,
++ .desc = "E680 lockscreen sw",
++ },
++};
++
++static struct gpio_keys_platform_data e680locksw_platform_data = {
++ .buttons = e680locksw_buttons,
++ .nbuttons = 1,
++};
++
++static struct platform_device e680locksw_device = {
++ .name = "gpio-keys",
++ .id = -1,
++ .dev = {
++ .platform_data = &e680locksw_platform_data,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e680_pcap_device,
+ &e680_emu_device,
+ &pcap_ts_device,
++ &e680locksw_device,
+ };
+
+ static void __init e680_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-mci.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-mci.patch
new file mode 100644
index 0000000000..73981823cf
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-mci.patch
@@ -0,0 +1,126 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 13:03:06.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 18:54:35.000000000 +0200
+@@ -13,6 +13,8 @@
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+ #include <linux/fb.h>
++#include <linux/mmc/host.h>
++#include <linux/irq.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -20,12 +22,104 @@
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
+ #include <asm/arch/ezx-pcap.h>
++#include <asm/arch/mmc.h>
+
+ #include "generic.h"
+
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
+
++#ifdef CONFIG_EZX_PCAP
++extern int ezx_pcap_mmcsd_power(int);
++extern void ezx_pcap_mmcsd_voltage(u_int32_t);
++#else
++#define ezx_pcap_mmcsd_voltage(x) {}
++#define ezx_pcap_mmcsd_power(x) {}
++#endif
++
++static struct pxamci_platform_data e680_mci_platform_data;
++
++static u_int8_t mmc_voltage[] = {
++ [ilog2(MMC_VDD_165_195)] = 3,
++ [ilog2(MMC_VDD_20_21)] = 3,
++ [ilog2(MMC_VDD_21_22)] = 3,
++ [ilog2(MMC_VDD_22_23)] = 3,
++ [ilog2(MMC_VDD_23_24)] = 3,
++ [ilog2(MMC_VDD_24_25)] = 3,
++ [ilog2(MMC_VDD_25_26)] = 3,
++ [ilog2(MMC_VDD_26_27)] = 3,
++ [ilog2(MMC_VDD_27_28)] = 3,
++ [ilog2(MMC_VDD_28_29)] = 3,
++ [ilog2(MMC_VDD_29_30)] = 3,
++ [ilog2(MMC_VDD_30_31)] = 3,
++ [ilog2(MMC_VDD_31_32)] = 3,
++ [ilog2(MMC_VDD_32_33)] = 3,
++ [ilog2(MMC_VDD_33_34)] = 3,
++ [ilog2(MMC_VDD_34_35)] = 3,
++ [ilog2(MMC_VDD_35_36)] = 3,
++};
++
++static int e680_mci_init(struct device *dev,
++ irqreturn_t (*ezx_detect_int)(int, void *),
++ void *data)
++{
++ int err;
++
++ /* Setup GPIO for PXA27x MMC/SD controller */
++ pxa_gpio_mode(GPIO32_MMCCLK_MD);
++ pxa_gpio_mode(GPIO112_MMCCMD_MD);
++ pxa_gpio_mode(GPIO92_MMCDAT0_MD);
++ pxa_gpio_mode(GPIO109_MMCDAT1_MD);
++ pxa_gpio_mode(GPIO110_MMCDAT2_MD);
++ pxa_gpio_mode(GPIO111_MMCDAT3_MD);
++
++ ezx_pcap_mmcsd_power(1);
++
++ e680_mci_platform_data.detect_delay = msecs_to_jiffies(250);
++
++ err = request_irq(0x49, ezx_detect_int, IRQF_DISABLED,
++ "MMC card detect", data);
++ if (err) {
++ printk(KERN_ERR "ezx_mci_detect: MMC/SD: can't request "
++ "MMC card detect IRQ\n");
++ return -1;
++ }
++
++ set_irq_type(0x0b, IRQT_BOTHEDGE);
++
++ return 0;
++}
++
++
++static inline int e680_mci_get_ro(struct device *dev)
++{
++ return (GPLR3 & 0x800);
++}
++
++static void e680_mci_setpower(struct device *dev, unsigned int vdd)
++{
++ struct pxamci_platform_data* p_d = dev->platform_data;
++
++ if (( 1 << vdd) & p_d->ocr_mask)
++ ezx_pcap_mmcsd_voltage(mmc_voltage[vdd]);
++
++ ezx_pcap_mmcsd_power(1);
++}
++
++static void e680_mci_exit(struct device *dev, void *data)
++{
++ ezx_pcap_mmcsd_power(0);
++ free_irq(0x49, data);
++}
++
++static struct pxamci_platform_data e680_mci_platform_data = {
++ .ocr_mask = MMC_VDD_27_28,
++ .init = e680_mci_init,
++ .get_ro = e680_mci_get_ro,
++ .setpower = e680_mci_setpower,
++ .exit = e680_mci_exit,
++};
++
+ static struct pxafb_mode_info mode_e680 = {
+ .pixclock = 150000,
+ .xres = 240,
+@@ -136,6 +230,7 @@
+ PSLR = 0x05800f00;
+
+ set_pxa_fb_info(&e680_fb_info);
++ pxa_set_mci_info(&e680_mci_platform_data);
+
+ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
+ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-pcap.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-pcap.patch
new file mode 100644
index 0000000000..12ce023749
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-pcap.patch
@@ -0,0 +1,90 @@
+Index: linux-2.6.21/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.21.orig/arch/arm/mach-pxa/ezx-e680.c 2007-09-06 00:41:38.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e680.c 2007-09-06 00:44:56.000000000 -0300
+@@ -19,6 +19,7 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/pxafb.h>
+ #include <asm/arch/ezx.h>
++#include <asm/arch/ezx-pcap.h>
+
+ #include "generic.h"
+
+@@ -48,7 +49,77 @@
+ .pxafb_lcd_power = &ezx_lcd_power,
+ };
+
++/* PCAP */
++static int __init e680_pcap_init(void)
++{
++ /* initialize PCAP registers */
++ /* set SW1 sleep to keep SW1 1.3v in sync mode */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE10, 0);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE11, 0);
++
++ /* SW1 active in sync mode */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE00, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW1_MODE01, 0);
++
++ /* at SW1 -core voltage to 1.30V */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW10_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW11_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW12_DVS, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_SW13_DVS, 0);
++
++ /* when STANDY2 PIN ACTIVE (high) set V3-- sram V8 -- pll off */
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V3_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V3_LOWPWR, 0);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V8_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V8_LOWPWR, 0);
++
++ /*
++ * when STANDY2 PIN ACTIVE (high) set V4-- lcd only for e680 V6 ---
++ * camera for e680
++ */
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V4_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V4_LOWPWR, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V6_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_VREG2_V6_LOWPWR, 0);
++
++ /* set Vc to low power mode when AP sleep */
++// SSP_PCAP_bit_set( PCAP_BIT_LOWPWR_CTRL_VC_STBY);
++
++ /* set VAUX2 to low power mode when AP sleep */
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_VAUX2_STBY, 1);
++ ezx_pcap_bit_set(PCAP_BIT_LOWPWR_VAUX2_LOWPWR, 1);
++
++ return 0;
++}
++
++static struct pcap_platform_data e680_pcap_platform_data = {
++ .port = 1,
++ .cs = GPIO_SPI_CE,
++ .flags = PCAP_MCI_SD,
++ .clk = 1,
++ .init = e680_pcap_init,
++};
++
++static struct resource e680_pcap_resources[] = {
++ [0] = {
++ .start = IRQ_GPIO1,
++ .end = IRQ_GPIO1,
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++struct platform_device e680_pcap_device = {
++ .name = "ezx-pcap",
++ .id = -1,
++ .num_resources = ARRAY_SIZE(e680_pcap_resources),
++ .resource = e680_pcap_resources,
++ .dev = {
++ .platform_data = &e680_pcap_platform_data,
++ },
++};
++
+ static struct platform_device *devices[] __initdata = {
++ &e680_pcap_device,
+ };
+
+ static void __init e680_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/e680-ts.patch b/packages/linux/linux-ezx-2.6.23/patches/e680-ts.patch
new file mode 100644
index 0000000000..2350b2de82
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/e680-ts.patch
@@ -0,0 +1,39 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:49.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 20:01:58.000000000 +0200
+@@ -291,9 +291,34 @@
+ },
+ };
+
++/* PCAP_TS */
++struct resource pcap_ts_resources[] = {
++ [0] = {
++ .start = EZX_IRQ_ADCDONE2,
++ .end = EZX_IRQ_ADCDONE2,
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = EZX_IRQ_TS,
++ .end = EZX_IRQ_TS,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++struct platform_device pcap_ts_device = {
++ .name = "pcap-ts",
++ .id = -1,
++ .dev = {
++ .parent = &e680_pcap_device.dev,
++ },
++ .num_resources = ARRAY_SIZE(pcap_ts_resources),
++ .resource = pcap_ts_resources,
++};
++
+ static struct platform_device *devices[] __initdata = {
+ &e680_pcap_device,
+ &e680_emu_device,
++ &pcap_ts_device,
+ };
+
+ static void __init e680_init(void)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-asoc.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-asoc.patch
new file mode 100644
index 0000000000..2226022a2c
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-asoc.patch
@@ -0,0 +1,1302 @@
+Index: linux-2.6.23/sound/soc/codecs/pcap2.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/sound/soc/codecs/pcap2.c 2007-10-22 22:28:06.000000000 +0200
+@@ -0,0 +1,796 @@
++/*
++ * pcap2.c - PCAP2 ASIC Audio driver
++ *
++ * Copyright (C) 2007 Daniel Ribeiro <drwyrm@gmail.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/delay.h>
++#include <linux/moduleparam.h>
++#include <linux/init.h>
++#include <linux/delay.h>
++#include <linux/pm.h>
++#include <linux/platform_device.h>
++#include <sound/driver.h>
++#include <sound/core.h>
++#include <sound/pcm.h>
++#include <sound/pcm_params.h>
++#include <sound/soc.h>
++#include <sound/soc-dapm.h>
++#include <sound/initval.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx-pcap.h>
++#include <asm/arch/ezx.h>
++#include <asm/arch/hardware.h>
++
++#include "pcap2.h"
++
++#define AUDIO_NAME "pcap2-codec"
++#define PCAP2_VERSION "0.1"
++
++extern int ezx_pcap_write(u_int8_t, u_int32_t);
++extern int ezx_pcap_read(u_int8_t, u_int32_t *);
++static struct snd_soc_device *pcap2_codec_socdev;
++
++/*
++ * Debug
++ */
++
++//#define PCAP2_DEBUG
++
++#ifdef PCAP2_DEBUG
++#define dbg(format, arg...) \
++ printk(KERN_DEBUG AUDIO_NAME ": " format "\n" , ## arg)
++#else
++#define dbg(format, arg...)
++#endif
++
++#define err(format, arg...) \
++ printk(KERN_ERR AUDIO_NAME ": " format "\n" , ## arg)
++#define info(format, arg...) \
++ printk(KERN_INFO AUDIO_NAME ": " format "\n" , ## arg)
++#define warn(format, arg...) \
++ printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg)
++
++#define dump_registers() pcap2_codec_read(NULL, 13); \
++ pcap2_codec_read(NULL, 12); \
++ pcap2_codec_read(NULL, 11); \
++ pcap2_codec_read(NULL, 26);
++
++
++
++
++/*
++ * ASoC limits register value to 16 bits and pcap uses 32 bit registers
++ * to work around this, we get 16 bits from low, mid or high positions.
++ * ASoC limits register number to 8 bits we use 0x1f for register
++ * number and 0xe0 for register offset. -WM
++ */
++static int pcap2_codec_write(struct snd_soc_codec *codec, unsigned int reg,
++ unsigned int value)
++{
++ unsigned int tmp;
++
++ ezx_pcap_read((reg & 0x1f), &tmp);
++
++ if (reg & SL) {
++ tmp &= 0xffff0000;
++ tmp |= (value & 0xffff);
++ }
++ else if (reg & SM) {
++ tmp &= 0xff0000ff;
++ tmp |= ((value << 8) & 0x00ffff00);
++ }
++ else if (reg & SH) {
++ tmp &= 0xffff;
++ tmp |= ((value << 16) & 0xffff0000);
++ }
++ else
++ tmp = value;
++
++ dbg("codec_write reg=%x, rval=%08x, fval=%08x", reg, tmp, value);
++ ezx_pcap_write((reg & 0x1f), tmp);
++ return 0;
++
++}
++
++static unsigned int pcap2_codec_read(struct snd_soc_codec *codec, unsigned int reg)
++{
++ unsigned int tmp, ret;
++
++ ezx_pcap_read((reg & 0x1f), &tmp);
++ ret = tmp;
++ if (reg & SL)
++ ret = (tmp & 0xffff);
++ else if (reg & SM)
++ ret = ((tmp >> 8) & 0xffff);
++ else if (reg & SH)
++ ret = ((tmp >> 16) & 0xffff);
++
++ dbg("codec_read reg=%x, rval=%08x, fval=%08x", reg, tmp, ret);
++ return(ret);
++
++}
++
++static const char *pcap2_output_select[] = {"2ch", "2->1ch", "2->1ch -3db", "2->1ch -6db"};
++
++static const struct soc_enum pcap2_enum[] = {
++SOC_ENUM_SINGLE((PCAP2_OUTPUT_AMP|SH), 3, 4, pcap2_output_select),
++};
++
++static const struct snd_kcontrol_new pcap2_input_mixer_controls[] = {
++SOC_DAPM_SINGLE("A3 Switch", (PCAP2_INPUT_AMP|SL), 6, 1, 0),
++SOC_DAPM_SINGLE("A5 Switch", (PCAP2_INPUT_AMP|SL), 8, 1, 0),
++};
++
++static const struct snd_kcontrol_new pcap2_output_mixer_controls[] = {
++SOC_DAPM_SINGLE("A1 Switch", (PCAP2_OUTPUT_AMP|SL), 0, 1, 0),
++SOC_DAPM_SINGLE("A2 Switch", (PCAP2_OUTPUT_AMP|SL), 1, 1, 0),
++SOC_DAPM_SINGLE("AR Switch", (PCAP2_OUTPUT_AMP|SL), 5, 1, 0),
++SOC_DAPM_SINGLE("AL Switch", (PCAP2_OUTPUT_AMP|SL), 6, 1, 0),
++};
++
++/* pcap2 codec non DAPM controls */
++static const struct snd_kcontrol_new pcap2_codec_snd_controls[] = {
++SOC_SINGLE("Output gain", (PCAP2_OUTPUT_AMP|SM), 5, 15, 0),
++SOC_SINGLE("Input gain", (PCAP2_INPUT_AMP|SL), 0, 31, 0),
++};
++
++static const struct snd_kcontrol_new pcap2_codec_dm_mux_control[] = {
++ SOC_DAPM_ENUM("Output Mode", pcap2_enum[0]),
++};
++
++/* add non dapm controls */
++static int pcap2_codec_add_controls(struct snd_soc_codec *codec)
++{
++ int err, i;
++
++ for (i = 0; i < ARRAY_SIZE(pcap2_codec_snd_controls); i++) {
++ if ((err = snd_ctl_add(codec->card,
++ snd_soc_cnew(&pcap2_codec_snd_controls[i],codec, NULL))) < 0)
++ return err;
++ }
++
++ return 0;
++}
++
++/* pcap2 codec DAPM controls */
++static const struct snd_soc_dapm_widget pcap2_codec_dapm_widgets[] = {
++ SND_SOC_DAPM_DAC("ST_DAC", "ST_DAC playback", SND_SOC_NOPM, 0, 0),
++ SND_SOC_DAPM_DAC("CDC_DAC", "CDC_DAC playback", SND_SOC_NOPM, 0, 0),
++ SND_SOC_DAPM_ADC("CDC_ADC", "CDC_DAC capture", SND_SOC_NOPM, 0, 0),
++ SND_SOC_DAPM_PGA("PGA_ST", (PCAP2_OUTPUT_AMP|SL), 9, 0, NULL, 0),
++ SND_SOC_DAPM_PGA("PGA_CDC", (PCAP2_OUTPUT_AMP|SL), 8, 0, NULL, 0),
++ SND_SOC_DAPM_PGA("PGA_R", (PCAP2_OUTPUT_AMP|SL), 11, 0, NULL, 0),
++ SND_SOC_DAPM_PGA("PGA_L", (PCAP2_OUTPUT_AMP|SL), 12, 0, NULL, 0),
++ SND_SOC_DAPM_MUX("Downmixer", SND_SOC_NOPM, 0, 0, pcap2_codec_dm_mux_control),
++ SND_SOC_DAPM_PGA("PGA_A1CTRL", (PCAP2_OUTPUT_AMP|SH), 1, 1, NULL, 0),
++ SND_SOC_DAPM_MIXER("Output Mixer", SND_SOC_NOPM, 0, 0, &pcap2_output_mixer_controls[0], ARRAY_SIZE(pcap2_output_mixer_controls)),
++ SND_SOC_DAPM_OUTPUT("A1"), /* Earpiece */
++ SND_SOC_DAPM_OUTPUT("A2"), /* LoudSpeaker */
++ SND_SOC_DAPM_OUTPUT("AR"), /* headset right */
++ SND_SOC_DAPM_OUTPUT("AL"), /* headset left */
++
++ SND_SOC_DAPM_MICBIAS("BIAS1", (PCAP2_INPUT_AMP|SL), 10, 0),
++ SND_SOC_DAPM_MICBIAS("BIAS2", (PCAP2_INPUT_AMP|SL), 11, 0),
++ SND_SOC_DAPM_MIXER("Input Mixer", SND_SOC_NOPM, 0, 0, &pcap2_input_mixer_controls[0], ARRAY_SIZE(pcap2_input_mixer_controls)),
++ SND_SOC_DAPM_INPUT("A3"), /* Headset Mic */
++ SND_SOC_DAPM_INPUT("A5"), /* Builtin Mic */
++};
++
++static const char *audio_map[][3] = {
++ { "A1", NULL, "Output Mixer" },
++ { "A2", NULL, "Output Mixer" },
++ { "AR", NULL, "Output Mixer" },
++ { "AL", NULL, "Output Mixer" },
++
++ { "Output Mixer", "A1 Switch", "PGA_A1CTRL" },
++ { "Output Mixer", "A2 Switch", "Downmixer" },
++ { "Output Mixer", "AR Switch", "PGA_R" },
++ { "Output Mixer", "AL Switch", "PGA_L" },
++
++ { "PGA_A1CTRL", NULL, "Downmixer" },
++
++ { "Downmixer", "2->1ch", "PGA_L" },
++ { "Downmixer", "2->1ch", "PGA_R" },
++ { "Downmixer", "2->1ch -3db", "PGA_L" },
++ { "Downmixer", "2->1ch -3db", "PGA_R" },
++ { "Downmixer", "2->1ch -6db", "PGA_L" },
++ { "Downmixer", "2->1ch -6db", "PGA_R" },
++ { "Downmixer", "2ch", "PGA_R" },
++
++ { "PGA_R", NULL, "PGA_ST" },
++ { "PGA_L", NULL, "PGA_ST" },
++ { "PGA_R", NULL, "PGA_CDC" },
++
++ { "PGA_ST", NULL, "ST_DAC" },
++ { "PGA_CDC", NULL, "CDC_DAC" },
++
++ /* input path */
++ { "BIAS1", NULL, "A3" },
++ { "BIAS2", NULL, "A5" },
++
++ { "Input Mixer", "A3 Switch", "BIAS1" },
++ { "Input Mixer", "A5 Switch", "BIAS2" },
++
++ { "PGA_R", NULL, "Input Mixer" },
++
++ { "PGA_CDC", NULL, "PGA_R" },
++ { "CDC_ADC", NULL, "PGA_CDC" },
++
++ /* terminator */
++ {NULL, NULL, NULL},
++};
++
++static int pcap2_codec_add_widgets(struct snd_soc_codec *codec)
++{
++ int i;
++
++ for(i = 0; i < ARRAY_SIZE(pcap2_codec_dapm_widgets); i++) {
++ snd_soc_dapm_new_control(codec, &pcap2_codec_dapm_widgets[i]);
++ }
++
++ /* set up audio path interconnects */
++ for(i = 0; audio_map[i][0] != NULL; i++) {
++ snd_soc_dapm_connect_input(codec, audio_map[i][0],
++ audio_map[i][1], audio_map[i][2]);
++ }
++
++ snd_soc_dapm_new_widgets(codec);
++ return 0;
++}
++
++static int pcap2_codec_dapm_event(struct snd_soc_codec *codec, int event)
++{
++ unsigned int input = pcap2_codec_read(codec, PCAP2_INPUT_AMP);
++
++ input &= ~PCAP2_INPUT_AMP_LOWPWR;
++
++ switch (event) {
++ case SNDRV_CTL_POWER_D0:
++ case SNDRV_CTL_POWER_D1:
++ case SNDRV_CTL_POWER_D2:
++ case SNDRV_CTL_POWER_D3hot: /* Off, with power */
++ dbg("dapm: ON\n");
++ break;
++ case SNDRV_CTL_POWER_D3cold: /* Off, without power */
++ input |= PCAP2_INPUT_AMP_LOWPWR;
++ dbg("dapm: OFF\n");
++ break;
++ }
++ codec->dapm_state = event;
++ pcap2_codec_write(codec, PCAP2_INPUT_AMP, input);
++ return 0;
++}
++
++static int pcap2_hw_params(struct snd_pcm_substream *substream,
++ struct snd_pcm_hw_params *params)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++ struct snd_soc_codec *codec = codec_dai->codec;
++ unsigned int tmp;
++
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ tmp = pcap2_codec_read(codec, PCAP2_ST_DAC);
++
++ tmp &= ~PCAP2_ST_DAC_RATE_MASK;
++ switch(params_rate(params)) {
++ case 8000:
++ break;
++ case 11025:
++ tmp |= PCAP2_ST_DAC_RATE_11025;
++ break;
++ case 12000:
++ tmp |= PCAP2_ST_DAC_RATE_12000;
++ break;
++ case 16000:
++ tmp |= PCAP2_ST_DAC_RATE_16000;
++ break;
++ case 22050:
++ tmp |= PCAP2_ST_DAC_RATE_22050;
++ break;
++ case 24000:
++ tmp |= PCAP2_ST_DAC_RATE_24000;
++ break;
++ case 32000:
++ tmp |= PCAP2_ST_DAC_RATE_32000;
++ break;
++ case 44100:
++ tmp |= PCAP2_ST_DAC_RATE_44100;
++ break;
++ case 48000:
++ tmp |= PCAP2_ST_DAC_RATE_48000;
++ break;
++ default:
++ return -EINVAL;
++ }
++ tmp |= PCAP2_ST_DAC_RESET_DF;
++ pcap2_codec_write(codec, PCAP2_ST_DAC, tmp);
++ }
++ else {
++ tmp = pcap2_codec_read(codec, PCAP2_CODEC);
++
++ tmp &= ~PCAP2_CODEC_RATE_MASK;
++ switch(params_rate(params)) {
++ case 8000:
++ break;
++ case 16000:
++ tmp |= PCAP2_CODEC_RATE_16000;
++ break;
++ default:
++ return -EINVAL;
++ }
++ tmp |= PCAP2_CODEC_RESET_DF;
++ pcap2_codec_write(codec, PCAP2_CODEC, tmp);
++ }
++
++ return 0;
++}
++
++static int pcap2_hw_free(struct snd_pcm_substream *substream)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++ struct snd_soc_codec *codec = codec_dai->codec;
++ struct snd_soc_dapm_widget *w;
++ unsigned int tmp;
++
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ snd_soc_dapm_set_endpoint(codec, "ST_DAC", 0);
++ tmp = pcap2_codec_read(codec, PCAP2_ST_DAC);
++ tmp &= ~(PCAP2_ST_DAC_EN | PCAP2_ST_DAC_CLK_EN);
++ pcap2_codec_write(codec, PCAP2_ST_DAC, tmp);
++ }
++ else {
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ snd_soc_dapm_set_endpoint(codec, "CDC_DAC", 0);
++ else
++ snd_soc_dapm_set_endpoint(codec, "CDC_ADC", 0);
++ list_for_each_entry(w, &codec->dapm_widgets, list) {
++ if ((!strcmp(w->name, "CDC_DAC") || !strcmp(w->name, "CDC_ADC")) && w->connected)
++ goto in_use;
++ }
++ tmp = pcap2_codec_read(codec, PCAP2_CODEC);
++ tmp &= ~(PCAP2_CODEC_EN | PCAP2_CODEC_CLK_EN);
++ pcap2_codec_write(codec, PCAP2_CODEC, tmp);
++ }
++in_use:
++ snd_soc_dapm_sync_endpoints(codec);
++
++ return 0;
++}
++
++static int pcap2_set_dai_sysclk(struct snd_soc_codec_dai *codec_dai,
++ int clk_id, unsigned int freq, int dir)
++{
++ struct snd_soc_codec *codec = codec_dai->codec;
++
++ unsigned int tmp;
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ /* ST_DAC */
++
++ tmp = pcap2_codec_read(codec, PCAP2_ST_DAC);
++
++ tmp &= ~PCAP2_ST_DAC_CLKSEL_MASK;
++ switch (clk_id) {
++ case PCAP2_CLK_AP:
++ tmp |= PCAP2_ST_DAC_CLKSEL_AP;
++ break;
++ case PCAP2_CLK_BP:
++ break;
++ default:
++ return -ENODEV;
++ }
++
++ tmp &= ~PCAP2_ST_DAC_CLK_MASK;
++ switch (freq) {
++ case 13000000:
++ break;
++/* case 15M36:
++ tmp |= PCAP2_ST_DAC_CLK_15M36;
++ break;
++ case 16M8:
++ tmp |= PCAP2_ST_DAC_CLK_16M8;
++ break;
++ case 19M44:
++ tmp |= PCAP2_ST_DAC_CLK_19M44;
++ break;
++*/ case 26000000:
++ tmp |= PCAP2_ST_DAC_CLK_26M;
++ break;
++/* case EXT_MCLK:
++ tmp |= PCAP2_ST_DAC_CLK_MCLK;
++ break;
++ case FSYNC:
++ tmp |= PCAP2_ST_DAC_CLK_FSYNC;
++ break;
++ case BITCLK:
++ tmp |= PCAP2_ST_DAC_CLK_BITCLK;
++ break;
++*/ default:
++ return -EINVAL;
++ }
++ pcap2_codec_write(codec, PCAP2_ST_DAC, tmp);
++ }
++ else {
++ /* MONO_DAC */
++ tmp = pcap2_codec_read(codec, PCAP2_CODEC);
++
++ tmp &= ~PCAP2_CODEC_CLKSEL_MASK;
++ switch (clk_id) {
++ case PCAP2_CLK_AP:
++ tmp |= PCAP2_CODEC_CLKSEL_AP;
++ break;
++ case PCAP2_CLK_BP:
++ break;
++ default:
++ return -ENODEV;
++ }
++
++ tmp &= ~PCAP2_CODEC_CLK_MASK;
++ switch (freq) {
++ case 13000000:
++ break;
++/* case 15M36:
++ tmp |= PCAP2_CODEC_CLK_15M36;
++ break;
++ case 16M8:
++ tmp |= PCAP2_CODEC_CLK_16M8;
++ break;
++ case 19M44:
++ tmp |= PCAP2_CODEC_CLK_19M44;
++ break;
++*/ case 26000000:
++ tmp |= PCAP2_CODEC_CLK_26M;
++ break;
++ default:
++ return -EINVAL;
++ }
++ pcap2_codec_write(codec, PCAP2_CODEC, tmp);
++ }
++ return 0;
++}
++
++static int pcap2_set_dai_fmt(struct snd_soc_codec_dai *codec_dai,
++ unsigned int fmt)
++{
++ struct snd_soc_codec *codec = codec_dai->codec;
++ unsigned int tmp = 0;
++
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ /* ST_DAC */
++
++ /* disable CODEC */
++ pcap2_codec_write(codec, PCAP2_CODEC, 0);
++
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
++ case SND_SOC_DAIFMT_CBM_CFM:
++ break;
++ case SND_SOC_DAIFMT_CBS_CFS:
++ tmp |= 0x1;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
++ case SND_SOC_DAIFMT_I2S:
++ tmp |= 0x4000;
++ break;
++/* case SND_SOC_NET:
++ tmp |= 0x2000;
++ break;
++*/ case SND_SOC_DAIFMT_DSP_B:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
++ case SND_SOC_DAIFMT_IB_IF:
++ break;
++ case SND_SOC_DAIFMT_NB_NF:
++ tmp |= 0x60000;
++ break;
++ case SND_SOC_DAIFMT_IB_NF:
++ tmp |= 0x40000;
++ break;
++ case SND_SOC_DAIFMT_NB_IF:
++ tmp |= 0x20000;
++ break;
++ }
++ /* set dai to AP */
++ tmp |= 0x1000;
++
++ /* set BCLK */
++ tmp |= 0x18000;
++
++ pcap2_codec_write(codec, PCAP2_ST_DAC, tmp);
++ }
++ else {
++ /* MONO_DAC */
++
++ /* disable ST_DAC */
++ pcap2_codec_write(codec, PCAP2_ST_DAC, 0);
++
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
++ case SND_SOC_DAIFMT_CBM_CFM:
++ break;
++ case SND_SOC_DAIFMT_CBS_CFS:
++ tmp |= 0x2;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
++ case SND_SOC_DAIFMT_DSP_B:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
++ case SND_SOC_DAIFMT_IB_IF:
++ break;
++ case SND_SOC_DAIFMT_NB_NF:
++ tmp |= 0x600;
++ break;
++ case SND_SOC_DAIFMT_IB_NF:
++ tmp |= 0x400;
++ break;
++ case SND_SOC_DAIFMT_NB_IF:
++ tmp |= 0x200;
++ break;
++ }
++ if (codec_dai->id == PCAP2_MONO_DAI)
++ /* set dai to AP */
++ tmp |= 0x8000;
++
++ tmp |= 0x5; /* IHF / OHF */
++
++ pcap2_codec_write(codec, PCAP2_CODEC, tmp);
++ }
++ return 0;
++}
++
++static int pcap2_prepare(struct snd_pcm_substream *substream)
++{
++
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++ struct snd_soc_codec *codec = codec_dai->codec;
++ unsigned int tmp;
++ /* FIXME enable clock only if codec is master */
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ snd_soc_dapm_set_endpoint(codec, "ST_DAC", 1);
++ snd_soc_dapm_set_endpoint(codec, "CDC_DAC", 0);
++ snd_soc_dapm_set_endpoint(codec, "CDC_ADC", 0);
++ tmp = pcap2_codec_read(codec, PCAP2_ST_DAC);
++ tmp |= (PCAP2_ST_DAC_EN | PCAP2_ST_DAC_CLK_EN);
++ pcap2_codec_write(codec, PCAP2_ST_DAC, tmp);
++ }
++ else {
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ snd_soc_dapm_set_endpoint(codec, "CDC_DAC", 1);
++ else
++ snd_soc_dapm_set_endpoint(codec, "CDC_ADC", 1);
++ snd_soc_dapm_set_endpoint(codec, "ST_DAC", 0);
++ tmp = pcap2_codec_read(codec, PCAP2_CODEC);
++ tmp |= (PCAP2_CODEC_EN | PCAP2_CODEC_CLK_EN);
++ pcap2_codec_write(codec, PCAP2_CODEC, tmp);
++ }
++ snd_soc_dapm_sync_endpoints(codec);
++ mdelay(1);
++#ifdef PCAP2_DEBUG
++ dump_registers();
++#endif
++ return 0;
++}
++
++/*
++ * Define codec DAI.
++ */
++struct snd_soc_codec_dai pcap2_dai[] = {
++{
++ .name = "PCAP2 MONO",
++ .id = 0,
++ .playback = {
++ .stream_name = "CDC_DAC playback",
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000),
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .capture = {
++ .stream_name = "CDC_DAC capture",
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000),
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .ops = {
++ .prepare = pcap2_prepare,
++ .hw_params = pcap2_hw_params,
++ .hw_free = pcap2_hw_free,
++ },
++ .dai_ops = {
++// .digital_mute = pcap2_mute,
++ .set_fmt = pcap2_set_dai_fmt,
++ .set_sysclk = pcap2_set_dai_sysclk,
++ },
++},
++{
++ .name = "PCAP2 STEREO",
++ .id = 1,
++ .playback = {
++ .stream_name = "ST_DAC playback",
++ .channels_min = 1,
++ .channels_max = 2,
++ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |
++ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |
++ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
++ SNDRV_PCM_RATE_48000),
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .capture = { /* FIXME: PCAP support this?? */
++ .stream_name = "ST_DAC capture",
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |
++ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |
++ SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
++ SNDRV_PCM_RATE_48000),
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .ops = {
++ .prepare = pcap2_prepare,
++ .hw_params = pcap2_hw_params,
++ .hw_free = pcap2_hw_free,
++ },
++ .dai_ops = {
++// .digital_mute = pcap2_mute,
++ .set_fmt = pcap2_set_dai_fmt,
++ .set_sysclk = pcap2_set_dai_sysclk,
++ },
++},
++{
++ .name = "PCAP2 BP",
++ .id = 2,
++ .playback = {
++ .stream_name = "BP playback",
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = SNDRV_PCM_RATE_8000,
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .ops = {
++ .prepare = pcap2_prepare,
++ .hw_params = pcap2_hw_params,
++ .hw_free = pcap2_hw_free,
++ },
++ .dai_ops = {
++// .digital_mute = pcap2_mute,
++ .set_fmt = pcap2_set_dai_fmt,
++ .set_sysclk = pcap2_set_dai_sysclk,
++ },
++},
++};
++EXPORT_SYMBOL_GPL(pcap2_dai);
++
++static int pcap2_codec_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
++ struct snd_soc_codec *codec = socdev->codec;
++
++ dbg("pcap2_codec_suspend");
++ pcap2_codec_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
++ return 0;
++}
++
++static int pcap2_codec_resume(struct platform_device *pdev)
++{
++ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
++ struct snd_soc_codec *codec = socdev->codec;
++
++ dbg("pcap2_codec_resume");
++ pcap2_codec_dapm_event(codec, SNDRV_CTL_POWER_D3hot);
++ pcap2_codec_dapm_event(codec, codec->suspend_dapm_state);
++ return 0;
++}
++
++/*
++ * initialise the PCAP2 driver
++ * register the mixer and dsp interfaces with the kernel
++ */
++static int pcap2_codec_init(struct snd_soc_device *socdev)
++{
++ struct snd_soc_codec *codec = socdev->codec;
++ int ret = 0;
++
++ dbg("pcap2_codec_init");
++ codec->name = "PCAP2 Audio";
++ codec->owner = THIS_MODULE;
++ codec->read = pcap2_codec_read;
++ codec->write = pcap2_codec_write;
++ codec->dapm_event = pcap2_codec_dapm_event;
++ codec->dai = pcap2_dai;
++ codec->num_dai = ARRAY_SIZE(pcap2_dai);
++
++ /* register pcms */
++ ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
++ if (ret < 0) {
++ return ret;
++ }
++ /* power on device */
++ pcap2_codec_dapm_event(codec, SNDRV_CTL_POWER_D3hot);
++ /* set the update bits */
++
++ pcap2_codec_add_controls(codec);
++ pcap2_codec_add_widgets(codec);
++ ret = snd_soc_register_card(socdev);
++ if (ret < 0) {
++ snd_soc_free_pcms(socdev);
++ snd_soc_dapm_free(socdev);
++ }
++
++ return ret;
++}
++
++static int pcap2_codec_probe(struct platform_device *pdev)
++{
++ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
++ struct pcap2_codec_setup_data *setup;
++ struct snd_soc_codec *codec;
++ int ret = 0;
++ info("PCAP2 Audio Codec %s", PCAP2_VERSION);
++
++ setup = socdev->codec_data;
++ codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
++ if (codec == NULL)
++ return -ENOMEM;
++
++ socdev->codec = codec;
++ mutex_init(&codec->mutex);
++ INIT_LIST_HEAD(&codec->dapm_widgets);
++ INIT_LIST_HEAD(&codec->dapm_paths);
++
++ pcap2_codec_socdev = socdev;
++
++ ret = pcap2_codec_init(socdev);
++ return ret;
++}
++
++/* power down chip and remove */
++static int pcap2_codec_remove(struct platform_device *pdev)
++{
++ struct snd_soc_device *socdev = platform_get_drvdata(pdev);
++ struct snd_soc_codec *codec = socdev->codec;
++ if (codec->control_data)
++ pcap2_codec_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
++ snd_soc_free_pcms(socdev);
++ snd_soc_dapm_free(socdev);
++
++ kfree(codec);
++
++ return 0;
++}
++
++/* codec device ops */
++struct snd_soc_codec_device soc_codec_dev_pcap2 = {
++ .probe = pcap2_codec_probe,
++ .remove = pcap2_codec_remove,
++ .suspend = pcap2_codec_suspend,
++ .resume = pcap2_codec_resume,
++};
++
++EXPORT_SYMBOL_GPL(soc_codec_dev_pcap2);
++
++MODULE_DESCRIPTION("ASoC PCAP2 codec");
++MODULE_AUTHOR("Daniel Ribeiro");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/sound/soc/codecs/pcap2.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/sound/soc/codecs/pcap2.h 2007-10-22 22:28:06.000000000 +0200
+@@ -0,0 +1,81 @@
++/*
++ * 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.
++ */
++
++#ifndef _PCAP2_H
++#define _PCAP2_H
++
++/* 16 bit reads/writes on pcap registers (ugly workaround) */
++#define SL (1 << 5) /* lower 16 bits */
++#define SM (1 << 6) /* mid 16 bits */
++#define SH (1 << 7) /* higher 16 bits */
++
++/* PCAP2 register space */
++#define PCAP2_CODEC 0x0b
++#define PCAP2_OUTPUT_AMP 0x0c
++#define PCAP2_ST_DAC 0x0d
++#define PCAP2_INPUT_AMP 0x1a
++
++#define PCAP2_MONO_DAI 0
++#define PCAP2_STEREO_DAI 1
++#define PCAP2_BP_DAI 2
++
++#define PCAP2_CLK_BP 0
++#define PCAP2_CLK_AP 1
++
++#define PCAP2_CODEC_EN 0x2000
++#define PCAP2_CODEC_CLK_EN 0x1000
++#define PCAP2_CODEC_RESET_DF 0x800
++#define PCAP2_CODEC_RATE_MASK 0x4000
++#define PCAP2_CODEC_RATE_8000 0x0
++#define PCAP2_CODEC_RATE_16000 0x4000
++#define PCAP2_CODEC_CLKSEL_MASK 0x10000
++#define PCAP2_CODEC_CLKSEL_AP 0x10000
++#define PCAP2_CODEC_CLKSEL_BP 0x0
++#define PCAP2_CODEC_CLK_MASK 0x1c0
++#define PCAP2_CODEC_CLK_13M 0x0
++#define PCAP2_CODEC_CLK_15M36 0x40
++#define PCAP2_CODEC_CLK_16M8 0x80
++#define PCAP2_CODEC_CLK_19M44 0xc0
++#define PCAP2_CODEC_CLK_26M 0x100
++
++#define PCAP2_ST_DAC_EN 0x80
++#define PCAP2_ST_DAC_CLK_EN 0x20
++#define PCAP2_ST_DAC_RESET_DF 0x40
++#define PCAP2_ST_DAC_RATE_MASK 0xf00
++#define PCAP2_ST_DAC_RATE_8000 0x0
++#define PCAP2_ST_DAC_RATE_11025 0x100
++#define PCAP2_ST_DAC_RATE_12000 0x200
++#define PCAP2_ST_DAC_RATE_16000 0x300
++#define PCAP2_ST_DAC_RATE_22050 0x400
++#define PCAP2_ST_DAC_RATE_24000 0x500
++#define PCAP2_ST_DAC_RATE_32000 0x600
++#define PCAP2_ST_DAC_RATE_44100 0x700
++#define PCAP2_ST_DAC_RATE_48000 0x800
++#define PCAP2_ST_DAC_CLKSEL_MASK 0x80000
++#define PCAP2_ST_DAC_CLKSEL_AP 0x80000
++#define PCAP2_ST_DAC_CLKSEL_BP 0x0
++#define PCAP2_ST_DAC_CLK_MASK 0x1c
++#define PCAP2_ST_DAC_CLK_13M 0x0
++#define PCAP2_ST_DAC_CLK_15M36 0x4
++#define PCAP2_ST_DAC_CLK_16M8 0x8
++#define PCAP2_ST_DAC_CLK_19M44 0xc
++#define PCAP2_ST_DAC_CLK_26M 0x10
++#define PCAP2_ST_DAC_CLK_MCLK 0x14
++#define PCAP2_ST_DAC_CLK_FSYNC 0x18
++#define PCAP2_ST_DAC_CLK_BITCLK 0x1c
++
++#define PCAP2_INPUT_AMP_LOWPWR 0x80000
++#define PCAP2_INPUT_AMP_V2EN2 0x200000
++
++#define PCAP2_OUTPUT_AMP_PGAR_EN 0x800
++#define PCAP2_OUTPUT_AMP_PGAL_EN 0x1000
++#define PCAP2_OUTPUT_AMP_CDC_SW 0x100
++#define PCAP2_OUTPUT_AMP_ST_DAC_SW 0x200
++
++extern struct snd_soc_codec_dai pcap2_dai[];
++extern struct snd_soc_codec_device soc_codec_dev_pcap2;
++
++#endif
+Index: linux-2.6.23/sound/soc/pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/sound/soc/pxa/Kconfig 2007-10-22 22:27:11.000000000 +0200
++++ linux-2.6.23/sound/soc/pxa/Kconfig 2007-10-22 22:29:23.000000000 +0200
+@@ -57,3 +57,12 @@
+ help
+ Say Y if you want to add support for SoC audio on Sharp
+ Zaurus SL-C6000x models (Tosa).
++
++config SND_PXA2XX_SOC_EZX
++ tristate "SoC Audio support for EZX"
++ depends on SND_PXA2XX_SOC && PXA_EZX
++ select SND_PXA2XX_SOC_SSP
++ select SND_SOC_PCAP2
++ help
++ Say Y if you want to add support for SoC audio on
++ Motorola EZX Phones (a780/e680).
+Index: linux-2.6.23/sound/soc/pxa/ezx.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/sound/soc/pxa/ezx.c 2007-10-22 22:28:06.000000000 +0200
+@@ -0,0 +1,349 @@
++/*
++ * ezx.c - Machine specific code for EZX phones
++ *
++ * Copyright (C) 2007 Daniel Ribeiro <drwyrm@gmail.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.
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/timer.h>
++#include <linux/interrupt.h>
++#include <linux/platform_device.h>
++#include <sound/driver.h>
++#include <sound/core.h>
++#include <sound/pcm.h>
++#include <sound/soc.h>
++#include <sound/soc-dapm.h>
++
++#include <asm/mach-types.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/hardware.h>
++
++#include <asm/arch/ezx-pcap.h>
++
++#include "../codecs/pcap2.h"
++#include "pxa2xx-pcm.h"
++#include "pxa2xx-ssp.h"
++
++#define GPIO_HW_ATTENUATE_A780 96
++
++static struct snd_soc_codec *control_codec;
++
++static void ezx_ext_control(struct snd_soc_codec *codec)
++{
++ if (ezx_pcap_read_bit(pbit(PCAP_REG_PSTAT, PCAP_IRQ_A1)))
++ snd_soc_dapm_set_endpoint(codec, "Headset", 1);
++ else
++ snd_soc_dapm_set_endpoint(codec, "Headset", 0);
++ if (ezx_pcap_read_bit(pbit(PCAP_REG_PSTAT, PCAP_IRQ_MB2)))
++ snd_soc_dapm_set_endpoint(codec, "External Mic", 1);
++ else
++ snd_soc_dapm_set_endpoint(codec, "External Mic", 0);
++
++ snd_soc_dapm_sync_endpoints(codec);
++}
++
++static irqreturn_t jack_irq(int irq, void *data)
++{
++ ezx_ext_control(control_codec);
++ return IRQ_HANDLED;
++}
++
++
++/*
++ * Alsa operations
++ * Only implement the required operations for your platform.
++ * These operations are specific to the machine only.
++ */
++
++ /*
++ * Called by ALSA when a PCM substream is opened, private data can be allocated.
++ */
++static int ezx_machine_startup(struct snd_pcm_substream *substream)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec *codec = rtd->socdev->codec;
++
++ /* check the jack status at stream startup */
++ ezx_ext_control(codec);
++ return 0;
++}
++
++/*
++ * Called by ALSA when the hardware params are set by application. This
++ * function can also be called multiple times and can allocate buffers
++ * (using snd_pcm_lib_* ). It's non-atomic.
++ */
++static int ezx_machine_hw_params(struct snd_pcm_substream *substream,
++ struct snd_pcm_hw_params *params)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++ int ret;
++
++ /* set codec DAI configuration */
++ if (codec_dai->id == PCAP2_STEREO_DAI)
++ ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
++ SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBM_CFM);
++ else
++ ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
++ SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
++ if(ret < 0)
++ return ret;
++
++ /* Turn on clock output on CLK_PIO */
++ OSCC |= 0x8;
++
++ /* set clock source */
++ ret = codec_dai->dai_ops.set_sysclk(codec_dai, PCAP2_CLK_AP,
++ 13000000, SND_SOC_CLOCK_IN);
++ if(ret < 0)
++ return ret;
++
++ /* set cpu DAI configuration */
++ ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B |
++ SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
++ if (ret < 0)
++ return ret;
++
++ ret = cpu_dai->dai_ops.set_tristate(cpu_dai, 0);
++ if (ret < 0)
++ return ret;
++
++ ret = cpu_dai->dai_ops.set_sysclk(cpu_dai,PXA2XX_SSP_CLK_EXT,
++ 0, SND_SOC_CLOCK_IN);
++ if (ret < 0)
++ return ret;
++
++ return 0;
++}
++
++/*
++ * Free's resources allocated by hw_params, can be called multiple times
++ */
++static int ezx_machine_hw_free(struct snd_pcm_substream *substream)
++{
++ OSCC &= ~0x8; /* turn off clock output on CLK_PIO */
++
++ return 0;
++}
++
++static int ezx_machine_prepare(struct snd_pcm_substream *substream)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++
++ if (codec_dai->id == PCAP2_STEREO_DAI) {
++ /* override pxa2xx-ssp sample size for stereo/network mode */
++ SSCR0_P(cpu_dai->id+1) &= ~(SSCR0_DSS | SSCR0_EDSS);
++ SSCR0_P(cpu_dai->id+1) |= (SSCR0_EDSS | SSCR0_DataSize(16));
++ }
++ return 0;
++}
++
++/* machine Alsa PCM operations */
++static struct snd_soc_ops ezx_ops = {
++ .startup = ezx_machine_startup,
++ .prepare = ezx_machine_prepare,
++ .hw_free = ezx_machine_hw_free,
++ .hw_params = ezx_machine_hw_params,
++};
++
++static int bp_hw_params(struct snd_pcm_substream *substream,
++ struct snd_pcm_hw_params *params)
++{
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
++// struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
++ int ret = 0;
++ /* set codec DAI configuration */
++ ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
++ SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
++ if(ret < 0)
++ return ret;
++
++ /* set clock source */
++ ret = codec_dai->dai_ops.set_sysclk(codec_dai, PCAP2_CLK_BP,
++ 13000000, SND_SOC_CLOCK_IN);
++
++ return ret;
++}
++
++
++
++/* machine dapm widgets */
++static const struct snd_soc_dapm_widget ezx_dapm_widgets[] = {
++ SND_SOC_DAPM_HP("Headset", NULL),
++ SND_SOC_DAPM_SPK("Earpiece", NULL),
++ SND_SOC_DAPM_SPK("Loudspeaker", NULL),
++ SND_SOC_DAPM_MIC("Built-in Mic", NULL),
++ SND_SOC_DAPM_MIC("External Mic", NULL),
++};
++
++/* machine audio map (connections to the codec pins) */
++static const char *audio_map[][3] = {
++ { "Headset", NULL, "AR" },
++ { "Headset", NULL, "AL" },
++ { "Earpiece", NULL, "A1" },
++ { "Loudspeaker", NULL, "A2" },
++
++ { "Built-in Mic", NULL, "A5" },
++ { "External Mic", NULL, "A3" },
++
++ {NULL, NULL, NULL},
++};
++
++/*
++ * Initialise the machine audio subsystem.
++ */
++static int ezx_machine_init(struct snd_soc_codec *codec)
++{
++ int i;
++ /* mark unused codec pins as NC */
++// snd_soc_dapm_set_endpoint(codec, "FIXME", 0);
++ control_codec = codec;
++
++ /* Add ezx specific controls */
++// for (i = 0; i < ARRAY_SIZE(ezx_controls); i++) {
++// if ((err = snd_ctl_add(codec->card, snd_soc_cnew(&ezx_controls[i], codec, NULL))) < 0)
++// return err;
++// }
++
++ /* Add ezx specific widgets */
++ for(i = 0; i < ARRAY_SIZE(ezx_dapm_widgets); i++) {
++ snd_soc_dapm_new_control(codec, &ezx_dapm_widgets[i]);
++ }
++ /* Set up ezx specific audio path interconnects */
++ for(i = 0; audio_map[i][0] != NULL; i++) {
++ snd_soc_dapm_connect_input(codec, audio_map[i][0], audio_map[i][1], audio_map[i][2]);
++ }
++
++ /* synchronise subsystem */
++ snd_soc_dapm_sync_endpoints(codec);
++ return 0;
++}
++
++static struct snd_soc_cpu_dai bp_dai =
++{
++ .name = "Baseband",
++ .id = 0,
++ .type = SND_SOC_DAI_PCM,
++ .playback = {
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = SNDRV_PCM_RATE_8000,
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .capture = {
++ .channels_min = 1,
++ .channels_max = 1,
++ .rates = SNDRV_PCM_RATE_8000,
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ },
++ .ops = {
++// .startup = bp_startup,
++// .shutdown = bp_shutdown,
++ .hw_params = bp_hw_params,
++// .hw_free = bp_hw_free,
++ },
++};
++
++/* template digital audio interface glue - connects codec <--> CPU */
++static struct snd_soc_dai_link ezx_dai[] = {
++{
++ .name = "PCAP2 STEREO",
++ .stream_name = "stereo playback",
++ .cpu_dai = &pxa_ssp_dai[PXA2XX_DAI_SSP3],
++ .codec_dai = &pcap2_dai[PCAP2_STEREO_DAI],
++ .init = ezx_machine_init,
++ .ops = &ezx_ops,
++},
++{
++ .name = "PCAP2 MONO",
++ .stream_name = "mono playback",
++ .cpu_dai = &pxa_ssp_dai[PXA2XX_DAI_SSP3],
++ .codec_dai = &pcap2_dai[PCAP2_MONO_DAI],
++// .init = ezx_machine_init, /* the stereo call already registered our controls */
++ .ops = &ezx_ops,
++},
++{
++ .name = "PCAP2 BP",
++ .stream_name = "BP Audio",
++ .cpu_dai = &bp_dai,
++ .codec_dai = &pcap2_dai[PCAP2_BP_DAI],
++},
++};
++
++/* template audio machine driver */
++static struct snd_soc_machine snd_soc_machine_ezx = {
++ .name = "Motorola EZX",
++// .probe
++// .remove
++// .suspend_pre
++// .resume_post
++ .dai_link = ezx_dai,
++ .num_links = ARRAY_SIZE(ezx_dai),
++};
++
++/* template audio subsystem */
++static struct snd_soc_device ezx_snd_devdata = {
++ .machine = &snd_soc_machine_ezx,
++ .platform = &pxa2xx_soc_platform,
++ .codec_dev = &soc_codec_dev_pcap2,
++};
++
++static struct platform_device *ezx_snd_device;
++
++static int __init ezx_init(void)
++{
++ int ret;
++ ezx_snd_device = platform_device_alloc("soc-audio", -1);
++ if (!ezx_snd_device)
++ return -ENOMEM;
++
++ platform_set_drvdata(ezx_snd_device, &ezx_snd_devdata);
++ ezx_snd_devdata.dev = &ezx_snd_device->dev;
++ ret = platform_device_add(ezx_snd_device);
++
++ if (ret)
++ platform_device_put(ezx_snd_device);
++ /* configure gpio for ssp3 */
++ pxa_gpio_mode(GPIO83_SFRM3_MD); /* SFRM */
++ pxa_gpio_mode(GPIO81_STXD3_MD); /* TXD */
++ pxa_gpio_mode(GPIO52_SCLK3_MD); /* SCLK */
++ pxa_gpio_mode(GPIO89_SRXD3_MD); /* RXD */
++
++ /* configure gpio for ssp2 */
++ pxa_gpio_mode(37 | GPIO_IN); /* SFRM */
++ pxa_gpio_mode(38 | GPIO_IN); /* TXD */
++ pxa_gpio_mode(22 | GPIO_IN); /* SCLK */
++ pxa_gpio_mode(88 | GPIO_IN); /* RXD */
++
++ pxa_gpio_mode(GPIO_HW_ATTENUATE_A780 | GPIO_OUT);
++ pxa_gpio_set_value(GPIO_HW_ATTENUATE_A780, 1);
++
++ /* request jack irq */
++ request_irq(EZX_IRQ_HEADJACK, &jack_irq, IRQF_DISABLED, "headphone jack", NULL);
++ request_irq(EZX_IRQ_MIC, &jack_irq, IRQF_DISABLED, "mic jack", NULL);
++
++ return ret;
++}
++
++static void __exit ezx_exit(void)
++{
++ free_irq(EZX_IRQ_HEADJACK, NULL);
++ free_irq(EZX_IRQ_MIC, NULL);
++ platform_device_unregister(ezx_snd_device);
++}
++
++module_init(ezx_init);
++module_exit(ezx_exit);
++
+Index: linux-2.6.23/sound/soc/codecs/Makefile
+===================================================================
+--- linux-2.6.23.orig/sound/soc/codecs/Makefile 2007-10-10 09:38:42.000000000 +0200
++++ linux-2.6.23/sound/soc/codecs/Makefile 2007-10-22 22:30:09.000000000 +0200
+@@ -3,9 +3,11 @@
+ snd-soc-wm8750-objs := wm8750.o
+ snd-soc-wm8753-objs := wm8753.o
+ snd-soc-wm9712-objs := wm9712.o
++snd-soc-pcap2-objs := pcap2.o
+
+ obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
+ obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o
+ obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o
+ obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
+ obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
++obj-$(CONFIG_SND_SOC_PCAP2) += snd-soc-pcap2.o
+Index: linux-2.6.23/sound/soc/codecs/Kconfig
+===================================================================
+--- linux-2.6.23.orig/sound/soc/codecs/Kconfig 2007-10-10 09:38:42.000000000 +0200
++++ linux-2.6.23/sound/soc/codecs/Kconfig 2007-10-22 22:28:06.000000000 +0200
+@@ -17,3 +17,7 @@
+ config SND_SOC_WM9712
+ tristate
+ depends on SND_SOC
++
++config SND_SOC_PCAP2
++ tristate
++ depends on SND_SOC && EZX_PCAP
+Index: linux-2.6.23/sound/soc/pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/sound/soc/pxa/Makefile 2007-10-22 22:27:11.000000000 +0200
++++ linux-2.6.23/sound/soc/pxa/Makefile 2007-10-22 22:28:06.000000000 +0200
+@@ -14,9 +14,10 @@
+ snd-soc-poodle-objs := poodle.o
+ snd-soc-tosa-objs := tosa.o
+ snd-soc-spitz-objs := spitz.o
++snd-soc-ezx-objs := ezx.o
+
+ obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o
+ obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o
+ obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o
+ obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o
+-
++obj-$(CONFIG_SND_PXA2XX_SOC_EZX) += snd-soc-ezx.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-backlight.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-backlight.patch
new file mode 100644
index 0000000000..b6bd9ff4f0
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-backlight.patch
@@ -0,0 +1,203 @@
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+Index: linux-2.6.23/drivers/video/backlight/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/video/backlight/Kconfig 2007-10-10 09:38:43.000000000 +0200
++++ linux-2.6.23/drivers/video/backlight/Kconfig 2007-10-22 22:25:23.000000000 +0200
+@@ -77,3 +77,12 @@
+ help
+ If you have a Intel LE80578 (Carillo Ranch) say Y to enable the
+ backlight driver.
++
++config BACKLIGHT_EZX
++ tristate "Motorola EXZ Backlight Driver (A780/E680/E680i)"
++ depends on BACKLIGHT_CLASS_DEVICE && PXA_EZX
++ default y
++ help
++ If you have a Motorola A780 or E680(i), say y to enable the
++ backlight driver.
++
+Index: linux-2.6.23/drivers/video/backlight/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/video/backlight/Makefile 2007-10-10 09:38:43.000000000 +0200
++++ linux-2.6.23/drivers/video/backlight/Makefile 2007-10-22 22:25:50.000000000 +0200
+@@ -7,3 +7,4 @@
+ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
+ obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
+ obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
++obj-$(CONFIG_BACKLIGHT_EZX) += ezx_bl.o
+Index: linux-2.6.23/drivers/video/backlight/ezx_bl.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/video/backlight/ezx_bl.c 2007-10-22 22:25:23.000000000 +0200
+@@ -0,0 +1,142 @@
++/*
++ * Backlight Driver for Motorola A780 and E680(i) GSM Phones.
++ *
++ * Copyright 2006 Vanille Media
++ *
++ * Author: Michael Lauer <mickey@Vanille.de>
++ *
++ * 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/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++#include <linux/backlight.h>
++
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx.h>
++
++#define EZX_MIN_INTENSITY 0
++#define EZX_MAX_INTENSITY 50
++#define EZX_DEFAULT_INTENSITY 30
++
++static struct backlight_device *ezx_backlight_device;
++static int last_intensity;
++static int suspended;
++
++static int ezxbl_send_intensity(struct backlight_device *bd)
++{
++ int intensity = bd->props.brightness;
++
++ if (suspended || bd->props.power != FB_BLANK_UNBLANK ||
++ bd->props.fb_blank != FB_BLANK_UNBLANK)
++ intensity = 0;
++
++ if ( !last_intensity && intensity ) {
++ PWM_CTRL0 = 2; /* pre-scaler */
++ PWM_PWDUTY0 = intensity; /* duty cycle */
++ PWM_PERVAL0 = 49; /* period */
++ pxa_gpio_mode(GPIO16_PWM0_MD); /* set GPIO16 as alternate function + output */
++ pxa_set_cken(CKEN_PWM0, 1); /* clock enable */
++ }
++ else if ( last_intensity && !intensity ) {
++ PWM_PWDUTY0 = 0;
++ GAFR0_U &= 0xFFFFFFFC; /* ??? */
++ pxa_set_cken(CKEN_PWM0, 0); /* clock disable */
++ pxa_gpio_mode(GPIO16_PWM0); /* set GPIO16 as input */
++ } else if ( last_intensity && intensity ) {
++ PWM_PWDUTY0 = intensity; /* duty cycle */
++ }
++ last_intensity = intensity;
++ return 0;
++}
++
++static int ezxbl_get_intensity(struct backlight_device *bd)
++{
++ return last_intensity;
++}
++
++static int ezxbl_set_intensity(struct backlight_device *bd)
++{
++ return ezxbl_send_intensity(ezx_backlight_device);
++}
++
++#ifdef CONFIG_PM
++static int ezxbl_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ suspended = 1;
++ ezxbl_set_intensity(ezx_backlight_device);
++ return 0;
++}
++
++static int ezxbl_resume(struct platform_device *pdev)
++{
++ suspended = 0;
++ ezxbl_set_intensity(ezx_backlight_device);
++ return 0;
++}
++#else
++#define ezxbl_suspend NULL
++#define ezxbl_resume NULL
++#endif
++
++static struct backlight_ops ezxbl_ops = {
++ .get_brightness = ezxbl_get_intensity,
++ .update_status = ezxbl_set_intensity,
++};
++
++static int __init ezxbl_probe(struct platform_device *pdev)
++{
++ ezx_backlight_device = backlight_device_register ("ezx-bl",
++ &pdev->dev, NULL, &ezxbl_ops);
++ if (IS_ERR (ezx_backlight_device))
++ return PTR_ERR (ezx_backlight_device);
++
++ platform_set_drvdata(pdev, ezx_backlight_device);
++
++ ezx_backlight_device->props.power = FB_BLANK_UNBLANK;
++ ezx_backlight_device->props.max_brightness = EZX_MAX_INTENSITY;
++ ezx_backlight_device->props.brightness = EZX_DEFAULT_INTENSITY;
++ ezxbl_set_intensity(ezx_backlight_device);
++ backlight_update_status(ezx_backlight_device);
++
++ return 0;
++}
++
++static int ezxbl_remove(struct platform_device *pdev)
++{
++ backlight_device_unregister(ezx_backlight_device);
++ return 0;
++}
++
++static struct platform_driver ezxbl_driver = {
++ .probe = ezxbl_probe,
++ .remove = ezxbl_remove,
++ .suspend = ezxbl_suspend,
++ .resume = ezxbl_resume,
++ .driver = {
++ .name = "ezx-bl",
++ },
++};
++
++static int __init ezxbl_init(void)
++{
++ return platform_driver_register(&ezxbl_driver);
++}
++
++static void __exit ezxbl_exit(void)
++{
++ platform_driver_unregister(&ezxbl_driver);
++}
++
++module_init(ezxbl_init);
++module_exit(ezxbl_exit);
++
++MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
++MODULE_DESCRIPTION("Backlight Driver for Motorola A780|E680(i)");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx.c 2007-10-22 22:03:08.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx.c 2007-10-22 22:25:23.000000000 +0200
+@@ -65,6 +65,12 @@
+ #endif
+ EXPORT_SYMBOL(ezx_backlight_power);
+
++/* EZX LCD Backlight */
++static struct platform_device ezxbacklight_device = {
++ .name = "ezx-bl",
++ .id = -1,
++};
++
+ /* OHCI Controller */
+ static int ezx_ohci_init(struct device *dev)
+ {
+@@ -121,6 +127,7 @@
+
+ static struct platform_device *devices[] __initdata = {
+ &ezxbp_device,
++ &ezxbacklight_device,
+ };
+
+ /* PM */
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-bp.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-bp.patch
new file mode 100644
index 0000000000..a20adc464c
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-bp.patch
@@ -0,0 +1,340 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx.c 2007-10-23 12:03:55.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx.c 2007-10-23 13:21:24.000000000 +0200
+@@ -86,8 +86,40 @@
+ .init = ezx_ohci_init,
+ };
+
++/* BP */
++static struct resource ezxbp_resources[] = {
++ [0] = {
++ .start = IRQ_GPIO(GPIO_BP_RDY),
++ .end = IRQ_GPIO(GPIO_BP_RDY),
++ .flags = IORESOURCE_IRQ,
++ },
++ [1] = {
++ .start = IRQ_GPIO(GPIO_BB_WDI2),
++ .end = IRQ_GPIO(GPIO_BB_WDI2),
++ .flags = IORESOURCE_IRQ,
++ },
++ [2] = {
++ .start = IRQ_GPIO(GPIO_BB_WDI),
++ .end = IRQ_GPIO(GPIO_BB_WDI),
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++static struct platform_device ezxbp_device = {
++ .name = "ezx-bp",
++ .dev = {
++ //.parent =
++ //.platform_data =
++ },
++ .id = -1,
++ .num_resources = ARRAY_SIZE(ezxbp_resources),
++ .resource = ezxbp_resources,
++};
++
++
+
+ static struct platform_device *devices[] __initdata = {
++ &ezxbp_device,
+ };
+
+ static int __init ezx_init(void)
+Index: linux-2.6.23/arch/arm/mach-pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Kconfig 2007-10-23 12:03:55.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Kconfig 2007-10-23 13:21:23.000000000 +0200
+@@ -106,6 +106,9 @@
+
+ endchoice
+
++config EZX_BP
++ bool "BP Control code for EZX Platform"
++
+ endif
+
+ endmenu
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-bp.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-bp.c 2007-10-23 13:22:01.000000000 +0200
+@@ -0,0 +1,264 @@
++/*
++ * BP handshake code for Motorola EZX phones
++ *
++ * Copyright (c) 2007 Daniel Ribeiro <drwyrm@gmail.com>
++ *
++ * Based on Motorola's a780.c Copyright (c) 2003-2005 Motorola
++ *
++ * 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/interrupt.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++
++#include <asm/mach/irq.h>
++#include <asm/arch/hardware.h>
++#include <asm/arch/pxa-regs.h>
++
++#include <asm/arch/ezx.h>
++
++/* BP Handshake */
++#define FIRST_STEP 2
++#define LAST_STEP 3
++#define BP_RDY_TIMEOUT 0x000c0000
++
++#if 1
++#define DEBUGP(x, args ...) printk(x, ##args)
++#else
++#define DEBUGP(x, args ...)
++#endif
++
++extern void usb_send_readurb(void);
++
++struct bp {
++ int irq_wdi;
++ int irq_wdi2;
++ int irq_rdy;
++};
++
++/* check power down condition */
++static inline void check_power_off(void)
++{
++ if (pxa_gpio_get_value(GPIO_BB_WDI2) == 0) {
++ DEBUGP("BP request poweroff!\n");
++ /*
++ * It is correct to power off here, the following line is
++ * commented out because e680 lowers WDI2 when BP is in
++ * flash mode, otherwise WDI2 is used to detect low
++ * battery. You can safely uncomment this line if you are
++ * using this kernel with BP in normal mode.
++ */
++#ifndef CONFIG_PXA_EZX_E680
++ pm_power_off();
++#endif
++ }
++}
++
++static int step = FIRST_STEP;
++
++inline int bp_handshake_passed(void)
++{
++ return (step > LAST_STEP);
++}
++EXPORT_SYMBOL(bp_handshake_passed);
++
++void handshake(void)
++{
++ /* step 1: check MCU_INT_SW or BP_RDY is low (now it is checked in apboot) */
++ DEBUGP("bp handshake entered!\n");
++ if (step == 1) {
++ int timeout = BP_RDY_TIMEOUT;
++
++ /* config MCU_INT_SW, BP_RDY as input */
++ pxa_gpio_mode(GPIO_MCU_INT_SW | GPIO_IN);
++ pxa_gpio_mode(GPIO_BP_RDY | GPIO_IN);
++
++ while (timeout--) {
++ if (pxa_gpio_get_value(GPIO_MCU_INT_SW) == 0
++ || pxa_gpio_get_value(GPIO_BP_RDY) == 0) {
++ step ++;
++ break;
++ }
++
++ check_power_off();
++ }
++ DEBUGP("ezx-bp: handshake step 1\n");
++ }
++
++ /* step 2: wait BP_RDY is low */
++ if (step == 2) {
++ if (pxa_gpio_get_value(GPIO_BP_RDY) == 0) {
++ /* config MCU_INT_SW as output */
++ pxa_gpio_mode(GPIO_MCU_INT_SW | GPIO_OUT);
++ pxa_gpio_set_value(GPIO_MCU_INT_SW, 0);
++
++ step ++;
++ DEBUGP("ezx-bp: handshake step 2\n");
++ }
++ }
++
++ /* step 3: wait BP_RDY is high */
++ else if (step == 3) {
++ if (pxa_gpio_get_value(GPIO_BP_RDY)) {
++ step ++;
++ //FIXME delay_bklight();
++ pxa_gpio_set_value(GPIO_MCU_INT_SW, 1);
++ printk(KERN_NOTICE "ezx-bp: handshake passed\n");
++ }
++ }
++}
++
++irqreturn_t bp_wdi_handler(int irq, void *dev_id)
++{
++ DEBUGP("BP Lowered WDI line. This is not good :(\n");
++ /*
++ * this means that BP is not responsive.
++ * we could try to reset BP and then handshake again
++ * but i doubt its possible to bring it up again.
++ */
++ return IRQ_HANDLED;
++}
++
++static irqreturn_t bp_rdy_handler(int irq, void *dev_id)
++{
++ struct bp *bp = dev_id;
++ DEBUGP("BP rdy irq\n");
++ if (!bp_handshake_passed()) {
++ handshake();
++ if (bp_handshake_passed()) {
++ /* FIXME: (test) try to not disable irq_wdi2 and drain battery */
++ disable_irq(bp->irq_wdi2);
++
++ /* set bp_rdy handle for usb ipc */
++ set_irq_type(bp->irq_rdy, IRQT_FALLING);
++ }
++ }
++#ifdef CONFIG_TS0710_MUX_USB
++ else usb_send_readurb();
++#endif
++ return IRQ_HANDLED;
++}
++
++/* BP request for poweroff */
++static irqreturn_t bp_wdi2_handler(int irq, void *dev_id)
++{
++ DEBUGP("BP request poweroff!\n");
++ /* same case as check_power_off() */
++#ifndef CONFIG_PXA_EZX_E680
++ pm_power_off();
++#endif
++ return IRQ_HANDLED;
++}
++
++static int __init ezxbp_probe(struct platform_device *dev)
++{
++ int ret;
++ struct bp *bp;
++
++ bp = kzalloc(sizeof(*bp), GFP_KERNEL);
++ if (!bp)
++ return -ENOMEM;
++
++ bp->irq_rdy = platform_get_irq(dev, 0);
++ if(bp->irq_rdy < 0) {
++ ret = bp->irq_rdy;
++ goto fail;
++ }
++
++ bp->irq_wdi2 = platform_get_irq(dev, 1);
++ if(bp->irq_wdi2 < 0) {
++ ret = bp->irq_wdi2;
++ goto fail;
++ }
++
++ bp->irq_wdi = platform_get_irq(dev, 2);
++ if(bp->irq_wdi < 0) {
++ ret = bp->irq_wdi;
++ goto fail;
++ }
++
++ set_irq_type(bp->irq_wdi, IRQT_FALLING);
++ request_irq(bp->irq_wdi, bp_wdi_handler, IRQF_DISABLED,
++ "bp wdi", bp);
++
++ set_irq_type(bp->irq_rdy, IRQT_BOTHEDGE);
++ request_irq(bp->irq_rdy, bp_rdy_handler, IRQF_DISABLED,
++ "bp rdy", bp);
++
++ set_irq_type(bp->irq_wdi2, IRQT_FALLING);
++ request_irq(bp->irq_wdi2, bp_wdi2_handler, IRQF_DISABLED,
++ "bp wdi2", bp);
++
++ /* turn on BP */
++ pxa_gpio_mode(GPIO_BB_RESET|GPIO_OUT);
++ pxa_gpio_set_value(GPIO_BB_RESET, 1);
++
++ check_power_off();
++ handshake();
++
++ return 0;
++fail:
++ kfree(bp);
++ return ret;
++}
++
++static int ezxbp_remove(struct platform_device *dev)
++{
++ struct bp *bp = platform_get_drvdata(dev);
++
++ free_irq(bp->irq_wdi, bp);
++ free_irq(bp->irq_wdi2, bp);
++ free_irq(bp->irq_rdy, bp);
++ kfree(bp);
++
++ return 0;
++}
++
++static int ezxbp_suspend(struct platform_device *dev, pm_message_t state)
++{
++ DEBUGP("bp suspend!\n");
++// pxa_gpio_set_value(GPIO_MCU_INT_SW, 0);
++ return 0;
++}
++
++static int ezxbp_resume(struct platform_device *dev)
++{
++ DEBUGP("bp resume!\n");
++// pxa_gpio_set_value(GPIO_MCU_INT_SW, 1);
++ return 0;
++}
++static struct platform_driver ezxbp_driver = {
++ .probe = ezxbp_probe,
++ .remove = ezxbp_remove,
++#warning FIXME: missing suspend/resume support
++ .suspend = ezxbp_suspend,
++ .resume = ezxbp_resume,
++ .driver = {
++ .name = "ezx-bp",
++ .owner = THIS_MODULE,
++ },
++};
++
++int __init ezxbp_init(void)
++{
++ return platform_driver_register(&ezxbp_driver);
++}
++
++void ezxbp_fini(void)
++{
++ return platform_driver_unregister(&ezxbp_driver);
++}
++
++module_init(ezxbp_init);
++module_exit(ezxbp_fini);
++
++MODULE_DESCRIPTION("Motorola BP Control driver");
++MODULE_AUTHOR("Daniel Ribeiro <drwyrm@gmail.com>");
++MODULE_LICENSE("GPL");
++
+Index: linux-2.6.23/arch/arm/mach-pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Makefile 2007-10-23 12:03:55.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Makefile 2007-10-23 13:21:23.000000000 +0200
+@@ -25,6 +25,7 @@
+ obj-$(CONFIG_PXA_EZX_E2) += ezx-e2.o
+ obj-$(CONFIG_PXA_EZX_A1200) += ezx-a1200.o
+ obj-$(CONFIG_PXA_EZX_E6) += ezx-e6.o
++obj-$(CONFIG_EZX_BP) += ezx-bp.o
+
+ # Support for blinky lights
+ led-y := leds.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-core.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-core.patch
new file mode 100644
index 0000000000..af31bc5620
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-core.patch
@@ -0,0 +1,1016 @@
+Index: linux-2.6.23/arch/arm/boot/compressed/head-xscale.S
+===================================================================
+--- linux-2.6.23.orig/arch/arm/boot/compressed/head-xscale.S 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/boot/compressed/head-xscale.S 2007-10-24 13:03:04.000000000 +0200
+@@ -48,3 +48,6 @@
+ str r1, [r0, #0x18]
+ #endif
+
++#ifdef CONFIG_ARCH_EZX
++ mov r7, #MACH_TYPE_EZX
++#endif
+Index: linux-2.6.23/arch/arm/mach-pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Kconfig 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Kconfig 2007-10-24 18:56:36.000000000 +0200
+@@ -41,6 +41,10 @@
+ bool "CompuLab EM-x270 platform"
+ select PXA27x
+
++config PXA_EZX
++ bool "Motorola EZX Platform"
++ select PXA_SSP
++
+ endchoice
+
+ if PXA_SHARPSL
+@@ -75,6 +79,35 @@
+
+ endif
+
++if PXA_EZX
++
++choice
++ prompt "Select target EZX device"
++
++config PXA_EZX_E680
++ bool "Motorola E680 GSM Phone"
++ select PXA27x
++
++config PXA_EZX_A780
++ bool "Motorola A780 GSM Phone"
++ select PXA27x
++
++config PXA_EZX_E2
++ bool "Motorola E2 GSM Phone"
++ select PXA27x
++
++config PXA_EZX_A1200
++ bool "Motorola A1200 GSM Phone"
++ select PXA27x
++
++config PXA_EZX_E6
++ bool "Motorola E6 GSM Phone"
++ select PXA27x
++
++endchoice
++
++endif
++
+ endmenu
+
+ config MACH_POODLE
+@@ -148,4 +181,5 @@
+ tristate
+ help
+ Enable support for PXA2xx SSP ports
++
+ endif
+Index: linux-2.6.23/arch/arm/mach-pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Makefile 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Makefile 2007-10-24 18:56:36.000000000 +0200
+@@ -19,6 +19,12 @@
+ obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o
+ obj-$(CONFIG_MACH_TOSA) += tosa.o
+ obj-$(CONFIG_MACH_EM_X270) += em-x270.o
++obj-$(CONFIG_PXA_EZX) += ezx.o
++obj-$(CONFIG_PXA_EZX_A780) += ezx-a780.o
++obj-$(CONFIG_PXA_EZX_E680) += ezx-e680.o
++obj-$(CONFIG_PXA_EZX_E2) += ezx-e2.o
++obj-$(CONFIG_PXA_EZX_A1200) += ezx-a1200.o
++obj-$(CONFIG_PXA_EZX_E6) += ezx-e6.o
+
+ # Support for blinky lights
+ led-y := leds.o
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx.c 2007-10-24 18:56:36.000000000 +0200
+@@ -0,0 +1,118 @@
++/*
++ * ezx.c - Common code for EZX platform.
++ *
++ * Copyright (c) 2005-2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++#include <linux/delay.h>
++
++#include <asm/arch/pxafb.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ohci.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++/* EZX PXA Framebuffer */
++void ezx_lcd_power(int on, struct fb_var_screeninfo *var)
++{
++ if (on) {
++ mdelay(1);
++ GPSR3 = 0x00100000;
++ mdelay(10);
++ GPCR3 = 0x00100000;
++ GPDR3 |= 0x00100000;
++ } else {
++ GPSR3 = 0x00100000;
++ PGSR3 |= 0x00100000;
++ mdelay(41);
++ LCCR0 &= ~LCCR0_LDM; /* disable lcd disable done interrupt */
++ LCCR0 |= LCCR0_DIS; /* normal disable lcd */
++ mdelay(18);
++ }
++}
++EXPORT_SYMBOL(ezx_lcd_power);
++
++/* failsafe if we are not using the backlight platform driver */
++#ifndef CONFIG_BACKLIGHT_EZX
++void ezx_backlight_power(int on)
++{
++ if (on) {
++ pxa_gpio_mode(GPIO16_PWM0_MD);
++ pxa_set_cken(CKEN_PWM0, 1);
++ PWM_CTRL0 = 0;
++ PWM_PWDUTY0 = 0x3ff;
++ PWM_PERVAL0 = 0x3ff;
++ } else {
++ PWM_CTRL0 = 0;
++ PWM_PWDUTY0 = 0x0;
++ PWM_PERVAL0 = 0x3FF;
++ pxa_set_cken(CKEN_PWM0, 0);
++ }
++}
++#else
++void ezx_backlight_power(int on){}
++#endif
++EXPORT_SYMBOL(ezx_backlight_power);
++
++/* OHCI Controller */
++static int ezx_ohci_init(struct device *dev)
++{
++ /* for A780 support (connected with Neptune) */
++ pxa_gpio_mode(GPIO30_USB_P3_2); /* GPIO30 - USB_P3_2/ICL_TXENB */
++ pxa_gpio_mode(GPIO31_USB_P3_6); /* GPIO31 - USB_P3_6/ICL_VPOUT */
++ pxa_gpio_mode(GPIO90_USB_P3_5); /* GPIO90 - USB_P3_5/ICL_VPIN */
++ pxa_gpio_mode(GPIO91_USB_P3_1); /* GPIO91 - USB_P3_1/ICL_XRXD */
++ pxa_gpio_mode(GPIO56_USB_P3_4); /* GPIO56 - USB_P3_4/ICL_VMOUT */
++ pxa_gpio_mode(GPIO113_USB_P3_3);/* GPIO113 - USB_P3_3/ICL_VMIN */
++ UP3OCR = 0x00000002;
++
++ UHCHR = UHCHR & ~(UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
++
++ return 0;
++}
++
++static struct pxaohci_platform_data ezx_ohci_platform_data = {
++ .port_mode = PMM_NPS_MODE,
++ .init = ezx_ohci_init,
++};
++
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static int __init ezx_init(void)
++{
++ CKEN = (1 << CKEN_OSTIMER) | (1 << CKEN_MEMC);
++
++ pxa_gpio_mode(GPIO_ICL_FFRXD_MD);
++ pxa_gpio_mode(GPIO_ICL_FFTXD_MD);
++ pxa_gpio_mode(GPIO_ICL_FFCTS_MD);
++ pxa_gpio_mode(GPIO_ICL_FFRTS_MD);
++
++ pxa_gpio_mode(GPIO42_BTRXD_MD);
++ pxa_gpio_mode(GPIO43_BTTXD_MD);
++ pxa_gpio_mode(GPIO44_BTCTS_MD);
++ pxa_gpio_mode(GPIO45_BTRTS_MD);
++
++ /* Standard UART */
++ pxa_gpio_mode(GPIO46_STRXD_MD);
++ pxa_gpio_mode(GPIO47_STTXD_MD);
++
++ pxa_set_ohci_info(&ezx_ohci_platform_data);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++
++ return 0;
++}
++
++subsys_initcall(ezx_init);
+Index: linux-2.6.23/include/asm-arm/arch-pxa/ezx.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/include/asm-arm/arch-pxa/ezx.h 2007-10-24 13:03:05.000000000 +0200
+@@ -0,0 +1,225 @@
++/*
++ * linux/include/asm-arm/arch-pxa/ezx.h
++ *
++ * Specific macro defines for Motorola Ezx Development Platform
++ *
++ * Author: Zhuang Xiaofan
++ * Created: Nov 25, 2003
++ * Copyright: Motorola Inc.
++ *
++ * 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.
++ */
++
++/* support E680 p3 and ealier PCB */
++//#define E680_P3_AND_EARLY
++
++#define GPIO_is_high(x) (GPLR(x) & GPIO_bit(x))
++#define set_GPIO(x) (GPSR(x) = GPIO_bit(x))
++#define clr_GPIO(x) (GPCR(x) = GPIO_bit(x))
++
++/*
++ * Flags in memory for sleep use
++ */
++#define FLAG_ADDR PHYS_OFFSET
++#define RESUME_ADDR (PHYS_OFFSET + 4)
++#define BPSIG_ADDR (PHYS_OFFSET + 8)
++
++#define USER_OFF_FLAG 0x5a5a5a5a
++#define SLEEP_FLAG 0x6b6b6b6b
++#define OFF_FLAG 0x7c7c7c7c
++#define REFLASH_FLAG 0x0C1D2E3F
++#define PASS_THRU_FLAG 0x12345678
++
++#define WDI_FLAG 0xbb00dead
++#define NO_FLAG 0xaa00dead
++
++/*
++ * GPIO control pin, have to change when hardware lock down
++ */
++
++#ifdef E680_P3_AND_EARLY
++
++/* shakehand with BP's PIN */
++#define GPIO_BP_RDY 0 /* BP_RDY */
++#define GPIO_BB_WDI 13 /* BB_WDI */
++#define GPIO_BB_WDI2 3 /* BB_WDI2 */
++#define GPIO_BB_RESET 57 /* BB_RESET */
++#define GPIO_MCU_INT_SW 115 /* MCU_INT_SW */
++#define GPIO_TC_MM_EN 89 /* TC_MM_EN */
++
++/* control PCAP direct PIN */
++#define GPIO_WDI_AP 4 /* WDI_AP */
++#define GPIO_SYS_RESTART 55 /* restart PCAP power */
++#define GPIO_AP_STANDBY 28 /* make pcap enter standby mode */
++
++/* communicate with PCAP's PIN */
++#define GPIO_PCAP_SEC_INT 1 /* PCAP interrupt PIN to AP */
++#define GPIO_SPI_CLK 23 /* PCAP SPI port clock */
++#define GPIO_SPI_CE 24 /* PCAP SPI port SSPFRM */
++#define GPIO_SPI_MOSI 25 /* PCAP SPI port SSPTXD */
++#define GPIO_SPI_MISO 26 /* PCAP SPI port SSPRXD */
++
++/* blue tooth control PIN */
++#define GPIO_BT_WAKEUP 2 /* AP wake up bluetooth module */
++#define GPIO_BT_HOSTWAKE 14 /* bluetooth module wake up Ap module */
++#define GPIO_BT_RESET 56 /* AP reset bluetooth module */
++
++/* control LCD high - OFF low -- ON */
++#define GPIO_LCD_OFF 116 /* control LCD */
++
++/* FFUART PIN */
++#define GPIO_ICL_FFRXD_MD (34 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFCTS_MD (35 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFTXD_MD (39 | GPIO_ALT_FN_2_OUT)
++#define GPIO_ICL_FFRTS_MD (41 | GPIO_ALT_FN_2_OUT)
++
++#elif defined(A780_P1_AND_EARLY)
++
++/* shakehand with BP's PIN */
++#define GPIO_BP_RDY 0 /* BP_RDY */
++#define GPIO_BB_WDI 13 /* BB_WDI */
++#define GPIO_BB_WDI2 3 /* BB_WDI2 */
++#define GPIO_BB_RESET 82 /* BB_RESET */
++#define GPIO_MCU_INT_SW 57 /* MCU_INT_SW */
++#define GPIO_TC_MM_EN 89 /* TC_MM_EN */
++
++/* control PCAP direct PIN */
++#define GPIO_WDI_AP 4 /* WDI_AP */
++#define GPIO_SYS_RESTART 55 /* restart PCAP power */
++#define GPIO_AP_STANDBY 28 /* make pcap enter standby mode */
++
++/* communicate with PCAP's PIN */
++#define GPIO_PCAP_SEC_INT 1 /* PCAP interrupt PIN to AP */
++#define GPIO_SPI_CLK 29 /* PCAP SPI port clock */
++#define GPIO_SPI_CE 24 /* PCAP SPI port SSPFRM */
++#define GPIO_SPI_MOSI 25 /* PCAP SPI port SSPTXD */
++#define GPIO_SPI_MISO 26 /* PCAP SPI port SSPRXD */
++
++/* blue tooth control PIN */
++#define GPIO_BT_WAKEUP 2 /* AP wake up bluetooth module */
++#define GPIO_BT_HOSTWAKE 14 /* bluetooth module wake up Ap module */
++#define GPIO_BT_RESET 56 /* AP reset bluetooth module */
++
++/* control LCD high - OFF low -- ON */
++#define GPIO_LCD_OFF 116 /* control LCD */
++
++/* FFUART PIN */
++#define GPIO_ICL_FFRXD_MD (53 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFCTS_MD (35 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFTXD_MD (39 | GPIO_ALT_FN_2_OUT)
++#define GPIO_ICL_FFRTS_MD (41 | GPIO_ALT_FN_2_OUT)
++
++#else
++
++/* shakehand with BP's PIN */
++#define GPIO_BP_RDY 0 /* BP_RDY */
++#define GPIO_BB_WDI 13 /* BB_WDI */
++#define GPIO_BB_WDI2 3 /* BB_WDI2 */
++#define GPIO_BB_RESET 82 /* BB_RESET */
++#define GPIO_MCU_INT_SW 57 /* MCU_INT_SW */
++#define GPIO_TC_MM_EN 99 /* TC_MM_EN */
++
++/* control PCAP direct PIN */
++#define GPIO_WDI_AP 4 /* WDI_AP */
++#define GPIO_SYS_RESTART 55 /* restart PCAP power */
++//#define GPIO_AP_STANDBY 28 /* make pcap enter standby mode */
++
++/* communicate with PCAP's PIN */
++#define GPIO_PCAP_SEC_INT 1 /* PCAP interrupt PIN to AP */
++#define GPIO_SPI_CLK 29 /* PCAP SPI port clock */
++#define GPIO_SPI_CE 24 /* PCAP SPI port SSPFRM */
++#define GPIO_SPI_MOSI 25 /* PCAP SPI port SSPTXD */
++#define GPIO_SPI_MISO 26 /* PCAP SPI port SSPRXD */
++
++/* blue tooth control PIN */
++#define GPIO_BT_WAKEUP 28 /* AP wake up bluetooth module */
++#define GPIO_BT_HOSTWAKE 14 /* AP wake up bluetooth module */
++#define GPIO_BT_RESET 48 /* AP reset bluetooth module */
++
++/* control LCD high - OFF low -- ON */
++#define GPIO_LCD_OFF 116 /* control LCD */
++
++/* FFUART PIN */
++#define GPIO_ICL_FFRXD_MD (53 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFCTS_MD (35 | GPIO_ALT_FN_1_IN)
++#define GPIO_ICL_FFTXD_MD (39 | GPIO_ALT_FN_2_OUT)
++#define GPIO_ICL_FFRTS_MD (41 | GPIO_ALT_FN_2_OUT)
++
++#endif
++/*
++ * ezx platform, wake up source edge detect bit
++ */
++#define PEDR_INT_SEC 1
++
++#define GPIO_FLIP_PIN 12
++/*E680 screen lock button*/
++
++#define GPIO_LOCK_SCREEN_PIN GPIO_FLIP_PIN
++
++/* MMC interface */
++#define GPIO_MMC_DETECT 11
++#define GPIO_MMC_CLK 32
++#define GPIO_MMC_DATA0 92
++#define GPIO_MMC_WP 107
++#define GPIO_MMC_DATA1 109
++#define GPIO_MMC_DATA2 110
++#define GPIO_MMC_DATA3 111
++#define GPIO_MMC_CMD 112
++
++/* interface function */
++#define GPIO_MMC_CLK_MD (GPIO_MMC_CLK | GPIO_ALT_FN_2_OUT)
++#define GPIO_MMC_DATA0_MD (GPIO_MMC_DATA0 | GPIO_ALT_FN_1_IN | GPIO_ALT_FN_1_OUT)
++#define GPIO_MMC_DATA1_MD (GPIO_MMC_DATA1 | GPIO_ALT_FN_1_IN | GPIO_ALT_FN_1_OUT)
++#define GPIO_MMC_DATA2_MD (GPIO_MMC_DATA2 | GPIO_ALT_FN_1_IN | GPIO_ALT_FN_1_OUT)
++#define GPIO_MMC_DATA3_MD (GPIO_MMC_DATA3 | GPIO_ALT_FN_1_IN | GPIO_ALT_FN_1_OUT)
++
++#define GPIO_MMC_CMD_MD (GPIO_MMC_CMD | GPIO_ALT_FN_1_IN | GPIO_ALT_FN_1_OUT)
++
++/* EMU GPIO 119 ---MUX2 120 --- MUX1 */
++#define GPIO_EMU_MUX1 120
++#define GPIO_EMU_MUX2 119
++#define GPIO_SNP_INT_CTL 86
++#define GPIO_SNP_INT_IN 87
++
++
++/* audio related pins */
++#define AP_13MHZ_OUTPUT_PIN 9
++
++#ifdef CONFIG_ARCH_EZX_E680
++#define GPIO_VA_SEL_BUL 79
++#define GPIO_FLT_SEL_BUL 80 /* out filter select pin */
++#define GPIO_MIDI_RESET 78 /* GPIO used by MIDI chipset */
++#define GPIO_MIDI_CS 33
++#define GPIO_MIDI_IRQ 15
++#define GPIO_MIDI_NPWE 49
++#define GPIO_MIDI_RDY 18
++#endif
++
++#ifdef CONFIG_ARCH_EZX_A780
++#define GPIO_HW_ATTENUATE_A780 96 /* hw noise attenuation be used or bypassed, for receiver or louderspeaker mode */
++#endif
++
++
++/* bp status pin */
++#define GPIO_BP_STATE 41
++
++/* define usb related pin */
++#define GPIO34_TXENB 34
++#define GPIO35_XRXD 35
++#define GPIO36_VMOUT 36
++#define GPIO39_VPOUT 39
++#define GPIO40_VPIN 40
++#define GPIO53_VMIN 53
++
++/* USB client 6 pin defination */
++#define GPIO34_TXENB_MD (GPIO34_TXENB | GPIO_ALT_FN_1_OUT)
++#define GPIO35_XRXD_MD (GPIO35_XRXD | GPIO_ALT_FN_2_IN )
++#define GPIO36_VMOUT_MD (GPIO36_VMOUT | GPIO_ALT_FN_1_OUT)
++#define GPIO39_VPOUT_MD (GPIO39_VPOUT | GPIO_ALT_FN_1_OUT)
++#define GPIO40_VPIN_MD (GPIO40_VPIN | GPIO_ALT_FN_3_IN )
++#define GPIO53_VMIN_MD (GPIO53_VMIN | GPIO_ALT_FN_2_IN )
++
++#define GPIO53_FFRXD_MD (53 | GPIO_ALT_FN_1_IN)
++
+Index: linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-24 13:03:04.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-24 18:56:34.000000000 +0200
+@@ -856,6 +856,8 @@
+ #define UP2OCR_HXOE (1 << 17) /* Host Port 2 Transceiver Output Enable */
+ #define UP2OCR_SEOS (1 << 24) /* Single-Ended Output Select */
+
++#define UP3OCR __REG(0x40600024) /* USB Port 3 Output Control register */
++
+ #define UDCCSN(x) __REG2(0x40600100, (x) << 2)
+ #define UDCCSR0 __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */
+ #define UDCCSR0_SA (1 << 7) /* Setup Active */
+@@ -1259,6 +1261,7 @@
+ #define GPIO33_nCS_5 33 /* chip select 5 */
+ #define GPIO34_FFRXD 34 /* FFUART receive */
+ #define GPIO34_MMCCS0 34 /* MMC Chip Select 0 */
++#define GPIO34_USB_P2_2 34 /* USB Port2 Pin 2 */
+ #define GPIO35_FFCTS 35 /* FFUART Clear to send */
+ #define GPIO36_FFDCD 36 /* FFUART Data carrier detect */
+ #define GPIO37_FFDSR 37 /* FFUART data set ready */
+@@ -1372,6 +1375,7 @@
+ #define GPIO18_RDY_MD (18 | GPIO_ALT_FN_1_IN)
+ #define GPIO19_DREQ1_MD (19 | GPIO_ALT_FN_1_IN)
+ #define GPIO20_DREQ0_MD (20 | GPIO_ALT_FN_1_IN)
++#define GPIO22_SCLK2_MD (22 | GPIO_ALT_FN_3_IN)
+ #define GPIO23_SCLK_MD (23 | GPIO_ALT_FN_2_OUT)
+ #define GPIO24_SFRM_MD (24 | GPIO_ALT_FN_2_OUT)
+ #define GPIO25_STXD_MD (25 | GPIO_ALT_FN_2_OUT)
+@@ -1382,23 +1386,33 @@
+ #define GPIO28_BITCLK_OUT_I2S_MD (28 | GPIO_ALT_FN_1_OUT)
+ #define GPIO29_SDATA_IN_AC97_MD (29 | GPIO_ALT_FN_1_IN)
+ #define GPIO29_SDATA_IN_I2S_MD (29 | GPIO_ALT_FN_2_IN)
++#define GPIO29_SCLK_MD (29 | GPIO_ALT_FN_3_IN)
+ #define GPIO30_SDATA_OUT_AC97_MD (30 | GPIO_ALT_FN_2_OUT)
+ #define GPIO30_SDATA_OUT_I2S_MD (30 | GPIO_ALT_FN_1_OUT)
++#define GPIO30_USB_P3_2 (30 | GPIO_ALT_FN_3_OUT)
+ #define GPIO31_SYNC_I2S_MD (31 | GPIO_ALT_FN_1_OUT)
+ #define GPIO31_SYNC_AC97_MD (31 | GPIO_ALT_FN_2_OUT)
++#define GPIO31_USB_P3_6 (31 | GPIO_ALT_FN_3_OUT)
+ #define GPIO32_SDATA_IN1_AC97_MD (32 | GPIO_ALT_FN_1_IN)
+ #define GPIO32_SYSCLK_I2S_MD (32 | GPIO_ALT_FN_1_OUT)
+ #define GPIO32_MMCCLK_MD ( 32 | GPIO_ALT_FN_2_OUT)
+ #define GPIO33_nCS_5_MD (33 | GPIO_ALT_FN_2_OUT)
+ #define GPIO34_FFRXD_MD (34 | GPIO_ALT_FN_1_IN)
+ #define GPIO34_MMCCS0_MD (34 | GPIO_ALT_FN_2_OUT)
++#define GPIO34_USB_P2_2_MD (34 | GPIO_ALT_FN_1_OUT)
+ #define GPIO35_FFCTS_MD (35 | GPIO_ALT_FN_1_IN)
++#define GPIO35_USB_P2_1_MD (35 | GPIO_ALT_FN_2_IN)
+ #define GPIO36_FFDCD_MD (36 | GPIO_ALT_FN_1_IN)
++#define GPIO36_USB_P2_4_MD (36 | GPIO_ALT_FN_1_OUT)
+ #define GPIO37_FFDSR_MD (37 | GPIO_ALT_FN_1_IN)
++#define GPIO37_SFRM2_MD (37 | GPIO_ALT_FN_2_IN)
+ #define GPIO38_FFRI_MD (38 | GPIO_ALT_FN_1_IN)
++#define GPIO38_STXD2_MD (38 | GPIO_ALT_FN_2_OUT)
+ #define GPIO39_MMCCS1_MD (39 | GPIO_ALT_FN_1_OUT)
+ #define GPIO39_FFTXD_MD (39 | GPIO_ALT_FN_2_OUT)
++#define GPIO39_USB_P2_6_MD (39 | GPIO_ALT_FN_1_OUT)
+ #define GPIO40_FFDTR_MD (40 | GPIO_ALT_FN_2_OUT)
++#define GPIO40_USB_P2_5_MD (40 | GPIO_ALT_FN_3_IN)
+ #define GPIO41_FFRTS_MD (41 | GPIO_ALT_FN_2_OUT)
+ #define GPIO42_BTRXD_MD (42 | GPIO_ALT_FN_1_IN)
+ #define GPIO42_HWRXD_MD (42 | GPIO_ALT_FN_3_IN)
+@@ -1423,13 +1437,17 @@
+ #define GPIO51_HWRTS_MD (51 | GPIO_ALT_FN_1_OUT)
+ #define GPIO51_nPIOW_MD (51 | GPIO_ALT_FN_2_OUT)
+ #define GPIO52_nPCE_1_MD (52 | GPIO_ALT_FN_2_OUT)
++#define GPIO52_SCLK3_MD (52 | GPIO_ALT_FN_2_OUT)
+ #define GPIO53_nPCE_2_MD (53 | GPIO_ALT_FN_2_OUT)
+ #define GPIO53_MMCCLK_MD (53 | GPIO_ALT_FN_1_OUT)
++#define GPIO53_FFRXD_MD (53 | GPIO_ALT_FN_1_IN)
++#define GPIO53_USB_P2_3_MD (53 | GPIO_ALT_FN_2_IN)
+ #define GPIO54_MMCCLK_MD (54 | GPIO_ALT_FN_1_OUT)
+ #define GPIO54_nPCE_2_MD (54 | GPIO_ALT_FN_2_OUT)
+ #define GPIO54_pSKTSEL_MD (54 | GPIO_ALT_FN_2_OUT)
+ #define GPIO55_nPREG_MD (55 | GPIO_ALT_FN_2_OUT)
+ #define GPIO56_nPWAIT_MD (56 | GPIO_ALT_FN_1_IN)
++#define GPIO56_USB_P3_4 (56 | GPIO_ALT_FN_1_OUT)
+ #define GPIO57_nIOIS16_MD (57 | GPIO_ALT_FN_1_IN)
+ #define GPIO58_LDD_0_MD (58 | GPIO_ALT_FN_2_OUT)
+ #define GPIO59_LDD_1_MD (59 | GPIO_ALT_FN_2_OUT)
+@@ -1465,13 +1483,19 @@
+ #define GPIO80_nCS_4_MD (80 | GPIO_ALT_FN_2_OUT)
+ #define GPIO81_NSSP_CLK_OUT (81 | GPIO_ALT_FN_1_OUT)
+ #define GPIO81_NSSP_CLK_IN (81 | GPIO_ALT_FN_1_IN)
++#define GPIO81_STXD3_MD (81 | GPIO_ALT_FN_1_OUT)
+ #define GPIO82_NSSP_FRM_OUT (82 | GPIO_ALT_FN_1_OUT)
+ #define GPIO82_NSSP_FRM_IN (82 | GPIO_ALT_FN_1_IN)
+ #define GPIO83_NSSP_TX (83 | GPIO_ALT_FN_1_OUT)
+ #define GPIO83_NSSP_RX (83 | GPIO_ALT_FN_2_IN)
++#define GPIO83_SFRM3_MD (83 | GPIO_ALT_FN_1_IN)
+ #define GPIO84_NSSP_TX (84 | GPIO_ALT_FN_1_OUT)
+ #define GPIO84_NSSP_RX (84 | GPIO_ALT_FN_2_IN)
+ #define GPIO85_nPCE_1_MD (85 | GPIO_ALT_FN_1_OUT)
++#define GPIO88_SRXD2_MD (88 | GPIO_ALT_FN_2_IN)
++#define GPIO89_SRXD3_MD (89 | GPIO_ALT_FN_1_IN)
++#define GPIO90_USB_P3_5 (90 | GPIO_ALT_FN_2_IN)
++#define GPIO91_USB_P3_1 (91 | GPIO_ALT_FN_2_IN)
+ #define GPIO92_MMCDAT0_MD (92 | GPIO_ALT_FN_1_OUT)
+ #define GPIO102_nPCE_1_MD (102 | GPIO_ALT_FN_1_OUT)
+ #define GPIO104_pSKTSEL_MD (104 | GPIO_ALT_FN_1_OUT)
+@@ -1483,6 +1507,7 @@
+ #define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT)
+ #define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT)
+ #define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT)
++#define GPIO113_USB_P3_3 (113 | GPIO_ALT_FN_3_IN)
+ #define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
+ #define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
+
+@@ -1498,6 +1523,7 @@
+ #define PFER __REG(0x40F00014) /* Power Manager GPIO Falling-Edge Detect Enable Register */
+ #define PEDR __REG(0x40F00018) /* Power Manager GPIO Edge Detect Status Register */
+ #define PCFR __REG(0x40F0001C) /* Power Manager General Configuration Register */
++#define PGSR(x) (__REG(0x40F00020 + ((unsigned long)(x)/32*4)))
+ #define PGSR0 __REG(0x40F00020) /* Power Manager GPIO Sleep State Register for GP[31-0] */
+ #define PGSR1 __REG(0x40F00024) /* Power Manager GPIO Sleep State Register for GP[63-32] */
+ #define PGSR2 __REG(0x40F00028) /* Power Manager GPIO Sleep State Register for GP[84-64] */
+Index: linux-2.6.23/arch/arm/boot/compressed/head.S
+===================================================================
+--- linux-2.6.23.orig/arch/arm/boot/compressed/head.S 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/boot/compressed/head.S 2007-10-24 13:03:05.000000000 +0200
+@@ -117,6 +117,9 @@
+ mov r0, r0
+ .endr
+
++ mov r1, #0x300 @ mach_id 0x363 is official EZX
++ orr r1, r1, #0x63 @ bootloader JUMP doesn't set r1
++
+ b 1f
+ .word 0x016f2818 @ Magic numbers to help the loader
+ .word start @ absolute load/run zImage address
+Index: linux-2.6.23/include/asm-arm/arch-pxa/uncompress.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/uncompress.h 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/uncompress.h 2007-10-24 13:03:05.000000000 +0200
+@@ -14,14 +14,14 @@
+ #define STUART ((volatile unsigned long *)0x40700000)
+ #define HWUART ((volatile unsigned long *)0x41600000)
+
+-#define UART FFUART
++#define UART STUART
+
+
+ static inline void putc(char c)
+ {
+- while (!(UART[5] & 0x20))
++/* while (!(UART[5] & 0x40))
+ barrier();
+- UART[0] = c;
++ UART[0] = c;*/
+ }
+
+ /*
+Index: linux-2.6.23/arch/arm/mm/init.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mm/init.c 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/mm/init.c 2007-10-24 13:03:05.000000000 +0200
+@@ -240,6 +240,10 @@
+ */
+ reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
+ boot_pages << PAGE_SHIFT);
++#ifdef CONFIG_PXA_EZX
++ /* reserve the first page memory for exiting sleep and user off */
++ reserve_bootmem_node(pgdat, PHYS_OFFSET, PAGE_SIZE);
++#endif
+
+ #ifdef CONFIG_BLK_DEV_INITRD
+ /*
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a780.c 2007-10-24 18:56:36.000000000 +0200
+@@ -0,0 +1,88 @@
++/*
++ * ezx-a780.c - Code specific to A780 GSM Phone.
++ *
++ * Copyright (c) 2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
++extern void ezx_backlight_power(int);
++
++static struct pxafb_mode_info mode_a780 = {
++ .pixclock = 150000,
++ .xres = 240,
++ .yres = 320,
++ .bpp = 16,
++ .hsync_len = 10,
++ .left_margin = 20,
++ .right_margin = 10,
++ .vsync_len = 2,
++ .upper_margin = 3,
++ .lower_margin = 2,
++ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
++};
++
++static struct pxafb_mach_info a780_fb_info = {
++ .modes = &mode_a780,
++ .num_modes = 1,
++ .lccr0 = 0x002008F8,
++ .lccr3 = 0x0430FF09,
++ .pxafb_backlight_power = &ezx_backlight_power,
++ .pxafb_lcd_power = &ezx_lcd_power,
++};
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static void __init a780_init(void)
++{
++ /* setup sleep mode values */
++ PWER = 0xc0007803; // disable usb, GPIO15 NC
++ PFER = 0x00007803;
++ PRER = 0x00001802;
++ PGSR0 = 0x00000010;
++ PGSR1 = 0x02800000;
++ PGSR2 = 0x00040000;
++ PGSR3 = 0x00000008;
++ PCFR = PCFR_DC_EN | PCFR_FS | PCFR_FP | PCFR_OPDE;
++ PSLR = 0x05800f00;
++
++ set_pxa_fb_info(&a780_fb_info);
++
++ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
++ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
++ clr_GPIO(GPIO_EMU_MUX1);
++ pxa_gpio_mode(GPIO_EMU_MUX2|GPIO_OUT);
++ clr_GPIO(GPIO_EMU_MUX2);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++}
++
++MACHINE_START(EZX, "Motorola Ezx Platform")
++ /* Maintainer: OpenEZX Team (www.openezx.org) */
++ .phys_io = 0x40000000,
++ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
++ .boot_params = 0xa0000100,
++ .map_io = pxa_map_io,
++ .init_irq = pxa27x_init_irq,
++ .timer = &pxa_timer,
++ .init_machine = a780_init,
++MACHINE_END
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e2.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e2.c 2007-10-24 18:57:44.000000000 +0200
+@@ -0,0 +1,70 @@
++/*
++ * ezx-e2.c - Code specific to E2 GSM Phone.
++ *
++ * Copyright (c) 2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
++extern void ezx_backlight_power(int);
++
++static struct pxafb_mode_info mode_e2 = {
++ .pixclock = 192308,
++ .xres = 240,
++ .yres = 320,
++ .bpp = 8,
++ .hsync_len = 10,
++ .left_margin = 20,
++ .right_margin = 10,
++ .vsync_len = 2,
++ .upper_margin = 3,
++ .lower_margin = 2,
++ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
++};
++
++static struct pxafb_mach_info e2_fb_info = {
++ .modes = &mode_e2,
++ .num_modes = 1,
++ .lccr0 = 0x022008B8,
++ .lccr3 = 0xC130FF13,
++ .pxafb_backlight_power = &ezx_backlight_power,
++ .pxafb_lcd_power = &ezx_lcd_power,
++};
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static void __init e2_init(void)
++{
++ set_pxa_fb_info(&e2_fb_info);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++}
++
++MACHINE_START(EZX, "Motorola Ezx Platform")
++ /* Maintainer: OpenEZX Team (www.openezx.org) */
++ .phys_io = 0x40000000,
++ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
++ .boot_params = 0xa0000200,
++ .map_io = pxa_map_io,
++ .init_irq = pxa27x_init_irq,
++ .timer = &pxa_timer,
++ .init_machine = e2_init,
++MACHINE_END
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e680.c 2007-10-24 18:57:19.000000000 +0200
+@@ -0,0 +1,87 @@
++/*
++ * ezx-e680.c - Code specific to E680 GSM Phone.
++ *
++ * Copyright (c) 2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
++extern void ezx_backlight_power(int);
++
++static struct pxafb_mode_info mode_e680 = {
++ .pixclock = 150000,
++ .xres = 240,
++ .yres = 320,
++ .bpp = 16,
++ .hsync_len = 10,
++ .left_margin = 20,
++ .right_margin = 10,
++ .vsync_len = 2,
++ .upper_margin = 3,
++ .lower_margin = 2,
++ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
++};
++
++static struct pxafb_mach_info e680_fb_info = {
++ .modes = &mode_e680,
++ .num_modes = 1,
++ .lccr0 = 0x002008F8,
++ .lccr3 = 0x0430FF09,
++ .pxafb_backlight_power = &ezx_backlight_power,
++ .pxafb_lcd_power = &ezx_lcd_power,
++};
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static void __init e680_init(void)
++{
++ /* setup sleep mode values */
++ PWER = 0xc000f803; // disable usb 0xdc00f803;
++ PFER = 0x0000f803;
++ PRER = 0x00001802;
++ PGSR0 = 0x00000010;
++ PGSR1 = 0x02800000;
++ PGSR2 = 0x00040000;
++ PGSR3 = 0x00000000;
++ PCFR = PCFR_DC_EN | PCFR_FS | PCFR_FP | PCFR_OPDE;
++ PSLR = 0x05800f00;
++
++ set_pxa_fb_info(&e680_fb_info);
++
++ /* clear EMU MUX1/MUX2 (low) to close the audio path to EMU */
++ pxa_gpio_mode(GPIO_EMU_MUX1|GPIO_OUT);
++ clr_GPIO(GPIO_EMU_MUX1);
++ pxa_gpio_mode(GPIO_EMU_MUX2|GPIO_OUT);
++ clr_GPIO(GPIO_EMU_MUX2);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++}
++
++MACHINE_START(EZX, "Motorola Ezx Platform")
++ /* Maintainer: OpenEZX Team (www.openezx.org) */
++ .phys_io = 0x40000000,
++ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
++ .boot_params = 0xa0000100,
++ .map_io = pxa_map_io,
++ .init_irq = pxa27x_init_irq,
++ .timer = &pxa_timer,
++ .init_machine = e680_init,
++MACHINE_END
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-a1200.c 2007-10-24 18:58:15.000000000 +0200
+@@ -0,0 +1,70 @@
++/*
++ * ezx-a1200.c - Code specific to A1200 GSM Phone.
++ *
++ * Copyright (c) 2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
++extern void ezx_backlight_power(int);
++
++static struct pxafb_mode_info mode_a1200 = {
++ .pixclock = 192308,
++ .xres = 240,
++ .yres = 320,
++ .bpp = 8,
++ .hsync_len = 10,
++ .left_margin = 20,
++ .right_margin = 10,
++ .vsync_len = 2,
++ .upper_margin = 3,
++ .lower_margin = 2,
++ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
++};
++
++static struct pxafb_mach_info a1200_fb_info = {
++ .modes = &mode_a1200,
++ .num_modes = 1,
++ .lccr0 = 0x022008B8,
++ .lccr3 = 0xC130FF13,
++ .pxafb_backlight_power = &ezx_backlight_power,
++ .pxafb_lcd_power = &ezx_lcd_power,
++};
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static void __init a1200_init(void)
++{
++ set_pxa_fb_info(&a1200_fb_info);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++}
++
++MACHINE_START(EZX, "Motorola Ezx Platform")
++ /* Maintainer: OpenEZX Team (www.openezx.org) */
++ .phys_io = 0x40000000,
++ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
++ .boot_params = 0xa0000200,
++ .map_io = pxa_map_io,
++ .init_irq = pxa27x_init_irq,
++ .timer = &pxa_timer,
++ .init_machine = a1200_init,
++MACHINE_END
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-e6.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-e6.c 2007-10-24 18:57:58.000000000 +0200
+@@ -0,0 +1,70 @@
++/*
++ * ezx-e6.c - Code specific to E6 GSM Phone.
++ *
++ * Copyright (c) 2007 OpenEZX Team (www.openezx.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 <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/fb.h>
++
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/ezx.h>
++
++#include "generic.h"
++
++extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
++extern void ezx_backlight_power(int);
++
++static struct pxafb_mode_info mode_e6 = {
++ .pixclock = 192308,
++ .xres = 240,
++ .yres = 320,
++ .bpp = 8,
++ .hsync_len = 10,
++ .left_margin = 20,
++ .right_margin = 10,
++ .vsync_len = 2,
++ .upper_margin = 3,
++ .lower_margin = 2,
++ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
++};
++
++static struct pxafb_mach_info e6_fb_info = {
++ .modes = &mode_e6,
++ .num_modes = 1,
++ .lccr0 = 0x022008B8,
++ .lccr3 = 0xC130FF13,
++ .pxafb_backlight_power = &ezx_backlight_power,
++ .pxafb_lcd_power = &ezx_lcd_power,
++};
++
++static struct platform_device *devices[] __initdata = {
++};
++
++static void __init e6_init(void)
++{
++ set_pxa_fb_info(&e6_fb_info);
++
++ platform_add_devices(devices, ARRAY_SIZE(devices));
++}
++
++MACHINE_START(EZX, "Motorola Ezx Platform")
++ /* Maintainer: OpenEZX Team (www.openezx.org) */
++ .phys_io = 0x40000000,
++ .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
++ .boot_params = 0xa0000200,
++ .map_io = pxa_map_io,
++ .init_irq = pxa27x_init_irq,
++ .timer = &pxa_timer,
++ .init_machine = e6_init,
++MACHINE_END
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-emu.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-emu.patch
new file mode 100644
index 0000000000..67075ec1fc
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-emu.patch
@@ -0,0 +1,269 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-emu.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-emu.c 2007-10-23 15:57:50.000000000 +0200
+@@ -0,0 +1,219 @@
++/*
++ * EMU Driver for Motorola EZX phones
++ *
++ * Copyright (c) 2007 Daniel Ribeiro <drwyrm@gmail.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/kernel.h>
++#include <linux/interrupt.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++
++#include <asm/arch/hardware.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx.h>
++#include <asm/arch/ezx-pcap.h>
++#include <asm/arch/udc.h>
++
++static struct pxa2xx_udc_mach_info ezx_udc_info;
++extern int ezx_pcap_bit_set(u_int32_t, u_int8_t);
++extern int ezx_pcap_read_bit(u_int32_t);
++static int emu_irq_usb4v;
++static int emu_irq_usb1v;
++
++
++#if defined CONFIG_EZX_EMU_USB
++#define emu_switch_to_default() emu_switch_to_usb()
++#elif defined CONFIG_EZX_EMU_UART
++#define emu_switch_to_default() emu_switch_to_uart()
++#else
++#define emu_switch_to_default() emu_switch_to_nothing()
++#endif
++
++void emu_switch_to_usb(void)
++{
++ printk(KERN_NOTICE "EMU: Switching to USB\n");
++ pxa_gpio_mode(GPIO34_USB_P2_2_MD);
++ pxa_gpio_mode(GPIO35_USB_P2_1_MD);
++ pxa_gpio_mode(GPIO36_USB_P2_4_MD);
++ pxa_gpio_mode(GPIO39_USB_P2_6_MD);
++ pxa_gpio_mode(GPIO40_USB_P2_5_MD);
++ pxa_gpio_mode(GPIO53_USB_P2_3_MD);
++ UP2OCR = 0x02000000;
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_RS232ENB, 1);
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_FSENB, 0);
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_VUSB_EN, 1);
++ clr_GPIO(GPIO_EMU_MUX1);
++ clr_GPIO(GPIO_EMU_MUX2);
++}
++
++void emu_switch_to_uart(void)
++{
++ printk(KERN_NOTICE "EMU: Switching to UART\n");
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_VUSB_EN,0);
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_RS232ENB, 0);
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_RS232_DIR, 1);
++ set_GPIO(GPIO39_FFTXD);
++ pxa_gpio_mode(GPIO34_TXENB | GPIO_OUT);
++ set_GPIO(GPIO34_TXENB);
++ pxa_gpio_mode(GPIO35_XRXD | GPIO_IN);
++ pxa_gpio_mode(GPIO36_VMOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO40_VPIN | GPIO_IN);
++ pxa_gpio_mode(GPIO39_FFTXD_MD);
++ pxa_gpio_mode(GPIO53_FFRXD_MD);
++ pxa_set_cken(CKEN_FFUART, 1);
++ clr_GPIO(GPIO_EMU_MUX1);
++ clr_GPIO(GPIO_EMU_MUX2);
++
++}
++
++void emu_switch_to_audio(int stereo)
++{
++ printk(KERN_NOTICE "EMU: Switching to audio(%s)\n", (stereo ? "stereo" : "mono"));
++ clr_GPIO(GPIO39_VPOUT);
++ if (stereo) {
++ pxa_gpio_mode(GPIO34_TXENB | GPIO_IN);
++ clr_GPIO(GPIO39_VPOUT);
++ } else {
++ pxa_gpio_mode(GPIO34_TXENB | GPIO_OUT);
++ set_GPIO(GPIO34_TXENB);
++ }
++
++ pxa_gpio_mode(GPIO35_XRXD | GPIO_IN);
++ pxa_gpio_mode(GPIO36_VMOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO39_VPOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO40_VPIN | GPIO_IN);
++ pxa_gpio_mode(GPIO53_VMIN | GPIO_IN);
++ set_GPIO(GPIO_EMU_MUX1);
++ if (stereo)
++ set_GPIO(GPIO_EMU_MUX2);
++ else
++ clr_GPIO(GPIO_EMU_MUX2);
++}
++
++void emu_switch_to_nothing(void)
++{
++ printk(KERN_NOTICE "EMU: Switching to disconnected\n");
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_VUSB_EN, 0);
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_RS232ENB, 1);
++ pxa_gpio_mode(GPIO34_TXENB | GPIO_OUT);
++ set_GPIO(GPIO34_TXENB);
++ pxa_gpio_mode(GPIO35_XRXD | GPIO_IN);
++ pxa_gpio_mode(GPIO36_VMOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO39_VPOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO40_VPIN | GPIO_IN);
++ pxa_gpio_mode(GPIO53_VMIN | GPIO_IN);
++}
++
++
++static irqreturn_t emu_irq(int irq, void *data)
++{
++ switch (irq) {
++ case EZX_IRQ_USB4V:
++ if(ezx_pcap_read_bit(pbit(PCAP_REG_PSTAT, PCAP_IRQ_USB4V)))
++ emu_switch_to_default();
++ break;
++ case EZX_IRQ_USB1V:
++ if(!ezx_pcap_read_bit(pbit(PCAP_REG_PSTAT, PCAP_IRQ_USB1V)))
++ emu_switch_to_nothing();
++ break;
++ }
++
++ return IRQ_HANDLED;
++}
++
++static int __init ezx_emu_probe(struct platform_device *dev)
++{
++ pxa_gpio_mode(GPIO_SNP_INT_IN | GPIO_IN);
++ pxa_gpio_mode(GPIO_EMU_MUX1 | GPIO_OUT);
++ pxa_gpio_mode(GPIO_EMU_MUX2 | GPIO_OUT);
++
++ emu_irq_usb4v = platform_get_irq(dev, 0);
++ if(emu_irq_usb4v < 0) {
++ printk(KERN_ERR "Unable to get IRQ for USB4V!\n");
++ return emu_irq_usb4v;
++ }
++ emu_irq_usb1v = platform_get_irq(dev, 1);
++ if(emu_irq_usb1v < 0) {
++ printk(KERN_ERR "Unable to get IRQ for USB1V!\n");
++ return emu_irq_usb1v;
++ }
++
++ request_irq(emu_irq_usb4v, &emu_irq, IRQF_DISABLED, "usb 4v", NULL);
++ request_irq(emu_irq_usb1v, &emu_irq, IRQF_DISABLED, "usb 1v", NULL);
++
++ pxa_set_udc_info(&ezx_udc_info);
++
++ if(ezx_pcap_read_bit(pbit(PCAP_REG_PSTAT, PCAP_IRQ_USB4V)))
++ emu_switch_to_default();
++ else
++ emu_switch_to_nothing();
++
++ return 0;
++}
++
++static int ezx_emu_remove(struct platform_device *dev)
++{
++ free_irq(emu_irq_usb4v, NULL);
++ free_irq(emu_irq_usb1v, NULL);
++
++ return 0;
++}
++
++/* USB Device Controller */
++static int udc_connected_status;
++static void ezx_udc_command(int cmd)
++{
++ switch (cmd) {
++ case PXA2XX_UDC_CMD_DISCONNECT:
++ printk(KERN_NOTICE "USB cmd disconnect\n");
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_USB_PU,0);
++ udc_connected_status = 0;
++ break;
++ case PXA2XX_UDC_CMD_CONNECT:
++ printk(KERN_NOTICE "USB cmd connect\n");
++ ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_USB_PU,1);
++ udc_connected_status = 1;
++ break;
++ }
++}
++
++static int ezx_udc_is_connected(void)
++{
++ return udc_connected_status;
++}
++
++static struct pxa2xx_udc_mach_info ezx_udc_info __initdata = {
++ .udc_is_connected = ezx_udc_is_connected,
++ .udc_command = ezx_udc_command,
++};
++
++static struct platform_driver ezxemu_driver = {
++ .probe = ezx_emu_probe,
++ .remove = ezx_emu_remove,
++ .driver = {
++ .name = "ezx-emu",
++ .owner = THIS_MODULE,
++ },
++};
++
++int __init ezx_emu_init(void)
++{
++ return platform_driver_register(&ezxemu_driver);
++}
++
++void ezx_emu_fini(void)
++{
++ return platform_driver_unregister(&ezxemu_driver);
++}
++
++module_init(ezx_emu_init);
++module_exit(ezx_emu_fini);
++
++MODULE_DESCRIPTION("Motorola Enchanced Mini Usb driver");
++MODULE_AUTHOR("Daniel Ribeiro <drwyrm@gmail.com>");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/arch/arm/mach-pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Kconfig 2007-10-23 15:38:53.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Kconfig 2007-10-23 18:00:57.000000000 +0200
+@@ -112,6 +112,28 @@
+ config EZX_PCAP
+ bool "PCAP Support"
+
++config EZX_EMU
++ bool "Motorola Enchanced Mini Usb"
++ depends on EZX_PCAP
++
++if EZX_EMU
++
++choice
++ prompt "Select default EMU mode"
++
++config EZX_EMU_USB
++ bool "USB"
++
++config EZX_EMU_UART
++ bool "UART"
++
++config EZX_EMU_NOTHING
++ bool "nothing"
++
++endchoice
++
++endif
++
+ endif
+
+ endmenu
+Index: linux-2.6.23/arch/arm/mach-pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Makefile 2007-10-23 15:38:53.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Makefile 2007-10-23 18:00:57.000000000 +0200
+@@ -27,6 +27,7 @@
+ obj-$(CONFIG_PXA_EZX_E6) += ezx-e6.o
+ obj-$(CONFIG_EZX_BP) += ezx-bp.o
+ obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o
++obj-$(CONFIG_EZX_EMU) += ezx-emu.o
+
+ # Support for blinky lights
+ led-y := leds.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-enable-stuart.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-enable-stuart.patch
new file mode 100644
index 0000000000..6f1a2c1ba4
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-enable-stuart.patch
@@ -0,0 +1,99 @@
+Index: linux-2.6.21/arch/arm/boot/compressed/head.S
+===================================================================
+--- linux-2.6.21.orig/arch/arm/boot/compressed/head.S 2007-05-19 11:22:56.000000000 -0300
++++ linux-2.6.21/arch/arm/boot/compressed/head.S 2007-05-19 11:50:29.000000000 -0300
+@@ -10,6 +10,7 @@
+ */
+ #include <linux/linkage.h>
+
++#define DEBUG
+ /*
+ * Debugging stuff
+ *
+@@ -117,6 +118,8 @@
+ mov r0, r0
+ .endr
+
++ inituart r10, r11
++
+ mov r1, #0x300 @ mach_id 0x363 is official EZX
+ orr r1, r1, #0x63 @ bootloader JUMP doesn't set r1
+
+Index: linux-2.6.21/include/asm-arm/arch-pxa/uncompress.h
+===================================================================
+--- linux-2.6.21.orig/include/asm-arm/arch-pxa/uncompress.h 2007-05-19 11:22:56.000000000 -0300
++++ linux-2.6.21/include/asm-arm/arch-pxa/uncompress.h 2007-05-19 11:30:38.000000000 -0300
+@@ -19,9 +19,9 @@
+
+ static inline void putc(char c)
+ {
+-/* while (!(UART[5] & 0x40))
++ while (!(UART[5] & 0x40))
+ barrier();
+- UART[0] = c;*/
++ UART[0] = c;
+ }
+
+ /*
+Index: linux-2.6.21/include/asm-arm/arch-pxa/debug-macro.S
+===================================================================
+--- linux-2.6.21.orig/include/asm-arm/arch-pxa/debug-macro.S 2007-05-19 11:30:54.000000000 -0300
++++ linux-2.6.21/include/asm-arm/arch-pxa/debug-macro.S 2007-05-19 11:49:35.000000000 -0300
+@@ -14,11 +14,52 @@
+ #include "hardware.h"
+
+ .macro addruart,rx
+- mrc p15, 0, \rx, c1, c0
+- tst \rx, #1 @ MMU enabled?
+- moveq \rx, #0x40000000 @ physical
+- movne \rx, #io_p2v(0x40000000) @ virtual
+- orr \rx, \rx, #0x00100000
++@ mrc p15, 0, \rx, c1, c0
++@ tst \rx, #1 @ MMU enabled?
++ mov \rx, #0x40000000
++@ moveq \rx, #0x40000000 @ physical
++@ movne \rx, #io_p2v(0x40000000) @ virtual
++ orr \rx, \rx, #0x00700000
++ .endm
++
++ .macro inituart,rd,rx
++ ldr \rd, =0x41300004 @ CKEN
++ ldr \rx, [\rd]
++ orr \rx, \rx, #0x20
++ str \rx, [\rd]
++
++ ldr \rd, =0x40E0005C
++ ldr \rx, [\rd]
++ bic \rx, \rx, #0xF0000000 @ clear GPIO46/47 config
++ orr \rx, \rx, #0x60000000 @ set GPIO46: AF2, GPIO47: AF1
++ str \rx, [\rd]
++ ldr \rd, =0x40E00010
++ ldr \rx, [\rd]
++ bic \rx, \rx, #0x0000c000 @ clear GPIO46/47 direction
++ orr \rx, \rx, #0x00008000 @ set GPIO 47 out, 46 in
++ str \rx, [\rd]
++
++ addruart \rd
++ mov \rx, #0x83 @ DLAB = 1
++ strb \rx, [\rd, #0x0c]
++
++ mov \rx, #0x08 @ Divisor 8 => 115200 bps
++ strb \rx, [\rd, #0x00]
++
++ mov \rx, #0x00
++ strb \rx, [\rd, #0x04] @ Divisor high = 0
++
++ mov \rx, #0x03
++ strb \rx, [\rd, #0x0c] @ DLAB = 0, n81
++
++ mov \rx, #0x00
++ strb \rx, [\rd, #0x10] @ MCR = 0
++
++ mov \rx, #0x00
++ strb \rx, [\rd, #0x28] @ disable autobaud
++
++ mov \rx, #0x40
++ strb \rx, [\rd, #0x04] @ IER UUE (UART Enable)
+ .endm
+
+ #define UART_SHIFT 2
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-eoc.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-eoc.patch
new file mode 100644
index 0000000000..c5597728c7
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-eoc.patch
@@ -0,0 +1,295 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-eoc.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-eoc.c 2007-10-24 19:49:32.000000000 +0200
+@@ -0,0 +1,261 @@
++/*
++ * EZX EOC Driver for Motorola EZX phones
++ *
++ * Copyright (C) 2007 Alex Zhang <celeber2@gmail.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/kernel.h>
++#include <linux/init.h>
++#include <linux/i2c.h>
++#include <linux/platform_device.h>
++
++#include <asm/arch/hardware.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx.h>
++#include <asm/arch/udc.h>
++
++#if 1
++#define EOC_DBG printk
++#else
++#define EOC_DBG(x, args...)
++#endif
++
++#define REG_INT_STATUS 32
++#define REG_INT_MASK 33
++#define REG_INT_SENSE 34
++#define REG_POWER_CONTROL_0 35
++#define REG_POWER_CONTROL_1 36
++#define REG_CONN_CONTROL 37
++
++#define EOC_REG_ADDR_SIZE 1
++#define EOC_REG_DATA_SIZE 3
++#define EOC_FUNC_NOTHING 0
++#define EOC_FUNC_USB_NET 1
++
++static const char eoc_i2c_driver_name[] = "ezx-eoc";
++static int eoc_func = EOC_FUNC_USB_NET;
++static struct pxa2xx_udc_mach_info ezx_udc_info;
++
++static int ezx_eoc_attach_adapter(struct i2c_adapter *adapter);
++static int ezx_eoc_detach_client(struct i2c_client *client);
++
++static struct i2c_client *eoc_i2c_client = NULL;
++
++static struct i2c_driver eoc_i2c_driver = {
++ .driver = {
++ .name = (char *)eoc_i2c_driver_name,
++ },
++ .attach_adapter = ezx_eoc_attach_adapter,
++ .detach_client = ezx_eoc_detach_client,
++};
++
++int eoc_reg_read(int reg, unsigned int *reg_value)
++{
++ unsigned char reg_num = reg;
++ unsigned char value[EOC_REG_DATA_SIZE];
++ int retval;
++
++ struct i2c_msg msgs[2] =
++ {
++ { eoc_i2c_client->addr, 0, EOC_REG_ADDR_SIZE, &reg_num },
++ { eoc_i2c_client->addr, I2C_M_RD, EOC_REG_DATA_SIZE, value }
++ };
++
++ /* transfer message to client */
++ retval = i2c_transfer(eoc_i2c_client->adapter, msgs, 2);
++ if (retval < 0)
++ return retval;
++
++ *reg_value = (value[2] << 0);
++ *reg_value |= (value[1] << 8);
++ *reg_value |= (value[0] << 16);
++ return 0;
++}
++
++int eoc_reg_write(int reg, unsigned int reg_value)
++{
++ unsigned char value[EOC_REG_ADDR_SIZE + EOC_REG_DATA_SIZE];
++ int retval;
++
++ /* Copy the data into a buffer into the correct format */
++ value[0] = reg;
++ value[1] = (reg_value >> 16) & 0xFF;
++ value[2] = (reg_value >> 8) & 0xFF;
++ value[3] = (reg_value >> 0) & 0xFF;
++
++ /* Write the data to the EOC */
++ retval = i2c_master_send (eoc_i2c_client, value, EOC_REG_ADDR_SIZE + EOC_REG_DATA_SIZE);
++ if (retval < 0)
++ return retval;
++ return 0;
++}
++
++static void eoc_switch_to_usb(void)
++{
++ EOC_DBG("EOC: Switching to USB\n");
++ pxa_gpio_mode(GPIO34_USB_P2_2_MD);
++ pxa_gpio_mode(GPIO35_USB_P2_1_MD);
++ pxa_gpio_mode(GPIO36_USB_P2_4_MD);
++ pxa_gpio_mode(GPIO39_USB_P2_6_MD);
++ pxa_gpio_mode(GPIO40_USB_P2_5_MD);
++ pxa_gpio_mode(GPIO53_USB_P2_3_MD);
++ UP2OCR = 0x02000000;
++ /* FIXME change eoc bits to USB */
++
++}
++
++static void eoc_switch_to_nothing(void)
++{
++ EOC_DBG("EOC: Switching do disconnected\n");
++ pxa_gpio_mode(GPIO34_TXENB | GPIO_OUT);
++ set_GPIO(GPIO34_TXENB);
++ pxa_gpio_mode(GPIO35_XRXD | GPIO_IN);
++ pxa_gpio_mode(GPIO36_VMOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO39_VPOUT | GPIO_IN);
++ pxa_gpio_mode(GPIO40_VPIN | GPIO_IN);
++ pxa_gpio_mode(GPIO53_VMIN | GPIO_IN);
++ /* FIXME disconnect mini usb port */
++}
++
++static void eoc_switch_to_default(void)
++{
++ switch (eoc_func) {
++ case EOC_FUNC_USB_NET:
++ eoc_switch_to_usb();
++ break;
++ case EOC_FUNC_NOTHING:
++ eoc_switch_to_nothing();
++ break;
++ }
++}
++
++static int ezx_eoc_attach_adapter(struct i2c_adapter *adapter)
++{
++ int err = 0;
++ EOC_DBG(">>>>attach adapter enter\n");
++
++ if (eoc_i2c_client != NULL) {
++ EOC_DBG(">>>>already loaded!!!\n");
++ return 0;
++ }
++
++ if (!(eoc_i2c_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL)))
++ return -ENOMEM;
++
++ eoc_i2c_client->addr = 0x17;
++ eoc_i2c_client->adapter = adapter;
++ eoc_i2c_client->driver = &eoc_i2c_driver;
++ eoc_i2c_client->flags = 0;
++ strlcpy(eoc_i2c_client->name, eoc_i2c_driver_name, I2C_NAME_SIZE);
++
++ if ((err = i2c_attach_client(eoc_i2c_client))) {
++ kfree(eoc_i2c_client);
++ eoc_i2c_client = NULL;
++ return err;
++ }
++ eoc_reg_write(REG_INT_MASK, 0x0000FEF);
++ eoc_reg_write(REG_POWER_CONTROL_0, 0x0000C00);
++ eoc_reg_write(REG_POWER_CONTROL_1, 0x000000C);
++ eoc_reg_write(REG_CONN_CONTROL,0x0021044);
++
++ eoc_switch_to_default();
++ EOC_DBG(">>>>attach adapter exit\n");
++ return 0;
++
++}
++
++static int ezx_eoc_detach_client(struct i2c_client *client)
++{
++ return i2c_detach_client(client);
++}
++
++static int __init ezx_eoc_probe(struct platform_device *dev)
++{
++ int ret;
++
++ ret = i2c_add_driver(&eoc_i2c_driver);
++ if (ret != 0)
++ return -EINVAL;
++
++ pxa_set_udc_info(&ezx_udc_info);
++
++ return 0;
++}
++
++static int ezx_eoc_remove(struct platform_device *dev)
++{
++ i2c_del_driver(&eoc_i2c_driver);
++ return 0;
++}
++
++static int ezx_eoc_suspend(struct platform_device *dev, pm_message_t state)
++{
++ eoc_switch_to_nothing();
++ return 0;
++}
++
++static int ezx_eoc_resume(struct platform_device *dev)
++{
++ eoc_switch_to_default();
++ return 0;
++}
++
++/* USB Device Controller */
++static int udc_connected_status;
++static void ezx_udc_command(int cmd)
++{
++ switch (cmd) {
++ case PXA2XX_UDC_CMD_DISCONNECT:
++ printk(KERN_NOTICE "USB cmd disconnect\n");
++// ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_USB_PU,0);
++ udc_connected_status = 0;
++ break;
++ case PXA2XX_UDC_CMD_CONNECT:
++ printk(KERN_NOTICE "USB cmd connect\n");
++// ezx_pcap_bit_set(PCAP_BIT_BUSCTRL_USB_PU,1);
++ udc_connected_status = 1;
++ break;
++ }
++}
++
++static int ezx_udc_is_connected(void)
++{
++ return udc_connected_status;
++}
++
++static struct pxa2xx_udc_mach_info ezx_udc_info __initdata = {
++ .udc_is_connected = ezx_udc_is_connected,
++ .udc_command = ezx_udc_command,
++};
++
++static struct platform_driver ezx_eoc_driver = {
++ .probe = ezx_eoc_probe,
++ .remove = ezx_eoc_remove,
++ .suspend = ezx_eoc_suspend,
++ .resume = ezx_eoc_resume,
++ .driver = {
++ .name = "ezx-eoc",
++ .owner = THIS_MODULE,
++ },
++};
++
++int __init ezx_eoc_init(void)
++{
++ return platform_driver_register(&ezx_eoc_driver);
++}
++
++void ezx_eoc_exit(void)
++{
++ return platform_driver_unregister(&ezx_eoc_driver);
++}
++
++MODULE_AUTHOR("Alex Zhang <celeber2@gmail.com>");
++MODULE_DESCRIPTION("EZX EOC I2C driver");
++MODULE_LICENSE("GPL");
++
++module_init(ezx_eoc_init);
++module_exit(ezx_eoc_exit);
+Index: linux-2.6.23/arch/arm/mach-pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Kconfig 2007-10-24 19:37:27.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Kconfig 2007-10-24 19:37:27.000000000 +0200
+@@ -112,6 +112,12 @@
+ config EZX_PCAP
+ bool "PCAP Support"
+
++config EZX_EOC
++ tristate "EOC i2c driver of Motorola EZX phones"
++ depends on I2C && EXPERIMENTAL
++ help
++ EOC i2c driver of Motorola EZX phones
++
+ config EZX_EMU
+ bool "Motorola Enchanced Mini Usb"
+ depends on EZX_PCAP
+Index: linux-2.6.23/arch/arm/mach-pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Makefile 2007-10-24 19:37:27.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Makefile 2007-10-24 19:37:27.000000000 +0200
+@@ -28,6 +28,7 @@
+ obj-$(CONFIG_EZX_BP) += ezx-bp.o
+ obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o
+ obj-$(CONFIG_EZX_EMU) += ezx-emu.o
++obj-$(CONFIG_EZX_EOC) += ezx-eoc.o
+
+ # Support for blinky lights
+ led-y := leds.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-mtd-map.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-mtd-map.patch
new file mode 100644
index 0000000000..2dd45d2a17
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-mtd-map.patch
@@ -0,0 +1,309 @@
+Index: linux-2.6.23/drivers/mtd/maps/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/mtd/maps/Kconfig 2007-10-10 09:38:44.000000000 +0200
++++ linux-2.6.23/drivers/mtd/maps/Kconfig 2007-10-22 22:19:57.000000000 +0200
+@@ -605,6 +605,34 @@
+ help
+ This enables access to the flash chip on the Sharp SL Series of PDAs.
+
++config MTD_EZX
++ tristate "Map driver for Motorola EZX Platform"
++ depends on MTD && PXA_EZX
++
++if MTD_EZX
++
++choice
++ prompt "Select partition mapping for EZX platform"
++
++config MTD_EZX_A780
++ bool "A780/E680 Original Mapping"
++
++config MTD_EZX_A780_ALTERNATE
++ bool "A780/E680 Alternate Mapping for BLOB2"
++
++config MTD_EZX_A1200
++ bool "A1200 Original Mapping"
++
++config MTD_EZX_E2
++ bool "E2 Original Mapping"
++
++config MTD_EZX_E6
++ bool "E6 Original Mapping"
++
++endchoice
++
++endif
++
+ config MTD_PLATRAM
+ tristate "Map driver for platform device RAM (mtd-ram)"
+ select MTD_RAM
+Index: linux-2.6.23/drivers/mtd/maps/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/mtd/maps/Makefile 2007-10-10 09:38:44.000000000 +0200
++++ linux-2.6.23/drivers/mtd/maps/Makefile 2007-10-22 22:19:57.000000000 +0200
+@@ -71,3 +71,4 @@
+ obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
+ obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
+ obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
++obj-$(CONFIG_MTD_EZX) += ezx-flash.o
+Index: linux-2.6.23/drivers/mtd/maps/ezx-flash.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/mtd/maps/ezx-flash.c 2007-10-22 22:19:57.000000000 +0200
+@@ -0,0 +1,256 @@
++/*
++ * Map driver for the PXA27x
++ *
++ * Author: Harald Welte
++ * Copyright: (C) 2001 MontaVista Software Inc.
++ *
++ * 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/types.h>
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/dma-mapping.h>
++#include <linux/slab.h>
++
++#include <linux/mtd/mtd.h>
++#include <linux/mtd/map.h>
++#include <linux/mtd/partitions.h>
++
++#include <asm/io.h>
++#include <asm/hardware.h>
++#include <asm/cacheflush.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/mainstone.h>
++
++#define WINDOW_ADDR 0x0
++#define WINDOW_SIZE (32*1024*1024)
++#define WINDOW_CACHE_ADDR 0x0
++#define WINDOW_CACHE_SIZE 0x1a00000
++
++static void pxa27x_map_inval_cache(struct map_info *map, unsigned long from,
++ ssize_t len)
++{
++ flush_ioremap_region(map->phys, map->cached, from, len);
++}
++
++
++struct map_info pxa27x_map = {
++ .name = "PXA27x flash",
++ .size = WINDOW_SIZE,
++ .phys = WINDOW_ADDR,
++ .inval_cache = &pxa27x_map_inval_cache,
++};
++
++#if defined CONFIG_MTD_EZX_A780_ALTERNATE
++static struct mtd_partition pxa27x_partitions[] = {
++ {
++ .name = "Bootloader (RO)",
++ .size = 0x00020000,
++ .offset = 0,
++ .mask_flags = MTD_WRITEABLE,
++ }, {
++ .name = "Bootloader 2",
++ .size = 0x00020000,
++ .offset = 0x00020000,
++ } , {
++ .name = "Moto Kernel",
++ .size = 0x000e0000, // 896KB
++ .offset = 0x00040000,
++ } , {
++ .name = "rootfs",
++ .size = 0x01760000,
++ .offset = 0x00120000,
++ } , {
++ .name = "OpenEZX Kernel",
++ .size = 0x00180000, // 1.5MB
++ .offset = 0x01880000,
++ } , {
++ .name = "ezxlocal",
++ .size = 0x005a0000,
++ .offset = 0x01a00000,
++ } , {
++ .name = "setup",
++ .size = 0x00020000,
++ .offset = 0x01fa0000,
++ } , {
++ .name = "Logo",
++ .size = 0x00020000,
++ .offset = 0x01fc0000,
++ },
++};
++#elif defined CONFIG_MTD_EZX_A780
++static struct mtd_partition pxa27x_partitions[] = {
++ {
++ .name = "Bootloader",
++ .size = 0x00020000,
++ .offset = 0,
++ .mask_flags = MTD_WRITEABLE,
++ }, {
++ .name = "Kernel",
++ .size = 0x000e0000,
++ .offset = 0x00020000,
++ } , {
++ .name = "rootfs",
++ .size = 0x018e0000,
++ .offset = 0x00120000,
++ } , {
++ .name = "VFM_Filesystem",
++ .size = 0x00580000,
++ .offset = 0x01a00000,
++ } , {
++ .name = "setup",
++ .size = 0x00020000,
++ .offset = 0x01fa0000,
++ } , {
++ .name = "Logo",
++ .size = 0x00020000,
++ .offset = 0x01fc0000,
++ },
++};
++#elif defined CONFIG_MTD_EZX_A1200
++static struct mtd_partition pxa27x_partitions[] = {
++ {
++ .name = "Caddo 2",
++ .size = 0x00008000,
++ .offset = 0,
++ }, {
++ .name = "Itunes",
++ .size = 0x00008000,
++ .offset = 0x00008000,
++ }, {
++ .name = "Caddo 1",
++ .size = 0x00008000,
++ .offset = 0x00010000,
++ }, {
++ .name = "Fota rev",
++ .size = 0x00008000,
++ .offset = 0x00018000,
++ }, {
++ .name = "MBM",
++ .size = 0x00040000,
++ .offset = 0x00020000,
++ .mask_flags = MTD_WRITEABLE,
++ }, {
++ .name = "Blob",
++ .size = 0x00020000,
++ .offset = 0x00080000,
++ .mask_flags = MTD_WRITEABLE,
++ }, {
++ .name = "Kernel",
++ .size = 0x00100000,
++ .offset = 0x000A0000,
++ } , {
++ .name = "UserFS DB",
++ .size = 0x00600000,
++ .offset = 0x00AA0000,
++ }, {
++ .name = "UserFS",
++ .size = 0x007E0000,
++ .offset = 0x010A0000,
++ }, {
++ .name = "Test cmd",
++ .size = 0x00020000,
++ .offset = 0x018C0000,
++ } , {
++ .name = "Logo",
++ .size = 0x00020000,
++ .offset = 0x018E0000,
++ } , {
++ .name = "Fota",
++ .size = 0x000c0000,
++ .offset = 0x01900000,
++ }, {
++ .name = "Reserve",
++ .size = 0x00020000,
++ .offset = 0x019c0000,
++ }
++};
++#else
++#error "please define partition for this PXA27x implementation"
++#endif
++
++
++static struct mtd_info *mymtd;
++static struct mtd_partition *parsed_parts;
++
++static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
++
++static int __init init_pxa27x(void)
++{
++ struct mtd_partition *parts;
++ int nb_parts = 0;
++ int parsed_nr_parts = 0;
++ char *part_type = "static";
++
++ pxa27x_map.bankwidth = (BOOT_DEF & 1) ? 2 : 4;
++
++ printk("Probing PXA27x flash at physical address 0x%08x (%d-bit bankwidth)\n",
++ WINDOW_ADDR, pxa27x_map.bankwidth * 8);
++ pxa27x_map.virt = ioremap(pxa27x_map.phys, pxa27x_map.size);
++
++ if (!pxa27x_map.virt) {
++ printk("Failed to ioremap\n");
++ return -EIO;
++ }
++
++ mymtd = do_map_probe("cfi_probe", &pxa27x_map);
++ if (!mymtd) {
++ iounmap((void *)pxa27x_map.virt);
++ return -ENXIO;
++ }
++ mymtd->owner = THIS_MODULE;
++
++ simple_map_init(&pxa27x_map);
++
++ if (parsed_nr_parts == 0) {
++ int ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
++
++ if (ret > 0) {
++ part_type = "RedBoot";
++ parsed_nr_parts = ret;
++ }
++ }
++
++ if (parsed_nr_parts > 0) {
++ parts = parsed_parts;
++ nb_parts = parsed_nr_parts;
++ } else {
++ parts = pxa27x_partitions;
++ nb_parts = ARRAY_SIZE(pxa27x_partitions);
++ }
++
++ if (nb_parts) {
++ printk(KERN_NOTICE "Using %s partition definition\n", part_type);
++ add_mtd_partitions(mymtd, parts, nb_parts);
++ } else {
++ add_mtd_device(mymtd);
++ }
++ return 0;
++}
++
++static void __exit cleanup_pxa27x(void)
++{
++ if (mymtd) {
++ del_mtd_partitions(mymtd);
++ map_destroy(mymtd);
++ if (parsed_parts)
++ kfree(parsed_parts);
++ }
++ if (pxa27x_map.virt)
++ iounmap((void *)pxa27x_map.virt);
++ if (pxa27x_map.cached)
++ iounmap((void *)pxa27x_map.cached);
++ return;
++}
++
++module_init(init_pxa27x);
++module_exit(cleanup_pxa27x);
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
++MODULE_DESCRIPTION("MTD map driver for Motorola EZX platform");
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-pcap.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-pcap.patch
new file mode 100644
index 0000000000..c917d4aa9e
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-pcap.patch
@@ -0,0 +1,849 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx-pcap.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/arch/arm/mach-pxa/ezx-pcap.c 2007-10-23 15:41:22.000000000 +0200
+@@ -0,0 +1,513 @@
++/* Driver for Motorola PCAP2 as present in EZX phones
++ *
++ * This is both a SPI device driver for PCAP itself, as well as
++ * an IRQ demultiplexer for handling PCAP generated events such as
++ * headphone jack sense by downstream drivers.
++ *
++ * Copyright (C) 2006 Harald Welte <laforge@openezx.org>
++ * Copyright (C) 2007 Daniel Ribeiro <drwyrm@gmail.com>
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/platform_device.h>
++#include <linux/interrupt.h>
++#include <linux/kernel_stat.h>
++#include <linux/proc_fs.h>
++
++#include <asm/hardware.h>
++#include <asm/mach-types.h>
++
++#include <asm/arch/ezx.h>
++#include <asm/arch/ssp.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx-pcap.h>
++#include <asm/arch/irqs.h>
++#include <asm/mach/irq.h>
++
++#if 0
++#define DEBUGP(x, args...) printk(x, ## args)
++#else
++#define DEBUGP(x, args...)
++#endif
++
++static DEFINE_SPINLOCK(ezx_ssp_lock);
++static struct ssp_dev ezx_ssp_dev;
++static struct ssp_state ezx_ssp_state;
++static struct pcap_platform_data *pcap_data;
++static int pcap_irq;
++
++static unsigned long ezx_ssp_pcap_putget(ulong data)
++{
++ unsigned long flag;
++ u32 ret = 0;
++
++ spin_lock_irqsave(&ezx_ssp_lock, flag);
++ if (pcap_data->cs >= 0) {
++ if (pcap_data->flags & PCAP_CS_AH)
++ GPSR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ else
++ GPCR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ }
++
++ ssp_write_word(&ezx_ssp_dev,data);
++ ssp_read_word(&ezx_ssp_dev, &ret);
++
++ if (pcap_data->cs >= 0) {
++ if(pcap_data->flags & PCAP_CS_AH)
++ GPCR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ else
++ GPSR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ }
++
++ spin_unlock_irqrestore(&ezx_ssp_lock, flag);
++
++ return ret;
++}
++
++int ezx_pcap_write(u_int8_t reg_num, u_int32_t value)
++{
++ value &= PCAP_REGISTER_VALUE_MASK;
++ value |= PCAP_REGISTER_WRITE_OP_BIT
++ | (reg_num<<PCAP_REGISTER_ADDRESS_SHIFT);
++
++ ezx_ssp_pcap_putget(value);
++
++ DEBUGP("pcap write r%x: 0x%08x\n", reg_num, value);
++ return 0;
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_write);
++
++int ezx_pcap_read(u_int8_t reg_num, u_int32_t *value)
++{
++ u_int32_t frame = PCAP_REGISTER_READ_OP_BIT
++ | (reg_num<<PCAP_REGISTER_ADDRESS_SHIFT);
++
++ *value = ezx_ssp_pcap_putget(frame);
++
++ DEBUGP("pcap read r%x: 0x%08x\n", reg_num, *value);
++ return 0;
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_read);
++
++int ezx_pcap_bit_set(u_int32_t sspPcapBit, u_int8_t to)
++{
++ int ret;
++ u_int32_t tmp;
++ u_int32_t bit = (sspPcapBit & PCAP_REGISTER_VALUE_MASK);
++ u_int8_t reg_num = (sspPcapBit & PCAP_REGISTER_ADDRESS_MASK)
++ >> PCAP_REGISTER_ADDRESS_SHIFT;
++
++ ret = ezx_pcap_read(reg_num, &tmp);
++ if (ret < 0)
++ return ret;
++
++ if (to == 0)
++ tmp &= ~bit;
++ else
++ tmp |= bit;
++
++ return ezx_pcap_write(reg_num, tmp);
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_bit_set);
++
++int ezx_pcap_read_bit(u_int32_t bit)
++{
++ int ret;
++ u_int32_t tmp;
++ u_int8_t reg_num = (bit & PCAP_REGISTER_ADDRESS_MASK)
++ >> PCAP_REGISTER_ADDRESS_SHIFT;
++
++ ret = ezx_pcap_read(reg_num, &tmp);
++ if (ret < 0)
++ return ret;
++
++ return tmp & (bit & PCAP_REGISTER_VALUE_MASK);
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_read_bit);
++
++/* /proc/pcap support */
++#ifdef CONFIG_PROC_FS
++
++static struct proc_dir_entry *proc_pcap;
++
++char *pcap_registers[] = {
++ "ISR\t", "MSR\t", "PSTAT\t", "INT_SEL\t", "SWCTRL\t", "VREG1\t",
++ "VREG2\t", "VREG\t", "BATT_DAC", "ADC1\t", "ADC2\t", "AUD_CODEC",
++ "RX_AUD_AMPS", "ST_DAC\t", "RTC_TOD\t", "RTC_TODA", "RTC_DAY\t",
++ "RTC_DAYA", "MTRTMR\t", "PWRCTRL\t", "BUSCTRL\t", "PERIPH\t",
++ "AUXVREG_MASK", "VENDOR_REV", "LOWPWR_CTRL", "PERIPH_MASK",
++ "TX_AUD_AMPS", "GP\t",
++ NULL, NULL, NULL, NULL
++};
++
++static int pcap_read_proc(char *page, char **start, off_t off, int count,
++ int *eof, void *data_unused)
++{
++ int len = 0;
++ u_int8_t r;
++ u_int32_t v;
++ off_t begin = 0;
++
++ for(r=0;r<32;r++) {
++ if (pcap_registers[r] == NULL)
++ continue;
++ ezx_pcap_read(r, &v);
++ len += sprintf(page+len, "%s\t%08X\n", pcap_registers[r], v);
++ if(len + begin > off + count)
++ goto done;
++ if(len + begin < off) {
++ begin += len;
++ len = 0;
++ }
++ }
++ *eof = 1;
++done:
++ if (off >= len+begin)
++ return 0;
++ *start = page + (off-begin);
++ return ((count < begin+len-off) ? count : begin+len-off);
++}
++#endif
++
++void ezx_pcap_vibrator_level(u_int32_t value)
++{
++ u_int32_t tmp;
++
++ ezx_pcap_read(PCAP_REG_AUXVREG, &tmp);
++
++ tmp &= ~PCAP_AUXVREG_V_VIB_MASK;
++ tmp |= ((value << PCAP_AUXVREG_V_VIB_SHIFT) & PCAP_AUXVREG_V_VIB_MASK);
++
++ ezx_pcap_write(PCAP_REG_AUXVREG, tmp);
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_vibrator_level);
++
++/* MMC/SD specific functions */
++
++void ezx_pcap_mmcsd_voltage(u_int32_t bits)
++{
++ unsigned int tmp;
++ ezx_pcap_read(PCAP_REG_AUXVREG, &tmp);
++ if (pcap_data->flags & PCAP_MCI_SD) {
++ tmp &= ~PCAP_AUXVREG_VAUX2_MASK;
++ tmp |= ((bits << PCAP_AUXVREG_VAUX2_SHIFT) &
++ PCAP_AUXVREG_VAUX2_MASK);
++ }
++ else if (pcap_data->flags & PCAP_MCI_TF) {
++ tmp &= ~PCAP_AUXVREG_VAUX3_MASK;
++ tmp |= ((bits << PCAP_AUXVREG_VAUX3_SHIFT) &
++ PCAP_AUXVREG_VAUX3_MASK);
++ }
++ ezx_pcap_write(PCAP_REG_AUXVREG, tmp);
++}
++EXPORT_SYMBOL(ezx_pcap_mmcsd_voltage);
++
++int ezx_pcap_mmcsd_power(int on)
++{
++ if (on > 0) on = 1;
++ else on = 0;
++
++ if (pcap_data->flags & PCAP_MCI_SD)
++ return ezx_pcap_bit_set(PCAP_BIT_AUXVREG_VAUX2_EN, on);
++ else if (pcap_data->flags & PCAP_MCI_TF)
++ return ezx_pcap_bit_set(PCAP_BIT_AUXVREG_VAUX3_EN, on);
++ else
++ return -ENODEV;
++}
++EXPORT_SYMBOL_GPL(ezx_pcap_mmcsd_power);
++
++/* IRQ Handling */
++
++/* Array indexed by BIT POSITION of PCAP register, returns IRQ number */
++static unsigned int pcap2irq[] = {
++ [0] = EZX_IRQ_ADCDONE,
++ [1] = EZX_IRQ_TS,
++ [2] = EZX_IRQ_1HZ, /* 1HZ */
++ [3] = EZX_IRQ_WH, /* WH */
++ [4] = EZX_IRQ_WL, /* WL */
++ [5] = EZX_IRQ_TODA, /* TODA */
++ [6] = EZX_IRQ_USB4V,
++ [7] = EZX_IRQ_ONOFF, /* ONOFF */
++ [8] = EZX_IRQ_ONOFF2, /* ONOFF2 */
++ [9] = EZX_IRQ_USB1V,
++ [10] = EZX_IRQ_MOBPORT, /* MOBPORT */
++ [11] = EZX_IRQ_MIC,
++ [12] = EZX_IRQ_HEADJACK,
++ [13] = EZX_IRQ_ST, /* ST */
++ [14] = EZX_IRQ_PC, /* PC */
++ [15] = EZX_IRQ_WARM, /* WARM */
++ [16] = EZX_IRQ_EOL, /* EOL */
++ [17] = EZX_IRQ_CLK, /* CLK */
++ [18] = EZX_IRQ_SYSRST, /* SYSRST */
++ [19] = 0,
++ [20] = EZX_IRQ_ADCDONE2,
++ [21] = EZX_IRQ_SOFTRESET, /* SOFTRESET */
++ [22] = EZX_IRQ_MNEXB, /* MNEXB */
++};
++
++/* Array indexed by IRQ NUMBER, returns PCAP absolute value */
++static unsigned int irq2pcap[] = {
++ [EZX_IRQ_MNEXB] = PCAP_IRQ_MNEXB,
++ [EZX_IRQ_SOFTRESET] = PCAP_IRQ_SOFTRESET,
++ [EZX_IRQ_SYSRST] = PCAP_IRQ_SYSRST,
++ [EZX_IRQ_CLK] = PCAP_IRQ_CLK,
++ [EZX_IRQ_EOL] = PCAP_IRQ_EOL,
++ [EZX_IRQ_WARM] = PCAP_IRQ_WARM,
++ [EZX_IRQ_PC] = PCAP_IRQ_PC,
++ [EZX_IRQ_ST] = PCAP_IRQ_ST,
++ [EZX_IRQ_MOBPORT] = PCAP_IRQ_MOBPORT,
++ [EZX_IRQ_ONOFF2] = PCAP_IRQ_ONOFF2,
++ [EZX_IRQ_ONOFF] = PCAP_IRQ_ONOFF,
++ [EZX_IRQ_TODA] = PCAP_IRQ_TODA,
++ [EZX_IRQ_WL] = PCAP_IRQ_WL,
++ [EZX_IRQ_WH] = PCAP_IRQ_WH,
++ [EZX_IRQ_1HZ] = PCAP_IRQ_1HZ,
++ [EZX_IRQ_USB4V] = PCAP_IRQ_USB4V,
++ [EZX_IRQ_USB1V] = PCAP_IRQ_USB1V,
++ [EZX_IRQ_HEADJACK] = PCAP_IRQ_A1,
++ [EZX_IRQ_MIC] = PCAP_IRQ_MB2,
++ [EZX_IRQ_TS] = PCAP_IRQ_TS,
++ [EZX_IRQ_ADCDONE] = PCAP_IRQ_ADCDONE,
++ [EZX_IRQ_ADCDONE2] = PCAP_IRQ_ADCDONE2,
++};
++
++static void pcap_ack_irq(unsigned int irq)
++{
++ DEBUGP("pcap_ack_irq: %u\n", irq);
++ ezx_pcap_write(PCAP_REG_ISR, irq2pcap[irq]);
++}
++
++static void pcap_mask_irq(unsigned int irq)
++{
++ u_int32_t reg;
++ unsigned long flag;
++
++ spin_lock_irqsave(&ezx_ssp_lock, flag);
++ DEBUGP("pcap_mask_irq: %u\n", irq);
++ ezx_pcap_read(PCAP_REG_MSR, &reg);
++ reg |= irq2pcap[irq];
++ ezx_pcap_write(PCAP_REG_MSR, reg);
++ spin_unlock_irqrestore(&ezx_ssp_lock, flag);
++}
++
++static void pcap_unmask_irq(unsigned int irq)
++{
++ u_int32_t tmp;
++ unsigned long flag;
++
++ spin_lock_irqsave(&ezx_ssp_lock, flag);
++ DEBUGP("pcap_unmask_irq: %u\n", irq);
++ ezx_pcap_read(PCAP_REG_MSR, &tmp);
++ tmp &= ~irq2pcap[irq];
++ ezx_pcap_write(PCAP_REG_MSR, tmp);
++ spin_unlock_irqrestore(&ezx_ssp_lock, flag);
++}
++
++static struct irq_chip pcap_chip = {
++ .ack = pcap_ack_irq,
++ .mask = pcap_mask_irq,
++ .unmask = pcap_unmask_irq,
++};
++
++/* handler for interrupt received from PCAP via GPIO */
++static void pcap_irq_demux_handler(unsigned int irq, struct irq_desc *desc)
++{
++ const unsigned int cpu = smp_processor_id();
++ int i;
++ u_int32_t isr, msr;
++
++ spin_lock(&desc->lock);
++ desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
++ if (unlikely(desc->status & (IRQ_INPROGRESS | IRQ_DISABLED))) {
++ desc->status |= (IRQ_PENDING | IRQ_MASKED);
++ desc->chip->mask(irq);
++ desc->chip->ack(irq);
++ goto out_unlock;
++ }
++ kstat_cpu(cpu).irqs[irq]++;
++ desc->chip->ack(irq);
++ desc->status |= IRQ_INPROGRESS;
++ do {
++ if (unlikely((desc->status &
++ (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) ==
++ (IRQ_PENDING | IRQ_MASKED))) {
++ desc->chip->unmask(irq);
++ desc->status &= ~IRQ_MASKED;
++ }
++ desc->status &= ~IRQ_PENDING;
++
++ ezx_pcap_read(PCAP_REG_ISR, &isr);
++ ezx_pcap_read(PCAP_REG_MSR, &msr);
++ for (i = ARRAY_SIZE(pcap2irq)-1; i >= 0; i--) {
++ unsigned int pirq = pcap2irq[i];
++ struct irq_desc *subdesc;
++ if (pirq == 0 || !(isr & irq2pcap[pirq]))
++ continue;
++ subdesc = irq_desc + pirq;
++ if (msr & irq2pcap[pirq])
++ continue;
++ DEBUGP("found irq %u\n", pirq);
++ spin_unlock(&desc->lock);
++ desc_handle_irq(pirq, subdesc);
++ spin_lock(&desc->lock);
++ }
++
++ } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
++
++ desc->status &= ~IRQ_INPROGRESS;
++out_unlock:
++ spin_unlock(&desc->lock);
++}
++
++static int ezx_pcap_remove(struct platform_device *pdev)
++{
++ int irq;
++ DEBUGP("exz_pcap_remove entered\n");
++
++ set_irq_chained_handler(pcap_irq, NULL);
++
++ for (irq = EZX_IRQ(0); irq <= EZX_IRQ(21); irq++) {
++ set_irq_chip(irq, NULL);
++ set_irq_handler(irq, NULL);
++ set_irq_flags(irq, 0);
++ }
++
++ ssp_exit(&ezx_ssp_dev);
++
++ return 0;
++}
++
++static int __init ezx_pcap_probe(struct platform_device *pdev)
++{
++ unsigned int ret, irq;
++ DEBUGP("ezx_pcap_probe entered\n");
++
++ pcap_data = pdev->dev.platform_data;
++
++ /* configure ssp port */
++ pxa_gpio_mode(29|GPIO_ALT_FN_3_OUT);
++ pxa_gpio_mode(GPIO24_SFRM_MD);
++ pxa_gpio_mode(GPIO25_STXD_MD);
++ pxa_gpio_mode(GPIO26_SRXD_MD);
++
++ if (pcap_data->cs >= 0) {
++ if (pcap_data->flags & PCAP_CS_AH)
++ pxa_gpio_mode(pcap_data->cs | GPIO_OUT);
++ else
++ pxa_gpio_mode(pcap_data->cs | GPIO_OUT
++ | GPIO_DFLT_HIGH);
++ }
++ pcap_irq = platform_get_irq(pdev, 0);
++ if(pcap_irq < 0) {
++ printk(KERN_ERR "Unable to get IRQ for pcap!\n");
++ return pcap_irq;
++ }
++
++ ret = ssp_init(&ezx_ssp_dev, pcap_data->port, 0);
++ if (ret) {
++ printk(KERN_ERR "Unable to register SSP handler!\n");
++ return ret;
++ }
++
++ ssp_disable(&ezx_ssp_dev);
++ ssp_config(&ezx_ssp_dev,
++ (SSCR0_Motorola | SSCR0_DataSize(16) | SSCR0_EDSS),
++ (SSCR1_TxTresh(1) | SSCR1_RxTresh(1)),
++ 0, SSCR0_SerClkDiv(pcap_data->clk));
++ ssp_enable(&ezx_ssp_dev);
++
++ /* mask/ack all PCAP interrupts */
++ ezx_pcap_write(PCAP_REG_MSR, PCAP_MASK_ALL_INTERRUPT);
++ ezx_pcap_write(PCAP_REG_ISR, PCAP_CLEAR_INTERRUPT_REGISTER);
++
++ if (pcap_data->init)
++ pcap_data->init();
++
++ /* set up interrupt demultiplexing code for PCAP2 irqs */
++ set_irq_type(pcap_irq, IRQT_RISING);
++ for (irq = EZX_IRQ(0); irq <= EZX_IRQ(21); irq++) {
++ set_irq_chip(irq, &pcap_chip);
++ set_irq_handler(irq, handle_level_irq);
++ set_irq_flags(irq, IRQF_VALID);
++ }
++ set_irq_chained_handler(pcap_irq, pcap_irq_demux_handler);
++ set_irq_wake(pcap_irq, 1);
++
++ printk("ezx-pcap: ssp driver registered\n");
++ return ret;
++}
++
++static int ezx_pcap_suspend(struct platform_device *dev, pm_message_t state)
++{
++ DEBUGP("pcap suspend!\n");
++ ssp_flush(&ezx_ssp_dev);
++ ssp_save_state(&ezx_ssp_dev, &ezx_ssp_state);
++ if (pcap_data->cs >= 0)
++ pxa_gpio_mode(pcap_data->cs | GPIO_IN);
++ return 0;
++}
++
++static int ezx_pcap_resume(struct platform_device *dev)
++{
++ DEBUGP("pcap resume!\n");
++
++ if (pcap_data->cs >= 0) {
++ if (pcap_data->flags & PCAP_CS_AH) {
++ pxa_gpio_mode(pcap_data->cs | GPIO_OUT);
++ GPCR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ }
++ else {
++ pxa_gpio_mode(pcap_data->cs | GPIO_OUT | GPIO_DFLT_HIGH);
++ GPSR(pcap_data->cs) = GPIO_bit(pcap_data->cs);
++ }
++ }
++ ssp_restore_state(&ezx_ssp_dev,&ezx_ssp_state);
++ ssp_enable(&ezx_ssp_dev);
++
++ ezx_pcap_write(PCAP_REG_ISR, PCAP_CLEAR_INTERRUPT_REGISTER);
++
++ return 0;
++}
++
++static struct platform_driver ezxpcap_driver = {
++ .probe = ezx_pcap_probe,
++ .remove = ezx_pcap_remove,
++ .suspend = ezx_pcap_suspend,
++ .resume = ezx_pcap_resume,
++ .driver = {
++ .name = "ezx-pcap",
++ .owner = THIS_MODULE,
++ },
++};
++
++static int __init ezx_pcap_init(void)
++{
++ DEBUGP("ezx_pcap_init entered\n");
++
++#ifdef CONFIG_PROC_FS
++ if((proc_pcap = create_proc_entry("pcap", 0, NULL)))
++ proc_pcap->read_proc = pcap_read_proc;
++#endif
++
++ return platform_driver_register(&ezxpcap_driver);
++}
++
++static void __exit ezx_pcap_exit(void)
++{
++#ifdef CONFIG_PROC_FS
++ if (proc_pcap)
++ remove_proc_entry("pcap", NULL);
++#endif
++
++ return platform_driver_unregister(&ezxpcap_driver);
++}
++
++module_init(ezx_pcap_init);
++module_exit(ezx_pcap_exit);
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Harald Welte");
++MODULE_DESCRIPTION("SPI Driver for Motorola PCAP2");
++
+Index: linux-2.6.23/include/asm-arm/arch-pxa/ezx-pcap.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/include/asm-arm/arch-pxa/ezx-pcap.h 2007-10-23 15:41:20.000000000 +0200
+@@ -0,0 +1,248 @@
++/*
++ * Copyright 2007 Daniel Ribeiro <drwyrm@gmail.com>
++ */
++
++#ifndef EZX_PCAP_H
++#define EZX_PCAP_H
++
++struct pcap_platform_data {
++ int port; /* SSP port */
++ int cs; /* CS gpio */
++ int clk;
++ int flags; /* driver flags */
++ int (*init)(void); /* board specific driver init */
++};
++
++/* driver configuration */
++#define PCAP_CS_AH (1 << 0) /* CS pin is active high */
++#define PCAP_MCI_SD (1 << 1) /* SD card slot */
++#define PCAP_MCI_TF (1 << 2) /* TF card slot */
++
++#define PCAP_REGISTER_WRITE_OP_BIT 0x80000000
++#define PCAP_REGISTER_READ_OP_BIT 0x00000000
++
++#define PCAP_REGISTER_VALUE_MASK 0x01ffffff
++#define PCAP_REGISTER_ADDRESS_MASK 0x7c000000
++#define PCAP_REGISTER_ADDRESS_SHIFT 26
++#define PCAP_REGISTER_NUMBER 32
++#define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff
++#define PCAP_MASK_ALL_INTERRUPT 0x01ffffff
++
++
++#define pbit(reg, bit) ((reg << PCAP_REGISTER_ADDRESS_SHIFT) | bit)
++
++/* registers acessible by both pcap ports */
++#define PCAP_REG_ISR 0x0 /* Interrupt Status */
++#define PCAP_REG_MSR 0x1 /* Interrupt Mask */
++#define PCAP_REG_PSTAT 0x2 /* Processor Status */
++#define PCAP_REG_VREG2 0x6 /* Regulator Bank 2 Control */
++#define PCAP_REG_AUXVREG 0x7 /* Auxiliary Regulator Control */
++#define PCAP_REG_BATT 0x8 /* Battery Control */
++#define PCAP_REG_ADC1 0x9 /* AD Control */
++#define PCAP_REG_ADC2 0xa /* AD Result */
++#define PCAP_REG_CODEC 0xb /* Audio Codec Control */
++#define PCAP_REG_RX_AMPS 0xc /* RX Audio Amplifiers Control */
++#define PCAP_REG_ST_DAC 0xd /* Stereo DAC Control */
++#define PCAP_REG_BUSCTRL 0x14 /* Connectivity Control */
++#define PCAP_REG_PERIPH 0x15 /* Peripheral Control */
++#define PCAP_REG_LOWPWR 0x18 /* Regulator Low Power Control */
++#define PCAP_REG_TX_AMPS 0x1a /* TX Audio Amplifiers Control */
++#define PCAP_REG_GP 0x1b /* General Purpose */
++
++/* registers acessible by pcap port 1 only (a1200, e2 & e6) */
++#define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */
++#define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */
++#define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */
++#define PCAP_REG_RTC_TOD 0xe /* RTC Time of Day */
++#define PCAP_REG_RTC_TODA 0xf /* RTC Time of Day Alarm */
++#define PCAP_REG_RTC_DAY 0x10 /* RTC Day */
++#define PCAP_REG_RTC_DAYA 0x11 /* RTC Day Alarm */
++#define PCAP_REG_MTRTMR 0x12 /* AD Monitor Timer */
++#define PCAP_REG_PWR 0x13 /* Power Control */
++#define PCAP_REG_AUXVREG_MASK 0x16 /* Auxiliary Regulator Mask */
++#define PCAP_REG_VENDOR_REV 0x17
++#define PCAP_REG_PERIPH_MASK 0x19 /* Peripheral Mask */
++
++/* interrupts - registers 0, 1, 2, 3 */
++#define PCAP_IRQ_ADCDONE (1 << 0) /* AD Conversion Done Port 1 */
++#define PCAP_IRQ_TS (1 << 1) /* Touch Screen */
++#define PCAP_IRQ_1HZ (1 << 2) /* 1HZ Timer */
++#define PCAP_IRQ_WH (1 << 3)
++#define PCAP_IRQ_WL (1 << 4)
++#define PCAP_IRQ_TODA (1 << 5)
++#define PCAP_IRQ_USB4V (1 << 6)
++#define PCAP_IRQ_ONOFF (1 << 7)
++#define PCAP_IRQ_ONOFF2 (1 << 8)
++#define PCAP_IRQ_USB1V (1 << 9)
++#define PCAP_IRQ_MOBPORT (1 << 10)
++#define PCAP_IRQ_MB2 (1 << 11) /* Mic */
++#define PCAP_IRQ_A1 (1 << 12) /* Audio jack */
++#define PCAP_IRQ_ST (1 << 13)
++#define PCAP_IRQ_PC (1 << 14)
++#define PCAP_IRQ_WARM (1 << 15)
++#define PCAP_IRQ_EOL (1 << 16)
++#define PCAP_IRQ_CLK (1 << 17)
++#define PCAP_IRQ_SYSRST (1 << 18)
++#define PCAP_IRQ_ADCDONE2 (1 << 20) /* AD Conversion Done Port 2 */
++#define PCAP_IRQ_SOFTRESET (1 << 21)
++#define PCAP_IRQ_MNEXB (1 << 22)
++
++#define PCAP_BIT_VREG2_V1_STBY pbit(PCAP_REG_VREG2, (1 << 0))
++#define PCAP_BIT_VREG2_V2_STBY pbit(PCAP_REG_VREG2, (1 << 1))
++#define PCAP_BIT_VREG2_V3_STBY pbit(PCAP_REG_VREG2, (1 << 2))
++#define PCAP_BIT_VREG2_V4_STBY pbit(PCAP_REG_VREG2, (1 << 3))
++#define PCAP_BIT_VREG2_V5_STBY pbit(PCAP_REG_VREG2, (1 << 4))
++#define PCAP_BIT_VREG2_V6_STBY pbit(PCAP_REG_VREG2, (1 << 5))
++#define PCAP_BIT_VREG2_V7_STBY pbit(PCAP_REG_VREG2, (1 << 6))
++#define PCAP_BIT_VREG2_V8_STBY pbit(PCAP_REG_VREG2, (1 << 7))
++#define PCAP_BIT_VREG2_V9_STBY pbit(PCAP_REG_VREG2, (1 << 8))
++#define PCAP_BIT_VREG2_V10_STBY pbit(PCAP_REG_VREG2, (1 << 9))
++#define PCAP_BIT_VREG2_V1_LOWPWR pbit(PCAP_REG_VREG2, (1 << 10))
++#define PCAP_BIT_VREG2_V2_LOWPWR pbit(PCAP_REG_VREG2, (1 << 11))
++#define PCAP_BIT_VREG2_V3_LOWPWR pbit(PCAP_REG_VREG2, (1 << 12))
++#define PCAP_BIT_VREG2_V4_LOWPWR pbit(PCAP_REG_VREG2, (1 << 13))
++#define PCAP_BIT_VREG2_V5_LOWPWR pbit(PCAP_REG_VREG2, (1 << 14))
++#define PCAP_BIT_VREG2_V6_LOWPWR pbit(PCAP_REG_VREG2, (1 << 15))
++#define PCAP_BIT_VREG2_V7_LOWPWR pbit(PCAP_REG_VREG2, (1 << 16))
++#define PCAP_BIT_VREG2_V8_LOWPWR pbit(PCAP_REG_VREG2, (1 << 17))
++#define PCAP_BIT_VREG2_V9_LOWPWR pbit(PCAP_REG_VREG2, (1 << 18))
++#define PCAP_BIT_VREG2_V10_LOWPWR pbit(PCAP_REG_VREG2, (1 << 19))
++
++#define PCAP_BIT_AUXVREG_VAUX1_EN pbit(PCAP_REG_AUXVREG, (1 << 1))
++#define PCAP_AUXVREG_VAUX1_MASK 0x0000000c
++#define PCAP_AUXVREG_VAUX1_SHIFT 2
++#define PCAP_BIT_AUXVREG_VAUX2_EN pbit(PCAP_REG_AUXVREG, (1 << 4))
++#define PCAP_AUXVREG_VAUX2_MASK 0x00000060
++#define PCAP_AUXVREG_VAUX2_SHIFT 5
++#define PCAP_BIT_AUXVREG_VAUX3_EN pbit(PCAP_REG_AUXVREG, (1 << 7))
++#define PCAP_AUXVREG_VAUX3_MASK 0x00000f00
++#define PCAP_AUXVREG_VAUX3_SHIFT 8
++#define PCAP_BIT_AUXVREG_VAUX4_EN pbit(PCAP_REG_AUXVREG, (1 << 12))
++#define PCAP_AUXVREG_VAUX4_MASK 0x00006000
++#define PCAP_AUXVREG_VAUX4_SHIFT 13
++#define PCAP_BIT_AUXVREG_VSIM2_EN pbit(PCAP_REG_AUXVREG, (1 << 16))
++#define PCAP_BIT_AUXVREG_VSIM_EN pbit(PCAP_REG_AUXVREG, (1 << 17))
++#define PCAP_BIT_AUXVREG_VSIM_0 pbit(PCAP_REG_AUXVREG, (1 << 18))
++#define PCAP_BIT_AUXVREG_V_VIB_EN pbit(PCAP_REG_AUXVREG, (1 << 19))
++#define PCAP_AUXVREG_V_VIB_MASK 0x00300000
++#define PCAP_AUXVREG_V_VIB_SHIFT 20
++#define PCAP_BIT_AUXVREG_VAUX1_STBY pbit(PCAP_REG_AUXVREG, (1 << 22))
++#define PCAP_BIT_AUXVREG_VAUX1_LOWPWR pbit(PCAP_REG_AUXVREG, (1 << 23))
++#define PCAP_BIT_AUXVREG_SW3_STBY pbit(PCAP_REG_AUXVREG, (1 << 24))
++
++#define PCAP_BATT_DAC_MASK 0x000000ff
++#define PCAP_BATT_DAC_SHIFT 0
++#define PCAP_BIT_BATT_B_FDBK pbit(PCAP_REG_BATT, (1 << 8))
++#define PCAP_BIT_BATT_EXT_ISENSE pbit(PCAP_REG_BATT, (1 << 9))
++#define PCAP_BATT_V_COIN_MASK 0x00003c00
++#define PCAP_BATT_V_COIN_SHIFT 10
++#define PCAP_BIT_BATT_I_COIN pbit(PCAP_REG_BATT, (1 << 14))
++#define PCAP_BIT_BATT_COIN_CH_EN pbit(PCAP_REG_BATT, (1 << 15))
++#define PCAP_BATT_EOL_SEL_MASK 0x000e0000
++#define PCAP_BATT_EOL_SEL_SHIFT 17
++#define PCAP_BIT_BATT_EOL_CMP_EN pbit(PCAP_REG_BATT, (1 << 20))
++#define PCAP_BIT_BATT_BATT_DET_EN pbit(PCAP_REG_BATT, (1 << 21))
++#define PCAP_BIT_BATT_THERMBIAS_CTRL pbit(PCAP_REG_BATT, (1 << 22))
++
++#define PCAP_BIT_ADC1_ADEN pbit(PCAP_REG_ADC1, (1 << 0))
++#define PCAP_BIT_ADC1_RAND pbit(PCAP_REG_ADC1, (1 << 1))
++#define PCAP_BIT_ADC1_AD_SEL1 pbit(PCAP_REG_ADC1, (1 << 2))
++#define PCAP_BIT_ADC1_AD_SEL2 pbit(PCAP_REG_ADC1, (1 << 3))
++#define PCAP_ADC1_ADA1_MASK 0x00000070
++#define PCAP_ADC1_ADA1_SHIFT 4
++#define PCAP_ADC1_ADA2_MASK 0x00000380
++#define PCAP_ADC1_ADA2_SHIFT 7
++#define PCAP_ADC1_ATO_MASK 0x00003c00
++#define PCAP_ADC1_ATO_SHIFT 10
++#define PCAP_BIT_ADC1_ATOX pbit(PCAP_REG_ADC1, (1 << 14))
++#define PCAP_BIT_ADC1_MTR1 pbit(PCAP_REG_ADC1, (1 << 15))
++#define PCAP_BIT_ADC1_MTR2 pbit(PCAP_REG_ADC1, (1 << 16))
++#define PCAP_ADC1_TS_M_MASK 0x000e0000
++#define PCAP_ADC1_TS_M_SHIFT 17
++#define PCAP_BIT_ADC1_TS_REF_LOWPWR pbit(PCAP_REG_ADC1, (1 << 20))
++#define PCAP_BIT_ADC1_TS_REFENB pbit(PCAP_REG_ADC1, (1 << 21))
++#define PCAP_BIT_ADC1_BATT_I_POLARITY pbit(PCAP_REG_ADC1, (1 << 22))
++#define PCAP_BIT_ADC1_BATT_I_ADC pbit(PCAP_REG_ADC1, (1 << 23))
++
++#define PCAP_ADC2_ADD1_MASK 0x000003ff
++#define PCAP_ADC2_ADD1_SHIFT 0
++#define PCAP_ADC2_ADD2_MASK 0x000ffc00
++#define PCAP_ADC2_ADD2_SHIFT 10
++#define PCAP_BIT_ADC2_ADINC1 pbit(PCAP_REG_ADC2, (1 << 20))
++#define PCAP_BIT_ADC2_ADINC2 pbit(PCAP_REG_ADC2, (1 << 21))
++#define PCAP_BIT_ADC2_ASC pbit(PCAP_REG_ADC2, (1 << 22))
++
++#define PCAP_BIT_BUSCTRL_FSENB 0x50000001
++#define PCAP_BIT_BUSCTRL_USB_SUSPEND 0x50000002
++#define PCAP_BIT_BUSCTRL_USB_PU 0x50000004
++#define PCAP_BIT_BUSCTRL_USB_PD 0x50000008
++#define PCAP_BIT_BUSCTRL_VUSB_EN 0x50000010
++#define PCAP_BIT_BUSCTRL_USB_PS 0x50000020
++#define PCAP_BIT_BUSCTRL_VUSB_MSTR_EN 0x50000040
++#define PCAP_BIT_BUSCTRL_VBUS_PD_ENB 0x50000080
++#define PCAP_BIT_BUSCTRL_CURRLIM 0x50000100
++#define PCAP_BIT_BUSCTRL_RS232ENB 0x50000200
++#define PCAP_BIT_BUSCTRL_RS232_DIR 0x50000400
++#define PCAP_BIT_BUSCTRL_SE0_CONN 0x50000800
++#define PCAP_BIT_BUSCTRL_USB_PDM 0x50001000
++#define PCAP_BIT_BUSCTRL_BUS_PRI_ADJ 0x51000000
++
++#define PCAP_BIT_PERIPH_BL_CTRL0 0x54000001
++#define PCAP_BIT_PERIPH_BL_CTRL1 0x54000002
++#define PCAP_BIT_PERIPH_BL_CTRL2 0x54000004
++#define PCAP_BIT_PERIPH_BL_CTRL3 0x54000008
++#define PCAP_BIT_PERIPH_BL_CTRL4 0x54000010
++#define PCAP_BIT_PERIPH_LEDR_EN 0x54000020
++#define PCAP_BIT_PERIPH_LEDG_EN 0x54000040
++#define PCAP_BIT_PERIPH_LEDR_CTRL0 0x54000080
++#define PCAP_BIT_PERIPH_LEDR_CTRL1 0x54000100
++#define PCAP_BIT_PERIPH_LEDR_CTRL2 0x54000200
++#define PCAP_BIT_PERIPH_LEDR_CTRL3 0x54000400
++#define PCAP_BIT_PERIPH_LEDG_CTRL0 0x54000800
++#define PCAP_BIT_PERIPH_LEDG_CTRL1 0x54001000
++#define PCAP_BIT_PERIPH_LEDG_CTRL2 0x54002000
++#define PCAP_BIT_PERIPH_LEDG_CTRL3 0x54004000
++#define PCAP_BIT_PERIPH_LEDR_I0 0x54008000
++#define PCAP_BIT_PERIPH_LEDR_I1 0x54010000
++#define PCAP_BIT_PERIPH_LEDG_I0 0x54020000
++#define PCAP_BIT_PERIPH_LEDG_I1 0x54040000
++#define PCAP_BIT_PERIPH_SKIP 0x54080000
++#define PCAP_BIT_PERIPH_BL2_CTRL0 0x54100000
++#define PCAP_BIT_PERIPH_BL2_CTRL1 0x54200000
++#define PCAP_BIT_PERIPH_BL2_CTRL2 0x54400000
++#define PCAP_BIT_PERIPH_BL2_CTRL3 0x54800000
++#define PCAP_BIT_PERIPH_BL2_CTRL4 0x55000000
++
++#define PCAP_BIT_LOWPWR_VAUX2_STBY 0x60000001
++#define PCAP_BIT_LOWPWR_VAUX2_LOWPWR 0x60000002
++#define PCAP_BIT_LOWPWR_VAUX3_STBY 0x60000004
++#define PCAP_BIT_LOWPWR_VAUX3_LOWPWR 0x60000008
++#define PCAP_BIT_LOWPWR_VAUX4_STBY 0x60000010
++#define PCAP_BIT_LOWPWR_VAUX4_LOWPWR 0x60000020
++#define PCAP_BIT_LOWPWR_VSIM_LOWPWR 0x60000040
++#define PCAP_BIT_LOWPWR_VSIM2_LOWPWR 0x60000080
++#define PCAP_BIT_LOWPWR_SW1_MODE00 0x60000100
++#define PCAP_BIT_LOWPWR_SW1_MODE01 0x60000200
++#define PCAP_BIT_LOWPWR_SW1_MODE10 0x60000400
++#define PCAP_BIT_LOWPWR_SW1_MODE11 0x60000800
++#define PCAP_BIT_LOWPWR_SW10_DVS 0x60001000
++#define PCAP_BIT_LOWPWR_SW11_DVS 0x60002000
++#define PCAP_BIT_LOWPWR_SW12_DVS 0x60004000
++#define PCAP_BIT_LOWPWR_SW13_DVS 0x60008000
++#define PCAP_BIT_LOWPWR_SW2_MODE00 0x60010000
++#define PCAP_BIT_LOWPWR_SW2_MODE01 0x60020000
++#define PCAP_BIT_LOWPWR_SW2_MODE10 0x60040000
++#define PCAP_BIT_LOWPWR_SW2_MODE11 0x60080000
++#define PCAP_BIT_LOWPWR_SW20_DVS 0x60100000
++#define PCAP_BIT_LOWPWR_SW21_DVS 0x60200000
++#define PCAP_BIT_LOWPWR_SW22_DVS 0x60400000
++#define PCAP_BIT_LOWPWR_SW23_DVS 0x60800000
++#define PCAP_BIT_LOWPWR_VC_STBY 0x61000000
++
++extern int ezx_pcap_write(u_int8_t, u_int32_t);
++extern int ezx_pcap_read(u_int8_t, u_int32_t *);
++extern int ezx_pcap_bit_set(u_int32_t, u_int8_t);
++extern int ezx_pcap_bit_get(u_int32_t);
++extern int ezx_pcap_read_bit(u_int32_t);
++extern void ezx_pcap_vibrator_level(u_int32_t);
++#endif
+Index: linux-2.6.23/include/asm-arm/arch-pxa/irqs.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/irqs.h 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/irqs.h 2007-10-23 15:18:28.000000000 +0200
+@@ -79,7 +79,7 @@
+ * within sensible limits.
+ */
+ #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM)
+-#define IRQ_BOARD_END (IRQ_BOARD_START + 16)
++#define IRQ_BOARD_END (IRQ_BOARD_START + 22)
+
+ #define IRQ_SA1111_START (IRQ_BOARD_END)
+ #define IRQ_GPAIN0 (IRQ_BOARD_END + 0)
+@@ -170,7 +170,8 @@
+ #define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1)
+ #elif defined(CONFIG_ARCH_LUBBOCK) || \
+ defined(CONFIG_MACH_LOGICPD_PXA270) || \
+- defined(CONFIG_MACH_MAINSTONE)
++ defined(CONFIG_MACH_MAINSTONE) || \
++ defined(CONFIG_PXA_EZX)
+ #define NR_IRQS (IRQ_BOARD_END)
+ #else
+ #define NR_IRQS (IRQ_BOARD_START)
+@@ -216,3 +217,28 @@
+ #define IRQ_LOCOMO_GPIO_BASE (IRQ_BOARD_START + 1)
+ #define IRQ_LOCOMO_LT_BASE (IRQ_BOARD_START + 2)
+ #define IRQ_LOCOMO_SPI_BASE (IRQ_BOARD_START + 3)
++
++/* EZX Interrupts (CONFIG_EZX) */
++#define EZX_IRQ(x) (IRQ_BOARD_START + (x))
++#define EZX_IRQ_USB4V EZX_IRQ(0) /* EMU */
++#define EZX_IRQ_USB1V EZX_IRQ(1) /* EMU */
++#define EZX_IRQ_HEADJACK EZX_IRQ(2) /* Audio connector */
++#define EZX_IRQ_MIC EZX_IRQ(3) /* Audio connector */
++#define EZX_IRQ_ADCDONE EZX_IRQ(4)
++#define EZX_IRQ_TS EZX_IRQ(5) /* TS touch */
++#define EZX_IRQ_ADCDONE2 EZX_IRQ(6) /* TS x/y ADC ready */
++#define EZX_IRQ_WH EZX_IRQ(7)
++#define EZX_IRQ_WL EZX_IRQ(8)
++#define EZX_IRQ_ONOFF EZX_IRQ(9)
++#define EZX_IRQ_ONOFF2 EZX_IRQ(10)
++#define EZX_IRQ_MOBPORT EZX_IRQ(11)
++#define EZX_IRQ_TODA EZX_IRQ(12)
++#define EZX_IRQ_1HZ EZX_IRQ(13)
++#define EZX_IRQ_MNEXB EZX_IRQ(14)
++#define EZX_IRQ_ST EZX_IRQ(15)
++#define EZX_IRQ_PC EZX_IRQ(16)
++#define EZX_IRQ_SYSRST EZX_IRQ(17)
++#define EZX_IRQ_SOFTRESET EZX_IRQ(18)
++#define EZX_IRQ_EOL EZX_IRQ(19)
++#define EZX_IRQ_CLK EZX_IRQ(20)
++#define EZX_IRQ_WARM EZX_IRQ(21)
+Index: linux-2.6.23/arch/arm/mach-pxa/Kconfig
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Kconfig 2007-10-23 15:18:28.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Kconfig 2007-10-23 15:38:53.000000000 +0200
+@@ -109,6 +109,9 @@
+ config EZX_BP
+ bool "BP Control code for EZX Platform"
+
++config EZX_PCAP
++ bool "PCAP Support"
++
+ endif
+
+ endmenu
+Index: linux-2.6.23/arch/arm/mach-pxa/Makefile
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/Makefile 2007-10-23 15:18:28.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/Makefile 2007-10-23 15:38:53.000000000 +0200
+@@ -26,6 +26,7 @@
+ obj-$(CONFIG_PXA_EZX_A1200) += ezx-a1200.o
+ obj-$(CONFIG_PXA_EZX_E6) += ezx-e6.o
+ obj-$(CONFIG_EZX_BP) += ezx-bp.o
++obj-$(CONFIG_EZX_PCAP) += ezx-pcap.o
+
+ # Support for blinky lights
+ led-y := leds.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-pm.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-pm.patch
new file mode 100644
index 0000000000..aa2d83b24e
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-pm.patch
@@ -0,0 +1,108 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/pxa27x.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/pxa27x.c 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/pxa27x.c 2007-10-23 12:25:34.000000000 +0200
+@@ -25,6 +25,10 @@
+ #include <asm/arch/pm.h>
+ #include <asm/arch/dma.h>
+
++#ifdef CONFIG_PXA_EZX
++#include <asm/arch/ezx.h>
++#endif
++
+ #include "generic.h"
+ #include "devices.h"
+
+@@ -192,7 +196,12 @@
+ void pxa27x_cpu_pm_restore(unsigned long *sleep_save)
+ {
+ /* ensure not to come back here if it wasn't intended */
++#ifdef CONFIG_PXA_EZX
++ *(unsigned long *)(phys_to_virt(RESUME_ADDR)) = 0;
++ *(unsigned long *)(phys_to_virt(FLAG_ADDR)) = OFF_FLAG;
++#else
+ PSPR = 0;
++#endif
+
+ /* restore registers */
+ RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1);
+@@ -242,7 +251,13 @@
+ break;
+ case PM_SUSPEND_MEM:
+ /* set resume return address */
++#ifdef CONFIG_PXA_EZX
++ /* set EZX flags for blob - WM */
++ *(unsigned long *)(phys_to_virt(RESUME_ADDR)) = virt_to_phys(pxa_cpu_resume);
++ *(unsigned long *)(phys_to_virt(FLAG_ADDR)) = SLEEP_FLAG;
++#else
+ PSPR = virt_to_phys(pxa_cpu_resume);
++#endif
+ pxa27x_cpu_suspend(PWRMODE_SLEEP);
+ break;
+ }
+Index: linux-2.6.23/arch/arm/mach-pxa/ezx.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/ezx.c 2007-10-23 12:23:34.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/ezx.c 2007-10-23 12:27:30.000000000 +0200
+@@ -19,6 +19,7 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/ohci.h>
+ #include <asm/arch/ezx.h>
++#include <asm/arch/system.h>
+
+ #include "generic.h"
+
+@@ -122,8 +123,53 @@
+ &ezxbp_device,
+ };
+
++/* PM */
++extern int bp_handshake_passed(void);
++
++static void ezx_reboot_poweroff(char mode)
++{
++ *(unsigned long *)(phys_to_virt(BPSIG_ADDR)) = NO_FLAG;
++ cpu_proc_fin();
++
++#ifdef CONFIG_EZX_BP
++ if (pxa_gpio_get_value(GPIO_BB_WDI) == 0) {
++ *(unsigned long *)(phys_to_virt(BPSIG_ADDR)) = WDI_FLAG;
++
++ /* reset BP */
++ pxa_gpio_set_value(GPIO_BB_RESET, 0);
++ mdelay(1);
++ pxa_gpio_set_value(GPIO_BB_RESET, 1);
++
++ if (mode == 'z') {
++ arch_reset('h');
++ while(1);
++ }
++ }
++#endif
++ if (mode == 'z')
++ /* Panic! Ask PCAP to turn both processors off */
++ pxa_gpio_set_value(GPIO_WDI_AP, 0);
++ else
++ arm_machine_restart(mode);
++
++ while(1);
++}
++
++static inline void ezx_poweroff(void)
++{
++ ezx_reboot_poweroff('z');
++}
++
++static inline void ezx_restart(char mode)
++{
++ ezx_reboot_poweroff(mode);
++}
++
+ static int __init ezx_init(void)
+ {
++ pm_power_off = ezx_poweroff;
++ arm_pm_restart = ezx_restart;
++
+ CKEN = (1 << CKEN_OSTIMER) | (1 << CKEN_MEMC);
+
+ pxa_gpio_mode(GPIO_ICL_FFRXD_MD);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/ezx-serial-bug-workaround.patch b/packages/linux/linux-ezx-2.6.23/patches/ezx-serial-bug-workaround.patch
new file mode 100644
index 0000000000..9f30cc35fe
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/ezx-serial-bug-workaround.patch
@@ -0,0 +1,45 @@
+Work around some errata in the pxa serial code (copied from motorolas 2.4.x tree)
+
+Index: linux-2.6.20.7/drivers/serial/pxa.c
+===================================================================
+--- linux-2.6.20.7.orig/drivers/serial/pxa.c 2007-04-21 13:57:46.000000000 -0300
++++ linux-2.6.20.7/drivers/serial/pxa.c 2007-04-21 14:05:03.000000000 -0300
+@@ -29,6 +29,10 @@
+ #define SUPPORT_SYSRQ
+ #endif
+
++#define pxa_buggy_port(x) ({ \
++ int cpu_ver; asm("mrc%? p15, 0, %0, c0, c0" : "=r" (cpu_ver)); \
++ ((x) == PORT_PXA && (cpu_ver & ~1) == 0x69052100); })
++
+ #include <linux/module.h>
+ #include <linux/ioport.h>
+ #include <linux/init.h>
+@@ -195,7 +199,7 @@
+ if (uart_circ_empty(xmit))
+ serial_pxa_stop_tx(&up->port);
+ }
+-
++static inline irqreturn_t serial_pxa_irq(int, void *);
+ static void serial_pxa_start_tx(struct uart_port *port)
+ {
+ struct uart_pxa_port *up = (struct uart_pxa_port *)port;
+@@ -203,6 +207,8 @@
+ if (!(up->ier & UART_IER_THRI)) {
+ up->ier |= UART_IER_THRI;
+ serial_out(up, UART_IER, up->ier);
++ if (pxa_buggy_port(up->port.type))
++ serial_pxa_irq(up->port.irq, NULL);
+ }
+ }
+
+@@ -298,6 +304,9 @@
+
+ mcr |= up->mcr;
+
++ if (pxa_buggy_port(up->port.type) && up->port.irq != 0)
++ mcr ^= UART_MCR_OUT2;
++
+ serial_out(up, UART_MCR, mcr);
+ }
+
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-fix-init-errorpath.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-init-errorpath.patch
new file mode 100644
index 0000000000..716ef86fd1
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-init-errorpath.patch
@@ -0,0 +1,20 @@
+Index: linux-2.6.16/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux_usb.c 2007-01-17 00:10:32.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux_usb.c 2007-01-17 00:42:23.000000000 +0100
+@@ -811,7 +811,6 @@
+ /*init the related mux interface*/
+ if (!(bvd_ipc = kzalloc(sizeof(struct ipc_usb_data), GFP_KERNEL))) {
+ err("usb_ipc_init: Out of memory.");
+- usb_deregister(&usb_ipc_driver);
+ return -ENOMEM;
+ }
+ bvd_dbg("usb_ipc_init: Address of bvd_ipc:%p", bvd_ipc);
+@@ -819,7 +818,6 @@
+ if (!(bvd_ipc->xmit.buf = kmalloc(IPC_USB_XMIT_SIZE, GFP_KERNEL))) {
+ err("usb_ipc_init: Not enough memory for the input buffer.");
+ kfree(bvd_ipc);
+- usb_deregister(&usb_ipc_driver);
+ return -ENOMEM;
+ }
+ bvd_dbg("usb_ipc_init: bvd_ipc->xmit.buf address:%p",
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-fix-makefile.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-makefile.patch
new file mode 100644
index 0000000000..9e5ae18263
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-makefile.patch
@@ -0,0 +1,14 @@
+Index: linux-2.6.23/drivers/char/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/char/Makefile 2007-10-22 22:26:50.000000000 +0200
++++ linux-2.6.23/drivers/char/Makefile 2007-10-22 22:26:59.000000000 +0200
+@@ -111,7 +111,8 @@
+ obj-$(CONFIG_JS_RTC) += js-rtc.o
+ js-rtc-y = rtc.o
+
+-obj-$(CONFIG_TS0710_MUX) += ts0710_mux.o ts0710_mux_usb.o
++obj-$(CONFIG_TS0710_MUX_USB) += ts0710_mux_usb.o
++obj-$(CONFIG_TS0710_MUX) += ts0710_mux.o
+
+
+ # Files generated that shall be removed upon make clean
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-fix-tty-driver.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-tty-driver.patch
new file mode 100644
index 0000000000..2e1aabd952
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-fix-tty-driver.patch
@@ -0,0 +1,125 @@
+Index: linux-2.6.20.7/drivers/char/ts0710_mux.c
+===================================================================
+--- linux-2.6.20.7.orig/drivers/char/ts0710_mux.c 2007-04-22 10:51:31.000000000 +0200
++++ linux-2.6.20.7/drivers/char/ts0710_mux.c 2007-04-22 10:53:05.000000000 +0200
+@@ -241,7 +241,8 @@
+ static volatile __u8 mux_recv_info_flags[NR_MUXS];
+ static mux_recv_struct *mux_recv_queue = NULL;
+
+-static struct tty_driver mux_driver;
++// Local for 2.6?
++static struct tty_driver *mux_driver;
+
+ #ifdef USB_FOR_MUX
+ #define COMM_FOR_MUX_DRIVER usb_for_mux_driver
+@@ -3007,6 +3008,7 @@
+ #else
+ mux_tty[line]++;
+ dlci = tty2dlci[line];
++ mux_table[line] = tty;
+
+ /* if( dlci == 1 ) { */
+ /* Open server channel 0 first */
+@@ -3087,6 +3089,7 @@
+ }
+ }
+
++
+ retval = 0;
+ #endif
+ out:
+@@ -3894,43 +3897,50 @@
+ INIT_WORK(&receive_tqueue, receive_worker, NULL);
+ INIT_WORK(&post_recv_tqueue, post_recv_worker, NULL);
+
+- memset(&mux_driver, 0, sizeof(struct tty_driver));
+- memset(&mux_tty, 0, sizeof(mux_tty));
+- mux_driver.magic = TTY_DRIVER_MAGIC;
+- mux_driver.driver_name = "ts0710mux";
+- mux_driver.name = "ts0710mux";
+- mux_driver.major = TS0710MUX_MAJOR;
+- mux_driver.minor_start = TS0710MUX_MINOR_START;
+- mux_driver.num = NR_MUXS;
+- mux_driver.type = TTY_DRIVER_TYPE_SERIAL;
+- mux_driver.subtype = SERIAL_TYPE_NORMAL;
+- mux_driver.init_termios = tty_std_termios;
+- mux_driver.init_termios.c_iflag = 0;
+- mux_driver.init_termios.c_oflag = 0;
+- mux_driver.init_termios.c_cflag = B38400 | CS8 | CREAD;
+- mux_driver.init_termios.c_lflag = 0;
+- mux_driver.flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
+-
+- mux_driver.ttys = mux_table;
+- mux_driver.termios = mux_termios;
+- mux_driver.termios_locked = mux_termios_locked;
++ mux_driver = alloc_tty_driver(NR_MUXS);
++ if (!mux_driver)
++ return -ENOMEM;
++
++ mux_driver->owner = THIS_MODULE;
++ mux_driver->driver_name = "ts0710mux";
++ mux_driver->name = "mux";
++ mux_driver->devfs_name = "mux";
++ mux_driver->major = TS0710MUX_MAJOR;
++ mux_driver->minor_start = TS0710MUX_MINOR_START;
++ mux_driver->type = TTY_DRIVER_TYPE_SERIAL;
++ mux_driver->subtype = SERIAL_TYPE_NORMAL;
++ mux_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
++
++ mux_driver->init_termios = tty_std_termios;
++ mux_driver->init_termios.c_iflag = 0;
++ mux_driver->init_termios.c_oflag = 0;
++ mux_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
++ mux_driver->init_termios.c_lflag = 0;
++
++// mux_driver.ttys = mux_table;
++ mux_driver->termios = mux_termios;
++ mux_driver->termios_locked = mux_termios_locked;
+ // mux_driver.driver_state = mux_state;
+- mux_driver.other = NULL;
++ mux_driver->other = NULL;
+
+- mux_driver.open = mux_open;
+- mux_driver.close = mux_close;
+- mux_driver.write = mux_write;
+- mux_driver.write_room = mux_write_room;
+- mux_driver.flush_buffer = mux_flush_buffer;
+- mux_driver.chars_in_buffer = mux_chars_in_buffer;
+- mux_driver.throttle = mux_throttle;
+- mux_driver.unthrottle = mux_unthrottle;
+- mux_driver.ioctl = mux_ioctl;
+- mux_driver.owner = THIS_MODULE;
++ mux_driver->open = mux_open;
++ mux_driver->close = mux_close;
++ mux_driver->write = mux_write;
++ mux_driver->write_room = mux_write_room;
++ mux_driver->flush_buffer = mux_flush_buffer;
++ mux_driver->chars_in_buffer = mux_chars_in_buffer;
++ mux_driver->throttle = mux_throttle;
++ mux_driver->unthrottle = mux_unthrottle;
++ mux_driver->ioctl = mux_ioctl;
+
+- if (tty_register_driver(&mux_driver))
++ // FIXME: No panic() here
++ if (tty_register_driver(mux_driver))
+ panic("Couldn't register mux driver");
+
++ for (j=0; j<NR_MUXS; j++)
++ tty_register_device(mux_driver, j, NULL);
++
++
+ COMM_MUX_DISPATCHER = mux_dispatcher;
+ COMM_MUX_SENDER = mux_sender;
+
+@@ -3964,7 +3974,10 @@
+ mux_recv_info[j] = 0;
+ }
+
+- if (tty_unregister_driver(&mux_driver))
++ for (j=0; j<NR_MUXS; j++)
++ tty_unregister_device(mux_driver, j);
++
++ if (tty_unregister_driver(mux_driver))
+ panic("Couldn't unregister mux driver");
+ }
+
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-fix.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-fix.patch
new file mode 100644
index 0000000000..b820762f41
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-fix.patch
@@ -0,0 +1,164 @@
+Index: linux-2.6.20.7/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.20.7.orig/drivers/char/ts0710_mux_usb.c 2007-04-21 18:07:45.000000000 +0200
++++ linux-2.6.20.7/drivers/char/ts0710_mux_usb.c 2007-04-21 20:55:13.000000000 +0200
+@@ -626,7 +626,6 @@
+ }
+
+ interface = &intf->cur_altsetting->desc;
+- endpoint = &intf->cur_altsetting->endpoint[0].desc;
+ /* Start checking for two bulk endpoints or ... FIXME: This is a future
+ * enhancement...*/
+ bvd_dbg("usb_ipc_probe: Number of Endpoints:%d",
+@@ -638,30 +637,26 @@
+
+ ep_cnt = have_bulk_in_mux = have_bulk_out_mux = 0;
+
+- bvd_dbg("usb_ipc_probe: endpoint[0] is:%x",
+- (&endpoint[0])->bEndpointAddress);
+- bvd_dbg("usb_ipc_probe: endpoint[1] is:%x ",
+- (&endpoint[1])->bEndpointAddress);
+-
+ while (ep_cnt < interface->bNumEndpoints) {
+-
+- if (!have_bulk_in_mux && IS_EP_BULK_IN(endpoint[ep_cnt])) {
+- bvd_dbg("usb_ipc_probe: bEndpointAddress(IN) is:%x ",
+- (&endpoint[ep_cnt])->bEndpointAddress);
+- have_bulk_in_mux =
+- (&endpoint[ep_cnt])->bEndpointAddress;
+- readsize = (&endpoint[ep_cnt])->wMaxPacketSize;
++ endpoint = &intf->cur_altsetting->endpoint[ep_cnt].desc;
++ bvd_dbg("usb_ipc_probe: endpoint[%i] is: %x", ep_cnt,
++ endpoint->bEndpointAddress);
++
++ if (!have_bulk_in_mux && IS_EP_BULK_IN(*endpoint)) {
++ bvd_dbg("usb_ipc_probe: bEndpointAddress(IN) is: %x ",
++ endpoint->bEndpointAddress);
++ have_bulk_in_mux = endpoint->bEndpointAddress;
++ readsize = endpoint->wMaxPacketSize;
+ bvd_dbg("usb_ipc_probe: readsize=%d", readsize);
+ ep_cnt++;
+ continue;
+ }
+
+- if (!have_bulk_out_mux && IS_EP_BULK_OUT(endpoint[ep_cnt])) {
+- bvd_dbg("usb_ipc_probe: bEndpointAddress(OUT) is:%x ",
+- (&endpoint[ep_cnt])->bEndpointAddress);
+- have_bulk_out_mux =
+- (&endpoint[ep_cnt])->bEndpointAddress;
+- writesize = (&endpoint[ep_cnt])->wMaxPacketSize;
++ if (!have_bulk_out_mux && IS_EP_BULK_OUT(*endpoint)) {
++ bvd_dbg("usb_ipc_probe: bEndpointAddress(OUT) is: %x ",
++ endpoint->bEndpointAddress);
++ have_bulk_out_mux = endpoint->bEndpointAddress;
++ writesize = endpoint->wMaxPacketSize;
+ bvd_dbg("usb_ipc_probe: writesize=%d", writesize);
+ ep_cnt++;
+ continue;
+@@ -718,21 +713,27 @@
+ bvd_ipc->bh_bp.func = usbipc_bh_bp_func;
+ bvd_ipc->bh_bp.data = (unsigned long) bvd_ipc;
+
++ bvd_dbg("after assignements");
+ /*Build a write urb*/
++ usb_init_urb(&bvd_ipc->writeurb_mux);
+ usb_fill_bulk_urb(&bvd_ipc->writeurb_mux, usbdev,
+ usb_sndbulkpipe(bvd_ipc->ipc_dev,
+ bvd_ipc->bulk_out_ep_mux),
+ bvd_ipc->obuf, writesize, usb_ipc_write_bulk,
+ bvd_ipc);
+ //bvd_ipc->writeurb_mux.transfer_flags |= USB_ASYNC_UNLINK;
++ bvd_dbg("after write urb");
+
+ /*Build a read urb and send a IN token first time*/
++ usb_init_urb(&bvd_ipc->readurb_mux);
+ usb_fill_bulk_urb(&bvd_ipc->readurb_mux, usbdev,
+ usb_rcvbulkpipe(usbdev, bvd_ipc->bulk_in_ep_mux),
+ bvd_ipc->ibuf, readsize, usb_ipc_read_bulk, bvd_ipc);
+ //bvd_ipc->readurb_mux.transfer_flags |= USB_ASYNC_UNLINK;
++ bvd_dbg("after read urb");
+
+- usb_driver_claim_interface(&usb_ipc_driver, intf, bvd_ipc);
++ //usb_driver_claim_interface(&usb_ipc_driver, intf, bvd_ipc);
++ bvd_dbg("after claim interface");
+ //usb_driver_claim_interface(&usb_ipc_driver, &ipccfg->interface[1], bvd_ipc);
+
+ // a2590c: dsplog is not supported by this driver
+@@ -740,6 +741,8 @@
+ // &ipccfg->interface[2], bvd_ipc);
+ /*send a IN token first time*/
+ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
++ bvd_dbg("after assignement");
++
+ if (usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC))
+ printk("usb_ipc_prob: usb_submit_urb(read mux bulk) failed!\n");
+
+@@ -750,7 +753,7 @@
+ tasklet_schedule(&bvd_ipc->bh);
+ }
+
+- printk("usb_ipc_probe: completed probe!");
++ printk("usb_ipc_probe: completed probe!\n");
+ usb_set_intfdata(intf, &bvd_ipc);
+ return 0;
+ }
+@@ -760,21 +763,23 @@
+ //struct usb_device *usbdev = interface_to_usbdev(intf);
+ struct ipc_usb_data *bvd_ipc_disconnect = usb_get_intfdata(intf);
+
+- printk("usb_ipc_disconnect:*** \n");
+
++ printk("usb_ipc_disconnect. bvd_ipc_disconnect address: %p\n", bvd_ipc_disconnect);
++
++ //FIXME: Memory leak?
+ if ((UHCRHPS3 & 0x4) == 0)
+- usb_unlink_urb(&bvd_ipc_disconnect->readurb_mux);
++ // usb_unlink_urb(&bvd_ipc_disconnect->readurb_mux);
+
+- usb_unlink_urb(&bvd_ipc_disconnect->writeurb_mux);
++ //usb_unlink_urb(&bvd_ipc_disconnect->writeurb_mux);
+
+ bvd_ipc_disconnect->ipc_flag = IPC_USB_PROBE_NOT_READY;
+ kfree(bvd_ipc_disconnect->ibuf);
+ kfree(bvd_ipc_disconnect->obuf);
+
+- usb_driver_release_interface(&usb_ipc_driver,
+- bvd_ipc_disconnect->ipc_dev->actconfig->interface[0]);
+- usb_driver_release_interface(&usb_ipc_driver,
+- bvd_ipc_disconnect->ipc_dev->actconfig->interface[1]);
++ //usb_driver_release_interface(&usb_ipc_driver,
++ // bvd_ipc_disconnect->ipc_dev->actconfig->interface[0]);
++ //usb_driver_release_interface(&usb_ipc_driver,
++ // bvd_ipc_disconnect->ipc_dev->actconfig->interface[1]);
+
+ //a2590c: dsplog interface is not supported by this driver
+ //usb_driver_release_interface(&usb_ipc_driver, &bvd_ipc_disconnect->ipc_dev->actconfig->interface[2]);
+@@ -803,13 +808,6 @@
+ int result;
+
+ bvd_dbg("init usb_ipc");
+- /* register driver at the USB subsystem */
+- result = usb_register(&usb_ipc_driver);
+- if (result < 0) {
+- err ("usb ipc driver could not be registered");
+- return result;
+- }
+-
+ /*init the related mux interface*/
+ if (!(bvd_ipc = kzalloc(sizeof(struct ipc_usb_data), GFP_KERNEL))) {
+ err("usb_ipc_init: Out of memory.");
+@@ -836,6 +834,14 @@
+ usb_for_mux_driver = &ipcusb_tty_driver;
+ usb_for_mux_tty = &ipcusb_tty;
+
++ /* register driver at the USB subsystem */
++ // this was called before bvd_ipc was allocated
++ result = usb_register(&usb_ipc_driver);
++ if (result < 0) {
++ err ("usb ipc driver could not be registered");
++ return result;
++ }
++
+ /* init timers for ipcusb read process and usb suspend */
+ init_timer(&ipcusb_timer);
+ ipcusb_timer.function = ipcusb_timeout;
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-ifdef-ezx-features.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-ifdef-ezx-features.patch
new file mode 100644
index 0000000000..a3a6a8249a
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-ifdef-ezx-features.patch
@@ -0,0 +1,99 @@
+Index: linux-2.6.21/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.21.orig/drivers/char/ts0710_mux_usb.c 2007-09-28 23:37:33.000000000 +0200
++++ linux-2.6.21/drivers/char/ts0710_mux_usb.c 2007-09-28 23:37:45.000000000 +0200
+@@ -35,10 +35,14 @@
+ #include <linux/list.h>
+ #include <linux/errno.h>
+ #include <asm/uaccess.h>
++
++#ifdef CONFIG_PXA_EZX
+ #include <asm/hardware.h>
+ #include <asm/arch/hardware.h>
+ #include <asm/arch-pxa/pxa-regs.h>
+ #include <asm/arch-pxa/ezx.h>
++#endif
++
+ #include <linux/slab.h>
+ #include <linux/miscdevice.h>
+ #include <linux/init.h>
+@@ -341,8 +345,10 @@
+
+ static void wakeup_timeout(unsigned long data)
+ {
++#ifdef CONFIG_PXA_EZX
+ GPSR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
+ bvd_dbg("wakup_timeout: send GPIO_MCU_INT_SW signal!");
++#endif
+ }
+
+ static void suspend_timeout(unsigned long data)
+@@ -353,10 +359,12 @@
+ bvd_dbg("suspend_timeout: add the suspend timer again");
+ } else {
+ unlink_urbs(&bvd_ipc->readurb_mux);
++#ifdef CONFIG_PXA_EZX
+ UHCRHPS3 = 0x4;
+ mdelay(40);
+ bvd_dbg("suspend_timeout: send SUSPEND signal! UHCRHPS3=0x%x",
+ UHCRHPS3);
++#endif
+ }
+ }
+
+@@ -404,6 +412,7 @@
+ bvd_ipc->writeurb_mux.transfer_buffer_length = buf_num;
+ bvd_dbg("ipcusb_xmit_data: copy data to write urb finished! ");
+
++#ifdef CONFIG_PXA_EZX
+ if ((UHCRHPS3 & 0x4) == 0x4) {
+ static int ret;
+ int time = 0;
+@@ -442,6 +451,7 @@
+ "failed! status=%d\n", ret);
+ bvd_dbg("ipcusb_xmit_data: Send a IN token successfully!");
+ }
++#endif
+
+ sumbit_times++;
+ bvd_ipc->write_finished_flag = 0;
+@@ -464,12 +474,16 @@
+
+ static void usbipc_bh_bp_func(unsigned long param)
+ {
++#ifdef CONFIG_PXA_EZX
+ if ((UHCRHPS3 & 0x4) == 0x4) {
+ UHCRHPS3 = 0x8;
++#endif
+ mdelay(40);
++#ifdef CONFIG_PXA_EZX
+ bvd_dbg("ipcusb_softint_send_readurb: Send RESUME signal! "
+ "UHCRHPS3=0x%x", UHCRHPS3);
+ }
++#endif
+ if (bvd_ipc->ipc_flag == IPC_USB_PROBE_READY) {
+ //get_halted_bit();
+
+@@ -735,7 +749,9 @@
+ printk("usb_ipc_disconnect. bvd_ipc_disconnect address: %p\n", bvd_ipc_disconnect);
+
+ //FIXME: Memory leak?
++#ifdef CONFIG_PXA_EZX
+ if ((UHCRHPS3 & 0x4) == 0)
++#endif
+ // usb_unlink_urb(&bvd_ipc_disconnect->readurb_mux);
+
+ //usb_unlink_urb(&bvd_ipc_disconnect->writeurb_mux);
+Index: linux-2.6.21/drivers/char/Kconfig
+===================================================================
+--- linux-2.6.21.orig/drivers/char/Kconfig 2007-09-29 10:52:18.000000000 +0200
++++ linux-2.6.21/drivers/char/Kconfig 2007-09-29 10:52:30.000000000 +0200
+@@ -1073,7 +1073,7 @@
+
+ config TS0710_MUX
+ tristate "GSM TS 07.10 Multiplex driver"
+- depends on EZX_BP
++ depends on EZX_BP || X86
+ help
+ This implements the GSM 07.10 multiplex.
+
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-linux-2.6.21-fix.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-linux-2.6.21-fix.patch
new file mode 100644
index 0000000000..8d5299e3bd
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-linux-2.6.21-fix.patch
@@ -0,0 +1,297 @@
+Index: linux-2.6.21/drivers/char/ts0710.h
+===================================================================
+--- linux-2.6.21.orig/drivers/char/ts0710.h 2007-04-27 20:35:44.000000000 -0300
++++ linux-2.6.21/drivers/char/ts0710.h 2007-04-27 20:36:03.000000000 -0300
+@@ -45,7 +45,6 @@
+ * 11/18/2002 Modified
+ */
+
+-#include <linux/config.h>
+ #include <linux/module.h>
+
+ #include <linux/errno.h>
+@@ -58,7 +57,6 @@
+ #include <linux/major.h>
+ #include <linux/mm.h>
+ #include <linux/init.h>
+-#include <linux/devfs_fs_kernel.h>
+
+ #include <asm/uaccess.h>
+ #include <asm/system.h>
+Index: linux-2.6.21/drivers/char/ts0710_mux.c
+===================================================================
+--- linux-2.6.21.orig/drivers/char/ts0710_mux.c 2007-04-27 20:35:44.000000000 -0300
++++ linux-2.6.21/drivers/char/ts0710_mux.c 2007-04-27 20:36:03.000000000 -0300
+@@ -46,7 +46,6 @@
+ * 11/18/2002 Second version
+ * 04/21/2004 Add GPRS PROC
+ */
+-#include <linux/config.h>
+ #include <linux/module.h>
+ #include <linux/types.h>
+
+@@ -70,15 +69,12 @@
+ #include <linux/mm.h>
+ #include <linux/slab.h>
+ #include <linux/init.h>
+-#include <linux/devfs_fs_kernel.h>
+-//#include <syslog.h>
+
+ #include <asm/uaccess.h>
+ #include <asm/system.h>
+ #include <asm/bitops.h>
+
+ #ifdef USB_FOR_MUX
+-//#include <linux/usb.h>
+ #include "ts0710_mux_usb.h"
+ #endif
+
+@@ -268,8 +264,8 @@
+ static struct work_struct post_recv_tqueue;
+
+ static struct tty_struct *mux_table[NR_MUXS];
+-static struct termios *mux_termios[NR_MUXS];
+-static struct termios *mux_termios_locked[NR_MUXS];
++static struct ktermios *mux_termios[NR_MUXS];
++static struct ktermios *mux_termios_locked[NR_MUXS];
+ static volatile short int mux_tty[NR_MUXS];
+
+ #ifdef min
+@@ -1894,11 +1890,7 @@
+ if (test_bit(TTY_THROTTLED, &tty->flags)) {
+ queue_data = 1;
+ } else {
+- if (test_bit
+- (TTY_DONT_FLIP, &tty->flags)) {
+- queue_data = 1;
+- post_recv = 1;
+- } else if (recv_info->total) {
++ if (recv_info->total) {
+ queue_data = 1;
+ post_recv = 1;
+ } else if (recv_room < uih_len) {
+@@ -3149,10 +3141,10 @@
+
+ /*For BP UART problem End*/
+
+-static void receive_worker(void *private_)
++static void receive_worker(struct work_struct *work)
+ {
+ struct tty_struct *tty = COMM_FOR_MUX_TTY;
+- int i, count, tbuf_free, tbuf_read;
++ int count, tbuf_free, tbuf_read;
+ static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
+ static unsigned char *tbuf_ptr = &tbuf[0];
+ static unsigned char *start_flag = 0;
+@@ -3168,7 +3160,7 @@
+ __u32 uih_len;
+ /*For BP UART problem End */
+
+- UNUSED_PARAM(private_);
++ UNUSED_PARAM(work);
+
+ if (!tty)
+ return;
+@@ -3440,7 +3432,7 @@
+ clear_bit(RECV_RUNNING, &mux_recv_flags);
+ }
+
+-static void post_recv_worker(void *private_)
++static void post_recv_worker(struct work_struct *work)
+ {
+ ts0710_con *ts0710 = &ts0710_connection;
+ int tty_idx;
+@@ -3453,7 +3445,7 @@
+ mux_recv_packet *recv_packet, *recv_packet2;
+ __u8 j;
+
+- UNUSED_PARAM(private_);
++ UNUSED_PARAM(work);
+
+ if (test_and_set_bit(RECV_RUNNING, &mux_recv_flags)) {
+ schedule_work(&post_recv_tqueue);
+@@ -3499,10 +3491,6 @@
+ if (test_bit(TTY_THROTTLED, &tty->flags)) {
+ add_post_recv_queue(&post_recv_q, recv_info);
+ continue;
+- } else if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
+- post_recv = 1;
+- add_post_recv_queue(&post_recv_q, recv_info);
+- continue;
+ }
+
+ flow_control = 0;
+@@ -3635,7 +3623,7 @@
+ }
+ }
+
+-static void send_worker(void *private_)
++static void send_worker(struct work_struct *work)
+ {
+ ts0710_con *ts0710 = &ts0710_connection;
+ __u8 j;
+@@ -3644,7 +3632,7 @@
+ struct tty_struct *tty;
+ __u8 dlci;
+
+- UNUSED_PARAM(private_);
++ UNUSED_PARAM(work);
+
+ TS0710_DEBUG("Enter into send_worker");
+
+@@ -3819,7 +3807,8 @@
+ gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].sentBytes =
+ get_count(TS0710MUX_GPRS2_SEND_COUNT_IDX);
+
+- copy_to_user(buf, gprsData, bufLen);
++ if(copy_to_user(buf, gprsData, bufLen))
++ return -EFAULT;
+
+ return bufLen;
+ }
+@@ -3836,7 +3825,8 @@
+
+ memset(gprsData, 0, bufLen);
+
+- copy_from_user(gprsData, buf, bufLen);
++ if(copy_from_user(gprsData, buf, bufLen))
++ return -EFAULT;
+
+ set_count(TS0710MUX_GPRS1_RECV_COUNT_IDX, gprsData[0].recvBytes);
+ set_count(TS0710MUX_GPRS1_SEND_COUNT_IDX, gprsData[0].sentBytes);
+@@ -3893,9 +3883,9 @@
+ }
+ post_recv_count_flag = 0;
+
+- INIT_WORK(&send_tqueue, send_worker, NULL);
+- INIT_WORK(&receive_tqueue, receive_worker, NULL);
+- INIT_WORK(&post_recv_tqueue, post_recv_worker, NULL);
++ INIT_WORK(&send_tqueue, send_worker);
++ INIT_WORK(&receive_tqueue, receive_worker);
++ INIT_WORK(&post_recv_tqueue, post_recv_worker);
+
+ mux_driver = alloc_tty_driver(NR_MUXS);
+ if (!mux_driver)
+@@ -3904,12 +3894,11 @@
+ mux_driver->owner = THIS_MODULE;
+ mux_driver->driver_name = "ts0710mux";
+ mux_driver->name = "mux";
+- mux_driver->devfs_name = "mux";
+ mux_driver->major = TS0710MUX_MAJOR;
+ mux_driver->minor_start = TS0710MUX_MINOR_START;
+ mux_driver->type = TTY_DRIVER_TYPE_SERIAL;
+ mux_driver->subtype = SERIAL_TYPE_NORMAL;
+- mux_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
++ mux_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
+
+ mux_driver->init_termios = tty_std_termios;
+ mux_driver->init_termios.c_iflag = 0;
+@@ -3917,10 +3906,10 @@
+ mux_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
+ mux_driver->init_termios.c_lflag = 0;
+
+-// mux_driver.ttys = mux_table;
++ //mux_driver.ttys = mux_table;
+ mux_driver->termios = mux_termios;
+ mux_driver->termios_locked = mux_termios_locked;
+-// mux_driver.driver_state = mux_state;
++ //mux_driver.driver_state = mux_state;
+ mux_driver->other = NULL;
+
+ mux_driver->open = mux_open;
+Index: linux-2.6.21/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.21.orig/drivers/char/ts0710_mux_usb.c 2007-04-27 20:35:44.000000000 -0300
++++ linux-2.6.21/drivers/char/ts0710_mux_usb.c 2007-04-27 22:34:31.000000000 -0300
+@@ -188,7 +188,8 @@
+ buf_list_t *inbuf;
+ int count = urb->actual_length;
+
+- inbuf = kmalloc(sizeof(buf_list_t), GFP_KERNEL);
++ // we are called from interrupt context.
++ inbuf = kmalloc(sizeof(buf_list_t), GFP_ATOMIC);
+ if (!inbuf) {
+ printk("append_to_inbuf_list: (%d) out of memory!\n",
+ sizeof(buf_list_t));
+@@ -196,7 +197,7 @@
+ }
+
+ inbuf->size = count;
+- inbuf->body = kmalloc(sizeof(char)*count, GFP_KERNEL);
++ inbuf->body = kmalloc(sizeof(char)*count, GFP_ATOMIC);
+ if (!inbuf->body) {
+ kfree(inbuf);
+ printk("append_to_inbuf_list: (%d) out of memory!\n",
+@@ -222,7 +223,7 @@
+ inbuf = list_entry(ptr, buf_list_t, list);
+ src_count = inbuf->size;
+ if (dst_count >= src_count) {
+- memcpy(buf, inbuf->body, src_count);
++ memcpy((unsigned char *)buf, inbuf->body, src_count);
+ ret = src_count;
+ list_del(ptr);
+ kfree(inbuf->body);
+@@ -282,9 +283,8 @@
+ spin_unlock(&bvd_ipc->in_buf_lock);
+ }
+
+-static void usb_ipc_read_bulk(struct urb *urb, struct pt_regs *regs)
++static void usb_ipc_read_bulk(struct urb *urb)
+ {
+- buf_list_t *inbuf;
+ int count = urb->actual_length;
+ struct tty_struct *tty = &ipcusb_tty;
+
+@@ -319,7 +319,7 @@
+ bvd_dbg("usb_ipc_read_bulk: completed!!!");
+ }
+
+-static void usb_ipc_write_bulk(struct urb *urb, struct pt_regs *regs)
++static void usb_ipc_write_bulk(struct urb *urb)
+ {
+ callback_times++;
+ bvd_ipc->write_finished_flag = 1;
+@@ -437,7 +437,7 @@
+ /*send IN token*/
+ bvd_ipc->readurb_mux.actual_length = 0;
+ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
+- if (ret = usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC))
++ if ((ret = usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC)))
+ printk("ipcusb_xmit_data: usb_submit_urb(read mux bulk)"
+ "failed! status=%d\n", ret);
+ bvd_dbg("ipcusb_xmit_data: Send a IN token successfully!");
+@@ -447,7 +447,7 @@
+ bvd_ipc->write_finished_flag = 0;
+ //printk("%s: clear write_finished_flag:%d\n", __FUNCTION__, bvd_ipc->write_finished_flag);
+ bvd_ipc->writeurb_mux.dev = bvd_ipc->ipc_dev;
+- if (result = usb_submit_urb(&bvd_ipc->writeurb_mux, GFP_ATOMIC))
++ if ((result = usb_submit_urb(&bvd_ipc->writeurb_mux, GFP_ATOMIC)))
+ warn("ipcusb_xmit_data: funky result! result=%d\n", result);
+
+ bvd_dbg("ipcusb_xmit_data: usb_submit_urb finished! result:%d", result);
+@@ -498,7 +498,7 @@
+ return 0;
+
+ if (*ipcusb_ap_to_bp != NULL)
+- (*ipcusb_ap_to_bp)(buf, count);
++ (*ipcusb_ap_to_bp)((unsigned char *)buf, count);
+
+ bvd_ipc->suspend_flag = 1;
+
+@@ -602,6 +602,7 @@
+ }
+
+ ep_cnt = have_bulk_in_mux = have_bulk_out_mux = 0;
++ readsize = writesize = 0;
+
+ while (ep_cnt < interface->bNumEndpoints) {
+ endpoint = &intf->cur_altsetting->endpoint[ep_cnt].desc;
+@@ -792,6 +793,8 @@
+ bvd_ipc->ipc_dev = NULL;
+ bvd_ipc->xmit.head = bvd_ipc->xmit.tail = 0;
+ bvd_ipc->write_flag = IPC_USB_WRITE_INIT;
++ spin_lock_init(&bvd_ipc->lock);
++ spin_lock_init(&bvd_ipc->in_buf_lock);
+
+ ipcusb_tty_driver.write = usb_ipc_write;
+ ipcusb_tty_driver.chars_in_buffer = usb_ipc_chars_in_buffer;
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-remove-flipbuffers.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-flipbuffers.patch
new file mode 100644
index 0000000000..d4781f9fc7
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-flipbuffers.patch
@@ -0,0 +1,269 @@
+Index: linux-2.6.16/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux_usb.c 2007-01-17 00:52:25.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux_usb.c 2007-01-17 00:52:26.000000000 +0100
+@@ -133,6 +133,7 @@
+
+ struct circ_buf xmit; /* write cric bufffer */
+ struct list_head in_buf_list;
++ spinlock_t in_buf_lock;
+ char bulk_in_ep_mux,
+ bulk_out_ep_mux,
+ bulk_in_ep_dsplog;
+@@ -204,9 +205,39 @@
+ return;
+ }
+ memcpy(inbuf->body, (unsigned char*)urb->transfer_buffer, count);
++ spin_lock(&bvd_ipc->in_buf_lock);
+ list_add_tail(&inbuf->list, &bvd_ipc->in_buf_list);
++ spin_unlock(&bvd_ipc->in_buf_lock);
+ }
+
++int get_from_inbuf_list(const unsigned char *buf, int dst_count)
++{
++ int ret = 0;
++ spin_lock(&bvd_ipc->in_buf_lock);
++ if (!(list_empty(&bvd_ipc->in_buf_list))) {
++ int src_count;
++ buf_list_t *inbuf;
++ struct list_head *ptr;
++
++ ptr = bvd_ipc->in_buf_list.next;
++ inbuf = list_entry(ptr, buf_list_t, list);
++ src_count = inbuf->size;
++ if (dst_count >= src_count) {
++ memcpy(buf, inbuf->body, src_count);
++ ret = src_count;
++ list_del(ptr);
++ kfree(inbuf->body);
++ kfree(inbuf);
++ } else {
++ bvd_dbg("get_from_inbuf_list: not enough space in destination buffer");
++ }
++ }
++ spin_unlock(&bvd_ipc->in_buf_lock);
++
++ return ret;
++}
++EXPORT_SYMBOL(get_from_inbuf_list);
++
+ static void ipcusb_timeout(unsigned long data)
+ {
+ struct tty_struct *tty = &ipcusb_tty;
+@@ -214,13 +245,14 @@
+
+ bvd_dbg("ipcusb_timeout***");
+
++ spin_lock(&bvd_ipc->in_buf_lock);
+ while (!(list_empty(&bvd_ipc->in_buf_list))) {
+ int count;
+ buf_list_t *inbuf;
+ struct list_head *ptr = NULL;
+
+ ptr = bvd_ipc->in_buf_list.next;
+- inbuf = list_entry (ptr, buf_list_t, list);
++ inbuf = list_entry(ptr, buf_list_t, list);
+ count = inbuf->size;
+ if (tty_insert_flip_string(tty, inbuf->body, count) >= count) {
+ list_del(ptr);
+@@ -232,10 +264,12 @@
+ break;
+ }
+ }
++ spin_unlock(&bvd_ipc->in_buf_lock);
+
+ if (usb_mux_dispatcher)
+ usb_mux_dispatcher(tty); /**call Liu changhui's func.**/
+
++ spin_lock(&bvd_ipc->in_buf_lock);
+ if (list_empty(&bvd_ipc->in_buf_list)) {
+ urb->actual_length = 0;
+ urb->dev = bvd_ipc->ipc_dev;
+@@ -246,6 +280,7 @@
+ ipcusb_timer.data = (unsigned long)urb;
+ mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
+ }
++ spin_unlock(&bvd_ipc->in_buf_lock);
+ }
+
+ static void usb_ipc_read_bulk(struct urb *urb, struct pt_regs *regs)
+@@ -266,69 +301,11 @@
+ if (count > 0 && ((*ipcusb_bp_to_ap) != NULL))
+ (*ipcusb_bp_to_ap)(urb->transfer_buffer, urb->actual_length);
+
+- if (!(list_empty(&bvd_ipc->in_buf_list))) {
+- int need_mux = 0;
+-
+- bvd_dbg("usb_ipc_read_bulk: some urbs in_buf_list");
+- if (count > 0) {
+- bvd_ipc->suspend_flag = 1;
+- append_to_inbuf_list(urb); /* append the current received urb */
+-#if 0
+- if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
+- {
+- last_jiff = jiffies;
+- queue_apm_event(KRNL_ICL, NULL);
+- }
+-#endif
+- }
+-
+- while (!(list_empty(&bvd_ipc->in_buf_list))) {
+- struct list_head* ptr = NULL;
+- ptr = bvd_ipc->in_buf_list.next;
+- inbuf = list_entry(ptr, buf_list_t, list);
+- count = inbuf->size;
+- need_mux = 1;
+-
+- tty_insert_flip_string(tty, inbuf->body, count);
+-
+- list_del(ptr);
+- kfree(inbuf->body);
+- inbuf->body = NULL;
+- kfree(inbuf);
+- }
+-
+- if (usb_mux_dispatcher && need_mux)
+- usb_mux_dispatcher(tty); /* call Liu changhui's func. */
+-
+- if (list_empty(&bvd_ipc->in_buf_list)) {
+- urb->actual_length = 0;
+- urb->dev = bvd_ipc->ipc_dev;
+- if (usb_submit_urb(urb, GFP_ATOMIC))
+- bvd_dbg("usb_ipc_read_bulk: "
+- "failed resubmitting read urb");
+- bvd_dbg("usb_ipc_read_bulk: resubmited read urb");
+- } else {
+- ipcusb_timer.data = (unsigned long)urb;
+- mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
+- }
+- } else if (count > 0) {
+- bvd_dbg("usb_ipc_read_bulk: no urbs in_buf_list");
++ if (count > 0) {
++ bvd_dbg("usb_ipc_read_bulk: inserting buffer into in_buf_list");
+ bvd_ipc->suspend_flag = 1;
+
+- if (tty_insert_flip_string(tty, urb->transfer_buffer,
+- count) < count) {
+- bvd_ipc->suspend_flag = 1;
+- append_to_inbuf_list(urb);
+- ipcusb_timer.data = (unsigned long)urb;
+- mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
+-#if 0
+- if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
+- {
+- last_jiff = jiffies;
+- queue_apm_event(KRNL_ICL, NULL);
+- }
+-#endif
+- }
++ append_to_inbuf_list(urb);
+
+ if (usb_mux_dispatcher)
+ usb_mux_dispatcher(tty); /* call Liu changhui's func. */
+@@ -337,13 +314,6 @@
+ urb->dev = bvd_ipc->ipc_dev;
+ if (usb_submit_urb(urb, GFP_ATOMIC))
+ bvd_dbg("failed resubmitting read urb");
+-#if 0
+- if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
+- {
+- last_jiff = jiffies;
+- queue_apm_event(KRNL_ICL, NULL);
+- }
+-#endif
+ bvd_dbg("usb_ipc_read_bulk: resubmited read urb");
+ }
+
+@@ -705,7 +675,8 @@
+ bvd_ipc->bulk_out_ep_mux= have_bulk_out_mux;
+ bvd_ipc->ipc_dev = usbdev;
+ bvd_ipc->writesize = writesize;
+- INIT_LIST_HEAD (&bvd_ipc->in_buf_list);
++ INIT_LIST_HEAD(&bvd_ipc->in_buf_list);
++ bvd_ipc->in_buf_lock = SPIN_LOCK_UNLOCKED;
+
+ bvd_ipc->bh.func = usbipc_bh_func;
+ bvd_ipc->bh.data = (unsigned long) bvd_ipc;
+Index: linux-2.6.16/drivers/char/ts0710_mux.c
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux.c 2007-01-17 00:52:23.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux.c 2007-01-17 00:52:26.000000000 +0100
+@@ -3149,7 +3149,7 @@
+ static void receive_worker(void *private_)
+ {
+ struct tty_struct *tty = COMM_FOR_MUX_TTY;
+- int i, count;
++ int i, count, tbuf_free, tbuf_read;
+ static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
+ static unsigned char *tbuf_ptr = &tbuf[0];
+ static unsigned char *start_flag = 0;
+@@ -3167,29 +3167,39 @@
+
+ UNUSED_PARAM(private_);
+
+- if (!tty)
+- return;
++ if (!tty)
++ return;
++
++ while (1) {
++ tbuf_free = TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf);
++ TS0710_PRINTK("Reading max %i bytes from ts0710_mux_usb inbuf.\n", tbuf_free);
++ tbuf_read = get_from_inbuf_list(tbuf_ptr, tbuf_free);
++ if (tbuf_read == 0) {
++ break;
++ } else {
++ TS0710_PRINTK("Read %i bytes.\n", tbuf_read);
++ };
++ tbuf_ptr += tbuf_read;
++ };
++
++ count = (tbuf_ptr - tbuf);
++
++ // Should be impossible?
++ //if (count > (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf))) {
++ // TS0710_PRINTK
++ // ("MUX receive_worker: !!!!! Exceed buffer boundary !!!!!\n");
++ // count = (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf));
++ //}
+
+ #ifdef USB_FOR_MUX
+- TS0710_DEBUG("Receive following bytes from IPC-USB");
++ TS0710_DEBUG("Received following bytes from IPC-USB");
+ #else
+- TS0710_DEBUG("Receive following bytes from UART");
++ TS0710_DEBUG("Received following bytes from UART");
+ #endif
+-
+- TS0710_DEBUGHEX(cp, count);
+-
+- if (count > (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf))) {
+- TS0710_PRINTK
+- ("MUX receive_worker: !!!!! Exceed buffer boundary !!!!!\n");
+- count = (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf));
+- }
+-
+- count = tty_buffer_request_room(tty, count);
+-
+- for (i = 0; i < count; i++)
+- tty_insert_flip_char(tty, tbuf_ptr[i], TTY_NORMAL);
+-
+- tbuf_ptr += count;
++ TS0710_DEBUGHEX(tbuf, count);
++
++ //gets updated above
++ //tbuf_ptr += count;
+ search = &tbuf[0];
+
+ if (test_and_set_bit(RECV_RUNNING, &mux_recv_flags)) {
+Index: linux-2.6.16/drivers/char/ts0710_mux_usb.h
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux_usb.h 2007-01-17 00:52:23.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux_usb.h 2007-01-17 00:52:26.000000000 +0100
+@@ -27,3 +27,6 @@
+ extern struct tty_struct *usb_for_mux_tty;
+ extern void (*usb_mux_dispatcher)(struct tty_struct *tty);
+ extern void (*usb_mux_sender)(void);
++
++extern int get_from_inbuf_list(const unsigned char *buf, int dst_count);
++
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-remove-get_halted_bit.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-get_halted_bit.patch
new file mode 100644
index 0000000000..0ebe27d03b
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-get_halted_bit.patch
@@ -0,0 +1,22 @@
+Index: linux-2.6.16/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux_usb.c 2007-01-17 01:06:21.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux_usb.c 2007-01-17 01:06:31.000000000 +0100
+@@ -461,7 +461,7 @@
+ ipcusb_xmit_data();
+ }
+
+-extern void get_halted_bit(void);
++//extern void get_halted_bit(void);
+
+ static void usbipc_bh_bp_func(unsigned long param)
+ {
+@@ -472,7 +472,7 @@
+ "UHCRHPS3=0x%x", UHCRHPS3);
+ }
+ if (bvd_ipc->ipc_flag == IPC_USB_PROBE_READY) {
+- get_halted_bit();
++ //get_halted_bit();
+
+ /*send a IN token*/
+ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux-remove-usbh_finished_resume.patch b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-usbh_finished_resume.patch
new file mode 100644
index 0000000000..c415ded428
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux-remove-usbh_finished_resume.patch
@@ -0,0 +1,22 @@
+Index: linux-2.6.16/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.16.orig/drivers/char/ts0710_mux_usb.c 2007-01-17 01:12:23.000000000 +0100
++++ linux-2.6.16/drivers/char/ts0710_mux_usb.c 2007-01-17 01:12:37.000000000 +0100
+@@ -97,7 +97,6 @@
+ static int sumbit_times = 0;
+ static int callback_times = 0;
+ //static unsigned long last_jiff = 0;
+-extern int usbh_finished_resume;
+ /*end global values defined*/
+
+ MODULE_AUTHOR(DRIVER_AUTHOR);
+@@ -546,9 +545,6 @@
+ void usb_send_readurb(void)
+ {
+ //printk("usb_send_readurb: begining!UHCRHPS3=0x%x, usbh_finished_resume=%d\n", UHCRHPS3, usbh_finished_resume);
+-
+- if (usbh_finished_resume == 0)
+- return;
+
+ tasklet_schedule(&bvd_ipc->bh_bp);
+ }
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux_cli.patch b/packages/linux/linux-ezx-2.6.23/patches/mux_cli.patch
new file mode 100644
index 0000000000..4938371d51
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux_cli.patch
@@ -0,0 +1,5396 @@
+Index: linux-2.6.23/drivers/char/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/char/Kconfig 2007-10-10 09:38:43.000000000 +0200
++++ linux-2.6.23/drivers/char/Kconfig 2007-10-22 22:26:50.000000000 +0200
+@@ -1064,5 +1064,18 @@
+
+ source "drivers/s390/char/Kconfig"
+
++config TS0710_MUX
++ tristate "GSM TS 07.10 Multiplex driver"
++ depends on EZX_BP
++ help
++ This implements the GSM 07.10 multiplex.
++
++config TS0710_MUX_USB
++ tristate "Motorola USB support for TS 07.10 Multiplex driver"
++ depends on TS0710_MUX
++ help
++ This ads support for TS 07.10 over USB, as found in motorola
++ Smartphones.
++
+ endmenu
+
+Index: linux-2.6.23/drivers/char/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/char/Makefile 2007-10-10 09:38:43.000000000 +0200
++++ linux-2.6.23/drivers/char/Makefile 2007-10-22 22:26:50.000000000 +0200
+@@ -111,6 +111,9 @@
+ obj-$(CONFIG_JS_RTC) += js-rtc.o
+ js-rtc-y = rtc.o
+
++obj-$(CONFIG_TS0710_MUX) += ts0710_mux.o ts0710_mux_usb.o
++
++
+ # Files generated that shall be removed upon make clean
+ clean-files := consolemap_deftbl.c defkeymap.c
+
+Index: linux-2.6.23/drivers/char/ts0710.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/char/ts0710.h 2007-10-22 22:26:50.000000000 +0200
+@@ -0,0 +1,368 @@
++/*
++ * File: ts0710.h
++ *
++ * Portions derived from rfcomm.c, original header as follows:
++ *
++ * Copyright (C) 2000, 2001 Axis Communications AB
++ *
++ * Author: Mats Friden <mats.friden@axis.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.
++ *
++ * Exceptionally, Axis Communications AB grants discretionary and
++ * conditional permissions for additional use of the text contained
++ * in the company's release of the AXIS OpenBT Stack under the
++ * provisions set forth hereunder.
++ *
++ * Provided that, if you use the AXIS OpenBT Stack with other files,
++ * that do not implement functionality as specified in the Bluetooth
++ * System specification, to produce an executable, this does not by
++ * itself cause the resulting executable to be covered by the GNU
++ * General Public License. Your use of that executable is in no way
++ * restricted on account of using the AXIS OpenBT Stack code with it.
++ *
++ * This exception does not however invalidate any other reasons why
++ * the executable file might be covered by the provisions of the GNU
++ * General Public License.
++ *
++ */
++/*
++ * Copyright (C) 2002 Motorola
++ *
++ * 07/28/2002 Initial version based on rfcomm.c
++ * 11/18/2002 Modified
++ */
++
++#include <linux/config.h>
++#include <linux/module.h>
++
++#include <linux/errno.h>
++#include <linux/sched.h>
++#include <linux/interrupt.h>
++#include <linux/tty.h>
++#include <linux/tty_flip.h>
++#include <linux/fcntl.h>
++#include <linux/string.h>
++#include <linux/major.h>
++#include <linux/mm.h>
++#include <linux/init.h>
++#include <linux/devfs_fs_kernel.h>
++
++#include <asm/uaccess.h>
++#include <asm/system.h>
++#include <asm/bitops.h>
++
++#include <asm/byteorder.h>
++#include <asm/types.h>
++
++#define TS0710_MAX_CHN 14
++
++#define SET_PF(ctr) ((ctr) | (1 << 4))
++#define CLR_PF(ctr) ((ctr) & 0xef)
++#define GET_PF(ctr) (((ctr) >> 4) & 0x1)
++
++#define GET_PN_MSG_FRAME_SIZE(pn) ( ((pn)->frame_sizeh << 8) | ((pn)->frame_sizel))
++#define SET_PN_MSG_FRAME_SIZE(pn, size) ({ (pn)->frame_sizel = (size) & 0xff; \
++ (pn)->frame_sizeh = (size) >> 8; })
++
++#define GET_LONG_LENGTH(a) ( ((a).h_len << 7) | ((a).l_len) )
++#define SET_LONG_LENGTH(a, length) ({ (a).ea = 0; \
++ (a).l_len = length & 0x7F; \
++ (a).h_len = (length >> 7) & 0xFF; })
++
++#define SHORT_CRC_CHECK 3
++#define LONG_CRC_CHECK 4
++
++/* FIXME: Should thsi one be define here? */
++#define SHORT_PAYLOAD_SIZE 127
++
++#define EA 1
++#define FCS_SIZE 1
++#define FLAG_SIZE 2
++
++#define TS0710_MAX_HDR_SIZE 5
++#define DEF_TS0710_MTU 256
++
++#define TS0710_BASIC_FLAG 0xF9
++/* the control field */
++#define SABM 0x2f
++#define SABM_SIZE 4
++#define UA 0x63
++#define UA_SIZE 4
++#define DM 0x0f
++#define DISC 0x43
++#define UIH 0xef
++
++/* the type field in a multiplexer command packet */
++#define TEST 0x8
++#define FCON 0x28
++#define FCOFF 0x18
++#define MSC 0x38
++#define RPN 0x24
++#define RLS 0x14
++#define PN 0x20
++#define NSC 0x4
++
++/* V.24 modem control signals */
++#define FC 0x2
++#define RTC 0x4
++#define RTR 0x8
++#define IC 0x40
++#define DV 0x80
++
++#define CTRL_CHAN 0 /* The control channel is defined as DLCI 0 */
++#define MCC_CMD 1 /* Multiplexer command cr */
++#define MCC_RSP 0 /* Multiplexer response cr */
++
++#ifdef __LITTLE_ENDIAN_BITFIELD
++
++typedef struct {
++ __u8 ea:1;
++ __u8 cr:1;
++ __u8 d:1;
++ __u8 server_chn:5;
++} __attribute__ ((packed)) address_field;
++
++typedef struct {
++ __u8 ea:1;
++ __u8 len:7;
++} __attribute__ ((packed)) short_length;
++
++typedef struct {
++ __u8 ea:1;
++ __u8 l_len:7;
++ __u8 h_len;
++} __attribute__ ((packed)) long_length;
++
++typedef struct {
++ address_field addr;
++ __u8 control;
++ short_length length;
++} __attribute__ ((packed)) short_frame_head;
++
++typedef struct {
++ short_frame_head h;
++ __u8 data[0];
++} __attribute__ ((packed)) short_frame;
++
++typedef struct {
++ address_field addr;
++ __u8 control;
++ long_length length;
++ __u8 data[0];
++} __attribute__ ((packed)) long_frame_head;
++
++typedef struct {
++ long_frame_head h;
++ __u8 data[0];
++} __attribute__ ((packed)) long_frame;
++
++/* Typedefinitions for structures used for the multiplexer commands */
++typedef struct {
++ __u8 ea:1;
++ __u8 cr:1;
++ __u8 type:6;
++} __attribute__ ((packed)) mcc_type;
++
++typedef struct {
++ mcc_type type;
++ short_length length;
++ __u8 value[0];
++} __attribute__ ((packed)) mcc_short_frame_head;
++
++typedef struct {
++ mcc_short_frame_head h;
++ __u8 value[0];
++} __attribute__ ((packed)) mcc_short_frame;
++
++typedef struct {
++ mcc_type type;
++ long_length length;
++ __u8 value[0];
++} __attribute__ ((packed)) mcc_long_frame_head;
++
++typedef struct {
++ mcc_long_frame_head h;
++ __u8 value[0];
++} __attribute__ ((packed)) mcc_long_frame;
++
++/* MSC-command */
++typedef struct {
++ __u8 ea:1;
++ __u8 fc:1;
++ __u8 rtc:1;
++ __u8 rtr:1;
++ __u8 reserved:2;
++ __u8 ic:1;
++ __u8 dv:1;
++} __attribute__ ((packed)) v24_sigs;
++
++typedef struct {
++ __u8 ea:1;
++ __u8 b1:1;
++ __u8 b2:1;
++ __u8 b3:1;
++ __u8 len:4;
++} __attribute__ ((packed)) brk_sigs;
++
++typedef struct {
++ short_frame_head s_head;
++ mcc_short_frame_head mcc_s_head;
++ address_field dlci;
++ __u8 v24_sigs;
++ //brk_sigs break_signals;
++ __u8 fcs;
++} __attribute__ ((packed)) msc_msg;
++
++#if 0
++/* conflict with termios.h */
++/* RPN command */
++#define B2400 0
++#define B4800 1
++#define B7200 2
++#define B9600 3
++#define B19200 4
++#define B38400 5
++#define B57600 6
++#define B115200 7
++#define D230400 8
++#endif
++
++/*
++typedef struct{
++ __u8 bit_rate:1;
++ __u8 data_bits:1;
++ __u8 stop_bit:1;
++ __u8 parity:1;
++ __u8 parity_type:1;
++ __u8 xon_u8:1;
++ __u8 xoff_u8:1;
++ __u8 res1:1;
++ __u8 xon_input:1;
++ __u8 xon_output:1;
++ __u8 rtr_input:1;
++ __u8 rtr_output:1;
++ __u8 rtc_input:1;
++ __u8 rtc_output:1;
++ __u8 res2:2;
++} __attribute__((packed)) parameter_mask;
++
++typedef struct{
++ __u8 bit_rate;
++ __u8 data_bits:2;
++ __u8 stop_bit:1;
++ __u8 parity:1;
++ __u8 parity_type:2;
++ __u8 res1:2;
++ __u8 xon_input:1;
++ __u8 xon_output:1;
++ __u8 rtr_input:1;
++ __u8 rtr_output:1;
++ __u8 rtc_input:1;
++ __u8 rtc_output:1;
++ __u8 res2:2;
++ __u8 xon_u8;
++ __u8 xoff_u8;
++ parameter_mask pm;
++} __attribute__((packed)) rpn_values;
++
++typedef struct{
++ short_frame_head s_head;
++ mcc_short_frame_head mcc_s_head;
++ address_field dlci;
++ rpn_values rpn_val;
++ __u8 fcs;
++} __attribute__((packed)) rpn_msg;
++*/
++
++/* RLS-command */
++/*
++typedef struct{
++ short_frame_head s_head;
++ mcc_short_frame_head mcc_s_head;
++ address_field dlci;
++ __u8 error:4;
++ __u8 res:4;
++ __u8 fcs;
++} __attribute__((packed)) rls_msg;
++*/
++
++/* PN-command */
++typedef struct {
++ short_frame_head s_head;
++ mcc_short_frame_head mcc_s_head;
++ __u8 dlci:6;
++ __u8 res1:2;
++ __u8 frame_type:4;
++ __u8 credit_flow:4;
++ __u8 prior:6;
++ __u8 res2:2;
++ __u8 ack_timer;
++ __u8 frame_sizel;
++ __u8 frame_sizeh;
++ __u8 max_nbrof_retrans;
++ __u8 credits;
++ __u8 fcs;
++} __attribute__ ((packed)) pn_msg;
++
++/* NSC-command */
++typedef struct {
++ short_frame_head s_head;
++ mcc_short_frame_head mcc_s_head;
++ mcc_type command_type;
++ __u8 fcs;
++} __attribute__ ((packed)) nsc_msg;
++
++#else
++#error Only littel-endianess supported now!
++#endif
++
++enum {
++ REJECTED = 0,
++ DISCONNECTED,
++ CONNECTING,
++ NEGOTIATING,
++ CONNECTED,
++ DISCONNECTING,
++ FLOW_STOPPED
++};
++
++enum ts0710_events {
++ CONNECT_IND,
++ CONNECT_CFM,
++ DISCONN_CFM
++};
++
++typedef struct {
++ volatile __u8 state;
++ volatile __u8 flow_control;
++ volatile __u8 initiated;
++ volatile __u8 initiator;
++ volatile __u16 mtu;
++ wait_queue_head_t open_wait;
++ wait_queue_head_t close_wait;
++} dlci_struct;
++
++/* user space interfaces */
++typedef struct {
++ volatile __u8 initiator;
++ volatile __u8 c_dlci;
++ volatile __u16 mtu;
++ volatile __u8 be_testing;
++ volatile __u32 test_errs;
++ wait_queue_head_t test_wait;
++
++ dlci_struct dlci[TS0710_MAX_CHN];
++} ts0710_con;
+Index: linux-2.6.23/drivers/char/ts0710_mux.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/char/ts0710_mux.c 2007-10-22 22:26:50.000000000 +0200
+@@ -0,0 +1,3966 @@
++/*
++ * File: mux_driver.c
++ *
++ * Portions derived from rfcomm.c, original header as follows:
++ *
++ * Copyright (C) 2000, 2001 Axis Communications AB
++ *
++ * Author: Mats Friden <mats.friden@axis.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.
++ *
++ * Exceptionally, Axis Communications AB grants discretionary and
++ * conditional permissions for additional use of the text contained
++ * in the company's release of the AXIS OpenBT Stack under the
++ * provisions set forth hereunder.
++ *
++ * Provided that, if you use the AXIS OpenBT Stack with other files,
++ * that do not implement functionality as specified in the Bluetooth
++ * System specification, to produce an executable, this does not by
++ * itself cause the resulting executable to be covered by the GNU
++ * General Public License. Your use of that executable is in no way
++ * restricted on account of using the AXIS OpenBT Stack code with it.
++ *
++ * This exception does not however invalidate any other reasons why
++ * the executable file might be covered by the provisions of the GNU
++ * General Public License.
++ *
++ */
++/*
++ * Copyright (C) 2002-2004 Motorola
++ * Copyright (C) 2006 Harald Welte <laforge@openezx.org>
++ *
++ * 07/28/2002 Initial version
++ * 11/18/2002 Second version
++ * 04/21/2004 Add GPRS PROC
++ */
++#include <linux/config.h>
++#include <linux/module.h>
++#include <linux/types.h>
++
++#include <linux/kernel.h>
++#include <linux/proc_fs.h>
++
++#define USB_FOR_MUX
++
++#ifndef USB_FOR_MUX
++#include <linux/serial.h>
++#endif
++
++#include <linux/errno.h>
++#include <linux/sched.h>
++#include <linux/interrupt.h>
++#include <linux/tty.h>
++#include <linux/tty_flip.h>
++#include <linux/fcntl.h>
++#include <linux/string.h>
++#include <linux/major.h>
++#include <linux/mm.h>
++#include <linux/slab.h>
++#include <linux/init.h>
++#include <linux/devfs_fs_kernel.h>
++//#include <syslog.h>
++
++#include <asm/uaccess.h>
++#include <asm/system.h>
++#include <asm/bitops.h>
++
++#ifdef USB_FOR_MUX
++//#include <linux/usb.h>
++#include "ts0710_mux_usb.h"
++#endif
++
++#include "ts0710.h"
++#include "ts0710_mux.h"
++
++#define TS0710MUX_GPRS_SESSION_MAX 2
++#define TS0710MUX_MAJOR 250
++#define TS0710MUX_MINOR_START 0
++#define NR_MUXS 16
++
++ /*#define TS0710MUX_TIME_OUT 30 *//* 300ms */
++#define TS0710MUX_TIME_OUT 250 /* 2500ms, for BP UART hardware flow control AP UART */
++
++#define TS0710MUX_IO_DLCI_FC_ON 0x54F2
++#define TS0710MUX_IO_DLCI_FC_OFF 0x54F3
++#define TS0710MUX_IO_FC_ON 0x54F4
++#define TS0710MUX_IO_FC_OFF 0x54F5
++
++#define TS0710MUX_MAX_BUF_SIZE 2048
++
++#define TS0710MUX_SEND_BUF_OFFSET 10
++#define TS0710MUX_SEND_BUF_SIZE (DEF_TS0710_MTU + TS0710MUX_SEND_BUF_OFFSET + 34)
++#define TS0710MUX_RECV_BUF_SIZE TS0710MUX_SEND_BUF_SIZE
++
++/*For BP UART problem Begin*/
++#ifdef TS0710SEQ2
++#define ACK_SPACE 66 /* 6 * 11(ACK frame size) */
++#else
++#define ACK_SPACE 42 /* 6 * 7(ACK frame size) */
++#endif
++/*For BP UART problem End*/
++
++ /*#define TS0710MUX_SERIAL_BUF_SIZE (DEF_TS0710_MTU + TS0710_MAX_HDR_SIZE)*//* For BP UART problem */
++#define TS0710MUX_SERIAL_BUF_SIZE (DEF_TS0710_MTU + TS0710_MAX_HDR_SIZE + ACK_SPACE) /* For BP UART problem: ACK_SPACE */
++
++#define TS0710MUX_MAX_TOTAL_FRAME_SIZE (DEF_TS0710_MTU + TS0710_MAX_HDR_SIZE + FLAG_SIZE)
++#define TS0710MUX_MAX_CHARS_IN_BUF 65535
++#define TS0710MUX_THROTTLE_THRESHOLD DEF_TS0710_MTU
++
++#define TEST_PATTERN_SIZE 250
++
++#define CMDTAG 0x55
++#define DATATAG 0xAA
++
++#define ACK 0x4F /*For BP UART problem */
++
++/*For BP UART problem Begin*/
++#ifdef TS0710SEQ2
++#define FIRST_BP_SEQ_OFFSET 1 /*offset from start flag */
++#define SECOND_BP_SEQ_OFFSET 2 /*offset from start flag */
++#define FIRST_AP_SEQ_OFFSET 3 /*offset from start flag */
++#define SECOND_AP_SEQ_OFFSET 4 /*offset from start flag */
++#define SLIDE_BP_SEQ_OFFSET 5 /*offset from start flag */
++#define SEQ_FIELD_SIZE 5
++#else
++#define SLIDE_BP_SEQ_OFFSET 1 /*offset from start flag */
++#define SEQ_FIELD_SIZE 1
++#endif
++
++#define ADDRESS_FIELD_OFFSET (1 + SEQ_FIELD_SIZE) /*offset from start flag */
++/*For BP UART problem End*/
++
++#ifndef UNUSED_PARAM
++#define UNUSED_PARAM(v) (void)(v)
++#endif
++
++#define TS0710MUX_GPRS1_DLCI 7
++#define TS0710MUX_GPRS2_DLCI 8
++
++#define TS0710MUX_GPRS1_RECV_COUNT_IDX 0
++#define TS0710MUX_GPRS1_SEND_COUNT_IDX 1
++#define TS0710MUX_GPRS2_RECV_COUNT_IDX 2
++#define TS0710MUX_GPRS2_SEND_COUNT_IDX 3
++#define TS0710MUX_COUNT_MAX_IDX 3
++#define TS0710MUX_COUNT_IDX_NUM (TS0710MUX_COUNT_MAX_IDX + 1)
++
++static volatile int mux_data_count[TS0710MUX_COUNT_IDX_NUM] = { 0, 0, 0, 0 };
++static volatile int mux_data_count2[TS0710MUX_COUNT_IDX_NUM] = { 0, 0, 0, 0 };
++static struct semaphore mux_data_count_mutex[TS0710MUX_COUNT_IDX_NUM];
++static volatile __u8 post_recv_count_flag = 0;
++
++/*PROC file*/
++struct proc_dir_entry *gprs_proc_file = NULL;
++ssize_t file_proc_read(struct file *file, char *buf, size_t size,
++ loff_t * ppos);
++ssize_t file_proc_write(struct file *file, const char *buf, size_t count,
++ loff_t * ppos);
++struct file_operations file_proc_operations = {
++ read:file_proc_read,
++ write:file_proc_write,
++};
++typedef struct {
++ int recvBytes;
++ int sentBytes;
++} gprs_bytes;
++
++static __u8 tty2dlci[NR_MUXS] =
++ { 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12, 13 };
++static __u8 iscmdtty[NR_MUXS] =
++ { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
++typedef struct {
++ __u8 cmdtty;
++ __u8 datatty;
++} dlci_tty;
++static dlci_tty dlci2tty[] = { {0, 0}, /* DLCI 0 */
++{0, 0}, /* DLCI 1 */
++{1, 1}, /* DLCI 2 */
++{2, 2}, /* DLCI 3 */
++{3, 3}, /* DLCI 4 */
++{4, 4}, /* DLCI 5 */
++{5, 8}, /* DLCI 6 */
++{6, 9}, /* DLCI 7 */
++{7, 10}, /* DLCI 8 */
++{11, 11}, /* DLCI 9 */
++{12, 12}, /* DLCI 10 */
++{13, 13}, /* DLCI 11 */
++{14, 14}, /* DLCI 12 */
++{15, 15}
++}; /* DLCI 13 */
++
++typedef struct {
++ volatile __u8 buf[TS0710MUX_SEND_BUF_SIZE];
++ volatile __u8 *frame;
++ unsigned long flags;
++ volatile __u16 length;
++ volatile __u8 filled;
++ volatile __u8 dummy; /* Allignment to 4*n bytes */
++} mux_send_struct;
++
++/* Bit number in flags of mux_send_struct */
++#define BUF_BUSY 0
++
++struct mux_recv_packet_tag {
++ __u8 *data;
++ __u32 length;
++ struct mux_recv_packet_tag *next;
++};
++typedef struct mux_recv_packet_tag mux_recv_packet;
++
++struct mux_recv_struct_tag {
++ __u8 data[TS0710MUX_RECV_BUF_SIZE];
++ __u32 length;
++ __u32 total;
++ mux_recv_packet *mux_packet;
++ struct mux_recv_struct_tag *next;
++ int no_tty;
++ volatile __u8 post_unthrottle;
++};
++typedef struct mux_recv_struct_tag mux_recv_struct;
++
++#define RECV_RUNNING 0
++static unsigned long mux_recv_flags = 0;
++
++static mux_send_struct *mux_send_info[NR_MUXS];
++static volatile __u8 mux_send_info_flags[NR_MUXS];
++static volatile __u8 mux_send_info_idx = NR_MUXS;
++
++static mux_recv_struct *mux_recv_info[NR_MUXS];
++static volatile __u8 mux_recv_info_flags[NR_MUXS];
++static mux_recv_struct *mux_recv_queue = NULL;
++
++static struct tty_driver mux_driver;
++
++#ifdef USB_FOR_MUX
++#define COMM_FOR_MUX_DRIVER usb_for_mux_driver
++#define COMM_FOR_MUX_TTY usb_for_mux_tty
++#define COMM_MUX_DISPATCHER usb_mux_dispatcher
++#define COMM_MUX_SENDER usb_mux_sender
++#else
++#define COMM_FOR_MUX_DRIVER serial_for_mux_driver
++#define COMM_FOR_MUX_TTY serial_for_mux_tty
++#define COMM_MUX_DISPATCHER serial_mux_dispatcher
++#define COMM_MUX_SENDER serial_mux_sender
++
++extern struct list_head *tq_serial_for_mux;
++#endif
++
++extern struct tty_driver *COMM_FOR_MUX_DRIVER;
++extern struct tty_struct *COMM_FOR_MUX_TTY;
++extern void (*COMM_MUX_DISPATCHER) (struct tty_struct * tty);
++extern void (*COMM_MUX_SENDER) (void);
++
++static struct work_struct send_tqueue;
++static struct work_struct receive_tqueue;
++static struct work_struct post_recv_tqueue;
++
++static struct tty_struct *mux_table[NR_MUXS];
++static struct termios *mux_termios[NR_MUXS];
++static struct termios *mux_termios_locked[NR_MUXS];
++static volatile short int mux_tty[NR_MUXS];
++
++#ifdef min
++#undef min
++#define min(a,b) ( (a)<(b) ? (a):(b) )
++#endif
++
++static int get_count(__u8 idx);
++static int set_count(__u8 idx, int count);
++static int add_count(__u8 idx, int count);
++
++static int send_ua(ts0710_con * ts0710, __u8 dlci);
++static int send_dm(ts0710_con * ts0710, __u8 dlci);
++static int send_sabm(ts0710_con * ts0710, __u8 dlci);
++static int send_disc(ts0710_con * ts0710, __u8 dlci);
++static void queue_uih(mux_send_struct * send_info, __u16 len,
++ ts0710_con * ts0710, __u8 dlci);
++static int send_pn_msg(ts0710_con * ts0710, __u8 prior, __u32 frame_size,
++ __u8 credit_flow, __u8 credits, __u8 dlci, __u8 cr);
++static int send_nsc_msg(ts0710_con * ts0710, mcc_type cmd, __u8 cr);
++static void set_uih_hdr(short_frame * uih_pkt, __u8 dlci, __u32 len, __u8 cr);
++
++static __u32 crc_check(__u8 * data, __u32 length, __u8 check_sum);
++static __u8 crc_calc(__u8 * data, __u32 length);
++static void create_crctable(__u8 table[]);
++
++static void mux_sched_send(void);
++
++static __u8 crctable[256];
++
++static ts0710_con ts0710_connection;
++/*
++static rpn_values rpn_val;
++*/
++
++static int valid_dlci(__u8 dlci)
++{
++ if ((dlci < TS0710_MAX_CHN) && (dlci > 0))
++ return 1;
++ else
++ return 0;
++}
++
++#ifdef TS0710DEBUG
++
++#ifdef PRINT_OUTPUT_PRINTK
++#define TS0710_DEBUG(fmt, arg...) printk(KERN_INFO "MUX " __FUNCTION__ ": " fmt "\n" , ## arg)
++#else
++#include "ezxlog.h"
++static __u8 strDebug[256];
++#define TS0710_DEBUG(fmt, arg...) ({ snprintf(strDebug, sizeof(strDebug), "MUX " __FUNCTION__ ": " fmt "\n" , ## arg); \
++ /*printk("%s", strDebug)*/ezxlogk("MX", strDebug, strlen(strDebug)); })
++#endif /* End #ifdef PRINT_OUTPUT_PRINTK */
++
++#else
++#define TS0710_DEBUG(fmt...)
++#endif /* End #ifdef TS0710DEBUG */
++
++#ifdef TS0710LOG
++static unsigned char g_tbuf[TS0710MUX_MAX_BUF_SIZE];
++#ifdef PRINT_OUTPUT_PRINTK
++#define TS0710_LOG(fmt, arg...) printk(fmt, ## arg)
++#define TS0710_PRINTK(fmt, arg...) printk(fmt, ## arg)
++#else
++#include "ezxlog.h"
++static __u8 strLog[256];
++#define TS0710_LOG(fmt, arg...) ({ snprintf(strLog, sizeof(strLog), fmt, ## arg); \
++ /*printk("%s", strLog)*/ezxlogk("MX", strLog, strlen(strLog)); })
++#define TS0710_PRINTK(fmt, arg...) ({ printk(fmt, ## arg); \
++ TS0710_LOG(fmt, ## arg); })
++#endif /* End #ifdef PRINT_OUTPUT_PRINTK */
++
++#else
++#define TS0710_LOG(fmt...)
++#define TS0710_PRINTK(fmt, arg...) printk(fmt, ## arg)
++#endif /* End #ifdef TS0710LOG */
++
++#ifdef TS0710DEBUG
++static void TS0710_DEBUGHEX(__u8 * buf, int len)
++{
++ static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
++
++ int i;
++ int c;
++
++ if (len <= 0) {
++ return;
++ }
++
++ c = 0;
++ for (i = 0; (i < len) && (c < (TS0710MUX_MAX_BUF_SIZE - 3)); i++) {
++ sprintf(&tbuf[c], "%02x ", buf[i]);
++ c += 3;
++ }
++ tbuf[c] = 0;
++
++#ifdef PRINT_OUTPUT_PRINTK
++ TS0710_DEBUG("%s", tbuf);
++#else
++ /*printk("%s\n", tbuf) */ ezxlogk("MX", tbuf, c);
++#endif
++}
++static void TS0710_DEBUGSTR(__u8 * buf, int len)
++{
++ static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
++
++ if (len <= 0) {
++ return;
++ }
++
++ if (len > (TS0710MUX_MAX_BUF_SIZE - 1)) {
++ len = (TS0710MUX_MAX_BUF_SIZE - 1);
++ }
++
++ memcpy(tbuf, buf, len);
++ tbuf[len] = 0;
++
++#ifdef PRINT_OUTPUT_PRINTK
++ /* 0x00 byte in the string pointed by tbuf may truncate the print result */
++ TS0710_DEBUG("%s", tbuf);
++#else
++ /*printk("%s\n", tbuf) */ ezxlogk("MX", tbuf, len);
++#endif
++}
++#else
++#define TS0710_DEBUGHEX(buf, len)
++#define TS0710_DEBUGSTR(buf, len)
++#endif /* End #ifdef TS0710DEBUG */
++
++#ifdef TS0710LOG
++static void TS0710_LOGSTR_FRAME(__u8 send, __u8 * data, int len)
++{
++ short_frame *short_pkt;
++ long_frame *long_pkt;
++ __u8 *uih_data_start;
++ __u32 uih_len;
++ __u8 dlci;
++ int pos;
++
++ if (len <= 0) {
++ return;
++ }
++
++ pos = 0;
++ if (send) {
++ pos += sprintf(&g_tbuf[pos], "<");
++ short_pkt = (short_frame *) (data + 1); /*For BP UART problem */
++ } else {
++ /*For BP UART problem */
++ /*pos += sprintf(&g_tbuf[pos], ">"); */
++ pos += sprintf(&g_tbuf[pos], ">%d ", *(data + SLIDE_BP_SEQ_OFFSET)); /*For BP UART problem */
++
++#ifdef TS0710SEQ2
++ pos += sprintf(&g_tbuf[pos], "%02x %02x %02x %02x ", *(data + FIRST_BP_SEQ_OFFSET), *(data + SECOND_BP_SEQ_OFFSET), *(data + FIRST_AP_SEQ_OFFSET), *(data + SECOND_AP_SEQ_OFFSET)); /*For BP UART problem */
++#endif
++
++ short_pkt = (short_frame *) (data + ADDRESS_FIELD_OFFSET); /*For BP UART problem */
++ }
++
++ /*For BP UART problem */
++ /*short_pkt = (short_frame *)(data + 1); */
++
++ dlci = short_pkt->h.addr.server_chn << 1 | short_pkt->h.addr.d;
++ switch (CLR_PF(short_pkt->h.control)) {
++ case SABM:
++ pos += sprintf(&g_tbuf[pos], "C SABM %d ::", dlci);
++ break;
++ case UA:
++ pos += sprintf(&g_tbuf[pos], "C UA %d ::", dlci);
++ break;
++ case DM:
++ pos += sprintf(&g_tbuf[pos], "C DM %d ::", dlci);
++ break;
++ case DISC:
++ pos += sprintf(&g_tbuf[pos], "C DISC %d ::", dlci);
++ break;
++
++ /*For BP UART problem Begin */
++ case ACK:
++ pos += sprintf(&g_tbuf[pos], "C ACK %d ", short_pkt->data[0]);
++
++#ifdef TS0710SEQ2
++ pos += sprintf(&g_tbuf[pos], "%02x %02x %02x %02x ", short_pkt->data[1], short_pkt->data[2], short_pkt->data[3], short_pkt->data[4]); /*For BP UART problem */
++#endif
++
++ pos += sprintf(&g_tbuf[pos], "::");
++ break;
++ /*For BP UART problem End */
++
++ case UIH:
++ if (!dlci) {
++ pos += sprintf(&g_tbuf[pos], "C MCC %d ::", dlci);
++ } else {
++
++ if ((short_pkt->h.length.ea) == 0) {
++ long_pkt = (long_frame *) short_pkt;
++ uih_len = GET_LONG_LENGTH(long_pkt->h.length);
++ uih_data_start = long_pkt->h.data;
++ } else {
++ uih_len = short_pkt->h.length.len;
++ uih_data_start = short_pkt->data;
++ }
++ switch (*uih_data_start) {
++ case CMDTAG:
++ pos +=
++ sprintf(&g_tbuf[pos], "I %d A %d ::", dlci,
++ uih_len);
++ break;
++ case DATATAG:
++ default:
++ pos +=
++ sprintf(&g_tbuf[pos], "I %d D %d ::", dlci,
++ uih_len);
++ break;
++ }
++
++ }
++ break;
++ default:
++ pos += sprintf(&g_tbuf[pos], "N!!! %d ::", dlci);
++ break;
++ }
++
++ if (len > (sizeof(g_tbuf) - pos - 1)) {
++ len = (sizeof(g_tbuf) - pos - 1);
++ }
++
++ memcpy(&g_tbuf[pos], data, len);
++ pos += len;
++ g_tbuf[pos] = 0;
++
++#ifdef PRINT_OUTPUT_PRINTK
++ /* 0x00 byte in the string pointed by g_tbuf may truncate the print result */
++ TS0710_LOG("%s\n", g_tbuf);
++#else
++ /*printk("%s\n", g_tbuf) */ ezxlogk("MX", g_tbuf, pos);
++#endif
++}
++#else
++#define TS0710_LOGSTR_FRAME(send, data, len)
++#endif
++
++#ifdef TS0710SIG
++#define my_for_each_task(p) \
++ for ((p) = current; ((p) = (p)->next_task) != current; )
++
++static void TS0710_SIG2APLOGD(void)
++{
++ struct task_struct *p;
++ static __u8 sig = 0;
++
++ if (sig) {
++ return;
++ }
++
++ read_lock(&tasklist_lock);
++ my_for_each_task(p) {
++ if (strncmp(p->comm, "aplogd", 6) == 0) {
++ sig = 1;
++ if (send_sig(SIGUSR2, p, 1) == 0) {
++ TS0710_PRINTK
++ ("MUX: success to send SIGUSR2 to aplogd!\n");
++ } else {
++ TS0710_PRINTK
++ ("MUX: failure to send SIGUSR2 to aplogd!\n");
++ }
++ break;
++ }
++ }
++ read_unlock(&tasklist_lock);
++
++ if (!sig) {
++ TS0710_PRINTK("MUX: not found aplogd!\n");
++ }
++}
++#else
++#define TS0710_SIG2APLOGD()
++#endif
++
++static int basic_write(ts0710_con * ts0710, __u8 * buf, int len)
++{
++ int res;
++
++ UNUSED_PARAM(ts0710);
++
++ buf[0] = TS0710_BASIC_FLAG;
++ buf[len + 1] = TS0710_BASIC_FLAG;
++
++ if ((COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)) {
++ TS0710_PRINTK
++ ("MUX basic_write: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n");
++
++#ifndef USB_FOR_MUX
++ TS0710_PRINTK
++ ("MUX basic_write: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n");
++ TS0710_SIG2APLOGD();
++#endif
++
++ return -1;
++ }
++
++ TS0710_LOGSTR_FRAME(1, buf, len + 2);
++ TS0710_DEBUGHEX(buf, len + 2);
++
++ res = COMM_FOR_MUX_DRIVER->write(COMM_FOR_MUX_TTY, buf, len + 2);
++
++ if (res != len + 2) {
++ TS0710_PRINTK("MUX basic_write: Write Error!\n");
++ return -1;
++ }
++
++ return len + 2;
++}
++
++/* Functions for the crc-check and calculation */
++
++#define CRC_VALID 0xcf
++
++static __u32 crc_check(__u8 * data, __u32 length, __u8 check_sum)
++{
++ __u8 fcs = 0xff;
++
++ while (length--) {
++ fcs = crctable[fcs ^ *data++];
++ }
++ fcs = crctable[fcs ^ check_sum];
++ TS0710_DEBUG("fcs : %d\n", fcs);
++ if (fcs == (uint) 0xcf) { /*CRC_VALID) */
++ TS0710_DEBUG("crc_check: CRC check OK\n");
++ return 0;
++ } else {
++ TS0710_PRINTK("MUX crc_check: CRC check failed\n");
++ return 1;
++ }
++}
++
++/* Calculates the checksum according to the ts0710 specification */
++
++static __u8 crc_calc(__u8 * data, __u32 length)
++{
++ __u8 fcs = 0xff;
++
++ while (length--) {
++ fcs = crctable[fcs ^ *data++];
++ }
++
++ return 0xff - fcs;
++}
++
++/* Calulates a reversed CRC table for the FCS check */
++
++static void create_crctable(__u8 table[])
++{
++ int i, j;
++
++ __u8 data;
++ __u8 code_word = (__u8) 0xe0;
++ __u8 sr = (__u8) 0;
++
++ for (j = 0; j < 256; j++) {
++ data = (__u8) j;
++
++ for (i = 0; i < 8; i++) {
++ if ((data & 0x1) ^ (sr & 0x1)) {
++ sr >>= 1;
++ sr ^= code_word;
++ } else {
++ sr >>= 1;
++ }
++
++ data >>= 1;
++ sr &= 0xff;
++ }
++
++ table[j] = sr;
++ sr = 0;
++ }
++}
++
++static void ts0710_reset_dlci(__u8 j)
++{
++ if (j >= TS0710_MAX_CHN)
++ return;
++
++ ts0710_connection.dlci[j].state = DISCONNECTED;
++ ts0710_connection.dlci[j].flow_control = 0;
++ ts0710_connection.dlci[j].mtu = DEF_TS0710_MTU;
++ ts0710_connection.dlci[j].initiated = 0;
++ ts0710_connection.dlci[j].initiator = 0;
++ init_waitqueue_head(&ts0710_connection.dlci[j].open_wait);
++ init_waitqueue_head(&ts0710_connection.dlci[j].close_wait);
++}
++
++static void ts0710_reset_con(void)
++{
++ __u8 j;
++
++ ts0710_connection.initiator = 0;
++ ts0710_connection.mtu = DEF_TS0710_MTU + TS0710_MAX_HDR_SIZE;
++ ts0710_connection.be_testing = 0;
++ ts0710_connection.test_errs = 0;
++ init_waitqueue_head(&ts0710_connection.test_wait);
++
++ for (j = 0; j < TS0710_MAX_CHN; j++) {
++ ts0710_reset_dlci(j);
++ }
++}
++
++static void ts0710_init(void)
++{
++ create_crctable(crctable);
++
++ ts0710_reset_con();
++
++ /* Set the values in the rpn octets */
++/*
++ rpn_val.bit_rate = 7;
++ rpn_val.data_bits = 3;
++ rpn_val.stop_bit = 0;
++ rpn_val.parity = 0;
++ rpn_val.parity_type = 0;
++ rpn_val.res1 = 0;
++ rpn_val.xon_input = 0;
++ rpn_val.xon_output = 0;
++ rpn_val.rtr_input = 0;
++ rpn_val.rtr_output = 0;
++ rpn_val.rtc_input = 0;
++ rpn_val.rtc_output = 0;
++ rpn_val.res2 = 0;
++ rpn_val.xon_u8 = 0x11;
++ rpn_val.xoff_u8 = 0x13;
++ memset(&rpn_val.pm, 0 , 2); *//* Set the mask to zero */
++}
++
++static void ts0710_upon_disconnect(void)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ __u8 j;
++
++ for (j = 0; j < TS0710_MAX_CHN; j++) {
++ ts0710->dlci[j].state = DISCONNECTED;
++ wake_up_interruptible(&ts0710->dlci[j].open_wait);
++ wake_up_interruptible(&ts0710->dlci[j].close_wait);
++ }
++ ts0710->be_testing = 0;
++ wake_up_interruptible(&ts0710->test_wait);
++ ts0710_reset_con();
++}
++
++/* Sending packet functions */
++
++/* Creates a UA packet and puts it at the beginning of the pkt pointer */
++
++static int send_ua(ts0710_con * ts0710, __u8 dlci)
++{
++ __u8 buf[sizeof(short_frame) + FCS_SIZE + FLAG_SIZE];
++ short_frame *ua;
++
++ TS0710_DEBUG("send_ua: Creating UA packet to DLCI %d\n", dlci);
++
++ ua = (short_frame *) (buf + 1);
++ ua->h.addr.ea = 1;
++ ua->h.addr.cr = ((~(ts0710->initiator)) & 0x1);
++ ua->h.addr.d = (dlci) & 0x1;
++ ua->h.addr.server_chn = (dlci) >> 0x1;
++ ua->h.control = SET_PF(UA);
++ ua->h.length.ea = 1;
++ ua->h.length.len = 0;
++ ua->data[0] = crc_calc((__u8 *) ua, SHORT_CRC_CHECK);
++
++ return basic_write(ts0710, buf, sizeof(short_frame) + FCS_SIZE);
++}
++
++/* Creates a DM packet and puts it at the beginning of the pkt pointer */
++
++static int send_dm(ts0710_con * ts0710, __u8 dlci)
++{
++ __u8 buf[sizeof(short_frame) + FCS_SIZE + FLAG_SIZE];
++ short_frame *dm;
++
++ TS0710_DEBUG("send_dm: Creating DM packet to DLCI %d\n", dlci);
++
++ dm = (short_frame *) (buf + 1);
++ dm->h.addr.ea = 1;
++ dm->h.addr.cr = ((~(ts0710->initiator)) & 0x1);
++ dm->h.addr.d = dlci & 0x1;
++ dm->h.addr.server_chn = dlci >> 0x1;
++ dm->h.control = SET_PF(DM);
++ dm->h.length.ea = 1;
++ dm->h.length.len = 0;
++ dm->data[0] = crc_calc((__u8 *) dm, SHORT_CRC_CHECK);
++
++ return basic_write(ts0710, buf, sizeof(short_frame) + FCS_SIZE);
++}
++
++static int send_sabm(ts0710_con * ts0710, __u8 dlci)
++{
++ __u8 buf[sizeof(short_frame) + FCS_SIZE + FLAG_SIZE];
++ short_frame *sabm;
++
++ TS0710_DEBUG("send_sabm: Creating SABM packet to DLCI %d\n", dlci);
++
++ sabm = (short_frame *) (buf + 1);
++ sabm->h.addr.ea = 1;
++ sabm->h.addr.cr = ((ts0710->initiator) & 0x1);
++ sabm->h.addr.d = dlci & 0x1;
++ sabm->h.addr.server_chn = dlci >> 0x1;
++ sabm->h.control = SET_PF(SABM);
++ sabm->h.length.ea = 1;
++ sabm->h.length.len = 0;
++ sabm->data[0] = crc_calc((__u8 *) sabm, SHORT_CRC_CHECK);
++
++ return basic_write(ts0710, buf, sizeof(short_frame) + FCS_SIZE);
++}
++
++static int send_disc(ts0710_con * ts0710, __u8 dlci)
++{
++ __u8 buf[sizeof(short_frame) + FCS_SIZE + FLAG_SIZE];
++ short_frame *disc;
++
++ TS0710_DEBUG("send_disc: Creating DISC packet to DLCI %d\n", dlci);
++
++ disc = (short_frame *) (buf + 1);
++ disc->h.addr.ea = 1;
++ disc->h.addr.cr = ((ts0710->initiator) & 0x1);
++ disc->h.addr.d = dlci & 0x1;
++ disc->h.addr.server_chn = dlci >> 0x1;
++ disc->h.control = SET_PF(DISC);
++ disc->h.length.ea = 1;
++ disc->h.length.len = 0;
++ disc->data[0] = crc_calc((__u8 *) disc, SHORT_CRC_CHECK);
++
++ return basic_write(ts0710, buf, sizeof(short_frame) + FCS_SIZE);
++}
++
++static void queue_uih(mux_send_struct * send_info, __u16 len,
++ ts0710_con * ts0710, __u8 dlci)
++{
++ __u32 size;
++
++ TS0710_DEBUG
++ ("queue_uih: Creating UIH packet with %d bytes data to DLCI %d\n",
++ len, dlci);
++
++ if (len > SHORT_PAYLOAD_SIZE) {
++ long_frame *l_pkt;
++
++ size = sizeof(long_frame) + len + FCS_SIZE;
++ l_pkt = (long_frame *) (send_info->frame - sizeof(long_frame));
++ set_uih_hdr((void *)l_pkt, dlci, len, ts0710->initiator);
++ l_pkt->data[len] = crc_calc((__u8 *) l_pkt, LONG_CRC_CHECK);
++ send_info->frame = ((__u8 *) l_pkt) - 1;
++ } else {
++ short_frame *s_pkt;
++
++ size = sizeof(short_frame) + len + FCS_SIZE;
++ s_pkt =
++ (short_frame *) (send_info->frame - sizeof(short_frame));
++ set_uih_hdr((void *)s_pkt, dlci, len, ts0710->initiator);
++ s_pkt->data[len] = crc_calc((__u8 *) s_pkt, SHORT_CRC_CHECK);
++ send_info->frame = ((__u8 *) s_pkt) - 1;
++ }
++ send_info->length = size;
++}
++
++/* Multiplexer command packets functions */
++
++/* Turns on the ts0710 flow control */
++
++static int ts0710_fcon_msg(ts0710_con * ts0710, __u8 cr)
++{
++ __u8 buf[30];
++ mcc_short_frame *mcc_pkt;
++ short_frame *uih_pkt;
++ __u32 size;
++
++ size = sizeof(short_frame) + sizeof(mcc_short_frame) + FCS_SIZE;
++ uih_pkt = (short_frame *) (buf + 1);
++ set_uih_hdr(uih_pkt, CTRL_CHAN, sizeof(mcc_short_frame),
++ ts0710->initiator);
++ uih_pkt->data[sizeof(mcc_short_frame)] =
++ crc_calc((__u8 *) uih_pkt, SHORT_CRC_CHECK);
++ mcc_pkt = (mcc_short_frame *) (uih_pkt->data);
++
++ mcc_pkt->h.type.ea = EA;
++ mcc_pkt->h.type.cr = cr;
++ mcc_pkt->h.type.type = FCON;
++ mcc_pkt->h.length.ea = EA;
++ mcc_pkt->h.length.len = 0;
++
++ return basic_write(ts0710, buf, size);
++}
++
++/* Turns off the ts0710 flow control */
++
++static int ts0710_fcoff_msg(ts0710_con * ts0710, __u8 cr)
++{
++ __u8 buf[30];
++ mcc_short_frame *mcc_pkt;
++ short_frame *uih_pkt;
++ __u32 size;
++
++ size = (sizeof(short_frame) + sizeof(mcc_short_frame) + FCS_SIZE);
++ uih_pkt = (short_frame *) (buf + 1);
++ set_uih_hdr(uih_pkt, CTRL_CHAN, sizeof(mcc_short_frame),
++ ts0710->initiator);
++ uih_pkt->data[sizeof(mcc_short_frame)] =
++ crc_calc((__u8 *) uih_pkt, SHORT_CRC_CHECK);
++ mcc_pkt = (mcc_short_frame *) (uih_pkt->data);
++
++ mcc_pkt->h.type.ea = 1;
++ mcc_pkt->h.type.cr = cr;
++ mcc_pkt->h.type.type = FCOFF;
++ mcc_pkt->h.length.ea = 1;
++ mcc_pkt->h.length.len = 0;
++
++ return basic_write(ts0710, buf, size);
++}
++
++/*
++static int ts0710_rpn_msg(ts0710_con *ts0710, __u8 cr, __u8 dlci, __u8 req)
++{
++ char buf[100];
++ rpn_msg* rpn_pkt;
++ __u32 fsize;
++ __u32 psize;
++
++ fsize = sizeof(rpn_msg);
++
++ if (req) {
++ fsize -= sizeof(rpn_values);
++ }
++
++ psize = (fsize - sizeof(short_frame) - FCS_SIZE);
++
++ rpn_pkt = (rpn_msg *) buf;
++
++ set_uih_hdr((short_frame *) rpn_pkt, CTRL_CHAN, psize, ts0710->initiator);
++
++ rpn_pkt->fcs = crc_calc((__u8*) rpn_pkt, SHORT_CRC_CHECK);
++
++ rpn_pkt->mcc_s_head.type.ea = EA;
++ rpn_pkt->mcc_s_head.type.cr = cr;
++ rpn_pkt->mcc_s_head.type.type = RPN;
++ rpn_pkt->mcc_s_head.length.ea = EA;
++
++ rpn_pkt->dlci.ea = EA;
++ rpn_pkt->dlci.cr = 1;
++ rpn_pkt->dlci.d = dlci & 1;
++ rpn_pkt->dlci.server_chn = (dlci >> 1);
++
++ if (req) {
++ rpn_pkt->mcc_s_head.length.len = 1;
++ rpn_pkt->rpn_val.bit_rate = rpn_pkt->fcs;
++ } else {
++ rpn_pkt->mcc_s_head.length.len = 8;
++ memcpy(&(rpn_pkt->rpn_val), &rpn_val, sizeof(rpn_values));
++ }
++ return basic_write(ts0710, buf, fsize);
++}
++*/
++/*
++static int ts0710_rls_msg(ts0710_con *ts0710, __u8 cr, __u8 dlci, __u8 err_code)
++{
++ char buf[100];
++ rls_msg *rls_pkt;
++ __u32 fsize;
++ __u32 psize;
++
++ fsize = sizeof(rls_msg);
++ psize = fsize - sizeof(short_frame) - FCS_SIZE;
++ rls_pkt = (rls_msg *) buf;
++
++ set_uih_hdr((short_frame *) rls_pkt, CTRL_CHAN, psize, ts0710->initiator);
++ rls_pkt->fcs = crc_calc((__u8*) rls_pkt, SHORT_CRC_CHECK);
++
++ rls_pkt->mcc_s_head.type.ea = EA;
++ rls_pkt->mcc_s_head.type.cr = cr;
++ rls_pkt->mcc_s_head.type.type = RLS;
++ rls_pkt->mcc_s_head.length.ea = EA;
++ rls_pkt->mcc_s_head.length.len = 2;
++
++ rls_pkt->dlci.ea = EA;
++ rls_pkt->dlci.cr = 1;
++ rls_pkt->dlci.d = dlci & 1;
++ rls_pkt->dlci.server_chn = dlci >> 1;
++ rls_pkt->error = err_code;
++ rls_pkt->res = 0;
++
++ return basic_write(ts0710, buf, fsize);
++}
++*/
++
++/* Sends an PN-messages and sets the not negotiable parameters to their
++ default values in ts0710 */
++
++static int send_pn_msg(ts0710_con * ts0710, __u8 prior, __u32 frame_size,
++ __u8 credit_flow, __u8 credits, __u8 dlci, __u8 cr)
++{
++ __u8 buf[30];
++ pn_msg *pn_pkt;
++ __u32 size;
++ TS0710_DEBUG
++ ("send_pn_msg: DLCI 0x%02x, prior:0x%02x, frame_size:%d, credit_flow:%x, credits:%d, cr:%x\n",
++ dlci, prior, frame_size, credit_flow, credits, cr);
++
++ size = sizeof(pn_msg);
++ pn_pkt = (pn_msg *) (buf + 1);
++
++ set_uih_hdr((void *)pn_pkt, CTRL_CHAN,
++ size - (sizeof(short_frame) + FCS_SIZE), ts0710->initiator);
++ pn_pkt->fcs = crc_calc((__u8 *) pn_pkt, SHORT_CRC_CHECK);
++
++ pn_pkt->mcc_s_head.type.ea = 1;
++ pn_pkt->mcc_s_head.type.cr = cr;
++ pn_pkt->mcc_s_head.type.type = PN;
++ pn_pkt->mcc_s_head.length.ea = 1;
++ pn_pkt->mcc_s_head.length.len = 8;
++
++ pn_pkt->res1 = 0;
++ pn_pkt->res2 = 0;
++ pn_pkt->dlci = dlci;
++ pn_pkt->frame_type = 0;
++ pn_pkt->credit_flow = credit_flow;
++ pn_pkt->prior = prior;
++ pn_pkt->ack_timer = 0;
++ SET_PN_MSG_FRAME_SIZE(pn_pkt, frame_size);
++ pn_pkt->credits = credits;
++ pn_pkt->max_nbrof_retrans = 0;
++
++ return basic_write(ts0710, buf, size);
++}
++
++/* Send a Not supported command - command, which needs 3 bytes */
++
++static int send_nsc_msg(ts0710_con * ts0710, mcc_type cmd, __u8 cr)
++{
++ __u8 buf[30];
++ nsc_msg *nsc_pkt;
++ __u32 size;
++
++ size = sizeof(nsc_msg);
++ nsc_pkt = (nsc_msg *) (buf + 1);
++
++ set_uih_hdr((void *)nsc_pkt, CTRL_CHAN,
++ sizeof(nsc_msg) - sizeof(short_frame) - FCS_SIZE,
++ ts0710->initiator);
++
++ nsc_pkt->fcs = crc_calc((__u8 *) nsc_pkt, SHORT_CRC_CHECK);
++
++ nsc_pkt->mcc_s_head.type.ea = 1;
++ nsc_pkt->mcc_s_head.type.cr = cr;
++ nsc_pkt->mcc_s_head.type.type = NSC;
++ nsc_pkt->mcc_s_head.length.ea = 1;
++ nsc_pkt->mcc_s_head.length.len = 1;
++
++ nsc_pkt->command_type.ea = 1;
++ nsc_pkt->command_type.cr = cmd.cr;
++ nsc_pkt->command_type.type = cmd.type;
++
++ return basic_write(ts0710, buf, size);
++}
++
++static int ts0710_msc_msg(ts0710_con * ts0710, __u8 value, __u8 cr, __u8 dlci)
++{
++ __u8 buf[30];
++ msc_msg *msc_pkt;
++ __u32 size;
++
++ size = sizeof(msc_msg);
++ msc_pkt = (msc_msg *) (buf + 1);
++
++ set_uih_hdr((void *)msc_pkt, CTRL_CHAN,
++ sizeof(msc_msg) - sizeof(short_frame) - FCS_SIZE,
++ ts0710->initiator);
++
++ msc_pkt->fcs = crc_calc((__u8 *) msc_pkt, SHORT_CRC_CHECK);
++
++ msc_pkt->mcc_s_head.type.ea = 1;
++ msc_pkt->mcc_s_head.type.cr = cr;
++ msc_pkt->mcc_s_head.type.type = MSC;
++ msc_pkt->mcc_s_head.length.ea = 1;
++ msc_pkt->mcc_s_head.length.len = 2;
++
++ msc_pkt->dlci.ea = 1;
++ msc_pkt->dlci.cr = 1;
++ msc_pkt->dlci.d = dlci & 1;
++ msc_pkt->dlci.server_chn = (dlci >> 1) & 0x1f;
++
++ msc_pkt->v24_sigs = value;
++
++ return basic_write(ts0710, buf, size);
++}
++
++static int ts0710_test_msg(ts0710_con * ts0710, __u8 * test_pattern, __u32 len,
++ __u8 cr, __u8 * f_buf /*Frame buf */ )
++{
++ __u32 size;
++
++ if (len > SHORT_PAYLOAD_SIZE) {
++ long_frame *uih_pkt;
++ mcc_long_frame *mcc_pkt;
++
++ size =
++ (sizeof(long_frame) + sizeof(mcc_long_frame) + len +
++ FCS_SIZE);
++ uih_pkt = (long_frame *) (f_buf + 1);
++
++ set_uih_hdr((short_frame *) uih_pkt, CTRL_CHAN, len +
++ sizeof(mcc_long_frame), ts0710->initiator);
++ uih_pkt->data[GET_LONG_LENGTH(uih_pkt->h.length)] =
++ crc_calc((__u8 *) uih_pkt, LONG_CRC_CHECK);
++ mcc_pkt = (mcc_long_frame *) uih_pkt->data;
++
++ mcc_pkt->h.type.ea = EA;
++ /* cr tells whether it is a commmand (1) or a response (0) */
++ mcc_pkt->h.type.cr = cr;
++ mcc_pkt->h.type.type = TEST;
++ SET_LONG_LENGTH(mcc_pkt->h.length, len);
++ memcpy(mcc_pkt->value, test_pattern, len);
++ } else if (len > (SHORT_PAYLOAD_SIZE - sizeof(mcc_short_frame))) {
++ long_frame *uih_pkt;
++ mcc_short_frame *mcc_pkt;
++
++ /* Create long uih packet and short mcc packet */
++ size =
++ (sizeof(long_frame) + sizeof(mcc_short_frame) + len +
++ FCS_SIZE);
++ uih_pkt = (long_frame *) (f_buf + 1);
++
++ set_uih_hdr((short_frame *) uih_pkt, CTRL_CHAN,
++ len + sizeof(mcc_short_frame), ts0710->initiator);
++ uih_pkt->data[GET_LONG_LENGTH(uih_pkt->h.length)] =
++ crc_calc((__u8 *) uih_pkt, LONG_CRC_CHECK);
++ mcc_pkt = (mcc_short_frame *) uih_pkt->data;
++
++ mcc_pkt->h.type.ea = EA;
++ mcc_pkt->h.type.cr = cr;
++ mcc_pkt->h.type.type = TEST;
++ mcc_pkt->h.length.ea = EA;
++ mcc_pkt->h.length.len = len;
++ memcpy(mcc_pkt->value, test_pattern, len);
++ } else {
++ short_frame *uih_pkt;
++ mcc_short_frame *mcc_pkt;
++
++ size =
++ (sizeof(short_frame) + sizeof(mcc_short_frame) + len +
++ FCS_SIZE);
++ uih_pkt = (short_frame *) (f_buf + 1);
++
++ set_uih_hdr((void *)uih_pkt, CTRL_CHAN, len
++ + sizeof(mcc_short_frame), ts0710->initiator);
++ uih_pkt->data[uih_pkt->h.length.len] =
++ crc_calc((__u8 *) uih_pkt, SHORT_CRC_CHECK);
++ mcc_pkt = (mcc_short_frame *) uih_pkt->data;
++
++ mcc_pkt->h.type.ea = EA;
++ mcc_pkt->h.type.cr = cr;
++ mcc_pkt->h.type.type = TEST;
++ mcc_pkt->h.length.ea = EA;
++ mcc_pkt->h.length.len = len;
++ memcpy(mcc_pkt->value, test_pattern, len);
++
++ }
++ return basic_write(ts0710, f_buf, size);
++}
++
++static void set_uih_hdr(short_frame * uih_pkt, __u8 dlci, __u32 len, __u8 cr)
++{
++ uih_pkt->h.addr.ea = 1;
++ uih_pkt->h.addr.cr = cr;
++ uih_pkt->h.addr.d = dlci & 0x1;
++ uih_pkt->h.addr.server_chn = dlci >> 1;
++ uih_pkt->h.control = CLR_PF(UIH);
++
++ if (len > SHORT_PAYLOAD_SIZE) {
++ SET_LONG_LENGTH(((long_frame *) uih_pkt)->h.length, len);
++ } else {
++ uih_pkt->h.length.ea = 1;
++ uih_pkt->h.length.len = len;
++ }
++}
++
++/* Parses a multiplexer control channel packet */
++
++void process_mcc(__u8 * data, __u32 len, ts0710_con * ts0710, int longpkt)
++{
++ __u8 *tbuf = NULL;
++ mcc_short_frame *mcc_short_pkt;
++ int j;
++
++ if (longpkt) {
++ mcc_short_pkt =
++ (mcc_short_frame *) (((long_frame *) data)->data);
++ } else {
++ mcc_short_pkt =
++ (mcc_short_frame *) (((short_frame *) data)->data);
++ }
++
++ switch (mcc_short_pkt->h.type.type) {
++ case TEST:
++ if (mcc_short_pkt->h.type.cr == MCC_RSP) {
++ TS0710_DEBUG("Received test command response\n");
++
++ if (ts0710->be_testing) {
++ if ((mcc_short_pkt->h.length.ea) == 0) {
++ mcc_long_frame *mcc_long_pkt;
++ mcc_long_pkt =
++ (mcc_long_frame *) mcc_short_pkt;
++ if (GET_LONG_LENGTH
++ (mcc_long_pkt->h.length) !=
++ TEST_PATTERN_SIZE) {
++ ts0710->test_errs =
++ TEST_PATTERN_SIZE;
++ TS0710_DEBUG
++ ("Err: received test pattern is %d bytes long, not expected %d\n",
++ GET_LONG_LENGTH
++ (mcc_long_pkt->h.length),
++ TEST_PATTERN_SIZE);
++ } else {
++ ts0710->test_errs = 0;
++ for (j = 0;
++ j < TEST_PATTERN_SIZE;
++ j++) {
++ if (mcc_long_pkt->
++ value[j] !=
++ (j & 0xFF)) {
++ (ts0710->
++ test_errs)++;
++ }
++ }
++ }
++
++ } else {
++
++#if TEST_PATTERN_SIZE < 128
++ if (mcc_short_pkt->h.length.len !=
++ TEST_PATTERN_SIZE) {
++#endif
++
++ ts0710->test_errs =
++ TEST_PATTERN_SIZE;
++ TS0710_DEBUG
++ ("Err: received test pattern is %d bytes long, not expected %d\n",
++ mcc_short_pkt->h.length.
++ len, TEST_PATTERN_SIZE);
++
++#if TEST_PATTERN_SIZE < 128
++ } else {
++ ts0710->test_errs = 0;
++ for (j = 0;
++ j < TEST_PATTERN_SIZE;
++ j++) {
++ if (mcc_short_pkt->
++ value[j] !=
++ (j & 0xFF)) {
++ (ts0710->
++ test_errs)++;
++ }
++ }
++ }
++#endif
++
++ }
++
++ ts0710->be_testing = 0; /* Clear the flag */
++ wake_up_interruptible(&ts0710->test_wait);
++ } else {
++ TS0710_DEBUG
++ ("Err: shouldn't or late to get test cmd response\n");
++ }
++ } else {
++ tbuf = (__u8 *) kmalloc(len + 32, GFP_ATOMIC);
++ if (!tbuf) {
++ break;
++ }
++
++ if ((mcc_short_pkt->h.length.ea) == 0) {
++ mcc_long_frame *mcc_long_pkt;
++ mcc_long_pkt = (mcc_long_frame *) mcc_short_pkt;
++ ts0710_test_msg(ts0710, mcc_long_pkt->value,
++ GET_LONG_LENGTH(mcc_long_pkt->h.
++ length),
++ MCC_RSP, tbuf);
++ } else {
++ ts0710_test_msg(ts0710, mcc_short_pkt->value,
++ mcc_short_pkt->h.length.len,
++ MCC_RSP, tbuf);
++ }
++
++ kfree(tbuf);
++ }
++ break;
++
++ case FCON: /*Flow control on command */
++ TS0710_PRINTK
++ ("MUX Received Flow control(all channels) on command\n");
++ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
++ ts0710->dlci[0].state = CONNECTED;
++ ts0710_fcon_msg(ts0710, MCC_RSP);
++ mux_sched_send();
++ }
++ break;
++
++ case FCOFF: /*Flow control off command */
++ TS0710_PRINTK
++ ("MUX Received Flow control(all channels) off command\n");
++ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
++ for (j = 0; j < TS0710_MAX_CHN; j++) {
++ ts0710->dlci[j].state = FLOW_STOPPED;
++ }
++ ts0710_fcoff_msg(ts0710, MCC_RSP);
++ }
++ break;
++
++ case MSC: /*Modem status command */
++ {
++ __u8 dlci;
++ __u8 v24_sigs;
++
++ dlci = (mcc_short_pkt->value[0]) >> 2;
++ v24_sigs = mcc_short_pkt->value[1];
++
++ if ((ts0710->dlci[dlci].state != CONNECTED)
++ && (ts0710->dlci[dlci].state != FLOW_STOPPED)) {
++ send_dm(ts0710, dlci);
++ break;
++ }
++ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
++ TS0710_DEBUG("Received Modem status command\n");
++ if (v24_sigs & 2) {
++ if (ts0710->dlci[dlci].state ==
++ CONNECTED) {
++ TS0710_LOG
++ ("MUX Received Flow off on dlci %d\n",
++ dlci);
++ ts0710->dlci[dlci].state =
++ FLOW_STOPPED;
++ }
++ } else {
++ if (ts0710->dlci[dlci].state ==
++ FLOW_STOPPED) {
++ ts0710->dlci[dlci].state =
++ CONNECTED;
++ TS0710_LOG
++ ("MUX Received Flow on on dlci %d\n",
++ dlci);
++ mux_sched_send();
++ }
++ }
++
++ ts0710_msc_msg(ts0710, v24_sigs, MCC_RSP, dlci);
++/*
++ if (!(ts0710->dlci[dlci].initiated) && !(ts0710->dlci[dlci].initiator)) {
++ ts0710_msc_msg(ts0710, EA | RTR | RTC | DV, MCC_CMD, dlci);
++ ts0710->dlci[dlci].initiated = 1;
++ }
++*/
++ } else {
++ TS0710_DEBUG
++ ("Received Modem status response\n");
++
++ if (v24_sigs & 2) {
++ TS0710_DEBUG("Flow stop accepted\n");
++ }
++ }
++ break;
++ }
++
++ /* case RPN: *//*Remote port negotiation command */
++
++/* {
++ __u8 dlci;
++
++ dlci = (mcc_short_pkt->value[0]) >> 2;
++
++ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
++ if (mcc_short_pkt->h.length.len == 1) {
++ TS0710_DEBUG("Received Remote port negotiation command\n");
++ ts0710_rpn_msg(ts0710, MCC_RSP, dlci, 0);
++ } else {
++*/
++ /* Accept the other sides settings (accept all for now) */
++/* TS0710_DEBUG("Received Remote port negotiation respons\n");
++ memcpy(&rpn_val, &mcc_short_pkt->value[1], 8);
++ ts0710_rpn_msg(ts0710, MCC_RSP, dlci, 0);
++*/
++ /* Zero the parametermask after response */
++/* memset(&rpn_val.pm, 0, 2);
++ }
++ }
++ break;
++ }
++*/
++/*
++ case RLS: *//*Remote line status */
++/* {
++ __u8 dlci;
++ __u8 err_code;
++
++ TS0710_DEBUG("Received Remote line status\n");
++ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
++ dlci = mcc_short_pkt->value[0] >> 2;
++ err_code = mcc_short_pkt->value[1];
++
++ ts0710_rls_msg(ts0710, MCC_RSP, dlci, err_code);
++ }
++ break;
++ }
++*/
++ case PN: /*DLC parameter negotiation */
++ {
++ __u8 dlci;
++ __u16 frame_size;
++ pn_msg *pn_pkt;
++
++ pn_pkt = (pn_msg *) data;
++ dlci = pn_pkt->dlci;
++ frame_size = GET_PN_MSG_FRAME_SIZE(pn_pkt);
++ TS0710_DEBUG
++ ("Received DLC parameter negotiation, PN\n");
++ if (pn_pkt->mcc_s_head.type.cr == MCC_CMD) {
++ TS0710_DEBUG("received PN command with:\n");
++ TS0710_DEBUG("Frame size:%d\n", frame_size);
++
++ frame_size =
++ min(frame_size, ts0710->dlci[dlci].mtu);
++ send_pn_msg(ts0710, pn_pkt->prior, frame_size,
++ 0, 0, dlci, MCC_RSP);
++ ts0710->dlci[dlci].mtu = frame_size;
++ TS0710_DEBUG("process_mcc : mtu set to %d\n",
++ ts0710->dlci[dlci].mtu);
++ } else {
++ TS0710_DEBUG("received PN response with:\n");
++ TS0710_DEBUG("Frame size:%d\n", frame_size);
++
++ frame_size =
++ min(frame_size, ts0710->dlci[dlci].mtu);
++ ts0710->dlci[dlci].mtu = frame_size;
++
++ TS0710_DEBUG
++ ("process_mcc : mtu set on dlci:%d to %d\n",
++ dlci, ts0710->dlci[dlci].mtu);
++
++ if (ts0710->dlci[dlci].state == NEGOTIATING) {
++ ts0710->dlci[dlci].state = CONNECTING;
++ wake_up_interruptible(&ts0710->
++ dlci[dlci].
++ open_wait);
++ }
++ }
++ break;
++ }
++
++ case NSC: /*Non supported command resonse */
++ TS0710_LOG("MUX Received Non supported command response\n");
++ break;
++
++ default: /*Non supported command received */
++ TS0710_LOG("MUX Received a non supported command\n");
++ send_nsc_msg(ts0710, mcc_short_pkt->h.type, MCC_RSP);
++ break;
++ }
++}
++
++static mux_recv_packet *get_mux_recv_packet(__u32 size)
++{
++ mux_recv_packet *recv_packet;
++
++ TS0710_DEBUG("Enter into get_mux_recv_packet");
++
++ recv_packet =
++ (mux_recv_packet *) kmalloc(sizeof(mux_recv_packet), GFP_ATOMIC);
++ if (!recv_packet) {
++ return 0;
++ }
++
++ recv_packet->data = (__u8 *) kmalloc(size, GFP_ATOMIC);
++ if (!(recv_packet->data)) {
++ kfree(recv_packet);
++ return 0;
++ }
++ recv_packet->length = 0;
++ recv_packet->next = 0;
++ return recv_packet;
++}
++
++static void free_mux_recv_packet(mux_recv_packet * recv_packet)
++{
++ TS0710_DEBUG("Enter into free_mux_recv_packet");
++
++ if (!recv_packet) {
++ return;
++ }
++
++ if (recv_packet->data) {
++ kfree(recv_packet->data);
++ }
++ kfree(recv_packet);
++}
++
++static void free_mux_recv_struct(mux_recv_struct * recv_info)
++{
++ mux_recv_packet *recv_packet1, *recv_packet2;
++
++ if (!recv_info) {
++ return;
++ }
++
++ recv_packet1 = recv_info->mux_packet;
++ while (recv_packet1) {
++ recv_packet2 = recv_packet1->next;
++ free_mux_recv_packet(recv_packet1);
++ recv_packet1 = recv_packet2;
++ }
++
++ kfree(recv_info);
++}
++
++static inline void add_post_recv_queue(mux_recv_struct ** head,
++ mux_recv_struct * new_item)
++{
++ new_item->next = *head;
++ *head = new_item;
++}
++
++static void ts0710_flow_on(__u8 dlci, ts0710_con * ts0710)
++{
++ int i;
++ __u8 cmdtty;
++ __u8 datatty;
++ struct tty_struct *tty;
++ mux_recv_struct *recv_info;
++
++ if ((ts0710->dlci[0].state != CONNECTED)
++ && (ts0710->dlci[0].state != FLOW_STOPPED)) {
++ return;
++ } else if ((ts0710->dlci[dlci].state != CONNECTED)
++ && (ts0710->dlci[dlci].state != FLOW_STOPPED)) {
++ return;
++ }
++
++ if (!(ts0710->dlci[dlci].flow_control)) {
++ return;
++ }
++
++ cmdtty = dlci2tty[dlci].cmdtty;
++ datatty = dlci2tty[dlci].datatty;
++
++ if (cmdtty != datatty) {
++ /* Check AT cmd tty */
++ tty = mux_table[cmdtty];
++ if (mux_tty[cmdtty] && tty) {
++ if (test_bit(TTY_THROTTLED, &tty->flags)) {
++ return;
++ }
++ }
++ recv_info = mux_recv_info[cmdtty];
++ if (mux_recv_info_flags[cmdtty] && recv_info) {
++ if (recv_info->total) {
++ return;
++ }
++ }
++
++ /* Check data tty */
++ tty = mux_table[datatty];
++ if (mux_tty[datatty] && tty) {
++ if (test_bit(TTY_THROTTLED, &tty->flags)) {
++ return;
++ }
++ }
++ recv_info = mux_recv_info[datatty];
++ if (mux_recv_info_flags[datatty] && recv_info) {
++ if (recv_info->total) {
++ return;
++ }
++ }
++ }
++
++ for (i = 0; i < 3; i++) {
++ if (ts0710_msc_msg(ts0710, EA | RTC | RTR | DV, MCC_CMD, dlci) <
++ 0) {
++ continue;
++ } else {
++ TS0710_LOG("MUX send Flow on on dlci %d\n", dlci);
++ ts0710->dlci[dlci].flow_control = 0;
++ break;
++ }
++ }
++}
++
++static void ts0710_flow_off(struct tty_struct *tty, __u8 dlci,
++ ts0710_con * ts0710)
++{
++ int i;
++
++ if (test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
++ return;
++ }
++
++ if ((ts0710->dlci[0].state != CONNECTED)
++ && (ts0710->dlci[0].state != FLOW_STOPPED)) {
++ return;
++ } else if ((ts0710->dlci[dlci].state != CONNECTED)
++ && (ts0710->dlci[dlci].state != FLOW_STOPPED)) {
++ return;
++ }
++
++ if (ts0710->dlci[dlci].flow_control) {
++ return;
++ }
++
++ for (i = 0; i < 3; i++) {
++ if (ts0710_msc_msg
++ (ts0710, EA | FC | RTC | RTR | DV, MCC_CMD, dlci) < 0) {
++ continue;
++ } else {
++ TS0710_LOG("MUX send Flow off on dlci %d\n", dlci);
++ ts0710->dlci[dlci].flow_control = 1;
++ break;
++ }
++ }
++}
++
++int ts0710_recv_data(ts0710_con * ts0710, char *data, int len)
++{
++ short_frame *short_pkt;
++ long_frame *long_pkt;
++ __u8 *uih_data_start;
++ __u32 uih_len;
++ __u8 dlci;
++ __u8 be_connecting;
++#ifdef TS0710DEBUG
++ unsigned long t;
++#endif
++
++ short_pkt = (short_frame *) data;
++
++ dlci = short_pkt->h.addr.server_chn << 1 | short_pkt->h.addr.d;
++ switch (CLR_PF(short_pkt->h.control)) {
++ case SABM:
++ TS0710_DEBUG("SABM-packet received\n");
++
++/*For BP UART problem
++ if( crc_check((__u8*) short_pkt, SHORT_CRC_CHECK, short_pkt->data[0]) )
++ break;
++*/
++
++ if (!dlci) {
++ TS0710_DEBUG("server channel == 0\n");
++ ts0710->dlci[0].state = CONNECTED;
++
++ TS0710_DEBUG("sending back UA - control channel\n");
++ send_ua(ts0710, dlci);
++ wake_up_interruptible(&ts0710->dlci[0].open_wait);
++
++ } else if (valid_dlci(dlci)) {
++
++ TS0710_DEBUG("Incomming connect on channel %d\n", dlci);
++
++ TS0710_DEBUG("sending UA, dlci %d\n", dlci);
++ send_ua(ts0710, dlci);
++
++ ts0710->dlci[dlci].state = CONNECTED;
++ wake_up_interruptible(&ts0710->dlci[dlci].open_wait);
++
++ } else {
++ TS0710_DEBUG("invalid dlci %d, sending DM\n", dlci);
++ send_dm(ts0710, dlci);
++ }
++
++ break;
++
++ case UA:
++ TS0710_DEBUG("UA packet received\n");
++
++/*For BP UART problem
++ if( crc_check((__u8*) short_pkt, SHORT_CRC_CHECK, short_pkt->data[0]) )
++ break;
++*/
++
++ if (!dlci) {
++ TS0710_DEBUG("server channel == 0\n");
++
++ if (ts0710->dlci[0].state == CONNECTING) {
++ ts0710->dlci[0].state = CONNECTED;
++ wake_up_interruptible(&ts0710->dlci[0].
++ open_wait);
++ } else if (ts0710->dlci[0].state == DISCONNECTING) {
++ ts0710_upon_disconnect();
++ } else {
++ TS0710_DEBUG
++ (" Something wrong receiving UA packet\n");
++ }
++ } else if (valid_dlci(dlci)) {
++ TS0710_DEBUG("Incomming UA on channel %d\n", dlci);
++
++ if (ts0710->dlci[dlci].state == CONNECTING) {
++ ts0710->dlci[dlci].state = CONNECTED;
++ wake_up_interruptible(&ts0710->dlci[dlci].
++ open_wait);
++ } else if (ts0710->dlci[dlci].state == DISCONNECTING) {
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ wake_up_interruptible(&ts0710->dlci[dlci].
++ open_wait);
++ wake_up_interruptible(&ts0710->dlci[dlci].
++ close_wait);
++ ts0710_reset_dlci(dlci);
++ } else {
++ TS0710_DEBUG
++ (" Something wrong receiving UA packet\n");
++ }
++ } else {
++ TS0710_DEBUG("invalid dlci %d\n", dlci);
++ }
++
++ break;
++
++ case DM:
++ TS0710_DEBUG("DM packet received\n");
++
++/*For BP UART problem
++ if( crc_check((__u8*) short_pkt, SHORT_CRC_CHECK, short_pkt->data[0]) )
++ break;
++*/
++
++ if (!dlci) {
++ TS0710_DEBUG("server channel == 0\n");
++
++ if (ts0710->dlci[0].state == CONNECTING) {
++ be_connecting = 1;
++ } else {
++ be_connecting = 0;
++ }
++ ts0710_upon_disconnect();
++ if (be_connecting) {
++ ts0710->dlci[0].state = REJECTED;
++ }
++ } else if (valid_dlci(dlci)) {
++ TS0710_DEBUG("Incomming DM on channel %d\n", dlci);
++
++ if (ts0710->dlci[dlci].state == CONNECTING) {
++ ts0710->dlci[dlci].state = REJECTED;
++ } else {
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ }
++ wake_up_interruptible(&ts0710->dlci[dlci].open_wait);
++ wake_up_interruptible(&ts0710->dlci[dlci].close_wait);
++ ts0710_reset_dlci(dlci);
++ } else {
++ TS0710_DEBUG("invalid dlci %d\n", dlci);
++ }
++
++ break;
++
++ case DISC:
++ TS0710_DEBUG("DISC packet received\n");
++
++/*For BP UART problem
++ if( crc_check((__u8*) short_pkt, SHORT_CRC_CHECK, short_pkt->data[0]) )
++ break;
++*/
++
++ if (!dlci) {
++ TS0710_DEBUG("server channel == 0\n");
++
++ send_ua(ts0710, dlci);
++ TS0710_DEBUG("DISC, sending back UA\n");
++
++ ts0710_upon_disconnect();
++ } else if (valid_dlci(dlci)) {
++ TS0710_DEBUG("Incomming DISC on channel %d\n", dlci);
++
++ send_ua(ts0710, dlci);
++ TS0710_DEBUG("DISC, sending back UA\n");
++
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ wake_up_interruptible(&ts0710->dlci[dlci].open_wait);
++ wake_up_interruptible(&ts0710->dlci[dlci].close_wait);
++ ts0710_reset_dlci(dlci);
++ } else {
++ TS0710_DEBUG("invalid dlci %d\n", dlci);
++ }
++
++ break;
++
++ case UIH:
++ TS0710_DEBUG("UIH packet received\n");
++
++ if ((dlci >= TS0710_MAX_CHN)) {
++ TS0710_DEBUG("invalid dlci %d\n", dlci);
++ send_dm(ts0710, dlci);
++ break;
++ }
++
++ if (GET_PF(short_pkt->h.control)) {
++ TS0710_LOG
++ ("MUX Error %s: UIH packet with P/F set, discard it!\n",
++ __FUNCTION__);
++ break;
++ }
++
++ if ((ts0710->dlci[dlci].state != CONNECTED)
++ && (ts0710->dlci[dlci].state != FLOW_STOPPED)) {
++ TS0710_LOG
++ ("MUX Error %s: DLCI %d not connected, discard it!\n",
++ __FUNCTION__, dlci);
++ send_dm(ts0710, dlci);
++ break;
++ }
++
++ if ((short_pkt->h.length.ea) == 0) {
++ TS0710_DEBUG("Long UIH packet received\n");
++ long_pkt = (long_frame *) data;
++ uih_len = GET_LONG_LENGTH(long_pkt->h.length);
++ uih_data_start = long_pkt->h.data;
++ TS0710_DEBUG("long packet length %d\n", uih_len);
++
++/*For BP UART problem
++ if (crc_check(data, LONG_CRC_CHECK, *(uih_data_start + uih_len)))
++ break;
++*/
++ } else {
++ TS0710_DEBUG("Short UIH pkt received\n");
++ uih_len = short_pkt->h.length.len;
++ uih_data_start = short_pkt->data;
++
++/*For BP UART problem
++ if (crc_check(data, SHORT_CRC_CHECK, *(uih_data_start + uih_len)))
++ break;
++*/
++ }
++
++ if (dlci == 0) {
++ TS0710_DEBUG("UIH on serv_channel 0\n");
++ process_mcc(data, len, ts0710,
++ !(short_pkt->h.length.ea));
++ } else if (valid_dlci(dlci)) {
++ /* do tty dispatch */
++ __u8 tag;
++ __u8 tty_idx;
++ struct tty_struct *tty;
++ __u8 queue_data;
++ __u8 post_recv;
++ __u8 flow_control;
++ mux_recv_struct *recv_info;
++ int recv_room;
++ mux_recv_packet *recv_packet, *recv_packet2;
++
++ TS0710_DEBUG("UIH on channel %d\n", dlci);
++
++ if (uih_len > ts0710->dlci[dlci].mtu) {
++ TS0710_PRINTK
++ ("MUX Error: DLCI:%d, uih_len:%d is bigger than mtu:%d, discard data!\n",
++ dlci, uih_len, ts0710->dlci[dlci].mtu);
++ break;
++ }
++
++ tag = *uih_data_start;
++ uih_data_start++;
++ uih_len--;
++
++ if (!uih_len) {
++ break;
++ }
++
++ switch (tag) {
++ case CMDTAG:
++ tty_idx = dlci2tty[dlci].cmdtty;
++ TS0710_DEBUG("CMDTAG on DLCI:%d, /dev/mux%d\n",
++ dlci, tty_idx);
++ TS0710_DEBUGSTR(uih_data_start, uih_len);
++ if (!(iscmdtty[tty_idx])) {
++ TS0710_PRINTK
++ ("MUX Error: %s: Wrong CMDTAG on DLCI:%d, /dev/mux%d\n",
++ __FUNCTION__, dlci, tty_idx);
++ }
++ break;
++ case DATATAG:
++ default:
++ tty_idx = dlci2tty[dlci].datatty;
++ TS0710_DEBUG
++ ("NON-CMDTAG on DLCI:%d, /dev/mux%d\n",
++ dlci, tty_idx);
++ if (iscmdtty[tty_idx]) {
++ TS0710_PRINTK
++ ("MUX Error: %s: Wrong NON-CMDTAG on DLCI:%d, /dev/mux%d\n",
++ __FUNCTION__, dlci, tty_idx);
++ }
++ break;
++ }
++ tty = mux_table[tty_idx];
++ if ((!mux_tty[tty_idx]) || (!tty)) {
++ TS0710_PRINTK
++ ("MUX: No application waiting for, discard it! /dev/mux%d\n",
++ tty_idx);
++ } else { /* Begin processing received data */
++ if ((!mux_recv_info_flags[tty_idx])
++ || (!mux_recv_info[tty_idx])) {
++ TS0710_PRINTK
++ ("MUX Error: No mux_recv_info, discard it! /dev/mux%d\n",
++ tty_idx);
++ break;
++ }
++
++ recv_info = mux_recv_info[tty_idx];
++ if (recv_info->total > 8192) {
++ TS0710_PRINTK
++ ("MUX : discard data for tty_idx:%d, recv_info->total > 8192 \n",
++ tty_idx);
++ break;
++ }
++
++ queue_data = 0;
++ post_recv = 0;
++ flow_control = 0;
++ recv_room = 65535;
++ if (tty->receive_room)
++ recv_room = tty->receive_room;
++
++ if (test_bit(TTY_THROTTLED, &tty->flags)) {
++ queue_data = 1;
++ } else {
++ if (test_bit
++ (TTY_DONT_FLIP, &tty->flags)) {
++ queue_data = 1;
++ post_recv = 1;
++ } else if (recv_info->total) {
++ queue_data = 1;
++ post_recv = 1;
++ } else if (recv_room < uih_len) {
++ queue_data = 1;
++ flow_control = 1;
++ }
++
++ if ((recv_room -
++ (uih_len + recv_info->total)) <
++ ts0710->dlci[dlci].mtu) {
++ flow_control = 1;
++ }
++ }
++
++ if (!queue_data) {
++ /* Put received data into read buffer of tty */
++ TS0710_DEBUG
++ ("Put received data into read buffer of /dev/mux%d",
++ tty_idx);
++
++#ifdef TS0710DEBUG
++ t = jiffies;
++#endif
++
++ (tty->ldisc.receive_buf) (tty,
++ uih_data_start,
++ NULL,
++ uih_len);
++
++#ifdef TS0710DEBUG
++ TS0710_DEBUG
++ ("tty->ldisc.receive_buf take ticks: %lu",
++ (jiffies - t));
++#endif
++
++ } else { /* Queue data */
++
++ TS0710_DEBUG
++ ("Put received data into recv queue of /dev/mux%d",
++ tty_idx);
++ if (recv_info->total) {
++ /* recv_info is already linked into mux_recv_queue */
++
++ recv_packet =
++ get_mux_recv_packet
++ (uih_len);
++ if (!recv_packet) {
++ TS0710_PRINTK
++ ("MUX %s: no memory\n",
++ __FUNCTION__);
++ break;
++ }
++
++ memcpy(recv_packet->data,
++ uih_data_start, uih_len);
++ recv_packet->length = uih_len;
++ recv_info->total += uih_len;
++ recv_packet->next = NULL;
++
++ if (!(recv_info->mux_packet)) {
++ recv_info->mux_packet =
++ recv_packet;
++ } else {
++ recv_packet2 =
++ recv_info->
++ mux_packet;
++ while (recv_packet2->
++ next) {
++ recv_packet2 =
++ recv_packet2->
++ next;
++ }
++ recv_packet2->next =
++ recv_packet;
++ } /* End if( !(recv_info->mux_packet) ) */
++ } else { /* recv_info->total == 0 */
++ if (uih_len >
++ TS0710MUX_RECV_BUF_SIZE) {
++ TS0710_PRINTK
++ ("MUX Error: tty_idx:%d, uih_len == %d is too big\n",
++ tty_idx, uih_len);
++ uih_len =
++ TS0710MUX_RECV_BUF_SIZE;
++ }
++ memcpy(recv_info->data,
++ uih_data_start, uih_len);
++ recv_info->length = uih_len;
++ recv_info->total = uih_len;
++
++ add_post_recv_queue
++ (&mux_recv_queue,
++ recv_info);
++ } /* End recv_info->total == 0 */
++ } /* End Queue data */
++
++ if (flow_control) {
++ /* Do something for flow control */
++ ts0710_flow_off(tty, dlci, ts0710);
++ }
++
++ if (tty_idx ==
++ dlci2tty[TS0710MUX_GPRS1_DLCI].datatty) {
++ if (add_count
++ (TS0710MUX_GPRS1_RECV_COUNT_IDX,
++ uih_len) < 0) {
++ post_recv_count_flag = 1;
++ post_recv = 1;
++ mux_data_count2
++ [TS0710MUX_GPRS1_RECV_COUNT_IDX]
++ += uih_len;
++ }
++ } else if (tty_idx ==
++ dlci2tty[TS0710MUX_GPRS2_DLCI].
++ datatty) {
++ if (add_count
++ (TS0710MUX_GPRS2_RECV_COUNT_IDX,
++ uih_len) < 0) {
++ post_recv_count_flag = 1;
++ post_recv = 1;
++ mux_data_count2
++ [TS0710MUX_GPRS2_RECV_COUNT_IDX]
++ += uih_len;
++ }
++ }
++
++ if (post_recv)
++ schedule_work(&post_recv_tqueue);
++ } /* End processing received data */
++ } else {
++ TS0710_DEBUG("invalid dlci %d\n", dlci);
++ }
++
++ break;
++
++ default:
++ TS0710_DEBUG("illegal packet\n");
++ break;
++ }
++ return 0;
++}
++
++/*
++int ts0710_send_data(ts0710_con *ts0710, __u8 dlci, __u8 *data, __u32 count)
++{
++ __u32 c, total = 0;
++ __u8 tag, first;
++
++ if( ts0710->dlci[0].state == FLOW_STOPPED ){
++ TS0710_DEBUG("Flow stopped on all channels, returning zero\n");
++*/
++/*
++ return -EFLOWSTOPPED;
++ } else if( ts0710->dlci[dlci].state == FLOW_STOPPED ){
++ TS0710_DEBUG("Flow stopped, returning zero\n");
++*/
++/*
++ return -EFLOWSTOPPED;
++ } else if( ts0710->dlci[dlci].state == CONNECTED ){
++
++ TS0710_DEBUG("trying to send %d bytes\n", count);
++ tag = *data;
++ first = 1;
++*/
++ /* The first byte is always a Cmd/Data tag */
++/*
++ while( count > 1 ){
++
++ c = min(count, ts0710->dlci[dlci].mtu);
++ if( queue_uih(data, c, ts0710, dlci) <= 0 ) {
++ break;
++ }
++
++ total += (c - 1);
++ data += (c - 1);
++ *data = tag;
++ count -= (c - 1);
++
++ if( first ) {
++ first = 0;
++ total++;
++ }
++ }
++ TS0710_DEBUG("sent %d bytes\n", total);
++ return total;
++ } else {
++ TS0710_DEBUG("DLCI %d not connected\n", dlci);
++ return -EDISCONNECTED;
++ }
++}
++*/
++
++/* Close ts0710 channel */
++static void ts0710_close_channel(__u8 dlci)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int try;
++ unsigned long t;
++
++ TS0710_DEBUG("ts0710_disc_command on channel %d\n", dlci);
++
++ if ((ts0710->dlci[dlci].state == DISCONNECTED)
++ || (ts0710->dlci[dlci].state == REJECTED)) {
++ return;
++ } else if (ts0710->dlci[dlci].state == DISCONNECTING) {
++ /* Reentry */
++ return;
++ } else {
++ ts0710->dlci[dlci].state = DISCONNECTING;
++ try = 3;
++ while (try--) {
++ t = jiffies;
++ send_disc(ts0710, dlci);
++ interruptible_sleep_on_timeout(&ts0710->dlci[dlci].
++ close_wait,
++ TS0710MUX_TIME_OUT);
++ if (ts0710->dlci[dlci].state == DISCONNECTED) {
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI %d Send DISC got signal!\n",
++ dlci);
++ break;
++ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI %d Send DISC timeout!\n", dlci);
++ continue;
++ }
++ }
++
++ if (ts0710->dlci[dlci].state != DISCONNECTED) {
++ if (dlci == 0) { /* Control Channel */
++ ts0710_upon_disconnect();
++ } else { /* Other Channel */
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ wake_up_interruptible(&ts0710->dlci[dlci].
++ close_wait);
++ ts0710_reset_dlci(dlci);
++ }
++ }
++ }
++}
++
++int ts0710_open_channel(__u8 dlci)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int try;
++ int retval;
++ unsigned long t;
++
++ retval = -ENODEV;
++ if (dlci == 0) { // control channel
++ if ((ts0710->dlci[0].state == CONNECTED)
++ || (ts0710->dlci[0].state == FLOW_STOPPED)) {
++ return 0;
++ } else if (ts0710->dlci[0].state == CONNECTING) {
++ /* Reentry */
++ TS0710_PRINTK
++ ("MUX DLCI: 0, reentry to open DLCI 0, pid: %d, %s !\n",
++ current->pid, current->comm);
++ try = 11;
++ while (try--) {
++ t = jiffies;
++ interruptible_sleep_on_timeout(&ts0710->dlci[0].
++ open_wait,
++ TS0710MUX_TIME_OUT);
++ if ((ts0710->dlci[0].state == CONNECTED)
++ || (ts0710->dlci[0].state ==
++ FLOW_STOPPED)) {
++ retval = 0;
++ break;
++ } else if (ts0710->dlci[0].state == REJECTED) {
++ retval = -EREJECTED;
++ break;
++ } else if (ts0710->dlci[0].state ==
++ DISCONNECTED) {
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Wait for connecting got signal!\n",
++ dlci);
++ retval = -EAGAIN;
++ break;
++ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Wait for connecting timeout!\n",
++ dlci);
++ continue;
++ } else if (ts0710->dlci[0].state == CONNECTING) {
++ continue;
++ }
++ }
++
++ if (ts0710->dlci[0].state == CONNECTING) {
++ ts0710->dlci[0].state = DISCONNECTED;
++ }
++ } else if ((ts0710->dlci[0].state != DISCONNECTED)
++ && (ts0710->dlci[0].state != REJECTED)) {
++ TS0710_PRINTK("MUX DLCI:%d state is invalid!\n", dlci);
++ return retval;
++ } else {
++ ts0710->initiator = 1;
++ ts0710->dlci[0].state = CONNECTING;
++ ts0710->dlci[0].initiator = 1;
++ try = 10;
++ while (try--) {
++ t = jiffies;
++ send_sabm(ts0710, 0);
++ interruptible_sleep_on_timeout(&ts0710->dlci[0].
++ open_wait,
++ TS0710MUX_TIME_OUT);
++ if ((ts0710->dlci[0].state == CONNECTED)
++ || (ts0710->dlci[0].state ==
++ FLOW_STOPPED)) {
++ retval = 0;
++ break;
++ } else if (ts0710->dlci[0].state == REJECTED) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM got rejected!\n",
++ dlci);
++ retval = -EREJECTED;
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM got signal!\n",
++ dlci);
++ retval = -EAGAIN;
++ break;
++ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM timeout!\n",
++ dlci);
++ continue;
++ }
++ }
++
++ if (ts0710->dlci[0].state == CONNECTING) {
++ ts0710->dlci[0].state = DISCONNECTED;
++ }
++ wake_up_interruptible(&ts0710->dlci[0].open_wait);
++ }
++ } else { // other channel
++ if ((ts0710->dlci[0].state != CONNECTED)
++ && (ts0710->dlci[0].state != FLOW_STOPPED)) {
++ return retval;
++ } else if ((ts0710->dlci[dlci].state == CONNECTED)
++ || (ts0710->dlci[dlci].state == FLOW_STOPPED)) {
++ return 0;
++ } else if ((ts0710->dlci[dlci].state == NEGOTIATING)
++ || (ts0710->dlci[dlci].state == CONNECTING)) {
++ /* Reentry */
++ try = 8;
++ while (try--) {
++ t = jiffies;
++ interruptible_sleep_on_timeout(&ts0710->
++ dlci[dlci].
++ open_wait,
++ TS0710MUX_TIME_OUT);
++ if ((ts0710->dlci[dlci].state == CONNECTED)
++ || (ts0710->dlci[dlci].state ==
++ FLOW_STOPPED)) {
++ retval = 0;
++ break;
++ } else if (ts0710->dlci[dlci].state == REJECTED) {
++ retval = -EREJECTED;
++ break;
++ } else if (ts0710->dlci[dlci].state ==
++ DISCONNECTED) {
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Wait for connecting got signal!\n",
++ dlci);
++ retval = -EAGAIN;
++ break;
++ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Wait for connecting timeout!\n",
++ dlci);
++ continue;
++ } else
++ if ((ts0710->dlci[dlci].state ==
++ NEGOTIATING)
++ || (ts0710->dlci[dlci].state ==
++ CONNECTING)) {
++ continue;
++ }
++ }
++
++ if ((ts0710->dlci[dlci].state == NEGOTIATING)
++ || (ts0710->dlci[dlci].state == CONNECTING)) {
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ }
++ } else if ((ts0710->dlci[dlci].state != DISCONNECTED)
++ && (ts0710->dlci[dlci].state != REJECTED)) {
++ TS0710_PRINTK("MUX DLCI:%d state is invalid!\n", dlci);
++ return retval;
++ } else {
++ ts0710->dlci[dlci].state = NEGOTIATING;
++ ts0710->dlci[dlci].initiator = 1;
++ try = 3;
++ while (try--) {
++ t = jiffies;
++ send_pn_msg(ts0710, 7, ts0710->dlci[dlci].mtu,
++ 0, 0, dlci, 1);
++ interruptible_sleep_on_timeout(&ts0710->
++ dlci[dlci].
++ open_wait,
++ TS0710MUX_TIME_OUT);
++ if (ts0710->dlci[dlci].state == CONNECTING) {
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send pn_msg got signal!\n",
++ dlci);
++ retval = -EAGAIN;
++ break;
++ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send pn_msg timeout!\n",
++ dlci);
++ continue;
++ }
++ }
++
++ if (ts0710->dlci[dlci].state == CONNECTING) {
++ try = 3;
++ while (try--) {
++ t = jiffies;
++ send_sabm(ts0710, dlci);
++ interruptible_sleep_on_timeout(&ts0710->
++ dlci
++ [dlci].
++ open_wait,
++ TS0710MUX_TIME_OUT);
++ if ((ts0710->dlci[dlci].state ==
++ CONNECTED)
++ || (ts0710->dlci[dlci].state ==
++ FLOW_STOPPED)) {
++ retval = 0;
++ break;
++ } else if (ts0710->dlci[dlci].state ==
++ REJECTED) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM got rejected!\n",
++ dlci);
++ retval = -EREJECTED;
++ break;
++ } else if (signal_pending(current)) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM got signal!\n",
++ dlci);
++ retval = -EAGAIN;
++ break;
++ } else if ((jiffies - t) >=
++ TS0710MUX_TIME_OUT) {
++ TS0710_PRINTK
++ ("MUX DLCI:%d Send SABM timeout!\n",
++ dlci);
++ continue;
++ }
++ }
++ }
++
++ if ((ts0710->dlci[dlci].state == NEGOTIATING)
++ || (ts0710->dlci[dlci].state == CONNECTING)) {
++ ts0710->dlci[dlci].state = DISCONNECTED;
++ }
++ wake_up_interruptible(&ts0710->dlci[dlci].open_wait);
++ }
++ }
++ return retval;
++}
++
++static int ts0710_exec_test_cmd(void)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ __u8 *f_buf; /* Frame buffer */
++ __u8 *d_buf; /* Data buffer */
++ int retval = -EFAULT;
++ int j;
++ unsigned long t;
++
++ if (ts0710->be_testing) {
++ /* Reentry */
++ t = jiffies;
++ interruptible_sleep_on_timeout(&ts0710->test_wait,
++ 3 * TS0710MUX_TIME_OUT);
++ if (ts0710->be_testing == 0) {
++ if (ts0710->test_errs == 0) {
++ retval = 0;
++ } else {
++ retval = -EFAULT;
++ }
++ } else if (signal_pending(current)) {
++ TS0710_DEBUG
++ ("Wait for Test_cmd response got signal!\n");
++ retval = -EAGAIN;
++ } else if ((jiffies - t) >= 3 * TS0710MUX_TIME_OUT) {
++ TS0710_DEBUG("Wait for Test_cmd response timeout!\n");
++ retval = -EFAULT;
++ }
++ } else {
++ ts0710->be_testing = 1; /* Set the flag */
++
++ f_buf = (__u8 *) kmalloc(TEST_PATTERN_SIZE + 32, GFP_KERNEL);
++ d_buf = (__u8 *) kmalloc(TEST_PATTERN_SIZE + 32, GFP_KERNEL);
++ if ((!f_buf) || (!d_buf)) {
++ if (f_buf) {
++ kfree(f_buf);
++ }
++ if (d_buf) {
++ kfree(d_buf);
++ }
++
++ ts0710->be_testing = 0; /* Clear the flag */
++ ts0710->test_errs = TEST_PATTERN_SIZE;
++ wake_up_interruptible(&ts0710->test_wait);
++ return -ENOMEM;
++ }
++
++ for (j = 0; j < TEST_PATTERN_SIZE; j++) {
++ d_buf[j] = j & 0xFF;
++ }
++
++ t = jiffies;
++ ts0710_test_msg(ts0710, d_buf, TEST_PATTERN_SIZE, MCC_CMD,
++ f_buf);
++ interruptible_sleep_on_timeout(&ts0710->test_wait,
++ 2 * TS0710MUX_TIME_OUT);
++ if (ts0710->be_testing == 0) {
++ if (ts0710->test_errs == 0) {
++ retval = 0;
++ } else {
++ retval = -EFAULT;
++ }
++ } else if (signal_pending(current)) {
++ TS0710_DEBUG("Send Test_cmd got signal!\n");
++ retval = -EAGAIN;
++ } else if ((jiffies - t) >= 2 * TS0710MUX_TIME_OUT) {
++ TS0710_DEBUG("Send Test_cmd timeout!\n");
++ ts0710->test_errs = TEST_PATTERN_SIZE;
++ retval = -EFAULT;
++ }
++
++ ts0710->be_testing = 0; /* Clear the flag */
++ wake_up_interruptible(&ts0710->test_wait);
++
++ /* Release buffer */
++ if (f_buf) {
++ kfree(f_buf);
++ }
++ if (d_buf) {
++ kfree(d_buf);
++ }
++ }
++
++ return retval;
++}
++
++static void mux_sched_send(void)
++{
++
++#ifdef USB_FOR_MUX
++ schedule_work(&send_tqueue);
++#else
++ if (!tq_serial_for_mux) {
++ TS0710_PRINTK("MUX Error: %s: tq_serial_for_mux == 0\n",
++ __FUNCTION__);
++ return;
++ }
++ schedule_work(&send_tqueue);
++ mark_bh(SERIAL_BH);
++#endif
++
++}
++
++/****************************
++ * TTY driver routines
++*****************************/
++
++static void mux_close(struct tty_struct *tty, struct file *filp)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int line;
++ __u8 dlci;
++ __u8 cmdtty;
++ __u8 datatty;
++
++ UNUSED_PARAM(filp);
++
++ if (!tty) {
++ return;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ return;
++ }
++ if (mux_tty[line] > 0)
++ mux_tty[line]--;
++
++ dlci = tty2dlci[line];
++ cmdtty = dlci2tty[dlci].cmdtty;
++ datatty = dlci2tty[dlci].datatty;
++ if ((mux_tty[cmdtty] == 0) && (mux_tty[datatty] == 0)) {
++ if (dlci == 1) {
++ ts0710_close_channel(0);
++ TS0710_PRINTK
++ ("MUX mux_close: tapisrv might be down!!! Close DLCI 1\n");
++ TS0710_SIG2APLOGD();
++ }
++ ts0710_close_channel(dlci);
++ }
++
++ if (mux_tty[line] == 0) {
++ if ((mux_send_info_flags[line])
++ && (mux_send_info[line])
++ /*&& (mux_send_info[line]->filled == 0) */
++ ) {
++ mux_send_info_flags[line] = 0;
++ kfree(mux_send_info[line]);
++ mux_send_info[line] = 0;
++ TS0710_DEBUG("Free mux_send_info for /dev/mux%d", line);
++ }
++
++ if ((mux_recv_info_flags[line])
++ && (mux_recv_info[line])
++ && (mux_recv_info[line]->total == 0)) {
++ mux_recv_info_flags[line] = 0;
++ free_mux_recv_struct(mux_recv_info[line]);
++ mux_recv_info[line] = 0;
++ TS0710_DEBUG("Free mux_recv_info for /dev/mux%d", line);
++ }
++
++ ts0710_flow_on(dlci, ts0710);
++ schedule_work(&post_recv_tqueue);
++
++ wake_up_interruptible(&tty->read_wait);
++ wake_up_interruptible(&tty->write_wait);
++ tty->packet = 0;
++ }
++}
++
++static void mux_throttle(struct tty_struct *tty)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int line;
++ int i;
++ __u8 dlci;
++
++ if (!tty) {
++ return;
++ }
++
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ return;
++ }
++
++ TS0710_DEBUG("Enter into %s, minor number is: %d\n", __FUNCTION__,
++ line);
++
++ dlci = tty2dlci[line];
++ if ((ts0710->dlci[0].state != CONNECTED)
++ && (ts0710->dlci[0].state != FLOW_STOPPED)) {
++ return;
++ } else if ((ts0710->dlci[dlci].state != CONNECTED)
++ && (ts0710->dlci[dlci].state != FLOW_STOPPED)) {
++ return;
++ }
++
++ if (ts0710->dlci[dlci].flow_control) {
++ return;
++ }
++
++ for (i = 0; i < 3; i++) {
++ if (ts0710_msc_msg
++ (ts0710, EA | FC | RTC | RTR | DV, MCC_CMD, dlci) < 0) {
++ continue;
++ } else {
++ TS0710_LOG("MUX Send Flow off on dlci %d\n", dlci);
++ ts0710->dlci[dlci].flow_control = 1;
++ break;
++ }
++ }
++}
++
++static void mux_unthrottle(struct tty_struct *tty)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int line;
++ __u8 dlci;
++ mux_recv_struct *recv_info;
++
++ if (!tty) {
++ return;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ return;
++ }
++
++ if ((!mux_recv_info_flags[line]) || (!mux_recv_info[line])) {
++ return;
++ }
++
++ TS0710_DEBUG("Enter into %s, minor number is: %d\n", __FUNCTION__,
++ line);
++
++ recv_info = mux_recv_info[line];
++ dlci = tty2dlci[line];
++
++ if (recv_info->total) {
++ recv_info->post_unthrottle = 1;
++ schedule_work(&post_recv_tqueue);
++ } else {
++ ts0710_flow_on(dlci, ts0710);
++ }
++}
++
++static int mux_chars_in_buffer(struct tty_struct *tty)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int retval;
++ int line;
++ __u8 dlci;
++ mux_send_struct *send_info;
++
++ retval = TS0710MUX_MAX_CHARS_IN_BUF;
++ if (!tty) {
++ goto out;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ goto out;
++ }
++
++ dlci = tty2dlci[line];
++ if (ts0710->dlci[0].state == FLOW_STOPPED) {
++ TS0710_DEBUG
++ ("Flow stopped on all channels, returning MAX chars in buffer\n");
++ goto out;
++ } else if (ts0710->dlci[dlci].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped, returning MAX chars in buffer\n");
++ goto out;
++ } else if (ts0710->dlci[dlci].state != CONNECTED) {
++ TS0710_DEBUG("DLCI %d not connected\n", dlci);
++ goto out;
++ }
++
++ if (!(mux_send_info_flags[line])) {
++ goto out;
++ }
++ send_info = mux_send_info[line];
++ if (!send_info) {
++ goto out;
++ }
++ if (send_info->filled) {
++ goto out;
++ }
++
++ retval = 0;
++
++ out:
++ return retval;
++}
++
++static int mux_chars_in_serial_buffer(struct tty_struct *tty)
++{
++ UNUSED_PARAM(tty);
++
++ if ((COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)) {
++ TS0710_PRINTK
++ ("MUX %s: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n",
++ __FUNCTION__);
++
++#ifndef USB_FOR_MUX
++ TS0710_PRINTK
++ ("MUX %s: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n",
++ __FUNCTION__);
++ TS0710_SIG2APLOGD();
++#endif
++
++ return 0;
++ }
++ return COMM_FOR_MUX_DRIVER->chars_in_buffer(COMM_FOR_MUX_TTY);
++}
++
++static int mux_write(struct tty_struct *tty,
++ const unsigned char *buf, int count)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int line;
++ __u8 dlci;
++ mux_send_struct *send_info;
++ __u8 *d_buf;
++ __u16 c;
++ __u8 post_recv;
++
++ if (count <= 0) {
++ return 0;
++ }
++
++ if (!tty) {
++ return 0;
++ }
++
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS))
++ return -ENODEV;
++
++ dlci = tty2dlci[line];
++ if (ts0710->dlci[0].state == FLOW_STOPPED) {
++ TS0710_DEBUG
++ ("Flow stopped on all channels, returning zero /dev/mux%d\n",
++ line);
++ return 0;
++ } else if (ts0710->dlci[dlci].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped, returning zero /dev/mux%d\n", line);
++ return 0;
++ } else if (ts0710->dlci[dlci].state == CONNECTED) {
++
++ if (!(mux_send_info_flags[line])) {
++ TS0710_PRINTK
++ ("MUX Error: mux_write: mux_send_info_flags[%d] == 0\n",
++ line);
++ return -ENODEV;
++ }
++ send_info = mux_send_info[line];
++ if (!send_info) {
++ TS0710_PRINTK
++ ("MUX Error: mux_write: mux_send_info[%d] == 0\n",
++ line);
++ return -ENODEV;
++ }
++
++ c = min(count, (ts0710->dlci[dlci].mtu - 1));
++ if (c <= 0) {
++ return 0;
++ }
++
++ if (test_and_set_bit(BUF_BUSY, &send_info->flags))
++ return 0;
++
++ if (send_info->filled) {
++ clear_bit(BUF_BUSY, &send_info->flags);
++ return 0;
++ }
++
++ d_buf = ((__u8 *) send_info->buf) + TS0710MUX_SEND_BUF_OFFSET;
++ memcpy(&d_buf[1], buf, c);
++
++ TS0710_DEBUG("Prepare to send %d bytes from /dev/mux%d", c,
++ line);
++ if (iscmdtty[line]) {
++ TS0710_DEBUGSTR(&d_buf[1], c);
++ TS0710_DEBUG("CMDTAG");
++ d_buf[0] = CMDTAG;
++ } else {
++ TS0710_DEBUG("DATATAG");
++ d_buf[0] = DATATAG;
++ }
++
++ TS0710_DEBUGHEX(d_buf, c + 1);
++
++ send_info->frame = d_buf;
++ queue_uih(send_info, c + 1, ts0710, dlci);
++ send_info->filled = 1;
++ clear_bit(BUF_BUSY, &send_info->flags);
++
++ post_recv = 0;
++ if (dlci == TS0710MUX_GPRS1_DLCI) {
++ if (add_count
++ (TS0710MUX_GPRS1_SEND_COUNT_IDX, c) < 0) {
++ post_recv_count_flag = 1;
++ post_recv = 1;
++ mux_data_count2[TS0710MUX_GPRS1_SEND_COUNT_IDX]
++ += c;
++ }
++ } else if (dlci == TS0710MUX_GPRS2_DLCI) {
++ if (add_count
++ (TS0710MUX_GPRS2_SEND_COUNT_IDX, c) < 0) {
++ post_recv_count_flag = 1;
++ post_recv = 1;
++ mux_data_count2[TS0710MUX_GPRS2_SEND_COUNT_IDX]
++ += c;
++ }
++ }
++
++ if (post_recv)
++ schedule_work(&post_recv_tqueue);
++
++ if (mux_chars_in_serial_buffer(COMM_FOR_MUX_TTY) == 0) {
++ /* Sending bottom half should be
++ run after return from this function */
++ mux_sched_send();
++ }
++ return c;
++ } else {
++ TS0710_PRINTK("MUX mux_write: DLCI %d not connected\n", dlci);
++ return -EDISCONNECTED;
++ }
++}
++
++static int mux_write_room(struct tty_struct *tty)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int retval;
++ int line;
++ __u8 dlci;
++ mux_send_struct *send_info;
++
++ retval = 0;
++ if (!tty) {
++ goto out;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ goto out;
++ }
++
++ dlci = tty2dlci[line];
++ if (ts0710->dlci[0].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped on all channels, returning ZERO\n");
++ goto out;
++ } else if (ts0710->dlci[dlci].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped, returning ZERO\n");
++ goto out;
++ } else if (ts0710->dlci[dlci].state != CONNECTED) {
++ TS0710_DEBUG("DLCI %d not connected\n", dlci);
++ goto out;
++ }
++
++ if (!(mux_send_info_flags[line])) {
++ goto out;
++ }
++ send_info = mux_send_info[line];
++ if (!send_info) {
++ goto out;
++ }
++ if (send_info->filled) {
++ goto out;
++ }
++
++ retval = ts0710->dlci[dlci].mtu - 1;
++
++ out:
++ return retval;
++}
++
++static int mux_ioctl(struct tty_struct *tty, struct file *file,
++ unsigned int cmd, unsigned long arg)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int line;
++ __u8 dlci;
++
++ UNUSED_PARAM(file);
++ UNUSED_PARAM(arg);
++
++ if (!tty) {
++ return -EIO;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ return -ENODEV;
++ }
++
++ dlci = tty2dlci[line];
++ switch (cmd) {
++ case TS0710MUX_IO_MSC_HANGUP:
++ if (ts0710_msc_msg(ts0710, EA | RTR | DV, MCC_CMD, dlci) < 0) {
++ return -EAGAIN;
++ } else {
++ return 0;
++ }
++
++ case TS0710MUX_IO_TEST_CMD:
++ return ts0710_exec_test_cmd();
++/*
++ case TS0710MUX_IO_DLCI_FC_ON:
++ if( line == 0 ) {
++ break;
++ }
++ if( ts0710_msc_msg(ts0710, EA | RTC | RTR | DV, MCC_CMD, (__u8)line) < 0) {
++ return -EAGAIN;
++ } else {
++ return 0;
++ }
++
++ case TS0710MUX_IO_DLCI_FC_OFF:
++ if( line == 0 ) {
++ break;
++ }
++ if( ts0710_msc_msg(ts0710, EA | FC | RTC | RTR | DV, MCC_CMD, (__u8)line) < 0) {
++ return -EAGAIN;
++ } else {
++ return 0;
++ }
++
++ case TS0710MUX_IO_FC_ON:
++ if( line != 0 ) {
++ break;
++ }
++ if( ts0710_fcon_msg(ts0710, MCC_CMD) < 0) {
++ return -EAGAIN;
++ } else {
++ return 0;
++ }
++
++ case TS0710MUX_IO_FC_OFF:
++ if( line != 0 ) {
++ break;
++ }
++ if( ts0710_fcoff_msg(ts0710, MCC_CMD) < 0) {
++ return -EAGAIN;
++ } else {
++ return 0;
++ }
++*/
++ default:
++ break;
++ }
++ return -ENOIOCTLCMD;
++}
++
++static void mux_flush_buffer(struct tty_struct *tty)
++{
++ int line;
++
++ if (!tty) {
++ return;
++ }
++
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ return;
++ }
++
++ TS0710_PRINTK("MUX %s: line is:%d\n", __FUNCTION__, line);
++
++ if ((mux_send_info_flags[line])
++ && (mux_send_info[line])
++ && (mux_send_info[line]->filled)) {
++
++ mux_send_info[line]->filled = 0;
++ }
++
++ wake_up_interruptible(&tty->write_wait);
++#ifdef SERIAL_HAVE_POLL_WAIT
++ wake_up_interruptible(&tty->poll_wait);
++#endif
++ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
++ tty->ldisc.write_wakeup) {
++ (tty->ldisc.write_wakeup) (tty);
++ }
++
++/*
++ if( (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0) ) {
++ TS0710_PRINTK("MUX %s: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n", __FUNCTION__);
++
++#ifndef USB_FOR_MUX
++ TS0710_PRINTK("MUX %s: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n", __FUNCTION__);
++ TS0710_SIG2APLOGD();
++#endif
++
++ return;
++ }
++ return COMM_FOR_MUX_DRIVER->flush_buffer(COMM_FOR_MUX_TTY);
++*/
++}
++
++static int mux_open(struct tty_struct *tty, struct file *filp)
++{
++ int retval;
++ int line;
++ __u8 dlci;
++ __u8 cmdtty;
++ __u8 datatty;
++ mux_send_struct *send_info;
++ mux_recv_struct *recv_info;
++
++ UNUSED_PARAM(filp);
++
++ retval = -ENODEV;
++ if ((COMM_FOR_MUX_DRIVER == NULL) || (COMM_FOR_MUX_TTY == NULL)) {
++
++#ifdef USB_FOR_MUX
++ TS0710_PRINTK("MUX: please install and open IPC-USB first\n");
++#else
++ TS0710_PRINTK("MUX: please install and open ttyS0 first\n");
++#endif
++
++ goto out;
++ }
++
++ if (!tty) {
++ goto out;
++ }
++ line = tty->index;
++ if ((line < 0) || (line >= NR_MUXS)) {
++ goto out;
++ }
++#ifdef TS0710SERVER
++ /* do nothing as a server */
++ mux_tty[line]++;
++ retval = 0;
++#else
++ mux_tty[line]++;
++ dlci = tty2dlci[line];
++
++/* if( dlci == 1 ) { */
++ /* Open server channel 0 first */
++ if ((retval = ts0710_open_channel(0)) != 0) {
++ TS0710_PRINTK("MUX: Can't connect server channel 0!\n");
++ ts0710_init();
++
++ mux_tty[line]--;
++ goto out;
++ }
++/* } */
++
++ /* Allocate memory first. As soon as connection has been established, MUX may receive */
++ if (mux_send_info_flags[line] == 0) {
++ send_info =
++ (mux_send_struct *) kmalloc(sizeof(mux_send_struct),
++ GFP_KERNEL);
++ if (!send_info) {
++ retval = -ENOMEM;
++
++ mux_tty[line]--;
++ goto out;
++ }
++ send_info->length = 0;
++ send_info->flags = 0;
++ send_info->filled = 0;
++ mux_send_info[line] = send_info;
++ mux_send_info_flags[line] = 1;
++ TS0710_DEBUG("Allocate mux_send_info for /dev/mux%d", line);
++ }
++
++ if (mux_recv_info_flags[line] == 0) {
++ recv_info =
++ (mux_recv_struct *) kmalloc(sizeof(mux_recv_struct),
++ GFP_KERNEL);
++ if (!recv_info) {
++ mux_send_info_flags[line] = 0;
++ kfree(mux_send_info[line]);
++ mux_send_info[line] = 0;
++ TS0710_DEBUG("Free mux_send_info for /dev/mux%d", line);
++ retval = -ENOMEM;
++
++ mux_tty[line]--;
++ goto out;
++ }
++ recv_info->length = 0;
++ recv_info->total = 0;
++ recv_info->mux_packet = 0;
++ recv_info->next = 0;
++ recv_info->no_tty = line;
++ recv_info->post_unthrottle = 0;
++ mux_recv_info[line] = recv_info;
++ mux_recv_info_flags[line] = 1;
++ TS0710_DEBUG("Allocate mux_recv_info for /dev/mux%d", line);
++ }
++
++ /* Now establish DLCI connection */
++ cmdtty = dlci2tty[dlci].cmdtty;
++ datatty = dlci2tty[dlci].datatty;
++ if ((mux_tty[cmdtty] > 0) || (mux_tty[datatty] > 0)) {
++ if ((retval = ts0710_open_channel(dlci)) != 0) {
++ TS0710_PRINTK("MUX: Can't connected channel %d!\n",
++ dlci);
++ ts0710_reset_dlci(dlci);
++
++ mux_send_info_flags[line] = 0;
++ kfree(mux_send_info[line]);
++ mux_send_info[line] = 0;
++ TS0710_DEBUG("Free mux_send_info for /dev/mux%d", line);
++
++ mux_recv_info_flags[line] = 0;
++ free_mux_recv_struct(mux_recv_info[line]);
++ mux_recv_info[line] = 0;
++ TS0710_DEBUG("Free mux_recv_info for /dev/mux%d", line);
++
++ mux_tty[line]--;
++ goto out;
++ }
++ }
++
++ retval = 0;
++#endif
++ out:
++ return retval;
++}
++
++/* mux dispatcher, call from serial.c receiver_chars() */
++void mux_dispatcher(struct tty_struct *tty)
++{
++ UNUSED_PARAM(tty);
++
++ schedule_work(&receive_tqueue);
++}
++
++/*For BP UART problem Begin*/
++#ifdef TS0710SEQ2
++static int send_ack(ts0710_con * ts0710, __u8 seq_num, __u8 bp_seq1,
++ __u8 bp_seq2)
++#else
++static int send_ack(ts0710_con * ts0710, __u8 seq_num)
++#endif
++{
++ __u8 buf[20];
++ short_frame *ack;
++
++#ifdef TS0710SEQ2
++ static __u16 ack_seq = 0;
++#endif
++
++ ack = (short_frame *) (buf + 1);
++ ack->h.addr.ea = 1;
++ ack->h.addr.cr = ((ts0710->initiator) & 0x1);
++ ack->h.addr.d = 0;
++ ack->h.addr.server_chn = 0;
++ ack->h.control = ACK;
++ ack->h.length.ea = 1;
++
++#ifdef TS0710SEQ2
++ ack->h.length.len = 5;
++ ack->data[0] = seq_num;
++ ack->data[1] = bp_seq1;
++ ack->data[2] = bp_seq2;
++ ack->data[3] = (ack_seq & 0xFF);
++ ack->data[4] = (ack_seq >> 8) & 0xFF;
++ ack_seq++;
++ ack->data[5] = crc_calc((__u8 *) ack, SHORT_CRC_CHECK);
++#else
++ ack->h.length.len = 1;
++ ack->data[0] = seq_num;
++ ack->data[1] = crc_calc((__u8 *) ack, SHORT_CRC_CHECK);
++#endif
++
++ return basic_write(ts0710, buf,
++ (sizeof(short_frame) + FCS_SIZE +
++ ack->h.length.len));
++}
++
++/*For BP UART problem End*/
++
++static void receive_worker(void *private_)
++{
++ struct tty_struct *tty = COMM_FOR_MUX_TTY;
++ int i, count;
++ static unsigned char tbuf[TS0710MUX_MAX_BUF_SIZE];
++ static unsigned char *tbuf_ptr = &tbuf[0];
++ static unsigned char *start_flag = 0;
++ unsigned char *search, *to, *from;
++ short_frame *short_pkt;
++ long_frame *long_pkt;
++ static int framelen = -1;
++
++ /*For BP UART problem Begin */
++ static __u8 expect_seq = 0;
++ __u32 crc_error;
++ __u8 *uih_data_start;
++ __u32 uih_len;
++ /*For BP UART problem End */
++
++ UNUSED_PARAM(private_);
++
++ if (!tty)
++ return;
++
++#ifdef USB_FOR_MUX
++ TS0710_DEBUG("Receive following bytes from IPC-USB");
++#else
++ TS0710_DEBUG("Receive following bytes from UART");
++#endif
++
++ TS0710_DEBUGHEX(cp, count);
++
++ if (count > (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf))) {
++ TS0710_PRINTK
++ ("MUX receive_worker: !!!!! Exceed buffer boundary !!!!!\n");
++ count = (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf));
++ }
++
++ count = tty_buffer_request_room(tty, count);
++
++ for (i = 0; i < count; i++)
++ tty_insert_flip_char(tty, tbuf_ptr[i], TTY_NORMAL);
++
++ tbuf_ptr += count;
++ search = &tbuf[0];
++
++ if (test_and_set_bit(RECV_RUNNING, &mux_recv_flags)) {
++ schedule_work(&receive_tqueue);
++ return;
++ }
++
++ if ((start_flag != 0) && (framelen != -1)) {
++ if ((tbuf_ptr - start_flag) < framelen) {
++ clear_bit(RECV_RUNNING, &mux_recv_flags);
++ return;
++ }
++ }
++
++ while (1) {
++ if (start_flag == 0) { /* Frame Start Flag not found */
++ framelen = -1;
++ while (search < tbuf_ptr) {
++ if (*search == TS0710_BASIC_FLAG) {
++ start_flag = search;
++ break;
++ }
++#ifdef TS0710LOG
++ else {
++ TS0710_LOG(">S %02x %c\n", *search,
++ *search);
++ }
++#endif
++
++ search++;
++ }
++
++ if (start_flag == 0) {
++ tbuf_ptr = &tbuf[0];
++ break;
++ }
++ } else { /* Frame Start Flag found */
++ /* 1 start flag + 1 address + 1 control + 1 or 2 length + lengths data + 1 FCS + 1 end flag */
++ /* For BP UART problem 1 start flag + 1 seq_num + 1 address + ...... */
++ /*if( (framelen == -1) && ((tbuf_ptr - start_flag) > TS0710_MAX_HDR_SIZE) ) */
++ if ((framelen == -1) && ((tbuf_ptr - start_flag) > (TS0710_MAX_HDR_SIZE + SEQ_FIELD_SIZE))) { /*For BP UART problem */
++ /*short_pkt = (short_frame *) (start_flag + 1); */
++ short_pkt = (short_frame *) (start_flag + ADDRESS_FIELD_OFFSET); /*For BP UART problem */
++ if (short_pkt->h.length.ea == 1) { /* short frame */
++ /*framelen = TS0710_MAX_HDR_SIZE + short_pkt->h.length.len + 1; */
++ framelen = TS0710_MAX_HDR_SIZE + short_pkt->h.length.len + 1 + SEQ_FIELD_SIZE; /*For BP UART problem */
++ } else { /* long frame */
++ /*long_pkt = (long_frame *) (start_flag + 1); */
++ long_pkt = (long_frame *) (start_flag + ADDRESS_FIELD_OFFSET); /*For BP UART problem */
++ /*framelen = TS0710_MAX_HDR_SIZE + GET_LONG_LENGTH( long_pkt->h.length ) + 2; */
++ framelen = TS0710_MAX_HDR_SIZE + GET_LONG_LENGTH(long_pkt->h.length) + 2 + SEQ_FIELD_SIZE; /*For BP UART problem */
++ }
++
++ /*if( framelen > TS0710MUX_MAX_TOTAL_FRAME_SIZE ) { */
++ if (framelen > (TS0710MUX_MAX_TOTAL_FRAME_SIZE + SEQ_FIELD_SIZE)) { /*For BP UART problem */
++ TS0710_LOGSTR_FRAME(0, start_flag,
++ (tbuf_ptr -
++ start_flag));
++ TS0710_PRINTK
++ ("MUX Error: %s: frame length:%d is bigger than Max total frame size:%d\n",
++ /*__FUNCTION__, framelen, TS0710MUX_MAX_TOTAL_FRAME_SIZE);*/
++ __FUNCTION__, framelen, (TS0710MUX_MAX_TOTAL_FRAME_SIZE + SEQ_FIELD_SIZE)); /*For BP UART problem */
++ search = start_flag + 1;
++ start_flag = 0;
++ framelen = -1;
++ continue;
++ }
++ }
++
++ if ((framelen != -1)
++ && ((tbuf_ptr - start_flag) >= framelen)) {
++ if (*(start_flag + framelen - 1) == TS0710_BASIC_FLAG) { /* OK, We got one frame */
++
++ /*For BP UART problem Begin */
++ TS0710_LOGSTR_FRAME(0, start_flag,
++ framelen);
++ TS0710_DEBUGHEX(start_flag, framelen);
++
++ short_pkt =
++ (short_frame *) (start_flag +
++ ADDRESS_FIELD_OFFSET);
++ if ((short_pkt->h.length.ea) == 0) {
++ long_pkt =
++ (long_frame *) (start_flag +
++ ADDRESS_FIELD_OFFSET);
++ uih_len =
++ GET_LONG_LENGTH(long_pkt->h.
++ length);
++ uih_data_start =
++ long_pkt->h.data;
++
++ crc_error =
++ crc_check((__u8
++ *) (start_flag +
++ SLIDE_BP_SEQ_OFFSET),
++ LONG_CRC_CHECK +
++ 1,
++ *(uih_data_start +
++ uih_len));
++ } else {
++ uih_len =
++ short_pkt->h.length.len;
++ uih_data_start =
++ short_pkt->data;
++
++ crc_error =
++ crc_check((__u8
++ *) (start_flag +
++ SLIDE_BP_SEQ_OFFSET),
++ SHORT_CRC_CHECK +
++ 1,
++ *(uih_data_start +
++ uih_len));
++ }
++
++ if (!crc_error) {
++ if (expect_seq ==
++ *(start_flag +
++ SLIDE_BP_SEQ_OFFSET)) {
++ expect_seq++;
++ if (expect_seq >= 4) {
++ expect_seq = 0;
++ }
++#ifdef TS0710SEQ2
++ send_ack
++ (&ts0710_connection,
++ expect_seq,
++ *(start_flag +
++ FIRST_BP_SEQ_OFFSET),
++ *(start_flag +
++ SECOND_BP_SEQ_OFFSET));
++#else
++ send_ack
++ (&ts0710_connection,
++ expect_seq);
++#endif
++
++ ts0710_recv_data
++ (&ts0710_connection,
++ start_flag +
++ ADDRESS_FIELD_OFFSET,
++ framelen - 2 -
++ SEQ_FIELD_SIZE);
++ } else {
++
++#ifdef TS0710DEBUG
++ if (*
++ (start_flag +
++ SLIDE_BP_SEQ_OFFSET)
++ != 0x9F) {
++#endif
++
++ TS0710_LOG
++ ("MUX sequence number %d is not expected %d, discard data!\n",
++ *
++ (start_flag
++ +
++ SLIDE_BP_SEQ_OFFSET),
++ expect_seq);
++
++#ifdef TS0710SEQ2
++ send_ack
++ (&ts0710_connection,
++ expect_seq,
++ *
++ (start_flag
++ +
++ FIRST_BP_SEQ_OFFSET),
++ *
++ (start_flag
++ +
++ SECOND_BP_SEQ_OFFSET));
++#else
++ send_ack
++ (&ts0710_connection,
++ expect_seq);
++#endif
++
++#ifdef TS0710DEBUG
++ } else {
++ *(uih_data_start
++ + uih_len) =
++ 0;
++ TS0710_PRINTK
++ ("MUX bp log: %s\n",
++ uih_data_start);
++ }
++#endif
++
++ }
++ } else { /* crc_error */
++ search = start_flag + 1;
++ start_flag = 0;
++ framelen = -1;
++ continue;
++ } /*End if(!crc_error) */
++
++ /*For BP UART problem End */
++
++/*For BP UART problem
++ TS0710_LOGSTR_FRAME(0, start_flag, framelen);
++ TS0710_DEBUGHEX(start_flag, framelen);
++ ts0710_recv_data(&ts0710_connection, start_flag + 1, framelen - 2);
++*/
++ search = start_flag + framelen;
++ } else {
++ TS0710_LOGSTR_FRAME(0, start_flag,
++ framelen);
++ TS0710_DEBUGHEX(start_flag, framelen);
++ TS0710_PRINTK
++ ("MUX: Lost synchronization!\n");
++ search = start_flag + 1;
++ }
++
++ start_flag = 0;
++ framelen = -1;
++ continue;
++ }
++
++ if (start_flag != &tbuf[0]) {
++ to = tbuf;
++ from = start_flag;
++ count = tbuf_ptr - start_flag;
++ while (count--) {
++ *to++ = *from++;
++ }
++
++ tbuf_ptr -= (start_flag - tbuf);
++ start_flag = tbuf;
++ }
++ break;
++ } /* End Frame Start Flag found */
++ } /* End while(1) */
++
++ clear_bit(RECV_RUNNING, &mux_recv_flags);
++}
++
++static void post_recv_worker(void *private_)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ int tty_idx;
++ struct tty_struct *tty;
++ __u8 post_recv;
++ __u8 flow_control;
++ __u8 dlci;
++ mux_recv_struct *recv_info, *recv_info2, *post_recv_q;
++ int recv_room;
++ mux_recv_packet *recv_packet, *recv_packet2;
++ __u8 j;
++
++ UNUSED_PARAM(private_);
++
++ if (test_and_set_bit(RECV_RUNNING, &mux_recv_flags)) {
++ schedule_work(&post_recv_tqueue);
++ return;
++ }
++
++ TS0710_DEBUG("Enter into post_recv_worker");
++
++ post_recv = 0;
++ if (!mux_recv_queue) {
++ goto out;
++ }
++
++ post_recv_q = NULL;
++ recv_info2 = mux_recv_queue;
++ while ((recv_info = recv_info2)) {
++ recv_info2 = recv_info->next;
++
++ if (!(recv_info->total)) {
++ TS0710_PRINTK
++ ("MUX Error: %s: Should not get here, recv_info->total == 0 \n",
++ __FUNCTION__);
++ continue;
++ }
++
++ tty_idx = recv_info->no_tty;
++ dlci = tty2dlci[tty_idx];
++ tty = mux_table[tty_idx];
++ if ((!mux_tty[tty_idx]) || (!tty)) {
++ TS0710_PRINTK
++ ("MUX: No application waiting for, free recv_info! tty_idx:%d\n",
++ tty_idx);
++ mux_recv_info_flags[tty_idx] = 0;
++ free_mux_recv_struct(mux_recv_info[tty_idx]);
++ mux_recv_info[tty_idx] = 0;
++ ts0710_flow_on(dlci, ts0710);
++ continue;
++ }
++
++ TS0710_DEBUG("/dev/mux%d recv_info->total is: %d", tty_idx,
++ recv_info->total);
++
++ if (test_bit(TTY_THROTTLED, &tty->flags)) {
++ add_post_recv_queue(&post_recv_q, recv_info);
++ continue;
++ } else if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
++ post_recv = 1;
++ add_post_recv_queue(&post_recv_q, recv_info);
++ continue;
++ }
++
++ flow_control = 0;
++ recv_packet2 = recv_info->mux_packet;
++ while (recv_info->total) {
++ recv_room = 65535;
++ if (tty->receive_room)
++ recv_room = tty->receive_room;
++
++ if (recv_info->length) {
++ if (recv_room < recv_info->length) {
++ flow_control = 1;
++ break;
++ }
++
++ /* Put queued data into read buffer of tty */
++ TS0710_DEBUG
++ ("Put queued recv data into read buffer of /dev/mux%d",
++ tty_idx);
++ TS0710_DEBUGHEX(recv_info->data,
++ recv_info->length);
++ (tty->ldisc.receive_buf) (tty, recv_info->data,
++ NULL,
++ recv_info->length);
++ recv_info->total -= recv_info->length;
++ recv_info->length = 0;
++ } else { /* recv_info->length == 0 */
++ if ((recv_packet = recv_packet2)) {
++ recv_packet2 = recv_packet->next;
++
++ if (recv_room < recv_packet->length) {
++ flow_control = 1;
++ recv_info->mux_packet =
++ recv_packet;
++ break;
++ }
++
++ /* Put queued data into read buffer of tty */
++ TS0710_DEBUG
++ ("Put queued recv data into read buffer of /dev/mux%d",
++ tty_idx);
++ TS0710_DEBUGHEX(recv_packet->data,
++ recv_packet->length);
++ (tty->ldisc.receive_buf) (tty,
++ recv_packet->
++ data, NULL,
++ recv_packet->
++ length);
++ recv_info->total -= recv_packet->length;
++ free_mux_recv_packet(recv_packet);
++ } else {
++ TS0710_PRINTK
++ ("MUX Error: %s: Should not get here, recv_info->total is:%u \n",
++ __FUNCTION__, recv_info->total);
++ }
++ } /* End recv_info->length == 0 */
++ } /* End while( recv_info->total ) */
++
++ if (!(recv_info->total)) {
++ /* Important clear */
++ recv_info->mux_packet = 0;
++
++ if (recv_info->post_unthrottle) {
++ /* Do something for post_unthrottle */
++ ts0710_flow_on(dlci, ts0710);
++ recv_info->post_unthrottle = 0;
++ }
++ } else {
++ add_post_recv_queue(&post_recv_q, recv_info);
++
++ if (flow_control) {
++ /* Do something for flow control */
++ if (recv_info->post_unthrottle) {
++ set_bit(TTY_THROTTLED, &tty->flags);
++ recv_info->post_unthrottle = 0;
++ } else {
++ ts0710_flow_off(tty, dlci, ts0710);
++ }
++ } /* End if( flow_control ) */
++ }
++ } /* End while( (recv_info = recv_info2) ) */
++
++ mux_recv_queue = post_recv_q;
++
++ out:
++ if (post_recv_count_flag) {
++ post_recv_count_flag = 0;
++ for (j = 0; j < TS0710MUX_COUNT_IDX_NUM; j++) {
++ if (mux_data_count2[j] > 0) {
++ if (add_count(j, mux_data_count2[j]) == 0) {
++ mux_data_count2[j] = 0;
++ } else {
++ post_recv_count_flag = 1;
++ post_recv = 1;
++ }
++ }
++ } /* End for (j = 0; j < TS0710MUX_COUNT_IDX_NUM; j++) */
++ }
++ /* End if( post_recv_count_flag ) */
++ if (post_recv)
++ schedule_work(&post_recv_tqueue);
++ clear_bit(RECV_RUNNING, &mux_recv_flags);
++}
++
++/* mux sender, call from serial.c transmit_chars() */
++void mux_sender(void)
++{
++ mux_send_struct *send_info;
++ int chars;
++ __u8 idx;
++
++ chars = mux_chars_in_serial_buffer(COMM_FOR_MUX_TTY);
++ if (!chars) {
++ /* chars == 0 */
++ TS0710_LOG("<[]\n");
++ mux_sched_send();
++ return;
++ }
++
++ idx = mux_send_info_idx;
++ if ((idx < NR_MUXS) && (mux_send_info_flags[idx])) {
++ send_info = mux_send_info[idx];
++ if ((send_info)
++ && (send_info->filled)
++ && (send_info->length <=
++ (TS0710MUX_SERIAL_BUF_SIZE - chars))) {
++
++ mux_sched_send();
++ }
++ }
++}
++
++static void send_worker(void *private_)
++{
++ ts0710_con *ts0710 = &ts0710_connection;
++ __u8 j;
++ mux_send_struct *send_info;
++ int chars;
++ struct tty_struct *tty;
++ __u8 dlci;
++
++ UNUSED_PARAM(private_);
++
++ TS0710_DEBUG("Enter into send_worker");
++
++ mux_send_info_idx = NR_MUXS;
++
++ if (ts0710->dlci[0].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped on all channels\n");
++ return;
++ }
++
++ for (j = 0; j < NR_MUXS; j++) {
++
++ if (!(mux_send_info_flags[j])) {
++ continue;
++ }
++
++ send_info = mux_send_info[j];
++ if (!send_info) {
++ continue;
++ }
++
++ if (!(send_info->filled)) {
++ continue;
++ }
++
++ dlci = tty2dlci[j];
++ if (ts0710->dlci[dlci].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped on channel DLCI: %d\n",
++ dlci);
++ continue;
++ } else if (ts0710->dlci[dlci].state != CONNECTED) {
++ TS0710_DEBUG("DLCI %d not connected\n", dlci);
++ send_info->filled = 0;
++ continue;
++ }
++
++ chars = mux_chars_in_serial_buffer(COMM_FOR_MUX_TTY);
++ if (send_info->length <= (TS0710MUX_SERIAL_BUF_SIZE - chars)) {
++ TS0710_DEBUG("Send queued UIH for /dev/mux%d", j);
++ basic_write(ts0710, (__u8 *) send_info->frame,
++ send_info->length);
++ send_info->length = 0;
++ send_info->filled = 0;
++ } else {
++ mux_send_info_idx = j;
++ break;
++ }
++ } /* End for() loop */
++
++ /* Queue UIH data to be transmitted */
++ for (j = 0; j < NR_MUXS; j++) {
++
++ if (!(mux_send_info_flags[j])) {
++ continue;
++ }
++
++ send_info = mux_send_info[j];
++ if (!send_info) {
++ continue;
++ }
++
++ if (send_info->filled) {
++ continue;
++ }
++
++ /* Now queue UIH data to send_info->buf */
++
++ if (!mux_tty[j]) {
++ continue;
++ }
++
++ tty = mux_table[j];
++ if (!tty) {
++ continue;
++ }
++
++ dlci = tty2dlci[j];
++ if (ts0710->dlci[dlci].state == FLOW_STOPPED) {
++ TS0710_DEBUG("Flow stopped on channel DLCI: %d\n",
++ dlci);
++ continue;
++ } else if (ts0710->dlci[dlci].state != CONNECTED) {
++ TS0710_DEBUG("DLCI %d not connected\n", dlci);
++ continue;
++ }
++
++ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
++ && tty->ldisc.write_wakeup) {
++ (tty->ldisc.write_wakeup) (tty);
++ }
++ wake_up_interruptible(&tty->write_wait);
++
++#ifdef SERIAL_HAVE_POLL_WAIT
++ wake_up_interruptible(&tty->poll_wait);
++#endif
++
++ if (send_info->filled) {
++ if (j < mux_send_info_idx) {
++ mux_send_info_idx = j;
++ }
++ }
++ } /* End for() loop */
++}
++
++static int get_count(__u8 idx)
++{
++ int ret;
++
++ if (idx > TS0710MUX_COUNT_MAX_IDX) {
++ TS0710_PRINTK("MUX get_count: invalid idx: %d!\n", idx);
++ return -1;
++ }
++
++ down(&mux_data_count_mutex[idx]);
++ ret = mux_data_count[idx];
++ up(&mux_data_count_mutex[idx]);
++
++ return ret;
++}
++
++static int set_count(__u8 idx, int count)
++{
++ if (idx > TS0710MUX_COUNT_MAX_IDX) {
++ TS0710_PRINTK("MUX set_count: invalid idx: %d!\n", idx);
++ return -1;
++ }
++ if (count < 0) {
++ TS0710_PRINTK("MUX set_count: invalid count: %d!\n", count);
++ return -1;
++ }
++
++ down(&mux_data_count_mutex[idx]);
++ mux_data_count[idx] = count;
++ up(&mux_data_count_mutex[idx]);
++
++ return 0;
++}
++
++static int add_count(__u8 idx, int count)
++{
++ if (idx > TS0710MUX_COUNT_MAX_IDX) {
++ TS0710_PRINTK("MUX add_count: invalid idx: %d!\n", idx);
++ return -1;
++ }
++ if (count <= 0) {
++ TS0710_PRINTK("MUX add_count: invalid count: %d!\n", count);
++ return -1;
++ }
++
++ if (down_trylock(&mux_data_count_mutex[idx]))
++ return -1;
++ mux_data_count[idx] += count;
++ up(&mux_data_count_mutex[idx]);
++
++ return 0;
++}
++
++ssize_t file_proc_read(struct file * file, char *buf, size_t size,
++ loff_t * ppos)
++{
++ gprs_bytes gprsData[TS0710MUX_GPRS_SESSION_MAX];
++ int bufLen = sizeof(gprs_bytes) * TS0710MUX_GPRS_SESSION_MAX;
++
++ UNUSED_PARAM(file);
++ UNUSED_PARAM(size);
++ UNUSED_PARAM(ppos);
++
++ gprsData[0].recvBytes = get_count(TS0710MUX_GPRS1_RECV_COUNT_IDX);
++ gprsData[0].sentBytes = get_count(TS0710MUX_GPRS1_SEND_COUNT_IDX);
++ gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].recvBytes =
++ get_count(TS0710MUX_GPRS2_RECV_COUNT_IDX);
++ gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].sentBytes =
++ get_count(TS0710MUX_GPRS2_SEND_COUNT_IDX);
++
++ copy_to_user(buf, gprsData, bufLen);
++
++ return bufLen;
++}
++
++ssize_t file_proc_write(struct file * file, const char *buf, size_t count,
++ loff_t * ppos)
++{
++ gprs_bytes gprsData[TS0710MUX_GPRS_SESSION_MAX];
++ int bufLen = sizeof(gprs_bytes) * TS0710MUX_GPRS_SESSION_MAX;
++
++ UNUSED_PARAM(file);
++ UNUSED_PARAM(count);
++ UNUSED_PARAM(ppos);
++
++ memset(gprsData, 0, bufLen);
++
++ copy_from_user(gprsData, buf, bufLen);
++
++ set_count(TS0710MUX_GPRS1_RECV_COUNT_IDX, gprsData[0].recvBytes);
++ set_count(TS0710MUX_GPRS1_SEND_COUNT_IDX, gprsData[0].sentBytes);
++ set_count(TS0710MUX_GPRS2_RECV_COUNT_IDX,
++ gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].recvBytes);
++ set_count(TS0710MUX_GPRS2_SEND_COUNT_IDX,
++ gprsData[TS0710MUX_GPRS_SESSION_MAX - 1].sentBytes);
++
++ return bufLen;
++}
++
++static void gprs_proc_init(void)
++{
++ gprs_proc_file =
++ create_proc_entry("gprsbytes", S_IRUSR | S_IWUSR, NULL);
++ gprs_proc_file->proc_fops = &file_proc_operations;
++}
++
++static void gprs_proc_exit(void)
++{
++ remove_proc_entry("gprsbytes", gprs_proc_file);
++}
++
++static int __init mux_init(void)
++{
++ __u8 j;
++
++ if (COMM_FOR_MUX_DRIVER == NULL) {
++
++#ifdef USB_FOR_MUX
++ panic("please install IPC-USB first\n");
++#else
++ panic("please install ttyS0 first\n");
++#endif
++
++ }
++
++ ts0710_init();
++
++ for (j = 0; j < NR_MUXS; j++) {
++ mux_send_info_flags[j] = 0;
++ mux_send_info[j] = 0;
++ mux_recv_info_flags[j] = 0;
++ mux_recv_info[j] = 0;
++ }
++ mux_send_info_idx = NR_MUXS;
++ mux_recv_queue = NULL;
++ mux_recv_flags = 0;
++
++ for (j = 0; j < TS0710MUX_COUNT_IDX_NUM; j++) {
++ mux_data_count[j] = 0;
++ mux_data_count2[j] = 0;
++ init_MUTEX(&mux_data_count_mutex[j]);
++ }
++ post_recv_count_flag = 0;
++
++ INIT_WORK(&send_tqueue, send_worker, NULL);
++ INIT_WORK(&receive_tqueue, receive_worker, NULL);
++ INIT_WORK(&post_recv_tqueue, post_recv_worker, NULL);
++
++ memset(&mux_driver, 0, sizeof(struct tty_driver));
++ memset(&mux_tty, 0, sizeof(mux_tty));
++ mux_driver.magic = TTY_DRIVER_MAGIC;
++ mux_driver.driver_name = "ts0710mux";
++ mux_driver.name = "ts0710mux";
++ mux_driver.major = TS0710MUX_MAJOR;
++ mux_driver.minor_start = TS0710MUX_MINOR_START;
++ mux_driver.num = NR_MUXS;
++ mux_driver.type = TTY_DRIVER_TYPE_SERIAL;
++ mux_driver.subtype = SERIAL_TYPE_NORMAL;
++ mux_driver.init_termios = tty_std_termios;
++ mux_driver.init_termios.c_iflag = 0;
++ mux_driver.init_termios.c_oflag = 0;
++ mux_driver.init_termios.c_cflag = B38400 | CS8 | CREAD;
++ mux_driver.init_termios.c_lflag = 0;
++ mux_driver.flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW;
++
++ mux_driver.ttys = mux_table;
++ mux_driver.termios = mux_termios;
++ mux_driver.termios_locked = mux_termios_locked;
++// mux_driver.driver_state = mux_state;
++ mux_driver.other = NULL;
++
++ mux_driver.open = mux_open;
++ mux_driver.close = mux_close;
++ mux_driver.write = mux_write;
++ mux_driver.write_room = mux_write_room;
++ mux_driver.flush_buffer = mux_flush_buffer;
++ mux_driver.chars_in_buffer = mux_chars_in_buffer;
++ mux_driver.throttle = mux_throttle;
++ mux_driver.unthrottle = mux_unthrottle;
++ mux_driver.ioctl = mux_ioctl;
++ mux_driver.owner = THIS_MODULE;
++
++ if (tty_register_driver(&mux_driver))
++ panic("Couldn't register mux driver");
++
++ COMM_MUX_DISPATCHER = mux_dispatcher;
++ COMM_MUX_SENDER = mux_sender;
++
++ gprs_proc_init();
++
++ return 0;
++}
++
++static void __exit mux_exit(void)
++{
++ __u8 j;
++
++ COMM_MUX_DISPATCHER = NULL;
++ COMM_MUX_SENDER = NULL;
++
++ gprs_proc_exit();
++
++ mux_send_info_idx = NR_MUXS;
++ mux_recv_queue = NULL;
++ for (j = 0; j < NR_MUXS; j++) {
++ if ((mux_send_info_flags[j]) && (mux_send_info[j])) {
++ kfree(mux_send_info[j]);
++ }
++ mux_send_info_flags[j] = 0;
++ mux_send_info[j] = 0;
++
++ if ((mux_recv_info_flags[j]) && (mux_recv_info[j])) {
++ free_mux_recv_struct(mux_recv_info[j]);
++ }
++ mux_recv_info_flags[j] = 0;
++ mux_recv_info[j] = 0;
++ }
++
++ if (tty_unregister_driver(&mux_driver))
++ panic("Couldn't unregister mux driver");
++}
++
++module_init(mux_init);
++module_exit(mux_exit);
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Harald Welte <laforge@openezx.org>");
++MODULE_DESCRIPTION("TS 07.10 Multiplexer");
+Index: linux-2.6.23/drivers/char/ts0710_mux.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/char/ts0710_mux.h 2007-10-22 22:26:50.000000000 +0200
+@@ -0,0 +1,103 @@
++/*
++ * mux_macro.h
++ *
++ * Copyright (C) 2002 2005 Motorola
++ *
++ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ *
++ * 11/18/2002 (Motorola) - Initial version
++ *
++ */
++
++/*
++* This header file should be included by both MUX and other applications
++* which access MUX device files. It gives the additional macro definitions
++* shared between MUX and applications.
++*/
++
++/* MUX DLCI(Data Link Connection Identifier) Configuration */
++/*
++* DLCI Service
++* 0 Control Channel
++* 1 Voice Call & Network-related
++* 2 SMS MO
++* 3 SMS MT
++* 4 Phonebook & related
++* 5 MISC
++* 6 CSD/FAX
++* 7 GPRS1
++* 8 GPRS2
++* 9 Logger CMD
++* 10 Logger Data
++* 11 Test CMD
++* 12 AGPS
++* 13 Net Monitor
++*/
++
++/* Mapping between DLCI and MUX device files */
++/*
++* File Name Minor DLCI AT Command/Data
++* /dev/mux0 0 1 AT Command
++* /dev/mux1 1 2 AT Command
++* /dev/mux2 2 3 AT Command
++* /dev/mux3 3 4 AT Command
++* /dev/mux4 4 5 AT Command
++* /dev/mux5 5 6 AT Command
++* /dev/mux6 6 7 AT Command
++* /dev/mux7 7 8 AT Command
++* /dev/mux8 8 6 Data
++* /dev/mux9 9 7 Data
++* /dev/mux10 10 8 Data
++* /dev/mux11 11 9 Data
++* /dev/mux12 12 10 Data
++* /dev/mux13 13 11 Data
++* /dev/mux14 14 12 Data
++* /dev/mux15 15 13 Data
++*/
++
++#define MUX_CMD_FILE_VOICE_CALL "/dev/mux0"
++#define MUX_CMD_FILE_SMS_MO "/dev/mux1"
++#define MUX_CMD_FILE_SMS_MT "/dev/mux2"
++#define MUX_CMD_FILE_PHONEBOOK "/dev/mux3"
++#define MUX_CMD_FILE_MISC "/dev/mux4"
++#define MUX_CMD_FILE_CSD "/dev/mux5"
++#define MUX_CMD_FILE_GPRS1 "/dev/mux6"
++#define MUX_CMD_FILE_GPRS2 "/dev/mux7"
++
++#define MUX_DATA_FILE_CSD "/dev/mux8"
++#define MUX_DATA_FILE_GPRS1 "/dev/mux9"
++#define MUX_DATA_FILE_GPRS2 "/dev/mux10"
++#define MUX_DATA_FILE_LOGGER_CMD "/dev/mux11"
++#define MUX_DATA_FILE_LOGGER_DATA "/dev/mux12"
++#define MUX_DATA_FILE_TEST_CMD "/dev/mux13"
++#define MUX_DATA_FILE_AGPS "/dev/mux14"
++#define MUX_DATA_FILE_NET_MONITOR "/dev/mux15"
++
++#define NUM_MUX_CMD_FILES 8
++#define NUM_MUX_DATA_FILES 8
++#define NUM_MUX_FILES ( NUM_MUX_CMD_FILES + NUM_MUX_DATA_FILES )
++
++/* Special ioctl() upon a MUX device file for hanging up a call */
++#define TS0710MUX_IO_MSC_HANGUP 0x54F0
++
++/* Special ioctl() upon a MUX device file for MUX loopback test */
++#define TS0710MUX_IO_TEST_CMD 0x54F1
++
++/* Special Error code might be return from write() to a MUX device file */
++#define EDISCONNECTED 900 /* Logical data link is disconnected */
++
++/* Special Error code might be return from open() to a MUX device file */
++#define EREJECTED 901 /* Logical data link connection request is rejected */
+Index: linux-2.6.23/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/char/ts0710_mux_usb.c 2007-10-22 22:26:50.000000000 +0200
+@@ -0,0 +1,868 @@
++/*
++ * linux/drivers/usb/ipcusb.c
++ *
++ * Implementation of a ipc driver based Intel's Bulverde USB Host
++ * Controller.
++ *
++ * Copyright (C) 2003-2005 Motorola
++ * Copyright (C) 2006 Harald Welte <laforge@openezx.org>
++ *
++ * 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
++ *
++ * 2003-Nov-03 - (Motorola) created
++ * 2004-Feb-20 - (Motorola) Add Power Manager codes
++ * 2004-Apr-14 - (Motorola) Update Suspend/Resume codes
++ * 2004-May-10 - (Motorola) Add unlink_urbs codes and do some updates of send
++ * out urb sequence
++ * 2006-Jun-22 - (Harald Welte) port to Linux 2.6.x
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/list.h>
++#include <linux/errno.h>
++#include <asm/uaccess.h>
++#include <asm/hardware.h>
++#include <asm/arch/hardware.h>
++#include <asm/arch-pxa/pxa-regs.h>
++#include <asm/arch-pxa/ezx.h>
++#include <linux/slab.h>
++#include <linux/miscdevice.h>
++#include <linux/init.h>
++#include <linux/timer.h>
++#include <linux/delay.h>
++#include <linux/sched.h>
++#include <linux/tty.h>
++#include <linux/tty_driver.h>
++#include <linux/tty_flip.h>
++#include <linux/circ_buf.h>
++#include <linux/usb.h>
++
++#include "ts0710_mux_usb.h"
++
++/*Macro defined for this driver*/
++#define DRIVER_VERSION "1.0alpha1"
++#define DRIVER_AUTHOR "Motorola / Harald Welte <laforge@openezx.org>"
++#define DRIVER_DESC "USB IPC Driver (TS07.10 lowlevel)"
++#define MOTO_IPC_VID 0x22b8
++#define MOTO_IPC_PID 0x3006
++#define IBUF_SIZE 32 /*urb size*/
++#define IPC_USB_XMIT_SIZE 1024
++#define IPC_URB_SIZE 32
++#define IPC_USB_WRITE_INIT 0
++#define IPC_USB_WRITE_XMIT 1
++#define IPC_USB_PROBE_READY 3
++#define IPC_USB_PROBE_NOT_READY 4
++#define DBG_MAX_BUF_SIZE 1024
++#define ICL_EVENT_INTERVAL (HZ)
++#undef BVD_DEBUG
++
++#define IS_EP_BULK(ep) ((ep).bmAttributes == USB_ENDPOINT_XFER_BULK ? 1 : 0)
++#define IS_EP_BULK_IN(ep) (IS_EP_BULK(ep) && ((ep).bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
++#define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep).bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
++/*End defined macro*/
++
++/*global values defined*/
++static struct usb_driver usb_ipc_driver;
++static struct timer_list ipcusb_timer;
++static struct timer_list suspend_timer;
++static struct timer_list wakeup_timer;
++static struct tty_struct ipcusb_tty; /* the coresponding tty struct, we just use flip buffer here. */
++static struct tty_driver ipcusb_tty_driver; /* the coresponding tty driver, we just use write and chars in buff here*/
++struct tty_driver *usb_for_mux_driver = NULL;
++struct tty_struct *usb_for_mux_tty = NULL;
++void (*usb_mux_dispatcher)(struct tty_struct *tty) = NULL;
++void (*usb_mux_sender)(void) = NULL;
++void (*ipcusb_ap_to_bp)(unsigned char*, int) = NULL;
++void (*ipcusb_bp_to_ap)(unsigned char*, int) = NULL;
++EXPORT_SYMBOL(usb_for_mux_driver);
++EXPORT_SYMBOL(usb_for_mux_tty);
++EXPORT_SYMBOL(usb_mux_dispatcher);
++EXPORT_SYMBOL(usb_mux_sender);
++EXPORT_SYMBOL(ipcusb_ap_to_bp);
++EXPORT_SYMBOL(ipcusb_bp_to_ap);
++static int sumbit_times = 0;
++static int callback_times = 0;
++//static unsigned long last_jiff = 0;
++extern int usbh_finished_resume;
++/*end global values defined*/
++
++MODULE_AUTHOR(DRIVER_AUTHOR);
++MODULE_DESCRIPTION(DRIVER_DESC);
++MODULE_LICENSE("GPL");
++
++#ifdef BVD_DEBUG
++#define bvd_dbg(format, arg...) printk(__FILE__ ": " format "\n" , ## arg)
++#else
++#define bvd_dbg(format, arg...) do {} while (0)
++#endif
++
++/* USB device context */
++typedef struct {
++ struct list_head list;
++ int size;
++ char *body;
++} buf_list_t;
++
++struct ipc_usb_data {
++ u_int8_t write_finished_flag;
++ u_int8_t write_flag,
++ ipc_flag,
++ suspend_flag;
++ struct usb_device *ipc_dev;
++ struct urb readurb_mux,
++ writeurb_mux,
++ writeurb_dsplog;
++ char *obuf, *ibuf;
++ int writesize; /* max packet size for the
++ output bulk endpoint *
++ transfer buffers */
++
++ struct circ_buf xmit; /* write cric bufffer */
++ struct list_head in_buf_list;
++ char bulk_in_ep_mux,
++ bulk_out_ep_mux,
++ bulk_in_ep_dsplog;
++ unsigned int ifnum;
++
++ struct tasklet_struct bh,
++ bh_bp;
++
++ spinlock_t lock;
++};
++
++struct ipc_usb_data *bvd_ipc;
++
++#ifdef BVD_DEBUG
++static void bvd_dbg_hex(__u8 *buf, int len)
++{
++ static unsigned char tbuf[DBG_MAX_BUF_SIZE];
++ int i, c;
++
++ if (len <= 0)
++ return;
++
++ c = 0;
++ for (i=0; (i < len) && (c < (DBG_MAX_BUF_SIZE - 3)); i++) {
++ sprintf(&tbuf[c], "%02x ",buf[i]);
++ c += 3;
++ }
++ tbuf[c] = 0;
++
++ printk("%s: %s\n", __FUNCTION__, tbuf);
++}
++#else
++#define bvd_dbg_hex(buf, len)
++#endif
++
++static int unlink_urbs(struct urb *urb)
++{
++ unsigned long flags;
++ int retval;
++
++ spin_lock_irqsave(&bvd_ipc->lock, flags);
++
++ retval = usb_unlink_urb(urb);
++ if (retval != -EINPROGRESS && retval != 0)
++ printk("unlink urb err, %d", retval);
++
++ spin_unlock_irqrestore(&bvd_ipc->lock, flags);
++ return retval;
++}
++
++static void append_to_inbuf_list(struct urb *urb)
++{
++ buf_list_t *inbuf;
++ int count = urb->actual_length;
++
++ inbuf = kmalloc(sizeof(buf_list_t), GFP_KERNEL);
++ if (!inbuf) {
++ printk("append_to_inbuf_list: (%d) out of memory!\n",
++ sizeof(buf_list_t));
++ return;
++ }
++
++ inbuf->size = count;
++ inbuf->body = kmalloc(sizeof(char)*count, GFP_KERNEL);
++ if (!inbuf->body) {
++ kfree(inbuf);
++ printk("append_to_inbuf_list: (%d) out of memory!\n",
++ sizeof(char)*count);
++ return;
++ }
++ memcpy(inbuf->body, (unsigned char*)urb->transfer_buffer, count);
++ list_add_tail(&inbuf->list, &bvd_ipc->in_buf_list);
++}
++
++static void ipcusb_timeout(unsigned long data)
++{
++ struct tty_struct *tty = &ipcusb_tty;
++ struct urb *urb = (struct urb *)data;
++
++ bvd_dbg("ipcusb_timeout***");
++
++ while (!(list_empty(&bvd_ipc->in_buf_list))) {
++ int count;
++ buf_list_t *inbuf;
++ struct list_head *ptr = NULL;
++
++ ptr = bvd_ipc->in_buf_list.next;
++ inbuf = list_entry (ptr, buf_list_t, list);
++ count = inbuf->size;
++ if (tty_insert_flip_string(tty, inbuf->body, count) >= count) {
++ list_del(ptr);
++ kfree(inbuf->body);
++ inbuf->body = NULL;
++ kfree(inbuf);
++ } else {
++ bvd_dbg("ipcusb_timeout: bvd_ipc->in_buf_list empty!");
++ break;
++ }
++ }
++
++ if (usb_mux_dispatcher)
++ usb_mux_dispatcher(tty); /**call Liu changhui's func.**/
++
++ if (list_empty(&bvd_ipc->in_buf_list)) {
++ urb->actual_length = 0;
++ urb->dev = bvd_ipc->ipc_dev;
++ if (usb_submit_urb(urb, GFP_ATOMIC))
++ bvd_dbg("ipcusb_timeout: failed resubmitting read urb");
++ bvd_dbg("ipcusb_timeout: resubmited read urb");
++ } else {
++ ipcusb_timer.data = (unsigned long)urb;
++ mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
++ }
++}
++
++static void usb_ipc_read_bulk(struct urb *urb, struct pt_regs *regs)
++{
++ buf_list_t *inbuf;
++ int count = urb->actual_length;
++ struct tty_struct *tty = &ipcusb_tty;
++
++ bvd_dbg("usb_ipc_read_bulk: begining!");
++ if (urb->status)
++ printk("nonzero read bulk status received: %d\n", urb->status);
++
++ bvd_dbg("usb_ipc_read_bulk: urb->actual_length=%d", urb->actual_length);
++ bvd_dbg("usb_ipc_read_bulk: urb->transfer_buffer:");
++
++ bvd_dbg_hex((unsigned char*)urb->transfer_buffer, urb->actual_length);
++
++ if (count > 0 && ((*ipcusb_bp_to_ap) != NULL))
++ (*ipcusb_bp_to_ap)(urb->transfer_buffer, urb->actual_length);
++
++ if (!(list_empty(&bvd_ipc->in_buf_list))) {
++ int need_mux = 0;
++
++ bvd_dbg("usb_ipc_read_bulk: some urbs in_buf_list");
++ if (count > 0) {
++ bvd_ipc->suspend_flag = 1;
++ append_to_inbuf_list(urb); /* append the current received urb */
++#if 0
++ if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
++ {
++ last_jiff = jiffies;
++ queue_apm_event(KRNL_ICL, NULL);
++ }
++#endif
++ }
++
++ while (!(list_empty(&bvd_ipc->in_buf_list))) {
++ struct list_head* ptr = NULL;
++ ptr = bvd_ipc->in_buf_list.next;
++ inbuf = list_entry(ptr, buf_list_t, list);
++ count = inbuf->size;
++ need_mux = 1;
++
++ tty_insert_flip_string(tty, inbuf->body, count);
++
++ list_del(ptr);
++ kfree(inbuf->body);
++ inbuf->body = NULL;
++ kfree(inbuf);
++ }
++
++ if (usb_mux_dispatcher && need_mux)
++ usb_mux_dispatcher(tty); /* call Liu changhui's func. */
++
++ if (list_empty(&bvd_ipc->in_buf_list)) {
++ urb->actual_length = 0;
++ urb->dev = bvd_ipc->ipc_dev;
++ if (usb_submit_urb(urb, GFP_ATOMIC))
++ bvd_dbg("usb_ipc_read_bulk: "
++ "failed resubmitting read urb");
++ bvd_dbg("usb_ipc_read_bulk: resubmited read urb");
++ } else {
++ ipcusb_timer.data = (unsigned long)urb;
++ mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
++ }
++ } else if (count > 0) {
++ bvd_dbg("usb_ipc_read_bulk: no urbs in_buf_list");
++ bvd_ipc->suspend_flag = 1;
++
++ if (tty_insert_flip_string(tty, urb->transfer_buffer,
++ count) < count) {
++ bvd_ipc->suspend_flag = 1;
++ append_to_inbuf_list(urb);
++ ipcusb_timer.data = (unsigned long)urb;
++ mod_timer(&ipcusb_timer, jiffies+(10*HZ/1000));
++#if 0
++ if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
++ {
++ last_jiff = jiffies;
++ queue_apm_event(KRNL_ICL, NULL);
++ }
++#endif
++ }
++
++ if (usb_mux_dispatcher)
++ usb_mux_dispatcher(tty); /* call Liu changhui's func. */
++
++ urb->actual_length = 0;
++ urb->dev = bvd_ipc->ipc_dev;
++ if (usb_submit_urb(urb, GFP_ATOMIC))
++ bvd_dbg("failed resubmitting read urb");
++#if 0
++ if(jiffies - last_jiff > ICL_EVENT_INTERVAL)
++ {
++ last_jiff = jiffies;
++ queue_apm_event(KRNL_ICL, NULL);
++ }
++#endif
++ bvd_dbg("usb_ipc_read_bulk: resubmited read urb");
++ }
++
++ bvd_dbg("usb_ipc_read_bulk: completed!!!");
++}
++
++static void usb_ipc_write_bulk(struct urb *urb, struct pt_regs *regs)
++{
++ callback_times++;
++ bvd_ipc->write_finished_flag = 1;
++
++ bvd_dbg("usb_ipc_write_bulk: begining!");
++ //printk("%s: write_finished_flag=%d\n", __FUNCTION__, bvd_ipc->write_finished_flag);
++
++ if (urb->status)
++ printk("nonzero write bulk status received: %d\n", urb->status);
++
++ if (usb_mux_sender)
++ usb_mux_sender(); /**call Liu changhui's func**/
++
++ //printk("usb_ipc_write_bulk: mark ipcusb_softint!\n");
++ tasklet_schedule(&bvd_ipc->bh);
++
++ bvd_dbg("usb_ipc_write_bulk: finished!");
++}
++
++static void wakeup_timeout(unsigned long data)
++{
++ GPSR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
++ bvd_dbg("wakup_timeout: send GPIO_MCU_INT_SW signal!");
++}
++
++static void suspend_timeout(unsigned long data)
++{
++ if (bvd_ipc->suspend_flag == 1) {
++ bvd_ipc->suspend_flag = 0;
++ mod_timer(&suspend_timer, jiffies+(5000*HZ/1000));
++ bvd_dbg("suspend_timeout: add the suspend timer again");
++ } else {
++ unlink_urbs(&bvd_ipc->readurb_mux);
++ UHCRHPS3 = 0x4;
++ mdelay(40);
++ bvd_dbg("suspend_timeout: send SUSPEND signal! UHCRHPS3=0x%x",
++ UHCRHPS3);
++ }
++}
++
++static void ipcusb_xmit_data(void)
++{
++ int c, count = IPC_URB_SIZE;
++ int result = 0;
++ int buf_flag = 0;
++ int buf_num = 0;
++
++ //printk("%s: sumbit_times=%d, callback_times=%d\n", __FUNCTION__, sumbit_times, callback_times);
++ if (bvd_ipc->write_finished_flag == 0)
++ return;
++
++ while (1) {
++ c = CIRC_CNT_TO_END(bvd_ipc->xmit.head, bvd_ipc->xmit.tail,
++ IPC_USB_XMIT_SIZE);
++ if (count < c)
++ c = count;
++ if (c <= 0)
++ break;
++
++ memcpy(bvd_ipc->obuf+buf_num,
++ bvd_ipc->xmit.buf + bvd_ipc->xmit.tail, c);
++ buf_flag = 1;
++ bvd_ipc->xmit.tail = ((bvd_ipc->xmit.tail + c)
++ & (IPC_USB_XMIT_SIZE-1));
++ count -= c;
++ buf_num += c;
++ }
++
++ if (buf_num == 0) {
++ bvd_dbg("ipcusb_xmit_data: buf_num=%d, add suspend_timer",
++ buf_num);
++ bvd_ipc->suspend_flag = 0;
++ mod_timer(&suspend_timer, jiffies+(5000*HZ/1000));
++ }
++
++ bvd_dbg("ipcusb_xmit_data: buf_num=%d", buf_num);
++ bvd_dbg("ipcusb_xmit_data: bvd_ipc->obuf: ");
++
++ bvd_dbg_hex((bvd_ipc->obuf)-buf_num, buf_num);
++
++ if (buf_flag) {
++ bvd_ipc->writeurb_mux.transfer_buffer_length = buf_num;
++ bvd_dbg("ipcusb_xmit_data: copy data to write urb finished! ");
++
++ if ((UHCRHPS3 & 0x4) == 0x4) {
++ static int ret;
++ int time = 0;
++
++ /* if BP sleep, wake up BP first */
++ pxa_gpio_mode(GPIO_IN | 41);
++ if (GPIO_is_high(41)) {
++ if (GPIO_is_high(GPIO_MCU_INT_SW))
++ GPCR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
++ else
++ GPSR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
++
++ time = jiffies;
++ while (GPIO_is_high(41) && (jiffies < (time+HZ)));
++
++ if (GPIO_is_high(41)) {
++ printk("%s: Wakeup BP timeout! BP state is %d\n",
++ __FUNCTION__, GPIO_is_high(41));
++ }
++ if (GPIO_is_high(GPIO_MCU_INT_SW))
++ GPCR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
++ else
++ GPSR(GPIO_MCU_INT_SW) = GPIO_bit(GPIO_MCU_INT_SW);
++ }
++
++ /* Resume BP */
++ UHCRHPS3 = 0x8;
++ mdelay(40);
++ bvd_dbg("ipcusb_xmit_data: Send RESUME signal! UHCRHPS3=0x%x",
++ UHCRHPS3);
++ /*send IN token*/
++ bvd_ipc->readurb_mux.actual_length = 0;
++ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
++ if (ret = usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC))
++ printk("ipcusb_xmit_data: usb_submit_urb(read mux bulk)"
++ "failed! status=%d\n", ret);
++ bvd_dbg("ipcusb_xmit_data: Send a IN token successfully!");
++ }
++
++ sumbit_times++;
++ bvd_ipc->write_finished_flag = 0;
++ //printk("%s: clear write_finished_flag:%d\n", __FUNCTION__, bvd_ipc->write_finished_flag);
++ bvd_ipc->writeurb_mux.dev = bvd_ipc->ipc_dev;
++ if (result = usb_submit_urb(&bvd_ipc->writeurb_mux, GFP_ATOMIC))
++ warn("ipcusb_xmit_data: funky result! result=%d\n", result);
++
++ bvd_dbg("ipcusb_xmit_data: usb_submit_urb finished! result:%d", result);
++
++ }
++}
++
++static void usbipc_bh_func(unsigned long param)
++{
++ ipcusb_xmit_data();
++}
++
++extern void get_halted_bit(void);
++
++static void usbipc_bh_bp_func(unsigned long param)
++{
++ if ((UHCRHPS3 & 0x4) == 0x4) {
++ UHCRHPS3 = 0x8;
++ mdelay(40);
++ bvd_dbg("ipcusb_softint_send_readurb: Send RESUME signal! "
++ "UHCRHPS3=0x%x", UHCRHPS3);
++ }
++ if (bvd_ipc->ipc_flag == IPC_USB_PROBE_READY) {
++ get_halted_bit();
++
++ /*send a IN token*/
++ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
++ if (usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC)) {
++ bvd_dbg("ipcusb_softint_send_readurb: "
++ "usb_submit_urb(read mux bulk) failed!");
++ }
++ bvd_dbg("ipcusb_softint_send_readurb: Send a IN token successfully!");
++ bvd_ipc->suspend_flag = 0;
++ bvd_dbg("ipcusb_softint_send_readurb: add suspend_timer");
++ mod_timer(&suspend_timer, jiffies+(5000*HZ/1000));
++ }
++}
++
++static int usb_ipc_write(struct tty_struct *tty,
++ const unsigned char *buf, int count)
++{
++ int c, ret = 0;
++
++ bvd_dbg("usb_ipc_write: count=%d, buf: ", count);
++ bvd_dbg_hex(buf, count);
++
++ if (count <= 0)
++ return 0;
++
++ if (*ipcusb_ap_to_bp != NULL)
++ (*ipcusb_ap_to_bp)(buf, count);
++
++ bvd_ipc->suspend_flag = 1;
++
++ if ((bvd_ipc->ipc_flag == IPC_USB_PROBE_READY) &&
++ (bvd_ipc->xmit.head == bvd_ipc->xmit.tail)) {
++ bvd_dbg("usb_ipc_write: set write_flag");
++ bvd_ipc->write_flag = IPC_USB_WRITE_XMIT;
++ }
++
++ while (1) {
++ c = CIRC_SPACE_TO_END(bvd_ipc->xmit.head,
++ bvd_ipc->xmit.tail, IPC_USB_XMIT_SIZE);
++ if (count < c)
++ c = count;
++ if (c <= 0)
++ break;
++
++ memcpy(bvd_ipc->xmit.buf + bvd_ipc->xmit.head, buf, c);
++ bvd_ipc->xmit.head = ((bvd_ipc->xmit.head + c)
++ & (IPC_USB_XMIT_SIZE-1));
++ buf += c;
++ count -= c;
++ ret += c;
++ }
++ bvd_dbg("usb_ipc_write: ret=%d, bvd_ipc->xmit.buf: ", ret);
++
++ bvd_dbg_hex(bvd_ipc->xmit.buf, ret);
++
++ if (bvd_ipc->write_flag == IPC_USB_WRITE_XMIT) {
++ bvd_ipc->write_flag = IPC_USB_WRITE_INIT;
++ bvd_dbg("usb_ipc_write: mark ipcusb_softint");
++ tasklet_schedule(&bvd_ipc->bh);
++ }
++
++ bvd_dbg("usb_ipc_write: ret=%d\n", ret);
++ return ret;
++}
++
++static int usb_ipc_chars_in_buffer(struct tty_struct *tty)
++{
++ return CIRC_CNT(bvd_ipc->xmit.head, bvd_ipc->xmit.tail, IPC_USB_XMIT_SIZE);
++}
++
++void usb_send_readurb(void)
++{
++ //printk("usb_send_readurb: begining!UHCRHPS3=0x%x, usbh_finished_resume=%d\n", UHCRHPS3, usbh_finished_resume);
++
++ if (usbh_finished_resume == 0)
++ return;
++
++ tasklet_schedule(&bvd_ipc->bh_bp);
++}
++
++static int usb_ipc_probe(struct usb_interface *intf,
++ const struct usb_device_id *id)
++{
++ struct usb_device *usbdev = interface_to_usbdev(intf);
++ struct usb_config_descriptor *ipccfg;
++ struct usb_interface_descriptor *interface;
++ struct usb_endpoint_descriptor *endpoint;
++ int ep_cnt, readsize, writesize;
++ char have_bulk_in_mux, have_bulk_out_mux;
++
++ bvd_dbg("usb_ipc_probe: vendor id 0x%x, device id 0x%x",
++ usbdev->descriptor.idVendor, usbdev->descriptor.idProduct);
++
++ if ((usbdev->descriptor.idVendor != MOTO_IPC_VID) ||
++ (usbdev->descriptor.idProduct != MOTO_IPC_PID))
++ return -ENODEV;
++
++ /* a2590c : dsplog interface is not supported by this driver */
++ if (intf->minor == 2) /* dsplog interface number is 2 */
++ return -1;
++
++ bvd_dbg("usb_ipc_probe: USB dev address:%p", usbdev);
++ bvd_dbg("usb_ipc_probe: ifnum:%u", intf->minor);
++
++ ipccfg = &usbdev->actconfig->desc;
++ bvd_dbg("usb_ipc_prob: config%d", ipccfg->bConfigurationValue);
++ bvd_dbg("usb_ipc_prob: bNumInterfaces = %d", ipccfg->bNumInterfaces);
++
++ /* After this point we can be a little noisy about what we are trying
++ * to configure, hehe. */
++ if (usbdev->descriptor.bNumConfigurations != 1) {
++ info("usb_ipc_probe: Only one device configuration "
++ "is supported.");
++ return -1;
++ }
++
++ if (usbdev->config[0].desc.bNumInterfaces != 3) {
++ info("usb_ipc_probe: Only three device interfaces are "
++ "supported.");
++ return -1;
++ }
++
++ interface = &intf->cur_altsetting->desc;
++ endpoint = &intf->cur_altsetting->endpoint[0].desc;
++ /* Start checking for two bulk endpoints or ... FIXME: This is a future
++ * enhancement...*/
++ bvd_dbg("usb_ipc_probe: Number of Endpoints:%d",
++ (int) interface->bNumEndpoints);
++ if (interface->bNumEndpoints != 2) {
++ info("usb_ipc_probe: Only two endpoints supported.");
++ return -1;
++ }
++
++ ep_cnt = have_bulk_in_mux = have_bulk_out_mux = 0;
++
++ bvd_dbg("usb_ipc_probe: endpoint[0] is:%x",
++ (&endpoint[0])->bEndpointAddress);
++ bvd_dbg("usb_ipc_probe: endpoint[1] is:%x ",
++ (&endpoint[1])->bEndpointAddress);
++
++ while (ep_cnt < interface->bNumEndpoints) {
++
++ if (!have_bulk_in_mux && IS_EP_BULK_IN(endpoint[ep_cnt])) {
++ bvd_dbg("usb_ipc_probe: bEndpointAddress(IN) is:%x ",
++ (&endpoint[ep_cnt])->bEndpointAddress);
++ have_bulk_in_mux =
++ (&endpoint[ep_cnt])->bEndpointAddress;
++ readsize = (&endpoint[ep_cnt])->wMaxPacketSize;
++ bvd_dbg("usb_ipc_probe: readsize=%d", readsize);
++ ep_cnt++;
++ continue;
++ }
++
++ if (!have_bulk_out_mux && IS_EP_BULK_OUT(endpoint[ep_cnt])) {
++ bvd_dbg("usb_ipc_probe: bEndpointAddress(OUT) is:%x ",
++ (&endpoint[ep_cnt])->bEndpointAddress);
++ have_bulk_out_mux =
++ (&endpoint[ep_cnt])->bEndpointAddress;
++ writesize = (&endpoint[ep_cnt])->wMaxPacketSize;
++ bvd_dbg("usb_ipc_probe: writesize=%d", writesize);
++ ep_cnt++;
++ continue;
++ }
++
++ info("usb_ipc_probe: Undetected endpoint ^_^ ");
++ /* Shouldn't ever get here unless we have something weird */
++ return -1;
++ }
++
++ /* Perform a quick check to make sure that everything worked as it
++ * should have. */
++
++ switch (interface->bNumEndpoints) {
++ case 2:
++ if (!have_bulk_in_mux || !have_bulk_out_mux) {
++ info("usb_ipc_probe: Two bulk endpoints required.");
++ return -1;
++ }
++ break;
++ default:
++ info("usb_ipc_probe: Endpoint determination failed ^_^ ");
++ return -1;
++ }
++
++ /* Ok, now initialize all the relevant values */
++ if (!(bvd_ipc->obuf = (char *)kmalloc(writesize, GFP_KERNEL))) {
++ err("usb_ipc_probe: Not enough memory for the output buffer.");
++ kfree(bvd_ipc);
++ return -1;
++ }
++ bvd_dbg("usb_ipc_probe: obuf address:%p", bvd_ipc->obuf);
++
++ if (!(bvd_ipc->ibuf = (char *)kmalloc(readsize, GFP_KERNEL))) {
++ err("usb_ipc_probe: Not enough memory for the input buffer.");
++ kfree(bvd_ipc->obuf);
++ kfree(bvd_ipc);
++ return -1;
++ }
++ bvd_dbg("usb_ipc_probe: ibuf address:%p", bvd_ipc->ibuf);
++
++ bvd_ipc->ipc_flag = IPC_USB_PROBE_READY;
++ bvd_ipc->write_finished_flag = 1;
++ bvd_ipc->suspend_flag = 1;
++ bvd_ipc->bulk_in_ep_mux= have_bulk_in_mux;
++ bvd_ipc->bulk_out_ep_mux= have_bulk_out_mux;
++ bvd_ipc->ipc_dev = usbdev;
++ bvd_ipc->writesize = writesize;
++ INIT_LIST_HEAD (&bvd_ipc->in_buf_list);
++
++ bvd_ipc->bh.func = usbipc_bh_func;
++ bvd_ipc->bh.data = (unsigned long) bvd_ipc;
++
++ bvd_ipc->bh_bp.func = usbipc_bh_bp_func;
++ bvd_ipc->bh_bp.data = (unsigned long) bvd_ipc;
++
++ /*Build a write urb*/
++ usb_fill_bulk_urb(&bvd_ipc->writeurb_mux, usbdev,
++ usb_sndbulkpipe(bvd_ipc->ipc_dev,
++ bvd_ipc->bulk_out_ep_mux),
++ bvd_ipc->obuf, writesize, usb_ipc_write_bulk,
++ bvd_ipc);
++ //bvd_ipc->writeurb_mux.transfer_flags |= USB_ASYNC_UNLINK;
++
++ /*Build a read urb and send a IN token first time*/
++ usb_fill_bulk_urb(&bvd_ipc->readurb_mux, usbdev,
++ usb_rcvbulkpipe(usbdev, bvd_ipc->bulk_in_ep_mux),
++ bvd_ipc->ibuf, readsize, usb_ipc_read_bulk, bvd_ipc);
++ //bvd_ipc->readurb_mux.transfer_flags |= USB_ASYNC_UNLINK;
++
++ usb_driver_claim_interface(&usb_ipc_driver, intf, bvd_ipc);
++ //usb_driver_claim_interface(&usb_ipc_driver, &ipccfg->interface[1], bvd_ipc);
++
++ // a2590c: dsplog is not supported by this driver
++ // usb_driver_claim_interface(&usb_ipc_driver,
++ // &ipccfg->interface[2], bvd_ipc);
++ /*send a IN token first time*/
++ bvd_ipc->readurb_mux.dev = bvd_ipc->ipc_dev;
++ if (usb_submit_urb(&bvd_ipc->readurb_mux, GFP_ATOMIC))
++ printk("usb_ipc_prob: usb_submit_urb(read mux bulk) failed!\n");
++
++ bvd_dbg("usb_ipc_prob: Send a IN token successfully!");
++
++ if (bvd_ipc->xmit.head != bvd_ipc->xmit.tail) {
++ printk("usb_ipc_probe: mark ipcusb_softint!\n");
++ tasklet_schedule(&bvd_ipc->bh);
++ }
++
++ printk("usb_ipc_probe: completed probe!");
++ usb_set_intfdata(intf, &bvd_ipc);
++ return 0;
++}
++
++static void usb_ipc_disconnect(struct usb_interface *intf)
++{
++ //struct usb_device *usbdev = interface_to_usbdev(intf);
++ struct ipc_usb_data *bvd_ipc_disconnect = usb_get_intfdata(intf);
++
++ printk("usb_ipc_disconnect:*** \n");
++
++ if ((UHCRHPS3 & 0x4) == 0)
++ usb_unlink_urb(&bvd_ipc_disconnect->readurb_mux);
++
++ usb_unlink_urb(&bvd_ipc_disconnect->writeurb_mux);
++
++ bvd_ipc_disconnect->ipc_flag = IPC_USB_PROBE_NOT_READY;
++ kfree(bvd_ipc_disconnect->ibuf);
++ kfree(bvd_ipc_disconnect->obuf);
++
++ usb_driver_release_interface(&usb_ipc_driver,
++ bvd_ipc_disconnect->ipc_dev->actconfig->interface[0]);
++ usb_driver_release_interface(&usb_ipc_driver,
++ bvd_ipc_disconnect->ipc_dev->actconfig->interface[1]);
++
++ //a2590c: dsplog interface is not supported by this driver
++ //usb_driver_release_interface(&usb_ipc_driver, &bvd_ipc_disconnect->ipc_dev->actconfig->interface[2]);
++
++ bvd_ipc_disconnect->ipc_dev = NULL;
++
++ usb_set_intfdata(intf, NULL);
++
++ printk("usb_ipc_disconnect completed!\n");
++}
++
++static struct usb_device_id usb_ipc_id_table[] = {
++ { USB_DEVICE(MOTO_IPC_VID, MOTO_IPC_PID) },
++ { } /* Terminating entry */
++};
++
++static struct usb_driver usb_ipc_driver = {
++ .name = "usb ipc",
++ .probe = usb_ipc_probe,
++ .disconnect = usb_ipc_disconnect,
++ .id_table = usb_ipc_id_table,
++};
++
++static int __init usb_ipc_init(void)
++{
++ int result;
++
++ bvd_dbg("init usb_ipc");
++ /* register driver at the USB subsystem */
++ result = usb_register(&usb_ipc_driver);
++ if (result < 0) {
++ err ("usb ipc driver could not be registered");
++ return result;
++ }
++
++ /*init the related mux interface*/
++ if (!(bvd_ipc = kzalloc(sizeof(struct ipc_usb_data), GFP_KERNEL))) {
++ err("usb_ipc_init: Out of memory.");
++ usb_deregister(&usb_ipc_driver);
++ return -ENOMEM;
++ }
++ bvd_dbg("usb_ipc_init: Address of bvd_ipc:%p", bvd_ipc);
++
++ if (!(bvd_ipc->xmit.buf = kmalloc(IPC_USB_XMIT_SIZE, GFP_KERNEL))) {
++ err("usb_ipc_init: Not enough memory for the input buffer.");
++ kfree(bvd_ipc);
++ usb_deregister(&usb_ipc_driver);
++ return -ENOMEM;
++ }
++ bvd_dbg("usb_ipc_init: bvd_ipc->xmit.buf address:%p",
++ bvd_ipc->xmit.buf);
++ bvd_ipc->ipc_dev = NULL;
++ bvd_ipc->xmit.head = bvd_ipc->xmit.tail = 0;
++ bvd_ipc->write_flag = IPC_USB_WRITE_INIT;
++
++ ipcusb_tty_driver.write = usb_ipc_write;
++ ipcusb_tty_driver.chars_in_buffer = usb_ipc_chars_in_buffer;
++
++ usb_for_mux_driver = &ipcusb_tty_driver;
++ usb_for_mux_tty = &ipcusb_tty;
++
++ /* init timers for ipcusb read process and usb suspend */
++ init_timer(&ipcusb_timer);
++ ipcusb_timer.function = ipcusb_timeout;
++
++ init_timer(&suspend_timer);
++ suspend_timer.function = suspend_timeout;
++
++ init_timer(&wakeup_timer);
++ wakeup_timer.function = wakeup_timeout;
++
++ info("USB Host(Bulverde) IPC driver registered.");
++ info(DRIVER_VERSION ":" DRIVER_DESC);
++
++ return 0;
++}
++
++static void __exit usb_ipc_exit(void)
++{
++ bvd_dbg("cleanup bvd_ipc");
++
++ kfree(bvd_ipc->xmit.buf);
++ kfree(bvd_ipc);
++ usb_deregister(&usb_ipc_driver);
++
++ info("USB Host(Bulverde) IPC driver deregistered.");
++}
++
++module_init(usb_ipc_init);
++module_exit(usb_ipc_exit);
++EXPORT_SYMBOL(usb_send_readurb);
+Index: linux-2.6.23/drivers/char/ts0710_mux_usb.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/char/ts0710_mux_usb.h 2007-10-22 22:26:50.000000000 +0200
+@@ -0,0 +1,29 @@
++/*
++ * linux/drivers/usb/ipcusb.h
++ *
++ * Implementation of a ipc driver based Intel's Bulverde USB Host
++ * Controller.
++ *
++ * Copyright (C) 2003-2005 Motorola
++ *
++ * 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
++ *
++ * 2003-Nov-18 - (Motorola) created
++ *
++ */
++extern struct tty_driver *usb_for_mux_driver;
++extern struct tty_struct *usb_for_mux_tty;
++extern void (*usb_mux_dispatcher)(struct tty_struct *tty);
++extern void (*usb_mux_sender)(void);
diff --git a/packages/linux/linux-ezx-2.6.23/patches/mux_debug.patch b/packages/linux/linux-ezx-2.6.23/patches/mux_debug.patch
new file mode 100644
index 0000000000..58cb25a0b6
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/mux_debug.patch
@@ -0,0 +1,551 @@
+Index: linux-2.6.20.7/drivers/char/ts0710_mux.c
+===================================================================
+--- linux-2.6.20.7.orig/drivers/char/ts0710_mux.c 2007-04-22 12:24:18.000000000 +0200
++++ linux-2.6.20.7/drivers/char/ts0710_mux.c 2007-04-22 12:26:47.000000000 +0200
+@@ -85,6 +85,9 @@
+ #include "ts0710.h"
+ #include "ts0710_mux.h"
+
++#define TS0710DEBUG
++#define PRINT_OUTPUT_PRINTK
++
+ #define TS0710MUX_GPRS_SESSION_MAX 2
+ #define TS0710MUX_MAJOR 250
+ #define TS0710MUX_MINOR_START 0
+@@ -316,7 +319,7 @@
+ #ifdef TS0710DEBUG
+
+ #ifdef PRINT_OUTPUT_PRINTK
+-#define TS0710_DEBUG(fmt, arg...) printk(KERN_INFO "MUX " __FUNCTION__ ": " fmt "\n" , ## arg)
++#define TS0710_DEBUG(fmt, arg...) printk(KERN_INFO "MUX %s: " fmt "\n" , __func__, ## arg)
+ #else
+ #include "ezxlog.h"
+ static __u8 strDebug[256];
+@@ -530,10 +533,10 @@
+ if (strncmp(p->comm, "aplogd", 6) == 0) {
+ sig = 1;
+ if (send_sig(SIGUSR2, p, 1) == 0) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX: success to send SIGUSR2 to aplogd!\n");
+ } else {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX: failure to send SIGUSR2 to aplogd!\n");
+ }
+ break;
+@@ -542,7 +545,7 @@
+ read_unlock(&tasklist_lock);
+
+ if (!sig) {
+- TS0710_PRINTK("MUX: not found aplogd!\n");
++ TS0710_DEBUG("MUX: not found aplogd!\n");
+ }
+ }
+ #else
+@@ -559,11 +562,11 @@
+ buf[len + 1] = TS0710_BASIC_FLAG;
+
+ if ((COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX basic_write: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n");
+
+ #ifndef USB_FOR_MUX
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX basic_write: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n");
+ TS0710_SIG2APLOGD();
+ #endif
+@@ -577,7 +580,7 @@
+ res = COMM_FOR_MUX_DRIVER->write(COMM_FOR_MUX_TTY, buf, len + 2);
+
+ if (res != len + 2) {
+- TS0710_PRINTK("MUX basic_write: Write Error!\n");
++ TS0710_DEBUG("MUX basic_write: Write Error!\n");
+ return -1;
+ }
+
+@@ -601,7 +604,7 @@
+ TS0710_DEBUG("crc_check: CRC check OK\n");
+ return 0;
+ } else {
+- TS0710_PRINTK("MUX crc_check: CRC check failed\n");
++ TS0710_DEBUG("MUX crc_check: CRC check failed\n");
+ return 1;
+ }
+ }
+@@ -1266,7 +1269,7 @@
+ break;
+
+ case FCON: /*Flow control on command */
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Received Flow control(all channels) on command\n");
+ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
+ ts0710->dlci[0].state = CONNECTED;
+@@ -1276,7 +1279,7 @@
+ break;
+
+ case FCOFF: /*Flow control off command */
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Received Flow control(all channels) off command\n");
+ if (mcc_short_pkt->h.type.cr == MCC_CMD) {
+ for (j = 0; j < TS0710_MAX_CHN; j++) {
+@@ -1823,7 +1826,7 @@
+ TS0710_DEBUG("UIH on channel %d\n", dlci);
+
+ if (uih_len > ts0710->dlci[dlci].mtu) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: DLCI:%d, uih_len:%d is bigger than mtu:%d, discard data!\n",
+ dlci, uih_len, ts0710->dlci[dlci].mtu);
+ break;
+@@ -1844,7 +1847,7 @@
+ dlci, tty_idx);
+ TS0710_DEBUGSTR(uih_data_start, uih_len);
+ if (!(iscmdtty[tty_idx])) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: %s: Wrong CMDTAG on DLCI:%d, /dev/mux%d\n",
+ __FUNCTION__, dlci, tty_idx);
+ }
+@@ -1856,7 +1859,7 @@
+ ("NON-CMDTAG on DLCI:%d, /dev/mux%d\n",
+ dlci, tty_idx);
+ if (iscmdtty[tty_idx]) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: %s: Wrong NON-CMDTAG on DLCI:%d, /dev/mux%d\n",
+ __FUNCTION__, dlci, tty_idx);
+ }
+@@ -1864,13 +1867,14 @@
+ }
+ tty = mux_table[tty_idx];
+ if ((!mux_tty[tty_idx]) || (!tty)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX: No application waiting for, discard it! /dev/mux%d\n",
+ tty_idx);
++ TS0710_DEBUG("MUX: mux_tty[%d] = %d, tty is at %i", tty_idx, mux_tty[tty_idx], tty);
+ } else { /* Begin processing received data */
+ if ((!mux_recv_info_flags[tty_idx])
+ || (!mux_recv_info[tty_idx])) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: No mux_recv_info, discard it! /dev/mux%d\n",
+ tty_idx);
+ break;
+@@ -1878,7 +1882,7 @@
+
+ recv_info = mux_recv_info[tty_idx];
+ if (recv_info->total > 8192) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX : discard data for tty_idx:%d, recv_info->total > 8192 \n",
+ tty_idx);
+ break;
+@@ -1949,7 +1953,7 @@
+ get_mux_recv_packet
+ (uih_len);
+ if (!recv_packet) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX %s: no memory\n",
+ __FUNCTION__);
+ break;
+@@ -1980,7 +1984,7 @@
+ } else { /* recv_info->total == 0 */
+ if (uih_len >
+ TS0710MUX_RECV_BUF_SIZE) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: tty_idx:%d, uih_len == %d is too big\n",
+ tty_idx, uih_len);
+ uih_len =
+@@ -2120,12 +2124,12 @@
+ if (ts0710->dlci[dlci].state == DISCONNECTED) {
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI %d Send DISC got signal!\n",
+ dlci);
+ break;
+ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI %d Send DISC timeout!\n", dlci);
+ continue;
+ }
+@@ -2158,7 +2162,7 @@
+ return 0;
+ } else if (ts0710->dlci[0].state == CONNECTING) {
+ /* Reentry */
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI: 0, reentry to open DLCI 0, pid: %d, %s !\n",
+ current->pid, current->comm);
+ try = 11;
+@@ -2179,13 +2183,13 @@
+ DISCONNECTED) {
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Wait for connecting got signal!\n",
+ dlci);
+ retval = -EAGAIN;
+ break;
+ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Wait for connecting timeout!\n",
+ dlci);
+ continue;
+@@ -2199,7 +2203,7 @@
+ }
+ } else if ((ts0710->dlci[0].state != DISCONNECTED)
+ && (ts0710->dlci[0].state != REJECTED)) {
+- TS0710_PRINTK("MUX DLCI:%d state is invalid!\n", dlci);
++ TS0710_DEBUG("MUX DLCI:%d state is invalid!\n", dlci);
+ return retval;
+ } else {
+ ts0710->initiator = 1;
+@@ -2218,19 +2222,19 @@
+ retval = 0;
+ break;
+ } else if (ts0710->dlci[0].state == REJECTED) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM got rejected!\n",
+ dlci);
+ retval = -EREJECTED;
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM got signal!\n",
+ dlci);
+ retval = -EAGAIN;
+ break;
+ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM timeout!\n",
+ dlci);
+ continue;
+@@ -2271,13 +2275,13 @@
+ DISCONNECTED) {
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Wait for connecting got signal!\n",
+ dlci);
+ retval = -EAGAIN;
+ break;
+ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Wait for connecting timeout!\n",
+ dlci);
+ continue;
+@@ -2296,7 +2300,7 @@
+ }
+ } else if ((ts0710->dlci[dlci].state != DISCONNECTED)
+ && (ts0710->dlci[dlci].state != REJECTED)) {
+- TS0710_PRINTK("MUX DLCI:%d state is invalid!\n", dlci);
++ TS0710_DEBUG("MUX DLCI:%d state is invalid!\n", dlci);
+ return retval;
+ } else {
+ ts0710->dlci[dlci].state = NEGOTIATING;
+@@ -2313,13 +2317,13 @@
+ if (ts0710->dlci[dlci].state == CONNECTING) {
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send pn_msg got signal!\n",
+ dlci);
+ retval = -EAGAIN;
+ break;
+ } else if ((jiffies - t) >= TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send pn_msg timeout!\n",
+ dlci);
+ continue;
+@@ -2344,20 +2348,20 @@
+ break;
+ } else if (ts0710->dlci[dlci].state ==
+ REJECTED) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM got rejected!\n",
+ dlci);
+ retval = -EREJECTED;
+ break;
+ } else if (signal_pending(current)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM got signal!\n",
+ dlci);
+ retval = -EAGAIN;
+ break;
+ } else if ((jiffies - t) >=
+ TS0710MUX_TIME_OUT) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX DLCI:%d Send SABM timeout!\n",
+ dlci);
+ continue;
+@@ -2468,7 +2472,7 @@
+ schedule_work(&send_tqueue);
+ #else
+ if (!tq_serial_for_mux) {
+- TS0710_PRINTK("MUX Error: %s: tq_serial_for_mux == 0\n",
++ TS0710_DEBUG("MUX Error: %s: tq_serial_for_mux == 0\n",
+ __FUNCTION__);
+ return;
+ }
+@@ -2508,7 +2512,7 @@
+ if ((mux_tty[cmdtty] == 0) && (mux_tty[datatty] == 0)) {
+ if (dlci == 1) {
+ ts0710_close_channel(0);
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX mux_close: tapisrv might be down!!! Close DLCI 1\n");
+ TS0710_SIG2APLOGD();
+ }
+@@ -2673,12 +2677,12 @@
+ UNUSED_PARAM(tty);
+
+ if ((COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX %s: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n",
+ __FUNCTION__);
+
+ #ifndef USB_FOR_MUX
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX %s: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n",
+ __FUNCTION__);
+ TS0710_SIG2APLOGD();
+@@ -2724,14 +2728,14 @@
+ } else if (ts0710->dlci[dlci].state == CONNECTED) {
+
+ if (!(mux_send_info_flags[line])) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: mux_write: mux_send_info_flags[%d] == 0\n",
+ line);
+ return -ENODEV;
+ }
+ send_info = mux_send_info[line];
+ if (!send_info) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: mux_write: mux_send_info[%d] == 0\n",
+ line);
+ return -ENODEV;
+@@ -2800,7 +2804,7 @@
+ }
+ return c;
+ } else {
+- TS0710_PRINTK("MUX mux_write: DLCI %d not connected\n", dlci);
++ TS0710_DEBUG("MUX mux_write: DLCI %d not connected\n", dlci);
+ return -EDISCONNECTED;
+ }
+ }
+@@ -2940,7 +2944,7 @@
+ return;
+ }
+
+- TS0710_PRINTK("MUX %s: line is:%d\n", __FUNCTION__, line);
++ TS0710_DEBUG("MUX %s: line is:%d\n", __FUNCTION__, line);
+
+ if ((mux_send_info_flags[line])
+ && (mux_send_info[line])
+@@ -2960,10 +2964,10 @@
+
+ /*
+ if( (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0) ) {
+- TS0710_PRINTK("MUX %s: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n", __FUNCTION__);
++ TS0710_DEBUG("MUX %s: (COMM_FOR_MUX_DRIVER == 0) || (COMM_FOR_MUX_TTY == 0)\n", __FUNCTION__);
+
+ #ifndef USB_FOR_MUX
+- TS0710_PRINTK("MUX %s: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n", __FUNCTION__);
++ TS0710_DEBUG("MUX %s: tapisrv might be down!!! (serial_for_mux_driver == 0) || (serial_for_mux_tty == 0)\n", __FUNCTION__);
+ TS0710_SIG2APLOGD();
+ #endif
+
+@@ -2989,9 +2993,9 @@
+ if ((COMM_FOR_MUX_DRIVER == NULL) || (COMM_FOR_MUX_TTY == NULL)) {
+
+ #ifdef USB_FOR_MUX
+- TS0710_PRINTK("MUX: please install and open IPC-USB first\n");
++ TS0710_DEBUG("MUX: please install and open IPC-USB first\n");
+ #else
+- TS0710_PRINTK("MUX: please install and open ttyS0 first\n");
++ TS0710_DEBUG("MUX: please install and open ttyS0 first\n");
+ #endif
+
+ goto out;
+@@ -3016,7 +3020,7 @@
+ /* if( dlci == 1 ) { */
+ /* Open server channel 0 first */
+ if ((retval = ts0710_open_channel(0)) != 0) {
+- TS0710_PRINTK("MUX: Can't connect server channel 0!\n");
++ TS0710_DEBUG("MUX: Can't connect server channel 0!\n");
+ ts0710_init();
+
+ mux_tty[line]--;
+@@ -3073,7 +3077,7 @@
+ datatty = dlci2tty[dlci].datatty;
+ if ((mux_tty[cmdtty] > 0) || (mux_tty[datatty] > 0)) {
+ if ((retval = ts0710_open_channel(dlci)) != 0) {
+- TS0710_PRINTK("MUX: Can't connected channel %d!\n",
++ TS0710_DEBUG("MUX: Can't connected channel %d!\n",
+ dlci);
+ ts0710_reset_dlci(dlci);
+
+@@ -3096,6 +3100,7 @@
+ retval = 0;
+ #endif
+ out:
++ TS0710_DEBUG("returning %d for open of /dev/mux%d (mux_tty[%d] = %d", retval, line, line, mux_tty[line]);
+ return retval;
+ }
+
+@@ -3178,12 +3183,12 @@
+
+ while (1) {
+ tbuf_free = TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf);
+- TS0710_PRINTK("Reading max %i bytes from ts0710_mux_usb inbuf.\n", tbuf_free);
++ TS0710_DEBUG("Reading max %i bytes from ts0710_mux_usb inbuf.\n", tbuf_free);
+ tbuf_read = get_from_inbuf_list(tbuf_ptr, tbuf_free);
+ if (tbuf_read == 0) {
+ break;
+ } else {
+- TS0710_PRINTK("Read %i bytes.\n", tbuf_read);
++ TS0710_DEBUG("Read %i bytes.\n", tbuf_read);
+ };
+ tbuf_ptr += tbuf_read;
+ };
+@@ -3192,7 +3197,7 @@
+
+ // Should be impossible?
+ //if (count > (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf))) {
+- // TS0710_PRINTK
++ // TS0710_DEBUG
+ // ("MUX receive_worker: !!!!! Exceed buffer boundary !!!!!\n");
+ // count = (TS0710MUX_MAX_BUF_SIZE - (tbuf_ptr - tbuf));
+ //}
+@@ -3264,7 +3269,7 @@
+ TS0710_LOGSTR_FRAME(0, start_flag,
+ (tbuf_ptr -
+ start_flag));
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: %s: frame length:%d is bigger than Max total frame size:%d\n",
+ /*__FUNCTION__, framelen, TS0710MUX_MAX_TOTAL_FRAME_SIZE);*/
+ __FUNCTION__, framelen, (TS0710MUX_MAX_TOTAL_FRAME_SIZE + SEQ_FIELD_SIZE)); /*For BP UART problem */
+@@ -3389,7 +3394,7 @@
+ *(uih_data_start
+ + uih_len) =
+ 0;
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX bp log: %s\n",
+ uih_data_start);
+ }
+@@ -3415,7 +3420,7 @@
+ TS0710_LOGSTR_FRAME(0, start_flag,
+ framelen);
+ TS0710_DEBUGHEX(start_flag, framelen);
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX: Lost synchronization!\n");
+ search = start_flag + 1;
+ }
+@@ -3476,7 +3481,7 @@
+ recv_info2 = recv_info->next;
+
+ if (!(recv_info->total)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: %s: Should not get here, recv_info->total == 0 \n",
+ __FUNCTION__);
+ continue;
+@@ -3486,7 +3491,7 @@
+ dlci = tty2dlci[tty_idx];
+ tty = mux_table[tty_idx];
+ if ((!mux_tty[tty_idx]) || (!tty)) {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX: No application waiting for, free recv_info! tty_idx:%d\n",
+ tty_idx);
+ mux_recv_info_flags[tty_idx] = 0;
+@@ -3560,7 +3565,7 @@
+ recv_info->total -= recv_packet->length;
+ free_mux_recv_packet(recv_packet);
+ } else {
+- TS0710_PRINTK
++ TS0710_DEBUG
+ ("MUX Error: %s: Should not get here, recv_info->total is:%u \n",
+ __FUNCTION__, recv_info->total);
+ }
+@@ -3760,7 +3765,7 @@
+ int ret;
+
+ if (idx > TS0710MUX_COUNT_MAX_IDX) {
+- TS0710_PRINTK("MUX get_count: invalid idx: %d!\n", idx);
++ TS0710_DEBUG("MUX get_count: invalid idx: %d!\n", idx);
+ return -1;
+ }
+
+@@ -3774,11 +3779,11 @@
+ static int set_count(__u8 idx, int count)
+ {
+ if (idx > TS0710MUX_COUNT_MAX_IDX) {
+- TS0710_PRINTK("MUX set_count: invalid idx: %d!\n", idx);
++ TS0710_DEBUG("MUX set_count: invalid idx: %d!\n", idx);
+ return -1;
+ }
+ if (count < 0) {
+- TS0710_PRINTK("MUX set_count: invalid count: %d!\n", count);
++ TS0710_DEBUG("MUX set_count: invalid count: %d!\n", count);
+ return -1;
+ }
+
+@@ -3792,11 +3797,11 @@
+ static int add_count(__u8 idx, int count)
+ {
+ if (idx > TS0710MUX_COUNT_MAX_IDX) {
+- TS0710_PRINTK("MUX add_count: invalid idx: %d!\n", idx);
++ TS0710_DEBUG("MUX add_count: invalid idx: %d!\n", idx);
+ return -1;
+ }
+ if (count <= 0) {
+- TS0710_PRINTK("MUX add_count: invalid count: %d!\n", count);
++ TS0710_DEBUG("MUX add_count: invalid count: %d!\n", count);
+ return -1;
+ }
+
+Index: linux-2.6.20.7/drivers/char/ts0710_mux_usb.c
+===================================================================
+--- linux-2.6.20.7.orig/drivers/char/ts0710_mux_usb.c 2007-04-22 12:26:47.000000000 +0200
++++ linux-2.6.20.7/drivers/char/ts0710_mux_usb.c 2007-04-22 12:26:47.000000000 +0200
+@@ -72,7 +72,8 @@
+ #define IPC_USB_PROBE_NOT_READY 4
+ #define DBG_MAX_BUF_SIZE 1024
+ #define ICL_EVENT_INTERVAL (HZ)
+-#undef BVD_DEBUG
++
++#define BVD_DEBUG
+
+ #define IS_EP_BULK(ep) ((ep).bmAttributes == USB_ENDPOINT_XFER_BULK ? 1 : 0)
+ #define IS_EP_BULK_IN(ep) (IS_EP_BULK(ep) && ((ep).bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/patch-2.6.23.1 b/packages/linux/linux-ezx-2.6.23/patches/patch-2.6.23.1
new file mode 100644
index 0000000000..5027b85ad4
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/patch-2.6.23.1
@@ -0,0 +1,108 @@
+diff --git a/Makefile b/Makefile
+index 4635a64..c244a02 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ VERSION = 2
+ PATCHLEVEL = 6
+ SUBLEVEL = 23
+-EXTRAVERSION =
++EXTRAVERSION = .1
+ NAME = Arr Matey! A Hairy Bilge Rat!
+
+ # *DOCUMENTATION*
+diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
+index cb7dec9..d9832e2 100644
+--- a/drivers/ata/sata_mv.c
++++ b/drivers/ata/sata_mv.c
+@@ -69,10 +69,11 @@
+ #include <linux/device.h>
+ #include <scsi/scsi_host.h>
+ #include <scsi/scsi_cmnd.h>
++#include <scsi/scsi_device.h>
+ #include <linux/libata.h>
+
+ #define DRV_NAME "sata_mv"
+-#define DRV_VERSION "1.0"
++#define DRV_VERSION "1.01"
+
+ enum {
+ /* BAR's are enumerated in terms of pci_resource_start() terms */
+@@ -420,6 +421,7 @@ static void mv_error_handler(struct ata_port *ap);
+ static void mv_post_int_cmd(struct ata_queued_cmd *qc);
+ static void mv_eh_freeze(struct ata_port *ap);
+ static void mv_eh_thaw(struct ata_port *ap);
++static int mv_slave_config(struct scsi_device *sdev);
+ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
+
+ static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
+@@ -457,7 +459,7 @@ static struct scsi_host_template mv5_sht = {
+ .use_clustering = 1,
+ .proc_name = DRV_NAME,
+ .dma_boundary = MV_DMA_BOUNDARY,
+- .slave_configure = ata_scsi_slave_config,
++ .slave_configure = mv_slave_config,
+ .slave_destroy = ata_scsi_slave_destroy,
+ .bios_param = ata_std_bios_param,
+ };
+@@ -475,7 +477,7 @@ static struct scsi_host_template mv6_sht = {
+ .use_clustering = 1,
+ .proc_name = DRV_NAME,
+ .dma_boundary = MV_DMA_BOUNDARY,
+- .slave_configure = ata_scsi_slave_config,
++ .slave_configure = mv_slave_config,
+ .slave_destroy = ata_scsi_slave_destroy,
+ .bios_param = ata_std_bios_param,
+ };
+@@ -763,6 +765,17 @@ static void mv_irq_clear(struct ata_port *ap)
+ {
+ }
+
++static int mv_slave_config(struct scsi_device *sdev)
++{
++ int rc = ata_scsi_slave_config(sdev);
++ if (rc)
++ return rc;
++
++ blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
++
++ return 0; /* scsi layer doesn't check return value, sigh */
++}
++
+ static void mv_set_edma_ptrs(void __iomem *port_mmio,
+ struct mv_host_priv *hpriv,
+ struct mv_port_priv *pp)
+@@ -1130,10 +1143,9 @@ static void mv_port_stop(struct ata_port *ap)
+ * LOCKING:
+ * Inherited from caller.
+ */
+-static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
++static void mv_fill_sg(struct ata_queued_cmd *qc)
+ {
+ struct mv_port_priv *pp = qc->ap->private_data;
+- unsigned int n_sg = 0;
+ struct scatterlist *sg;
+ struct mv_sg *mv_sg;
+
+@@ -1151,7 +1163,7 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
+
+ mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
+ mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
+- mv_sg->flags_size = cpu_to_le32(len);
++ mv_sg->flags_size = cpu_to_le32(len & 0xffff);
+
+ sg_len -= len;
+ addr += len;
+@@ -1160,12 +1172,9 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
+ mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
+
+ mv_sg++;
+- n_sg++;
+ }
+
+ }
+-
+- return n_sg;
+ }
+
+ static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
diff --git a/packages/linux/linux-ezx-2.6.23/patches/pcap-ts.patch b/packages/linux/linux-ezx-2.6.23/patches/pcap-ts.patch
new file mode 100644
index 0000000000..5891ccb837
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/pcap-ts.patch
@@ -0,0 +1,363 @@
+Index: linux-2.6.23/drivers/input/touchscreen/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/input/touchscreen/Kconfig 2007-10-10 09:38:44.000000000 +0200
++++ linux-2.6.23/drivers/input/touchscreen/Kconfig 2007-10-22 22:25:02.000000000 +0200
+@@ -238,4 +238,13 @@
+ bool "IRTOUCHSYSTEMS/UNITOP device support" if EMBEDDED
+ depends on TOUCHSCREEN_USB_COMPOSITE
+
++config TOUCHSCREEN_PCAP
++ tristate "Motorola PCAP touchscreen"
++ depends on EZX_PCAP
++ help
++ Say Y here if you have a Motorola EZX telephone and
++ want to support the built-in touchscreen.
++
++ If unsure, say N.
++
+ endif
+Index: linux-2.6.23/drivers/input/touchscreen/pcap_ts.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/input/touchscreen/pcap_ts.c 2007-10-22 22:25:02.000000000 +0200
+@@ -0,0 +1,331 @@
++/*
++ * pcap_ts.c - Touchscreen driver for Motorola PCAP2 based touchscreen as found
++ * in the EZX phone platform.
++ *
++ * Copyright (C) 2006 Harald Welte <laforge@openezx.org>
++ * Copyright (C) 2007 Daniel Ribeiro <drwyrm@gmail.com>
++ *
++ * Based on information found in the original Motorola 2.4.x ezx-ts.c driver.
++ *
++ * 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.
++ *
++ * TODO:
++ * split this in a hardirq handler and a tasklet/bh
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/fs.h>
++#include <linux/string.h>
++#include <linux/pm.h>
++#include <linux/timer.h>
++#include <linux/interrupt.h>
++#include <linux/platform_device.h>
++#include <linux/input.h>
++
++#include <asm/arch/hardware.h>
++#include <asm/arch/pxa-regs.h>
++#include <asm/arch/ezx-pcap.h>
++
++#if 0
++#define DEBUGP(x, args ...) printk(x, ## args)
++#else
++#define DEBUGP(x, args ...)
++#endif
++
++#define POSITION_X_MEASUREMENT 0
++#define POSITION_XY_MEASUREMENT 1
++#define PRESSURE_MEASUREMENT 2
++#define PLATE_X_MEASUREMENT 3
++#define PLATE_Y_MEASUREMENT 4
++#define STANDBY_MODE 5
++#define NONTS_MODE 6
++
++struct pcap_ts {
++ int irq_xy;
++ int irq_touch;
++ struct input_dev *input;
++ struct timer_list timer;
++ u_int16_t x, y;
++ u_int16_t pressure;
++ u_int8_t read_state;
++};
++
++#define X_AXIS_MIN 0
++#define X_AXIS_MAX 1023
++
++#define Y_AXIS_MAX X_AXIS_MAX
++#define Y_AXIS_MIN X_AXIS_MIN
++
++#define PRESSURE_MAX X_AXIS_MAX
++#define PRESSURE_MIN X_AXIS_MIN
++
++/* if we try to read faster, pressure reading becomes unreliable */
++#define SAMPLE_INTERVAL (HZ/50)
++
++
++static void pcap_ts_mode(struct pcap_ts *pcap_ts, u_int32_t mode)
++{
++ u_int32_t tmp;
++
++ pcap_ts->read_state = mode;
++ ezx_pcap_read(PCAP_REG_ADC1, &tmp);
++ tmp &= ~PCAP_ADC1_TS_M_MASK;
++ tmp |= ((mode << PCAP_ADC1_TS_M_SHIFT) & PCAP_ADC1_TS_M_MASK);
++ ezx_pcap_write(PCAP_REG_ADC1, tmp);
++}
++
++/* issue a XY read command to the ADC of PCAP2. Well get an ADCDONE interrupt
++ * once the result of the conversion is available */
++static void pcap_ts_start_xy_read(struct pcap_ts *pcap_ts)
++{
++ u_int32_t tmp;
++
++ ezx_pcap_read(PCAP_REG_ADC1, &tmp);
++ tmp &= ~(PCAP_BIT_ADC1_RAND | PCAP_ADC1_ADA1_MASK |
++ PCAP_ADC1_ADA2_MASK);
++ tmp |= (PCAP_BIT_ADC1_ADEN | PCAP_BIT_ADC1_AD_SEL1 |
++ PCAP_BIT_ADC1_AD_SEL2 | (5 << PCAP_ADC1_ADA1_SHIFT) |
++ (3 << PCAP_ADC1_ADA2_SHIFT));
++ ezx_pcap_write(PCAP_REG_ADC1, tmp);
++ ezx_pcap_bit_set(PCAP_BIT_ADC2_ASC, 1);
++}
++
++/* read the XY result from the ADC of PCAP2 */
++static void pcap_ts_get_xy_value(struct pcap_ts *pcap_ts)
++{
++ u_int32_t tmp;
++
++ ezx_pcap_read(PCAP_REG_ADC2, &tmp);
++
++ if (pcap_ts->read_state == POSITION_XY_MEASUREMENT) {
++ pcap_ts->x = (tmp & PCAP_ADC2_ADD1_MASK) >>
++ PCAP_ADC2_ADD1_SHIFT;
++ pcap_ts->y = (tmp & PCAP_ADC2_ADD2_MASK) >>
++ PCAP_ADC2_ADD2_SHIFT;
++ } else {
++ pcap_ts->pressure = (tmp & PCAP_ADC2_ADD2_MASK) >>
++ PCAP_ADC2_ADD2_SHIFT;
++ }
++}
++
++/* PCAP2 interrupts us when ADC conversion result is available */
++static irqreturn_t pcap_ts_irq_xy(int irq, void *dev_id)
++{
++ struct pcap_ts *pcap_ts = dev_id;
++
++ pcap_ts_get_xy_value(pcap_ts);
++ DEBUGP(KERN_DEBUG "%s X=%4d, Y=%4d Z=%4d ",
++ pcap_ts->read_state == POSITION_XY_MEASUREMENT ? "COORD" :
++ "PRESS", pcap_ts->x, pcap_ts->y, pcap_ts->pressure);
++ switch (pcap_ts->read_state) {
++ case PRESSURE_MEASUREMENT:
++ if (pcap_ts->pressure >= PRESSURE_MAX ||
++ pcap_ts->pressure <= PRESSURE_MIN ) {
++ /* pen has been released (or cant read pressure - WM)*/
++ DEBUGP("UP\n");
++ /* do nothing */
++ } else {
++ /* pen has been touched down */
++ DEBUGP("DOWN\n");
++ input_report_key(pcap_ts->input, BTN_TOUCH, 1);
++ input_report_abs(pcap_ts->input, ABS_PRESSURE, pcap_ts->pressure);
++ }
++ /* switch state machine into coordinate read mode */
++ pcap_ts_mode(pcap_ts, POSITION_XY_MEASUREMENT);
++ pcap_ts_start_xy_read(pcap_ts);
++ break;
++ case POSITION_XY_MEASUREMENT:
++ if (pcap_ts->x <= X_AXIS_MIN || pcap_ts->x >= X_AXIS_MAX ||
++ pcap_ts->y <= Y_AXIS_MIN || pcap_ts->y >= Y_AXIS_MAX) {
++ /* pen has been released */
++ DEBUGP("UP END\n");
++
++ input_report_key(pcap_ts->input, BTN_TOUCH, 0);
++ input_report_abs(pcap_ts->input, ABS_PRESSURE, 0);
++
++ /* no need for timer, we'll get interrupted with
++ * next touch down event */
++ del_timer(&pcap_ts->timer);
++
++ /* ask PCAP2 to interrupt us if touch event happens
++ * again */
++ pcap_ts_mode(pcap_ts, STANDBY_MODE);
++ enable_irq(pcap_ts->irq_touch);
++ } else {
++ DEBUGP("DOWN\n");
++ input_report_abs(pcap_ts->input, ABS_X, pcap_ts->x);
++ input_report_abs(pcap_ts->input, ABS_Y, pcap_ts->y);
++
++ /* switch back to pressure read mode */
++ pcap_ts_mode(pcap_ts, PRESSURE_MEASUREMENT);
++ mod_timer(&pcap_ts->timer, jiffies + SAMPLE_INTERVAL);
++ }
++ input_sync(pcap_ts->input);
++ break;
++ default:
++ DEBUGP("ERROR\n");
++ break;
++ }
++ return IRQ_HANDLED;
++}
++
++/* PCAP2 interrupts us if the pen touches down (interrupts also on pen up - WM)*/
++static irqreturn_t pcap_ts_irq_touch(int irq, void *dev_id)
++{
++ struct pcap_ts *pcap_ts = dev_id;
++ /* mask Touchscreen interrupt bit, prevents further touch events
++ * from being reported to us until we're finished with reading
++ * both pressure and x/y from ADC */
++ disable_irq(pcap_ts->irq_touch);
++
++ DEBUGP("touched!!\n");
++ pcap_ts_mode(pcap_ts, PRESSURE_MEASUREMENT);
++ pcap_ts_start_xy_read(pcap_ts);
++ return IRQ_HANDLED;
++}
++
++static void pcap_ts_timer_fn(unsigned long data)
++{
++ struct pcap_ts *pcap_ts = (struct pcap_ts *) data;
++
++ pcap_ts_start_xy_read(pcap_ts);
++}
++
++static int __init ezxts_probe(struct platform_device *pdev)
++{
++ struct pcap_ts *pcap_ts;
++ struct input_dev *input_dev;
++ int err = -ENOMEM;
++
++ pcap_ts = kzalloc(sizeof(*pcap_ts), GFP_KERNEL);
++ input_dev = input_allocate_device();
++ if (!pcap_ts || !input_dev)
++ goto fail;
++
++ pcap_ts->irq_xy = platform_get_irq(pdev, 0);
++ if (pcap_ts->irq_xy < 0) {
++ err = pcap_ts->irq_xy;
++ goto fail;
++ }
++
++ pcap_ts->irq_touch = platform_get_irq(pdev, 1);
++ if (pcap_ts->irq_touch < 0) {
++ err = pcap_ts->irq_touch;
++ goto fail;
++ }
++
++ ezx_pcap_bit_set(PCAP_BIT_ADC1_TS_REFENB, 0);
++ pcap_ts_mode(pcap_ts, STANDBY_MODE);
++
++ err = request_irq(pcap_ts->irq_xy, pcap_ts_irq_xy, IRQF_DISABLED,
++ "pcap-ts X/Y", pcap_ts);
++ if (err < 0) {
++ printk(KERN_ERR "pcap_ts: can't grab xy irq %d: %d\n",
++ pcap_ts->irq_xy, err);
++ goto fail;
++ }
++
++ err = request_irq(pcap_ts->irq_touch, pcap_ts_irq_touch, IRQF_DISABLED,
++ "pcap-ts touch", pcap_ts);
++ if (err < 0) {
++ printk(KERN_ERR "pcap_ts: can't grab touch irq %d: %d\n",
++ pcap_ts->irq_touch, err);
++ goto fail_xy;
++ }
++
++ pcap_ts->input = input_dev;
++ init_timer(&pcap_ts->timer);
++ pcap_ts->timer.data = (unsigned long) pcap_ts;
++ pcap_ts->timer.function = &pcap_ts_timer_fn;
++
++ platform_set_drvdata(pdev, pcap_ts);
++
++ input_dev->name = "pcap-touchscreen";
++ input_dev->phys = "ezxts/input0";
++ input_dev->id.bustype = BUS_HOST;
++ input_dev->id.vendor = 0x0001;
++ input_dev->id.product = 0x0002;
++ input_dev->id.version = 0x0100;
++ input_dev->cdev.dev = &pdev->dev;
++ input_dev->private = pcap_ts;
++
++ input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
++ input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
++ input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
++ input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
++ input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN,
++ PRESSURE_MAX, 0, 0);
++
++ input_register_device(pcap_ts->input);
++
++ return 0;
++
++fail_xy:
++ free_irq(pcap_ts->irq_xy, pcap_ts);
++fail:
++ input_free_device(input_dev);
++ kfree(pcap_ts);
++
++ return err;
++}
++
++static int ezxts_remove(struct platform_device *pdev)
++{
++ struct pcap_ts *pcap_ts = platform_get_drvdata(pdev);
++
++ del_timer_sync(&pcap_ts->timer);
++
++ free_irq(pcap_ts->irq_touch, pcap_ts);
++ free_irq(pcap_ts->irq_xy, pcap_ts);
++
++ input_unregister_device(pcap_ts->input);
++ kfree(pcap_ts);
++
++ return 0;
++}
++
++static int ezxts_suspend(struct platform_device *dev, pm_message_t state)
++{
++ ezx_pcap_bit_set(PCAP_BIT_ADC1_TS_REF_LOWPWR, 1);
++ return 0;
++}
++
++static int ezxts_resume(struct platform_device *dev)
++{
++ ezx_pcap_bit_set(PCAP_BIT_ADC1_TS_REF_LOWPWR, 0);
++ /* just in case we suspend with TSI masked. */
++// ezx_pcap_bit_set(PCAP_BIT_MSR_TSM, 0);
++ return 0;
++}
++
++
++static struct platform_driver ezxts_driver = {
++ .probe = ezxts_probe,
++ .remove = ezxts_remove,
++ .suspend = ezxts_suspend,
++ .resume = ezxts_resume,
++ .driver = {
++ .name = "pcap-ts",
++ .owner = THIS_MODULE,
++ },
++};
++
++static int __init ezxts_init(void)
++{
++ return platform_driver_register(&ezxts_driver);
++}
++
++static void __exit ezxts_exit(void)
++{
++ platform_driver_unregister(&ezxts_driver);
++}
++
++module_init(ezxts_init);
++module_exit(ezxts_exit);
++
++MODULE_DESCRIPTION("Motorola PCAP2 touchscreen driver");
++MODULE_AUTHOR("Harald Welte <laforge@openezx.org>");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/drivers/input/touchscreen/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/input/touchscreen/Makefile 2007-10-10 09:38:44.000000000 +0200
++++ linux-2.6.23/drivers/input/touchscreen/Makefile 2007-10-22 22:25:02.000000000 +0200
+@@ -18,3 +18,4 @@
+ obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
+ obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
+ obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
++obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o
diff --git a/packages/linux/linux-ezx-2.6.23/patches/pxa-kbd.patch b/packages/linux/linux-ezx-2.6.23/patches/pxa-kbd.patch
new file mode 100644
index 0000000000..a824b87a19
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/pxa-kbd.patch
@@ -0,0 +1,545 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/generic.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/generic.c 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/generic.c 2007-10-23 23:04:42.000000000 +0200
+@@ -42,6 +42,7 @@
+ #include <asm/arch/mmc.h>
+ #include <asm/arch/irda.h>
+ #include <asm/arch/i2c.h>
++#include <asm/arch/kbd.h>
+
+ #include "devices.h"
+ #include "generic.h"
+@@ -413,3 +414,28 @@
+ .name = "sa1100-rtc",
+ .id = -1,
+ };
++
++static struct resource pxa_kbd_resources[] = {
++ {
++ .start = IRQ_KEYPAD,
++ .end = IRQ_KEYPAD,
++ .flags = IORESOURCE_IRQ,
++ }, {
++ .start = 0x41500000,
++ .end = 0x4150004c,
++ .flags = IORESOURCE_MEM,
++ },
++};
++
++struct platform_device pxa_device_kbd = {
++ .name = "pxa-keyboard",
++ .id = -1,
++ .resource = pxa_kbd_resources,
++ .num_resources = ARRAY_SIZE(pxa_kbd_resources),
++};
++
++void __init pxa_set_kbd_info(struct pxakbd_platform_data *info)
++{
++ pxa_device_kbd.dev.platform_data = info;
++}
++
+Index: linux-2.6.23/drivers/input/keyboard/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/input/keyboard/Kconfig 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/drivers/input/keyboard/Kconfig 2007-10-23 23:04:42.000000000 +0200
+@@ -253,4 +253,11 @@
+ To compile this driver as a module, choose M here: the
+ module will be called gpio-keys.
+
++config KEYBOARD_PXA
++ tristate "Intel PXA keyboard support"
++ depends on ARCH_PXA
++ help
++ This add support for a driver of the Intel PXA2xx keyboard
++ controller.
++
+ endif
+Index: linux-2.6.23/drivers/input/keyboard/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/input/keyboard/Makefile 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/drivers/input/keyboard/Makefile 2007-10-23 23:04:42.000000000 +0200
+@@ -21,4 +21,4 @@
+ obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o
+ obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
+ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
+-
++obj-$(CONFIG_KEYBOARD_PXA) += pxakbd.o
+Index: linux-2.6.23/include/asm-arm/arch-pxa/kbd.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/include/asm-arm/arch-pxa/kbd.h 2007-10-23 23:04:42.000000000 +0200
+@@ -0,0 +1,28 @@
++/*
++ * kbd_pxa.h
++ *
++ * Copyright (C) 2006 Harald Welte <laforge@openezx.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.
++ *
++ */
++#ifndef _KBD_PXA_H_
++#define _KBD_PXA_H_
++
++struct pxakbd_platform_data {
++ int (*init)(void); /* init gpio, etc. */
++ unsigned int scan_interval;
++ struct {
++ unsigned int rows;
++ unsigned int cols;
++ unsigned char *keycode;
++ } matrix;
++ struct {
++ unsigned int num;
++ unsigned char *keycode;
++ } direct;
++};
++
++#endif
+Index: linux-2.6.23/drivers/input/keyboard/pxakbd.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/input/keyboard/pxakbd.c 2007-10-23 23:04:42.000000000 +0200
+@@ -0,0 +1,403 @@
++/*
++ * Driver for Motorola EZX phone "keyboard"
++ *
++ * (C) 2006 by Harald Welte <laforge@openezx.org>
++ *
++ * May, 2007 - Daniel Ribeiro <drwyrm@gmail.com>
++ * pm callbacks
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/interrupt.h>
++#include <linux/input.h>
++#include <linux/spinlock.h>
++#include <linux/platform_device.h>
++
++#include <asm/hardware.h>
++#include <asm/io.h>
++#include <asm/irq.h>
++
++#include <asm/arch/kbd.h>
++#include <asm/arch/irqs.h>
++#include <asm/arch/pxa-regs.h>
++
++#if 0
++#define DEBUGP(x, args ...) printk(x, ## args)
++#else
++#define DEBUGP(x, args ...)
++#endif
++
++/* per-keyboard private data structure */
++struct pxakbd {
++ struct input_dev *input;
++ struct timer_list timer;
++ spinlock_t lock;
++
++ struct resource *res;
++ unsigned int irq;
++ u_int32_t kpc;
++ u_int32_t kpkdi;
++
++ struct pxakbd_platform_data *pd;
++};
++
++static int pxakbd_scan_direct(struct pxakbd *pxakbd)
++{
++ u_int32_t kpdk;
++ unsigned int i;
++ int num_pressed = 0;
++
++ kpdk = KPDK & 0x000000ff;
++ for (i = 0; i < pxakbd->pd->direct.num; i++) {
++ int pressed = 0;
++
++ if (kpdk & (1 << i)) {
++ pressed = 1;
++ num_pressed++;
++ DEBUGP("pxakbd: pressed: direct %u\n", i);
++ }
++ if (pxakbd->pd->direct.keycode[i] != KEY_RESERVED) {
++ DEBUGP( "pxakbd: sending to input layer: keycode = %d, pressed = %d\n", pxakbd->pd->direct.keycode[i], pressed );
++ input_report_key(pxakbd->input, pxakbd->pd->direct.keycode[i],
++ pressed);
++ }
++ }
++ return num_pressed;
++}
++
++/* read the full 8x8 matrix from the PXA27x keypad controller */
++static inline void __read_matrix(u_int8_t *matrix)
++{
++ u_int32_t tmp;
++ u_int8_t row;
++
++ /* Fill the matrix by rows */
++
++ tmp = KPASMKP0;
++ for (row=0; row<8; row++) {
++ /* zero the matrix on the first time, then keep ORing */
++ matrix[row] = ((tmp >> row) & 1);
++ matrix[row] |= ((tmp >> (16 + row)) & 1) << 1;
++ }
++
++ tmp = KPASMKP1;
++ for (row=0; row<8; row++) {
++ matrix[row] |= ((tmp >> row) & 1) << 2;
++ matrix[row] |= ((tmp >> (16 + row)) & 1) << 3;
++ }
++
++ tmp = KPASMKP2;
++ for (row=0; row<8; row++) {
++ matrix[row] |= ((tmp >> row) & 1) << 4;
++ matrix[row] |= ((tmp >> (16 + row)) & 1) << 5;
++ }
++
++ tmp = KPASMKP3;
++ for (row=0; row<8; row++) {
++ matrix[row] |= ((tmp >> row) & 1) << 6;
++ matrix[row] |= ((tmp >> (16 + row)) & 1) << 7;
++ }
++}
++
++/* compare current matrix with last, generate 'diff' events */
++static int __cmp_matrix_gen_events(struct pxakbd *pxakbd, u_int8_t *matrix)
++{
++ unsigned int i;
++ int num_pressed = 0;
++
++ /* iterate over the matrix */
++ for (i = 0; i < pxakbd->pd->matrix.rows; i++) {
++ unsigned int j;
++ for (j = 0; j < pxakbd->pd->matrix.cols; j++) {
++ u_int32_t scancode =
++ (i * pxakbd->pd->matrix.cols) + j;
++ int pressed = matrix[i] & (1 << j);
++
++ if (pressed) {
++ DEBUGP("pxakbd: pressed: %u/%u\n", i, j);
++ num_pressed++;
++ }
++
++ input_report_key(pxakbd->input,
++ pxakbd->pd->matrix.keycode[scancode], pressed);
++ }
++ }
++
++ return num_pressed;
++}
++
++/* scan the matrix keypad */
++static int pxakbd_scan_matrix(struct pxakbd *pxakbd)
++{
++ int num_pressed;
++ u_int32_t kpas;
++ u_int8_t matrix[8];
++
++ kpas = KPAS;
++
++ if ((kpas & KPAS_MUKP) == KPAS_MUKP_NONE) {
++ /* no keys pressed */
++ memset(matrix, 0, sizeof(matrix));
++ } else if ((kpas & KPAS_MUKP) == KPAS_MUKP_ONE) {
++ /* one key pressed */
++ u_int8_t row = (kpas & KPAS_RP) >> 4;
++ u_int8_t col = kpas & KPAS_CP;
++
++ if (row == 0x0f || col == 0x0f) {
++ printk(KERN_WARNING "pxakbd: col or row invalid!\n");
++ return -1;
++ }
++
++ /* clear the matrix and set the single pressed key */
++ memset(matrix, 0, sizeof(matrix));
++ matrix[row] |= (1 << col);
++ } else {
++ /* multiple keys pressed */
++ __read_matrix(matrix);
++ }
++
++ num_pressed = __cmp_matrix_gen_events(pxakbd, matrix);
++
++ return num_pressed;
++}
++
++static void pxakbd_timer_callback(unsigned long data)
++{
++ unsigned long flags;
++ struct pxakbd *pxakbd = (struct pxakbd *) data;
++ unsigned int num_pressed;
++
++ spin_lock_irqsave(&pxakbd->lock, flags);
++
++ num_pressed = pxakbd_scan_direct(pxakbd);
++ num_pressed += pxakbd_scan_matrix(pxakbd);
++
++ spin_unlock_irqrestore(&pxakbd->lock, flags);
++
++ /* propagate events up the input stack */
++ input_sync(pxakbd->input);
++}
++
++static irqreturn_t pxakbd_interrupt(int irq, void *dummy)
++{
++ struct pxakbd *pxakbd = dummy;
++ u_int32_t kpc;
++ int handled = 0;
++ int num_pressed = 0;
++
++ /* read and clear interrupt */
++ kpc = KPC;
++
++ if (kpc & KPC_DI) {
++ num_pressed += pxakbd_scan_direct(pxakbd);
++ handled = 1;
++ }
++
++ if (kpc & KPC_MI) {
++ while (KPAS & KPAS_SO) {
++ /* wait for scan to complete beforereading scan regs */
++ cpu_relax();
++ }
++ num_pressed += pxakbd_scan_matrix(pxakbd);
++ handled = 1;
++ }
++
++ /* If any keys are currently pressed, we need to start the timer to detect
++ * key release. */
++ if (num_pressed)
++ mod_timer(&pxakbd->timer, jiffies + pxakbd->pd->scan_interval);
++
++ /* propagate events up the input stack */
++ input_sync(pxakbd->input);
++
++ return IRQ_RETVAL(handled);
++}
++
++static int __init pxakbd_probe(struct platform_device *pdev)
++{
++ struct pxakbd *pxakbd;
++ struct input_dev *input_dev;
++ struct resource *r;
++ int i;
++ int ret = -ENOMEM;
++
++ int rows, cols, n_direct;
++
++ if (!pdev->dev.platform_data) {
++ printk(KERN_ERR "pxakbd: platform data not set\n");
++ ret = -ENODEV;
++ goto out;
++ }
++
++ pxakbd = kzalloc(sizeof(*pxakbd), GFP_KERNEL);
++ if (!pxakbd)
++ goto out;
++
++ input_dev = input_allocate_device();
++ if (!input_dev)
++ goto out_pxa;
++
++ spin_lock_init(&pxakbd->lock);
++ pxakbd->irq = platform_get_irq(pdev, 0);
++ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (!r || pxakbd->irq == NO_IRQ) {
++ printk(KERN_ERR "pxakbd: invalid resources\n");
++ ret = -EBUSY;
++ goto out_idev;
++ }
++
++ pxakbd->input = input_dev;
++ init_timer(&pxakbd->timer);
++ pxakbd->timer.function = pxakbd_timer_callback;
++ pxakbd->timer.data = (unsigned long) pxakbd;
++ pxakbd->pd = pdev->dev.platform_data;
++ pxakbd->res = r;
++
++ rows = pxakbd->pd->matrix.rows;
++ cols = pxakbd->pd->matrix.cols;
++ n_direct = pxakbd->pd->direct.num;
++
++ input_dev->name = "pxa-keyboard";
++ input_dev->phys = "pxakbd/input0";
++ input_dev->id.bustype = BUS_HOST;
++ input_dev->id.vendor = 0x0001;
++ input_dev->id.product = 0x0001;
++ input_dev->id.version = 0x0001;
++ input_dev->cdev.dev = &pdev->dev;
++ input_dev->private = pxakbd;
++
++ input_dev->evbit[0] = BIT(EV_KEY)|BIT(EV_REP);
++
++ input_dev->keycodesize = sizeof(unsigned char);
++ input_dev->keycodemax = (rows*cols)+n_direct;
++ input_dev->keycode = kmalloc(input_dev->keycodemax*input_dev->keycodesize,
++ GFP_KERNEL);
++ if (!input_dev->keycode){
++ ret = -ENOMEM;
++ goto out_idev;
++ }
++
++ memcpy(input_dev->keycode, pxakbd->pd->matrix.keycode, rows*cols);
++
++ memcpy(input_dev->keycode+(rows*cols),
++ pxakbd->pd->direct.keycode,
++ n_direct);
++
++ for (i = 0; i < rows*cols; i++)
++ set_bit(pxakbd->pd->matrix.keycode[i], input_dev->keybit);
++
++ for (i = 0; i < n_direct; i++)
++ set_bit(pxakbd->pd->direct.keycode[i], input_dev->keybit);
++
++ clear_bit(0, input_dev->keybit);
++
++ if (request_irq(pxakbd->irq, pxakbd_interrupt, 0, "pxakbd", pxakbd)) {
++ printk(KERN_ERR "pxakbd: can't request irq %d\n", pxakbd->irq);
++ ret = -EBUSY;
++ goto out_idev;
++ }
++
++ r = request_mem_region(r->start, 0x4c, "pxakbd");
++ if (!r) {
++ printk(KERN_ERR "pxakbd: can't request memregion\n");
++ ret = -EBUSY;
++ goto out_irq;
++ }
++
++ /* set up gpio */
++ pxakbd->pd->init();
++
++ /* set keypad control register */
++ KPC = (KPC_ASACT | /* automatic scan on activity */
++ KPC_ME | KPC_DE | /* matrix and direct keypad enabled */
++ ((pxakbd->pd->matrix.cols-1)<<23) | /* columns */
++ ((pxakbd->pd->matrix.rows-1)<<26) | /* rows */
++ ((pxakbd->pd->direct.num-1)<<6) | /* direct keys */
++ KPC_MS_ALL); /* scan all columns */
++
++ pxa_set_cken(CKEN_KEYPAD, 1);
++
++ KPC |= (KPC_DIE | KPC_MIE); /* enable matrix and direct keyboard */
++
++ KPKDI = 0x40; /* matrix key debounce interval: 0x40 */
++
++ platform_set_drvdata(pdev, pxakbd);
++
++ return input_register_device(pxakbd->input);
++
++out_drvdata:
++ platform_set_drvdata(pdev, NULL);
++out_mem:
++ release_resource(r);
++out_irq:
++ free_irq(pxakbd->irq, pxakbd);
++out_idev:
++ kfree(input_dev->keycode);
++ input_free_device(input_dev);
++out_pxa:
++ kfree(pxakbd);
++out:
++ return ret;
++}
++
++static int pxakbd_remove(struct platform_device *pdev)
++{
++ struct pxakbd *pxakbd = platform_get_drvdata(pdev);
++
++ kfree(pxakbd->input->keycode);
++ input_unregister_device(pxakbd->input);
++ platform_set_drvdata(pdev, NULL);
++ release_resource(pxakbd->res);
++ free_irq(pxakbd->irq, pxakbd);
++ kfree(pxakbd);
++
++ return 0;
++}
++
++static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct pxakbd *pxakbd = platform_get_drvdata(pdev);
++
++ pxakbd->kpc = KPC;
++ pxakbd->kpkdi = KPKDI;
++
++ return 0;
++}
++
++static int pxakbd_resume(struct platform_device *pdev)
++{
++ struct pxakbd *pxakbd = platform_get_drvdata(pdev);
++
++ KPC = pxakbd->kpc;
++ KPKDI = pxakbd->kpkdi;
++
++ return 0;
++}
++
++static struct platform_driver pxakbd_driver = {
++ .probe = &pxakbd_probe,
++ .remove = &pxakbd_remove,
++ .suspend = &pxakbd_suspend,
++ .resume = &pxakbd_resume,
++ .driver = {
++ .name = "pxa-keyboard",
++ },
++};
++
++static int __devinit pxakbd_init(void)
++{
++ return platform_driver_register(&pxakbd_driver);
++}
++
++static void __exit pxakbd_exit(void)
++{
++ platform_driver_unregister(&pxakbd_driver);
++}
++
++module_init(pxakbd_init);
++module_exit(pxakbd_exit);
++
++MODULE_AUTHOR("Harald Welte <laforge@openezx.org>");
++MODULE_DESCRIPTION("Driver for Intel PXA27x keypad controller");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-23 23:04:42.000000000 +0200
+@@ -2256,6 +2256,11 @@
+ #define KPMK_MKP (0x1 << 31)
+ #define KPAS_SO (0x1 << 31)
+ #define KPASMKPx_SO (0x1 << 31)
++#define KPAS_RP (0x000000f0)
++#define KPAS_CP (0x0000000f)
++#define KPAS_MUKP (0x7c000000)
++#define KPAS_MUKP_ONE (0x04000000)
++#define KPAS_MUKP_NONE (0x00000000)
+
+ /*
+ * UHC: USB Host Controller (OHCI-like) register definitions
+Index: linux-2.6.23/arch/arm/mach-pxa/pxa27x.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/pxa27x.c 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/pxa27x.c 2007-10-23 23:04:42.000000000 +0200
+@@ -349,6 +349,7 @@
+ &pxa_device_rtc,
+ &pxa27x_device_i2c_power,
+ &pxa27x_device_ohci,
++ &pxa_device_kbd,
+ };
+
+ void __init pxa27x_init_irq(void)
+Index: linux-2.6.23/arch/arm/mach-pxa/devices.h
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/devices.h 2007-10-23 23:04:39.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/devices.h 2007-10-23 23:04:42.000000000 +0200
+@@ -9,3 +9,4 @@
+ extern struct platform_device pxa_device_i2s;
+ extern struct platform_device pxa_device_ficp;
+ extern struct platform_device pxa_device_rtc;
++extern struct platform_device pxa_device_kbd;
diff --git a/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-fix-a1200.patch b/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-fix-a1200.patch
new file mode 100644
index 0000000000..7ea9f18d0a
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-fix-a1200.patch
@@ -0,0 +1,45 @@
+This hack hardcodes pxa27x-udc to ether_gadget. This is just a temp workaround.
+Index: linux-2.6.23/drivers/usb/gadget/ether.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/ether.c 2007-10-23 12:58:40.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/ether.c 2007-10-23 12:58:46.000000000 +0200
+@@ -2709,10 +2709,16 @@
+ MODULE_LICENSE ("GPL");
+
+
+-static int __init init (void)
++// Alex add FIXME
++int usb_ether_init (void)
+ {
+ return usb_gadget_register_driver (&eth_driver);
+ }
++
++static int __init init (void)
++{
++// return usb_gadget_register_driver (&eth_driver);
++}
+ module_init (init);
+
+ static void __exit cleanup (void)
+Index: linux-2.6.23/drivers/usb/gadget/pxa27x_udc.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/pxa27x_udc.c 2007-10-23 12:58:40.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/pxa27x_udc.c 2007-10-23 13:01:47.000000000 +0200
+@@ -65,6 +65,8 @@
+ //#include <asm/arch/udc.h>
+ #include <asm/mach/udc_pxa2xx.h>
+
++extern int usb_ether_init(void);
++
+ /*
+ * This driver handles the USB Device Controller (UDC) in Intel's PXA 27x
+ * series processors.
+@@ -2275,6 +2277,8 @@
+ udc_init_ep(udc);
+ udc_reinit(udc);
+
++ usb_ether_init(); // Alex add FIXME
++
+ /* irq setup after old hardware state is cleaned up */
+ retval = request_irq(irq, pxa27x_udc_irq, 0, driver_name, udc);
+ if (retval != 0) {
diff --git a/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-support.3.patch b/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-support.3.patch
new file mode 100644
index 0000000000..21482fdc8f
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/pxa27x-udc-support.3.patch
@@ -0,0 +1,3113 @@
+Index: linux-2.6.23/arch/arm/mach-pxa/generic.c
+===================================================================
+--- linux-2.6.23.orig/arch/arm/mach-pxa/generic.c 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/arch/arm/mach-pxa/generic.c 2007-10-23 12:48:34.000000000 +0200
+@@ -283,7 +283,11 @@
+ static u64 udc_dma_mask = ~(u32)0;
+
+ struct platform_device pxa_device_udc = {
++#ifdef CONFIG_PXA27x
++ .name = "pxa27x-udc",
++#else
+ .name = "pxa2xx-udc",
++#endif
+ .id = -1,
+ .resource = pxa2xx_udc_resources,
+ .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
+Index: linux-2.6.23/drivers/usb/gadget/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/Kconfig 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/Kconfig 2007-10-23 12:48:34.000000000 +0200
+@@ -167,6 +167,24 @@
+ default USB_GADGET
+ select USB_GADGET_SELECTED
+
++config USB_GADGET_PXA27X
++ boolean "PXA 27x"
++ depends on ARCH_PXA && PXA27x
++ help
++ Intel's PXA 27x series XScale processors include an integrated
++ full speed USB 1.1 device controller.
++
++ Say "y" to link the driver statically, or "m" to build a
++ dynamically linked module called "pxa2xx_udc" and force all
++ gadget drivers to also be dynamically linked.
++
++
++config USB_PXA27X
++ tristate
++ depends on USB_GADGET_PXA27X
++ default USB_GADGET
++ select USB_GADGET_SELECTED
++
+ # if there's only one gadget driver, using only two bulk endpoints,
+ # don't waste memory for the other endpoints
+ config USB_PXA2XX_SMALL
+Index: linux-2.6.23/drivers/usb/gadget/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/Makefile 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/Makefile 2007-10-23 12:48:34.000000000 +0200
+@@ -9,6 +9,7 @@
+ obj-$(CONFIG_USB_NET2280) += net2280.o
+ obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o
+ obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o
++obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o
+ obj-$(CONFIG_USB_GOKU) += goku_udc.o
+ obj-$(CONFIG_USB_OMAP) += omap_udc.o
+ obj-$(CONFIG_USB_LH7A40X) += lh7a40x_udc.o
+Index: linux-2.6.23/drivers/usb/gadget/epautoconf.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/epautoconf.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/epautoconf.c 2007-10-23 12:48:34.000000000 +0200
+@@ -230,7 +230,8 @@
+ */
+ struct usb_ep * __devinit usb_ep_autoconfig (
+ struct usb_gadget *gadget,
+- struct usb_endpoint_descriptor *desc
++ struct usb_endpoint_descriptor *desc,
++ int config, int interface, int alt
+ )
+ {
+ struct usb_ep *ep;
+@@ -238,6 +239,11 @@
+
+ type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+
++ /* If have ep_alloc() function use it! */
++ if (gadget->ops->ep_alloc)
++ return gadget->ops->ep_alloc(gadget, desc,
++ config, interface, alt);
++
+ /* First, apply chip-specific "best usage" knowledge.
+ * This might make a good usb_gadget_ops hook ...
+ */
+Index: linux-2.6.23/drivers/usb/gadget/ether.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/ether.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/ether.c 2007-10-23 12:48:34.000000000 +0200
+@@ -257,10 +257,6 @@
+ #define DEV_CONFIG_CDC
+ #endif
+
+-#ifdef CONFIG_USB_GADGET_PXA27X
+-#define DEV_CONFIG_CDC
+-#endif
+-
+ #ifdef CONFIG_USB_GADGET_S3C2410
+ #define DEV_CONFIG_CDC
+ #endif
+@@ -292,6 +288,10 @@
+ #define DEV_CONFIG_SUBSET
+ #endif
+
++#ifdef CONFIG_USB_GADGET_PXA27X
++#define DEV_CONFIG_SUBSET
++#endif
++
+ #ifdef CONFIG_USB_GADGET_SUPERH
+ #define DEV_CONFIG_SUBSET
+ #endif
+@@ -1042,13 +1042,12 @@
+ static int
+ set_ether_config (struct eth_dev *dev, gfp_t gfp_flags)
+ {
+- int result = 0;
+- struct usb_gadget *gadget = dev->gadget;
++ int result = 0;
+
+ #if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS)
+ /* status endpoint used for RNDIS and (optionally) CDC */
+ if (!subset_active(dev) && dev->status_ep) {
+- dev->status = ep_desc (gadget, &hs_status_desc,
++ dev->status = ep_desc (dev->gadget, &hs_status_desc,
+ &fs_status_desc);
+ dev->status_ep->driver_data = dev;
+
+@@ -1061,10 +1060,10 @@
+ }
+ #endif
+
+- dev->in = ep_desc(gadget, &hs_source_desc, &fs_source_desc);
++ dev->in = ep_desc(dev->gadget, &hs_source_desc, &fs_source_desc);
+ dev->in_ep->driver_data = dev;
+
+- dev->out = ep_desc(gadget, &hs_sink_desc, &fs_sink_desc);
++ dev->out = ep_desc(dev->gadget, &hs_sink_desc, &fs_sink_desc);
+ dev->out_ep->driver_data = dev;
+
+ /* With CDC, the host isn't allowed to use these two data
+@@ -2320,6 +2319,9 @@
+ * non-CDC to be compatible with ARM Linux-2.4 "usb-eth".
+ */
+ cdc = 0;
++ } else if (gadget_is_pxa27x(gadget)) {
++ /* hardware can't write zlps */
++ zlp = 0;
+ }
+
+ gcnum = usb_gadget_controller_number (gadget);
+@@ -2386,7 +2388,22 @@
+
+ /* all we really need is bulk IN/OUT */
+ usb_ep_autoconfig_reset (gadget);
+- in_ep = usb_ep_autoconfig (gadget, &fs_source_desc);
++#ifdef CONFIG_USB_ETH_RNDIS
++ in_ep = usb_ep_autoconfig (gadget, &fs_source_desc,
++ DEV_RNDIS_CONFIG_VALUE,
++ (int)rndis_data_intf.bInterfaceNumber,
++ (int)rndis_data_intf.bAlternateSetting);
++#elif defined(DEV_CONFIG_CDC)
++ in_ep = usb_ep_autoconfig (gadget, &fs_source_desc,
++ DEV_CONFIG_VALUE,
++ (int)data_intf.bInterfaceNumber,
++ (int)data_intf.bAlternateSetting);
++#elif defined(DEV_CONFIG_SUBSET)
++ in_ep = usb_ep_autoconfig (gadget, &fs_source_desc,
++ DEV_CONFIG_VALUE,
++ (int)subset_data_intf.bInterfaceNumber,
++ (int)subset_data_intf.bAlternateSetting);
++#endif /* CONFIG_USB_ETH_RNDIS */
+ if (!in_ep) {
+ autoconf_fail:
+ dev_err (&gadget->dev,
+@@ -2395,8 +2412,24 @@
+ return -ENODEV;
+ }
+ in_ep->driver_data = in_ep; /* claim */
++
++#ifdef CONFIG_USB_ETH_RNDIS
++ out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc,
++ DEV_RNDIS_CONFIG_VALUE,
++ (int)rndis_data_intf.bInterfaceNumber,
++ (int)rndis_data_intf.bAlternateSetting);
++#elif defined(DEV_CONFIG_CDC)
++ out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc,
++ DEV_CONFIG_VALUE,
++ (int)data_intf.bInterfaceNumber,
++ (int)data_intf.bAlternateSetting);
++#elif defined(DEV_CONFIG_SUBSET)
++ out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc,
++ DEV_CONFIG_VALUE,
++ (int)subset_data_intf.bInterfaceNumber,
++ (int)subset_data_intf.bAlternateSetting);
++#endif /* CONFIG_USB_ETH_RNDIS */
+
+- out_ep = usb_ep_autoconfig (gadget, &fs_sink_desc);
+ if (!out_ep)
+ goto autoconf_fail;
+ out_ep->driver_data = out_ep; /* claim */
+@@ -2406,7 +2439,18 @@
+ * Since some hosts expect one, try to allocate one anyway.
+ */
+ if (cdc || rndis) {
+- status_ep = usb_ep_autoconfig (gadget, &fs_status_desc);
++#ifdef CONFIG_USB_ETH_RNDIS
++ status_ep = usb_ep_autoconfig (gadget, &fs_status_desc,
++ DEV_RNDIS_CONFIG_VALUE,
++ (int)rndis_control_intf.bInterfaceNumber,
++ (int)rndis_control_intf.bAlternateSetting);
++#elif defined(DEV_CONFIG_CDC)
++ status_ep = usb_ep_autoconfig (gadget, &fs_status_desc,
++ DEV_CONFIG_VALUE,
++ (int)control_intf.bInterfaceNumber,
++ (int)control_intf.bAlternateSetting);
++#endif /* CONFIG_USB_ETH_RNDIS */
++
+ if (status_ep) {
+ status_ep->driver_data = status_ep; /* claim */
+ } else if (rndis) {
+@@ -2414,13 +2458,14 @@
+ "can't run RNDIS on %s\n",
+ gadget->name);
+ return -ENODEV;
++ }
+ #ifdef DEV_CONFIG_CDC
+- /* pxa25x only does CDC subset; often used with RNDIS */
+- } else if (cdc) {
++ /* pxa25x only does CDC subset; often used with RNDIS */
++ else if (cdc) {
+ control_intf.bNumEndpoints = 0;
+ /* FIXME remove endpoint from descriptor list */
+-#endif
+ }
++#endif
+ }
+ #endif
+
+Index: linux-2.6.23/drivers/usb/gadget/file_storage.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/file_storage.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/file_storage.c 2007-10-23 12:48:34.000000000 +0200
+@@ -3912,20 +3912,20 @@
+
+ /* Find all the endpoints we will use */
+ usb_ep_autoconfig_reset(gadget);
+- ep = usb_ep_autoconfig(gadget, &fs_bulk_in_desc);
++ ep = usb_ep_autoconfig(gadget, &fs_bulk_in_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ ep->driver_data = fsg; // claim the endpoint
+ fsg->bulk_in = ep;
+
+- ep = usb_ep_autoconfig(gadget, &fs_bulk_out_desc);
++ ep = usb_ep_autoconfig(gadget, &fs_bulk_out_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ ep->driver_data = fsg; // claim the endpoint
+ fsg->bulk_out = ep;
+
+ if (transport_is_cbi()) {
+- ep = usb_ep_autoconfig(gadget, &fs_intr_in_desc);
++ ep = usb_ep_autoconfig(gadget, &fs_intr_in_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ ep->driver_data = fsg; // claim the endpoint
+Index: linux-2.6.23/drivers/usb/gadget/gmidi.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/gmidi.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/gmidi.c 2007-10-23 12:48:34.000000000 +0200
+@@ -1204,7 +1204,7 @@
+ * but there may also be important quirks to address.
+ */
+ usb_ep_autoconfig_reset(gadget);
+- in_ep = usb_ep_autoconfig(gadget, &bulk_in_desc);
++ in_ep = usb_ep_autoconfig(gadget, &bulk_in_desc, 0, 0, 0);
+ if (!in_ep) {
+ autoconf_fail:
+ printk(KERN_ERR "%s: can't autoconfigure on %s\n",
+@@ -1214,7 +1214,7 @@
+ EP_IN_NAME = in_ep->name;
+ in_ep->driver_data = in_ep; /* claim */
+
+- out_ep = usb_ep_autoconfig(gadget, &bulk_out_desc);
++ out_ep = usb_ep_autoconfig(gadget, &bulk_out_desc, 0, 0, 0);
+ if (!out_ep) {
+ goto autoconf_fail;
+ }
+Index: linux-2.6.23/drivers/usb/gadget/pxa27x_udc.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/usb/gadget/pxa27x_udc.c 2007-10-23 12:48:34.000000000 +0200
+@@ -0,0 +1,2408 @@
++/*
++ * linux/drivers/usb/gadget/pxa27x_udc.c
++ * Intel PXA2xx and IXP4xx on-chip full speed USB device controllers
++ *
++ * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker)
++ * Copyright (C) 2003 Robert Schwebel, Pengutronix
++ * Copyright (C) 2003 Benedikt Spranger, Pengutronix
++ * Copyright (C) 2003 David Brownell
++ * Copyright (C) 2003 Joshua Wise
++ * Copyright (C) 2004 Intel Corporation
++ * Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
++ *
++ * 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
++ *
++ */
++
++#undef DEBUG
++/* #define VERBOSE DBG_VERBOSE */
++
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/ioport.h>
++#include <linux/types.h>
++#include <linux/version.h>
++#include <linux/errno.h>
++#include <linux/delay.h>
++#include <linux/sched.h>
++#include <linux/slab.h>
++#include <linux/init.h>
++#include <linux/timer.h>
++#include <linux/list.h>
++#include <linux/interrupt.h>
++#include <linux/proc_fs.h>
++#include <linux/mm.h>
++#include <linux/device.h>
++#include <linux/dma-mapping.h>
++#include <linux/platform_device.h>
++
++#include <asm/byteorder.h>
++#include <asm/dma.h>
++#include <asm/gpio.h>
++#include <asm/io.h>
++#include <asm/irq.h>
++#include <asm/system.h>
++#include <asm/mach-types.h>
++#include <asm/unaligned.h>
++#include <asm/hardware.h>
++//#include <asm/arch/pxa-regs.h>
++
++#include <linux/usb/ch9.h>
++#include <linux/usb_gadget.h>
++
++//#include <asm/arch/udc.h>
++#include <asm/mach/udc_pxa2xx.h>
++
++/*
++ * This driver handles the USB Device Controller (UDC) in Intel's PXA 27x
++ * series processors.
++ * Such controller drivers work with a gadget driver. The gadget driver
++ * returns descriptors, implements configuration and data protocols used
++ * by the host to interact with this device, and allocates endpoints to
++ * the different protocol interfaces. The controller driver virtualizes
++ * usb hardware so that the gadget drivers will be more portable.
++ *
++ * This UDC hardware wants to implement a bit too much USB protocol, so
++ * it constrains the sorts of USB configuration change events that work.
++ * The errata for these chips are misleading; some "fixed" bugs from
++ * pxa250 a0/a1 b0/b1/b2 sure act like they're still there.
++ */
++
++#define DRIVER_VERSION "28-Jun-2007"
++#define DRIVER_DESC "PXA 27x USB Device Controller driver"
++
++static const char driver_name[] = "pxa27x_udc";
++
++static const char ep0name[] = "ep0";
++
++#undef USE_DMA
++#undef DISABLE_TEST_MODE
++
++#ifdef CONFIG_PROC_FS
++#define UDC_PROC_FILE
++#endif
++
++#include "pxa27x_udc.h"
++
++#ifdef CONFIG_EMBEDDED
++/* few strings, and little code to use them */
++#undef DEBUG
++#undef UDC_PROC_FILE
++#endif
++
++#ifdef USE_DMA
++static int use_dma = 1;
++module_param(use_dma, bool, 0);
++MODULE_PARM_DESC(use_dma, "true to use dma");
++
++static void dma_nodesc_handler(int dmach, void *_ep);
++static void kick_dma(struct pxa27x_ep *ep, struct pxa27x_request *req);
++
++#define DMASTR " (dma support)"
++
++#else /* !USE_DMA */
++#define DMASTR " (pio only)"
++#endif
++
++#ifdef CONFIG_USB_PXA27X_SMALL
++#define SIZE_STR " (small)"
++#else
++#define SIZE_STR ""
++#endif
++
++#ifdef DISABLE_TEST_MODE
++/* (mode == 0) == no undocumented chip tweaks
++ * (mode & 1) == double buffer bulk IN
++ * (mode & 2) == double buffer bulk OUT
++ * ... so mode = 3 (or 7, 15, etc) does it for both
++ */
++static ushort fifo_mode = 0;
++module_param(fifo_mode, ushort, 0);
++MODULE_PARM_DESC(fifo_mode, "pxa27x udc fifo mode");
++#endif
++
++#define UDCISR0_IR0 0x3
++#define UDCISR_INT_MASK (UDC_INT_FIFOERROR | UDC_INT_PACKETCMP)
++#define UDCICR_INT_MASK UDCISR_INT_MASK
++
++#define UDCCSR_MASK (UDCCSR_FST | UDCCSR_DME)
++/* ---------------------------------------------------------------------------
++ * endpoint related parts of the api to the usb controller hardware,
++ * used by gadget driver; and the inner talker-to-hardware core.
++ * ---------------------------------------------------------------------------
++ */
++
++static void pxa27x_ep_fifo_flush(struct usb_ep *ep);
++static void nuke(struct pxa27x_ep *, int status);
++
++/* one GPIO should control a D+ pullup, so host sees this device (or not) */
++static void pullup_off(void)
++{
++ struct pxa2xx_udc_mach_info *mach = the_controller->mach;
++
++ if (mach->gpio_pullup)
++ gpio_set_value(mach->gpio_pullup, 0);
++ else if (mach->udc_command)
++ mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
++}
++
++static void pullup_on(void)
++{
++ struct pxa2xx_udc_mach_info *mach = the_controller->mach;
++
++ if (mach->gpio_pullup)
++ gpio_set_value(mach->gpio_pullup, 1);
++ else if (mach->udc_command)
++ mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
++}
++
++static void pio_irq_enable(int ep_num)
++{
++ if (ep_num < 16)
++ UDCICR0 |= 3 << (ep_num * 2);
++ else {
++ ep_num -= 16;
++ UDCICR1 |= 3 << (ep_num * 2);
++ }
++}
++
++static void pio_irq_disable(int ep_num)
++{
++ ep_num &= 0xf;
++ if (ep_num < 16)
++ UDCICR0 &= ~(3 << (ep_num * 2));
++ else {
++ ep_num -= 16;
++ UDCICR1 &= ~(3 << (ep_num * 2));
++ }
++}
++
++/* The UDCCR reg contains mask and interrupt status bits,
++ * so using '|=' isn't safe as it may ack an interrupt.
++ */
++#define UDCCR_MASK_BITS (UDCCR_OEN | UDCCR_UDE)
++
++static inline void udc_set_mask_UDCCR(int mask)
++{
++ UDCCR = (UDCCR & UDCCR_MASK_BITS) | (mask & UDCCR_MASK_BITS);
++}
++
++static inline void udc_clear_mask_UDCCR(int mask)
++{
++ UDCCR = (UDCCR & UDCCR_MASK_BITS) & ~(mask & UDCCR_MASK_BITS);
++}
++
++static inline void udc_ack_int_UDCCR(int mask)
++{
++ /* udccr contains the bits we dont want to change */
++ __u32 udccr = UDCCR & UDCCR_MASK_BITS;
++
++ UDCCR = udccr | (mask & ~UDCCR_MASK_BITS);
++}
++
++/*
++ * endpoint enable/disable
++ *
++ * we need to verify the descriptors used to enable endpoints. since pxa27x
++ * endpoint configurations are fixed, and are pretty much always enabled,
++ * there's not a lot to manage here.
++ *
++ * because pxa27x can't selectively initialize bulk (or interrupt) endpoints,
++ * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except
++ * for a single interface (with only the default altsetting) and for gadget
++ * drivers that don't halt endpoints (not reset by set_interface). that also
++ * means that if you use ISO, you must violate the USB spec rule that all
++ * iso endpoints must be in non-default altsettings.
++ */
++static int pxa27x_ep_enable(struct usb_ep *_ep,
++ const struct usb_endpoint_descriptor *desc)
++{
++ struct pxa27x_ep *ep;
++ struct pxa27x_udc *dev;
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (!_ep || !desc || _ep->name == ep0name
++ || desc->bDescriptorType != USB_DT_ENDPOINT
++ || ep->fifo_size < le16_to_cpu(desc->wMaxPacketSize)) {
++ DMSG("%s, bad ep or descriptor\n", __FUNCTION__);
++ return -EINVAL;
++ }
++
++ /* xfer types must match, except that interrupt ~= bulk */
++ if (ep->ep_type != USB_ENDPOINT_XFER_BULK
++ && desc->bmAttributes != USB_ENDPOINT_XFER_INT) {
++ DMSG("%s, %s type mismatch\n", __FUNCTION__, _ep->name);
++ return -EINVAL;
++ }
++
++ /* hardware _could_ do smaller, but driver doesn't */
++ if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
++ && le16_to_cpu(desc->wMaxPacketSize)
++ != BULK_FIFO_SIZE)
++ || !desc->wMaxPacketSize) {
++ DMSG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name);
++ return -ERANGE;
++ }
++
++ dev = ep->dev;
++ if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) {
++ DMSG("%s, bogus device state\n", __FUNCTION__);
++ return -ESHUTDOWN;
++ }
++
++ ep->desc = desc;
++ ep->dma = -1;
++ ep->stopped = 0;
++ ep->pio_irqs = ep->dma_irqs = 0;
++ ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize);
++
++ /* flush fifo (mostly for OUT buffers) */
++ pxa27x_ep_fifo_flush(_ep);
++
++ /* ... reset halt state too, if we could ... */
++
++#ifdef USE_DMA
++ /* for (some) bulk and ISO endpoints, try to get a DMA channel and
++ * bind it to the endpoint. otherwise use PIO.
++ */
++ DMSG("%s: called attributes=%d\n", __FUNCTION__, ep->ep_type);
++ switch (ep->ep_type) {
++ case USB_ENDPOINT_XFER_ISOC:
++ if (le16_to_cpu(desc->wMaxPacketSize) % 32)
++ break;
++ /* fall through */
++ case USB_ENDPOINT_XFER_BULK:
++ if (!use_dma || !ep->reg_drcmr)
++ break;
++ ep->dma = pxa_request_dma((char *)_ep->name,
++ (le16_to_cpu(desc->wMaxPacketSize) > 64)
++ ? DMA_PRIO_MEDIUM /* some iso */
++ : DMA_PRIO_LOW,
++ dma_nodesc_handler, ep);
++ if (ep->dma >= 0) {
++ *ep->reg_drcmr = DRCMR_MAPVLD | ep->dma;
++ DMSG("%s using dma%d\n", _ep->name, ep->dma);
++ }
++ default:
++ break;
++ }
++#endif
++ DBG(DBG_VERBOSE, "enabled %s\n", _ep->name);
++ return 0;
++}
++
++static int pxa27x_ep_disable(struct usb_ep *_ep)
++{
++ struct pxa27x_ep *ep;
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (!_ep || !ep->desc) {
++ DMSG("%s, %s not enabled\n", __FUNCTION__,
++ _ep ? ep->ep.name : NULL);
++ return -EINVAL;
++ }
++ nuke(ep, -ESHUTDOWN);
++
++#ifdef USE_DMA
++ if (ep->dma >= 0) {
++ *ep->reg_drcmr = 0;
++ pxa_free_dma(ep->dma);
++ ep->dma = -1;
++ }
++#endif
++
++ /* flush fifo (mostly for IN buffers) */
++ pxa27x_ep_fifo_flush(_ep);
++
++ ep->desc = 0;
++ ep->stopped = 1;
++
++ DBG(DBG_VERBOSE, "%s disabled\n", _ep->name);
++ return 0;
++}
++
++/*-------------------------------------------------------------------------*/
++
++/* for the pxa27x, these can just wrap kmalloc/kfree. gadget drivers
++ * must still pass correctly initialized endpoints, since other controller
++ * drivers may care about how it's currently set up (dma issues etc).
++ */
++
++/*
++ * pxa27x_ep_alloc_request - allocate a request data structure
++ */
++static struct usb_request *pxa27x_ep_alloc_request(struct usb_ep *_ep,
++ unsigned int gfp_flags)
++{
++ struct pxa27x_request *req;
++
++ req = kmalloc(sizeof *req, gfp_flags);
++ if (!req)
++ return 0;
++
++ memset(req, 0, sizeof *req);
++ INIT_LIST_HEAD(&req->queue);
++ return &req->req;
++}
++
++/*
++ * pxa27x_ep_free_request - deallocate a request data structure
++ */
++static void pxa27x_ep_free_request(struct usb_ep *_ep, struct usb_request *_req)
++{
++ struct pxa27x_request *req;
++
++ req = container_of(_req, struct pxa27x_request, req);
++ WARN_ON(!list_empty(&req->queue));
++ kfree(req);
++}
++
++/* PXA cache needs flushing with DMA I/O (it's dma-incoherent), but there's
++ * no device-affinity and the heap works perfectly well for i/o buffers.
++ * It wastes much less memory than dma_alloc_coherent() would, and even
++ * prevents cacheline (32 bytes wide) sharing problems.
++ */
++static void *pxa27x_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
++ dma_addr_t * dma, unsigned int gfp_flags)
++{
++ char *retval;
++
++ retval = kmalloc(bytes, gfp_flags & ~(__GFP_DMA | __GFP_HIGHMEM));
++ if (retval)
++#ifdef USE_DMA
++ *dma = virt_to_bus(retval);
++#else
++ *dma = (dma_addr_t) ~0;
++#endif
++ return retval;
++}
++
++static void
++pxa27x_ep_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma,
++ unsigned bytes)
++{
++ kfree(buf);
++}
++
++/*-------------------------------------------------------------------------*/
++
++/*
++ * done - retire a request; caller blocked irqs
++ */
++static void done(struct pxa27x_ep *ep, struct pxa27x_request *req, int status)
++{
++ list_del_init(&req->queue);
++ if (likely(req->req.status == -EINPROGRESS))
++ req->req.status = status;
++ else
++ status = req->req.status;
++
++ if (status && status != -ESHUTDOWN)
++ DBG(DBG_VERBOSE, "complete %s req %p stat %d len %u/%u\n",
++ ep->ep.name, &req->req, status,
++ req->req.actual, req->req.length);
++
++ /* don't modify queue heads during completion callback */
++ req->req.complete(&ep->ep, &req->req);
++}
++
++static inline void ep0_idle(struct pxa27x_udc *dev)
++{
++ dev->ep0state = EP0_IDLE;
++ LED_EP0_OFF;
++}
++
++static int
++write_packet(volatile u32 * uddr, struct pxa27x_request *req, unsigned max)
++{
++ u32 *buf;
++ int length, count, remain;
++
++ buf = (u32 *) (req->req.buf + req->req.actual);
++ prefetch(buf);
++
++ /* how big will this packet be? */
++ length = min(req->req.length - req->req.actual, max);
++ req->req.actual += length;
++
++ remain = length & 0x3;
++ count = length & ~(0x3);
++
++ while (likely(count)) {
++ *uddr = *buf++;
++ count -= 4;
++ }
++
++ if (remain) {
++ volatile u8 *reg = (u8 *) uddr;
++ char *rd = (u8 *) buf;
++
++ while (remain--) {
++ *reg = *rd++;
++ }
++ }
++
++ return length;
++}
++
++/*
++ * write to an IN endpoint fifo, as many packets as possible.
++ * irqs will use this to write the rest later.
++ * caller guarantees at least one packet buffer is ready (or a zlp).
++ */
++static int write_fifo(struct pxa27x_ep *ep, struct pxa27x_request *req)
++{
++ unsigned max;
++
++ max = le16_to_cpu(ep->desc->wMaxPacketSize);
++ do {
++ int count;
++ int is_last, is_short;
++
++ count = write_packet(ep->reg_udcdr, req, max);
++
++ /* last packet is usually short (or a zlp) */
++ if (unlikely(count != max))
++ is_last = is_short = 1;
++ else {
++ if (likely(req->req.length != req->req.actual)
++ || req->req.zero)
++ is_last = 0;
++ else
++ is_last = 1;
++ /* interrupt/iso maxpacket may not fill the fifo */
++ is_short = unlikely(max < ep->fifo_size);
++ }
++
++ DMSG("wrote %s count:%d bytes%s%s %d left %p\n",
++ ep->ep.name, count,
++ is_last ? "/L" : "", is_short ? "/S" : "",
++ req->req.length - req->req.actual, &req->req);
++
++ /* let loose that packet. maybe try writing another one,
++ * double buffering might work. TSP, TPC, and TFS
++ * bit values are the same for all normal IN endpoints.
++ */
++ *ep->reg_udccsr = UDCCSR_PC;
++ if (is_short)
++ *ep->reg_udccsr = UDCCSR_SP;
++
++ /* requests complete when all IN data is in the FIFO */
++ if (is_last) {
++ done(ep, req, 0);
++ if (list_empty(&ep->queue) || unlikely(ep->dma >= 0)) {
++ pio_irq_disable(ep->ep_num);
++#ifdef USE_DMA
++ /* unaligned data and zlps couldn't use dma */
++ if (unlikely(!list_empty(&ep->queue))) {
++ req = list_entry(ep->queue.next,
++ struct pxa27x_request,
++ queue);
++ kick_dma(ep, req);
++ return 0;
++ }
++#endif
++ }
++ return 1;
++ }
++ /* TODO experiment: how robust can fifo mode tweaking be?
++ * double buffering is off in the default fifo mode, which
++ * prevents TFS from being set here.
++ */
++
++ } while (*ep->reg_udccsr & UDCCSR_FS);
++ return 0;
++}
++
++/* caller asserts req->pending (ep0 irq status nyet cleared); starts
++ * ep0 data stage. these chips want very simple state transitions.
++ */
++static inline void ep0start(struct pxa27x_udc *dev, u32 flags, const char *tag)
++{
++ UDCCSR0 = flags | UDCCSR0_SA | UDCCSR0_OPC;
++ UDCISR0 = UDCICR_INT(0, UDC_INT_FIFOERROR | UDC_INT_PACKETCMP);
++ dev->req_pending = 0;
++ DBG(DBG_VERY_NOISY, "%s %s, %02x/%02x\n",
++ __FUNCTION__, tag, UDCCSR0, flags);
++}
++
++static int write_ep0_fifo(struct pxa27x_ep *ep, struct pxa27x_request *req)
++{
++ unsigned count;
++ int is_short;
++
++ count = write_packet(&UDCDR0, req, EP0_FIFO_SIZE);
++ ep->dev->stats.write.bytes += count;
++
++ /* last packet "must be" short (or a zlp) */
++ is_short = (count != EP0_FIFO_SIZE);
++
++ DBG(DBG_VERY_NOISY, "ep0in %d bytes %d left %p\n", count,
++ req->req.length - req->req.actual, &req->req);
++
++ if (unlikely(is_short)) {
++ if (ep->dev->req_pending)
++ ep0start(ep->dev, UDCCSR0_IPR, "short IN");
++ else
++ UDCCSR0 = UDCCSR0_IPR;
++
++ count = req->req.length;
++ done(ep, req, 0);
++ ep0_idle(ep->dev);
++#if 0
++ /* This seems to get rid of lost status irqs in some cases:
++ * host responds quickly, or next request involves config
++ * change automagic, or should have been hidden, or ...
++ *
++ * FIXME get rid of all udelays possible...
++ */
++ if (count >= EP0_FIFO_SIZE) {
++ count = 100;
++ do {
++ if ((UDCCSR0 & UDCCSR0_OPC) != 0) {
++ /* clear OPC, generate ack */
++ UDCCSR0 = UDCCSR0_OPC;
++ break;
++ }
++ count--;
++ udelay(1);
++ } while (count);
++ }
++#endif
++ } else if (ep->dev->req_pending)
++ ep0start(ep->dev, 0, "IN");
++ return is_short;
++}
++
++/*
++ * read_fifo - unload packet(s) from the fifo we use for usb OUT
++ * transfers and put them into the request. caller should have made
++ * sure there's at least one packet ready.
++ *
++ * returns true if the request completed because of short packet or the
++ * request buffer having filled (and maybe overran till end-of-packet).
++ */
++static int read_fifo(struct pxa27x_ep *ep, struct pxa27x_request *req)
++{
++ for (;;) {
++ u32 *buf;
++ int bufferspace, count, is_short;
++
++ /* make sure there's a packet in the FIFO. */
++ if (unlikely((*ep->reg_udccsr & UDCCSR_PC) == 0))
++ break;
++ buf = (u32 *) (req->req.buf + req->req.actual);
++ prefetchw(buf);
++ bufferspace = req->req.length - req->req.actual;
++
++ /* read all bytes from this packet */
++ if (likely(*ep->reg_udccsr & UDCCSR_BNE)) {
++ count = 0x3ff & *ep->reg_udcbcr;
++ req->req.actual += min(count, bufferspace);
++ } else /* zlp */
++ count = 0;
++
++ is_short = (count < ep->ep.maxpacket);
++ DMSG("read %s udccsr:%02x, count:%d bytes%s req %p %d/%d\n",
++ ep->ep.name, *ep->reg_udccsr, count,
++ is_short ? "/S" : "",
++ &req->req, req->req.actual, req->req.length);
++
++#if 0
++ dump_regs(ep->ep_num );
++#endif
++ count = min(count, bufferspace);
++ while (likely(count > 0)) {
++ *buf++ = *ep->reg_udcdr;
++ count -= 4;
++ }
++ DMSG("Buf:0x%p\n", req->req.buf);
++
++ *ep->reg_udccsr = UDCCSR_PC;
++ /* RPC/RSP/RNE could now reflect the other packet buffer */
++
++ /* completion */
++ if (is_short || req->req.actual == req->req.length) {
++ done(ep, req, 0);
++ if (list_empty(&ep->queue))
++ pio_irq_disable(ep->ep_num);
++ return 1;
++ }
++
++ /* finished that packet. the next one may be waiting... */
++ }
++ return 0;
++}
++
++/*
++ * special ep0 version of the above. no UBCR0 or double buffering; status
++ * handshaking is magic. most device protocols don't need control-OUT.
++ * CDC vendor commands (and RNDIS), mass storage CB/CBI, and some other
++ * protocols do use them.
++ */
++static int read_ep0_fifo(struct pxa27x_ep *ep, struct pxa27x_request *req)
++{
++ u32 *buf, word;
++ unsigned bufferspace;
++
++ buf = (u32 *) (req->req.buf + req->req.actual);
++ bufferspace = req->req.length - req->req.actual;
++
++ while (UDCCSR0 & UDCCSR0_RNE) {
++ word = UDCDR0;
++
++ if (unlikely(bufferspace == 0)) {
++ /* this happens when the driver's buffer
++ * is smaller than what the host sent.
++ * discard the extra data.
++ */
++ if (req->req.status != -EOVERFLOW)
++ DMSG("%s overflow\n", ep->ep.name);
++ req->req.status = -EOVERFLOW;
++ } else {
++ *buf++ = word;
++ req->req.actual += 4;
++ bufferspace -= 4;
++ }
++ }
++
++ UDCCSR0 = UDCCSR0_OPC;
++
++ /* completion */
++ if (req->req.actual >= req->req.length)
++ return 1;
++
++ /* finished that packet. the next one may be waiting... */
++ return 0;
++}
++
++#ifdef USE_DMA
++
++#define MAX_IN_DMA ((DCMD_LENGTH + 1) - BULK_FIFO_SIZE)
++static void kick_dma(struct pxa27x_ep *ep, struct pxa27x_request *req)
++{
++ u32 dcmd = 0;
++ u32 len = req->req.length;
++ u32 buf = req->req.dma;
++ u32 fifo = io_v2p((u32) ep->reg_udcdr);
++
++ buf += req->req.actual;
++ len -= req->req.actual;
++ ep->dma_con = 0;
++
++ DMSG("%s: req:0x%p length:%d, actual:%d dma:%d\n",
++ __FUNCTION__, &req->req, req->req.length,
++ req->req.actual, ep->dma);
++
++ /* no-descriptor mode can be simple for bulk-in, iso-in, iso-out */
++ DCSR(ep->dma) = DCSR_NODESC;
++ if (buf & 0x3)
++ DALGN |= 1 << ep->dma;
++ else
++ DALGN &= ~(1 << ep->dma);
++
++ if (ep->dir_in) {
++ DSADR(ep->dma) = buf;
++ DTADR(ep->dma) = fifo;
++ if (len > MAX_IN_DMA) {
++ len = MAX_IN_DMA;
++ ep->dma_con = 1;
++ } else if (len >= ep->ep.maxpacket) {
++ if ((ep->dma_con = (len % ep->ep.maxpacket) != 0))
++ len = ep->ep.maxpacket;
++ }
++ dcmd = len | DCMD_BURST32 | DCMD_WIDTH4 | DCMD_ENDIRQEN
++ | DCMD_FLOWTRG | DCMD_INCSRCADDR;
++ } else {
++ DSADR(ep->dma) = fifo;
++ DTADR(ep->dma) = buf;
++ dcmd = len | DCMD_BURST32 | DCMD_WIDTH4 | DCMD_ENDIRQEN
++ | DCMD_FLOWSRC | DCMD_INCTRGADDR;
++ }
++ *ep->reg_udccsr = UDCCSR_DME;
++ DCMD(ep->dma) = dcmd;
++ DCSR(ep->dma) = DCSR_NODESC | DCSR_EORIRQEN
++ | ((ep->dir_in) ? DCSR_STOPIRQEN : 0);
++ *ep->reg_drcmr = ep->dma | DRCMR_MAPVLD;
++ DCSR(ep->dma) |= DCSR_RUN;
++}
++
++static void cancel_dma(struct pxa27x_ep *ep)
++{
++ struct pxa27x_request *req;
++ u32 tmp;
++
++ if (DCSR(ep->dma) == 0 || list_empty(&ep->queue))
++ return;
++
++ DMSG("hehe dma:%d,dcsr:0x%x\n", ep->dma, DCSR(ep->dma));
++ DCSR(ep->dma) = 0;
++ while ((DCSR(ep->dma) & DCSR_STOPSTATE) == 0)
++ cpu_relax();
++
++ req = list_entry(ep->queue.next, struct pxa27x_request, queue);
++ tmp = DCMD(ep->dma) & DCMD_LENGTH;
++ req->req.actual = req->req.length - tmp;
++
++ /* the last tx packet may be incomplete, so flush the fifo.
++ * FIXME correct req.actual if we can
++ */
++ *ep->reg_udccsr = UDCCSR_FEF;
++}
++
++static void dma_nodesc_handler(int dmach, void *_ep, struct pt_regs *r)
++{
++ struct pxa27x_ep *ep = _ep;
++ struct pxa27x_request *req, *req_next;
++ u32 dcsr, tmp, completed;
++
++ local_irq_disable();
++
++ req = list_entry(ep->queue.next, struct pxa27x_request, queue);
++
++ DMSG("%s, buf:0x%p\n", __FUNCTION__, req->req.buf);
++
++ ep->dma_irqs++;
++ ep->dev->stats.irqs++;
++ HEX_DISPLAY(ep->dev->stats.irqs);
++
++ completed = 0;
++
++ dcsr = DCSR(dmach);
++ DCSR(ep->dma) &= ~DCSR_RUN;
++
++ if (dcsr & DCSR_BUSERR) {
++ DCSR(dmach) = DCSR_BUSERR;
++ printk(KERN_ERR " Buss Error\n");
++ req->req.status = -EIO;
++ completed = 1;
++ } else if (dcsr & DCSR_ENDINTR) {
++ DCSR(dmach) = DCSR_ENDINTR;
++ if (ep->dir_in) {
++ tmp = req->req.length - req->req.actual;
++ /* Last packet is a short one */
++ if (tmp < ep->ep.maxpacket) {
++ int count = 0;
++
++ *ep->reg_udccsr = UDCCSR_SP |
++ (*ep->reg_udccsr & UDCCSR_MASK);
++ /*Wait for packet out */
++ while ((count++ < 10000) &&
++ !(*ep->reg_udccsr & UDCCSR_FS)) ;
++ if (count >= 10000)
++ DMSG("Failed to send packet\n");
++ else
++ DMSG("%s: short packet sent len:%d,"
++ "length:%d,actual:%d\n",
++ __FUNCTION__, tmp, req->req.length,
++ req->req.actual);
++ req->req.actual = req->req.length;
++ completed = 1;
++ /* There are still packets to transfer */
++ } else if (ep->dma_con) {
++ DMSG("%s: more packets,length:%d,actual:%d\n",
++ __FUNCTION__, req->req.length,
++ req->req.actual);
++ req->req.actual += ep->ep.maxpacket;
++ completed = 0;
++ } else {
++ DMSG("%s: no more packets,length:%d,"
++ "actual:%d\n", __FUNCTION__,
++ req->req.length, req->req.actual);
++ req->req.actual = req->req.length;
++ completed = 1;
++ }
++ } else {
++ req->req.actual = req->req.length;
++ completed = 1;
++ }
++ } else if (dcsr & DCSR_EORINTR) { /* Only happened in OUT DMA */
++ int remain, udccsr;
++
++ DCSR(dmach) = DCSR_EORINTR;
++ remain = DCMD(dmach) & DCMD_LENGTH;
++ req->req.actual = req->req.length - remain;
++
++ udccsr = *ep->reg_udccsr;
++ if (udccsr & UDCCSR_SP) {
++ *ep->reg_udccsr = UDCCSR_PC | (udccsr & UDCCSR_MASK);
++ completed = 1;
++ }
++ DMSG("%s: length:%d actual:%d\n",
++ __FUNCTION__, req->req.length, req->req.actual);
++ } else
++ DMSG("%s: Others dma:%d DCSR:0x%x DCMD:0x%x\n",
++ __FUNCTION__, dmach, DCSR(dmach), DCMD(dmach));
++
++ if (likely(completed)) {
++ if (req->queue.next != &ep->queue) {
++ req_next = list_entry(req->queue.next,
++ struct pxa27x_request, queue);
++ kick_dma(ep, req_next);
++ }
++ done(ep, req, 0);
++ } else {
++ kick_dma(ep, req);
++ }
++
++ local_irq_enable();
++}
++
++#endif
++/*-------------------------------------------------------------------------*/
++
++static int
++pxa27x_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
++ unsigned int gfp_flags)
++{
++ struct pxa27x_ep *ep;
++ struct pxa27x_request *req;
++ struct pxa27x_udc *dev;
++ unsigned long flags;
++
++ req = container_of(_req, struct pxa27x_request, req);
++ if (unlikely(!_req || !_req->complete || !_req->buf ||
++ !list_empty(&req->queue))) {
++ DMSG("%s, bad params\n", __FUNCTION__);
++ return -EINVAL;
++ }
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
++ DMSG("%s, bad ep\n", __FUNCTION__);
++ return -EINVAL;
++ }
++
++ DMSG("%s, ep point %d is queue\n", __FUNCTION__, ep->ep_num);
++
++ dev = ep->dev;
++ if (unlikely(!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) {
++ DMSG("%s, bogus device state\n", __FUNCTION__);
++ return -ESHUTDOWN;
++ }
++
++ /* iso is always one packet per request, that's the only way
++ * we can report per-packet status. that also helps with dma.
++ */
++ if (unlikely(ep->ep_type == USB_ENDPOINT_XFER_ISOC
++ && req->req.length > le16_to_cpu
++ (ep->desc->wMaxPacketSize)))
++ return -EMSGSIZE;
++
++#ifdef USE_DMA
++ /* FIXME: caller may already have done the dma mapping */
++ if (ep->dma >= 0) {
++ _req->dma = dma_map_single(dev->dev, _req->buf, _req->length,
++ (ep->
++ dir_in) ? DMA_TO_DEVICE :
++ DMA_FROM_DEVICE);
++ }
++#endif
++
++ DBG(DBG_NOISY, "%s queue req %p, len %d buf %p\n",
++ _ep->name, _req, _req->length, _req->buf);
++
++ local_irq_save(flags);
++
++ _req->status = -EINPROGRESS;
++ _req->actual = 0;
++
++ /* kickstart this i/o queue? */
++ if (list_empty(&ep->queue) && !ep->stopped) {
++ if (ep->desc == 0 /* ep0 */ ) {
++ unsigned length = _req->length;
++
++ switch (dev->ep0state) {
++ case EP0_IN_DATA_PHASE:
++ dev->stats.write.ops++;
++ if (write_ep0_fifo(ep, req))
++ req = 0;
++ break;
++
++ case EP0_OUT_DATA_PHASE:
++ dev->stats.read.ops++;
++ if (dev->req_pending)
++ ep0start(dev, UDCCSR0_IPR, "OUT");
++ if (length == 0 || ((UDCCSR0 & UDCCSR0_RNE) != 0
++ && read_ep0_fifo(ep,
++ req))) {
++ ep0_idle(dev);
++ done(ep, req, 0);
++ req = 0;
++ }
++ break;
++ case EP0_NO_ACTION:
++ ep0_idle(dev);
++ req = 0;
++ break;
++ default:
++ DMSG("ep0 i/o, odd state %d\n", dev->ep0state);
++ local_irq_restore(flags);
++ return -EL2HLT;
++ }
++#ifdef USE_DMA
++ /* either start dma or prime pio pump */
++ } else if (ep->dma >= 0) {
++ kick_dma(ep, req);
++#endif
++ /* can the FIFO can satisfy the request immediately? */
++ } else if (ep->dir_in
++ && (*ep->reg_udccsr & UDCCSR_FS) != 0
++ && write_fifo(ep, req)) {
++ req = 0;
++ } else if ((*ep->reg_udccsr & UDCCSR_FS) != 0
++ && read_fifo(ep, req)) {
++ req = 0;
++ }
++ DMSG("req:%p,ep->desc:%p,ep->dma:%d\n", req, ep->desc, ep->dma);
++ if (likely(req && ep->desc) && ep->dma < 0)
++ pio_irq_enable(ep->ep_num);
++ }
++
++ /* pio or dma irq handler advances the queue. */
++ if (likely(req != 0))
++ list_add_tail(&req->queue, &ep->queue);
++ local_irq_restore(flags);
++
++ return 0;
++}
++
++/*
++ * nuke - dequeue ALL requests
++ */
++static void nuke(struct pxa27x_ep *ep, int status)
++{
++ struct pxa27x_request *req;
++
++ /* called with irqs blocked */
++#ifdef USE_DMA
++ if (ep->dma >= 0 && !ep->stopped)
++ cancel_dma(ep);
++#endif
++ while (!list_empty(&ep->queue)) {
++ req = list_entry(ep->queue.next, struct pxa27x_request, queue);
++ done(ep, req, status);
++ }
++ if (ep->desc)
++ pio_irq_disable(ep->ep_num);
++}
++
++/* dequeue JUST ONE request */
++static int pxa27x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
++{
++ struct pxa27x_ep *ep;
++ struct pxa27x_request *req;
++ unsigned long flags;
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (!_ep || ep->ep.name == ep0name)
++ return -EINVAL;
++
++ local_irq_save(flags);
++
++ /* make sure it's actually queued on this endpoint */
++ list_for_each_entry(req, &ep->queue, queue) {
++ if (&req->req == _req)
++ break;
++ }
++ if (&req->req != _req) {
++ local_irq_restore(flags);
++ return -EINVAL;
++ }
++#ifdef USE_DMA
++ if (ep->dma >= 0 && ep->queue.next == &req->queue && !ep->stopped) {
++ cancel_dma(ep);
++ done(ep, req, -ECONNRESET);
++ /* restart i/o */
++ if (!list_empty(&ep->queue)) {
++ req = list_entry(ep->queue.next,
++ struct pxa27x_request, queue);
++ kick_dma(ep, req);
++ }
++ } else
++#endif
++ done(ep, req, -ECONNRESET);
++
++ local_irq_restore(flags);
++ return 0;
++}
++
++/*-------------------------------------------------------------------------*/
++
++static int pxa27x_ep_set_halt(struct usb_ep *_ep, int value)
++{
++ struct pxa27x_ep *ep;
++ unsigned long flags;
++
++ DMSG("%s is called\n", __FUNCTION__);
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))
++ || ep->ep_type == USB_ENDPOINT_XFER_ISOC) {
++ DMSG("%s, bad ep\n", __FUNCTION__);
++ return -EINVAL;
++ }
++ if (value == 0) {
++ /* this path (reset toggle+halt) is needed to implement
++ * SET_INTERFACE on normal hardware. but it can't be
++ * done from software on the PXA UDC, and the hardware
++ * forgets to do it as part of SET_INTERFACE automagic.
++ */
++ DMSG("only host can clear %s halt\n", _ep->name);
++ return -EROFS;
++ }
++
++ local_irq_save(flags);
++
++ if (ep->dir_in && ((*ep->reg_udccsr & UDCCSR_FS) == 0
++ || !list_empty(&ep->queue))) {
++ local_irq_restore(flags);
++ return -EAGAIN;
++ }
++
++ /* FST bit is the same for control, bulk in, bulk out, interrupt in */
++ *ep->reg_udccsr = UDCCSR_FST | UDCCSR_FEF;
++
++ /* ep0 needs special care */
++ if (!ep->desc) {
++ start_watchdog(ep->dev);
++ ep->dev->req_pending = 0;
++ ep->dev->ep0state = EP0_STALL;
++ LED_EP0_OFF;
++
++ /* and bulk/intr endpoints like dropping stalls too */
++ } else {
++ unsigned i;
++ for (i = 0; i < 1000; i += 20) {
++ if (*ep->reg_udccsr & UDCCSR_SST)
++ break;
++ udelay(20);
++ }
++ }
++ local_irq_restore(flags);
++
++ DBG(DBG_VERBOSE, "%s halt\n", _ep->name);
++ return 0;
++}
++
++static int pxa27x_ep_fifo_status(struct usb_ep *_ep)
++{
++ struct pxa27x_ep *ep;
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (!_ep) {
++ DMSG("%s, bad ep\n", __FUNCTION__);
++ return -ENODEV;
++ }
++ /* pxa can't report unclaimed bytes from IN fifos */
++ if (ep->dir_in)
++ return -EOPNOTSUPP;
++ if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN
++ || (*ep->reg_udccsr & UDCCSR_FS) == 0)
++ return 0;
++ else
++ return (*ep->reg_udcbcr & 0xfff) + 1;
++}
++
++static void pxa27x_ep_fifo_flush(struct usb_ep *_ep)
++{
++ struct pxa27x_ep *ep;
++
++ ep = container_of(_ep, struct pxa27x_ep, ep);
++ if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) {
++ DMSG("%s, bad ep\n", __FUNCTION__);
++ return;
++ }
++
++ /* toggle and halt bits stay unchanged */
++
++ /* for OUT, just read and discard the FIFO contents. */
++ if (!ep->dir_in) {
++ while (((*ep->reg_udccsr) & UDCCSR_BNE) != 0)
++ (void)*ep->reg_udcdr;
++ return;
++ }
++
++ /* most IN status is the same, but ISO can't stall */
++ *ep->reg_udccsr = UDCCSR_PC | UDCCSR_FST | UDCCSR_TRN
++ | (ep->ep_type == USB_ENDPOINT_XFER_ISOC)
++ ? 0 : UDCCSR_SST;
++}
++
++static struct usb_ep_ops pxa27x_ep_ops = {
++ .enable = pxa27x_ep_enable,
++ .disable = pxa27x_ep_disable,
++
++ .alloc_request = pxa27x_ep_alloc_request,
++ .free_request = pxa27x_ep_free_request,
++
++#warning "CHECK comemnts here"
++ //.alloc_buffer = pxa27x_ep_alloc_buffer,
++ //.free_buffer = pxa27x_ep_free_buffer,
++
++ .queue = pxa27x_ep_queue,
++ .dequeue = pxa27x_ep_dequeue,
++
++ .set_halt = pxa27x_ep_set_halt,
++ .fifo_status = pxa27x_ep_fifo_status,
++ .fifo_flush = pxa27x_ep_fifo_flush,
++};
++
++/* ---------------------------------------------------------------------------
++ * device-scoped parts of the api to the usb controller hardware
++ * ---------------------------------------------------------------------------
++ */
++
++static inline void validate_fifo_size(struct pxa27x_ep *pxa_ep, u8 bmAttributes)
++{
++ switch (bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
++ case USB_ENDPOINT_XFER_CONTROL:
++ pxa_ep->fifo_size = EP0_FIFO_SIZE;
++ break;
++ case USB_ENDPOINT_XFER_ISOC:
++ pxa_ep->fifo_size = ISO_FIFO_SIZE;
++ break;
++ case USB_ENDPOINT_XFER_BULK:
++ pxa_ep->fifo_size = BULK_FIFO_SIZE;
++ break;
++ case USB_ENDPOINT_XFER_INT:
++ pxa_ep->fifo_size = INT_FIFO_SIZE;
++ break;
++ default:
++ break;
++ }
++}
++
++#define NAME_SIZE 18
++struct usb_ep *pxa27x_ep_alloc(struct usb_gadget *gadget,
++ struct usb_endpoint_descriptor *desc, int config,
++ int interface, int alt)
++{
++ u32 tmp;
++ unsigned i;
++ char *name;
++ struct usb_ep *ep = NULL;
++ struct pxa27x_ep *pxa_ep = NULL;
++ struct pxa27x_udc *dev = the_controller;
++
++ DMSG("pxa27x_config_ep is called\n");
++ DMSG(" usb endpoint descriptor is:\n"
++ " bLength:%d\n"
++ " bDescriptorType:%x\n"
++ " bEndpointAddress:%x\n"
++ " bmAttributes:%x\n"
++ " wMaxPacketSize:%d\n",
++ desc->bLength,
++ desc->bDescriptorType, desc->bEndpointAddress,
++ desc->bmAttributes, desc->wMaxPacketSize);
++
++ for (i = 1; i < UDC_EP_NUM; i++) {
++ if (!dev->ep[i].assigned) {
++ pxa_ep = &dev->ep[i];
++ pxa_ep->assigned = 1;
++ pxa_ep->ep_num = i;
++ break;
++ }
++ }
++ if (unlikely(i == UDC_EP_NUM)) {
++ printk(KERN_ERR __FILE__ ": Failed to find a spare endpoint\n");
++ return ep;
++ }
++
++ ep = &pxa_ep->ep;
++
++ pxa_ep->dev = dev;
++ pxa_ep->desc = desc;
++ pxa_ep->pio_irqs = pxa_ep->dma_irqs = 0;
++ pxa_ep->dma = -1;
++
++ if (!(desc->bEndpointAddress & 0xF))
++ desc->bEndpointAddress |= i;
++
++ if (!(desc->wMaxPacketSize)) {
++ validate_fifo_size(pxa_ep, desc->bmAttributes);
++ desc->wMaxPacketSize = pxa_ep->fifo_size;
++ } else
++ pxa_ep->fifo_size = desc->wMaxPacketSize;
++
++ pxa_ep->dir_in = (desc->bEndpointAddress & USB_DIR_IN) ? 1 : 0;
++ pxa_ep->ep_type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
++ pxa_ep->stopped = 1;
++ pxa_ep->dma_con = 0;
++ pxa_ep->config = config;
++ pxa_ep->interface = interface;
++ pxa_ep->aisn = alt;
++
++ pxa_ep->reg_udccsr = &UDCCSR0 + i;
++ pxa_ep->reg_udcbcr = &UDCBCR0 + i;
++ pxa_ep->reg_udcdr = &UDCDR0 + i;
++ pxa_ep->reg_udccr = &UDCCRA - 1 + i;
++#ifdef USE_DMA
++ pxa_ep->reg_drcmr = &DRCMR24 + i;
++#endif
++
++ DMSG("udccsr=0x%8x, udcbcr=0x%8x, udcdr=0x%8x,"
++ "udccr0=0x%8x\n",
++ (unsigned)pxa_ep->reg_udccsr,
++ (unsigned)pxa_ep->reg_udcbcr,
++ (unsigned)pxa_ep->reg_udcdr, (unsigned)pxa_ep->reg_udccr);
++
++ /* Configure UDCCR */
++ tmp = 0;
++ tmp |= (pxa_ep->config << UDCCONR_CN_S) & UDCCONR_CN;
++#if 0
++ tmp |= (pxa_ep->interface << UDCCONR_IN_S) & UDCCONR_IN;
++ tmp |= (pxa_ep->aisn << UDCCONR_AISN_S) & UDCCONR_AISN;
++#else
++ tmp |= (0 << UDCCONR_IN_S) & UDCCONR_IN;
++ tmp |= (0 << UDCCONR_AISN_S) & UDCCONR_AISN;
++#endif
++ tmp |= (desc->bEndpointAddress << UDCCONR_EN_S) & UDCCONR_EN;
++ tmp |= (pxa_ep->ep_type << UDCCONR_ET_S) & UDCCONR_ET;
++ tmp |= (pxa_ep->dir_in) ? UDCCONR_ED : 0;
++ tmp |= (min(pxa_ep->fifo_size, (unsigned)desc->wMaxPacketSize)
++ << UDCCONR_MPS_S) & UDCCONR_MPS;
++ tmp |= UDCCONR_DE | UDCCONR_EE;
++#if 0
++ tmp |= UDCCONR_EE;
++#endif
++
++ *pxa_ep->reg_udccr = tmp;
++
++#ifdef USE_DMA
++ /* Only BULK use DMA */
++ if ((pxa_ep->ep_type & USB_ENDPOINT_XFERTYPE_MASK)
++ == USB_ENDPOINT_XFER_BULK)
++ *pxa_ep->reg_udccsr = UDCCSR_DME;
++#endif
++
++ DMSG("UDCCR: 0x%p is 0x%x\n", pxa_ep->reg_udccr, *pxa_ep->reg_udccr);
++
++ /* Fill ep name */
++ name = kmalloc(NAME_SIZE, GFP_KERNEL);
++ if (!name) {
++ printk(KERN_ERR "%s: Error\n", __FUNCTION__);
++ return NULL;
++ }
++
++ switch (pxa_ep->ep_type) {
++ case USB_ENDPOINT_XFER_BULK:
++ sprintf(name, "Bulk-%s-%d", (pxa_ep->dir_in ? "in" : "out"), i);
++ break;
++ case USB_ENDPOINT_XFER_INT:
++ sprintf(name, "Interrupt-%s-%d", (pxa_ep->dir_in ?
++ "in" : "out"), i);
++ break;
++ default:
++ sprintf(name, "endpoint-%s-%d", (pxa_ep->dir_in ?
++ "in" : "out"), i);
++ break;
++ }
++ ep->name = name;
++
++ ep->ops = &pxa27x_ep_ops;
++ ep->maxpacket = min((ushort) pxa_ep->fifo_size, desc->wMaxPacketSize);
++
++ list_add_tail(&ep->ep_list, &gadget->ep_list);
++ return ep;
++}
++
++static int pxa27x_udc_get_frame(struct usb_gadget *_gadget)
++{
++ return (UDCFNR & 0x3FF);
++}
++
++static int pxa27x_udc_wakeup(struct usb_gadget *_gadget)
++{
++ /* host may not have enabled remote wakeup */
++ if ((UDCCR & UDCCR_DWRE) == 0)
++ return -EHOSTUNREACH;
++ udc_set_mask_UDCCR(UDCCR_UDR);
++ return 0;
++}
++
++static const struct usb_gadget_ops pxa27x_udc_ops = {
++ .ep_alloc = pxa27x_ep_alloc,
++ .get_frame = pxa27x_udc_get_frame,
++ .wakeup = pxa27x_udc_wakeup,
++ /* current versions must always be self-powered */
++};
++
++/*-------------------------------------------------------------------------*/
++
++#ifdef UDC_PROC_FILE
++
++static const char proc_node_name[] = "driver/udc";
++
++static int
++udc_proc_read(char *page, char **start, off_t off, int count,
++ int *eof, void *_dev)
++{
++ char *buf = page;
++ struct pxa27x_udc *dev = _dev;
++ char *next = buf;
++ unsigned size = count;
++ unsigned long flags;
++ int i, t;
++ u32 tmp;
++
++ if (off != 0)
++ return 0;
++
++ local_irq_save(flags);
++
++ /* basic device status */
++ t = scnprintf(next, size, DRIVER_DESC "\n"
++ "%s version: %s\nGadget driver: %s\n",
++ driver_name, DRIVER_VERSION SIZE_STR DMASTR,
++ dev->driver ? dev->driver->driver.name : "(none)");
++ size -= t;
++ next += t;
++
++ /* registers for device and ep0 */
++ t = scnprintf(next, size,
++ "uicr %02X.%02X, usir %02X.%02x, ufnr %02X\n",
++ UDCICR1, UDCICR0, UDCISR1, UDCISR0, UDCFNR);
++ size -= t;
++ next += t;
++
++ tmp = UDCCR;
++ t = scnprintf(next, size,
++ "udccr %02X =%s%s%s%s%s%s%s%s%s%s, con=%d,inter=%d,altinter=%d\n",
++ tmp, (tmp & UDCCR_OEN) ? " oen" : "",
++ (tmp & UDCCR_AALTHNP) ? " aalthnp" : "",
++ (tmp & UDCCR_AHNP) ? " rem" : "",
++ (tmp & UDCCR_BHNP) ? " rstir" : "",
++ (tmp & UDCCR_DWRE) ? " dwre" : "",
++ (tmp & UDCCR_SMAC) ? " smac" : "",
++ (tmp & UDCCR_EMCE) ? " emce" : "",
++ (tmp & UDCCR_UDR) ? " udr" : "",
++ (tmp & UDCCR_UDA) ? " uda" : "",
++ (tmp & UDCCR_UDE) ? " ude" : "",
++ (tmp & UDCCR_ACN) >> UDCCR_ACN_S,
++ (tmp & UDCCR_AIN) >> UDCCR_AIN_S,
++ (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S);
++
++ size -= t;
++ next += t;
++
++ tmp = UDCCSR0;
++ t = scnprintf(next, size,
++ "udccsr0 %02X =%s%s%s%s%s%s%s\n", tmp,
++ (tmp & UDCCSR0_SA) ? " sa" : "",
++ (tmp & UDCCSR0_RNE) ? " rne" : "",
++ (tmp & UDCCSR0_FST) ? " fst" : "",
++ (tmp & UDCCSR0_SST) ? " sst" : "",
++ (tmp & UDCCSR0_DME) ? " dme" : "",
++ (tmp & UDCCSR0_IPR) ? " ipr" : "",
++ (tmp & UDCCSR0_OPC) ? " opc" : "");
++ size -= t;
++ next += t;
++
++ if (!dev->driver)
++ goto done;
++
++ t = scnprintf(next, size, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",
++ dev->stats.write.bytes, dev->stats.write.ops,
++ dev->stats.read.bytes, dev->stats.read.ops,
++ dev->stats.irqs);
++ size -= t;
++ next += t;
++
++ /* dump endpoint queues */
++ for (i = 0; i < UDC_EP_NUM; i++) {
++ struct pxa27x_ep *ep = &dev->ep[i];
++ struct pxa27x_request *req;
++ int t;
++
++ if (i != 0) {
++ const struct usb_endpoint_descriptor *d;
++
++ d = ep->desc;
++ if (!d)
++ continue;
++ tmp = *dev->ep[i].reg_udccsr;
++ t = scnprintf(next, size,
++ "%s max %d %s udccs %02x udccr:0x%x\n",
++ ep->ep.name,
++ le16_to_cpu(d->wMaxPacketSize),
++ (ep->dma >= 0) ? "dma" : "pio", tmp,
++ *dev->ep[i].reg_udccr);
++ /* TODO translate all five groups of udccs bits! */
++
++ } else /* ep0 should only have one transfer queued */
++ t = scnprintf(next, size, "ep0 max 16 pio irqs %lu\n",
++ ep->pio_irqs);
++ if (t <= 0 || t > size)
++ goto done;
++ size -= t;
++ next += t;
++
++ if (list_empty(&ep->queue)) {
++ t = scnprintf(next, size, "\t(nothing queued)\n");
++ if (t <= 0 || t > size)
++ goto done;
++ size -= t;
++ next += t;
++ continue;
++ }
++ list_for_each_entry(req, &ep->queue, queue) {
++#ifdef USE_DMA
++ if (ep->dma >= 0 && req->queue.prev == &ep->queue)
++ t = scnprintf(next, size,
++ "\treq %p len %d/%d "
++ "buf %p (dma%d dcmd %08x)\n",
++ &req->req, req->req.actual,
++ req->req.length, req->req.buf,
++ ep->dma, DCMD(ep->dma)
++ /* low 13 bits == bytes-to-go */
++ );
++ else
++#endif
++ t = scnprintf(next, size,
++ "\treq %p len %d/%d buf %p\n",
++ &req->req, req->req.actual,
++ req->req.length, req->req.buf);
++ if (t <= 0 || t > size)
++ goto done;
++ size -= t;
++ next += t;
++ }
++ }
++
++ done:
++ local_irq_restore(flags);
++ *eof = 1;
++ return count - size;
++}
++
++#define create_proc_files() \
++ create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev)
++#define remove_proc_files() \
++ remove_proc_entry(proc_node_name, NULL)
++
++#else /* !UDC_PROC_FILE */
++#define create_proc_files() do {} while (0)
++#define remove_proc_files() do {} while (0)
++
++#endif /* UDC_PROC_FILE */
++
++/* "function" sysfs attribute */
++static ssize_t
++show_function(struct device *_dev, struct device_attribute *attr, char *buf)
++{
++ struct pxa27x_udc *dev = dev_get_drvdata(_dev);
++
++ if (!dev->driver
++ || !dev->driver->function
++ || strlen(dev->driver->function) > PAGE_SIZE)
++ return 0;
++ return scnprintf(buf, PAGE_SIZE, "%s\n", dev->driver->function);
++}
++
++static DEVICE_ATTR(function, S_IRUGO, show_function, NULL);
++
++/*-------------------------------------------------------------------------*/
++
++/*
++ * udc_disable - disable USB device controller
++ */
++static void udc_disable(struct pxa27x_udc *dev)
++{
++ UDCICR0 = 0x00000000;
++ UDCICR1 = 0x00000000;
++
++ udc_clear_mask_UDCCR(UDCCR_UDE);
++
++ /* Disable clock for USB device */
++ pxa_set_cken(CKEN_USB, 0);
++
++ ep0_idle(dev);
++ dev->gadget.speed = USB_SPEED_UNKNOWN;
++
++ pullup_off();
++}
++
++/*
++ * udc_reinit - initialize software state
++ */
++static void udc_reinit(struct pxa27x_udc *dev)
++{
++ u32 i;
++
++ dev->ep0state = EP0_IDLE;
++
++ /* basic endpoint records init */
++ for (i = 0; i < UDC_EP_NUM; i++) {
++ struct pxa27x_ep *ep = &dev->ep[i];
++
++ ep->stopped = 0;
++ ep->pio_irqs = ep->dma_irqs = 0;
++ }
++ dev->configuration = 0;
++ dev->interface = 0;
++ dev->alternate = 0;
++ /* the rest was statically initialized, and is read-only */
++}
++
++/* until it's enabled, this UDC should be completely invisible
++ * to any USB host.
++ */
++static void udc_enable(struct pxa27x_udc *dev)
++{
++ udc_clear_mask_UDCCR(UDCCR_UDE);
++
++ /* Enable clock for USB device */
++ pxa_set_cken(CKEN_USB, 1);
++
++ UDCICR0 = UDCICR1 = 0;
++
++ ep0_idle(dev);
++ dev->gadget.speed = USB_SPEED_FULL;
++ dev->stats.irqs = 0;
++
++ udc_set_mask_UDCCR(UDCCR_UDE);
++ udelay(2);
++ if (UDCCR & UDCCR_EMCE) {
++ printk(KERN_ERR
++ ": There are error in configuration, udc disabled\n");
++ }
++
++ /* caller must be able to sleep in order to cope
++ * with startup transients.
++ */
++ msleep(100);
++
++ /* enable suspend/resume and reset irqs */
++ UDCICR1 = UDCICR1_IECC | UDCICR1_IERU | UDCICR1_IESU | UDCICR1_IERS;
++
++ /* enable ep0 irqs */
++ UDCICR0 = UDCICR_INT(0, UDCICR_INT_MASK);
++#if 0
++ for (i = 1; i < UDC_EP_NUM; i++) {
++ if (dev->ep[i].assigned)
++ pio_irq_enable(i);
++ }
++#endif
++
++ pullup_on();
++}
++
++/* when a driver is successfully registered, it will receive
++ * control requests including set_configuration(), which enables
++ * non-control requests. then usb traffic follows until a
++ * disconnect is reported. then a host may connect again, or
++ * the driver might get unbound.
++ */
++int usb_gadget_register_driver(struct usb_gadget_driver *driver)
++{
++ struct pxa27x_udc *dev = the_controller;
++ int retval;
++
++ DMSG("dev=0x%x, driver=0x%x, speed=%d, "
++ "bind=0x%x, unbind=0x%x, disconnect=0x%x, setup=0x%x\n",
++ (unsigned)dev, (unsigned)driver, driver->speed,
++ (unsigned)driver->bind, (unsigned)driver->unbind,
++ (unsigned)driver->disconnect, (unsigned)driver->setup);
++
++ if (!driver || driver->speed != USB_SPEED_FULL
++ || !driver->bind
++ || !driver->unbind || !driver->disconnect || !driver->setup)
++ return -EINVAL;
++ if (!dev)
++ return -ENODEV;
++ if (dev->driver)
++ return -EBUSY;
++
++ /* first hook up the driver ... */
++ dev->driver = driver;
++ dev->gadget.dev.driver = &driver->driver;
++
++ retval = device_add(&dev->gadget.dev);
++ if (retval) {
++ DMSG("unable to add device for %s --> error %d\n",
++ driver->driver.name, retval);
++ goto device_add_error;
++ }
++ retval = driver->bind(&dev->gadget);
++ if (retval) {
++ DMSG("bind to driver %s --> error %d\n",
++ driver->driver.name, retval);
++ goto device_bind_error;
++ }
++ retval = device_create_file(dev->dev, &dev_attr_function);
++ if (retval) {
++ DMSG("unable to create file for %s --> error %d\n",
++ driver->driver.name, retval);
++ goto create_file_error;
++ }
++
++ /* ... then enable host detection and ep0; and we're ready
++ * for set_configuration as well as eventual disconnect.
++ * NOTE: this shouldn't power up until later.
++ */
++ DMSG("registered gadget driver '%s'\n", driver->driver.name);
++ udc_enable(dev);
++ dump_state(dev);
++
++ return 0;
++
++ create_file_error:
++ driver->unbind(&dev->gadget);
++
++ device_bind_error:
++ device_del(&dev->gadget.dev);
++
++ device_add_error:
++ dev->driver = 0;
++ dev->gadget.dev.driver = 0;
++
++ return retval;
++}
++
++EXPORT_SYMBOL(usb_gadget_register_driver);
++
++static void
++stop_activity(struct pxa27x_udc *dev, struct usb_gadget_driver *driver)
++{
++ int i;
++
++ DMSG("Trace path 1\n");
++ /* don't disconnect drivers more than once */
++ if (dev->gadget.speed == USB_SPEED_UNKNOWN)
++ driver = 0;
++ dev->gadget.speed = USB_SPEED_UNKNOWN;
++
++ /* prevent new request submissions, kill any outstanding requests */
++ for (i = 0; i < UDC_EP_NUM; i++) {
++ struct pxa27x_ep *ep = &dev->ep[i];
++
++ ep->stopped = 1;
++ nuke(ep, -ESHUTDOWN);
++ }
++ del_timer_sync(&dev->timer);
++
++ /* report disconnect; the driver is already quiesced */
++ if (driver)
++ driver->disconnect(&dev->gadget);
++
++ /* re-init driver-visible data structures */
++ udc_reinit(dev);
++}
++
++int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
++{
++ struct pxa27x_udc *dev = the_controller;
++
++ if (!dev)
++ return -ENODEV;
++ if (!driver || driver != dev->driver)
++ return -EINVAL;
++
++ local_irq_disable();
++ udc_disable(dev);
++ stop_activity(dev, driver);
++ local_irq_enable();
++
++ driver->unbind(&dev->gadget);
++ dev->driver = 0;
++
++ device_del(&dev->gadget.dev);
++ device_remove_file(dev->dev, &dev_attr_function);
++
++ DMSG("unregistered gadget driver '%s'\n", driver->driver.name);
++ dump_state(dev);
++ return 0;
++}
++
++EXPORT_SYMBOL(usb_gadget_unregister_driver);
++
++#ifndef enable_disconnect_irq
++#define enable_disconnect_irq() do {} while (0)
++#define disable_disconnect_irq() do {} while (0)
++#endif
++
++/*-------------------------------------------------------------------------*/
++
++static inline void clear_ep_state(struct pxa27x_udc *dev)
++{
++ unsigned i;
++
++ /* hardware SET_{CONFIGURATION,INTERFACE} automagic resets endpoint
++ * fifos, and pending transactions mustn't be continued in any case.
++ */
++ for (i = 1; i < UDC_EP_NUM; i++)
++ nuke(&dev->ep[i], -ECONNABORTED);
++}
++
++static void udc_watchdog(unsigned long _dev)
++{
++ struct pxa27x_udc *dev = (void *)_dev;
++
++ local_irq_disable();
++ if (dev->ep0state == EP0_STALL
++ && (UDCCSR0 & UDCCSR0_FST) == 0 && (UDCCSR0 & UDCCSR0_SST) == 0) {
++ UDCCSR0 = UDCCSR0_FST | UDCCSR0_FTF;
++ DBG(DBG_VERBOSE, "ep0 re-stall\n");
++ start_watchdog(dev);
++ }
++ local_irq_enable();
++}
++
++static void handle_ep0(struct pxa27x_udc *dev)
++{
++ u32 udccsr0 = UDCCSR0;
++ struct pxa27x_ep *ep = &dev->ep[0];
++ struct pxa27x_request *req;
++ union {
++ struct usb_ctrlrequest r;
++ u8 raw[8];
++ u32 word[2];
++ } u;
++
++ if (list_empty(&ep->queue))
++ req = 0;
++ else
++ req = list_entry(ep->queue.next, struct pxa27x_request, queue);
++
++ /* clear stall status */
++ if (udccsr0 & UDCCSR0_SST) {
++ nuke(ep, -EPIPE);
++ UDCCSR0 = UDCCSR0_SST;
++ del_timer(&dev->timer);
++ ep0_idle(dev);
++ }
++
++ /* previous request unfinished? non-error iff back-to-back ... */
++ if ((udccsr0 & UDCCSR0_SA) != 0 && dev->ep0state != EP0_IDLE) {
++ nuke(ep, 0);
++ del_timer(&dev->timer);
++ ep0_idle(dev);
++ }
++
++ switch (dev->ep0state) {
++ case EP0_NO_ACTION:
++ printk(KERN_INFO "%s: Busy\n", __FUNCTION__);
++ /*Fall through */
++ case EP0_IDLE:
++ /* late-breaking status? */
++ udccsr0 = UDCCSR0;
++
++ /* start control request? */
++ if (likely((udccsr0 & (UDCCSR0_OPC | UDCCSR0_SA | UDCCSR0_RNE))
++ == (UDCCSR0_OPC | UDCCSR0_SA | UDCCSR0_RNE))) {
++ int i;
++
++ nuke(ep, -EPROTO);
++ /* read SETUP packet */
++ for (i = 0; i < 2; i++) {
++ if (unlikely(!(UDCCSR0 & UDCCSR0_RNE))) {
++ bad_setup:
++ DMSG("SETUP %d!\n", i);
++ goto stall;
++ }
++ u.word[i] = UDCDR0;
++ }
++ if (unlikely((UDCCSR0 & UDCCSR0_RNE) != 0))
++ goto bad_setup;
++
++ le16_to_cpus(&u.r.wValue);
++ le16_to_cpus(&u.r.wIndex);
++ le16_to_cpus(&u.r.wLength);
++
++ LED_EP0_ON;
++
++ DBG(DBG_VERBOSE, "SETUP %02x.%02x v%04x i%04x l%04x\n",
++ u.r.bRequestType, u.r.bRequest,
++ u.r.wValue, u.r.wIndex, u.r.wLength);
++ /* cope with automagic for some standard requests. */
++ dev->req_std = (u.r.bRequestType & USB_TYPE_MASK)
++ == USB_TYPE_STANDARD;
++ dev->req_config = 0;
++ dev->req_pending = 1;
++#if 0
++ switch (u.r.bRequest) {
++ /* hardware was supposed to hide this */
++ case USB_REQ_SET_CONFIGURATION:
++ case USB_REQ_SET_INTERFACE:
++ case USB_REQ_SET_ADDRESS:
++ printk(KERN_ERR "Should not come here\n");
++ break;
++ }
++
++#endif
++ if (u.r.bRequestType & USB_DIR_IN)
++ dev->ep0state = EP0_IN_DATA_PHASE;
++ else
++ dev->ep0state = EP0_OUT_DATA_PHASE;
++ i = dev->driver->setup(&dev->gadget, &u.r);
++
++ if (i < 0) {
++ /* hardware automagic preventing STALL... */
++ if (dev->req_config) {
++ /* hardware sometimes neglects to tell
++ * tell us about config change events,
++ * so later ones may fail...
++ */
++ WARN("config change %02x fail %d?\n",
++ u.r.bRequest, i);
++ return;
++ /* TODO experiment: if has_cfr,
++ * hardware didn't ACK; maybe we
++ * could actually STALL!
++ */
++ }
++ DBG(DBG_VERBOSE, "protocol STALL, "
++ "%02x err %d\n", UDCCSR0, i);
++ stall:
++ /* the watchdog timer helps deal with cases
++ * where udc seems to clear FST wrongly, and
++ * then NAKs instead of STALLing.
++ */
++ ep0start(dev, UDCCSR0_FST | UDCCSR0_FTF,
++ "stall");
++ start_watchdog(dev);
++ dev->ep0state = EP0_STALL;
++ LED_EP0_OFF;
++
++ /* deferred i/o == no response yet */
++ } else if (dev->req_pending) {
++ if (likely(dev->ep0state == EP0_IN_DATA_PHASE
++ || dev->req_std || u.r.wLength))
++ ep0start(dev, 0, "defer");
++ else
++ ep0start(dev, UDCCSR0_IPR, "defer/IPR");
++ }
++
++ /* expect at least one data or status stage irq */
++ return;
++
++ } else {
++ /* some random early IRQ:
++ * - we acked FST
++ * - IPR cleared
++ * - OPC got set, without SA (likely status stage)
++ */
++ UDCCSR0 = udccsr0 & (UDCCSR0_SA | UDCCSR0_OPC);
++ }
++ break;
++ case EP0_IN_DATA_PHASE: /* GET_DESCRIPTOR etc */
++ if (udccsr0 & UDCCSR0_OPC) {
++ UDCCSR0 = UDCCSR0_OPC | UDCCSR0_FTF;
++ DBG(DBG_VERBOSE, "ep0in premature status\n");
++ if (req)
++ done(ep, req, 0);
++ ep0_idle(dev);
++ } else { /* irq was IPR clearing */
++
++ if (req) {
++ /* this IN packet might finish the request */
++ (void)write_ep0_fifo(ep, req);
++ } /* else IN token before response was written */
++ }
++ break;
++ case EP0_OUT_DATA_PHASE: /* SET_DESCRIPTOR etc */
++ if (udccsr0 & UDCCSR0_OPC) {
++ if (req) {
++ /* this OUT packet might finish the request */
++ if (read_ep0_fifo(ep, req))
++ done(ep, req, 0);
++ /* else more OUT packets expected */
++ } /* else OUT token before read was issued */
++ } else { /* irq was IPR clearing */
++
++ DBG(DBG_VERBOSE, "ep0out premature status\n");
++ if (req)
++ done(ep, req, 0);
++ ep0_idle(dev);
++ }
++ break;
++ case EP0_STALL:
++ UDCCSR0 = UDCCSR0_FST;
++ break;
++ }
++ UDCISR0 = UDCISR_INT(0, UDCISR_INT_MASK);
++}
++
++static void handle_ep(struct pxa27x_ep *ep)
++{
++ struct pxa27x_request *req;
++ int completed;
++ u32 udccsr = 0;
++
++ DMSG("%s is called\n", __FUNCTION__);
++ do {
++ completed = 0;
++ if (likely(!list_empty(&ep->queue))) {
++ req = list_entry(ep->queue.next,
++ struct pxa27x_request, queue);
++ } else
++ req = 0;
++
++#if 0
++ udccsr = *ep->reg_udccsr;
++#endif
++ DMSG("%s: req:%p, udcisr0:0x%x udccsr %p:0x%x\n", __FUNCTION__,
++ req, UDCISR0, ep->reg_udccsr, *ep->reg_udccsr);
++ if (unlikely(ep->dir_in)) {
++ udccsr = (UDCCSR_SST | UDCCSR_TRN) & *ep->reg_udccsr;
++ if (unlikely(udccsr))
++ *ep->reg_udccsr = udccsr;
++
++ if (req && likely((*ep->reg_udccsr & UDCCSR_FS) != 0))
++ completed = write_fifo(ep, req);
++
++ } else {
++ udccsr = (UDCCSR_SST | UDCCSR_TRN) & *ep->reg_udccsr;
++ if (unlikely(udccsr))
++ *ep->reg_udccsr = udccsr;
++
++ /* fifos can hold packets, ready for reading... */
++ if (likely(req)) {
++ completed = read_fifo(ep, req);
++ } else {
++ pio_irq_disable(ep->ep_num);
++ *ep->reg_udccsr = UDCCSR_FEF;
++ DMSG("%s: no req for out data\n", __FUNCTION__);
++ }
++ }
++ ep->pio_irqs++;
++ } while (completed);
++}
++
++static void pxa27x_change_configuration(struct pxa27x_udc *dev)
++{
++ struct usb_ctrlrequest req;
++
++ req.bRequestType = 0;
++ req.bRequest = USB_REQ_SET_CONFIGURATION;
++ req.wValue = dev->configuration;
++ req.wIndex = 0;
++ req.wLength = 0;
++
++ dev->ep0state = EP0_NO_ACTION;
++ dev->driver->setup(&dev->gadget, &req);
++
++}
++
++static void pxa27x_change_interface(struct pxa27x_udc *dev)
++{
++ struct usb_ctrlrequest req;
++
++ req.bRequestType = USB_RECIP_INTERFACE;
++ req.bRequest = USB_REQ_SET_INTERFACE;
++ req.wValue = dev->alternate;
++ req.wIndex = dev->interface;
++ req.wLength = 0;
++
++ dev->ep0state = EP0_NO_ACTION;
++ dev->driver->setup(&dev->gadget, &req);
++}
++
++/*
++ * pxa27x_udc_irq - interrupt handler
++ *
++ * avoid delays in ep0 processing. the control handshaking isn't always
++ * under software control (pxa250c0 and the pxa255 are better), and delays
++ * could cause usb protocol errors.
++ */
++static irqreturn_t pxa27x_udc_irq(int irq, void *_dev)
++{
++ struct pxa27x_udc *dev = _dev;
++ int handled;
++
++ dev->stats.irqs++;
++ HEX_DISPLAY(dev->stats.irqs);
++
++ DBG(DBG_VERBOSE, "Interrupt, UDCISR0:0x%08x, UDCISR1:0x%08x, "
++ "UDCCR:0x%08x\n", UDCISR0, UDCISR1, UDCCR);
++
++ do {
++ u32 udcir = UDCISR1 & 0xF8000000;
++
++ handled = 0;
++
++ /* SUSpend Interrupt Request */
++ if (unlikely(udcir & UDCISR1_IRSU)) {
++ UDCISR1 = UDCISR1_IRSU;
++ handled = 1;
++ DBG(DBG_VERBOSE, "USB suspend\n");
++ if (dev->gadget.speed != USB_SPEED_UNKNOWN
++ && dev->driver && dev->driver->suspend)
++ dev->driver->suspend(&dev->gadget);
++ ep0_idle(dev);
++ }
++
++ /* RESume Interrupt Request */
++ if (unlikely(udcir & UDCISR1_IRRU)) {
++ UDCISR1 = UDCISR1_IRRU;
++ handled = 1;
++ DBG(DBG_VERBOSE, "USB resume\n");
++
++ if (dev->gadget.speed != USB_SPEED_UNKNOWN
++ && dev->driver && dev->driver->resume)
++ dev->driver->resume(&dev->gadget);
++ }
++
++ if (unlikely(udcir & UDCISR1_IRCC)) {
++ unsigned config, interface, alternate;
++
++ handled = 1;
++ DBG(DBG_VERBOSE, "USB SET_CONFIGURATION or "
++ "SET_INTERFACE command received\n");
++
++ UDCCR |= UDCCR_SMAC;
++
++ config = (UDCCR & UDCCR_ACN) >> UDCCR_ACN_S;
++
++ if (dev->configuration != config) {
++ dev->configuration = config;
++ pxa27x_change_configuration(dev);
++ }
++
++ interface = (UDCCR & UDCCR_AIN) >> UDCCR_AIN_S;
++ alternate = (UDCCR & UDCCR_AAISN) >> UDCCR_AAISN_S;
++
++ if ((dev->configuration != interface) ||
++ (dev->alternate != alternate)) {
++ dev->interface = config;
++ dev->alternate = alternate;
++ pxa27x_change_interface(dev);
++ }
++
++ UDCISR1 = UDCISR1_IRCC;
++ DMSG("%s: con:%d,inter:%d,alt:%d\n",
++ __FUNCTION__, config, interface, alternate);
++ }
++
++ /* ReSeT Interrupt Request - USB reset */
++ if (unlikely(udcir & UDCISR1_IRRS)) {
++ UDCISR1 = UDCISR1_IRRS;
++ handled = 1;
++
++ if ((UDCCR & UDCCR_UDA) == 0) {
++ DBG(DBG_VERBOSE, "SB reset start\n");
++
++ /* reset driver and endpoints,
++ * in case that's not yet done
++ */
++ stop_activity(dev, dev->driver);
++
++ }
++ INFO("USB reset\n");
++ dev->gadget.speed = USB_SPEED_FULL;
++ memset(&dev->stats, 0, sizeof dev->stats);
++
++ } else {
++ u32 udcisr0 = UDCISR0;
++ u32 udcisr1 = UDCISR1 & 0xFFFF;
++ int i;
++
++ if (unlikely(!udcisr0 && !udcisr1))
++ continue;
++
++ DBG(DBG_VERY_NOISY, "irq %02x.%02x\n", udcisr1,
++ udcisr0);
++
++ /* control traffic */
++ if (udcisr0 & UDCISR0_IR0) {
++ dev->ep[0].pio_irqs++;
++ handle_ep0(dev);
++ handled = 1;
++ }
++
++ udcisr0 >>= 2;
++ /* endpoint data transfers */
++ for (i = 1; udcisr0 != 0 && i < 16; udcisr0 >>= 2, i++) {
++ UDCISR0 = UDCISR_INT(i, UDCISR_INT_MASK);
++
++ if (udcisr0 & UDC_INT_FIFOERROR)
++ printk(KERN_ERR
++ " Endpoint %d Fifo error\n", i);
++ if (udcisr0 & UDC_INT_PACKETCMP) {
++ handle_ep(&dev->ep[i]);
++ handled = 1;
++ }
++
++ }
++
++ for (i = 0; udcisr1 != 0 && i < 8; udcisr1 >>= 2, i++) {
++ UDCISR1 = UDCISR_INT(i, UDCISR_INT_MASK);
++
++ if (udcisr1 & UDC_INT_FIFOERROR) {
++ printk(KERN_ERR
++ " Endpoint %d fifo error\n",
++ (i + 16));
++ }
++
++ if (udcisr1 & UDC_INT_PACKETCMP) {
++ handle_ep(&dev->ep[i + 16]);
++ handled = 1;
++ }
++ }
++ }
++
++ /* we could also ask for 1 msec SOF (SIR) interrupts */
++
++ } while (handled);
++ return IRQ_HANDLED;
++}
++
++static void udc_init_ep(struct pxa27x_udc *dev)
++{
++ int i;
++
++ INIT_LIST_HEAD(&dev->gadget.ep_list);
++ INIT_LIST_HEAD(&dev->gadget.ep0->ep_list);
++
++ for (i = 0; i < UDC_EP_NUM; i++) {
++ struct pxa27x_ep *ep = &dev->ep[i];
++
++ ep->dma = -1;
++ if (i != 0) {
++ memset(ep, 0, sizeof(*ep));
++ }
++ INIT_LIST_HEAD(&ep->queue);
++ }
++}
++
++/*-------------------------------------------------------------------------*/
++
++static void nop_release(struct device *dev)
++{
++ DMSG("%s %s\n", __FUNCTION__, dev->bus_id);
++}
++
++/* this uses load-time allocation and initialization (instead of
++ * doing it at run-time) to save code, eliminate fault paths, and
++ * be more obviously correct.
++ */
++static struct pxa27x_udc memory = {
++ .gadget = {
++ .ops = &pxa27x_udc_ops,
++ .ep0 = &memory.ep[0].ep,
++ .name = driver_name,
++ .dev = {
++ .bus_id = "gadget",
++ .release = nop_release,
++ },
++ },
++
++ /* control endpoint */
++ .ep[0] = {
++ .ep = {
++ .name = ep0name,
++ .ops = &pxa27x_ep_ops,
++ .maxpacket = EP0_FIFO_SIZE,
++ },
++ .dev = &memory,
++ .reg_udccsr = &UDCCSR0,
++ .reg_udcdr = &UDCDR0,
++ }
++};
++
++#define CP15R0_VENDOR_MASK 0xffffe000
++
++#define CP15R0_XSCALE_VALUE 0x69054000 /* intel/arm/xscale */
++
++/*
++ * probe - binds to the platform device
++ */
++static int __init pxa27x_udc_probe(struct platform_device *pdev)
++{
++ struct device *dev = &pdev->dev;
++ struct pxa27x_udc *udc = &memory;
++ int irq, retval;
++ u32 chiprev;
++
++ /* insist on Intel/ARM/XScale */
++ asm("mrc%? p15, 0, %0, c0, c0":"=r"(chiprev));
++ if ((chiprev & CP15R0_VENDOR_MASK) != CP15R0_XSCALE_VALUE) {
++ printk(KERN_ERR "%s: not XScale!\n", driver_name);
++ return -ENODEV;
++ }
++
++ irq = platform_get_irq(pdev, 0);
++ if (irq < 0)
++ return -ENODEV;
++ pr_debug("%s: IRQ %d\n", driver_name, irq);
++
++ /* other non-static parts of init */
++ udc->dev = dev;
++ udc->mach = dev->platform_data;
++
++ /* Disable irq, erase old events and disable the pull up on the bus */
++ UDCICR0 = 0x00000000;
++ UDCICR1 = 0x00000000;
++ UDCISR0 = 0xffffffff;
++ UDCISR1 = 0xffffffff;
++ if (udc->mach->gpio_pullup) {
++ if ((retval = gpio_request(udc->mach->gpio_pullup,
++ "pca2xx_udc GPIO PULLUP"))) {
++ dev_dbg(&pdev->dev,
++ "can't get pullup gpio %d, err: %d\n",
++ udc->mach->gpio_pullup, retval);
++ if (udc->mach->gpio_vbus)
++ gpio_free(udc->mach->gpio_vbus);
++ return -EBUSY;
++ }
++ gpio_direction_output(udc->mach->gpio_pullup, 0);
++ }
++
++ init_timer(&udc->timer);
++ udc->timer.function = udc_watchdog;
++ udc->timer.data = (unsigned long)udc;
++
++ device_initialize(&udc->gadget.dev);
++ udc->gadget.dev.parent = dev;
++ udc->gadget.dev.dma_mask = dev->dma_mask;
++
++ the_controller = udc;
++ dev_set_drvdata(dev, udc);
++
++ udc_disable(udc);
++ udc_init_ep(udc);
++ udc_reinit(udc);
++
++ /* irq setup after old hardware state is cleaned up */
++ retval = request_irq(irq, pxa27x_udc_irq, 0, driver_name, udc);
++ if (retval != 0) {
++ printk(KERN_ERR "%s: can't get irq %i, err %d\n",
++ driver_name, irq, retval);
++ return -EBUSY;
++ }
++ udc->got_irq = 1;
++
++ create_proc_files();
++
++ return 0;
++}
++
++static void pxa27x_udc_shutdown(struct platform_device *_dev)
++{
++ pullup_off();
++}
++
++static int __exit pxa27x_udc_remove(struct platform_device *pdev)
++{
++ struct device *dev = &pdev->dev;
++ struct pxa27x_udc *udc = dev->driver_data;
++
++ udc_disable(udc);
++ remove_proc_files();
++ usb_gadget_unregister_driver(udc->driver);
++
++ if (udc->got_irq) {
++ free_irq(platform_get_irq(pdev, 0), udc);
++ udc->got_irq = 0;
++ }
++ if (machine_is_lubbock() && udc->got_disc) {
++ free_irq(LUBBOCK_USB_DISC_IRQ, udc);
++ udc->got_disc = 0;
++ }
++ dev_set_drvdata(dev, 0);
++ the_controller = 0;
++ return 0;
++}
++
++#ifdef CONFIG_PM
++static int pxa27x_udc_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct device *dev = &pdev->dev;
++ struct pxa27x_udc *udc = dev->driver_data;
++ int i;
++
++ DMSG("%s will go into SUSPEND_POWER_DOWN\n", __FUNCTION__);
++ udc->udccsr0 = UDCCSR0;
++ for (i = 1; (i < UDC_EP_NUM); i++) {
++ if (udc->ep[i].assigned) {
++ struct pxa27x_ep *ep = &udc->ep[i];
++
++ ep->udccsr_value = *ep->reg_udccsr;
++ ep->udccr_value = *ep->reg_udccr;
++ DMSG("EP%d, udccsr:0x%x, udccr:0x%x\n",
++ i, *ep->reg_udccsr, *ep->reg_udccr);
++ }
++ }
++
++ udc_clear_mask_UDCCR(UDCCR_UDE);
++ pxa_set_cken(CKEN_USB, 0);
++
++ return 0;
++}
++
++static int pxa27x_udc_resume(struct platform_device *pdev)
++{
++ struct device *dev = &pdev->dev;
++ struct pxa27x_udc *udc = dev->driver_data;
++ int i;
++
++ DMSG("%s: udc resume\n", __FUNCTION__);
++
++ UDCCSR0 = udc->udccsr0 & (UDCCSR0_FST | UDCCSR0_DME);
++ for (i = 1; i < UDC_EP_NUM; i++) {
++ if (udc->ep[i].assigned) {
++ struct pxa27x_ep *ep = &udc->ep[i];
++
++ *ep->reg_udccsr = ep->udccsr_value;
++ *ep->reg_udccr = ep->udccr_value;
++ DMSG("EP%d, udccsr:0x%x, udccr:0x%x\n",
++ i, *ep->reg_udccsr, *ep->reg_udccr);
++ }
++ }
++ udc_enable(udc);
++ /* OTGPH bit is set when sleep mode is entered.
++ * it indicates that OTG pad is retaining its state.
++ * Upon exit from sleep mode and before clearing OTGPH,
++ * Software must configure the USB OTG pad, UDC, and UHC
++ * to the state they were in before entering sleep mode.*/
++ PSSR |= PSSR_OTGPH;
++
++ return 0;
++}
++#else
++#define pxa27x_udc_suspend NULL
++#define pxa27x_udc_resume NULL
++#endif
++
++/*-------------------------------------------------------------------------*/
++
++static struct platform_driver pxa27x_udc_driver = {
++ .shutdown = pxa27x_udc_shutdown,
++ .remove = __exit_p(pxa27x_udc_remove),
++ .suspend = pxa27x_udc_suspend,
++ .resume = pxa27x_udc_resume,
++ .driver = {
++ .owner = THIS_MODULE,
++ .name = "pxa27x-udc",
++ },
++};
++
++static int __init udc_init(void)
++{
++ printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
++ return platform_driver_probe(&pxa27x_udc_driver, pxa27x_udc_probe);
++}
++
++static void __exit udc_exit(void)
++{
++ platform_driver_unregister(&pxa27x_udc_driver);
++}
++
++module_init(udc_init);
++module_exit(udc_exit);
++
++MODULE_DESCRIPTION(DRIVER_DESC);
++MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell, Rodolfo Giometti");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23/drivers/usb/gadget/pxa27x_udc.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/usb/gadget/pxa27x_udc.h 2007-10-23 12:48:34.000000000 +0200
+@@ -0,0 +1,304 @@
++/*
++ * linux/drivers/usb/gadget/pxa27x_udc.h
++ * Intel PXA27x on-chip full speed USB device controller
++ *
++ * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
++ * Copyright (C) 2003 David Brownell
++ * Copyright (C) 2004 Intel 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
++ */
++
++#ifndef __LINUX_USB_GADGET_PXA27X_H
++#define __LINUX_USB_GADGET_PXA27X_H
++
++#include <linux/types.h>
++
++struct pxa27x_udc;
++
++struct pxa27x_ep {
++ struct usb_ep ep;
++ struct pxa27x_udc *dev;
++
++ const struct usb_endpoint_descriptor *desc;
++ struct list_head queue;
++ unsigned long pio_irqs;
++ unsigned long dma_irqs;
++
++ int dma;
++ unsigned fifo_size;
++ unsigned ep_num;
++ unsigned ep_type;
++
++ unsigned stopped : 1;
++ unsigned dma_con : 1;
++ unsigned dir_in : 1;
++ unsigned assigned : 1;
++
++ unsigned config;
++ unsigned interface;
++ unsigned aisn;
++ /* UDCCSR = UDC Control/Status Register for this EP
++ * UBCR = UDC Byte Count Remaining (contents of OUT fifo)
++ * UDCDR = UDC Endpoint Data Register (the fifo)
++ * UDCCR = UDC Endpoint Configuration Registers
++ * DRCM = DMA Request Channel Map
++ */
++ volatile u32 *reg_udccsr;
++ volatile u32 *reg_udcbcr;
++ volatile u32 *reg_udcdr;
++ volatile u32 *reg_udccr;
++#ifdef USE_DMA
++ volatile u32 *reg_drcmr;
++#define drcmr(n) .reg_drcmr = & DRCMR ## n ,
++#else
++#define drcmr(n)
++#endif
++
++#ifdef CONFIG_PM
++ unsigned udccsr_value;
++ unsigned udccr_value;
++#endif
++};
++
++struct pxa27x_request {
++ struct usb_request req;
++ struct list_head queue;
++};
++
++enum ep0_state {
++ EP0_IDLE,
++ EP0_IN_DATA_PHASE,
++ EP0_OUT_DATA_PHASE,
++// EP0_END_XFER,
++ EP0_STALL,
++ EP0_NO_ACTION
++};
++
++#define EP0_FIFO_SIZE ((unsigned)16)
++#define BULK_FIFO_SIZE ((unsigned)64)
++#define ISO_FIFO_SIZE ((unsigned)256)
++#define INT_FIFO_SIZE ((unsigned)8)
++
++struct udc_stats {
++ struct ep0stats {
++ unsigned long ops;
++ unsigned long bytes;
++ } read, write;
++ unsigned long irqs;
++};
++
++#ifdef CONFIG_USB_PXA27X_SMALL
++/* when memory's tight, SMALL config saves code+data. */
++//#undef USE_DMA
++//#define UDC_EP_NUM 3
++#endif
++
++#ifndef UDC_EP_NUM
++#define UDC_EP_NUM 24
++#endif
++
++struct pxa27x_udc {
++ struct usb_gadget gadget;
++ struct usb_gadget_driver *driver;
++
++ enum ep0_state ep0state;
++ struct udc_stats stats;
++ unsigned got_irq : 1,
++ got_disc : 1,
++ has_cfr : 1,
++ req_pending : 1,
++ req_std : 1,
++ req_config : 1;
++
++#define start_watchdog(dev) mod_timer(&dev->timer, jiffies + (HZ/200))
++ struct timer_list timer;
++
++ struct device *dev;
++ struct pxa2xx_udc_mach_info *mach;
++ u64 dma_mask;
++ struct pxa27x_ep ep [UDC_EP_NUM];
++
++ unsigned configuration,
++ interface,
++ alternate;
++#ifdef CONFIG_PM
++ unsigned udccsr0;
++#endif
++};
++
++/*-------------------------------------------------------------------------*/
++#if 0
++#ifdef DEBUG
++#define HEX_DISPLAY(n) do { \
++ if (machine_is_mainstone())\
++ { MST_LEDDAT1 = (n); } \
++ } while(0)
++
++#define HEX_DISPLAY1(n) HEX_DISPLAY(n)
++
++#define HEX_DISPLAY2(n) do { \
++ if (machine_is_mainstone()) \
++ { MST_LEDDAT2 = (n); } \
++ } while(0)
++
++#endif /* DEBUG */
++#endif
++/*-------------------------------------------------------------------------*/
++
++/* LEDs are only for debug */
++#ifndef HEX_DISPLAY
++#define HEX_DISPLAY(n) do {} while(0)
++#endif
++
++#ifndef LED_CONNECTED_ON
++#define LED_CONNECTED_ON do {} while(0)
++#define LED_CONNECTED_OFF do {} while(0)
++#endif
++#ifndef LED_EP0_ON
++#define LED_EP0_ON do {} while (0)
++#define LED_EP0_OFF do {} while (0)
++#endif
++
++static struct pxa27x_udc *the_controller;
++
++/*-------------------------------------------------------------------------*/
++
++/*
++ * Debugging support vanishes in non-debug builds. DBG_NORMAL should be
++ * mostly silent during normal use/testing, with no timing side-effects.
++ */
++#define DBG_NORMAL 1 /* error paths, device state transitions */
++#define DBG_VERBOSE 2 /* add some success path trace info */
++#define DBG_NOISY 3 /* ... even more: request level */
++#define DBG_VERY_NOISY 4 /* ... even more: packet level */
++
++#ifdef DEBUG
++
++static const char *state_name[] = {
++ "EP0_IDLE",
++ "EP0_IN_DATA_PHASE", "EP0_OUT_DATA_PHASE",
++ "EP0_END_XFER", "EP0_STALL"
++};
++
++#define DMSG(stuff...) printk(KERN_ERR "udc: " stuff)
++
++#ifdef VERBOSE
++# define UDC_DEBUG DBG_VERBOSE
++#else
++# define UDC_DEBUG DBG_NORMAL
++#endif
++
++static void __attribute__ ((__unused__))
++dump_udccr(const char *label)
++{
++ u32 udccr = UDCCR;
++ DMSG("%s 0x%08x =%s%s%s%s%s%s%s%s%s%s, con=%d,inter=%d,altinter=%d\n",
++ label, udccr,
++ (udccr & UDCCR_OEN) ? " oen":"",
++ (udccr & UDCCR_AALTHNP) ? " aalthnp":"",
++ (udccr & UDCCR_AHNP) ? " rem" : "",
++ (udccr & UDCCR_BHNP) ? " rstir" : "",
++ (udccr & UDCCR_DWRE) ? " dwre" : "",
++ (udccr & UDCCR_SMAC) ? " smac" : "",
++ (udccr & UDCCR_EMCE) ? " emce" : "",
++ (udccr & UDCCR_UDR) ? " udr" : "",
++ (udccr & UDCCR_UDA) ? " uda" : "",
++ (udccr & UDCCR_UDE) ? " ude" : "",
++ (udccr & UDCCR_ACN) >> UDCCR_ACN_S,
++ (udccr & UDCCR_AIN) >> UDCCR_AIN_S,
++ (udccr & UDCCR_AAISN)>> UDCCR_AAISN_S );
++}
++
++static void __attribute__ ((__unused__))
++dump_udccsr0(const char *label)
++{
++ u32 udccsr0 = UDCCSR0;
++
++ DMSG("%s %s 0x%08x =%s%s%s%s%s%s%s\n",
++ label, state_name[the_controller->ep0state], udccsr0,
++ (udccsr0 & UDCCSR0_SA) ? " sa" : "",
++ (udccsr0 & UDCCSR0_RNE) ? " rne" : "",
++ (udccsr0 & UDCCSR0_FST) ? " fst" : "",
++ (udccsr0 & UDCCSR0_SST) ? " sst" : "",
++ (udccsr0 & UDCCSR0_DME) ? " dme" : "",
++ (udccsr0 & UDCCSR0_IPR) ? " ipr" : "",
++ (udccsr0 & UDCCSR0_OPC) ? " opr" : "");
++}
++
++static void __attribute__ ((__unused__))
++dump_state(struct pxa27x_udc *dev)
++{
++ unsigned i;
++
++ DMSG("%s, udcicr %02X.%02X, udcsir %02X.%02x, udcfnr %02X\n",
++ state_name[dev->ep0state],
++ UDCICR1, UDCICR0, UDCISR1, UDCISR0, UDCFNR);
++ dump_udccr("udccr");
++
++ if (!dev->driver) {
++ DMSG("no gadget driver bound\n");
++ return;
++ } else
++ DMSG("ep0 driver '%s'\n", dev->driver->driver.name);
++
++
++ dump_udccsr0 ("udccsr0");
++ DMSG("ep0 IN %lu/%lu, OUT %lu/%lu\n",
++ dev->stats.write.bytes, dev->stats.write.ops,
++ dev->stats.read.bytes, dev->stats.read.ops);
++
++ for (i = 1; i < UDC_EP_NUM; i++) {
++ if (dev->ep [i].desc == 0)
++ continue;
++ DMSG ("udccs%d = %02x\n", i, *dev->ep->reg_udccsr);
++ }
++}
++
++#if 0
++static void dump_regs(u8 ep)
++{
++ DMSG("EP:%d UDCCSR:0x%08x UDCBCR:0x%08x\n UDCCR:0x%08x\n",
++ ep,UDCCSN(ep), UDCBCN(ep), UDCCN(ep));
++}
++static void dump_req (struct pxa27x_request *req)
++{
++ struct usb_request *r = &req->req;
++
++ DMSG("%s: buf:0x%08x length:%d dma:0x%08x actual:%d\n",
++ __FUNCTION__, (unsigned)r->buf, r->length,
++ r->dma, r->actual);
++}
++#endif
++
++#else
++
++#define DMSG(stuff...) do{}while(0)
++
++#define dump_udccr(x) do{}while(0)
++#define dump_udccsr0(x) do{}while(0)
++#define dump_state(x) do{}while(0)
++
++#define UDC_DEBUG ((unsigned)0)
++
++#endif
++
++#define DBG(lvl, stuff...) do{if ((lvl) <= UDC_DEBUG) DMSG(stuff);}while(0)
++
++#define WARN(stuff...) printk(KERN_WARNING "udc: " stuff)
++#define INFO(stuff...) printk(KERN_INFO "udc: " stuff)
++
++
++#endif /* __LINUX_USB_GADGET_PXA27X_H */
+Index: linux-2.6.23/drivers/usb/gadget/serial.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/serial.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/serial.c 2007-10-23 12:48:34.000000000 +0200
+@@ -1378,20 +1378,20 @@
+
+ usb_ep_autoconfig_reset(gadget);
+
+- ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc);
++ ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ EP_IN_NAME = ep->name;
+ ep->driver_data = ep; /* claim the endpoint */
+
+- ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc);
++ ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ EP_OUT_NAME = ep->name;
+ ep->driver_data = ep; /* claim the endpoint */
+
+ if (use_acm) {
+- ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc);
++ ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc, 0, 0, 0);
+ if (!ep) {
+ printk(KERN_ERR "gs_bind: cannot run ACM on %s\n", gadget->name);
+ goto autoconf_fail;
+Index: linux-2.6.23/drivers/usb/gadget/zero.c
+===================================================================
+--- linux-2.6.23.orig/drivers/usb/gadget/zero.c 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/drivers/usb/gadget/zero.c 2007-10-23 12:48:34.000000000 +0200
+@@ -1154,7 +1154,7 @@
+ * but there may also be important quirks to address.
+ */
+ usb_ep_autoconfig_reset (gadget);
+- ep = usb_ep_autoconfig (gadget, &fs_source_desc);
++ ep = usb_ep_autoconfig (gadget, &fs_source_desc, 0, 0, 0);
+ if (!ep) {
+ autoconf_fail:
+ printk (KERN_ERR "%s: can't autoconfigure on %s\n",
+@@ -1164,7 +1164,7 @@
+ EP_IN_NAME = ep->name;
+ ep->driver_data = ep; /* claim */
+
+- ep = usb_ep_autoconfig (gadget, &fs_sink_desc);
++ ep = usb_ep_autoconfig (gadget, &fs_sink_desc, 0, 0, 0);
+ if (!ep)
+ goto autoconf_fail;
+ EP_OUT_NAME = ep->name;
+Index: linux-2.6.23/include/asm-arm/arch-pxa/udc.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/udc.h 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/udc.h 2007-10-23 12:48:34.000000000 +0200
+@@ -2,6 +2,7 @@
+ * linux/include/asm-arm/arch-pxa/udc.h
+ *
+ */
++#include <asm/arch/pxa-regs.h>
+ #include <asm/mach/udc_pxa2xx.h>
+
+ extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
+Index: linux-2.6.23/include/linux/usb_gadget.h
+===================================================================
+--- linux-2.6.23.orig/include/linux/usb_gadget.h 2007-10-23 12:47:11.000000000 +0200
++++ linux-2.6.23/include/linux/usb_gadget.h 2007-10-23 12:48:34.000000000 +0200
+@@ -397,10 +397,28 @@
+
+ struct usb_gadget;
+
++/**
++ * struct usb_endpoint_config - possible configurations of a given endpoint
++ * @config: the configuration number
++ * @interface: the interface number
++ * @altinterface: the altinterface number
++ *
++ * Used as an array to pass information about the possible configurations
++ * of a given endpoint to the bus controller.
++ */
++struct usb_endpoint_config {
++ int config;
++ int interface;
++ int altinterface;
++};
++
+ /* the rest of the api to the controller hardware: device operations,
+ * which don't involve endpoints (or i/o).
+ */
+ struct usb_gadget_ops {
++ struct usb_ep* (*ep_alloc)(struct usb_gadget *gadget,
++ struct usb_endpoint_descriptor *desc,
++ int config, int interface, int alt);
+ int (*get_frame)(struct usb_gadget *);
+ int (*wakeup)(struct usb_gadget *);
+ int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered);
+@@ -824,7 +842,8 @@
+ /* utility wrapping a simple endpoint selection policy */
+
+ extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *,
+- struct usb_endpoint_descriptor *) __devinit;
++ struct usb_endpoint_descriptor *,
++ int, int, int) __devinit;
+
+ extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit;
+
diff --git a/packages/linux/linux-ezx-2.6.23/patches/pxa27x_overlay-r7.patch b/packages/linux/linux-ezx-2.6.23/patches/pxa27x_overlay-r7.patch
new file mode 100644
index 0000000000..7eca9301ac
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/pxa27x_overlay-r7.patch
@@ -0,0 +1,2436 @@
+ drivers/video/Kconfig | 18
+ drivers/video/Makefile | 1
+ drivers/video/pxafb.c | 305 +++++--
+ drivers/video/pxafb.h | 65 +
+ drivers/video/pxafb_overlay.c | 1525 ++++++++++++++++++++++++++++++++++++
+ include/asm-arm/arch-pxa/pxa-regs.h | 111 ++
+ 6 files changed, 1969 insertions(+), 56 deletions(-)
+
+Index: linux-2.6.23/drivers/video/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/video/Kconfig 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/drivers/video/Kconfig 2007-10-22 21:53:54.000000000 +0200
+@@ -1682,6 +1682,24 @@
+
+ If unsure, say N.
+
++choice
++ prompt "PXA LCD type"
++ depends on FB_PXA
++
++config FB_PXA_LCD_QVGA
++ bool "QVGA(320x240)"
++
++config FB_PXA_LCD_VGA
++ bool "VGA (640x480)"
++
++endchoice
++
++config FB_PXA_OVERLAY
++ tristate "PXA LCD overlay support"
++ depends on FB_PXA
++ ---help---
++ Frame buffer overlay driver for PXA27x
++
+ config FB_PXA_PARAMETERS
+ bool "PXA LCD command line parameters"
+ default n
+Index: linux-2.6.23/drivers/video/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/video/Makefile 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/drivers/video/Makefile 2007-10-22 21:53:54.000000000 +0200
+@@ -96,6 +96,7 @@
+ obj-$(CONFIG_FB_CIRRUS) += cirrusfb.o
+ obj-$(CONFIG_FB_ASILIANT) += asiliantfb.o
+ obj-$(CONFIG_FB_PXA) += pxafb.o
++obj-$(CONFIG_FB_PXA_OVERLAY) += pxafb_overlay.o
+ obj-$(CONFIG_FB_W100) += w100fb.o
+ obj-$(CONFIG_FB_AU1100) += au1100fb.o
+ obj-$(CONFIG_FB_AU1200) += au1200fb.o
+Index: linux-2.6.23/drivers/video/pxafb.c
+===================================================================
+--- linux-2.6.23.orig/drivers/video/pxafb.c 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/drivers/video/pxafb.c 2007-10-22 22:01:00.000000000 +0200
+@@ -58,17 +58,49 @@
+ #define LCCR0_INVALID_CONFIG_MASK (LCCR0_OUM|LCCR0_BM|LCCR0_QDM|LCCR0_DIS|LCCR0_EFM|LCCR0_IUM|LCCR0_SFM|LCCR0_LDM|LCCR0_ENB)
+ #define LCCR3_INVALID_CONFIG_MASK (LCCR3_HSP|LCCR3_VSP|LCCR3_PCD|LCCR3_BPP)
+
++wait_queue_head_t fcs_wait_eof;
++int fcs_in_eof;
++static DECLARE_MUTEX(fcs_lcd_sem);
++
+ static void (*pxafb_backlight_power)(int);
+ static void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
+
+ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *);
+-static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
++void pxafb_set_ctrlr_state(struct pxafb_info *fbi, u_int state);
+
+ #ifdef CONFIG_FB_PXA_PARAMETERS
+ #define PXAFB_OPTIONS_SIZE 256
+ static char g_options[PXAFB_OPTIONS_SIZE] __devinitdata = "";
+ #endif
+
++static struct pxafb_rgb def_rgb_8 = {
++ red: { offset: 0, length: 8, },
++ green: { offset: 0, length: 8, },
++ blue: { offset: 0, length: 8, },
++ transp: { offset: 0, length: 0, },
++};
++
++static struct pxafb_rgb def_rgb_16 = {
++ red: { offset: 11, length: 5, },
++ green: { offset: 5, length: 6, },
++ blue: { offset: 0, length: 5, },
++ transp: { offset: 0, length: 0, },
++};
++
++static struct pxafb_rgb def_rgb_18 = {
++ red: { offset: 12, length: 6, },
++ green: { offset: 6, length: 6, },
++ blue: { offset: 0, length: 6, },
++ transp: { offset: 0, length: 0, },
++};
++
++static struct pxafb_rgb def_rgb_24 = {
++ red: { offset: 16, length: 8, },
++ green: { offset: 8, length: 8, },
++ blue: { offset: 0, length: 8, },
++ transp: { offset: 0, length: 0, },
++};
++
+ static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state)
+ {
+ unsigned long flags;
+@@ -190,6 +222,10 @@
+ case 4: ret = LCCR3_4BPP; break;
+ case 8: ret = LCCR3_8BPP; break;
+ case 16: ret = LCCR3_16BPP; break;
++ case 18: ret = LCCR3_18BPP; break;
++ case 19: ret = LCCR3_19BPP; break;
++ case 24: ret = LCCR3_24BPP; break;
++ case 25: ret = LCCR3_25BPP; break;
+ }
+ return ret;
+ }
+@@ -301,18 +337,34 @@
+ * The pixel packing format is described on page 7-11 of the
+ * PXA2XX Developer's Manual.
+ */
+- if (var->bits_per_pixel == 16) {
+- var->red.offset = 11; var->red.length = 5;
+- var->green.offset = 5; var->green.length = 6;
+- var->blue.offset = 0; var->blue.length = 5;
+- var->transp.offset = var->transp.length = 0;
+- } else {
+- var->red.offset = var->green.offset = var->blue.offset = var->transp.offset = 0;
+- var->red.length = 8;
+- var->green.length = 8;
+- var->blue.length = 8;
+- var->transp.length = 0;
+- }
++ switch (var->bits_per_pixel) {
++ case 16:
++ /* 2 pixels per line */
++ var->red = def_rgb_16.red;
++ var->green = def_rgb_16.green;
++ var->blue = def_rgb_16.blue;
++ var->transp = def_rgb_16.transp;
++ break;
++ case 18:
++ case 19:
++ var->red = def_rgb_18.red;
++ var->green = def_rgb_18.green;
++ var->blue = def_rgb_18.blue;
++ var->transp = def_rgb_18.transp;
++ break;
++ case 24:
++ case 25:
++ var->red = def_rgb_24.red;
++ var->green = def_rgb_24.green;
++ var->blue = def_rgb_24.blue;
++ var->transp = def_rgb_24.transp;
++ break;
++ default:
++ var->red = def_rgb_8.red;
++ var->green = def_rgb_8.green;
++ var->blue = def_rgb_8.blue;
++ var->transp = def_rgb_8.transp;
++ }
+
+ #ifdef CONFIG_CPU_FREQ
+ pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n",
+@@ -326,7 +378,7 @@
+ static inline void pxafb_set_truecolor(u_int is_true_color)
+ {
+ pr_debug("pxafb: true_color = %d\n", is_true_color);
+- // do your machine-specific setup if needed
++ /* do your machine-specific setup if needed */
+ }
+
+ /*
+@@ -341,7 +393,8 @@
+
+ pr_debug("pxafb: set_par\n");
+
+- if (var->bits_per_pixel == 16)
++ if (var->bits_per_pixel == 16 || var->bits_per_pixel == 18 ||var->bits_per_pixel == 19
++ || var->bits_per_pixel == 24 || var->bits_per_pixel == 25)
+ fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
+ else if (!fbi->cmap_static)
+ fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
+@@ -354,12 +407,25 @@
+ fbi->fb.fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
+ }
+
+- fbi->fb.fix.line_length = var->xres_virtual *
+- var->bits_per_pixel / 8;
+- if (var->bits_per_pixel == 16)
+- fbi->palette_size = 0;
+- else
+- fbi->palette_size = var->bits_per_pixel == 1 ? 4 : 1 << var->bits_per_pixel;
++ switch (var->bits_per_pixel) {
++ case 16:
++ fbi->fb.fix.line_length = var->xres_virtual * 2;
++ fbi->palette_size = 0;
++ break;
++ case 18:
++ case 19:
++ fbi->fb.fix.line_length = var->xres_virtual * 3;
++ fbi->palette_size = 0;
++ break;
++ case 24:
++ case 25:
++ fbi->fb.fix.line_length = var->xres_virtual * 4;
++ fbi->palette_size = 0;
++ break;
++ default:
++ fbi->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8;
++ fbi->palette_size = var->bits_per_pixel == 1 ? 4 : 1 << var->bits_per_pixel;
++ }
+
+ palette_mem_size = fbi->palette_size * sizeof(u16);
+
+@@ -373,7 +439,8 @@
+ */
+ pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR);
+
+- if (fbi->fb.var.bits_per_pixel == 16)
++ if (fbi->fb.var.bits_per_pixel == 16 || fbi->fb.var.bits_per_pixel == 18 ||fbi->fb.var.bits_per_pixel == 19
++ || fbi->fb.var.bits_per_pixel == 24 || fbi->fb.var.bits_per_pixel == 25)
+ fb_dealloc_cmap(&fbi->fb.cmap);
+ else
+ fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0);
+@@ -419,7 +486,7 @@
+ * 16 bpp mode does not really use the palette, so this will not
+ * blank the display in all modes.
+ */
+-static int pxafb_blank(int blank, struct fb_info *info)
++int pxafb_blank(int blank, struct fb_info *info)
+ {
+ struct pxafb_info *fbi = (struct pxafb_info *)info;
+ int i;
+@@ -436,19 +503,20 @@
+ for (i = 0; i < fbi->palette_size; i++)
+ pxafb_setpalettereg(i, 0, 0, 0, 0, info);
+
+- pxafb_schedule_work(fbi, C_DISABLE);
+- //TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
++ pxafb_schedule_work(fbi, C_BLANK);
++ /* TODO if (pxafb_blank_helper) pxafb_blank_helper(blank); */
+ break;
+
+ case FB_BLANK_UNBLANK:
+- //TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
++ /* TODO if (pxafb_blank_helper) pxafb_blank_helper(blank); */
+ if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
+ fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
+ fb_set_cmap(&fbi->fb.cmap, info);
+- pxafb_schedule_work(fbi, C_ENABLE);
++ pxafb_schedule_work(fbi, C_UNBLANK);
+ }
+ return 0;
+ }
++EXPORT_SYMBOL(pxafb_blank);
+
+ static int pxafb_mmap(struct fb_info *info,
+ struct vm_area_struct *vma)
+@@ -582,6 +650,10 @@
+ case 4:
+ case 8:
+ case 16:
++ case 18:
++ case 19:
++ case 24:
++ case 25:
+ break;
+ default:
+ printk(KERN_ERR "%s: invalid bit depth %d\n",
+@@ -613,7 +685,10 @@
+
+ new_regs.lccr0 = fbi->lccr0 |
+ (LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM |
+- LCCR0_QDM | LCCR0_BM | LCCR0_OUM);
++#ifdef CONFIG_PXA27x /* Enable overlay for PXA27x */
++ LCCR0_OUC | LCCR0_CMDIM | LCCR0_RDSTM |
++#endif
++ LCCR0_QDM | LCCR0_BM | LCCR0_OUM);
+
+ new_regs.lccr1 =
+ LCCR1_DisWdth(var->xres) +
+@@ -672,13 +747,14 @@
+
+ fbi->dmadesc_fbhigh_cpu->fsadr = fbi->screen_dma;
+ fbi->dmadesc_fbhigh_cpu->fidr = 0;
+- fbi->dmadesc_fbhigh_cpu->ldcmd = BYTES_PER_PANEL;
++ fbi->dmadesc_fbhigh_cpu->ldcmd = BYTES_PER_PANEL | LDCMD_EOFINT;
+
+ fbi->dmadesc_palette_cpu->fsadr = fbi->palette_dma;
+ fbi->dmadesc_palette_cpu->fidr = 0;
+ fbi->dmadesc_palette_cpu->ldcmd = (fbi->palette_size * 2) | LDCMD_PAL;
+
+- if (var->bits_per_pixel == 16) {
++ if (var->bits_per_pixel == 16 || var->bits_per_pixel == 18 ||var->bits_per_pixel == 19
++ || var->bits_per_pixel == 24 || var->bits_per_pixel == 25) {
+ /* palette shouldn't be loaded in true-color mode */
+ fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
+ fbi->fdadr0 = fbi->dmadesc_fbhigh_dma; /* no pal just fbhigh */
+@@ -731,8 +807,8 @@
+ }
+
+ /*
+- * NOTE! The following functions are purely helpers for set_ctrlr_state.
+- * Do not call them directly; set_ctrlr_state does the correct serialisation
++ * NOTE! The following functions are purely helpers for pxafb_set_ctrlr_state.
++ * Do not call them directly; pxafb_set_ctrlr_state does the correct serialisation
+ * to ensure that things happen in the right way 100% of time time.
+ * -- rmk
+ */
+@@ -754,7 +830,8 @@
+
+ static void pxafb_setup_gpio(struct pxafb_info *fbi)
+ {
+- int gpio, ldd_bits;
++ int gpio;
++ int ldd_bits = 0;
+ unsigned int lccr0 = fbi->lccr0;
+
+ /*
+@@ -764,28 +841,56 @@
+ /* 4 bit interface */
+ if ((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
+ (lccr0 & LCCR0_SDS) == LCCR0_Sngl &&
+- (lccr0 & LCCR0_DPD) == LCCR0_4PixMono)
++ (lccr0 & LCCR0_DPD) == LCCR0_4PixMono) {
+ ldd_bits = 4;
+-
++ }
+ /* 8 bit interface */
+ else if (((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
+ ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_DPD) == LCCR0_8PixMono)) ||
+ ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
+- (lccr0 & LCCR0_PAS) == LCCR0_Pas && (lccr0 & LCCR0_SDS) == LCCR0_Sngl))
++ (lccr0 & LCCR0_PAS) == LCCR0_Pas && (lccr0 & LCCR0_SDS) == LCCR0_Sngl)) {
+ ldd_bits = 8;
+-
++ }
+ /* 16 bit interface */
+- else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
+- ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act))
+- ldd_bits = 16;
++ else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
++ ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act)) {
++ switch (fbi->fb.var.bits_per_pixel) {
++ case 16:
++#ifdef CONFIG_PXA27x
++ /* bits 58-77 */
++ GPDR1 |= (0x3f << 26);
++ GPDR2 |= 0x00003fff;
+
++ GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
++ GAFR2_L = (GAFR2_L & 0xf0000000) | 0x0aaaaaaa;
++#endif
++ ldd_bits = 16;
++ break;
++ case 18:
++ case 19:
++ case 24:
++ case 25:
++#ifdef CONFIG_PXA27x
++ /* bits 58-77 and 86, 87 */
++ GPDR1 |= (0x3f << 26);
++ GPDR2 |= 0x00c03fff;
++
++ GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
++ GAFR2_L = (GAFR2_L & 0xf0000000) | 0x0aaaaaaa;
++ GAFR2_U = (GAFR2_U & 0xffff0fff) | 0xa000;
++#endif
++ ldd_bits = 25;
++ break;
++ }
++ }
+ else {
+ printk(KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n");
+ return;
+ }
+
+- for (gpio = 58; ldd_bits; gpio++, ldd_bits--)
++ for (gpio = 58; ldd_bits > 0; gpio++, ldd_bits--) {
+ pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT);
++ }
+ pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
+ pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
+ pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
+@@ -805,6 +910,7 @@
+ /* enable LCD controller clock */
+ pxa_set_cken(CKEN_LCD, 1);
+
++ down(&fcs_lcd_sem);
+ /* Sequence from 11.7.10 */
+ LCCR3 = fbi->reg_lccr3;
+ LCCR2 = fbi->reg_lccr2;
+@@ -815,6 +921,8 @@
+ FDADR1 = fbi->fdadr1;
+ LCCR0 |= LCCR0_ENB;
+
++ up(&fcs_lcd_sem);
++
+ pr_debug("FDADR0 0x%08x\n", (unsigned int) FDADR0);
+ pr_debug("FDADR1 0x%08x\n", (unsigned int) FDADR1);
+ pr_debug("LCCR0 0x%08x\n", (unsigned int) LCCR0);
+@@ -829,6 +937,7 @@
+
+ pr_debug("pxafb: disabling LCD controller\n");
+
++ down(&fcs_lcd_sem);
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ add_wait_queue(&fbi->ctrlr_wait, &wait);
+
+@@ -838,6 +947,7 @@
+
+ schedule_timeout(200 * HZ / 1000);
+ remove_wait_queue(&fbi->ctrlr_wait, &wait);
++ up(&fcs_lcd_sem);
+
+ /* disable LCD controller clock */
+ pxa_set_cken(CKEN_LCD, 0);
+@@ -855,6 +965,11 @@
+ LCCR0 |= LCCR0_LDM;
+ wake_up(&fbi->ctrlr_wait);
+ }
++ if (lcsr & LCSR_EOF && fcs_in_eof) {
++ LCCR0 |= LCCR0_EFM;
++ fcs_in_eof = 0;
++ wake_up(&fcs_wait_eof);
++ }
+
+ LCSR = lcsr;
+ return IRQ_HANDLED;
+@@ -865,7 +980,7 @@
+ * sleep when disabling the LCD controller, or if we get two contending
+ * processes trying to alter state.
+ */
+-static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
++void pxafb_set_ctrlr_state(struct pxafb_info *fbi, u_int state)
+ {
+ u_int old_state;
+
+@@ -887,7 +1002,9 @@
+ */
+ if (old_state != C_DISABLE && old_state != C_DISABLE_PM) {
+ fbi->state = state;
+- //TODO __pxafb_lcd_power(fbi, 0);
++ /* TODO __pxafb_lcd_power(fbi, 0); */
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_DISABLE);
+ pxafb_disable_controller(fbi);
+ }
+ break;
+@@ -901,6 +1018,8 @@
+ fbi->state = state;
+ __pxafb_backlight_power(fbi, 0);
+ __pxafb_lcd_power(fbi, 0);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_DISABLE);
+ if (old_state != C_DISABLE_CLKCHANGE)
+ pxafb_disable_controller(fbi);
+ }
+@@ -914,7 +1033,9 @@
+ if (old_state == C_DISABLE_CLKCHANGE) {
+ fbi->state = C_ENABLE;
+ pxafb_enable_controller(fbi);
+- //TODO __pxafb_lcd_power(fbi, 1);
++ /* TODO __pxafb_lcd_power(fbi, 1); */
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_ENABLE);
+ }
+ break;
+
+@@ -926,9 +1047,13 @@
+ */
+ if (old_state == C_ENABLE) {
+ __pxafb_lcd_power(fbi, 0);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_DISABLE);
+ pxafb_disable_controller(fbi);
+ pxafb_setup_gpio(fbi);
+ pxafb_enable_controller(fbi);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_ENABLE);
+ __pxafb_lcd_power(fbi, 1);
+ }
+ break;
+@@ -954,11 +1079,46 @@
+ pxafb_enable_controller(fbi);
+ __pxafb_lcd_power(fbi, 1);
+ __pxafb_backlight_power(fbi, 1);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_ENABLE);
+ }
+ break;
++
++ case C_BLANK:
++ /*
++ * Disable controller, blank overlays if exist.
++ */
++ if ((old_state != C_DISABLE) && (old_state != C_BLANK)) {
++ fbi->state = state;
++ __pxafb_backlight_power(fbi, 0);
++ __pxafb_lcd_power(fbi, 0);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_BLANK);
++ if (old_state != C_DISABLE_CLKCHANGE)
++ pxafb_disable_controller(fbi);
++ }
++ break;
++
++ case C_UNBLANK:
++ /*
++ * Power up the LCD screen, enable controller, and
++ * turn on the backlight, unblank overlays if exist.
++ */
++ if ((old_state != C_ENABLE) && (old_state != C_UNBLANK)) {
++ fbi->state = C_UNBLANK;
++ pxafb_setup_gpio(fbi);
++ pxafb_enable_controller(fbi);
++ __pxafb_lcd_power(fbi, 1);
++ __pxafb_backlight_power(fbi, 1);
++ if(fbi->set_overlay_ctrlr_state)
++ fbi->set_overlay_ctrlr_state(fbi, C_UNBLANK);
++ }
++ break;
++
+ }
+ up(&fbi->ctrlr_sem);
+ }
++EXPORT_SYMBOL(pxafb_set_ctrlr_state);
+
+ /*
+ * Our LCD controller task (which is called when we blank or unblank)
+@@ -970,7 +1130,7 @@
+ container_of(work, struct pxafb_info, task);
+ u_int state = xchg(&fbi->task_state, -1);
+
+- set_ctrlr_state(fbi, state);
++ pxafb_set_ctrlr_state(fbi, state);
+ }
+
+ #ifdef CONFIG_CPU_FREQ
+@@ -985,19 +1145,29 @@
+ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
+ {
+ struct pxafb_info *fbi = TO_INF(nb, freq_transition);
+- //TODO struct cpufreq_freqs *f = data;
++ /* TODO struct cpufreq_freqs *f = data; */
++ struct cpufreq_freqs *clkinfo;
+ u_int pcd;
++ u_int lccr3;
+
+ switch (val) {
+ case CPUFREQ_PRECHANGE:
+- set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
++ pxafb_set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
+ break;
+
+ case CPUFREQ_POSTCHANGE:
++ clkinfo = (struct cpufreq_freqs *)data;
++ /* If leaving a 13kHz state with the LCD sustained */
++ if ((clkinfo->old == 13000))
++ break;
++
+ pcd = get_pcd(fbi->fb.var.pixclock);
++ lccr3 = fbi->reg_lccr3;
+ set_hsync_time(fbi, pcd);
+ fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd);
+- set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
++ pxafb_set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
++ if (lccr3 != fbi->reg_lccr3 && !((LCCR0 & LCCR0_DIS) || !(LCCR0 & LCCR0_ENB)))
++ LCCR3 = fbi->reg_lccr3;
+ break;
+ }
+ return 0;
+@@ -1016,7 +1186,7 @@
+ printk(KERN_DEBUG "min dma period: %d ps, "
+ "new clock %d kHz\n", pxafb_display_dma_period(var),
+ policy->max);
+- // TODO: fill in min/max values
++ /* TODO: fill in min/max values */
+ break;
+ #if 0
+ case CPUFREQ_NOTIFY:
+@@ -1042,7 +1212,7 @@
+ {
+ struct pxafb_info *fbi = platform_get_drvdata(dev);
+
+- set_ctrlr_state(fbi, C_DISABLE_PM);
++ pxafb_set_ctrlr_state(fbi, C_DISABLE_PM);
+ return 0;
+ }
+
+@@ -1050,7 +1220,11 @@
+ {
+ struct pxafb_info *fbi = platform_get_drvdata(dev);
+
+- set_ctrlr_state(fbi, C_ENABLE_PM);
++ pxafb_set_ctrlr_state(fbi, C_ENABLE_PM);
++//RP#ifdef CONFIG_PXA27x
++//RP LCCR4 |= (1 << 31); /* Disable the PCD Divisor, PCDDIV */
++//RP LCCR4 |= (5 << 17); /* Undocumented feature */
++//RP#endif
+ return 0;
+ }
+ #else
+@@ -1154,11 +1328,21 @@
+ fbi->task_state = (u_char)-1;
+
+ for (i = 0; i < inf->num_modes; i++) {
+- smemlen = mode[i].xres * mode[i].yres * mode[i].bpp / 8;
++ if (mode[i].bpp <= 16) { /* 8, 16 bpp */
++ smemlen = mode[i].xres * mode[i].yres * mode[i].bpp / 8;
++ } else if ( mode[i].bpp > 19 ) { /* 24, 25 bpp */
++ smemlen = mode[i].xres * mode[i].yres * 4;
++ } else { /* 18, 19 bpp */
++ /* packed format */
++ smemlen = mode[i].xres * mode[i].yres * 3;
++ }
++
+ if (smemlen > fbi->fb.fix.smem_len)
+ fbi->fb.fix.smem_len = smemlen;
+ }
+
++ fbi->set_overlay_ctrlr_state = NULL;
++
+ init_waitqueue_head(&fbi->ctrlr_wait);
+ INIT_WORK(&fbi->task, pxafb_task);
+ init_MUTEX(&fbi->ctrlr_sem);
+@@ -1225,6 +1409,10 @@
+ case 4:
+ case 8:
+ case 16:
++ case 18:
++ case 19:
++ case 24:
++ case 25:
+ inf->modes[0].bpp = bpp;
+ dev_info(dev, "overriding bit depth: %d\n", bpp);
+ break;
+@@ -1373,7 +1561,7 @@
+ fbi = pxafb_init_fbinfo(&dev->dev);
+ if (!fbi) {
+ dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
+- ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
++ ret = -ENOMEM; /* only reason for pxafb_init_fbinfo to fail is kmalloc */
+ goto failed;
+ }
+
+@@ -1408,7 +1596,7 @@
+ }
+
+ #ifdef CONFIG_PM
+- // TODO
++ /* TODO */
+ #endif
+
+ #ifdef CONFIG_CPU_FREQ
+@@ -1421,7 +1609,12 @@
+ /*
+ * Ok, now enable the LCD controller
+ */
+- set_ctrlr_state(fbi, C_ENABLE);
++ pxafb_set_ctrlr_state(fbi, C_ENABLE);
++//#ifdef CONFIG_PXA27x
++// LCCR4 |= (1 << 31); /* Disabel the PCD Divisor, PCDDIV */
++// LCCR4 |= (5 << 17); /* Undocumented feature */
++//#endif
++ init_waitqueue_head(&fcs_wait_eof);
+
+ return 0;
+
+Index: linux-2.6.23/drivers/video/pxafb.h
+===================================================================
+--- linux-2.6.23.orig/drivers/video/pxafb.h 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/drivers/video/pxafb.h 2007-10-22 21:53:54.000000000 +0200
+@@ -29,6 +29,60 @@
+ unsigned int lccr3;
+ };
+
++struct pxafb_rgb {
++ struct fb_bitfield red;
++ struct fb_bitfield green;
++ struct fb_bitfield blue;
++ struct fb_bitfield transp;
++};
++
++#ifdef CONFIG_PXA27x
++/* PXA Overlay Framebuffer Support */
++struct overlayfb_info
++{
++ struct fb_info fb;
++
++ struct fb_var_screeninfo old_var;
++
++ struct semaphore mutex;
++ unsigned long refcount;
++
++ struct pxafb_info *basefb;
++
++ unsigned long map_cpu;
++ unsigned long screen_cpu;
++ unsigned long palette_cpu;
++ unsigned long map_size;
++ unsigned long palette_size;
++
++ dma_addr_t screen_dma;
++ dma_addr_t map_dma;
++ dma_addr_t palette_dma;
++
++ volatile u_char state;
++
++ /* overlay specific info */
++ unsigned long xpos; /* screen position (x, y)*/
++ unsigned long ypos;
++ unsigned long format;
++
++ /* additional */
++ union {
++ struct pxafb_dma_descriptor *dma0;
++ struct pxafb_dma_descriptor *dma1;
++ struct {
++ struct pxafb_dma_descriptor *dma2;
++ struct pxafb_dma_descriptor *dma3;
++ struct pxafb_dma_descriptor *dma4;
++ };
++ struct {
++ struct pxafb_dma_descriptor *dma5_pal;
++ struct pxafb_dma_descriptor *dma5_frame;
++ };
++ };
++};
++#endif
++
+ /* PXA LCD DMA descriptor */
+ struct pxafb_dma_descriptor {
+ unsigned int fdadr;
+@@ -87,6 +141,14 @@
+ wait_queue_head_t ctrlr_wait;
+ struct work_struct task;
+
++#ifdef CONFIG_PXA27x
++ /* PXA Overlay Framebuffer Support */
++ struct overlayfb_info *overlay1fb;
++ struct overlayfb_info *overlay2fb;
++ struct overlayfb_info *cursorfb;
++#endif
++ void (*set_overlay_ctrlr_state)(struct pxafb_info *, u_int);
++
+ #ifdef CONFIG_CPU_FREQ
+ struct notifier_block freq_transition;
+ struct notifier_block freq_policy;
+@@ -106,6 +168,9 @@
+ #define C_DISABLE_PM (5)
+ #define C_ENABLE_PM (6)
+ #define C_STARTUP (7)
++#define C_BLANK (8)
++#define C_UNBLANK (9)
++
+
+ #define PXA_NAME "PXA"
+
+Index: linux-2.6.23/drivers/video/pxafb_overlay.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/video/pxafb_overlay.c 2007-10-22 21:53:54.000000000 +0200
+@@ -0,0 +1,1525 @@
++/*
++ * linux/drivers/video/pxafb_overlay.c
++ *
++ * Copyright (c) 2004, Intel Corporation
++ *
++ * Code Status:
++ * 2004/10/28: <yan.yin@intel.com>
++ * - Ported to 2.6 kernel
++ * - Made overlay driver a loadable module
++ * - Merged overlay optimized patch
++ * 2004/03/10: <stanley.cai@intel.com>
++ * - Fixed Bugs
++ * - Added workaround for overlay1&2
++ * 2003/08/27: <yu.tang@intel.com>
++ * - Added Overlay 1 & Overlay2 & Hardware Cursor support
++ *
++ *
++ * This software program is licensed subject to the GNU Lesser General
++ * Public License (LGPL). Version 2.1, February 1999, available at
++ * http://www.gnu.org/copyleft/lesser.html
++ *
++ * Intel PXA27x LCD Controller Frame Buffer Overlay Driver
++ *
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/kernel.h>
++#include <linux/sched.h>
++#include <linux/errno.h>
++#include <linux/string.h>
++#include <linux/interrupt.h>
++#include <linux/slab.h>
++#include <linux/fb.h>
++#include <linux/delay.h>
++#include <linux/init.h>
++#include <linux/ioport.h>
++#include <linux/cpufreq.h>
++#include <linux/device.h>
++#include <linux/platform_device.h>
++#include <linux/dma-mapping.h>
++
++#include <asm/hardware.h>
++#include <asm/io.h>
++#include <asm/irq.h>
++#include <asm/uaccess.h>
++#include <asm/arch/bitfield.h>
++#include <asm/arch/pxafb.h>
++#include <asm/arch/pxa-regs.h>
++
++#include "pxafb.h"
++
++/* LCD enhancement : Overlay 1 & 2 & Hardware Cursor */
++
++/*
++ * LCD enhancement : Overlay 1
++ *
++ * Features:
++ * - support 16bpp (No palette)
++ */
++/*
++ * debugging?
++ */
++#define DEBUG 0
++
++#ifdef DEBUG
++#define dbg(fmt,arg...) printk(KERN_ALERT "%s(): " fmt "\n", __FUNCTION__, ##arg)
++#else
++#define dbg(fmt,arg...)
++#endif
++
++static int overlay1fb_enable(struct fb_info *info);
++static int overlay2fb_enable(struct fb_info *info);
++static int cursorfb_enable(struct fb_info *info);
++
++static int overlay1fb_disable(struct fb_info *info);
++static int overlay2fb_disable(struct fb_info *info);
++static int cursorfb_disable(struct fb_info *info);
++
++static int overlay1fb_blank(int blank, struct fb_info *info);
++static int overlay2fb_blank(int blank, struct fb_info *info);
++static int cursorfb_blank(int blank, struct fb_info *info);
++
++extern void pxafb_set_ctrlr_state(struct pxafb_info *fbi, u_int state);
++extern int pxafb_blank(int blank, struct fb_info *info);
++
++static struct pxafb_rgb def_rgb_18 = {
++ red: { offset: 12, length: 6, },
++ green: { offset: 6, length: 6, },
++ blue: { offset: 0, length: 6, },
++ transp: { offset: 0, length: 0, },
++};
++
++static struct pxafb_rgb def_rgbt_16 = {
++ red: { offset: 10, length: 5, },
++ green: { offset: 5, length: 5, },
++ blue: { offset: 0, length: 5, },
++ transp: { offset: 15, length: 1, },
++};
++
++static struct pxafb_rgb def_rgbt_19 = {
++ red: { offset: 12, length: 6, },
++ green: { offset: 6, length: 6, },
++ blue: { offset: 0, length: 6, },
++ transp: { offset: 18, length: 1, },
++};
++
++static struct pxafb_rgb def_rgbt_24 = {
++ red: { offset: 16, length: 7, },
++ green: { offset: 8, length: 8, },
++ blue: { offset: 0, length: 8, },
++ transp: { offset: 0, length: 0, },
++};
++
++static struct pxafb_rgb def_rgbt_25 = {
++ red: { offset: 16, length: 8, },
++ green: { offset: 8, length: 8, },
++ blue: { offset: 0, length: 8, },
++ transp: { offset: 24, length: 1, },
++};
++
++#define CLEAR_LCD_INTR(reg, intr) do { \
++ reg = (intr); \
++}while(0)
++
++#define WAIT_FOR_LCD_INTR(reg,intr,timeout) ({ \
++ int __done =0; \
++ int __t = timeout; \
++ while (__t) { \
++ __done = (reg) & (intr); \
++ if (__done) break; \
++ mdelay(10); \
++ __t--; \
++ } \
++ if (!__t) dbg("wait " #intr " timeount");\
++ __done; \
++})
++
++#define DISABLE_OVERLAYS(fbi) do { \
++ if (fbi->overlay1fb && (fbi->overlay1fb->state == C_ENABLE)) { \
++ overlay1fb_disable((struct fb_info*)fbi->overlay1fb); \
++ } \
++ if (fbi->overlay2fb && (fbi->overlay2fb->state == C_ENABLE)) { \
++ overlay2fb_disable((struct fb_info*)fbi->overlay2fb); \
++ } \
++ if (fbi->cursorfb && (fbi->cursorfb->state == C_ENABLE)) { \
++ cursorfb_disable((struct fb_info*)fbi->cursorfb); \
++ } \
++}while(0)
++
++#define ENABLE_OVERLAYS(fbi) do { \
++ if (fbi->overlay1fb && (fbi->overlay1fb->state == C_DISABLE)) { \
++ overlay1fb_enable((struct fb_info*)fbi->overlay1fb); \
++ } \
++ if (fbi->overlay2fb && (fbi->overlay2fb->state == C_DISABLE)) { \
++ overlay2fb_enable((struct fb_info*)fbi->overlay2fb); \
++ } \
++ if (fbi->cursorfb && (fbi->cursorfb->state == C_DISABLE)) { \
++ cursorfb_enable((struct fb_info*)fbi->cursorfb); \
++ } \
++}while(0)
++
++#define BLANK_OVERLAYS(fbi) do { \
++ if (fbi->overlay1fb && (fbi->overlay1fb->state == C_ENABLE)) { \
++ overlay1fb_disable((struct fb_info*)fbi->overlay1fb); \
++ fbi->overlay1fb->state = C_BLANK; \
++ } \
++ if (fbi->overlay2fb && (fbi->overlay2fb->state == C_ENABLE)) { \
++ overlay2fb_disable((struct fb_info*)fbi->overlay2fb); \
++ fbi->overlay2fb->state = C_BLANK; \
++ } \
++ if (fbi->cursorfb && (fbi->cursorfb->state == C_ENABLE)) { \
++ cursorfb_disable((struct fb_info*)fbi->cursorfb); \
++ fbi->cursorfb->state = C_BLANK; \
++ } \
++}while(0)
++
++#define UNBLANK_OVERLAYS(fbi) do { \
++ if (fbi->overlay1fb && (fbi->overlay1fb->state == C_BLANK)) { \
++ overlay1fb_enable((struct fb_info*)fbi->overlay1fb); \
++ fbi->overlay1fb->state = C_ENABLE; \
++ } \
++ if (fbi->overlay2fb && (fbi->overlay2fb->state == C_BLANK)) { \
++ overlay2fb_enable((struct fb_info*)fbi->overlay2fb); \
++ fbi->overlay2fb->state = C_ENABLE; \
++ } \
++ if (fbi->cursorfb && (fbi->cursorfb->state == C_BLANK)) { \
++ cursorfb_enable((struct fb_info*)fbi->cursorfb); \
++ fbi->cursorfb->state = C_ENABLE; \
++ } \
++}while(0)
++
++static int overlay1fb_open(struct fb_info *info, int user)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ int ret = 0;
++
++/* If basefb is disable, enable fb. */
++ if (fbi->basefb && fbi->basefb->state != C_ENABLE)
++ pxafb_blank(VESA_NO_BLANKING, (struct fb_info *)(fbi->basefb));
++
++ down(&fbi->mutex);
++
++ if (fbi->refcount)
++ ret = -EACCES;
++ else
++ fbi->refcount ++;
++
++ up(&fbi->mutex);
++
++ /* Initialize the variables in overlay1 framebuffer. */
++ fbi->fb.var.xres = fbi->fb.var.yres = 0;
++ fbi->fb.var.bits_per_pixel = 0;
++
++ return ret;
++}
++
++static int overlay1fb_release(struct fb_info *info, int user)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ down(&fbi->mutex);
++
++ if (fbi->refcount)
++ fbi->refcount --;
++
++ up(&fbi->mutex);
++ /* disable overlay when released */
++ overlay1fb_blank(1, info);
++
++ return 0;
++}
++
++static int overlay1fb_map_video_memory(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++
++ if (fbi->map_cpu)
++ dma_free_writecombine(NULL, fbi->map_size, (void*)fbi->map_cpu, fbi->map_dma);
++ fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE);
++
++ fbi->map_cpu = (unsigned long)dma_alloc_writecombine(NULL, fbi->map_size,
++ &fbi->map_dma, GFP_KERNEL );
++
++ if (!fbi->map_cpu) return -ENOMEM;
++
++ fbi->screen_cpu = fbi->map_cpu + PAGE_SIZE;
++ fbi->screen_dma = fbi->map_dma + PAGE_SIZE;
++
++ fbi->fb.fix.smem_start = fbi->screen_dma;
++
++ /* setup dma descriptor */
++ fbi->dma1 = (struct pxafb_dma_descriptor*)
++ (fbi->screen_cpu - sizeof(struct pxafb_dma_descriptor));
++
++ fbi->dma1->fdadr = (fbi->screen_dma - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma1->fsadr = fbi->screen_dma;
++ fbi->dma1->fidr = 0;
++ fbi->dma1->ldcmd = fbi->fb.fix.smem_len;
++
++ return 0;
++}
++
++static int overlay1fb_enable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ unsigned long bpp1;
++
++ if (!fbi->map_cpu) return -EINVAL;
++
++ switch (fbi->fb.var.bits_per_pixel) {
++ case 16:
++ bpp1 = 0x4;
++ break;
++ case 18:
++ bpp1 = 0x6;
++ break;
++ case 19:
++ bpp1 = 0x8;
++ break;
++ case 24:
++ bpp1 = 0x9;
++ break;
++ case 25:
++ bpp1 = 0xa;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ /* disable branch/start/end of frame interrupt */
++ LCCR5 |= (LCCR5_IUM1 | LCCR5_BSM1 | LCCR5_EOFM1 | LCCR5_SOFM1);
++
++ if (fbi->state == C_DISABLE || fbi->state == C_BLANK)
++ FDADR1 = (fbi->dma1->fdadr);
++ else
++ FBR1 = fbi->dma1->fdadr | 0x1;
++
++ /* enable overlay 1 window */
++ OVL1C2 = (fbi->ypos << 10) | fbi->xpos;
++ OVL1C1 = OVL1C1_O1EN | (bpp1 << 20) | ((fbi->fb.var.yres-1)<<10) | (fbi->fb.var.xres-1);
++
++ fbi->state = C_ENABLE;
++
++ return 0;
++}
++
++static int overlay1fb_disable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*)info;
++ int done;
++
++ if ((fbi->state == C_DISABLE) || (fbi->state == C_BLANK))
++ return 0;
++
++ fbi->state = C_DISABLE;
++
++ /* clear O1EN */
++ OVL1C1 &= ~OVL1C1_O1EN;
++
++ CLEAR_LCD_INTR(LCSR1, LCSR1_BS1);
++ FBR1 = 0x3;
++ done = WAIT_FOR_LCD_INTR(LCSR1, LCSR1_BS1, 100);
++
++ if (!done) {
++ pr_debug(KERN_INFO "%s: timeout\n", __FUNCTION__);
++ return -1;
++ }
++ return 0;
++}
++
++static int overlay1fb_blank(int blank, struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ int err=0;
++
++ switch (blank) {
++ case 0:
++ err = overlay1fb_enable(info);
++ if (err) {
++ fbi->state = C_DISABLE;
++ pxafb_set_ctrlr_state(fbi->basefb, C_REENABLE);
++ }
++ break;
++ case 1:
++ err = overlay1fb_disable(info);
++ if (err) {
++ fbi->state = C_DISABLE;
++ pxafb_set_ctrlr_state(fbi->basefb, C_REENABLE);
++ }
++ break;
++ default:
++ break;
++ }
++
++ return err;
++}
++
++static int overlay1fb_check_var( struct fb_var_screeninfo *var, struct fb_info *info)
++{
++ int xpos, ypos;
++ struct overlayfb_info *fbi=(struct overlayfb_info*)info;
++
++ /* must in base frame */
++ xpos = (var->nonstd & 0x3ff);
++ ypos = ((var->nonstd>>10) & 0x3ff);
++
++ if ( (xpos + var->xres) > fbi->basefb->fb.var.xres )
++ return -EINVAL;
++
++ if ( (ypos + var->yres) > fbi->basefb->fb.var.yres )
++ return -EINVAL;
++
++ switch (var->bits_per_pixel) {
++ case 16:
++ if ( var->xres & 0x1 ) {
++ printk("xres should be a multiple of 2 pixels!\n");
++ return -EINVAL;
++ }
++ break;
++ case 18:
++ case 19:
++ if ( var->xres & 0x7 ) {
++ printk("xres should be a multiple of 8 pixels!\n");
++ return -EINVAL;
++ }
++ break;
++ default:
++ break;
++ }
++
++ fbi->old_var=*var;
++
++ var->activate=FB_ACTIVATE_NOW;
++
++ return 0;
++}
++
++
++static int overlay1fb_set_par(struct fb_info *info)
++{
++ int nbytes=0, err=0, pixels_per_line=0;
++
++ struct overlayfb_info *fbi=(struct overlayfb_info*)info;
++ struct fb_var_screeninfo *var = &fbi->fb.var;
++
++ info->flags &= ~FBINFO_MISC_USEREVENT;
++
++ if (fbi->state == C_BLANK)
++ return 0;
++
++ if (fbi->state == C_DISABLE)
++ goto out1;
++
++ /* only xpos & ypos change */
++ if ( (var->xres == fbi->old_var.xres) &&
++ (var->yres == fbi->old_var.yres) &&
++ (var->bits_per_pixel == fbi->old_var.bits_per_pixel) )
++ goto out2;
++
++out1:
++ switch(var->bits_per_pixel) {
++ case 16:
++ /* 2 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x1) & (~0x1);
++ nbytes = 2;
++
++ var->red = def_rgbt_16.red;
++ var->green = def_rgbt_16.green;
++ var->blue = def_rgbt_16.blue;
++ var->transp = def_rgbt_16.transp;
++
++ break;
++ case 18:
++ /* 8 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x7 ) & (~0x7);
++ nbytes = 3;
++
++ var->red = def_rgb_18.red;
++ var->green = def_rgb_18.green;
++ var->blue = def_rgb_18.blue;
++ var->transp = def_rgb_18.transp;
++
++ break;
++ case 19:
++ /* 8 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x7 ) & (~0x7);
++ nbytes = 3;
++
++ var->red = def_rgbt_19.red;
++ var->green = def_rgbt_19.green;
++ var->blue = def_rgbt_19.blue;
++ var->transp = def_rgbt_19.transp;
++
++ break;
++ case 24:
++ pixels_per_line = fbi->fb.var.xres;
++ nbytes = 4;
++
++ var->red = def_rgbt_24.red;
++ var->green = def_rgbt_24.green;
++ var->blue = def_rgbt_24.blue;
++ var->transp = def_rgbt_24.transp;
++
++ break;
++ case 25:
++ pixels_per_line = fbi->fb.var.xres;
++ nbytes = 4;
++
++ var->red = def_rgbt_25.red;
++ var->green = def_rgbt_25.green;
++ var->blue = def_rgbt_25.blue;
++ var->transp = def_rgbt_25.transp;
++
++ break;
++ }
++
++ fbi->fb.fix.line_length = nbytes * pixels_per_line;
++ fbi->fb.fix.smem_len = fbi->fb.fix.line_length * fbi->fb.var.yres;
++
++ err= overlay1fb_map_video_memory((struct fb_info*)fbi);
++
++ if (err)
++ return err;
++
++out2:
++ fbi->xpos = var->nonstd & 0x3ff;
++ fbi->ypos = (var->nonstd>>10) & 0x3ff;
++
++ overlay1fb_enable(info);
++
++ return 0;
++
++}
++
++static struct fb_ops overlay1fb_ops = {
++ .owner = THIS_MODULE,
++ .fb_open = overlay1fb_open,
++ .fb_release = overlay1fb_release,
++ .fb_check_var = overlay1fb_check_var,
++ .fb_set_par = overlay1fb_set_par,
++ .fb_blank = overlay1fb_blank,
++ .fb_fillrect = cfb_fillrect,
++ .fb_copyarea = cfb_copyarea,
++ .fb_imageblit = cfb_imageblit,
++};
++
++ /*
++ * LCD enhancement : Overlay 2
++ *
++ * Features:
++ * - support planar YCbCr420/YCbCr422/YCbCr444;
++ */
++static int overlay2fb_open(struct fb_info *info, int user)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ int ret = 0;
++
++ /* if basefb is disable, enable fb. */
++ if (fbi->basefb && fbi->basefb->state != C_ENABLE)
++ pxafb_blank(VESA_NO_BLANKING, (struct fb_info *)(fbi->basefb));
++
++ down(&fbi->mutex);
++
++ if (fbi->refcount)
++ ret = -EACCES;
++ else
++ fbi->refcount ++;
++
++ up(&fbi->mutex);
++ fbi->fb.var.xres = fbi->fb.var.yres = 0;
++
++ return ret;
++}
++
++static int overlay2fb_release(struct fb_info *info, int user)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++
++ down(&fbi->mutex);
++
++ if (fbi->refcount)
++ fbi->refcount --;
++
++ up(&fbi->mutex);
++
++ /* disable overlay when released */
++ overlay2fb_blank(1, info);
++
++ return 0;
++}
++
++static int overlay2fb_map_YUV_memory( struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ unsigned int ylen, cblen, crlen, aylen, acblen, acrlen;
++ unsigned int yoff, cboff, croff;
++ unsigned int xres,yres;
++ unsigned int nbytes;
++
++ ylen = cblen = crlen = aylen = acblen = acrlen = 0;
++ yoff = cboff = croff = 0;
++
++ if (fbi->map_cpu)
++ dma_free_writecombine(NULL, fbi->map_size, (void*)fbi->map_cpu, fbi->map_dma);
++
++ yres = fbi->fb.var.yres;
++
++ switch(fbi->format) {
++ case 0x4: /* YCbCr 4:2:0 planar */
++ pr_debug("420 planar\n");
++ /* 16 pixels per line */
++ xres = (fbi->fb.var.xres + 0xf) & (~0xf);
++ fbi->fb.fix.line_length = xres;
++
++ nbytes = xres * yres;
++ ylen = nbytes;
++ cblen = crlen = (nbytes/4);
++
++ break;
++ case 0x3: /* YCbCr 4:2:2 planar */
++ /* 8 pixles per line */
++ pr_debug("422 planar\n");
++ xres = (fbi->fb.var.xres + 0x7) & (~0x7);
++ fbi->fb.fix.line_length = xres;
++
++ nbytes = xres * yres;
++ ylen = nbytes;
++ cblen = crlen = (nbytes/2);
++
++ break;
++ case 0x2: /* YCbCr 4:4:4 planar */
++ /* 4 pixels per line */
++ pr_debug("444 planar\n");
++ xres = (fbi->fb.var.xres + 0x3) & (~0x3);
++ fbi->fb.fix.line_length = xres;
++
++ nbytes = xres * yres;
++ ylen = cblen = crlen = nbytes;
++ break;
++ }
++
++ /* 16-bytes alignment for DMA */
++ aylen = (ylen + 0xf) & (~0xf);
++ acblen = (cblen + 0xf) & (~0xf);
++ acrlen = (crlen + 0xf) & (~0xf);
++
++ fbi->fb.fix.smem_len = aylen + acblen + acrlen;
++
++ /* alloc memory */
++
++ fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE);
++ fbi->map_cpu = (unsigned long)dma_alloc_writecombine(NULL, fbi->map_size,
++ &fbi->map_dma, GFP_KERNEL );
++
++ if (!fbi->map_cpu) return -ENOMEM;
++
++ fbi->screen_cpu = fbi->map_cpu + PAGE_SIZE;
++ fbi->screen_dma = fbi->map_dma + PAGE_SIZE;
++
++ fbi->fb.fix.smem_start = fbi->screen_dma;
++
++ /* setup dma for Planar format */
++ fbi->dma2 = (struct pxafb_dma_descriptor*)
++ (fbi->screen_cpu - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma3 = fbi->dma2 - 1;
++ fbi->dma4 = fbi->dma3 - 1;
++
++ /* offset */
++ yoff = 0;
++ cboff = aylen;
++ croff = cboff + acblen;
++
++ /* Y vector */
++ fbi->dma2->fdadr = (fbi->screen_dma - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma2->fsadr = fbi->screen_dma + yoff;
++ fbi->dma2->fidr = 0;
++ fbi->dma2->ldcmd = ylen;
++
++ /* Cb vector */
++ fbi->dma3->fdadr = (fbi->dma2->fdadr - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma3->fsadr = (fbi->screen_dma + cboff);
++ fbi->dma3->fidr = 0;
++ fbi->dma3->ldcmd = cblen;
++
++ /* Cr vector */
++
++ fbi->dma4->fdadr = (fbi->dma3->fdadr - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma4->fsadr = (fbi->screen_dma + croff);
++ fbi->dma4->fidr = 0;
++ fbi->dma4->ldcmd = crlen;
++
++ /* adjust for user */
++ fbi->fb.var.red.length = ylen;
++ fbi->fb.var.red.offset = yoff;
++ fbi->fb.var.green.length = cblen;
++ fbi->fb.var.green.offset = cboff;
++ fbi->fb.var.blue.length = crlen;
++ fbi->fb.var.blue.offset = croff;
++
++ return 0;
++};
++
++static int overlay2fb_map_RGB_memory( struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ struct fb_var_screeninfo *var = &fbi->fb.var;
++ int pixels_per_line=0 , nbytes=0;
++
++ if (fbi->map_cpu)
++ dma_free_writecombine(NULL, fbi->map_size, (void*)fbi->map_cpu, fbi->map_dma);
++
++ switch(var->bits_per_pixel) {
++ case 16:
++ /* 2 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x1) & (~0x1);
++ nbytes = 2;
++
++ var->red = def_rgbt_16.red;
++ var->green = def_rgbt_16.green;
++ var->blue = def_rgbt_16.blue;
++ var->transp = def_rgbt_16.transp;
++ break;
++
++ case 18:
++ /* 8 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x7 ) & (~0x7);
++ nbytes = 3;
++
++ var->red = def_rgb_18.red;
++ var->green = def_rgb_18.green;
++ var->blue = def_rgb_18.blue;
++ var->transp = def_rgb_18.transp;
++
++ break;
++ case 19:
++ /* 8 pixels per line */
++ pixels_per_line = (fbi->fb.var.xres + 0x7 ) & (~0x7);
++ nbytes = 3;
++
++ var->red = def_rgbt_19.red;
++ var->green = def_rgbt_19.green;
++ var->blue = def_rgbt_19.blue;
++ var->transp = def_rgbt_19.transp;
++
++ break;
++ case 24:
++ pixels_per_line = fbi->fb.var.xres;
++ nbytes = 4;
++
++ var->red = def_rgbt_24.red;
++ var->green = def_rgbt_24.green;
++ var->blue = def_rgbt_24.blue;
++ var->transp = def_rgbt_24.transp;
++
++ break;
++
++ case 25:
++ pixels_per_line = fbi->fb.var.xres;
++ nbytes = 4;
++
++ var->red = def_rgbt_25.red;
++ var->green = def_rgbt_25.green;
++ var->blue = def_rgbt_25.blue;
++ var->transp = def_rgbt_25.transp;
++
++ break;
++ }
++
++ fbi->fb.fix.line_length = nbytes * pixels_per_line;
++ fbi->fb.fix.smem_len = fbi->fb.fix.line_length * fbi->fb.var.yres;
++
++ fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE);
++ fbi->map_cpu = (unsigned long)dma_alloc_writecombine(NULL, fbi->map_size,
++ &fbi->map_dma, GFP_KERNEL );
++
++ if (!fbi->map_cpu) return -ENOMEM;
++
++ fbi->screen_cpu = fbi->map_cpu + PAGE_SIZE;
++ fbi->screen_dma = fbi->map_dma + PAGE_SIZE;
++
++ fbi->fb.fix.smem_start = fbi->screen_dma;
++
++ /* setup dma descriptor */
++ fbi->dma2 = (struct pxafb_dma_descriptor*)
++ (fbi->screen_cpu - sizeof(struct pxafb_dma_descriptor));
++
++ fbi->dma2->fdadr = (fbi->screen_dma - sizeof(struct pxafb_dma_descriptor));
++ fbi->dma2->fsadr = fbi->screen_dma;
++ fbi->dma2->fidr = 0;
++ fbi->dma2->ldcmd = fbi->fb.fix.smem_len;
++
++ return 0;
++}
++
++static int overlay2fb_enable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ unsigned long bpp2;
++ unsigned int xres, yres;
++
++ if (!fbi->map_cpu) return -EINVAL;
++
++ switch(fbi->fb.var.bits_per_pixel) {
++ case 16:
++ bpp2 = 0x4;
++ break;
++ case 18:
++ bpp2 = 0x6;
++ break;
++ case 19:
++ bpp2 = 0x8;
++ break;
++ case 24:
++ bpp2 = 0x9;
++ break;
++ case 25:
++ bpp2 = 0xa;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ /* disable branch/start/end of frame interrupt */
++ LCCR5 |= (LCCR5_IUM4 | LCCR5_IUM3 | LCCR5_IUM2 |
++ LCCR5_BSM4 | LCCR5_BSM3 | LCCR5_BSM2 |
++ LCCR5_EOFM4 | LCCR5_EOFM3 | LCCR5_EOFM2 |
++ LCCR5_SOFM4 | LCCR5_SOFM3 | LCCR5_SOFM2);
++
++ if (fbi->format == 0) {
++ /* overlay2 RGB resolution, RGB and YUV have different xres value*/
++ xres = fbi->fb.var.xres;
++ yres = fbi->fb.var.yres;
++
++ OVL2C2 = (fbi->format << 20) | (fbi->ypos << 10) | fbi->xpos;
++ OVL2C1 = OVL2C1_O2EN | (bpp2 << 20) | ((yres-1)<<10) | (xres-1);
++ /* setup RGB DMA */
++ if (fbi->state == C_DISABLE || fbi->state == C_BLANK)
++ FDADR2 = fbi->dma2->fdadr;
++ else
++ FBR2 = fbi->dma2->fdadr | 0x1;
++ } else {
++ /* overlay2 YUV resolution */
++ xres = fbi->fb.fix.line_length;
++ yres = fbi->fb.var.yres;
++
++ OVL2C2 = (fbi->format << 20) | (fbi->ypos << 10) | fbi->xpos;
++ OVL2C1 = OVL2C1_O2EN | (bpp2 << 20) | ((yres-1)<<10) | (xres-1);
++
++ if (fbi->state == C_DISABLE || fbi->state == C_BLANK) {
++ FDADR2 = fbi->dma2->fdadr;
++ FDADR3 = fbi->dma3->fdadr;
++ FDADR4 = fbi->dma4->fdadr;
++ } else {
++ FBR2 = fbi->dma2->fdadr | 0x01;
++ FBR3 = fbi->dma3->fdadr | 0x01;
++ FBR4 = fbi->dma4->fdadr | 0x01;
++ }
++ }
++
++ fbi->state = C_ENABLE;
++ return 0;
++}
++
++static int overlay2fb_disable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*)info;
++ int done;
++
++ if (fbi->state == C_DISABLE)
++ return 0;
++ if (fbi->state == C_BLANK) {
++ fbi->state = C_DISABLE;
++ return 0;
++ }
++
++ fbi->state = C_DISABLE;
++
++ /* clear O2EN */
++ OVL2C1 &= ~OVL2C1_O2EN;
++
++ /* Make overlay2 can't disable/enable
++ * correctly sometimes.
++ */
++ CLEAR_LCD_INTR(LCSR1, LCSR1_BS2);
++
++ if (fbi->format == 0)
++ FBR2 = 0x3;
++ else {
++ FBR2 = 0x3;
++ FBR3 = 0x3;
++ FBR4 = 0x3;
++ }
++
++ done = WAIT_FOR_LCD_INTR(LCSR1, LCSR1_BS2, 100);
++
++ if (!done) {
++ pr_debug(KERN_INFO "%s: timeout\n", __FUNCTION__);
++ return -1;
++ }
++ return 0;
++}
++
++static int overlay2fb_blank(int blank, struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ int err=0;
++
++ switch(blank)
++ {
++ case 0:
++ err = overlay2fb_enable(info);
++ if (err) {
++ fbi->state = C_DISABLE;
++ pxafb_set_ctrlr_state(fbi->basefb, C_REENABLE);
++ }
++ break;
++ case 1:
++ err = overlay2fb_disable(info);
++ if (err) {
++ fbi->state = C_DISABLE;
++ pxafb_set_ctrlr_state(fbi->basefb, C_REENABLE);
++ }
++ break;
++ default:
++ /* reserved */
++ break;
++ }
++
++ return err;
++}
++
++
++static int overlay2fb_check_var( struct fb_var_screeninfo *var, struct fb_info *info)
++{
++ int xpos, ypos, xres, yres;
++ int format;
++ struct overlayfb_info *fbi=(struct overlayfb_info*)info;
++
++ xres=yres=0;
++
++ xpos = (var->nonstd & 0x3ff);
++ ypos = (var->nonstd >> 10) & 0x3ff;
++ format = (var->nonstd >>20) & 0x7;
++
++
++ /* Palnar YCbCr444, YCbCr422, YCbCr420 */
++ if ( (format != 0x4) && (format != 0x3) && (format != 0x2) && (format !=0x0))
++ return -EINVAL;
++
++ /* dummy pixels */
++ switch(format) {
++ case 0x0: /* RGB */
++ xres = var->xres;
++ break;
++ case 0x2: /* 444 */
++ xres = (var->xres + 0x3) & ~(0x3);
++ break;
++ case 0x3: /* 422 */
++ xres = (var->xres + 0x7) & ~(0x7);
++ break;
++ case 0x4: /* 420 */
++ xres = (var->xres + 0xf) & ~(0xf);
++ break;
++ }
++ yres = var->yres;
++
++ if ( (xpos + xres) > fbi->basefb->fb.var.xres )
++ return -EINVAL;
++
++ if ( (ypos + yres) > fbi->basefb->fb.var.yres )
++ return -EINVAL;
++
++ fbi->old_var=*var;
++
++ var->activate=FB_ACTIVATE_NOW;
++
++ return 0;
++
++}
++
++
++/*
++ * overlay2fb_set_var()
++ *
++ * var.nonstd is used as YCbCr format.
++ * var.red/green/blue is used as (Y/Cb/Cr) vector
++ */
++
++static int overlay2fb_set_par(struct fb_info *info)
++{
++ unsigned int xpos, ypos;
++ int format, err;
++
++ struct overlayfb_info *fbi=(struct overlayfb_info*)info;
++ struct fb_var_screeninfo *var = &fbi->fb.var;
++
++ info->flags &= ~FBINFO_MISC_USEREVENT;
++
++ if (fbi->state == C_BLANK)
++ return 0;
++
++ if (fbi->state == C_DISABLE)
++ goto out1;
++
++ if ( (var->xres == fbi->old_var.xres) &&
++ (var->yres == fbi->old_var.yres) &&
++ (var->bits_per_pixel == fbi->old_var.bits_per_pixel) &&
++ (((var->nonstd>>20) & 0x7) == fbi->format) )
++ goto out2;
++
++out1:
++ xpos = var->nonstd & 0x3ff;
++ ypos = (var->nonstd>>10) & 0x3ff;
++ format = (var->nonstd>>20) & 0x7;
++
++
++ fbi->format = format;
++ if ( fbi->format==0 )
++ err = overlay2fb_map_RGB_memory(info);
++ else
++ err = overlay2fb_map_YUV_memory(info);
++
++ if (err) return err;
++
++out2:
++ /* position */
++ fbi->xpos = var->nonstd & 0x3ff;
++ fbi->ypos = (var->nonstd>>10) & 0x3ff;
++
++ overlay2fb_enable(info);
++
++ return 0;
++}
++
++static struct fb_ops overlay2fb_ops = {
++ .owner = THIS_MODULE,
++ .fb_open = overlay2fb_open,
++ .fb_release = overlay2fb_release,
++ .fb_check_var = overlay2fb_check_var,
++ .fb_set_par = overlay2fb_set_par,
++ .fb_blank = overlay2fb_blank,
++ .fb_fillrect = cfb_fillrect,
++ .fb_copyarea = cfb_copyarea,
++ .fb_imageblit = cfb_imageblit,
++};
++
++/* Hardware cursor */
++
++/* Bulverde Cursor Modes */
++struct cursorfb_mode{
++ int xres;
++ int yres;
++ int bpp;
++};
++
++static struct cursorfb_mode cursorfb_modes[]={
++ { 32, 32, 2},
++ { 32, 32, 2},
++ { 32, 32, 2},
++ { 64, 64, 2},
++ { 64, 64, 2},
++ { 64, 64, 2},
++ {128, 128, 1},
++ {128, 128, 1}
++};
++
++static int cursorfb_enable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++
++ if (!fbi->map_cpu) return -EINVAL;
++
++ CCR &= ~CCR_CEN;
++
++ /* set palette format
++ *
++ * FIXME: if only cursor uses palette
++ */
++ LCCR4 = (LCCR4 & (~(0x3<<15))) | (0x1<<15);
++
++ /* disable branch/start/end of frame interrupt */
++ LCCR5 |= (LCCR5_IUM5 | LCCR5_BSM5 | LCCR5_EOFM5 | LCCR5_SOFM5);
++
++ /* load palette and frame data */
++ if (fbi->state == C_DISABLE) {
++ FDADR5 = fbi->dma5_pal->fdadr;
++ udelay(1);
++ FDADR5 = fbi->dma5_frame->fdadr;
++ udelay(1);
++
++ }
++ else {
++ FBR5 = fbi->dma5_pal->fdadr | 0x1;
++ udelay(1);
++ FBR5 = fbi->dma5_frame->fdadr | 0x1;
++ udelay(1);
++ }
++
++ CCR = CCR_CEN | (fbi->ypos << 15) | (fbi->xpos << 5) | (fbi->format);
++
++ fbi->state = C_ENABLE;
++
++ return 0;
++}
++
++static int cursorfb_disable(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*)info;
++ int done, ret = 0;
++
++ fbi->state = C_DISABLE;
++
++ done = WAIT_FOR_LCD_INTR(LCSR1, LCSR1_BS5, 100);
++ if (!done) ret = -1;
++
++ CCR &= ~CCR_CEN;
++
++ return ret;
++}
++
++static int cursorfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
++ u_int trans, struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info *)info;
++ u_int val, ret = 1;
++ u_int *pal=(u_int*) fbi->palette_cpu;
++
++ /* 25bit with Transparcy for 16bpp format */
++ if (regno < fbi->palette_size) {
++ val = ((trans << 24) & 0x1000000);
++ val |= ((red << 16) & 0x0ff0000);
++ val |= ((green << 8 ) & 0x000ff00);
++ val |= ((blue << 0) & 0x00000ff);
++
++ pal[regno] = val;
++ ret = 0;
++ }
++ return ret;
++}
++
++int cursorfb_blank(int blank, struct fb_info *info)
++{
++ switch(blank)
++ {
++ case 0:
++ cursorfb_enable(info);
++ break;
++ case 1:
++ cursorfb_disable(info);
++ break;
++ default:
++ /* reserved */
++ break;
++ }
++ return 0;
++}
++
++static int cursorfb_check_var( struct fb_var_screeninfo *var, struct fb_info *info)
++{
++ int xpos, ypos, xres, yres;
++ int mode;
++ struct cursorfb_mode *cursor;
++ struct overlayfb_info *fbi=(struct overlayfb_info*)info;
++
++ mode = var->nonstd & 0x7;
++ xpos = (var->nonstd>>5) & 0x3ff;
++ ypos = (var->nonstd>>15) & 0x3ff;
++
++ if (mode>7 || mode <0 )
++ return -EINVAL;
++
++ cursor = cursorfb_modes + mode;
++
++ xres = cursor->xres;
++ yres = cursor->yres;
++
++ if ( (xpos + xres) > fbi->basefb->fb.var.xres )
++ return -EINVAL;
++
++ if ( (ypos + yres) > fbi->basefb->fb.var.yres )
++ return -EINVAL;
++
++ return 0;
++
++}
++
++static int cursorfb_set_par(struct fb_info *info)
++{
++ struct overlayfb_info *fbi = (struct overlayfb_info*) info;
++ struct fb_var_screeninfo *var = &fbi->fb.var;
++ struct cursorfb_mode *cursor;
++ int mode, xpos, ypos;
++ int err;
++
++ info->flags &= ~FBINFO_MISC_USEREVENT;
++
++ mode = var->nonstd & 0x7;
++ xpos = (var->nonstd>>5) & 0x3ff;
++ ypos = (var->nonstd>>15) & 0x3ff;
++
++ if (mode != fbi->format) {
++ cursor = cursorfb_modes + mode;
++
++ /* update "var" info */
++ fbi->fb.var.xres = cursor->xres;
++ fbi->fb.var.yres = cursor->yres;
++ fbi->fb.var.bits_per_pixel = cursor->bpp;
++
++ /* alloc video memory
++ *
++ * 4k is engouh for 128x128x1 cursor,
++ * - 2k for cursor pixels,
++ * - 2k for palette data, plus 2 dma descriptor
++ */
++ if (!fbi->map_cpu) {
++ fbi->map_size = PAGE_SIZE;
++ fbi->map_cpu = (unsigned long)dma_alloc_writecombine(NULL, fbi->map_size,
++ &fbi->map_dma, GFP_KERNEL );
++ if (!fbi->map_cpu) return -ENOMEM;
++ }
++
++ cursor = cursorfb_modes + mode;
++
++ /* update overlay & fix "info" */
++ fbi->screen_cpu = fbi->map_cpu;
++ fbi->palette_cpu = fbi->map_cpu + (PAGE_SIZE/2);
++ fbi->screen_dma = fbi->map_dma;
++ fbi->palette_dma = fbi->map_dma + (PAGE_SIZE/2);
++
++ fbi->format = mode;
++ fbi->palette_size = (1<<cursor->bpp);
++ fbi->fb.fix.smem_start = fbi->screen_dma;
++ fbi->fb.fix.smem_len = cursor->xres * cursor->yres * cursor->bpp / 8;
++ fbi->fb.fix.line_length = cursor->xres * cursor->bpp / 8;
++
++ fbi->dma5_pal = (struct pxafb_dma_descriptor*)(fbi->map_cpu + PAGE_SIZE - 16 );
++ fbi->dma5_pal->fdadr = (fbi->map_dma + PAGE_SIZE - 16);
++ fbi->dma5_pal->fsadr = fbi->palette_dma;
++ fbi->dma5_pal->fidr = 0;
++ fbi->dma5_pal->ldcmd = (fbi->palette_size<<2) | LDCMD_PAL;
++
++ fbi->dma5_frame = (struct pxafb_dma_descriptor*)(fbi->map_cpu + PAGE_SIZE - 32 );
++ fbi->dma5_frame->fdadr = (fbi->map_dma + PAGE_SIZE - 32);
++ fbi->dma5_frame->fsadr = fbi->screen_dma;
++ fbi->dma5_frame->fidr = 0;
++ fbi->dma5_frame->ldcmd = fbi->fb.fix.smem_len;
++
++ /* alloc & set default cmap */
++ err = fb_alloc_cmap(&fbi->fb.cmap, fbi->palette_size, 0);
++ if (err) return err;
++ err = fb_set_cmap(&fbi->fb.cmap, info);
++ if (err) return err;
++ }
++
++ /* update overlay info */
++ if ( (xpos != fbi->xpos) || (ypos != fbi->ypos) ) {
++ fbi->xpos = xpos;
++ fbi->ypos = ypos;
++ }
++
++ cursorfb_enable(info);
++ pxafb_set_ctrlr_state(fbi->basefb, C_REENABLE);
++
++ return 0;
++}
++
++static struct fb_ops cursorfb_ops = {
++ .owner = THIS_MODULE,
++ .fb_check_var = cursorfb_check_var,
++ .fb_set_par = cursorfb_set_par,
++ .fb_blank = cursorfb_blank,
++ .fb_fillrect = cfb_fillrect,
++ .fb_copyarea = cfb_copyarea,
++ .fb_imageblit = cfb_imageblit,
++ .fb_setcolreg = cursorfb_setcolreg,
++};
++
++static struct overlayfb_info * __init overlay1fb_init_fbinfo(void)
++{
++ struct overlayfb_info *fbi;
++
++ fbi = kmalloc(sizeof(struct overlayfb_info) + sizeof(u16) * 16, GFP_KERNEL);
++ if (!fbi)
++ return NULL;
++
++ memset(fbi, 0, sizeof(struct overlayfb_info) );
++
++ fbi->refcount = 0;
++ init_MUTEX(&fbi->mutex);
++
++ strcpy(fbi->fb.fix.id, "overlay1");
++
++ fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS;
++ fbi->fb.fix.type_aux = 0;
++ fbi->fb.fix.xpanstep = 0;
++ fbi->fb.fix.ypanstep = 0;
++ fbi->fb.fix.ywrapstep = 0;
++ fbi->fb.fix.accel = FB_ACCEL_NONE;
++
++ fbi->fb.var.nonstd = 0;
++ fbi->fb.var.activate = FB_ACTIVATE_NOW;
++ fbi->fb.var.height = -1;
++ fbi->fb.var.width = -1;
++ fbi->fb.var.accel_flags = 0;
++ fbi->fb.var.vmode = FB_VMODE_NONINTERLACED;
++
++
++ fbi->fb.fbops = &overlay1fb_ops;
++ fbi->fb.flags = FBINFO_FLAG_DEFAULT;
++ fbi->fb.node = -1;
++ fbi->fb.pseudo_palette = NULL;
++
++ fbi->xpos = 0;
++ fbi->ypos = 0;
++ fbi->format = -1;
++ fbi->state = C_DISABLE;
++
++ return fbi;
++}
++
++static struct overlayfb_info * __init overlay2fb_init_fbinfo(void)
++{
++ struct overlayfb_info *fbi;
++
++ fbi = kmalloc(sizeof(struct overlayfb_info) + sizeof(u16) * 16, GFP_KERNEL);
++ if (!fbi)
++ return NULL;
++
++ memset(fbi, 0, sizeof(struct overlayfb_info) );
++
++ fbi->refcount = 0;
++ init_MUTEX(&fbi->mutex);
++
++ strcpy(fbi->fb.fix.id, "overlay2");
++
++ fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS;
++ fbi->fb.fix.type_aux = 0;
++ fbi->fb.fix.xpanstep = 0;
++ fbi->fb.fix.ypanstep = 0;
++ fbi->fb.fix.ywrapstep = 0;
++ fbi->fb.fix.accel = FB_ACCEL_NONE;
++
++ fbi->fb.var.nonstd = 0;
++ fbi->fb.var.activate = FB_ACTIVATE_NOW;
++ fbi->fb.var.height = -1;
++ fbi->fb.var.width = -1;
++ fbi->fb.var.accel_flags = 0;
++ fbi->fb.var.vmode = FB_VMODE_NONINTERLACED;
++
++ fbi->fb.fbops = &overlay2fb_ops;
++ fbi->fb.flags = FBINFO_FLAG_DEFAULT;
++ fbi->fb.node = -1;
++ fbi->fb.pseudo_palette = NULL;
++
++ fbi->xpos = 0;
++ fbi->ypos = 0;
++ fbi->format = -1;
++ fbi->state = C_DISABLE;
++
++ return fbi;
++}
++
++static struct overlayfb_info * __init cursorfb_init_fbinfo(void)
++{
++ struct overlayfb_info *fbi;
++
++ fbi = kmalloc(sizeof(struct overlayfb_info) + sizeof(u16) * 16, GFP_KERNEL);
++ if (!fbi)
++ return NULL;
++
++ memset(fbi, 0, sizeof(struct overlayfb_info) );
++
++ fbi->refcount = 0;
++ init_MUTEX(&fbi->mutex);
++
++ strcpy(fbi->fb.fix.id, "cursor");
++
++ fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS;
++ fbi->fb.fix.type_aux = 0;
++ fbi->fb.fix.xpanstep = 0;
++ fbi->fb.fix.ypanstep = 0;
++ fbi->fb.fix.ywrapstep = 0;
++ fbi->fb.fix.accel = FB_ACCEL_NONE;
++
++ fbi->fb.var.nonstd = 0;
++ fbi->fb.var.activate = FB_ACTIVATE_NOW;
++ fbi->fb.var.height = -1;
++ fbi->fb.var.width = -1;
++ fbi->fb.var.accel_flags = 0;
++ fbi->fb.var.vmode = FB_VMODE_NONINTERLACED;
++
++ fbi->fb.fbops = &cursorfb_ops;
++ fbi->fb.flags = FBINFO_FLAG_DEFAULT;
++ fbi->fb.node = -1;
++ fbi->fb.pseudo_palette = NULL;
++
++
++ fbi->xpos = 0;
++ fbi->ypos = 0;
++ fbi->format = -1;
++ fbi->state = C_DISABLE;
++
++ return fbi;
++}
++
++
++void pxa_set_overlay_ctrlr_state(struct pxafb_info *fbi, u_int state)
++{
++ switch (state) {
++ case C_DISABLE:
++ DISABLE_OVERLAYS(fbi);
++ break;
++ case C_ENABLE:
++ ENABLE_OVERLAYS(fbi);
++ break;
++ case C_BLANK:
++ BLANK_OVERLAYS(fbi);
++ break;
++ case C_UNBLANK:
++ UNBLANK_OVERLAYS(fbi);
++ break;
++ default:
++ break;
++ }
++}
++
++static int is_pxafb_device(struct device * dev, void * data)
++{
++ struct platform_device *pdev = container_of(dev, struct platform_device, dev);
++
++ return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0);
++}
++
++static int __devinit pxafb_overlay_init(void)
++{
++ int ret;
++ struct overlayfb_info *overlay1fb, *overlay2fb, *cursorfb;
++ struct pxafb_info *fbi;
++ struct device *dev;
++
++ ret = -1;
++ overlay1fb = overlay2fb = cursorfb = NULL;
++ fbi = NULL;
++
++ dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
++ if (!dev) {
++ printk(KERN_INFO "Base framebuffer not exists, failed to load overlay driver!\n");
++ return ret;
++ }
++
++ fbi = dev_get_drvdata(dev);
++ if (fbi == NULL) {
++ printk(KERN_INFO "Base framebuffer not initialized, failed to load overlay driver!\n");
++ return ret;
++ }
++
++ /* Overlay 1 windows */
++ overlay1fb = overlay1fb_init_fbinfo();
++
++ if (!overlay1fb) {
++ ret = -ENOMEM;
++ printk("overlay1fb_init_fbinfo failed\n");
++ goto failed;
++ }
++
++ ret = register_framebuffer(&overlay1fb->fb);
++ if (ret < 0)
++ goto failed;
++
++ /* Overlay 2 window */
++ overlay2fb = overlay2fb_init_fbinfo();
++
++ if (!overlay2fb) {
++ ret = -ENOMEM;
++ printk("overlay2fb_init_fbinfo failed\n");
++ goto failed;
++ }
++
++ ret = register_framebuffer(&overlay2fb->fb);
++ if (ret < 0) goto failed;
++
++ /* Hardware cursor window */
++ cursorfb = cursorfb_init_fbinfo();
++
++ if (!cursorfb) {
++ ret = -ENOMEM;
++ printk("cursorfb_init_fbinfo failed\n");
++ goto failed;
++ }
++
++ ret = register_framebuffer(&cursorfb->fb);
++ if (ret < 0) goto failed;
++
++
++ /* set refernce to Overlays */
++ fbi->overlay1fb = overlay1fb;
++ fbi->overlay2fb = overlay2fb;
++ fbi->cursorfb = cursorfb;
++ fbi->set_overlay_ctrlr_state=pxa_set_overlay_ctrlr_state;
++
++ /* set refernce to BaseFrame */
++ overlay1fb->basefb = fbi;
++ overlay2fb->basefb = fbi;
++ cursorfb->basefb = fbi;
++
++ printk(KERN_INFO "Load PXA Overlay driver successfully!\n");
++
++ return 0;
++
++failed:
++ if (overlay1fb)
++ kfree(overlay1fb);
++ if (overlay2fb)
++ kfree(overlay2fb);
++ if (cursorfb)
++ kfree(cursorfb);
++ printk(KERN_INFO "Load PXA Overlay driver failed!\n");
++ return ret;
++}
++
++static void __exit pxafb_overlay_exit(void)
++{
++ struct pxafb_info *fbi;
++ struct device *dev;
++
++ dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device);
++ if (!dev)
++ return;
++
++ fbi = dev_get_drvdata(dev);
++ if (!fbi)
++ return;
++
++ if (fbi->overlay1fb) {
++ unregister_framebuffer(&(fbi->overlay1fb->fb));
++ kfree(fbi->overlay1fb);
++ fbi->overlay1fb = NULL;
++ }
++
++ if (fbi->overlay2fb) {
++ unregister_framebuffer(&(fbi->overlay2fb->fb));
++ kfree(fbi->overlay2fb);
++ fbi->overlay2fb = NULL;
++ }
++
++ if (fbi->cursorfb) {
++ unregister_framebuffer(&(fbi->cursorfb->fb));
++ kfree(fbi->cursorfb);
++ fbi->cursorfb = NULL;
++ }
++
++ fbi->set_overlay_ctrlr_state = NULL;
++
++ printk(KERN_INFO "Unload PXA Overlay driver successfully!\n");
++ return;
++}
++
++
++module_init(pxafb_overlay_init);
++module_exit(pxafb_overlay_exit);
++
++MODULE_DESCRIPTION("Loadable framebuffer overlay driver for PXA");
++MODULE_LICENSE("GPL");
++
+Index: linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h
+===================================================================
+--- linux-2.6.23.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-10 09:38:46.000000000 +0200
++++ linux-2.6.23/include/asm-arm/arch-pxa/pxa-regs.h 2007-10-22 21:53:54.000000000 +0200
+@@ -789,11 +789,18 @@
+ #define UDC_INT_PACKETCMP (0x1)
+
+ #define UDCICR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
++/* Older defines, do not use. */
+ #define UDCICR1_IECC (1 << 31) /* IntEn - Configuration Change */
+ #define UDCICR1_IESOF (1 << 30) /* IntEn - Start of Frame */
+ #define UDCICR1_IERU (1 << 29) /* IntEn - Resume */
+ #define UDCICR1_IESU (1 << 28) /* IntEn - Suspend */
+ #define UDCICR1_IERS (1 << 27) /* IntEn - Reset */
++/* New defines. */
++#define UDCISR1_IRCC (1 << 31) /* IntEn - Configuration Change */
++#define UDCISR1_IRSOF (1 << 30) /* IntEn - Start of Frame */
++#define UDCISR1_IRRU (1 << 29) /* IntEn - Resume */
++#define UDCISR1_IRSU (1 << 28) /* IntEn - Suspend */
++#define UDCISR1_IRRS (1 << 27) /* IntEn - Reset */
+
+ #define UDCISR0 __REG(0x4060000C) /* UDC Interrupt Status Register 0 */
+ #define UDCISR1 __REG(0x40600010) /* UDC Interrupt Status Register 1 */
+@@ -1826,6 +1833,8 @@
+ #define DFBR0 __REG(0x44000020) /* DMA Channel 0 Frame Branch Register */
+ #define DFBR1 __REG(0x44000024) /* DMA Channel 1 Frame Branch Register */
+ #define LCSR __REG(0x44000038) /* LCD Controller Status Register */
++#define LCSR0 __REG(0x44000038) /* LCD Controller Status Register */
++#define LCSR1 __REG(0x44000034) /* LCD Controller Status Register */
+ #define LIIDR __REG(0x4400003C) /* LCD Controller Interrupt ID Register */
+ #define TMEDRGBR __REG(0x44000040) /* TMED RGB Seed Register */
+ #define TMEDCR __REG(0x44000044) /* TMED Control Register */
+@@ -1835,6 +1844,10 @@
+ #define LCCR3_4BPP (2 << 24)
+ #define LCCR3_8BPP (3 << 24)
+ #define LCCR3_16BPP (4 << 24)
++#define LCCR3_18BPP (6 << 24)
++#define LCCR3_19BPP (8 << 24)
++#define LCCR3_24BPP (9 << 24)
++#define LCCR3_25BPP (10<< 24)
+
+ #define FDADR0 __REG(0x44000200) /* DMA Channel 0 Frame Descriptor Address Register */
+ #define FSADR0 __REG(0x44000204) /* DMA Channel 0 Frame Source Address Register */
+@@ -1999,6 +2012,104 @@
+
+ #define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
+
++/* Overlay1 & Overlay2 & Hardware Cursor */
++#define LCSR1_SOF1 (1 << 0)
++#define LCSR1_SOF2 (1 << 1)
++#define LCSR1_SOF3 (1 << 2)
++#define LCSR1_SOF4 (1 << 3)
++#define LCSR1_SOF5 (1 << 4)
++#define LCSR1_SOF6 (1 << 5)
++
++#define LCSR1_EOF1 (1 << 8)
++#define LCSR1_EOF2 (1 << 9)
++#define LCSR1_EOF3 (1 << 10)
++#define LCSR1_EOF4 (1 << 11)
++#define LCSR1_EOF5 (1 << 12)
++#define LCSR1_EOF6 (1 << 13)
++
++#define LCSR1_BS1 (1 << 16)
++#define LCSR1_BS2 (1 << 17)
++#define LCSR1_BS3 (1 << 18)
++#define LCSR1_BS4 (1 << 19)
++#define LCSR1_BS5 (1 << 20)
++#define LCSR1_BS6 (1 << 21)
++
++#define LCSR1_IU2 (1 << 25)
++#define LCSR1_IU3 (1 << 26)
++#define LCSR1_IU4 (1 << 27)
++#define LCSR1_IU5 (1 << 28)
++#define LCSR1_IU6 (1 << 29)
++
++#define LDCMD_SOFINT (1 << 22)
++#define LDCMD_EOFINT (1 << 21)
++
++
++#define LCCR5_SOFM1 (1<<0) /* Start Of Frame Mask for Overlay 1 (channel 1) */
++#define LCCR5_SOFM2 (1<<1) /* Start Of Frame Mask for Overlay 2 (channel 2) */
++#define LCCR5_SOFM3 (1<<2) /* Start Of Frame Mask for Overlay 2 (channel 3) */
++#define LCCR5_SOFM4 (1<<3) /* Start Of Frame Mask for Overlay 2 (channel 4) */
++#define LCCR5_SOFM5 (1<<4) /* Start Of Frame Mask for cursor (channel 5) */
++#define LCCR5_SOFM6 (1<<5) /* Start Of Frame Mask for command data (channel 6) */
++
++#define LCCR5_EOFM1 (1<<8) /* End Of Frame Mask for Overlay 1 (channel 1) */
++#define LCCR5_EOFM2 (1<<9) /* End Of Frame Mask for Overlay 2 (channel 2) */
++#define LCCR5_EOFM3 (1<<10) /* End Of Frame Mask for Overlay 2 (channel 3) */
++#define LCCR5_EOFM4 (1<<11) /* End Of Frame Mask for Overlay 2 (channel 4) */
++#define LCCR5_EOFM5 (1<<12) /* End Of Frame Mask for cursor (channel 5) */
++#define LCCR5_EOFM6 (1<<13) /* End Of Frame Mask for command data (channel 6) */
++
++#define LCCR5_BSM1 (1<<16) /* Branch mask for Overlay 1 (channel 1) */
++#define LCCR5_BSM2 (1<<17) /* Branch mask for Overlay 2 (channel 2) */
++#define LCCR5_BSM3 (1<<18) /* Branch mask for Overlay 2 (channel 3) */
++#define LCCR5_BSM4 (1<<19) /* Branch mask for Overlay 2 (channel 4) */
++#define LCCR5_BSM5 (1<<20) /* Branch mask for cursor (channel 5) */
++#define LCCR5_BSM6 (1<<21) /* Branch mask for data command (channel 6) */
++
++#define LCCR5_IUM1 (1<<24) /* Input FIFO Underrun Mask for Overlay 1 */
++#define LCCR5_IUM2 (1<<25) /* Input FIFO Underrun Mask for Overlay 2 */
++#define LCCR5_IUM3 (1<<26) /* Input FIFO Underrun Mask for Overlay 2 */
++#define LCCR5_IUM4 (1<<27) /* Input FIFO Underrun Mask for Overlay 2 */
++#define LCCR5_IUM5 (1<<28) /* Input FIFO Underrun Mask for cursor */
++#define LCCR5_IUM6 (1<<29) /* Input FIFO Underrun Mask for data command */
++
++#define OVL1C1_O1EN (1<<31) /* Enable bit for Overlay 1 */
++#define OVL2C1_O2EN (1<<31) /* Enable bit for Overlay 2 */
++#define CCR_CEN (1<<31) /* Enable bit for Cursor */
++
++/* LCD registers */
++#define LCCR4 __REG(0x44000010) /* LCD Controller Control Register 4 */
++#define LCCR5 __REG(0x44000014) /* LCD Controller Control Register 5 */
++#define FBR0 __REG(0x44000020) /* DMA Channel 0 Frame Branch Register */
++#define FBR1 __REG(0x44000024) /* DMA Channel 1 Frame Branch Register */
++#define FBR2 __REG(0x44000028) /* DMA Channel 2 Frame Branch Register */
++#define FBR3 __REG(0x4400002C) /* DMA Channel 3 Frame Branch Register */
++#define FBR4 __REG(0x44000030) /* DMA Channel 4 Frame Branch Register */
++#define FDADR2 __REG(0x44000220) /* DMA Channel 2 Frame Descriptor Address Register */
++#define FSADR2 __REG(0x44000224) /* DMA Channel 2 Frame Source Address Register */
++#define FIDR2 __REG(0x44000228) /* DMA Channel 2 Frame ID Register */
++#define LDCMD2 __REG(0x4400022C) /* DMA Channel 2 Command Register */
++#define FDADR3 __REG(0x44000230) /* DMA Channel 3 Frame Descriptor Address Register */
++#define FSADR3 __REG(0x44000234) /* DMA Channel 3 Frame Source Address Register */
++#define FIDR3 __REG(0x44000238) /* DMA Channel 3 Frame ID Register */
++#define LDCMD3 __REG(0x4400023C) /* DMA Channel 3 Command Register */
++#define FDADR4 __REG(0x44000240) /* DMA Channel 4 Frame Descriptor Address Register */
++#define FSADR4 __REG(0x44000244) /* DMA Channel 4 Frame Source Address Register */
++#define FIDR4 __REG(0x44000248) /* DMA Channel 4 Frame ID Register */
++#define LDCMD4 __REG(0x4400024C) /* DMA Channel 4 Command Register */
++#define FDADR5 __REG(0x44000250) /* DMA Channel 5 Frame Descriptor Address Register */
++#define FSADR5 __REG(0x44000254) /* DMA Channel 5 Frame Source Address Register */
++#define FIDR5 __REG(0x44000258) /* DMA Channel 5 Frame ID Register */
++#define LDCMD5 __REG(0x4400025C) /* DMA Channel 5 Command Register */
++
++#define OVL1C1 __REG(0x44000050) /* Overlay 1 Control Register 1 */
++#define OVL1C2 __REG(0x44000060) /* Overlay 1 Control Register 2 */
++#define OVL2C1 __REG(0x44000070) /* Overlay 2 Control Register 1 */
++#define OVL2C2 __REG(0x44000080) /* Overlay 2 Control Register 2 */
++#define CCR __REG(0x44000090) /* Cursor Control Register */
++
++#define FBR5 __REG(0x44000110) /* DMA Channel 5 Frame Branch Register */
++#define FBR6 __REG(0x44000114) /* DMA Channel 6 Frame Branch Register */
++
+ /*
+ * Memory controller
+ */
diff --git a/packages/linux/linux-ezx-2.6.23/patches/series b/packages/linux/linux-ezx-2.6.23/patches/series
new file mode 100644
index 0000000000..c7738e4b61
--- /dev/null
+++ b/packages/linux/linux-ezx-2.6.23/patches/series
@@ -0,0 +1,106 @@
+binutils-buildid-arm.patch
+patch-2.6.23.1
+pxa27x_overlay-r7.patch
+
+ezx-core.patch
+# ezx-core TODO: should be ezx-common
+# look at the pxa-regs.h diff and put each definition on the proper patch
+# register a machine type for each phone model
+
+# enable this patch ONLY if you have STUART connected and dont forget
+# to change your cmdline if you want console on STUART.
+#ezx-enable-stuart.patch
+
+ezx-bp.patch
+# ezx-bp TODO:
+# try to run this as a module - this may solve timing issues for opentapi.
+# suspend/resume (not sure if it can be handled here)
+# implement 2nd gen handshake support
+# move platform device to ezx-phone.c
+
+ezx-pm.patch
+
+ezx-pcap.patch
+# ezx-pcap TODO:
+# move vibrator level function to the vibrator driver
+
+a780-pcap.patch
+e680-pcap.patch
+a1200-pcap.patch
+e6-pcap.patch
+
+a780-mci.patch
+e680-mci.patch
+a1200-mci.patch
+e6-mci.patch
+
+pxa27x-udc-support.3.patch
+
+ezx-emu.patch
+# ezx-emu TODO:
+# userspace interface for controling emu
+# read adc to find which accessory is plugged
+a780-emu.patch
+e680-emu.patch
+
+pxa27x-udc-fix-a1200.patch #(see ezx-a1200.c)
+ezx-eoc.patch
+a1200-eoc.patch
+e6-eoc.patch
+
+ezx-mtd-map.patch
+
+ezx-serial-bug-workaround.patch
+
+pxa-kbd.patch
+a780-kbd.patch
+e680-kbd.patch
+a1200-kbd.patch
+
+pcap-ts.patch
+a780-ts.patch
+e680-ts.patch
+a1200-ts.patch
+e6-ts.patch
+
+ezx-backlight.patch
+
+a780-flip.patch
+e680-locksw.patch
+a1200-flip.patch
+
+a780-leds.patch
+e680-leds.patch
+
+a780-vibrator.patch
+
+# mux_cli patches
+mux_cli.patch
+mux-fix.patch
+mux-fix-init-errorpath.patch
+mux-remove-flipbuffers.patch
+mux-remove-get_halted_bit.patch
+mux-remove-usbh_finished_resume.patch
+mux-fix-makefile.patch
+mux-fix-tty-driver.patch
+mux-linux-2.6.21-fix.patch
+#mux-ifdef-ezx-features.patch
+#mux_debug.patch
+
+asoc-pxa-ssp.patch
+asoc-fix-loopback.patch
+ezx-asoc.patch
+
+# mux_cli TODO:
+# merge patches
+# try to understand the code and cleanup (painful)
+
+# Global TODO:
+# compile everything as module and test for insmod/rmmod
+# can NOT run as module (yet)
+# pxa-ohci, ts0710_mux, ts0710_mux_usb, ezx-bp
+
+# the folowing break too much stuff on other phones.
+
+# incomplete
+