Update 2.6.38 to 2.6.38.2
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches / 700-dwc_otg.patch
index 40c9ba9f6f5cd8dcbd0cfa267b24d97a571435a3..81884034c0c4fda518c90281616ad43f5e35d1c5 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/usb/Kconfig
 +++ b/drivers/usb/Kconfig
-@@ -111,6 +111,8 @@
+@@ -113,6 +113,8 @@
  
  source "drivers/usb/host/Kconfig"
  
@@ -39,9 +39,9 @@
 +        bool "HOST ONLY MODE"
 +        depends on DWC_OTG
 +
-+config DWC_OTG_DEVICE_ONLY
-+        bool "DEVICE ONLY MODE"
-+        depends on DWC_OTG
++#config DWC_OTG_DEVICE_ONLY
++#        bool "DEVICE ONLY MODE"
++#        depends on DWC_OTG
 +endchoice
 +
 +choice
 +        dwc_modify_reg32(&global_regs->gintmsk, intr_mask.d32, 0);
 +}
 +
-+#if 1
++#if 0
 +/* currently not used, keep it here as if needed later */
 +static int phy_read(dwc_otg_core_if_t * _core_if, int addr)
 +{
 +}
 --- /dev/null
 +++ b/drivers/usb/dwc_otg/dwc_otg_driver.c
-@@ -0,0 +1,1269 @@
+@@ -0,0 +1,1274 @@
 +/* ==========================================================================
 + * $File: //dwh/usb_iip/dev/software/otg_ipmate/linux/drivers/dwc_otg_driver.c $
 + * $Revision: 1.1.1.1 $
 +static int __devinit
 +dwc_otg_driver_probe(struct platform_device *_dev)
 +{
-+    int retval = 0;
-+    dwc_otg_device_t *dwc_otg_device;
-+    int32_t   snpsid;
++      int retval = 0;
++      dwc_otg_device_t *dwc_otg_device;
++      int pin = (int)_dev->dev.platform_data;
++      int32_t snpsid;
 +      struct resource *res;
 +      gusbcfg_data_t usbcfg = {.d32 = 0};
 +
 +      // GPIOs
-+      gpio_request(_dev->dev.platform_data, "USB_POWER");
-+      gpio_direction_output(_dev->dev.platform_data, 1);
-+
++      if(pin >= 0)
++      {
++              gpio_request(pin, "usb_power");
++              gpio_direction_output(pin, 1);
++              gpio_set_value(pin, 1);
++              gpio_export(pin, 0);
++      }
 +      dev_dbg(&_dev->dev, "dwc_otg_driver_probe (%p)\n", _dev);
 +
 +    dwc_otg_device = kmalloc(sizeof(dwc_otg_device_t), GFP_KERNEL);
 +#endif /* DWC_DEVICE_ONLY */
 --- /dev/null
 +++ b/drivers/usb/dwc_otg/dwc_otg_ifx.c
-@@ -0,0 +1,150 @@
+@@ -0,0 +1,101 @@
 +/******************************************************************************
 +**
 +** FILE NAME    : dwc_otg_ifx.c
 +      writel (0x14014, (volatile unsigned long *)0xbe10103c);
 +}
 +
-+static void release_platform_dev(struct device * dev)
-+{
-+      printk("IFX dwc_otg USB platform_dev release\n");
-+      dev->parent = NULL;
-+}
-+
-+static struct resource resources[] =
-+{
-+      [0] = {
-+              .name    = "dwc_otg_membase",
-+              .start   = IFX_USB_IOMEM_BASE,
-+              .end       = IFX_USB_IOMEM_BASE + IFX_USB_IOMEM_SIZE - 1,
-+              .flags   = IORESOURCE_MEM,
-+      },
-+      [1] = {
-+              .name    = "dwc_otg_irq",
-+              .start   = IFX_USB_IRQ,
-+              .flags   = IORESOURCE_IRQ,
-+      },
-+};
-+
-+static u64 dwc_dmamask = (u32)0x1fffffff;
-+
-+static struct platform_device platform_dev = {
-+      .dev = {
-+              .release       = release_platform_dev,
-+              .dma_mask      = &dwc_dmamask,
-+      },
-+      .resource               = resources,
-+      .num_resources          = ARRAY_SIZE(resources),
-+};
-+
-+extern const char dwc_driver_name[];
 +int ifx_usb_hc_init(unsigned long base_addr, int irq)
 +{
-+      if (platform_dev.dev.parent)
-+              return -EBUSY;
-+
-+      /* finish seting up the platform device */
-+      //resources[0].start = base_addr;
-+      //resources[0].end = base_addr + SZ_256K;
-+
-+      //resources[1].start = irq;
-+
-+      /* The driver core will probe for us.  We know sl811-hcd has been
-+       * initialized already because of the link order dependency.
-+       */
-+      platform_dev.name = dwc_driver_name;
-+      lq_enable_irq(resources[1].start);
-+
-+      return platform_device_register(&platform_dev);
++      return 0;
 +}
 +
 +void ifx_usb_hc_remove(void)
 +{
-+    platform_device_unregister(&platform_dev);
 +}
 --- /dev/null
 +++ b/drivers/usb/dwc_otg/dwc_otg_ifx.h
 +xway_register_dwc(int pin)
 +{
 +      lq_enable_irq(resources[1].start);
-+      platform_dev.dev.platform_data = pin;
++      platform_dev.dev.platform_data = (void*) pin;
 +      return platform_device_register(&platform_dev);
 +}
 --- /dev/null
 +extern void __init xway_register_dwc(int pin);
 +
 +#endif
---- a/arch/mips/lantiq/xway/mach-arv45xx.c
-+++ b/arch/mips/lantiq/xway/mach-arv45xx.c
-@@ -23,6 +23,7 @@
- #include <lantiq_platform.h>
- #include "devices.h"
-+#include "dev-dwc_otg.h"
- #define ARV452_LATCH_SWITCH           (1 << 10)
-@@ -132,6 +133,7 @@
-       lq_register_pci(&lq_pci_data);
-       lq_register_wdt();
-       arv45xx_register_ethernet();
-+      xway_register_dwc(14);
- }
- MIPS_MACHINE(LANTIQ_MACH_ARV4518,
-@@ -151,6 +153,7 @@
-       lq_register_pci(&lq_pci_data);
-       lq_register_wdt();
-       arv45xx_register_ethernet();
-+      xway_register_dwc(28);
- }
- MIPS_MACHINE(LANTIQ_MACH_ARV452,