Marri, Please find some more modifications. I am still testing the driver on my setup with different use case scenarios. Will post you modifications if I find any more bug. Regards Pratyush On 9/6/2011 10:05 PM, Tirumala Marri wrote:
Pratush, We will take a look at the patches and pick the suggestions from the community. I need to see how the ARM related changes can blend in. Regards, Marri <-----Original Message----- <From: Pratyush Anand [mailto:pratyush.anand@xxxxxx] <Sent: Tuesday, September 06, 2011 2:01 AM <To: Tirumala Marri <Cc: Shiraz HASHIM <Subject: Re: [PATCH 00/14] Modifications for DWC OTG since v13 < <Hello Tirumala, < <As discussed on mailing list please find attached patches which we have <modified over your v13 submission. < <Regards <Pratyush < <On 8/30/2011 8:57 PM, Tirumala Marri wrote: <> <-----Original Message----- <> <From: Pratyush Anand [mailto:pratyush.anand@xxxxxx] <> <Sent: Tuesday, August 30, 2011 4:58 AM <> <To: linux-usb@xxxxxxxxxxxxxxx <> <Cc: tmarri@xxxxxxx; linuxppc-dev@xxxxxxxxxxxxxxxx; fchen@xxxxxxx; <> <mmiesfeld@xxxxxxx; shiraz.hashim@xxxxxx; deepak.sikri@xxxxxx; <> <vipulkumar.samar@xxxxxx; rajeev-dlh.kumar@xxxxxx; vipin.kumar@xxxxxx; <> <bhupesh.sharma@xxxxxx; viresh.kumar@xxxxxx; Amit.VIRDI@xxxxxx; <> Pratyush<Anand <> <Subject: [PATCH 00/14] Modifications for DWC OTG since v13< <These <> patches are based on:http://patchwork.ozlabs.org/patch/89560/ <> <After not getting any reply from developers, I started to do <> <modifications for my platform (SPEAr1340). <> <I have done modifications in such a way that all the code in <> <driver/usb/dwc/ would be platform independent. <> <I have tested this code for host/device/dma/slave mode. <> <My fifo configuration is dedicated and dynamic. <> <> [Tirumala Marri] We are working on our next release of patches. They <> should be coming out soon. <> . <> .
>From 864caeec9a5df501dbdd2f768f17036698b7a775 Mon Sep 17 00:00:00 2001 From: Pratyush Anand <pratyush.anand@xxxxxx> Date: Wed, 7 Sep 2011 14:07:24 +0530 Subject: [PATCH] DWC/OTG: Flush RX FIFO also when RESET interrupt is received RX Fifo must also be flushed when RESET interrupt is received. Otherwise, it might cause random problem for some OUT transaction. Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx> --- drivers/usb/dwc/pcd_intr.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/usb/dwc/pcd_intr.c b/drivers/usb/dwc/pcd_intr.c index bb921e0..38f0853 100644 --- a/drivers/usb/dwc/pcd_intr.c +++ b/drivers/usb/dwc/pcd_intr.c @@ -663,8 +663,9 @@ static int dwc_otg_pcd_handle_usb_reset_intr(struct dwc_pcd *pcd) for (i = 0; i <= dev_if->num_out_eps; i++) dwc_write32(out_ep_ctl_reg(pcd, i), doepctl); - /* Flush the NP Tx FIFO */ + /* Flush the FIFO */ dwc_otg_flush_tx_fifo(core_if, 0); + dwc_otg_flush_rx_fifo(core_if); /* Flush the Learning Queue */ resetctl |= DWC_RSTCTL_TKN_QUE_FLUSH; -- 1.6.0.2
>From 70ca8e8987d3c88fa7a45a65df10e269f0e0cad0 Mon Sep 17 00:00:00 2001 From: Pratyush Anand <pratyush.anand@xxxxxx> Date: Wed, 7 Sep 2011 17:17:57 +0530 Subject: [PATCH] dwc/otg: Soft disconnect is removed when gadget probe is called Earlier soft disconnect was removed during otg pcd driver initialization. So, as soon as this disconnect was removed chirp started and reset happened. Then host sends control request like get device descriptor. Since, gadget driver is not up till this time, so descriptor would not be ready. Therefore soft disconnection must be removed only when gadget is also up. Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx> --- drivers/usb/dwc/pcd.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc/pcd.c b/drivers/usb/dwc/pcd.c index 2ef6405..c9ce32a 100644 --- a/drivers/usb/dwc/pcd.c +++ b/drivers/usb/dwc/pcd.c @@ -1636,9 +1636,7 @@ int __devinit dwc_otg_pcd_init(struct device *dev) struct dwc_pcd *pcd; struct dwc_otg_device *otg_dev = dev_get_drvdata(dev); struct core_if *core_if = otg_dev->core_if; - struct device_if *dev_if = core_if->dev_if; int retval; - u32 dctl; /* Allocate PCD structure */ pcd = kzalloc(sizeof(*pcd), GFP_KERNEL); @@ -1698,11 +1696,6 @@ int __devinit dwc_otg_pcd_init(struct device *dev) start_xfer_tasklet.data = (unsigned long)pcd; pcd->start_xfer_tasklet = &start_xfer_tasklet; - /* Remove Soft Disconnect */ - dctl = dwc_read32(dev_if->dev_global_regs + DWC_DCTL); - dctl = DWC_DCTL_SFT_DISCONNECT(dctl, 0); - dwc_write32(dev_if->dev_global_regs + DWC_DCTL, dctl); - return 0; err_cleanup: @@ -1763,6 +1756,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, int (*bind) (struct usb_gadget *)) { int retval; + u32 dctl; + struct device_if *dev_if = (GET_CORE_IF(s_pcd))->dev_if; if (!driver || driver->speed == USB_SPEED_UNKNOWN || !bind || !driver->unbind || !driver->disconnect || !driver->setup) @@ -1790,6 +1785,12 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, s_pcd->gadget.dev.driver = NULL; return retval; } + + /* Remove Soft Disconnect */ + dctl = dwc_read32(dev_if->dev_global_regs + DWC_DCTL); + dctl = DWC_DCTL_SFT_DISCONNECT(dctl, 0); + dwc_write32(dev_if->dev_global_regs + DWC_DCTL, dctl); + return 0; } EXPORT_SYMBOL(usb_gadget_probe_driver); -- 1.6.0.2
>From 6a1cef270d1139fd8a088b1b52cf96910b47e849 Mon Sep 17 00:00:00 2001 From: Pratyush Anand <pratyush.anand@xxxxxx> Date: Thu, 8 Sep 2011 18:56:36 +0530 Subject: [PATCH] dwc/otg: Global interrupt mask mechanism modified There are 3 interrupt enabling routines. dwc_otg_enable_common_interrupts dwc_otg_enable_host_interrupts dwc_otg_enable_device_interrupts Both host and device routines was disabling all the interrupt. So, if OTG mode was used then first device routine was called and then host routine. This host routine was disabling all the interrupt and so the already enabled device interrupt also. Now, if a device was connected first then it was never enumerated as its interrupt was disabled. This patch will correct above behaviour. Only common interrupt should disable all the interrupt. It must be called only from common initialization routine. Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx> --- drivers/usb/dwc/cil.c | 11 ++++------- drivers/usb/dwc/cil.h | 1 - drivers/usb/dwc/hcd.c | 6 ------ 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/usb/dwc/cil.c b/drivers/usb/dwc/cil.c index 71841fc..1fcb0f3 100644 --- a/drivers/usb/dwc/cil.c +++ b/drivers/usb/dwc/cil.c @@ -265,7 +265,7 @@ static void dwc_otg_core_reset(struct core_if *core_if) * This function initializes the commmon interrupts, used in both * device and host modes. */ -void dwc_otg_enable_common_interrupts(struct core_if *core_if) +static void dwc_otg_enable_common_interrupts(struct core_if *core_if) { ulong global_regs = core_if->core_global_regs; u32 intr_mask = 0; @@ -276,6 +276,9 @@ void dwc_otg_enable_common_interrupts(struct core_if *core_if) /* Clear any pending interrupts */ dwc_write32(global_regs + DWC_GINTSTS, 0xFFFFFFFF); + /* Disable all interrupts. */ + dwc_write32(global_regs + DWC_GINTMSK, 0); + /* Enable the interrupts in the GINTMSK. */ intr_mask |= DWC_INTMSK_MODE_MISMTC; intr_mask |= DWC_INTMSK_OTG; @@ -537,15 +540,9 @@ static void dwc_otg_enable_device_interrupts(struct core_if *core_if) u32 msk = 0; ulong global_regs = core_if->core_global_regs; - /* Disable all interrupts. */ - dwc_write32(global_regs + DWC_GINTMSK, 0); - /* Clear any pending interrupts */ dwc_write32(global_regs + DWC_GINTSTS, 0xFFFFFFFF); - /* Enable the common interrupts */ - dwc_otg_enable_common_interrupts(core_if); - /* Enable interrupts */ intr_mask |= DWC_INTMSK_USB_RST; intr_mask |= DWC_INTMSK_ENUM_DONE; diff --git a/drivers/usb/dwc/cil.h b/drivers/usb/dwc/cil.h index 54c7c43..6c35e4f 100644 --- a/drivers/usb/dwc/cil.h +++ b/drivers/usb/dwc/cil.h @@ -774,7 +774,6 @@ extern void dwc_otg_core_dev_init(struct core_if *core_if); extern const char *op_state_str(enum usb_otg_state state); extern void dwc_otg_enable_global_interrupts(struct core_if *core_if); extern void dwc_otg_disable_global_interrupts(struct core_if *core_if); -extern void dwc_otg_enable_common_interrupts(struct core_if *core_if); /** * This function Reads HPRT0 in preparation to modify. It keeps the WC bits 0 diff --git a/drivers/usb/dwc/hcd.c b/drivers/usb/dwc/hcd.c index 64d912f..5545164 100644 --- a/drivers/usb/dwc/hcd.c +++ b/drivers/usb/dwc/hcd.c @@ -71,15 +71,9 @@ static void dwc_otg_enable_host_interrupts(struct core_if *core_if) ulong global_regs = core_if->core_global_regs; u32 intr_mask = 0; - /* Disable all interrupts. */ - dwc_write32(global_regs + DWC_GINTMSK, 0); - /* Clear any pending interrupts. */ dwc_write32(global_regs + DWC_GINTSTS, 0xFFFFFFFF); - /* Enable the common interrupts */ - dwc_otg_enable_common_interrupts(core_if); - /* * Enable host mode interrupts without disturbing common * interrupts. -- 1.6.0.2