linux-ezx: improve rokre6 support
authorKoen Kooi <koen@openembedded.org>
Fri, 14 Sep 2007 13:22:24 +0000 (13:22 +0000)
committerKoen Kooi <koen@openembedded.org>
Fri, 14 Sep 2007 13:22:24 +0000 (13:22 +0000)
packages/linux/linux-ezx-2.6.21/patches/e6-eoc.patch [new file with mode: 0644]
packages/linux/linux-ezx-2.6.21/patches/e6-mci.patch [new file with mode: 0644]
packages/linux/linux-ezx-2.6.21/patches/e6-pcap.patch [new file with mode: 0644]
packages/linux/linux-ezx-2.6.21/patches/e6-ts.patch [new file with mode: 0644]
packages/linux/linux-ezx-2.6.21/patches/ezx-eoc.patch
packages/linux/linux-ezx-2.6.21/rokre6/defconfig
packages/linux/linux-ezx_2.6.21.bb

diff --git a/packages/linux/linux-ezx-2.6.21/patches/e6-eoc.patch b/packages/linux/linux-ezx-2.6.21/patches/e6-eoc.patch
new file mode 100644 (file)
index 0000000..79c60c8
--- /dev/null
@@ -0,0 +1,82 @@
+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 22:15:52.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c    2007-09-09 13:29:56.000000000 -0300
+@@ -25,6 +25,7 @@
+ #include <asm/arch/mmc.h>
+ #include "generic.h"
++#include "ezx-eoc.h"
+ extern void ezx_lcd_power(int, struct fb_var_screeninfo *);
+ extern void ezx_backlight_power(int);
+@@ -227,11 +228,69 @@
+       .resource       = pcap_ts_resources,
+ };
++
++/* EOC */
++static const unsigned int tab_init_eoc_reg[][2] =
++{
++    {POWER_IC_REG_EOC_INT_MASK,        0x00000FEF},
++    {POWER_IC_REG_EOC_POWER_CONTROL_0, 0x00000C00},
++    {POWER_IC_REG_EOC_POWER_CONTROL_1, 0x0000000C},
++    {POWER_IC_REG_EOC_CONN_CONTROL,    0x00021044},
++};
++
++static void dump_eoc_registers(void)
++{
++      int i, val = 0;
++
++      printk("========DUMP EOC=========\n");
++      for (i = 0; i < POWER_IC_REG_EOC_NUM; i++) {
++              eoc_reg_read(i, &val);
++              printk("eoc_registers[%d] = 0x%08X\n", i, val);
++      }
++      printk("========END DUMP=========\n");
++}
++
++/*
++ * FIXME: The same about the PCAP driver applies here.
++ * This is the initial state only.
++ * Which bits does the change to USB/UART/AUDIO mode?
++ * I think that this is causing the crash on pxa27x-udc
++ * you are setting the 'port connected' bit, and thats why
++ * you are getting interrupts early.
++ * --WM
++ */
++
++static int __init e6_eoc_init(void)
++{
++    int i;
++
++    for (i = 0; i < sizeof(tab_init_eoc_reg)/sizeof(unsigned int)/2; i++)
++    {
++              eoc_reg_write(tab_init_eoc_reg[i][0], tab_init_eoc_reg[i][1]);
++    }
++      dump_eoc_registers();
++      return 0;
++}
++
++static struct ezx_eoc_platform_data e6_eoc_platform_data = {
++      .init           = e6_eoc_init,
++};
++
++struct platform_device e6_eoc_device = {
++      .name           = "ezx-eoc",
++      .id             = -1,
++      .dev            = {
++              .platform_data = &e6_eoc_platform_data,
++      },
++};
++
+ static struct platform_device *devices[] __initdata = {
+       &e6_pcap_device,
+       &pcap_ts_device,
++      &e6_eoc_device,
+ };
++
+ static void __init e6_init(void)
+ {
+       set_pxa_fb_info(&e6_fb_info);
diff --git a/packages/linux/linux-ezx-2.6.21/patches/e6-mci.patch b/packages/linux/linux-ezx-2.6.21/patches/e6-mci.patch
new file mode 100644 (file)
index 0000000..08a6f97
--- /dev/null
@@ -0,0 +1,124 @@
+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:51:55.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c    2007-09-07 11:54:52.000000000 -0300
+@@ -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[] = {
++      [MMC_VDD_160] = 5,
++      [MMC_VDD_170] = 5,
++      [MMC_VDD_180] = 6,
++      [MMC_VDD_190] = 6,
++      [MMC_VDD_200] = 7,
++      [MMC_VDD_210] = 7,
++      [MMC_VDD_220] = 8,
++      [MMC_VDD_230] = 8,
++      [MMC_VDD_240] = 9,
++      [MMC_VDD_250] = 9,
++      [MMC_VDD_260] = 10,
++      [MMC_VDD_270] = 10,
++      [MMC_VDD_280] = 11,
++      [MMC_VDD_290] = 11,
++      [MMC_VDD_300] = 12,
++      [MMC_VDD_310] = 12,
++      [MMC_VDD_320] = 13,
++      [MMC_VDD_330] = 13,
++      [MMC_VDD_340] = 14,
++      [MMC_VDD_350] = 14,
++      [MMC_VDD_360] = 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, SA_INTERRUPT,
++                       "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)
++{
++      if (vdd <= MMC_VDD_360)
++              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_160_165|MMC_VDD_18_19|MMC_VDD_20_21
++                        |MMC_VDD_22_23|MMC_VDD_24_25|MMC_VDD_26_27
++                        |MMC_VDD_28_29|MMC_VDD_30_31|MMC_VDD_32_33
++                        |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.21/patches/e6-pcap.patch b/packages/linux/linux-ezx-2.6.21/patches/e6-pcap.patch
new file mode 100644 (file)
index 0000000..a11adbc
--- /dev/null
@@ -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.21/patches/e6-ts.patch b/packages/linux/linux-ezx-2.6.21/patches/e6-ts.patch
new file mode 100644 (file)
index 0000000..6472f77
--- /dev/null
@@ -0,0 +1,38 @@
+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:54:52.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-e6.c    2007-09-07 11:55:10.000000000 -0300
+@@ -203,8 +203,33 @@
+       },
+ };
++/* 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,
++      &pcap_ts_device,
+ };
+ static void __init e6_init(void)
index f21894e..77c79fd 100644 (file)
@@ -1,8 +1,8 @@
 Index: linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.c   2007-09-09 13:33:19.000000000 -0300
-@@ -0,0 +1,270 @@
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.c   2007-09-11 20:14:33.000000000 -0300
+@@ -0,0 +1,267 @@
 +/*
 + *  EZX EOC Driver for Motorola EZX phones
 + *
@@ -182,11 +182,8 @@ Index: linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.c
 +
 +      eoc_i2c_client = new_client;
 +
-+      if (pdata && pdata->init) {
++      if (pdata && pdata->init)
 +              pdata->init();
-+              }
-+      else
-+              return -EINVAL;
 +
 +      eoc_switch_to_default();
 +
@@ -276,7 +273,7 @@ Index: linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.c
 Index: linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.h   2007-09-07 22:15:52.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.h   2007-09-09 21:46:27.000000000 -0300
 @@ -0,0 +1,33 @@
 +/*
 + *  linux/arch/arm/mach-pxa/ezx-eoc.h
@@ -313,15 +310,15 @@ Index: linux-2.6.21/arch/arm/mach-pxa/ezx-eoc.h
 +#endif /* __EZX_EOC_H__ */
 Index: linux-2.6.21/arch/arm/mach-pxa/Kconfig
 ===================================================================
---- linux-2.6.21.orig/arch/arm/mach-pxa/Kconfig        2007-09-07 22:15:52.000000000 -0300
-+++ linux-2.6.21/arch/arm/mach-pxa/Kconfig     2007-09-07 22:15:52.000000000 -0300
+--- linux-2.6.21.orig/arch/arm/mach-pxa/Kconfig        2007-09-09 21:46:27.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/Kconfig     2007-09-09 21:46:27.000000000 -0300
 @@ -108,6 +108,12 @@
  config EZX_PCAP
        bool "PCAP Support"
  
 +config EZX_EOC
 +      tristate "EOC i2c driver of Motorola EZX phones"
-+      depends on I2C && EXPERIMENTAL && PXA_EZX_A1200
++      depends on I2C && EXPERIMENTAL
 +      help
 +        EOC i2c driver of Motorola EZX phones
 +
@@ -330,8 +327,8 @@ Index: linux-2.6.21/arch/arm/mach-pxa/Kconfig
        depends on EZX_PCAP
 Index: linux-2.6.21/arch/arm/mach-pxa/Makefile
 ===================================================================
---- linux-2.6.21.orig/arch/arm/mach-pxa/Makefile       2007-09-07 22:15:52.000000000 -0300
-+++ linux-2.6.21/arch/arm/mach-pxa/Makefile    2007-09-07 22:15:52.000000000 -0300
+--- linux-2.6.21.orig/arch/arm/mach-pxa/Makefile       2007-09-09 21:46:27.000000000 -0300
++++ linux-2.6.21/arch/arm/mach-pxa/Makefile    2007-09-09 21:46:27.000000000 -0300
 @@ -27,6 +27,7 @@
  obj-$(CONFIG_EZX_BP)          += ezx-bp.o
  obj-$(CONFIG_EZX_PCAP)                += ezx-pcap.o
index 8a1f55c..95a5a25 100755 (executable)
@@ -152,6 +152,7 @@ CONFIG_PXA_EZX=y
 CONFIG_PXA_EZX_E6=y
 CONFIG_EZX_BP=y
 CONFIG_EZX_PCAP=y
+CONFIG_EZX_EOC=y
 CONFIG_EZX_EMU=y
 CONFIG_EZX_EMU_USB=y
 # CONFIG_EZX_EMU_UART is not set
index 892d4f2..366c71f 100644 (file)
@@ -4,7 +4,7 @@ AUTHOR = "Harald Welte and the OpenEZX Team <openezx-devel@lists.openezx.org>"
 HOMEPAGE = "http://www.openezx.org"
 LICENSE = "GPL"
 EZX = "ezxdev"
-PR = "${EZX}-r11"
+PR = "${EZX}-r12"
 
 inherit kernel
 
@@ -22,9 +22,11 @@ SRC_URI = " \
         file://patches/a780-pcap.patch;patch=1 \
         file://patches/e680-pcap.patch;patch=1 \
         file://patches/a1200-pcap.patch;patch=1 \
+       file://patches/e6-pcap.patch;patch=1 \
        file://patches/a780-mci.patch;patch=1 \
        file://patches/e680-mci.patch;patch=1 \
        file://patches/a1200-mci.patch;patch=1 \
+       file://patches/e6-mci.patch;patch=1 \
        file://patches/pxa27x-udc-support.2.patch;patch=1 \
        file://patches/ezx-emu.patch;patch=1 \
         file://patches/a780-emu.patch;patch=1 \
@@ -38,8 +40,10 @@ SRC_URI = " \
        file://patches/a780-ts.patch;patch=1 \
        file://patches/e680-ts.patch;patch=1 \
        file://patches/a1200-ts.patch;patch=1 \
+       file://patches/e6-ts.patch;patch=1 \
         file://patches/ezx-eoc.patch;patch=1 \
         file://patches/a1200-eoc.patch;patch=1 \
+       file://patches/e6-eoc.patch;patch=1 \
        file://patches/ezx-backlight.patch;patch=1 \
        file://patches/a780-flip.patch;patch=1 \
        file://patches/e680-locksw.patch;patch=1 \