[PATCH] arm/dts: omap: Add omap-usb2 dt data

2012-09-11 Thread Kishon Vijay Abraham I
Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
connected to ocp2scp, omap-usb2 dt data is added as a child node
of ocp2scp.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
Applies on
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
 arch/arm/boot/dts/omap4.dtsi |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 8a780b2..bdc21f1 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -302,6 +302,11 @@
#size-cells = 1;
ranges;
ti,hwmods = ocp2scp_usb_phy;
+   usb2phy@4a0ad080 {
+   compatible = ti,omap-usb2;
+   reg = 0x4a0ad080 0x58,
+ 0x4a002300 0x4;
+   };
};
};
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: dwc3: query: dma sg implementation for isoc

2012-09-11 Thread Pratyush Anand

On 9/10/2012 6:49 PM, Felipe Balbi wrote:

On Mon, Sep 10, 2012 at 06:45:06PM +0530, Pratyush Anand wrote:

Hi Felip,

Thanks for the clarifications.

On 9/10/2012 6:29 PM, Felipe Balbi wrote:

If my understanding is correct, then I might need to modify dwc3

driver a bit. only first TRB of the service interval should have
TRBCTL as ISOC_FIRST rest should have TRBCTL as ISOC.

Why ? IIRC, ISOC_FIRST was a hint to the internal packet scheduler to
give higher priority to the isochronous packet, right ? Does it make any
difference for your use case ?


Databook says:


The first TRB in a Buffer Descriptor must have the TRBCTL field set
to the “Isochronous-First” type while all others have this field set
to “Isochronous”.


aaa true :-) I had forgotten about that extra bit of information when
using chained TRBs :-s My bad. Please send a patch.


So I thought to modify the code. As of now, ISOC IN does not work
fully with either All Isochronous-First or Isochronous First +
Isochronous implementation (in case of more than one TRB for one
service interval).
May be I am doing some mistake in my code. :(
I am debugging. Will get back with my observations.


I think you're perfectly right at the need for ISOCHRONOUS_FIRST flag.
My bad.



Hummm.. It works with Isochronous First + Isochronous implementation. 
But, code needs many modification..


We have one trb and one trb_dma per struct dwc3_request. We take lot 
of decisions on the basis of req-trb value. These all will change in 
case of SG. We will not have only one TRB per struct usb_request.


I am going to keep array for trb and trb_dma and then to manage all 
these with backward compatibility (non SG case). What do you say?


struct dwc3_trb *trb[DWC3_TRB_NUM];
dma_addr_t  trb_dma[DWC3_TRB_NUM];

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 05/11] USB: chipidea: don't let probe fail if otg controller start one role failed

2012-09-11 Thread Alexander Shishkin
Richard Zhao richard.z...@freescale.com writes:

 On Wed, Aug 29, 2012 at 12:48:15PM +0300, Alexander Shishkin wrote:
 Richard Zhao richard.z...@freescale.com writes:
 
  On Wed, Aug 29, 2012 at 11:10:33AM +0300, Alexander Shishkin wrote:
  Richard Zhao richard.z...@freescale.com writes:
  
   On Tue, Aug 28, 2012 at 11:38:23AM +0300, Alexander Shishkin wrote:
   Richard Zhao richard.z...@freescale.com writes:
   
One role failed, but the other role will possiblly still work.
For example, when udc start failed, if plug in a host device,
it works.
   
   If you're a host device, ci-role should be HOST at this point and
   ci_role_start() shouldn't fail. If ci-role is detected wrongly, the
   role detection must be fixed. If ci_role_start() fails for host, but it
   still works when it's called again after the id pin change is detected,
   again, the problem is elsewhere.
   The check is only for OTG device. For single role device, it just fail
   if it start the role failed.
  
  Sorry, can you rephrase?
  
   
   
Signed-off-by: Richard Zhao richard.z...@freescale.com
---
 drivers/usb/chipidea/core.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)
   
diff --git a/drivers/usb/chipidea/core.c 
b/drivers/usb/chipidea/core.c
index 19ef324..8fd390a 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -473,8 +473,11 @@ static int __devinit ci_hdrc_probe(struct 
platform_device *pdev)
 ret = ci_role_start(ci, ci-role);
 if (ret) {
 dev_err(dev, can't start %s role\n, 
ci_role(ci)-name);
-ret = -ENODEV;
-goto rm_wq;
+ci-role = CI_ROLE_END;
   
   So are you relying on id pin interrupt for initializing the role after
   this? Can you provide more details?
   Yes. The ID pin detect still works. My case is, gadget role failed,
   host role works. I was trying not to ruin host function.
  
  But it shouldn't even try to start the gadget, because ci_otg_role()
  should set ci-role to HOST before ci_role_start() happens.
  It depends on ID pin. If ID pin is gadget and gadget is not support well,
  ci_role_start will fail. See below example.
  
  Another question is, why does gadget start fail?
  There's one example:
  If usb phy don't support otg yet, otg_set_peripheral will fail, and
  then cause udc_start fail.
 
 So you should drop the CI13XXX_REQUIRE_TRANSCEIVER flag from imx
 platform data till the phy is fully implemented.
 It's just an example. We can not assume udc_start always success. If it
 fails, isn't it better to continue support of host than say game over?

Ok, I think what we need here is to rework error handling around role
switching, so that we can allow certain things to fail and retry at a
later point (say at id pin change), while being careful about the other
failures.

If this patch is not crucial for imx right now, I'd prefer to leave it
out.

Regards,
--
Alex
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] USB: option: replace ZTE K5006-Z entry with vendor class rule

2012-09-11 Thread Bjørn Mork
Fix the ZTE K5006-Z entry so that it actually matches anything

  commit f1b5c997 USB: option: add ZTE K5006-Z

added a device specific entry assuming that the device would use
class/subclass/proto == ff/ff/ff like other ZTE devices. It
turns out that ZTE has started using vendor specific subclass
and protocol codes:

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=1018 Rev= 0.00
S:  Manufacturer=ZTE,Incorporated
S:  Product=ZTE LTE Technologies MSM
S:  SerialNumber=MF821Vxxx
C:* #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=86 Prot=10 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=02 Prot=05 Driver=(none)
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=06 Prot=00 Driver=qmi_wwan
E:  Ad=85(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

We do not have any information on how ZTE intend to use these
codes, but let us assume for now that the 3 sets matching
serial functions in the K5006-Z always will identify a serial
function in a ZTE device.

Cc: Thomas Schäfer tschae...@t-online.de
Cc: stable sta...@vger.kernel.org
Signed-off-by: Bjørn Mork bj...@mork.no
---
 drivers/usb/serial/option.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index cc40f47..5ce88d1 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -886,8 +886,6 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 
0xff),
  .driver_info = (kernel_ulong_t)net_intf4_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 
0xff) },
-   { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 
0xff),
- .driver_info = (kernel_ulong_t)net_intf3_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 
0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 
0xff) },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 
0xff) },
@@ -1092,6 +1090,10 @@ static const struct usb_device_id option_ids[] = {
 .driver_info = (kernel_ulong_t)zte_ad3812_z_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 
0xff, 0xff, 0xff),
 .driver_info = (kernel_ulong_t)zte_mc2716_z_blacklist },
+   { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
+   { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
+   { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
+
{ USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
{ USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
{ USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, 
ALINK_VENDOR_ID */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 05/11] USB: chipidea: don't let probe fail if otg controller start one role failed

2012-09-11 Thread Richard Zhao
On Tue, Sep 11, 2012 at 10:23:55AM +0300, Alexander Shishkin wrote:
 Richard Zhao richard.z...@freescale.com writes:
 
  On Wed, Aug 29, 2012 at 12:48:15PM +0300, Alexander Shishkin wrote:
  Richard Zhao richard.z...@freescale.com writes:
  
   On Wed, Aug 29, 2012 at 11:10:33AM +0300, Alexander Shishkin wrote:
   Richard Zhao richard.z...@freescale.com writes:
   
On Tue, Aug 28, 2012 at 11:38:23AM +0300, Alexander Shishkin wrote:
Richard Zhao richard.z...@freescale.com writes:

 One role failed, but the other role will possiblly still work.
 For example, when udc start failed, if plug in a host device,
 it works.

If you're a host device, ci-role should be HOST at this point and
ci_role_start() shouldn't fail. If ci-role is detected wrongly, the
role detection must be fixed. If ci_role_start() fails for host, but 
it
still works when it's called again after the id pin change is 
detected,
again, the problem is elsewhere.
The check is only for OTG device. For single role device, it just fail
if it start the role failed.
   
   Sorry, can you rephrase?
   


 Signed-off-by: Richard Zhao richard.z...@freescale.com
 ---
  drivers/usb/chipidea/core.c |7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

 diff --git a/drivers/usb/chipidea/core.c 
 b/drivers/usb/chipidea/core.c
 index 19ef324..8fd390a 100644
 --- a/drivers/usb/chipidea/core.c
 +++ b/drivers/usb/chipidea/core.c
 @@ -473,8 +473,11 @@ static int __devinit ci_hdrc_probe(struct 
 platform_device *pdev)
ret = ci_role_start(ci, ci-role);
if (ret) {
dev_err(dev, can't start %s role\n, 
 ci_role(ci)-name);
 -  ret = -ENODEV;
 -  goto rm_wq;
 +  ci-role = CI_ROLE_END;

So are you relying on id pin interrupt for initializing the role 
after
this? Can you provide more details?
Yes. The ID pin detect still works. My case is, gadget role failed,
host role works. I was trying not to ruin host function.
   
   But it shouldn't even try to start the gadget, because ci_otg_role()
   should set ci-role to HOST before ci_role_start() happens.
   It depends on ID pin. If ID pin is gadget and gadget is not support well,
   ci_role_start will fail. See below example.
   
   Another question is, why does gadget start fail?
   There's one example:
   If usb phy don't support otg yet, otg_set_peripheral will fail, and
   then cause udc_start fail.
  
  So you should drop the CI13XXX_REQUIRE_TRANSCEIVER flag from imx
  platform data till the phy is fully implemented.
  It's just an example. We can not assume udc_start always success. If it
  fails, isn't it better to continue support of host than say game over?
 
 Ok, I think what we need here is to rework error handling around role
 switching, so that we can allow certain things to fail and retry at a
 later point (say at id pin change), while being careful about the other
 failures.
 
 If this patch is not crucial for imx right now, I'd prefer to leave it
 out.
That's OK. but I hope other function related patch can be merged for
3.7 :)

Thanks
Richard
 
 Regards,
 --
 Alex
 

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] arm/dts: omap: Add omap-usb2 dt data

2012-09-11 Thread Benoit Cousson
Hi Kishon,

On 09/11/2012 08:12 AM, Kishon Vijay Abraham I wrote:
 Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
 connected to ocp2scp, omap-usb2 dt data is added as a child node
 of ocp2scp.

Could you add more details about the omap-usb2?

You must update the Documentation binding with that compatible name.
Is it already part of the driver serie? The MUSB driver is referring to
ti,musb-omap2430 only.

 
 Acked-by: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
 Applies on
 git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
  arch/arm/boot/dts/omap4.dtsi |5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index 8a780b2..bdc21f1 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -302,6 +302,11 @@
   #size-cells = 1;
   ranges;
   ti,hwmods = ocp2scp_usb_phy;

There is no ocp2scp_usb_phy in the current omap4.dtsi?
What base did you used?

You have to use lo/devel-dt branch as a base. All the latest DTS patches
an in there for 3.7.

Regards,
Benoit

 + usb2phy@4a0ad080 {
 + compatible = ti,omap-usb2;
 + reg = 0x4a0ad080 0x58,
 +   0x4a002300 0x4;
 + };
   };
   };
  };
 

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] arm/dts: omap: Add omap-usb2 dt data

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 11, 2012 at 1:53 PM, Benoit Cousson b-cous...@ti.com wrote:
 Hi Kishon,

 On 09/11/2012 08:12 AM, Kishon Vijay Abraham I wrote:
 Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
 connected to ocp2scp, omap-usb2 dt data is added as a child node
 of ocp2scp.

 Could you add more details about the omap-usb2?
I think information about omap-usb2 driver is added in
 *usb: phy: add a new driver for omap usb2 phy.*.
Do you want the same thing to be added here?

 You must update the Documentation binding with that compatible name.
Yes. It's part of *usb: phy: add a new driver for omap usb2 phy.*
 Is it already part of the driver serie? The MUSB driver is referring to
 ti,musb-omap2430 only.

Will correct the Documentation for MUSB.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 10, 2012 at 10:13 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Sep 10, 2012 at 06:17:03PM +0200, Benoit Cousson wrote:
  On 9/6/2012 8:25 PM, Kishon Vijay Abraham I wrote:
  The mailbox register for usb otg in omap is present in control module.
  On detection of any events VBUS or ID, this register should be written
  to send the notification to musb core.
 
  Till we have a separate control module driver to write to control 
  module,
  omap2430 will handle the register writes to control module by itself. 
  So
  a new address space to represent this control module register is added
  to usb_otg_hs.
 
  Cc: Benoit Cousson b-cous...@ti.com
  Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
  ---
   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 +
   1 file changed, 5 insertions(+)
 
  diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
  b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  index 242aee4..02341bc 100644
  --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space 
  omap44xx_usb_otg_hs_addrs[] = {
 .pa_end = 0x4a0ab003,
 .flags  = ADDR_TYPE_RT
 },
  +  {
  +  .pa_start   = 0x4a00233c,
  +  .pa_end = 0x4a00233f,
  +  .flags  = ADDR_TYPE_RT
  +  },
 
  I do not have any objection/comment here, but I believe this is control
  module address space required for USB module, right?
  I am not sure this is right way of accessing control module space.
  Actually Control Module Access required for drivers is one of the
  blocking issue we have currently.
 
  Also there was some effort put up by 'Konstantine' to convert Control
  module to MFD driver, I haven't seen any further update on it. But it
  would be good to check with him.
 
  this was an agreement with Benoit since we already lost a couple merge
  windows for this patchset. We agreed to wait until -rc4 for SCM driver
  and if it wasn't ready, we'd go ahead with this and SCM author would fix
  it up on a patch converting users to new SCM driver.
 
  Tony, can I get your Acked-by to this patch so I can take it together
  with the rest of the series ? Thanks
 
  ps: I'll apply this to my 'musb' branch which is immutable, so it's safe
  to merge it into your tree once I apply.
 
  It would be best if this got acked by Benoit and Paul as they may
  have some other patches queued up. I'll ack if they ack ;)
 
  Benoit, care to ack this patch ???

 Gosh, that's hard to ack something like that :-)

 btw, that's not different than what's already in tree, the only
 difference is that now hwmod knows about it...

 But considering that the control module driver is not there yet, I have
 no choice but accepting that one if we want to have the functionality
 we've been waiting for years.

 Could you just update the patch with a big disclaimer on top of the
 address range to explain that this should not belong here and will be
 removed ASAP, when the proper driver will be done.

 sure, that's doable... Kishon, can you do this ASAP ? I want to send my
 pull requests tomorrow at the latest.

Sure. Will send now.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 06/11] USB: mxs-phy: add basic otg support

2012-09-11 Thread Felipe Balbi
Hi,

On Tue, Aug 28, 2012 at 03:03:12PM +0800, Richard Zhao wrote:
 Signed-off-by: Richard Zhao richard.z...@freescale.com

if you add a commit log you can add my:

Acked-by: Felipe Balbi ba...@ti.com

 ---
  drivers/usb/otg/mxs-phy.c |   21 +
  1 file changed, 21 insertions(+)
 
 diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
 index c1a67cb..6a03e97 100644
 --- a/drivers/usb/otg/mxs-phy.c
 +++ b/drivers/usb/otg/mxs-phy.c
 @@ -97,12 +97,24 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int 
 port)
   return 0;
  }
  
 +static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host)
 +{
 + return 0;
 +}
 +
 +static int mxs_phy_set_peripheral(struct usb_otg *otg,
 + struct usb_gadget *gadget)
 +{
 + return 0;
 +}
 +
  static int mxs_phy_probe(struct platform_device *pdev)
  {
   struct resource *res;
   void __iomem *base;
   struct clk *clk;
   struct mxs_phy *mxs_phy;
 + struct usb_otg *otg;
  
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
 @@ -139,6 +151,15 @@ static int mxs_phy_probe(struct platform_device *pdev)
  
   mxs_phy-clk = clk;
  
 + otg = devm_kzalloc(pdev-dev, sizeof(struct usb_otg), GFP_KERNEL);
 + if (!otg)
 + return -ENOMEM;
 + otg-phy = mxs_phy-phy;
 + otg-set_host = mxs_phy_set_host;
 + otg-set_peripheral = mxs_phy_set_peripheral;
 +
 + mxs_phy-phy.otg = otg;
 +
   platform_set_drvdata(pdev, mxs_phy-phy);
  
   return 0;
 -- 
 1.7.9.5
 
 

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v2 0/3] omap: musb: Add device tree support

2012-09-11 Thread Kishon Vijay Abraham I
This patch series adds device tree support for MUSB.

The glue layer is now made to write to mailbox register (present in
control module) instead of calling phy layer to write to mailbox
register. Writing to mailbox register notifies the core of events like
device connect/disconnect.

Changes from v1:
* Added a comment in hwmod data to remove the control module data from
otg_hs once control driver is in place.
* Fixed the omap-usb Documentation to the correct compatible value
(Should be ti,omap4-musb or ti,omap3-musb)

Previously these patches were part of
[PATCH v7 0/7] omap: musb: Add device tree support

This patch series was created to contain only the *musb* part and it
also has one hwmod patch.

This patch series was created on
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git musb

Kishon Vijay Abraham I (3):
  arm: omap: hwmod: add a new addr space in otg for writing to control
module
  usb: musb: omap: write directly to mailbox instead of using phy
  usb: musb: omap: Add device tree support for omap musb glue

 Documentation/devicetree/bindings/usb/omap-usb.txt |   33 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |6 ++
 drivers/usb/musb/omap2430.c|  106 ++--
 drivers/usb/musb/omap2430.h|9 ++
 4 files changed, 147 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-09-11 Thread Kishon Vijay Abraham I
The mailbox register for usb otg in omap is present in control module.
On detection of any events VBUS or ID, this register should be written
to send the notification to musb core.

Till we have a separate control module driver to write to control module,
omap2430 will handle the register writes to control module by itself. So
a new address space to represent this control module register is added
to usb_otg_hs.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 242aee4..3c19120 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5890,6 +5890,12 @@ static struct omap_hwmod_addr_space 
omap44xx_usb_otg_hs_addrs[] = {
.pa_end = 0x4a0ab003,
.flags  = ADDR_TYPE_RT
},
+   {
+   /* XXX: Remove this once control module driver is in place */
+   .pa_start   = 0x4a00233c,
+   .pa_end = 0x4a00233f,
+   .flags  = ADDR_TYPE_RT
+   },
{ }
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] usb: musb: omap: write directly to mailbox instead of using phy

2012-09-11 Thread Kishon Vijay Abraham I
The glue layer should directly write to mailbox register (present in
control module) instead of calling phy layer to write to mailbox
register. Writing to mailbox register notifies the core of events like
device connect/disconnect.

Currently writing to control module register is taken care in this
driver which will be removed once the control module driver is in place.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/usb/musb/omap2430.c |   52 +--
 drivers/usb/musb/omap2430.h |9 
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 02c39a7..f4d9503 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -45,6 +45,7 @@ struct omap2430_glue {
struct platform_device  *musb;
enum omap_musb_vbus_id_status status;
struct work_struct  omap_musb_mailbox_work;
+   u32 __iomem *control_otghs;
 };
 #define glue_to_musb(g)platform_get_drvdata(g-musb)
 
@@ -52,6 +53,26 @@ struct omap2430_glue *_glue;
 
 static struct timer_list musb_idle_timer;
 
+/**
+ * omap4_usb_phy_mailbox - write to usb otg mailbox
+ * @glue: struct omap2430_glue *
+ * @val: the value to be written to the mailbox
+ *
+ * On detection of a device (ID pin is grounded), this API should be called
+ * to set AVALID, VBUSVALID and ID pin is grounded.
+ *
+ * When OMAP is connected to a host (OMAP in device mode), this API
+ * is called to set AVALID, VBUSVALID and ID pin in high impedance.
+ *
+ * XXX: This function will be removed once we have a seperate driver for
+ * control module
+ */
+static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
+{
+   if (glue-control_otghs)
+   writel(val, glue-control_otghs);
+}
+
 static void musb_do_idle(unsigned long _musb)
 {
struct musb *musb = (void *)_musb;
@@ -247,6 +268,7 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
+   u32 val;
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb-controller;
struct musb_hdrc_platform_data *pdata = dev-platform_data;
@@ -262,7 +284,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_ID;
if (musb-gadget_driver) {
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
omap2430_musb_set_vbus(musb, 1);
}
break;
@@ -275,7 +298,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_VBUS;
if (musb-gadget_driver)
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
case OMAP_MUSB_ID_FLOAT:
@@ -292,7 +316,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
if (musb-xceiv-otg-set_vbus)
otg_set_vbus(musb-xceiv-otg, 0);
}
-   usb_phy_shutdown(musb-xceiv);
+   val = SESSEND | IDDIG;
+   omap4_usb_phy_mailbox(glue, val);
break;
default:
dev_dbg(dev, ID float\n);
@@ -367,6 +392,7 @@ err1:
 static void omap2430_musb_enable(struct musb *musb)
 {
u8  devctl;
+   u32 val;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb-controller;
struct omap2430_glue *glue = dev_get_drvdata(dev-parent);
@@ -376,7 +402,8 @@ static void omap2430_musb_enable(struct musb *musb)
switch (glue-status) {
 
case OMAP_MUSB_ID_GROUND:
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
if (data-interface_type != MUSB_INTERFACE_UTMI)
break;
devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
@@ -395,7 +422,8 @@ static void omap2430_musb_enable(struct musb *musb)
break;
 
case OMAP_MUSB_VBUS_VALID:
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
default:
@@ -405,11 +433,14 @@ static void omap2430_musb_enable(struct musb *musb)
 
 static void omap2430_musb_disable(struct musb *musb)
 {
+   u32 val;
struct device *dev = musb-controller;
struct omap2430_glue *glue = dev_get_drvdata(dev-parent);
 
-   if (glue-status != OMAP_MUSB_UNKNOWN)
-  

[PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue

2012-09-11 Thread Kishon Vijay Abraham I
Added device tree support for omap musb driver and updated the
Documentation with device tree binding information.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |   33 
 drivers/usb/musb/omap2430.c|   54 
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
new file mode 100644
index 000..29a043e
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -0,0 +1,33 @@
+OMAP GLUE
+
+OMAP MUSB GLUE
+ - compatible : Should be ti,omap4-musb or ti,omap3-musb
+ - ti,hwmods : must be usb_otg_hs
+ - multipoint : Should be 1 indicating the musb controller supports
+   multipoint. This is a MUSB configuration-specific setting.
+ - num_eps : Specifies the number of endpoints. This is also a
+   MUSB configuration-specific setting. Should be set to 16
+ - ram_bits : Specifies the ram address size. Should be set to 12
+ - interface_type : This is a board specific setting to describe the type of
+   interface between the controller and the phy. It should be 0 or 1
+   specifying ULPI and UTMI respectively.
+ - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
+   represents PERIPHERAL.
+ - power : Should be 50. This signifies the controller can supply upto
+   100mA when operating in host mode.
+
+SOC specific device node entry
+usb_otg_hs: usb_otg_hs@4a0ab000 {
+   compatible = ti,omap4-musb;
+   ti,hwmods = usb_otg_hs;
+   multipoint = 1;
+   num_eps = 16;
+   ram_bits = 12;
+};
+
+Board specific device node entry
+usb_otg_hs {
+   interface_type = 1;
+   mode = 3;
+   power = 50;
+};
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f4d9503..d96873b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -30,6 +30,7 @@
 #include linux/init.h
 #include linux/list.h
 #include linux/io.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/dma-mapping.h
 #include linux/pm_runtime.h
@@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 static int __devinit omap2430_probe(struct platform_device *pdev)
 {
struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
+   struct omap_musb_board_data *data;
struct platform_device  *musb;
struct omap2430_glue*glue;
+   struct device_node  *np = pdev-dev.of_node;
+   struct musb_hdrc_config *config;
struct resource *res;
int ret = -ENOMEM;
 
@@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device 
*pdev)
if (glue-control_otghs == NULL)
dev_dbg(pdev-dev, Failed to obtain control memory\n);
 
+   if (np) {
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(pdev-dev,
+   failed to allocate musb platfrom data\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   dev_err(pdev-dev,
+   failed to allocate musb board data\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
+   if (!data) {
+   dev_err(pdev-dev,
+   failed to allocate musb hdrc config\n);
+   goto err1;
+   }
+
+   of_property_read_u32(np, mode, (u32 *)pdata-mode);
+   of_property_read_u32(np, interface_type,
+   (u32 *)data-interface_type);
+   of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
+   of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
+   of_property_read_u32(np, power, (u32 *)pdata-power);
+   config-multipoint = of_property_read_bool(np, multipoint);
+
+   pdata-board_data   = data;
+   pdata-config   = config;
+   }
+
pdata-platform_ops = omap2430_ops;
 
platform_set_drvdata(pdev, glue);
@@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
 #define DEV_PM_OPS NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id omap2430_id_table[] = {
+   {
+   .compatible = ti,omap4-musb
+   },
+   {
+   .compatible = ti,omap3-musb
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(of, omap2430_id_table);

Re: [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-09-11 Thread Benoit Cousson
On 09/11/2012 11:09 AM, Kishon Vijay Abraham I wrote:
 The mailbox register for usb otg in omap is present in control module.
 On detection of any events VBUS or ID, this register should be written
 to send the notification to musb core.
 
 Till we have a separate control module driver to write to control module,
 omap2430 will handle the register writes to control module by itself. So
 a new address space to represent this control module register is added
 to usb_otg_hs.
 
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

Acked-by: Benoit Cousson b-cous...@ti.com

 ---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
 b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
 index 242aee4..3c19120 100644
 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
 +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
 @@ -5890,6 +5890,12 @@ static struct omap_hwmod_addr_space 
 omap44xx_usb_otg_hs_addrs[] = {
   .pa_end = 0x4a0ab003,
   .flags  = ADDR_TYPE_RT
   },
 + {
 + /* XXX: Remove this once control module driver is in place */
 + .pa_start   = 0x4a00233c,
 + .pa_end = 0x4a00233f,
 + .flags  = ADDR_TYPE_RT
 + },
   { }
  };
  
 

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: dwc3: query: dma sg implementation for isoc

2012-09-11 Thread Felipe Balbi
On Tue, Sep 11, 2012 at 12:29:36PM +0530, Pratyush Anand wrote:
 On 9/10/2012 6:49 PM, Felipe Balbi wrote:
 On Mon, Sep 10, 2012 at 06:45:06PM +0530, Pratyush Anand wrote:
 Hi Felip,
 
 Thanks for the clarifications.
 
 On 9/10/2012 6:29 PM, Felipe Balbi wrote:
 If my understanding is correct, then I might need to modify dwc3
 driver a bit. only first TRB of the service interval should have
 TRBCTL as ISOC_FIRST rest should have TRBCTL as ISOC.
 Why ? IIRC, ISOC_FIRST was a hint to the internal packet scheduler to
 give higher priority to the isochronous packet, right ? Does it make any
 difference for your use case ?
 
 Databook says:
 
 
 The first TRB in a Buffer Descriptor must have the TRBCTL field set
 to the “Isochronous-First” type while all others have this field set
 to “Isochronous”.
 
 aaa true :-) I had forgotten about that extra bit of information when
 using chained TRBs :-s My bad. Please send a patch.
 
 So I thought to modify the code. As of now, ISOC IN does not work
 fully with either All Isochronous-First or Isochronous First +
 Isochronous implementation (in case of more than one TRB for one
 service interval).
 May be I am doing some mistake in my code. :(
 I am debugging. Will get back with my observations.
 
 I think you're perfectly right at the need for ISOCHRONOUS_FIRST flag.
 My bad.
 
 
 Hummm.. It works with Isochronous First + Isochronous
 implementation. But, code needs many modification..
 
 We have one trb and one trb_dma per struct dwc3_request. We take
 lot of decisions on the basis of req-trb value. These all will
 change in case of SG. We will not have only one TRB per struct
 usb_request.
 
 I am going to keep array for trb and trb_dma and then to manage all
 these with backward compatibility (non SG case). What do you say?
 
 struct dwc3_trb *trb[DWC3_TRB_NUM];
 dma_addr_t  trb_dma[DWC3_TRB_NUM];

that doesn't look right :-(

Isn't something like below enough ?

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3ddf779..330556b 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -749,7 +749,8 @@ static void dwc3_gadget_ep_free_request(struct usb_ep *ep,
  */
 static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
struct dwc3_request *req, dma_addr_t dma,
-   unsigned length, unsigned last, unsigned chain)
+   unsigned length, unsigned first, unsigned last,
+   unsigned chain)
 {
struct dwc3 *dwc = dep-dwc;
struct dwc3_trb *trb;
@@ -786,7 +787,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
break;
 
case USB_ENDPOINT_XFER_ISOC:
-   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
+   if (first  chain)
+   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
+   else
+   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS;
 
if (!req-request.no_interrupt)
trb-ctrl |= DWC3_TRB_CTRL_IOC;
@@ -912,7 +916,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
chain = false;
 
dwc3_prepare_one_trb(dep, req, dma, length,
-   last_one, chain);
+   (i == 0), first_one, last_one,
+   chain);
 
if (last_one)
break;

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v9 00/13] usb: musb: adding multi instance support

2012-09-11 Thread Felipe Balbi
Hi,

On Fri, Aug 31, 2012 at 04:39:46PM +0530, Ravi Babu wrote:
 This series of patches adds,
 a) Multi instances support in musb driver
 b) DT support for musb_dsps glue layer
 c) DT support for NOP transceiver
 
 AM33xx and TI81xx has dual musb controller and has two usb PHY of same type.
 This patch series uses 'phandle' based API devm_usb_get_phy_by_phandle() to
 get the PHY of same type. This API support is being added by Kishon's patch
 discussed at [1]
 
 The series applies to felipe/master [1] branch
   + Vaibhav baseport patches on his tree at [4]
   + Kishon's multi phy patches on Felipe's branch 'xceiv'
   + Kishon's patch on phandle at [2]
   + Damodar's recent patch at [3] 
   + Ajay's  Damodar's patches at [5] and [6] included in this series
 
 1. http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary
 2. http://marc.info/?l=linux-usbm=134070369306112w=2
 3. http://marc.info/?l=linux-usbm=134200284230689w=2
 4. https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-staging
 5. http://marc.info/?l=linux-usbm=134200285530701w=2
 6. http://marc.info/?l=linux-usbm=134208820028625w=2
 
 Changes from v8:
   - included Sergei's comment, removing underscore in device tree file
   - removed duplicated signoff from patches
 Changes from v7:
   - patches rebased on felipe/master branch  verified
   - included additional two patches 0001  0002 as part of this series
 which are already submitted [5]  [6] 
 Changes from v6:
   - Removed parent_pdev to get glue and used dev_get_getdrv() as per
 Felipe's comment
   - use pr_debug() instead of pr_info() as per Felipe's comment
 Changes from v5:
   - Removed musb-id as per Felipe's comment
   - used nop_ida as per Felipe's comment
 Changes from v4:
   - Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL()
   - Fixed Felipe's comment on using dev_set_mask()
 Changes from v3:
   - Fixed Kishon's comment on removing id from phy struct and
 removing unneeded #else part.
 Changes from v2:
   - Fixed Sergei's comment on not using address prefix in musb_dsps
 glue and nop transceiver dt dats.
   - Also removed the ti string in compatible property for nop data.
 Changes from v1:
   - Defined musb_ida to manage core ids based on Felipe's comment
 in [PATCH 01/11]

I tried appliying this, but this doesn't apply. Please rebase on my musb
branch. Unfortunately there's no time anymore to wait otherwise the
entire musb branch will miss this merge window.

I'm sorry

-- 
balbi


signature.asc
Description: Digital signature


[GIT PULL] usb: gadget: patches for v3.7 merge window

2012-09-11 Thread Felipe Balbi
Hi Greg,

here's the pull request for the gadget framework.

There's a bunch of details here and there'll be one conflict with your
greg/usb-next branch. I have pushed a branch 'merge-result-for-greg' to
my k.org tree with the solved merge conflict, if you want to take a
look.

Please let me know if there are any issues with the merge.

The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92:

  Linux 3.6-rc2 (2012-08-16 14:51:24 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
tags/gadget-for-v3.7

for you to fetch changes up to 5c4d46eb89fe99011a02048533857345d9e8b506:

  usb: gadget serial: don't shift bcd version left by 16 (2012-09-10 20:04:20 
+0300)


usb: gadget: patches for v3.7 merge window

This pull request is large but the biggest part is the first part
of the cleanup on the gadget framework so we have a saner setup
to add configfs support for v3.8.

We have also some more conversions to the new udc_start/udc_stop
which makes us closer from dropping the old interfaces.

USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED are finally gone,
thanks to Michal for his awesome work.

Other than that, we have the usual set of miscellaneous changes
and cleanups involving improvements to debug messages, removal
of duplicated includes, moving dereference after NULL test,
making renesas_hsbhs' irq handler Shared, unused code being dropped,
prevention of sleep-inside-spinlock bugs and a race condition fix
on udc-core.


Alan Stern (1):
  usb: gadget: dummy-hcd: remember to update driver pointer

Andy Shevchenko (2):
  usb: gadget: use native print_hex_dump_bytes()
  usb: gadget: use %pm to print mac addresses

Chao Xie (1):
  usb: gadget: mv_udc: add iso support

Du, Changbin (1):
  usb: gadget: s3c-hsotg: fix core reset timeout failure

Fabio Porcedda (1):
  usb: gadget: at91_udc: fix dt support

Julia Lawall (1):
  usb: gadget: lpc32xx_udc.c: adjust inconsistent IS_ERR and PTR_ERR

Kevin Cernekee (2):
  usb: gadget: udc-core: Race between disconnect/unbind and setup
  usb: gadget: bcm63xx UDC driver

Michael Grzeschik (1):
  usb composite: fix locking in usb_function_activate

Michal Nazarewicz (1):
  usb: gadget: get rid of USB_GADGET_{DUAL,SUPER}SPEED

Neil Zhang (5):
  usb: gadget: mv_udc: reduce the delay interval
  usb: gadget: mv_udc: remove unused code
  usb: gadget: mv_udc: avoid sleeping on spinlock
  usb: gadget: mv_udc: enable stream mode
  usb: gadget: mv_udc: fix boot up hang

Roland Stigge (3):
  usb: gadget: lpc32xx_udc: Port to new start/stop interface
  usb: gadget: lpc32xx_udc: Remove usb_endpoint_descriptor
  usb: gadget: lpc32xx_udc: Support multiple controllers

Sachin Kamat (9):
  usb: gadget: s3c2410_udc: Replace asm/io.h with linux/io.h
  usb: gadget: s3c2410_udc: Use pr_* and dev_err functions
  usb: gadget: s3c2410_udc: Silence checkpatch errors and warnings
  usb: gadget: s3c2410_udc: Move assignment outside if condition
  usb: gadget: s3c2410_udc: Do not use integer for NULL
  usb: gadget: s3c-hsudc: Use devm_* functions
  usb: gadget: s3c-hsudc: Add missing braces around sizeof
  usb: gadget: s3c-hsudc: Replace 0 with NULL for pointers
  usb: gadget: s3c-hsotg: Use devm_clk_get function

Sebastian Andrzej Siewior (32):
  staging: ccg: Add a note about compatibility issues.
  usb: gadget: move bind callback into driver struct usb_composite_driver
  usb: gadget: remove __devexit in f_uac2
  usb: gadget: push all usb_composite_driver structs into __refdata
  usb: gadget: move bind() callback back to struct usb_composite_driver
  usb: gadget: move bind() callback back to struct usb_gadget_driver
  staging: ccg: include all sourced files
  usb: gadget: remove global variable composite in composite.c
  usb: gadget: pxa25x: make it compile with debug again
  usb: gadget: start with libcomposite
  usb: gadget: libcomposite: move config.c into libcomposite
  usb: gadget: move global vars from epautoconf into struct usb_gadget
  usb: gadget: libcomposite: add epautoconf.c to libcomposite
  usb: gadget: move USB_BUFSIZ into global composite.h
  usb: gadget: remove bufsiz from struct usb_composite_dev
  usb: gadget: make composite module options readonly only
  usb: gadget: use usb_string_ids_tab instead multiple usb_string_id()
  usb: gadget: make g_printer enumerate again
  usb: gadget: initialize the strings in tcm_usb_gadget properly
  usb: gadget: move usb_gadget_controller_number() into a .c file and 
libcomposite
  usb: gadget: push VID/PID/USB BCD module option into gadgets
  usb: gadget: make sure each gadget is using same index for Product, 
Serial,…
  usb: gadget: push 

[GIT PULL] usb: xceiv: patches for v3.7 merge window

2012-09-11 Thread Felipe Balbi
Hi Greg,

here's the transceiver pull request. Let me know if I've missed
something:

The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee:

  Linux 3.6-rc1 (2012-08-02 16:38:10 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
tags/xceiv-for-v3.7

for you to fetch changes up to 363366cf61c544ea476f3d220f43a95cb03014f5:

  usb: otg: mxs-phy: Fix mx23 operation (2012-09-10 19:46:38 +0300)


usb: xceiv: patches for v3.7 merge window

nop xceiv got its own header to avoid polluting otg.h. It has also
learned to work as USB2 and USB3 phys so we can use it on USB3
controllers.

Together with those two changes to nop xceiv, we're adding basic
PHY support to dwc3 driver, this is to allow platforms which actually
have a SW-controllable PHY talk to them through dwc3 driver.

We're adding a new phy driver for the OMAP architecture. This driver
is for the PHY found in OMAP4 SoCs, and a new phy driver for the
marvell architecture. An extra phy driver - for Tegra SoCs - is now
moving from arch/arm/mach-tegra* to drivers/usb/phy.

Also here, there's the creation of linux/usb/phy.h which should be
used from now on for PHY drivers, even those which don't support
OTG.


Felipe Balbi (6):
  usb: xceiv: create nop-usb-xceiv.h and avoid pollution on otg.h
  usb: xceiv: nop: let it work as USB2 and USB3 phy
  usb: dwc3: pci: add nop transceiver support
  usb: dwc3: omap: add nop transceiver support
  usb: dwc3: exynos: add nop transceiver support
  usb: dwc3: add basic PHY support

Kishon Vijay Abraham I (5):
  usb: phy: add a new driver for omap usb2 phy
  usb: otg: make twl6030_usb as a comparator driver to omap_usb2
  usb: twl6030: Add dt support for twl6030 usb
  usb: twl4030: Add device tree support for twl4030 usb
  arm: omap: phy: remove unused functions from omap-phy-internal.c

Mike Thompson (1):
  usb: otg: mxs-phy: Fix mx23 operation

Roland Stigge (1):
  usb: phy: isp1301: Remove unused static array and define

Shubhrajyoti D (1):
  usb: otg: Remove the unneeded NULL check

Venu Byravarasu (3):
  usb: otg: Move phy interface to separate file.
  usb: move phy driver from mach-tegra to drivers/usb
  usb: phy: fix build break

Wei Yongjun (1):
  usb: otg: move the dereference below the NULL test

Yu Xu (1):
  usb: phy: mv_u3d: Add usb phy driver for mv_u3d

 .../devicetree/bindings/usb/twl-usb.txt|  40 +++
 Documentation/devicetree/bindings/usb/usb-phy.txt  |  17 +
 arch/arm/mach-omap2/board-omap3evm.c   |   1 +
 arch/arm/mach-omap2/omap_phy_internal.c| 138 -
 arch/arm/mach-omap2/twl-common.c   |   5 -
 arch/arm/mach-omap2/usb-musb.c |   3 -
 arch/arm/mach-tegra/Makefile   |   1 -
 arch/arm/mach-tegra/devices.c  |   2 +-
 arch/arm/mach-tegra/devices.h  |   2 +-
 drivers/usb/dwc3/core.c|  15 +
 drivers/usb/dwc3/core.h|   5 +
 drivers/usb/dwc3/dwc3-exynos.c |  66 
 drivers/usb/dwc3/dwc3-omap.c   |  66 
 drivers/usb/dwc3/dwc3-pci.c|  67 
 drivers/usb/host/ehci-tegra.c  |  14 +-
 drivers/usb/musb/am35x.c   |   1 +
 drivers/usb/musb/blackfin.c|   1 +
 drivers/usb/musb/da8xx.c   |   1 +
 drivers/usb/musb/davinci.c |   1 +
 drivers/usb/musb/musb_dsps.c   |   1 +
 drivers/usb/musb/tusb6010.c|   1 +
 drivers/usb/otg/Kconfig|   2 +-
 drivers/usb/otg/fsl_otg.c  |  34 +-
 drivers/usb/otg/mxs-phy.c  |  38 ++-
 drivers/usb/otg/nop-usb-xceiv.c|   8 +-
 drivers/usb/otg/otg.c  |   2 +-
 drivers/usb/otg/twl4030-usb.c  |  26 +-
 drivers/usb/otg/twl6030-usb.c  | 157 +++---
 drivers/usb/phy/Kconfig|  17 +
 drivers/usb/phy/Makefile   |   3 +
 drivers/usb/phy/isp1301.c  |   6 -
 drivers/usb/phy/mv_u3d_phy.c   | 345 +
 drivers/usb/phy/mv_u3d_phy.h   | 105 +++
 drivers/usb/phy/omap-usb2.c| 271 
 .../usb_phy.c = drivers/usb/phy/tegra_usb_phy.c   | 152 +
 include/linux/usb/nop-usb-xceiv.h  |  24 ++
 include/linux/usb/omap_usb.h   |  46 +++
 include/linux/usb/otg.h| 236 +-
 include/linux/usb/phy.h  

Re: usb: dwc3: query: dma sg implementation for isoc

2012-09-11 Thread Pratyush Anand

On 9/11/2012 2:39 PM, Felipe Balbi wrote:

On Tue, Sep 11, 2012 at 12:29:36PM +0530, Pratyush Anand wrote:

On 9/10/2012 6:49 PM, Felipe Balbi wrote:

On Mon, Sep 10, 2012 at 06:45:06PM +0530, Pratyush Anand wrote:

Hi Felip,

Thanks for the clarifications.

On 9/10/2012 6:29 PM, Felipe Balbi wrote:

If my understanding is correct, then I might need to modify dwc3

driver a bit. only first TRB of the service interval should have
TRBCTL as ISOC_FIRST rest should have TRBCTL as ISOC.

Why ? IIRC, ISOC_FIRST was a hint to the internal packet scheduler to
give higher priority to the isochronous packet, right ? Does it make any
difference for your use case ?


Databook says:


The first TRB in a Buffer Descriptor must have the TRBCTL field set
to the “Isochronous-First” type while all others have this field set
to “Isochronous”.


aaa true :-) I had forgotten about that extra bit of information when
using chained TRBs :-s My bad. Please send a patch.


So I thought to modify the code. As of now, ISOC IN does not work
fully with either All Isochronous-First or Isochronous First +
Isochronous implementation (in case of more than one TRB for one
service interval).
May be I am doing some mistake in my code. :(
I am debugging. Will get back with my observations.


I think you're perfectly right at the need for ISOCHRONOUS_FIRST flag.
My bad.



Hummm.. It works with Isochronous First + Isochronous
implementation. But, code needs many modification..

We have one trb and one trb_dma per struct dwc3_request. We take
lot of decisions on the basis of req-trb value. These all will
change in case of SG. We will not have only one TRB per struct
usb_request.

I am going to keep array for trb and trb_dma and then to manage all
these with backward compatibility (non SG case). What do you say?

struct dwc3_trb *trb[DWC3_TRB_NUM];
dma_addr_t  trb_dma[DWC3_TRB_NUM];


that doesn't look right :-(

Isn't something like below enough ?


Probably not ;)
It will handle only one part, ie to manage DWC3_TRBCTL_ISOCHRONOUS_FIRST 
 DWC3_TRBCTL_ISOCHRONOUS.


But, problem is that we have single trb associated with each struct 
dwc3_trb. In case of SG, we will prepare req-request.num_mapped_sgs 
number of TRBs against one request (ie one struct dwc3_trb).


Each TRBs of SG need to be updated into core cache. During cleanup, we 
need to check status of each TRB of SG.


How can we manage if we have only one struct dwc3_trb *trb associated 
with struct dwc3_trb.



Regards
Pratyush




diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3ddf779..330556b 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -749,7 +749,8 @@ static void dwc3_gadget_ep_free_request(struct usb_ep *ep,
   */
  static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
struct dwc3_request *req, dma_addr_t dma,
-   unsigned length, unsigned last, unsigned chain)
+   unsigned length, unsigned first, unsigned last,
+   unsigned chain)
  {
struct dwc3 *dwc = dep-dwc;
struct dwc3_trb *trb;
@@ -786,7 +787,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
break;

case USB_ENDPOINT_XFER_ISOC:
-   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
+   if (first  chain)
+   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
+   else
+   trb-ctrl = DWC3_TRBCTL_ISOCHRONOUS;

if (!req-request.no_interrupt)
trb-ctrl |= DWC3_TRB_CTRL_IOC;
@@ -912,7 +916,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
chain = false;

dwc3_prepare_one_trb(dep, req, dma, length,
-   last_one, chain);
+   (i == 0), first_one, last_one,
+   chain);

if (last_one)
break;




--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue

2012-09-11 Thread Vaibhav Hiremath


On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
 Added device tree support for omap musb driver and updated the
 Documentation with device tree binding information.
 
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/omap-usb.txt |   33 
  drivers/usb/musb/omap2430.c|   54 
 
  2 files changed, 87 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
 
 diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
 b/Documentation/devicetree/bindings/usb/omap-usb.txt
 new file mode 100644
 index 000..29a043e
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
 @@ -0,0 +1,33 @@
 +OMAP GLUE
 +
 +OMAP MUSB GLUE
 + - compatible : Should be ti,omap4-musb or ti,omap3-musb
 + - ti,hwmods : must be usb_otg_hs
 + - multipoint : Should be 1 indicating the musb controller supports
 +   multipoint. This is a MUSB configuration-specific setting.
 + - num_eps : Specifies the number of endpoints. This is also a
 +   MUSB configuration-specific setting. Should be set to 16
 + - ram_bits : Specifies the ram address size. Should be set to 12
 + - interface_type : This is a board specific setting to describe the type of
 +   interface between the controller and the phy. It should be 0 or 1
 +   specifying ULPI and UTMI respectively.
 + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
 +   represents PERIPHERAL.
 + - power : Should be 50. This signifies the controller can supply upto
 +   100mA when operating in host mode.
 +
 +SOC specific device node entry
 +usb_otg_hs: usb_otg_hs@4a0ab000 {
 + compatible = ti,omap4-musb;
 + ti,hwmods = usb_otg_hs;
 + multipoint = 1;
 + num_eps = 16;
 + ram_bits = 12;
 +};


reg and interrupt properties are missing here.

I would encourage to specify reg and interrupt properties in every
node getting newly added to the OMAP DTS files.


Thanks,
Vaibhav
 +
 +Board specific device node entry
 +usb_otg_hs {
 + interface_type = 1;
 + mode = 3;
 + power = 50;
 +};
 diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
 index f4d9503..d96873b 100644
 --- a/drivers/usb/musb/omap2430.c
 +++ b/drivers/usb/musb/omap2430.c
 @@ -30,6 +30,7 @@
  #include linux/init.h
  #include linux/list.h
  #include linux/io.h
 +#include linux/of.h
  #include linux/platform_device.h
  #include linux/dma-mapping.h
  #include linux/pm_runtime.h
 @@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
  static int __devinit omap2430_probe(struct platform_device *pdev)
  {
   struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
 + struct omap_musb_board_data *data;
   struct platform_device  *musb;
   struct omap2430_glue*glue;
 + struct device_node  *np = pdev-dev.of_node;
 + struct musb_hdrc_config *config;
   struct resource *res;
   int ret = -ENOMEM;
  
 @@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct 
 platform_device *pdev)
   if (glue-control_otghs == NULL)
   dev_dbg(pdev-dev, Failed to obtain control memory\n);
  
 + if (np) {
 + pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
 + if (!pdata) {
 + dev_err(pdev-dev,
 + failed to allocate musb platfrom data\n);
 + ret = -ENOMEM;
 + goto err1;
 + }
 +
 + data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
 + if (!data) {
 + dev_err(pdev-dev,
 + failed to allocate musb board data\n);
 + ret = -ENOMEM;
 + goto err1;
 + }
 +
 + config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
 + if (!data) {
 + dev_err(pdev-dev,
 + failed to allocate musb hdrc config\n);
 + goto err1;
 + }
 +
 + of_property_read_u32(np, mode, (u32 *)pdata-mode);
 + of_property_read_u32(np, interface_type,
 + (u32 *)data-interface_type);
 + of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
 + of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
 + of_property_read_u32(np, power, (u32 *)pdata-power);
 + config-multipoint = of_property_read_bool(np, multipoint);
 +
 + pdata-board_data   = data;
 + pdata-config   = config;
 + }
 +
   pdata-platform_ops = omap2430_ops;
  
   platform_set_drvdata(pdev, glue);
 @@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
  #define DEV_PM_OPS   NULL
  #endif
  
 +#ifdef 

Re: OMAP L138 with exar usb serial converter

2012-09-11 Thread Aníbal Almeida Pinto

On 22-06-2012 15:22, Aníbal Almeida Pinto wrote:

Em 22-06-2012 14:39, Greg KH escreveu:

On Fri, Jun 22, 2012 at 12:07:57PM +0100, Aníbal Almeida Pinto wrote:

Em Qui 21 Jun 2012 19:19:40 WEST, Aníbal Almeida Pinto escreveu:

Em 21-06-2012 18:12, Greg KH escreveu:

On Thu, Jun 21, 2012 at 10:34:15AM +0100, Aníbal Almeida Pinto wrote:

Hi,

we are using an board with a OMAP L138 with a exar xr21v141x [1], an
usb to two serial port converter. The exar have drivers [2] for
linux but aren't on mainline.

We are having problems when using both ports at same time, the
driver only receive the information from one port after the other
was closed.

On musb_core.c there are some information about problems with
multipoint devices. The behaviour that we are seeing is due to this
?

Any way of resolve this, being able to receive data from both ports
when both are open ?

We are having problems compiling the latest release of linux-davinci
kernel with usb support, even usb 1.0 interface don't work. Any info
about this ?


As you are stuck using their out-of-tree driver, I suggest you ask
them
about this, as there's nothing we can really do here to help you
out :(


I will ask to them but one issue is that the driver works on i386.

The musb_core.c have some comments about possible problems and I am
thinking if this device can demonstrate one of it :-/

Is a way of validating this ?


Now we could take their driver and add it to the kernel tree, but
that's
a more long-term solution, not something to help you out right now,
sorry.


If license allow it, anyone can pick on the driver and try to submit ?
Don't need someone from the company or someone that maintain the
driver ?

Thanks for your time.


I can reproduce this behavior with a different approach.

I connected a hub to OMAP L138 with two usb to serial converter from
Prolific Technology Inc that uses the pl2303 driver.

When opening one of the devices I can communicate and everything work
fine.

When trying to open a second one, with the first connected, I
receive this error:

pl2303 ttyUSB1: pl2303_open - failed submitting interrupt urb,
error -28

This setup works on i386, so can this be a problem from MUSB ?


That error is saying that the usb bus has no more bandwidth in order to
be able to accept this transfer.  Which seems odd, you should ask the
musb authors about this.


Added maintainer of MUSB to the fight :)

This happen when have a hub with two pl2303 usb serial converter, the
first work when opening second report error:
 failed submitting interrupt urb, error -28

Any idea why this happen ?



Since last email Texas developer acknowledge [1] the problem but I 
haven't receive any update about this.


This issue happens with any two serial USB converters connected to an 
OMAP L138 via an USB hub.


Anyone have seen this behavior our know a way of disable it ?

Thanks.

[1] - 
http://e2e.ti.com/support/embedded/linux/f/354/p/197489/729078.aspx#729078




--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 1/3] USB: chipidea: add imx usbmisc support

2012-09-11 Thread Alexander Shishkin
Richard Zhao linux...@gmail.com writes:

 On Wed, Aug 29, 2012 at 10:00:32PM +0200, Marc Kleine-Budde wrote:
 On 08/29/2012 01:01 PM, Sascha Hauer wrote:
  On Wed, Aug 29, 2012 at 01:18:10PM +0300, Alexander Shishkin wrote:
  Sascha Hauer s.ha...@pengutronix.de writes:
 
  On Wed, Aug 29, 2012 at 10:50:08AM +0300, Alexander Shishkin wrote:
  Richard Zhao richard.z...@freescale.com writes:
 
  i.MX usb controllers shares non-core registers, which may include
  SoC specific controls. We take it as a usbmisc device and usbmisc
  driver set operations needed by ci13xxx_imx driver.
 
  For example, Sabrelite board has bad over-current design, we can
  usbmisc to disable over-current detect.
 
  Why does this have to be part of the usb driver instead of SoC specific
  code? It looks like you've created a whole new device/driver
  infrastructure just to disable overcurrent for a specific board.
 
  Richards code indeed only handles overcurrent for a specific board, but
  there are more bits to configure in the longer run: power pin
  polarities, ULPI/serial mode select and some more.
 
 We already have a patch adding a usbmisc_imx53_init() function to that
 driver.
 
  Sounds to me like these things that should be taken care of by the phy
  driver, which will likely be simpler from both driver's and devicetree's
  perspective.
  
  Most i.MX SoCs have three instances of the chipidea core. These cores
  share a single register space for controlling the mentioned bits (the
  usbmisc register space). The usbmisc looks different on the different
  SoCs.
  Indeed they control some phy specific aspects, but the phy itself may
  also be an external ULPI or UTMI phy with a separate driver. So if we
  integrate the usbmisc into the phy wouldn't that mean that it has to
  be integrated into all possible phy drivers?
  
  From a devicetrees perspective it makes sense to integrate the flags
  into the chipidea nodes, because there is one node per chipidea core,
  but only one usbmisc unit for all ports on the SoC. So we can do a:
  
 chipidea@ofs {
 disable-overcurrent = 1;
 };
  
  instead of
  
 usbmisc@ofs {
 disable-overcurrent-port0 = 1;
 disable-overcurrent-port1 = 0;
 ...
 };
 
 +1
 
 IMHO looks much cleaner.
 So, Marc agree on the patch too. Maybe you can give a reviewed-by? :)

 Hi Alex,

 What do you think?

Weeell, as long as this is contained in platform specific code and arm
bits, I can tolerate it.

What about the other two patches? I guess they can go through arm tree
so we don't have to send it through Greg, right?

Regards,
--
Alex
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v9 00/13] usb: musb: adding multi instance support

2012-09-11 Thread B, Ravi
 
 Hi,
 
 On Fri, Aug 31, 2012 at 04:39:46PM +0530, Ravi Babu wrote:
  This series of patches adds,
  a) Multi instances support in musb driver
  b) DT support for musb_dsps glue layer
  c) DT support for NOP transceiver
  
  AM33xx and TI81xx has dual musb controller and has two usb 
 PHY of same type.
  This patch series uses 'phandle' based API 
  devm_usb_get_phy_by_phandle() to get the PHY of same type. This API 
  support is being added by Kishon's patch discussed at [1]
  
  The series applies to felipe/master [1] branch
  + Vaibhav baseport patches on his tree at [4]
  + Kishon's multi phy patches on Felipe's branch 'xceiv'
  + Kishon's patch on phandle at [2]
  + Damodar's recent patch at [3] 
  + Ajay's  Damodar's patches at [5] and [6] included in 
 this series
  
  1. http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary
  2. http://marc.info/?l=linux-usbm=134070369306112w=2
  3. http://marc.info/?l=linux-usbm=134200284230689w=2
  4. 
  
 https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-stagi
  ng 5. http://marc.info/?l=linux-usbm=134200285530701w=2
  6. http://marc.info/?l=linux-usbm=134208820028625w=2
  
  Changes from v8:
  - included Sergei's comment, removing underscore in 
 device tree file
  - removed duplicated signoff from patches Changes from v7:
  - patches rebased on felipe/master branch  verified
  - included additional two patches 0001  0002 as part 
 of this series
which are already submitted [5]  [6] Changes from v6:
  - Removed parent_pdev to get glue and used 
 dev_get_getdrv() as per
Felipe's comment
  - use pr_debug() instead of pr_info() as per Felipe's 
 comment Changes 
  from v5:
  - Removed musb-id as per Felipe's comment
  - used nop_ida as per Felipe's comment Changes from v4:
  - Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL()
  - Fixed Felipe's comment on using dev_set_mask() 
 Changes from v3:
  - Fixed Kishon's comment on removing id from phy struct and
removing unneeded #else part.
  Changes from v2:
  - Fixed Sergei's comment on not using address prefix in 
 musb_dsps
glue and nop transceiver dt dats.
  - Also removed the ti string in compatible property 
 for nop data.
  Changes from v1:
  - Defined musb_ida to manage core ids based on Felipe's comment
in [PATCH 01/11]
 
 I tried appliying this, but this doesn't apply. Please rebase 
 on my musb branch. Unfortunately there's no time anymore to 
 wait otherwise the entire musb branch will miss this merge window.
 
 I'm sorry

Felipe, patch set is ready, I will re-send the patches shortly by today.

 
 --
 balbi
 --
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [balbi-usb:master 33/36] drivers/usb/gadget/serial.c:89:22: sparse: cast truncates bits from constant value (24000000 becomes 0)

2012-09-11 Thread Fengguang Wu
On Mon, Sep 10, 2012 at 07:05:15PM +0200, Sebastian Andrzej Siewior wrote:
 On 09/10/2012 06:40 PM, Fengguang Wu wrote:
 tree:   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git master
 head:   d9c88901337158c9f253a7de58a10b5125d61d26
 commit: 7a7322b0a5d984025dd4faea9098b8fef07f8d8f [33/36] usb: gadget: remove 
 usb_gadget_controller_number()
 
 All sparse warnings:
 
 Once again, thank you.

You are welcome!

drivers/usb/gadget/f_acm.c:287:9: sparse: advancing past deep designator
drivers/usb/gadget/f_obex.c:60:9: sparse: advancing past deep designator
drivers/usb/gadget/f_serial.c:134:9: sparse: advancing past deep 
  designator
drivers/usb/gadget/serial.c:66:9: sparse: advancing past deep designator
 
 I don't get these. The purpose is an all NULL terminating entry. Could
 this be a sparse bug or is the [] / {} switch not really good C code?

http://marc.info/?l=linux-sparsem=130673652023059w=4

According to Dan's explanations, I'll filter out these warnings in future.

 + drivers/usb/gadget/serial.c:89:22: sparse: cast truncates bits from 
 constant value (2400 becomes 0)
 
 I've sent a patch for this.

Thank you!

Fengguang
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 11, 2012 at 3:23 PM, Vaibhav Hiremath hvaib...@ti.com wrote:


 On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
 Added device tree support for omap musb driver and updated the
 Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/omap-usb.txt |   33 
  drivers/usb/musb/omap2430.c|   54 
 
  2 files changed, 87 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
 b/Documentation/devicetree/bindings/usb/omap-usb.txt
 new file mode 100644
 index 000..29a043e
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
 @@ -0,0 +1,33 @@
 +OMAP GLUE
 +
 +OMAP MUSB GLUE
 + - compatible : Should be ti,omap4-musb or ti,omap3-musb
 + - ti,hwmods : must be usb_otg_hs
 + - multipoint : Should be 1 indicating the musb controller supports
 +   multipoint. This is a MUSB configuration-specific setting.
 + - num_eps : Specifies the number of endpoints. This is also a
 +   MUSB configuration-specific setting. Should be set to 16
 + - ram_bits : Specifies the ram address size. Should be set to 12
 + - interface_type : This is a board specific setting to describe the type of
 +   interface between the controller and the phy. It should be 0 or 1
 +   specifying ULPI and UTMI respectively.
 + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
 +   represents PERIPHERAL.
 + - power : Should be 50. This signifies the controller can supply upto
 +   100mA when operating in host mode.
 +
 +SOC specific device node entry
 +usb_otg_hs: usb_otg_hs@4a0ab000 {
 + compatible = ti,omap4-musb;
 + ti,hwmods = usb_otg_hs;
 + multipoint = 1;
 + num_eps = 16;
 + ram_bits = 12;
 +};


 reg and interrupt properties are missing here.

 I would encourage to specify reg and interrupt properties in every
 node getting newly added to the OMAP DTS files.

Sure. will add that in my next version.

Thanks
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: cdc-wdm: fix wdm_find_device* return value

2012-09-11 Thread Sergei Shtylyov

Hello.

On 11-09-2012 0:17, Bjørn Mork wrote:


A logic error made the wdm_find_device* functions
return a bogus pointer into static data instead of
the intended NULL no matching device was found.

   ^ if

   Maybe the maintainer could fix while applying...


Cc: sta...@vger.kernel.org # v3.4+
Cc: Oliver Neukum oli...@neukum.org
Signed-off-by: Bjørn Mork bj...@mork.no


WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue

2012-09-11 Thread Hiremath, Vaibhav
On Tue, Sep 11, 2012 at 16:54:37, ABRAHAM, KISHON VIJAY wrote:
 Hi,
 
 On Tue, Sep 11, 2012 at 3:23 PM, Vaibhav Hiremath hvaib...@ti.com wrote:
 
 
  On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
  Added device tree support for omap musb driver and updated the
  Documentation with device tree binding information.
 
  Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
  ---
   Documentation/devicetree/bindings/usb/omap-usb.txt |   33 
   drivers/usb/musb/omap2430.c|   54 
  
   2 files changed, 87 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
 
  diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
  b/Documentation/devicetree/bindings/usb/omap-usb.txt
  new file mode 100644
  index 000..29a043e
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
  @@ -0,0 +1,33 @@
  +OMAP GLUE
  +
  +OMAP MUSB GLUE
  + - compatible : Should be ti,omap4-musb or ti,omap3-musb
  + - ti,hwmods : must be usb_otg_hs
  + - multipoint : Should be 1 indicating the musb controller supports
  +   multipoint. This is a MUSB configuration-specific setting.
  + - num_eps : Specifies the number of endpoints. This is also a
  +   MUSB configuration-specific setting. Should be set to 16
  + - ram_bits : Specifies the ram address size. Should be set to 12
  + - interface_type : This is a board specific setting to describe the type 
  of
  +   interface between the controller and the phy. It should be 0 or 1
  +   specifying ULPI and UTMI respectively.
  + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
  +   represents PERIPHERAL.
  + - power : Should be 50. This signifies the controller can supply upto
  +   100mA when operating in host mode.
  +
  +SOC specific device node entry
  +usb_otg_hs: usb_otg_hs@4a0ab000 {
  + compatible = ti,omap4-musb;
  + ti,hwmods = usb_otg_hs;
  + multipoint = 1;
  + num_eps = 16;
  + ram_bits = 12;
  +};
 
 
  reg and interrupt properties are missing here.
 
  I would encourage to specify reg and interrupt properties in every
  node getting newly added to the OMAP DTS files.
 
 Sure. will add that in my next version.
 

I saw there is some discussion going-on for which baseline to use, so make 
sure that you test the patches on top of below patch (already available in 
linux-omap/devel-dt)

http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap.git;a=commit;h=b82b04e8eb27abe0cfe9cd7bf4fee8bb1bb9b013


Thanks,
Vaibhav
 Thanks
 Kishon
 

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 00/13] usb: musb: adding multi instance support

2012-09-11 Thread Felipe Balbi
On Tue, Sep 11, 2012 at 10:45:44AM +, B, Ravi wrote:
  
  Hi,
  
  On Fri, Aug 31, 2012 at 04:39:46PM +0530, Ravi Babu wrote:
   This series of patches adds,
   a) Multi instances support in musb driver
   b) DT support for musb_dsps glue layer
   c) DT support for NOP transceiver
   
   AM33xx and TI81xx has dual musb controller and has two usb 
  PHY of same type.
   This patch series uses 'phandle' based API 
   devm_usb_get_phy_by_phandle() to get the PHY of same type. This API 
   support is being added by Kishon's patch discussed at [1]
   
   The series applies to felipe/master [1] branch
 + Vaibhav baseport patches on his tree at [4]
 + Kishon's multi phy patches on Felipe's branch 'xceiv'
 + Kishon's patch on phandle at [2]
 + Damodar's recent patch at [3] 
 + Ajay's  Damodar's patches at [5] and [6] included in 
  this series
   
   1. http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary
   2. http://marc.info/?l=linux-usbm=134070369306112w=2
   3. http://marc.info/?l=linux-usbm=134200284230689w=2
   4. 
   
  https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-stagi
   ng 5. http://marc.info/?l=linux-usbm=134200285530701w=2
   6. http://marc.info/?l=linux-usbm=134208820028625w=2
   
   Changes from v8:
 - included Sergei's comment, removing underscore in 
  device tree file
 - removed duplicated signoff from patches Changes from v7:
 - patches rebased on felipe/master branch  verified
 - included additional two patches 0001  0002 as part 
  of this series
   which are already submitted [5]  [6] Changes from v6:
 - Removed parent_pdev to get glue and used 
  dev_get_getdrv() as per
   Felipe's comment
 - use pr_debug() instead of pr_info() as per Felipe's 
  comment Changes 
   from v5:
 - Removed musb-id as per Felipe's comment
 - used nop_ida as per Felipe's comment Changes from v4:
 - Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL()
 - Fixed Felipe's comment on using dev_set_mask() 
  Changes from v3:
 - Fixed Kishon's comment on removing id from phy struct and
   removing unneeded #else part.
   Changes from v2:
 - Fixed Sergei's comment on not using address prefix in 
  musb_dsps
   glue and nop transceiver dt dats.
 - Also removed the ti string in compatible property 
  for nop data.
   Changes from v1:
 - Defined musb_ida to manage core ids based on Felipe's comment
   in [PATCH 01/11]
  
  I tried appliying this, but this doesn't apply. Please rebase 
  on my musb branch. Unfortunately there's no time anymore to 
  wait otherwise the entire musb branch will miss this merge window.
  
  I'm sorry
 
 Felipe, patch set is ready, I will re-send the patches shortly by today.

Thanks a lot. So I'll wait for a few more hours before sending out my
musb pull request ;-)

-- 
balbi


signature.asc
Description: Digital signature


RE: [PATCH v9 00/13] usb: musb: adding multi instance support

2012-09-11 Thread B, Ravi
   
   On Fri, Aug 31, 2012 at 04:39:46PM +0530, Ravi Babu wrote:
This series of patches adds,
a) Multi instances support in musb driver
b) DT support for musb_dsps glue layer
c) DT support for NOP transceiver

AM33xx and TI81xx has dual musb controller and has two usb
   PHY of same type.
This patch series uses 'phandle' based API
devm_usb_get_phy_by_phandle() to get the PHY of same type. This 
API support is being added by Kishon's patch discussed at [1]

The series applies to felipe/master [1] branch
+ Vaibhav baseport patches on his tree at [4]
+ Kishon's multi phy patches on Felipe's branch 'xceiv'
+ Kishon's patch on phandle at [2]
+ Damodar's recent patch at [3] 
+ Ajay's  Damodar's patches at [5] and [6] included in
   this series

1. 

 http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary
2. http://marc.info/?l=linux-usbm=134070369306112w=2
3. http://marc.info/?l=linux-usbm=134200284230689w=2
4. 

   
 https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-sta
   gi
ng 5. http://marc.info/?l=linux-usbm=134200285530701w=2
6. http://marc.info/?l=linux-usbm=134208820028625w=2

Changes from v8:
- included Sergei's comment, removing underscore in
   device tree file
- removed duplicated signoff from patches 
 Changes from v7:
- patches rebased on felipe/master branch  verified
- included additional two patches 0001  0002 as part
   of this series
  which are already submitted [5]  [6] Changes from v6:
- Removed parent_pdev to get glue and used
   dev_get_getdrv() as per
  Felipe's comment
- use pr_debug() instead of pr_info() as per Felipe's
   comment Changes
from v5:
- Removed musb-id as per Felipe's comment
- used nop_ida as per Felipe's comment Changes from v4:
- Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL()
- Fixed Felipe's comment on using dev_set_mask()
   Changes from v3:
- Fixed Kishon's comment on removing id from 
 phy struct and
  removing unneeded #else part.
Changes from v2:
- Fixed Sergei's comment on not using address prefix in
   musb_dsps
  glue and nop transceiver dt dats.
- Also removed the ti string in compatible property
   for nop data.
Changes from v1:
- Defined musb_ida to manage core ids based on 
 Felipe's comment
  in [PATCH 01/11]
   
   I tried appliying this, but this doesn't apply. Please 
 rebase on my 
   musb branch. Unfortunately there's no time anymore to 
 wait otherwise 
   the entire musb branch will miss this merge window.
   
   I'm sorry
  
  Felipe, patch set is ready, I will re-send the patches 
 shortly by today.
 
 Thanks a lot. So I'll wait for a few more hours before 
 sending out my musb pull request ;-)
 

Thanks Felipe, these v9 patches are created on felipe/master branch. Now 
working on, to rebase on felipe/musb branch, will try to provide by end of 
today. 

 --
 balbi
 --
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: dwc3: query: dma sg implementation for isoc

2012-09-11 Thread Felipe Balbi
On Tue, Sep 11, 2012 at 03:08:20PM +0530, Pratyush Anand wrote:
 On 9/11/2012 2:39 PM, Felipe Balbi wrote:
 On Tue, Sep 11, 2012 at 12:29:36PM +0530, Pratyush Anand wrote:
 On 9/10/2012 6:49 PM, Felipe Balbi wrote:
 On Mon, Sep 10, 2012 at 06:45:06PM +0530, Pratyush Anand wrote:
 Hi Felip,
 
 Thanks for the clarifications.
 
 On 9/10/2012 6:29 PM, Felipe Balbi wrote:
 If my understanding is correct, then I might need to modify dwc3
 driver a bit. only first TRB of the service interval should have
 TRBCTL as ISOC_FIRST rest should have TRBCTL as ISOC.
 Why ? IIRC, ISOC_FIRST was a hint to the internal packet scheduler to
 give higher priority to the isochronous packet, right ? Does it make any
 difference for your use case ?
 
 Databook says:
 
 
 The first TRB in a Buffer Descriptor must have the TRBCTL field set
 to the “Isochronous-First” type while all others have this field set
 to “Isochronous”.
 
 aaa true :-) I had forgotten about that extra bit of information when
 using chained TRBs :-s My bad. Please send a patch.
 
 So I thought to modify the code. As of now, ISOC IN does not work
 fully with either All Isochronous-First or Isochronous First +
 Isochronous implementation (in case of more than one TRB for one
 service interval).
 May be I am doing some mistake in my code. :(
 I am debugging. Will get back with my observations.
 
 I think you're perfectly right at the need for ISOCHRONOUS_FIRST flag.
 My bad.
 
 
 Hummm.. It works with Isochronous First + Isochronous
 implementation. But, code needs many modification..
 
 We have one trb and one trb_dma per struct dwc3_request. We take
 lot of decisions on the basis of req-trb value. These all will
 change in case of SG. We will not have only one TRB per struct
 usb_request.
 
 I am going to keep array for trb and trb_dma and then to manage all
 these with backward compatibility (non SG case). What do you say?
 
 struct dwc3_trb *trb[DWC3_TRB_NUM];
 dma_addr_t  trb_dma[DWC3_TRB_NUM];
 
 that doesn't look right :-(
 
 Isn't something like below enough ?
 
 Probably not ;)
 It will handle only one part, ie to manage
 DWC3_TRBCTL_ISOCHRONOUS_FIRST  DWC3_TRBCTL_ISOCHRONOUS.
 
 But, problem is that we have single trb associated with each struct
 dwc3_trb. In case of SG, we will prepare req-request.num_mapped_sgs
 number of TRBs against one request (ie one struct dwc3_trb).
 
 Each TRBs of SG need to be updated into core cache. During cleanup,
 we need to check status of each TRB of SG.
 
 How can we manage if we have only one struct dwc3_trb *trb
 associated with struct dwc3_trb.

Well, you iterate over each entrie on the scatterlist and you know that
TRBs are physically consecutive. Granted, it would be a lot easier if we
have one request per-TRB, but this isn't always the case and we need to
treat that inside the driver.

Looks like dwc3_gadget_cleanup_done_reqs() needs some re-factoring and
needs to learn about chained TRBs. Currently it only works if no TRBs
fail, I guess... Still, I don't think adding that array to the endpoint
is the best solution.

Maybe it's enough to just add some check for req-request.num_mapped_sgs
and if that's greater than zero, then we need to act differently... I'd
start by looking at cleaning up dwc3_gadget_cleanup_done_reqs() since
that's a bit obfuscated IMHO.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v2] usb: gadget: at91_udc: dt: fix platform_data check

2012-09-11 Thread Fabio Porcedda
Don't fail the initialization check for the platform_data
if there is avaiable an associated device tree node.

This patch fix the dt support introduced in 3.4-rc1 by commit
(d1494a3 USB: at91: Device udc add dt support).

Tested on a at91sam9260 based board (PRO3-EVK).

Signed-off-by: Fabio Porcedda fabio.porce...@gmail.com
Cc: Stable sta...@vger.kernel.org [v3.4+]
Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
v2:
  - better description
  - add stable tag

 drivers/usb/gadget/at91_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 1e35963..660fd53 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1699,7 +1699,7 @@ static int __devinit at91udc_probe(struct platform_device 
*pdev)
int retval;
struct resource *res;
 
-   if (!dev-platform_data) {
+   if (!dev-platform_data  !pdev-dev.of_node) {
/* small (so we copy it) but critical! */
DBG(missing platform_data\n);
return -ENODEV;
-- 
1.7.11.3

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: gadget: at91_udc: dt: fix platform_data check

2012-09-11 Thread Nicolas Ferre
On 09/11/2012 02:07 PM, Fabio Porcedda :
 Don't fail the initialization check for the platform_data
 if there is avaiable an associated device tree node.
 
 This patch fix the dt support introduced in 3.4-rc1 by commit
 (d1494a3 USB: at91: Device udc add dt support).
 
 Tested on a at91sam9260 based board (PRO3-EVK).
 
 Signed-off-by: Fabio Porcedda fabio.porce...@gmail.com
 Cc: Stable sta...@vger.kernel.org [v3.4+]
 Cc: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

Acked-by: Nicolas Ferre nicolas.fe...@atmel.com

Felipe, Greg, can we queue this one for 3.6-final ?

Best regards,

 ---
 v2:
   - better description
   - add stable tag
 
  drivers/usb/gadget/at91_udc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
 index 1e35963..660fd53 100644
 --- a/drivers/usb/gadget/at91_udc.c
 +++ b/drivers/usb/gadget/at91_udc.c
 @@ -1699,7 +1699,7 @@ static int __devinit at91udc_probe(struct 
 platform_device *pdev)
   int retval;
   struct resource *res;
  
 - if (!dev-platform_data) {
 + if (!dev-platform_data  !pdev-dev.of_node) {
   /* small (so we copy it) but critical! */
   DBG(missing platform_data\n);
   return -ENODEV;
 


-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 1/3] USB: chipidea: add imx usbmisc support

2012-09-11 Thread Shawn Guo
On Tue, Sep 11, 2012 at 01:42:01PM +0300, Alexander Shishkin wrote:
 What about the other two patches? I guess they can go through arm tree
 so we don't have to send it through Greg, right?
 
Right, those two will go via arm-soc tree once the first one gets
applied on usb tree.

-- 
Regards,
Shawn
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] Documentation update for Isochronous URB handling

2012-09-11 Thread Alan Stern
Here is a proposed update for the kernel's documentation on Isochronous 
URBs.  It describes the behavior Clemens and I have been discussing, 
which isn't implemented yet.  I'm working on separate patches to 
implement the new behavior for EHCI, OHCI, and UHCI.

Pratyush, since you have been busily working on related issues for the 
dwc3, you might be interested in this too.

I have no idea how XHCI deals with these issues.

Anyway, everyone please take a quick look and let me know if this seems 
okay.

Alan Stern



Index: usb-3.6/Documentation/usb/error-codes.txt
===
--- usb-3.6.orig/Documentation/usb/error-codes.txt
+++ usb-3.6/Documentation/usb/error-codes.txt
@@ -35,9 +35,8 @@ USB-specific:
d) ISO: number_of_packets is  0
e) various other cases
 
--EAGAINa) specified ISO start frame too early
-   b) (using ISO-ASAP) too much scheduled for the future
-  wait some time and try again.
+-EXDEV ISO: URB_ISO_ASAP wasn't specified and all the frames
+   the URB would be scheduled in have already expired.
 
 -EFBIG Host controller driver can't schedule that many ISO frames.
 
Index: usb-3.6/include/linux/usb.h
===
--- usb-3.6.orig/include/linux/usb.h
+++ usb-3.6/include/linux/usb.h
@@ -1101,8 +1101,8 @@ extern int usb_disabled(void);
  * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
  */
 #define URB_SHORT_NOT_OK   0x0001  /* report short reads as errors */
-#define URB_ISO_ASAP   0x0002  /* iso-only, urb-start_frame
-* ignored */
+#define URB_ISO_ASAP   0x0002  /* iso-only; use the first unexpired
+* slot in the schedule */
 #define URB_NO_TRANSFER_DMA_MAP0x0004  /* urb-transfer_dma valid on 
submit */
 #define URB_NO_FSBR0x0020  /* UHCI-specific */
 #define URB_ZERO_PACKET0x0040  /* Finish bulk OUT with short 
packet */
@@ -1281,15 +1281,20 @@ typedef void (*usb_complete_t)(struct ur
  * the transfer interval in the endpoint descriptor is logarithmic.
  * Device drivers must convert that value to linear units themselves.)
  *
- * Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling
- * the host controller to schedule the transfer as soon as bandwidth
- * utilization allows, and then set start_frame to reflect the actual frame
- * selected during submission.  Otherwise drivers must specify the start_frame
- * and handle the case where the transfer can't begin then.  However, drivers
- * won't know how bandwidth is currently allocated, and while they can
- * find the current frame using usb_get_current_frame_number () they can't
- * know the range for that frame number.  (Ranges for frame counter values
- * are HC-specific, and can go from 256 to 65536 frames from now.)
+ * If an isochronous endpoint queue isn't already running, the host
+ * controller will schedule a new URB to start as soon as bandwidth
+ * utilization allows.  If the queue is running then a new URB will be
+ * scheduled to start in the first transfer slot following the end of the
+ * preceding URB, if that slot has not already expired.  If the slot has
+ * expired (which can happen when IRQ delivery is delayed for a long time),
+ * the scheduling behavior depends on the URB_ISO_ASAP flag.  If the flag
+ * is clear then the URB will be scheduled to start in the expired slot,
+ * implying that some of its packets will not be transferred; if the flag
+ * is set then the URB will be scheduled in the first unexpired slot,
+ * breaking the queue's synchronization.  Upon URB completion, the
+ * start_frame field will be set to the (micro)frame number in which the
+ * transfer was scheduled.  Ranges for frame counter values are HC-specific
+ * and can go from as low as 256 to as high as 65536 frames.
  *
  * Isochronous URBs have a different data transfer model, in part because
  * the quality of service is only best effort.  Callers provide specially
Index: usb-3.6/drivers/usb/core/urb.c
===
--- usb-3.6.orig/drivers/usb/core/urb.c
+++ usb-3.6/drivers/usb/core/urb.c
@@ -214,9 +214,25 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
  * urb-interval is modified to reflect the actual transfer period used
  * (normally some power of two units).  And for isochronous urbs,
  * urb-start_frame is modified to reflect when the URB's transfers were
- * scheduled to start.  Not all isochronous transfer scheduling policies
- * will work, but most host controller drivers should easily handle ISO
- * queues going from now until 10-200 msec into the future.
+ * scheduled to start.
+ *
+ * Not all isochronous transfer scheduling policies will work, but most
+ * host controller drivers should easily handle ISO 

Re: Wrong SSD sector count with current F17 (right with live)

2012-09-11 Thread Alan Stern
On Mon, 10 Sep 2012, Michael J Gruber wrote:

 I'm sorry, but if the USB layer is only sending data it is told to
 send then by definition it is bugfree. It's not an argumentation
 which I follow.

I didn't mean to claim that usb-storage is bug-free.  Merely that if
your problem is caused by the data that is sent to the drive, you're a
lot more likely to find the source of the problem by looking somewhere
other than the USB layer.

 Here's some more info after a dozen more reboots: In fact, the
 described problem appears to be independ of the mentioned kernel
 versions. It is not present after the first boot, appears with the
 first soft reboot and remains to be present until the next hard reboot
 (shutdown, wait a few secs, boot again).
 
 Since I had switched between different kernels by rebooting I had been
 tricked into that previous diagnosis. After rebooting the same
 versions again and again, soft and hard, I'm convinced it's the
 difference between first boot and subsequent reboots.
 
 Still stomped, though.

You really should try posting a description of your problem to the 
linux-scsi list.  The people there are much more likely to have helpful 
ideas than the people on this list.

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: cdc-wdm: fix wdm_find_device* return value

2012-09-11 Thread Greg KH
On Tue, Sep 11, 2012 at 03:31:30PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 11-09-2012 0:17, Bjørn Mork wrote:
 
 A logic error made the wdm_find_device* functions
 return a bogus pointer into static data instead of
 the intended NULL no matching device was found.
^ if
 
Maybe the maintainer could fix while applying...

The maintainer really doesn't care about changelog typos like this.

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL] usb: musb: patches for v3.7 merge window

2012-09-11 Thread Felipe Balbi
Hi Greg,

and finally, here's the musb pull request for v3.7 merge window.

This is bigger than I was initially expecting and the entire DeviceTree
migration seems to be delaying a few things, that's why this pull
request took a few more hours to prepare then the others.

I don't expect any problems with any of these patches since they are
both self-contained to drivers/usb/musb/ and have been pending for
a long time on the mailing list.

Please, _do_ let me know if you run into any issues. There will be a
conflict here, but I have pushed the resolution to
merge-result-for-greg.

The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee:

  Linux 3.6-rc1 (2012-08-02 16:38:10 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/musb-for-v3.7

for you to fetch changes up to d8c3ef256f88b7c6ecd673d03073b5645be9c5e4:

  usb: musb: dsps: remove explicit NOP device creation (2012-09-11 17:36:50 
+0300)


usb: musb: patches for v3.7 merge window

Here we have a bunch of miscellaneous cleanups and fixes
to the musb driver. It fixes a bunch of mistakes errors
which nobody has triggered before, so I'm not Ccing stable
tree.

We are finally improving OMAP's VBUS/ID Mailbox usage so
that we can introduce our PHY drivers properly. Also, we're
adding support for multiple instances of the MUSB IP in
the same SoC, as seen on some platforms from TI which
have 2 MUSB instances.

Other than that, we have some small fixes like not kicking
DMA for a zero byte transfer, or properly handling NAK timeout
on MUSB's host side, and the enabling of DMA Mode1 for any
transfers which are aligned to wMaxPacketSize.

All patches have been pending on mailing list for a long time
and I don't expect any big surprises with this pull request.


Ajay Kumar Gupta (7):
  usb: musb: host: don't program dma for zero byte tx
  usb: musb: gadget: don't program dma for zero byte tx
  usb: musb: check for zero byte in musb_read/write_fifo
  usb: musb: NAK timeout scheme on bulk TX endpoint
  usb: musb: kill global and static for multi instance
  usb: musb: dsps: add dt support
  usb: musb: dsps: remove explicit NOP device creation

B, Ravi (2):
  usb: musb: add musb_ida for multi instance support
  usb: musb: am335x: add support for dual instance

Brian Downing (1):
  usb: musb: Fix bad call to kfree() in musb_free

Felipe Balbi (3):
  usb: musb: fix sparse warnings
  usb: musb: drop useless board_mode usage
  usb: musb: drop is_host_capable() and is_peripheral_capable()

Kishon Vijay Abraham I (4):
  usb: musb: cleanup while removing musb omap glue driver
  arm: omap: hwmod: add a new addr space in otg for writing to control 
module
  usb: musb: omap: write directly to mailbox instead of using phy
  usb: musb: omap: Add device tree support for omap musb glue

Matthias Brugger (1):
  usb: musb: omap2430.c delete unused variable.

NeilBrown (1):
  usb: musb: omap2430: don't loop indefinitely in interrupt.

Peter Meerwald (1):
  usb: musb: fix spelling of families in Kconfig

Roger Quadros (2):
  usb: musb: use DMA mode 1 whenever possible
  usb: musb: Remove redundant if statement

Sergei Shtylyov (2):
  usb: musb: gadget: use variables according to their names in rxstate()
  usb: musb: core: fix kernel-doc of musb_init_controller()

Shubhrajyoti D (2):
  usb: musb: Prevent the masking of the return value
  usb: musb: Make dma_controller_create __devinit

Virupax Sadashivpetimath (1):
  usb: musb: host: Handle highmem in PIO mode

 .../devicetree/bindings/usb/am33xx-usb.txt |  14 +
 Documentation/devicetree/bindings/usb/omap-usb.txt |  33 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   6 +
 drivers/usb/musb/Kconfig   |   2 +-
 drivers/usb/musb/am35x.c   |  66 ++--
 drivers/usb/musb/blackfin.c|  63 ++--
 drivers/usb/musb/cppi_dma.c|   2 +-
 drivers/usb/musb/da8xx.c   |  58 ++--
 drivers/usb/musb/davinci.c |  66 ++--
 drivers/usb/musb/musb_core.c   | 331 +
 drivers/usb/musb/musb_core.h   |  17 +-
 drivers/usb/musb/musb_debugfs.c|   8 +-
 drivers/usb/musb/musb_dma.h|   2 +-
 drivers/usb/musb/musb_dsps.c   | 189 
 drivers/usb/musb/musb_gadget.c | 172 ---
 drivers/usb/musb/musb_host.c   | 264 +++-
 drivers/usb/musb/musb_host.h   |   3 +
 drivers/usb/musb/musb_virthub.c|  13 +-
 drivers/usb/musb/musbhsdma.c   |   2 +-
 

Re: [PATCH] usb/core: Fix race condition when removing EHCI PCI devices

2012-09-11 Thread Alan Stern
On Mon, 10 Sep 2012, Don Zickus wrote:

 A customer of ours noticed that after a bunch of hot removals of the EHCI
 PCI device, a panic occurs. This happened on a 2.6.32 RHEL-6 kernel, but
 I believe is still applicable upstream.
 
 The panic was further simplified to enabling SLUB debug poisoning and running
 the following command:
 
 while true; do find /proc/bus/usb -type f -exec cat {} /dev/null \; ; done 
 
 This gets the machine to panic after 1 or 2 removals of the device.

 This is likely because the following thread was in the process of removing the
 device:

 The fix that solved their problem was to deregister the usb bus first before
 running usb_put_dev.  After running multiple tests the panic disappeared.
 
 Deregistering the bus first to prevent future readers from accessing the 
 device
 before cleaning up the hcd, seemed like an appropriate way to go.  I'll leave
 it to the experts to validate that or provide a better solution. :-)
 
 I adapted their usb_remove_hcd fix for usb_add_hcd error path too to mimic
 the same behaviour (a little code shuffling to handle the gotos cleanly).

Moving things around in usb_add_hcd() is not a good way to attack this
problem.  Here's a better approach; please make sure that it does what
you want.  The idea is to indicate that a root hub is not registered by
setting its devnum field to 0.

Alan Stern



Index: usb-3.6/drivers/usb/core/devices.c
===
--- usb-3.6.orig/drivers/usb/core/devices.c
+++ usb-3.6/drivers/usb/core/devices.c
@@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct fi
/* print devices for all busses */
list_for_each_entry(bus, usb_bus_list, bus_list) {
/* recurse through all children of the root hub */
-   if (!bus-root_hub)
+   if (!bus-root_hub || bus-root_hub-devnum == 0)
continue;
usb_lock_device(bus-root_hub);
ret = usb_device_dump(buf, nbytes, skip_bytes, ppos,
Index: usb-3.6/drivers/usb/core/hcd.c
===
--- usb-3.6.orig/drivers/usb/core/hcd.c
+++ usb-3.6/drivers/usb/core/hcd.c
@@ -980,6 +980,8 @@ static int register_root_hub(struct usb_
const int devnum = 1;
int retval;
 
+   mutex_lock(usb_bus_list_lock);
+
usb_dev-devnum = devnum;
usb_dev-bus-devnum_next = devnum + 1;
memset (usb_dev-bus-devmap.devicemap, 0,
@@ -987,8 +989,6 @@ static int register_root_hub(struct usb_
set_bit (devnum, usb_dev-bus-devmap.devicemap);
usb_set_device_state(usb_dev, USB_STATE_ADDRESS);
 
-   mutex_lock(usb_bus_list_lock);
-
usb_dev-ep0.desc.wMaxPacketSize = cpu_to_le16(64);
retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
if (retval != sizeof usb_dev-descriptor) {
@@ -1011,6 +1011,7 @@ static int register_root_hub(struct usb_
if (retval) {
dev_err (parent_dev, can't register root hub for %s, %d\n,
dev_name(usb_dev-dev), retval);
+   usb_dev-devnum = 0;
}
mutex_unlock(usb_bus_list_lock);
 
@@ -2527,6 +2528,7 @@ error_create_attr_group:
 #endif
mutex_lock(usb_bus_list_lock);
usb_disconnect(rhdev); /* Sets rhdev to NULL */
+   hcd-self.root_hub-devnum = 0;
mutex_unlock(usb_bus_list_lock);
 err_register_root_hub:
hcd-rh_pollable = 0;
@@ -2583,6 +2585,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 
mutex_lock(usb_bus_list_lock);
usb_disconnect(rhdev); /* Sets rhdev to NULL */
+   hcd-self.root_hub-devnum = 0;
mutex_unlock(usb_bus_list_lock);
 
/* Prevent any more root-hub status calls from the timer.

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb/xhci: update a comment regarding the BOS descriptor to reflect the code

2012-09-11 Thread Sebastian Andrzej Siewior
The comment is a quote of Alan Stern and reflects the data structure
better than the the initial comment.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
 drivers/usb/host/xhci-hub.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 74bfc86..0ee45ac 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -29,7 +29,7 @@
 #definePORT_RWC_BITS   (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \
 PORT_RC | PORT_PLC | PORT_PE)
 
-/* usb 1.1 root hub device descriptor */
+/* USB 3.0 BOS descriptor and a capability descriptor, combined */
 static u8 usb_bos_descriptor [] = {
USB_DT_BOS_SIZE,/*  __u8 bLength, 5 bytes */
USB_DT_BOS, /*  __u8 bDescriptorType */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] How to handle delays in isochronous transfers?

2012-09-11 Thread Alan Stern
On Mon, 10 Sep 2012, Clemens Ladisch wrote:

 Peter Chen wrote:
  Essentially, the stream is restarted with known timing.
 
  So, if big delay occurs (like 10ms), you would like the controller layer 
  tells
  you that, then, you drop 10ms packet?
 
 I want to be able to know when the next submitted packet will be
 transmitted.

You can find out after usb_submit_urb(urb) returns by looking at
urb-start_frame.

I have tried some initial testing of my updates, using data-OUT
transfers with URB_ISO_ASAP turned off for the data URBs in
sound/usb/endpoint.c.  When interrupts are delayed so long that
synchronization is lost and a data URB submission fails, the sound
stops playing and doesn't restart.  But the synch URBs continue to be
submitted and ogg123 doesn't end for quite some time.

This doesn't seem like the desired behavior.  I'm not sure where to pin 
any blame, though.

The test patch should be ready for posting soon.  Would you like to try 
it out?

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v10 2/5] usb: musb: kill global and static for multi instance

2012-09-11 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

Moved global variable musb_debugfs_root and static variable
old_state to 'struct musb' to help support multi instance of
musb controller as present on AM335x platform.

Also removed the global variable orig_dma_mask and filled the
dev-dma_mask with parent device's dma_mask.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c|   22 +++---
 drivers/usb/musb/musb_core.h|4 
 drivers/usb/musb/musb_debugfs.c |8 +++-
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 61b64fc..bb56a0e 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include linux/platform_device.h
 #include linux/io.h
 #include linux/idr.h
+#include linux/dma-mapping.h
 
 #include musb_core.h
 
@@ -1797,10 +1798,9 @@ static const struct attribute_group musb_attr_group = {
 static void musb_irq_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, irq_work);
-   static int old_state;
 
-   if (musb-xceiv-state != old_state) {
-   old_state = musb-xceiv-state;
+   if (musb-xceiv-state != musb-xceiv_old_state) {
+   musb-xceiv_old_state = musb-xceiv-state;
sysfs_notify(musb-controller-kobj, NULL, mode);
}
 }
@@ -2060,11 +2060,6 @@ fail0:
 /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
  * bridge to a platform device; this driver then suffices.
  */
-
-#ifndef CONFIG_MUSB_PIO_ONLY
-static u64 *orig_dma_mask;
-#endif
-
 static int __devinit musb_probe(struct platform_device *pdev)
 {
struct device   *dev = pdev-dev;
@@ -2083,10 +2078,6 @@ static int __devinit musb_probe(struct platform_device 
*pdev)
return -ENOMEM;
}
 
-#ifndef CONFIG_MUSB_PIO_ONLY
-   /* clobbered by use_dma=n */
-   orig_dma_mask = dev-dma_mask;
-#endif
status = musb_init_controller(dev, irq, base);
if (status  0)
iounmap(base);
@@ -2096,7 +2087,8 @@ static int __devinit musb_probe(struct platform_device 
*pdev)
 
 static int __devexit musb_remove(struct platform_device *pdev)
 {
-   struct musb *musb = dev_to_musb(pdev-dev);
+   struct device   *dev = pdev-dev;
+   struct musb *musb = dev_to_musb(dev);
void __iomem*ctrl_base = musb-ctrl_base;
 
/* this gets called on rmmod.
@@ -2109,9 +2101,9 @@ static int __devexit musb_remove(struct platform_device 
*pdev)
 
musb_free(musb);
iounmap(ctrl_base);
-   device_init_wakeup(pdev-dev, 0);
+   device_init_wakeup(dev, 0);
 #ifndef CONFIG_MUSB_PIO_ONLY
-   pdev-dev.dma_mask = orig_dma_mask;
+   dma_set_mask(dev, *dev-parent-dma_mask);
 #endif
return 0;
 }
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index a69ffd6..c158aac 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -437,6 +437,10 @@ struct musb {
 #ifdef MUSB_CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
 #endif
+   int xceiv_old_state;
+#ifdef CONFIG_DEBUG_FS
+   struct dentry   *debugfs_root;
+#endif
 };
 
 static inline struct musb *gadget_to_musb(struct usb_gadget *g)
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 40a37c9..1d6e8af 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -103,8 +103,6 @@ static const struct musb_register_map musb_regmap[] = {
{  }/* Terminating Entry */
 };
 
-static struct dentry *musb_debugfs_root;
-
 static int musb_regdump_show(struct seq_file *s, void *unused)
 {
struct musb *musb = s-private;
@@ -241,7 +239,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
struct dentry   *file;
int ret;
 
-   root = debugfs_create_dir(musb, NULL);
+   root = debugfs_create_dir(dev_name(musb-controller), NULL);
if (!root) {
ret = -ENOMEM;
goto err0;
@@ -261,7 +259,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
goto err1;
}
 
-   musb_debugfs_root = root;
+   musb-debugfs_root = root;
 
return 0;
 
@@ -274,5 +272,5 @@ err0:
 
 void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
 {
-   debugfs_remove_recursive(musb_debugfs_root);
+   debugfs_remove_recursive(musb-debugfs_root);
 }
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v10 5/5] usb: musb: dsps: remove explicit NOP device creation

2012-09-11 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

As NOP device node is now added in am33xx tree so remove the call
which creates the NOP platform_device.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index b8aecbb..2785e28 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -376,8 +376,7 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb-mregs += wrp-musb_core_offset;
 
-   /* NOP driver needs change if supporting dual instance */
-   usb_nop_xceiv_register();
+   /* Get the NOP PHY */
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv))
return -ENODEV;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v10 0/5] usb: musb: adding multi instance support

2012-09-11 Thread Ravi Babu
This series of patches adds multi instances support in musb driver

AM33xx and TI81xx has dual musb controller and has two usb PHY of same type.

The series applies to felipe/musb branch
+ Vaibhav baseport patches on his tree at [4]
+ Kishon's multi phy patches on Felipe's branch 'xceiv'
+ Kishon's patch on phandle at [2]
+ Damodar's recent patch at [3] 
+ Ajay's  Damodar's patches at [5] and [6] included in this series

1. http://git.kernel.org/?p=linux/kernel/git/balbi/usb.git;a=summary
2. http://marc.info/?l=linux-usbm=134070369306112w=2
3. http://marc.info/?l=linux-usbm=134200284230689w=2
4. https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-staging
5. http://marc.info/?l=linux-usbm=134200285530701w=2
6. http://marc.info/?l=linux-usbm=134208820028625w=2

Changes from v9:
- patches rebased on felipe/musb 
- DT and xceiv patches not included in this series
Changes from v8:
- included Sergei's comment, removing underscore in device tree file
- removed duplicated signoff from patches
Changes from v7:
- patches rebased on felipe/master branch  verified
- included additional two patches 0001  0002 as part of this series
  which are already submitted [5]  [6] 
Changes from v6:
- Removed parent_pdev to get glue and used dev_get_getdrv() as per
  Felipe's comment
- use pr_debug() instead of pr_info() as per Felipe's comment
Changes from v5:
- Removed musb-id as per Felipe's comment
- used nop_ida as per Felipe's comment
Changes from v4:
- Fixed Felipe's comment for adding EXPORT_SYMBOL_GPL()
- Fixed Felipe's comment on using dev_set_mask()
Changes from v3:
- Fixed Kishon's comment on removing id from phy struct and
  removing unneeded #else part.
Changes from v2:
- Fixed Sergei's comment on not using address prefix in musb_dsps
  glue and nop transceiver dt dats.
- Also removed the ti string in compatible property for nop data.
Changes from v1:
- Defined musb_ida to manage core ids based on Felipe's comment
  in [PATCH 01/11]


Ajay Kumar Gupta (3):
  usb: musb: kill global and static for multi instance
  usb: musb: dsps: add dt support
  usb: musb: dsps: remove explicit NOP device creation

B, Ravi (2):
  usb: musb: add musb_ida for multi instance support
  usb: musb: am335x: add support for dual instance

 .../devicetree/bindings/usb/am33xx-usb.txt |   14 ++
 drivers/usb/musb/am35x.c   |   42 --
 drivers/usb/musb/blackfin.c|   26 +++-
 drivers/usb/musb/da8xx.c   |   34 +++--
 drivers/usb/musb/davinci.c |   34 +++--
 drivers/usb/musb/musb_core.c   |   53 +--
 drivers/usb/musb/musb_core.h   |6 +
 drivers/usb/musb/musb_debugfs.c|8 +-
 drivers/usb/musb/musb_dsps.c   |  167 ++--
 drivers/usb/musb/omap2430.c|   26 +++-
 drivers/usb/musb/tusb6010.c|   26 +++-
 drivers/usb/musb/ux500.c   |   33 +++--
 12 files changed, 338 insertions(+), 131 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v10 1/5] usb: musb: add musb_ida for multi instance support

2012-09-11 Thread Ravi Babu
From: B, Ravi ravib...@ti.com

Added musb_ida in musb_core.c to manage the multi core ids.

Signed-off-by: Ravi Babu ravib...@ti.com
Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/am35x.c |   42 --
 drivers/usb/musb/blackfin.c  |   26 --
 drivers/usb/musb/da8xx.c |   34 --
 drivers/usb/musb/davinci.c   |   34 --
 drivers/usb/musb/musb_core.c |   31 +++
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/musb_dsps.c |   25 ++---
 drivers/usb/musb/omap2430.c  |   26 --
 drivers/usb/musb/tusb6010.c  |   26 --
 drivers/usb/musb/ux500.c |   33 +++--
 10 files changed, 210 insertions(+), 69 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 9fbe736..de717b5 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -458,6 +458,7 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
struct clk  *clk;
 
int ret = -ENOMEM;
+   int musbid;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -465,38 +466,47 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc(musb-hdrc, -1);
+   /* get the musb id */
+   musbid = musb_get_id(pdev-dev, GFP_KERNEL);
+   if (musbid  0) {
+   dev_err(pdev-dev, failed to allocate musb id\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   musb = platform_device_alloc(musb-hdrc, musbid);
if (!musb) {
dev_err(pdev-dev, failed to allocate musb device\n);
-   goto err1;
+   goto err2;
}
 
phy_clk = clk_get(pdev-dev, fck);
if (IS_ERR(phy_clk)) {
dev_err(pdev-dev, failed to get PHY clock\n);
ret = PTR_ERR(phy_clk);
-   goto err2;
+   goto err3;
}
 
clk = clk_get(pdev-dev, ick);
if (IS_ERR(clk)) {
dev_err(pdev-dev, failed to get clock\n);
ret = PTR_ERR(clk);
-   goto err3;
+   goto err4;
}
 
ret = clk_enable(phy_clk);
if (ret) {
dev_err(pdev-dev, failed to enable PHY clock\n);
-   goto err4;
+   goto err5;
}
 
ret = clk_enable(clk);
if (ret) {
dev_err(pdev-dev, failed to enable clock\n);
-   goto err5;
+   goto err6;
}
 
+   musb-id= musbid;
musb-dev.parent= pdev-dev;
musb-dev.dma_mask  = am35x_dmamask;
musb-dev.coherent_dma_mask = am35x_dmamask;
@@ -514,38 +524,41 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
pdev-num_resources);
if (ret) {
dev_err(pdev-dev, failed to add resources\n);
-   goto err6;
+   goto err7;
}
 
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(pdev-dev, failed to add platform_data\n);
-   goto err6;
+   goto err7;
}
 
ret = platform_device_add(musb);
if (ret) {
dev_err(pdev-dev, failed to register musb device\n);
-   goto err6;
+   goto err7;
}
 
return 0;
 
-err6:
+err7:
clk_disable(clk);
 
-err5:
+err6:
clk_disable(phy_clk);
 
-err4:
+err5:
clk_put(clk);
 
-err3:
+err4:
clk_put(phy_clk);
 
-err2:
+err3:
platform_device_put(musb);
 
+err2:
+   musb_put_id(pdev-dev, musbid);
+
 err1:
kfree(glue);
 
@@ -557,6 +570,7 @@ static int __devexit am35x_remove(struct platform_device 
*pdev)
 {
struct am35x_glue   *glue = platform_get_drvdata(pdev);
 
+   musb_put_id(pdev-dev, glue-musb-id);
platform_device_del(glue-musb);
platform_device_put(glue-musb);
clk_disable(glue-clk);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 54f1b98..26cc8b7 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -454,6 +454,7 @@ static int __devinit bfin_probe(struct platform_device 
*pdev)
struct bfin_glue*glue;
 
int ret = -ENOMEM;
+   int musbid;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -461,12 +462,21 @@ static int __devinit 

[PATCH v10 4/5] usb: musb: dsps: add dt support

2012-09-11 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

Added device tree support for dsps musb glue driver and updated the
Documentation with device tree binding information.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
[af...@ti.com: use '-' instead of '_' for dt properties]
Signed-off-by: Afzal Mohammed af...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |   14 +
 drivers/usb/musb/musb_dsps.c   |   60 +---
 2 files changed, 65 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
new file mode 100644
index 000..ca8fa56
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -0,0 +1,14 @@
+AM33XX MUSB GLUE
+ - compatible : Should be ti,musb-am33xx
+ - ti,hwmods : must be usb_otg_hs
+ - multipoint : Should be 1 indicating the musb controller supports
+   multipoint. This is a MUSB configuration-specific setting.
+ - num_eps : Specifies the number of endpoints. This is also a
+   MUSB configuration-specific setting. Should be set to 16
+ - ram_bits : Specifies the ram address size. Should be set to 12
+ - port0_mode : Should be 3 to represent OTG. 1 signifies HOST and 2
+   represents PERIPHERAL.
+ - port1_mode : Should be 1 to represent HOST. 3 signifies OTG and 2
+   represents PERIPHERAL.
+ - power : Should be 250. This signifies the controller can supply upto
+   500mA when operating in host mode.
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 796fc60..b8aecbb 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -31,6 +31,7 @@
 
 #include linux/init.h
 #include linux/io.h
+#include linux/of.h
 #include linux/err.h
 #include linux/platform_device.h
 #include linux/dma-mapping.h
@@ -45,6 +46,10 @@
 
 #include musb_core.h
 
+#ifdef CONFIG_OF
+static const struct of_device_id musb_dsps_of_match[];
+#endif
+
 /**
  * avoid using musb_readx()/musb_writex() as glue layer should not be
  * dependent on musb core layer symbols.
@@ -448,6 +453,8 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue 
*glue, u8 id)
struct device *dev = glue-dev;
struct platform_device *pdev = to_platform_device(dev);
struct musb_hdrc_platform_data  *pdata = dev-platform_data;
+   struct device_node *np = pdev-dev.of_node;
+   struct musb_hdrc_config *config;
struct platform_device  *musb;
struct resource *res;
struct resource resources[2];
@@ -499,14 +506,40 @@ static int __devinit dsps_create_musb_pdev(struct 
dsps_glue *glue, u8 id)
 
glue-musb[id]  = musb;
 
-   pdata-platform_ops = dsps_ops;
-
ret = platform_device_add_resources(musb, resources, 2);
if (ret) {
dev_err(dev, failed to add resources\n);
goto err2;
}
 
+   if (np) {
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(pdev-dev,
+   failed to allocate musb platfrom data\n);
+   ret = -ENOMEM;
+   goto err2;
+   }
+
+   config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
+   if (!config) {
+   dev_err(pdev-dev,
+   failed to allocate musb hdrc config\n);
+   goto err2;
+   }
+
+   of_property_read_u32(np, num-eps, (u32 *)config-num_eps);
+   of_property_read_u32(np, ram-bits, (u32 *)config-ram_bits);
+   sprintf(res_name, port%d-mode, id);
+   of_property_read_u32(np, res_name, (u32 *)pdata-mode);
+   of_property_read_u32(np, power, (u32 *)pdata-power);
+   config-multipoint = of_property_read_bool(np, multipoint);
+
+   pdata-config   = config;
+   }
+
+   pdata-platform_ops = dsps_ops;
+
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(dev, failed to add platform_data\n);
@@ -538,13 +571,21 @@ static void dsps_delete_musb_pdev(struct dsps_glue *glue, 
u8 id)
 
 static int __devinit dsps_probe(struct platform_device *pdev)
 {
-   const struct platform_device_id *id = platform_get_device_id(pdev);
-   const struct dsps_musb_wrapper *wrp =
-   (struct dsps_musb_wrapper *)id-driver_data;
+   struct device_node *np = pdev-dev.of_node;
+   const struct of_device_id *match;
+   const struct dsps_musb_wrapper *wrp;
struct dsps_glue *glue;
struct resource *iomem;
 

[PATCH v10 3/5] usb: musb: am335x: add support for dual instance

2012-09-11 Thread Ravi Babu
From: B, Ravi ravib...@ti.com

AM335x and TI81xx platform has dual musb controller so updating the
musb_dspc.c to support the same.

Changes:
- Moved otg_workaround timer to glue structure
- Moved static local variable last_timer to glue structure
- PHY on/off related cleanups

Signed-off-by: Ravi Babu ravib...@ti.com
Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
[af...@ti.com: remove control module related modifications]
Signed-off-by: Afzal Mohammed af...@ti.com
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c |   81 +
 1 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 5351e96..796fc60 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -105,6 +105,8 @@ struct dsps_musb_wrapper {
/* miscellaneous stuff */
u32 musb_core_offset;
u8  poll_seconds;
+   /* number of musb instances */
+   u8  instances;
 };
 
 /**
@@ -112,9 +114,10 @@ struct dsps_musb_wrapper {
  */
 struct dsps_glue {
struct device *dev;
-   struct platform_device *musb;   /* child musb pdev */
+   struct platform_device *musb[2];/* child musb pdev */
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
-   struct timer_list timer;/* otg_workaround timer */
+   struct timer_list timer[2]; /* otg_workaround timer */
+   unsigned long last_timer[2];/* last timer data for each instance */
 };
 
 /**
@@ -164,8 +167,8 @@ static void otg_timer(unsigned long _musb)
struct musb *musb = (void *)_musb;
void __iomem *mregs = musb-mregs;
struct device *dev = musb-controller;
-   struct platform_device *pdev = to_platform_device(dev-parent);
-   struct dsps_glue *glue = platform_get_drvdata(pdev);
+   struct platform_device *pdev = to_platform_device(dev);
+   struct dsps_glue *glue = dev_get_drvdata(dev-parent);
const struct dsps_musb_wrapper *wrp = glue-wrp;
u8 devctl;
unsigned long flags;
@@ -201,7 +204,7 @@ static void otg_timer(unsigned long _musb)
case OTG_STATE_B_IDLE:
devctl = dsps_readb(mregs, MUSB_DEVCTL);
if (devctl  MUSB_DEVCTL_BDEVICE)
-   mod_timer(glue-timer,
+   mod_timer(glue-timer[pdev-id],
jiffies + wrp-poll_seconds * HZ);
else
musb-xceiv-state = OTG_STATE_A_IDLE;
@@ -215,9 +218,8 @@ static void otg_timer(unsigned long _musb)
 static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
 {
struct device *dev = musb-controller;
-   struct platform_device *pdev = to_platform_device(dev-parent);
-   struct dsps_glue *glue = platform_get_drvdata(pdev);
-   static unsigned long last_timer;
+   struct platform_device *pdev = to_platform_device(dev);
+   struct dsps_glue *glue = dev_get_drvdata(dev-parent);
 
if (timeout == 0)
timeout = jiffies + msecs_to_jiffies(3);
@@ -227,22 +229,23 @@ static void dsps_musb_try_idle(struct musb *musb, 
unsigned long timeout)
musb-xceiv-state == OTG_STATE_A_WAIT_BCON)) {
dev_dbg(musb-controller, %s active, deleting timer\n,
otg_state_string(musb-xceiv-state));
-   del_timer(glue-timer);
-   last_timer = jiffies;
+   del_timer(glue-timer[pdev-id]);
+   glue-last_timer[pdev-id] = jiffies;
return;
}
 
-   if (time_after(last_timer, timeout)  timer_pending(glue-timer)) {
+   if (time_after(glue-last_timer[pdev-id], timeout) 
+   timer_pending(glue-timer[pdev-id])) {
dev_dbg(musb-controller,
Longer idle timer already pending, ignoring...\n);
return;
}
-   last_timer = timeout;
+   glue-last_timer[pdev-id] = timeout;
 
dev_dbg(musb-controller, %s inactive, starting idle timer for %u 
ms\n,
otg_state_string(musb-xceiv-state),
jiffies_to_msecs(timeout - jiffies));
-   mod_timer(glue-timer, timeout);
+   mod_timer(glue-timer[pdev-id], timeout);
 }
 
 static irqreturn_t dsps_interrupt(int irq, void *hci)
@@ -250,8 +253,8 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
struct musb  *musb = hci;
void __iomem *reg_base = musb-ctrl_base;
struct device *dev = musb-controller;
-   struct platform_device *pdev = to_platform_device(dev-parent);
-   struct dsps_glue *glue = platform_get_drvdata(pdev);
+   struct platform_device *pdev = to_platform_device(dev);
+   struct dsps_glue *glue 

[PATCH] usb/gadget: Add IAD descriptor for ECM in SS mode

2012-09-11 Thread Sebastian Andrzej Siewior
Commit d11519 (usb: gadget: Add Interface Association Descriptor to
ECM) added the IAD descriptor to FS and HS descriptors. The SS
descriptor has been left out probably because it has been added just
recently.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
 drivers/usb/gadget/f_ecm.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index 95bc94f..8ab9e96 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -330,6 +330,7 @@ static struct usb_ss_ep_comp_descriptor 
ss_ecm_bulk_comp_desc = {
 
 static struct usb_descriptor_header *ecm_ss_function[] = {
/* CDC ECM control descriptors */
+   (struct usb_descriptor_header *) ecm_iad_descriptor,
(struct usb_descriptor_header *) ecm_control_intf,
(struct usb_descriptor_header *) ecm_header_desc,
(struct usb_descriptor_header *) ecm_union_desc,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] How to handle delays in isochronous transfers?

2012-09-11 Thread Clemens Ladisch
Alan Stern wrote:
 I have tried some initial testing of my updates, using data-OUT
 transfers with URB_ISO_ASAP turned off for the data URBs in
 sound/usb/endpoint.c.  When interrupts are delayed so long that
 synchronization is lost and a data URB submission fails, the sound
 stops playing and doesn't restart.  But the synch URBs continue to be
 submitted and ogg123 doesn't end for quite some time.

When URB submission fails, the stream should be stopped.  In theory.

Daniel, is there a reason that you commented out the snd_pcm_stop()
call in snd_complete_urb()?

 The test patch should be ready for posting soon.  Would you like to try
 it out?

Yes (if I find time).


Regards,
Clemens
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb/core: Fix race condition when removing EHCI PCI devices

2012-09-11 Thread Don Zickus
On Tue, Sep 11, 2012 at 11:34:56AM -0400, Alan Stern wrote:
 On Mon, 10 Sep 2012, Don Zickus wrote:
 
  A customer of ours noticed that after a bunch of hot removals of the EHCI
  PCI device, a panic occurs. This happened on a 2.6.32 RHEL-6 kernel, but
  I believe is still applicable upstream.
  
  The panic was further simplified to enabling SLUB debug poisoning and 
  running
  the following command:
  
  while true; do find /proc/bus/usb -type f -exec cat {} /dev/null \; ; done 
  
  
  This gets the machine to panic after 1 or 2 removals of the device.
 
  This is likely because the following thread was in the process of removing 
  the
  device:
 
  The fix that solved their problem was to deregister the usb bus first before
  running usb_put_dev.  After running multiple tests the panic disappeared.
  
  Deregistering the bus first to prevent future readers from accessing the 
  device
  before cleaning up the hcd, seemed like an appropriate way to go.  I'll 
  leave
  it to the experts to validate that or provide a better solution. :-)
  
  I adapted their usb_remove_hcd fix for usb_add_hcd error path too to mimic
  the same behaviour (a little code shuffling to handle the gotos cleanly).
 
 Moving things around in usb_add_hcd() is not a good way to attack this
 problem.  Here's a better approach; please make sure that it does what
 you want.  The idea is to indicate that a root hub is not registered by
 setting its devnum field to 0.

Thanks for the feedback.  I will pass this along for testing and get back
to you.

Thanks,
Don

 
 Alan Stern
 
 
 
 Index: usb-3.6/drivers/usb/core/devices.c
 ===
 --- usb-3.6.orig/drivers/usb/core/devices.c
 +++ usb-3.6/drivers/usb/core/devices.c
 @@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct fi
   /* print devices for all busses */
   list_for_each_entry(bus, usb_bus_list, bus_list) {
   /* recurse through all children of the root hub */
 - if (!bus-root_hub)
 + if (!bus-root_hub || bus-root_hub-devnum == 0)
   continue;
   usb_lock_device(bus-root_hub);
   ret = usb_device_dump(buf, nbytes, skip_bytes, ppos,
 Index: usb-3.6/drivers/usb/core/hcd.c
 ===
 --- usb-3.6.orig/drivers/usb/core/hcd.c
 +++ usb-3.6/drivers/usb/core/hcd.c
 @@ -980,6 +980,8 @@ static int register_root_hub(struct usb_
   const int devnum = 1;
   int retval;
  
 + mutex_lock(usb_bus_list_lock);
 +
   usb_dev-devnum = devnum;
   usb_dev-bus-devnum_next = devnum + 1;
   memset (usb_dev-bus-devmap.devicemap, 0,
 @@ -987,8 +989,6 @@ static int register_root_hub(struct usb_
   set_bit (devnum, usb_dev-bus-devmap.devicemap);
   usb_set_device_state(usb_dev, USB_STATE_ADDRESS);
  
 - mutex_lock(usb_bus_list_lock);
 -
   usb_dev-ep0.desc.wMaxPacketSize = cpu_to_le16(64);
   retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
   if (retval != sizeof usb_dev-descriptor) {
 @@ -1011,6 +1011,7 @@ static int register_root_hub(struct usb_
   if (retval) {
   dev_err (parent_dev, can't register root hub for %s, %d\n,
   dev_name(usb_dev-dev), retval);
 + usb_dev-devnum = 0;
   }
   mutex_unlock(usb_bus_list_lock);
  
 @@ -2527,6 +2528,7 @@ error_create_attr_group:
  #endif
   mutex_lock(usb_bus_list_lock);
   usb_disconnect(rhdev); /* Sets rhdev to NULL */
 + hcd-self.root_hub-devnum = 0;
   mutex_unlock(usb_bus_list_lock);
  err_register_root_hub:
   hcd-rh_pollable = 0;
 @@ -2583,6 +2585,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
  
   mutex_lock(usb_bus_list_lock);
   usb_disconnect(rhdev); /* Sets rhdev to NULL */
 + hcd-self.root_hub-devnum = 0;
   mutex_unlock(usb_bus_list_lock);
  
   /* Prevent any more root-hub status calls from the timer.
 
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


EHCI: iaa_watchdog_start() warning followed by NULL ptr dereference in start_unlink_async()

2012-09-11 Thread Hemant Kumar
Hi

I came across an issue where I see WARN_ON from iaa_watchdog_start() and
after almost 10ms I see NULL ptr dereference in start_unlink_async()
 It happens exactly here
prev = ehci-async;
=  while (prev-qh_next.qh != qh)
prev = prev-qh_next.qh;

Here is the call stack trace when warning shows up and then call stack
trace for NULL ptr dereference

4[12-07-25 15:38:29.438] WARNING: at /kernel/drivers/usb/host/ehci.h:191
start_unlink_async+0x1cc/0x1f8()
4[12-07-25 15:38:29.438] [c010c694] (unwind_backtrace+0x0/0x12c) from
[c0186a10] (warn_slowpath_common+0x4c/0x64)
4[12-07-25 15:38:29.438] [c0186a10] (warn_slowpath_common+0x4c/0x64)
from [c0186a40] (warn_slowpath_null+0x18/0x1c)
4[12-07-25 15:38:29.438] [c0186a40] (warn_slowpath_null+0x18/0x1c)
from [c04c76c8] (start_unlink_async+0x1cc/0x1f8)
4[12-07-25 15:38:29.438] [c04c76c8] (start_unlink_async+0x1cc/0x1f8)
from [c04c74a0] (end_unlink_async+0x1b4/0x210)
4[12-07-25 15:38:29.438] [c04c74a0] (end_unlink_async+0x1b4/0x210)
from [c04cd244] (ehci_irq+0x1a4/0x4d8)
4[12-07-25 15:38:29.438] [c04cd244] (ehci_irq+0x1a4/0x4d8) from
[c04ad3bc] (usb_hcd_irq+0x30/0x80)
4[12-07-25 15:38:29.438] [c04ad3bc] (usb_hcd_irq+0x30/0x80) from
[c01c8ab0] (handle_irq_event_percpu+0x9c/0x244)
4[12-07-25 15:38:29.438] [c01c8ab0]
(handle_irq_event_percpu+0x9c/0x244) from [c01c8c94]
(handle_irq_event+0x3c/0x5c)
4[12-07-25 15:38:29.438] [c01c8c94] (handle_irq_event+0x3c/0x5c) from
[c01cb97c] (handle_fasteoi_irq+0xd0/0x108)
4[12-07-25 15:38:29.438] [c01cb97c] (handle_fasteoi_irq+0xd0/0x108)
from [c01c8590] (generic_handle_irq+0x28/0x3c)
4[12-07-25 15:38:29.438] [c01c8590] (generic_handle_irq+0x28/0x3c)
from [c0106f08] (handle_IRQ+0x7c/0xc0)
4[12-07-25 15:38:29.438] [c0106f08] (handle_IRQ+0x7c/0xc0) from
[c0100410] (gic_handle_irq+0xac/0x104)
4[12-07-25 15:38:29.438] [c0100410] (gic_handle_irq+0xac/0x104) from
[c08106d4] (__irq_svc+0x54/0x80)


1[12-07-25 15:38:29.448] Unable to handle kernel NULL pointer
dereference at virtual address 0008
1[12-07-25 15:38:29.448] pgd = c0004000
1[12-07-25 15:38:29.448] [0008] *pgd=
0[12-07-25 15:38:29.448] Internal error: Oops: 17 [#1] PREEMPT SMP
4[12-07-25 15:38:29.448] Modules linked in: wlan(P) cfg80211 mwlan_aarp(P)
4[12-07-25 15:38:29.448] CPU: 1Tainted: PW(3.0.21 #1)
4[12-07-25 15:38:29.448] PC is at start_unlink_async+0xf0/0x1f8
4[12-07-25 15:38:29.448] LR is at start_unlink_async+0x1c/0x1f8
4[12-07-25 15:38:29.448] pc : c04c75eclr : c04c7518psr:
0093

4[12-07-25 15:38:29.448] [c04c75ec] (start_unlink_async+0xf0/0x1f8)
from [c04cb384] (ehci_urb_dequeue+0x84/0x110)
4[12-07-25 15:38:29.448] [c04cb384] (ehci_urb_dequeue+0x84/0x110) from
[c04af690] (unlink1+0xc4/0xd4)
4[12-07-25 15:38:29.448] [c04af690] (unlink1+0xc4/0xd4) from
[c04af868] (usb_hcd_unlink_urb+0x5c/0xc4)
4[12-07-25 15:38:29.448] [c04af868] (usb_hcd_unlink_urb+0x5c/0xc4)
from [c04afd44] (usb_kill_urb+0x4c/0xec)
4[12-07-25 15:38:29.448] [c04afd44] (usb_kill_urb+0x4c/0xec) from
[c04b03b4] (usb_kill_anchored_urbs+0x30/0x58)
4[12-07-25 15:38:29.448] [c04b03b4] (usb_kill_anchored_urbs+0x30/0x58)
from [c04e6ea8] (bridge_suspend+0x4c/0x5c)
4[12-07-25 15:38:29.448] [c04e6ea8] (bridge_suspend+0x4c/0x5c) from
[c04b2eec] (usb_suspend_both+0x7c/0x1c4)
4[12-07-25 15:38:29.448] [c04b2eec] (usb_suspend_both+0x7c/0x1c4) from
[c04b3060] (usb_runtime_suspend+0x2c/0x50)
4[12-07-25 15:38:29.448] [c04b3060] (usb_runtime_suspend+0x2c/0x50)
from [c042d8dc] (rpm_callback+0x44/0x5c)
4[12-07-25 15:38:29.448] [c042d8dc] (rpm_callback+0x44/0x5c) from
[c042ddc4] (rpm_suspend+0x29c/0x4c0)
4[12-07-25 15:38:29.448] [c042ddc4] (rpm_suspend+0x29c/0x4c0) from
[c042eda0] (pm_runtime_work+0x7c/0x98)
4[12-07-25 15:38:29.448] [c042eda0] (pm_runtime_work+0x7c/0x98) from
[c019e8e8] (process_one_work+0x2bc/0x494)
4[12-07-25 15:38:29.448] [c019e8e8] (process_one_work+0x2bc/0x494)
from [c019ee9c] (worker_thread+0x224/0x3e0)
4[12-07-25 15:38:29.448] [c019ee9c] (worker_thread+0x224/0x3e0) from
[c01a483c] (kthread+0x80/0x88)
4[12-07-25 15:38:29.448] [c01a483c] (kthread+0x80/0x88) from
[c0106fa0] (kernel_thread_exit+0x0/0x8)
0[12-07-25 15:38:29.448] Code: e5853024 e5943014 e584501c e1a02003
(e5933008)
4[12-07-25 15:38:29.528] ---[ end trace da227214a82491ba ]---
0[12-07-25 15:38:29.528] Kernel panic - not syncing: Fatal exception

Which looks to me that qh that we are trying to unlink is not part for the
async list maintained by ehci. Here is the status of ehci_hcd struct at
the time of crash

-006|start_unlink_async(
|ehci = 0xDE70A948 - (
|  caps = 0xE1FDE100,
|  regs = 0xE1FDE140,
|  debug = 0x0,
|  hcs_params = 65553,
|  lock = (rlock = (raw_lock = (lock = 2997727918))),
|  async = 0xDCAA4BC0,
|  dummy = 0x0,
|  reclaim = 0xDC9FC480,
|  qh_scan_next = 0x0,
|  scanning = 0,
|  periodic_size = 512,
|  periodic = 0xFFDE6000,
|  periodic_dma = 

Re: [GIT PULL] usb: gadget: patches for v3.7 merge window

2012-09-11 Thread Greg KH
On Tue, Sep 11, 2012 at 12:26:16PM +0300, Felipe Balbi wrote:
 Hi Greg,
 
 here's the pull request for the gadget framework.
 
 There's a bunch of details here and there'll be one conflict with your
 greg/usb-next branch. I have pushed a branch 'merge-result-for-greg' to
 my k.org tree with the solved merge conflict, if you want to take a
 look.
 
 Please let me know if there are any issues with the merge.
 
 The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92:
 
   Linux 3.6-rc2 (2012-08-16 14:51:24 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
 tags/gadget-for-v3.7

Pulled and pushed out, thanks.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html