Re: [PATCH] usb: ohci-exynos: Change to use phy provided by the generic phy framework

2013-12-09 Thread Greg KH
On Wed, Nov 06, 2013 at 10:27:49AM +0900, Jingoo Han wrote:
 Change the phy provider used from the old usb phy specific to a new one
 using the generic phy framework.
 
 Signed-off-by: Jingoo Han jg1@samsung.com
 Cc: Kamil Debski k.deb...@samsung.com
 ---
 Exynos OHCI driver also uses Exynos USB2.0 PHY. Thus, I make this
 patch based-on Kamil Debski's patchset for adding Exynos USB 2.0 PHY
 driver.
 (http://www.spinics.net/lists/linux-samsung-soc/msg24104.html)
 
  drivers/usb/host/ohci-exynos.c |   28 
  1 file changed, 8 insertions(+), 20 deletions(-)

This has some fuzz when applied to my tree, care to redo it against my
usb-next branch of the usb.git tree on git.kernel.org?

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


Re: [PATCH] usb-storage: scsiglue: Changing the command result

2013-12-09 Thread Greg KH
On Sat, Nov 16, 2013 at 12:23:50PM +0530, Vishal Annapurve wrote:
 Hi,
 
 Here are the updated patches: 

Can you please resend these in a format which I can apply them in
without having to hand-edit all three of them?

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


Re: [PATCH 5/7] usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28

2013-12-09 Thread Greg KH
On Thu, Dec 05, 2013 at 03:20:53PM +0800, Peter Chen wrote:
 Due to imx28 needs ARM swp instruction for writing, we set
 CI_HDRC_IMX28_WRITE_FIX for imx28.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Tested-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/chipidea/ci_hdrc_imx.c |   32 ++--
  1 files changed, 26 insertions(+), 6 deletions(-)

Really needed for 3.13-final?
--
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 6/7] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2013-12-09 Thread Greg KH
On Thu, Dec 05, 2013 at 03:20:54PM +0800, Peter Chen wrote:
 From: Chris Ruehl chris.ru...@gtsys.com.hk
 
 * init the sts flag to 0 (missed)
 * fix write the real bit not sts value
 * Set PORTCS_STS and DEVLC_STS only if sts = 1
 
 Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/chipidea/core.c |8 +---
  1 files changed, 5 insertions(+), 3 deletions(-)

If this is so important, why isn't it for 3.12-stable as well?

is this really a regression?  Or just something nice to fix up?

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


Re: [PATCH 4/7] usb: chipidea: add freescale imx28 special write register method

2013-12-09 Thread Greg KH
On Thu, Dec 05, 2013 at 03:20:52PM +0800, Peter Chen wrote:
 According to Freescale imx28 Errata, ENGR119653 USB: ARM to USB
 register error issue, All USB register write operations must
 use the ARM SWP instruction. So, we implement special hw_write
 and hw_test_and_clear for imx28.
 
 Discussion for it at below:
 http://marc.info/?l=linux-usbm=137996395529294w=2
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Tested-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/chipidea/ci.h|   26 --
  drivers/usb/chipidea/core.c  |2 ++
  drivers/usb/chipidea/host.c  |1 +
  include/linux/usb/chipidea.h |1 +
  4 files changed, 28 insertions(+), 2 deletions(-)

Same here, is this really 3.13-final material?
--
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 3/7] usb: ehci: add freescale imx28 special write register method

2013-12-09 Thread Greg KH
On Thu, Dec 05, 2013 at 03:20:51PM +0800, Peter Chen wrote:
 According to Freescale imx28 Errata, ENGR119653 USB: ARM to USB
 register error issue, All USB register write operations must
 use the ARM SWP instruction. So, we implement a special ehci_write
 for imx28.
 
 Discussion for it at below:
 http://marc.info/?l=linux-usbm=137996395529294w=2
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 Acked-by: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Tested-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/host/ehci.h |   18 +-
  1 files changed, 17 insertions(+), 1 deletions(-)

How is this a regression that needs to be fixed in 3.13-final?

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


Re: [PATCH 7/7] usb: chipidea: put hw_phymode_configure before ci_usb_phy_init

2013-12-09 Thread Greg KH
On Thu, Dec 05, 2013 at 03:20:55PM +0800, Peter Chen wrote:
 From: Chris Ruehl chris.ru...@gtsys.com.hk
 
 hw_phymode_configure configures the PORTSC registers and allow the
 following phy_inits to operate on the right parameters. This fix a problem
 where the UPLI (ISP1504) could not be detected, because the Viewport was not
 available and read the viewport return 0's only.
 
 Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/chipidea/core.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

Not needed for -stable?

--
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 v5 08/15] usb: phy-mxs: Add implementation of nofity_suspend and notify_resume

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 07:30 AM, Peter Chen wrote:
 Implementation of notify_suspend and notify_resume will be different
 according to mxs_phy_data-flags.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/phy/phy-mxs-usb.c |   55 
 ++---
  1 files changed, 51 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
 index 0ef930a..e3df53f 100644
 --- a/drivers/usb/phy/phy-mxs-usb.c
 +++ b/drivers/usb/phy/phy-mxs-usb.c
 @@ -166,8 +166,8 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend)
  static int mxs_phy_on_connect(struct usb_phy *phy,
   enum usb_device_speed speed)
  {
 - dev_dbg(phy-dev, %s speed device has connected\n,
 - (speed == USB_SPEED_HIGH) ? high : non-high);
 + dev_dbg(phy-dev, %s device has connected\n,
 + (speed == USB_SPEED_HIGH) ? HS : FS/LS);

What about creating a mxs_phy_dbg() function that adds the HS FS/LS
prefix when printing?

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH 31/39] USB: remove DEFINE_PCI_DEVICE_TABLE macro

2013-12-09 Thread 'Greg Kroah-Hartman'
On Sun, Dec 08, 2013 at 10:03:42PM -0600, Felipe Balbi wrote:
 On Tue, Dec 03, 2013 at 08:27:58AM +0900, Jingoo Han wrote:
  Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
  is not preferred.
  
  Signed-off-by: Jingoo Han jg1@samsung.com
 
 I wonder why I wasn't Cc:ed to this email considering it touches three
 drivers I care about.
 
 Greg, I have the original ones in my tree and I would really like to
 avoid rebasing my 'next' branch. Do we keep it there or do you want to
 avoid merging those commits ?

Just keep it there and we can handle the merge, it shouldn't be a big
deal, right?

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


Re: [PATCH v5 09/15] usb: phy-mxs: Enable IC fixes for related SoCs

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 07:30 AM, Peter Chen wrote:
 Some PHY bugs are fixed by IC logic, but these bits are not
 enabled by default, so we enable them at driver.

Which bugs are fixed by enabling this bit? Is it only suspend related?
Can you document them or better add a pointer to the documentation.

Further I don't like the idea of adding code, or enabling a feature on
certain hardware, that is broken in the first place and fixing it in a
later patch. Think about squashing it into the correct patch.

 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/phy/phy-mxs-usb.c |   28 ++--
  1 files changed, 26 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
 index e3df53f..d1c319b 100644
 --- a/drivers/usb/phy/phy-mxs-usb.c
 +++ b/drivers/usb/phy/phy-mxs-usb.c
 @@ -31,6 +31,10 @@
  #define HW_USBPHY_CTRL_SET   0x34
  #define HW_USBPHY_CTRL_CLR   0x38
  
 +#define HW_USBPHY_IP 0x90
 +#define HW_USBPHY_IP_SET 0x94
 +#define HW_USBPHY_IP_CLR 0x98
 +
  #define BM_USBPHY_CTRL_SFTRSTBIT(31)
  #define BM_USBPHY_CTRL_CLKGATE   BIT(30)
  #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26)
 @@ -42,6 +46,8 @@
  #define BM_USBPHY_CTRL_ENUTMILEVEL2  BIT(14)
  #define BM_USBPHY_CTRL_ENHOSTDISCONDETECTBIT(1)
  
 +#define BM_USBPHY_IP_FIX   (BIT(17) | BIT(18))
 +
  #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy)
  
  /* Do disconnection between PHY and controller without vbus */
 @@ -63,6 +69,9 @@
  /* The SoCs who have anatop module */
  #define MXS_PHY_HAS_ANATOP   BIT(3)
  
 +/* IC has bug fixes logic */
 +#define MXS_PHY_NEED_IP_FIX  BIT(4)
 +
  struct mxs_phy_data {
   unsigned int flags;
  };
 @@ -74,12 +83,14 @@ static const struct mxs_phy_data imx23_phy_data = {
  static const struct mxs_phy_data imx6q_phy_data = {
   .flags = MXS_PHY_SENDING_SOF_TOO_FAST |
   MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
 - MXS_PHY_HAS_ANATOP,
 + MXS_PHY_HAS_ANATOP |
 + MXS_PHY_NEED_IP_FIX,
  };
  
  static const struct mxs_phy_data imx6sl_phy_data = {
   .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
 - MXS_PHY_HAS_ANATOP,
 + MXS_PHY_HAS_ANATOP |
 + MXS_PHY_NEED_IP_FIX,
  };
  
  static const struct of_device_id mxs_phy_dt_ids[] = {
 @@ -97,6 +108,16 @@ struct mxs_phy {
   struct regmap *regmap_anatop;
  };
  
 +static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy)
 +{
 + return mxs_phy-data == imx6q_phy_data;
 +}
 +
 +static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
 +{
 + return mxs_phy-data == imx6sl_phy_data;
 +}

Are the two is_imx6* functions still needed?

 +
  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
  {
   int ret;
 @@ -123,6 +144,9 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
   BM_USBPHY_CTRL_ENUTMILEVEL3,
  base + HW_USBPHY_CTRL_SET);
  
 + if (mxs_phy-data-flags  MXS_PHY_NEED_IP_FIX)
 + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
 +
   return 0;
  }

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v5 12/15] usb: phy: Add set_wakeup API

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 07:31 AM, Peter Chen wrote:
 This API is used to set wakeup enable at PHY registers, in that
 case, the PHY can be waken up from suspend due to external events,

I' no native speaker, but I think it's to be woken up.

 like vbus change, dp/dm change and id change.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  include/linux/usb/phy.h |   16 
  1 files changed, 16 insertions(+), 0 deletions(-)
 
 diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
 index a747960..c6ebe1d 100644
 --- a/include/linux/usb/phy.h
 +++ b/include/linux/usb/phy.h
 @@ -111,6 +111,13 @@ struct usb_phy {
   int (*set_suspend)(struct usb_phy *x,
   int suspend);
  
 + /*
 +  * Set wakeup enable for PHY, in that case, the PHY can be
 +  * waken up from suspend status due to external events,
 +  * like vbus change, dp/dm change and id.
 +  */
 + int (*set_wakeup)(struct usb_phy *x, bool enabled);
 +
   /* notify phy connect status change */
   int (*notify_connect)(struct usb_phy *x,
   enum usb_device_speed speed);
 @@ -270,6 +277,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
  }
  
  static inline int
 +usb_phy_set_wakeup(struct usb_phy *x, bool enabled)
 +{
 + if (x  x-set_wakeup)

can x be NULL?

 + return x-set_wakeup(x, enabled);
 + else
 + return 0;
 +}
 +
 +static inline int
  usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
  {
   if (x  x-notify_connect)
 

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


RE: [PATCH 7/7] usb: chipidea: put hw_phymode_configure before ci_usb_phy_init

2013-12-09 Thread peter.c...@freescale.com


 
 
 On Thu, Dec 05, 2013 at 03:20:55PM +0800, Peter Chen wrote:
  From: Chris Ruehl chris.ru...@gtsys.com.hk
 
  hw_phymode_configure configures the PORTSC registers and allow the
  following phy_inits to operate on the right parameters. This fix a
 problem
  where the UPLI (ISP1504) could not be detected, because the Viewport
 was not
  available and read the viewport return 0's only.
 
  Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/chipidea/core.c |4 ++--
   1 files changed, 2 insertions(+), 2 deletions(-)
 
 Not needed for -stable?
 
 

Not needed, the usb for that platform did not enable
at 3.12.

Peter
--
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 3/7] usb: ehci: add freescale imx28 special write register method

2013-12-09 Thread peter.c...@freescale.com
 
 
 On Thu, Dec 05, 2013 at 03:20:51PM +0800, Peter Chen wrote:
  According to Freescale imx28 Errata, ENGR119653 USB: ARM to USB
  register error issue, All USB register write operations must
  use the ARM SWP instruction. So, we implement a special ehci_write
  for imx28.
 
  Discussion for it at below:
  http://marc.info/?l=linux-usbm=137996395529294w=2
 
  Signed-off-by: Peter Chen peter.c...@freescale.com
  Acked-by: Alan Stern st...@rowland.harvard.edu
  Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
  Tested-by: Marc Kleine-Budde m...@pengutronix.de
  ---
   drivers/usb/host/ehci.h |   18 +-
   1 files changed, 17 insertions(+), 1 deletions(-)
 
 How is this a regression that needs to be fixed in 3.13-final?
 

Without this patchset, there is lots of usb errors at i.mx28.
It was reported at: http://marc.info/?l=linux-usbm=137996395529294w=2.


--
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 v5 2/3] usb: ohci-at91: use dev variable instead of pdev-dev

2013-12-09 Thread Boris BREZILLON
Make use of the dev variable instead of referencing the dev field of the
pdev struct.

Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Signed-off-by: Alan Stern st...@rowland.harvard.edu
---
 drivers/usb/host/ohci-at91.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 9dc50f8..8c0c4a4 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -152,7 +152,7 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
return irq;
}
 
-   hcd = usb_create_hcd(driver, pdev-dev, at91);
+   hcd = usb_create_hcd(driver, dev, at91);
if (!hcd)
return -ENOMEM;
hcd-rsrc_start = res-start;
@@ -164,28 +164,28 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
goto err;
}
 
-   iclk = clk_get(pdev-dev, ohci_clk);
+   iclk = clk_get(dev, ohci_clk);
if (IS_ERR(iclk)) {
-   dev_err(pdev-dev, failed to get ohci_clk\n);
+   dev_err(dev, failed to get ohci_clk\n);
retval = PTR_ERR(iclk);
goto err;
}
-   fclk = clk_get(pdev-dev, uhpck);
+   fclk = clk_get(dev, uhpck);
if (IS_ERR(fclk)) {
-   dev_err(pdev-dev, failed to get uhpck\n);
+   dev_err(dev, failed to get uhpck\n);
retval = PTR_ERR(fclk);
goto err4;
}
-   hclk = clk_get(pdev-dev, hclk);
+   hclk = clk_get(dev, hclk);
if (IS_ERR(hclk)) {
-   dev_err(pdev-dev, failed to get hclk\n);
+   dev_err(dev, failed to get hclk\n);
retval = PTR_ERR(hclk);
goto err5;
}
if (IS_ENABLED(CONFIG_COMMON_CLK)) {
-   uclk = clk_get(pdev-dev, usb_clk);
+   uclk = clk_get(dev, usb_clk);
if (IS_ERR(uclk)) {
-   dev_err(pdev-dev, failed to get uclk\n);
+   dev_err(dev, failed to get uclk\n);
retval = PTR_ERR(uclk);
goto err6;
}
-- 
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 v5 1/3] usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource

2013-12-09 Thread Boris BREZILLON
Replace the request_mem_region + ioremap calls by the
devm_ioremap_resource call which does the same things but with device
managed resources.

Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Signed-off-by: Alan Stern st...@rowland.harvard.edu
---
 drivers/usb/host/ohci-at91.c |   27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 8c356af..9dc50f8 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -158,24 +158,17 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
hcd-rsrc_start = res-start;
hcd-rsrc_len = resource_size(res);
 
-   if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) {
-   pr_debug(request_mem_region failed\n);
-   retval = -EBUSY;
-   goto err1;
-   }
-
-   hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len);
-   if (!hcd-regs) {
-   pr_debug(ioremap failed\n);
-   retval = -EIO;
-   goto err2;
+   hcd-regs = devm_ioremap_resource(dev, res);
+   if (IS_ERR(hcd-regs)) {
+   retval = PTR_ERR(hcd-regs);
+   goto err;
}
 
iclk = clk_get(pdev-dev, ohci_clk);
if (IS_ERR(iclk)) {
dev_err(pdev-dev, failed to get ohci_clk\n);
retval = PTR_ERR(iclk);
-   goto err3;
+   goto err;
}
fclk = clk_get(pdev-dev, uhpck);
if (IS_ERR(fclk)) {
@@ -219,13 +212,7 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
  err4:
clk_put(iclk);
 
- err3:
-   iounmap(hcd-regs);
-
- err2:
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
-
- err1:
+ err:
usb_put_hcd(hcd);
return retval;
 }
@@ -248,8 +235,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
 {
usb_remove_hcd(hcd);
at91_stop_hc(pdev);
-   iounmap(hcd-regs);
-   release_mem_region(hcd-rsrc_start, hcd-rsrc_len);
usb_put_hcd(hcd);
 
if (IS_ENABLED(CONFIG_COMMON_CLK))
-- 
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 v5 3/3] usb: ohci-at91: use device managed clk retrieval

2013-12-09 Thread Boris BREZILLON
Replace clk_get calls by devm_clk_get calls.

Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Signed-off-by: Alan Stern st...@rowland.harvard.edu
---
 drivers/usb/host/ohci-at91.c |   30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 8c0c4a4..9aa485e 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -164,30 +164,30 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
goto err;
}
 
-   iclk = clk_get(dev, ohci_clk);
+   iclk = devm_clk_get(dev, ohci_clk);
if (IS_ERR(iclk)) {
dev_err(dev, failed to get ohci_clk\n);
retval = PTR_ERR(iclk);
goto err;
}
-   fclk = clk_get(dev, uhpck);
+   fclk = devm_clk_get(dev, uhpck);
if (IS_ERR(fclk)) {
dev_err(dev, failed to get uhpck\n);
retval = PTR_ERR(fclk);
-   goto err4;
+   goto err;
}
-   hclk = clk_get(dev, hclk);
+   hclk = devm_clk_get(dev, hclk);
if (IS_ERR(hclk)) {
dev_err(dev, failed to get hclk\n);
retval = PTR_ERR(hclk);
-   goto err5;
+   goto err;
}
if (IS_ENABLED(CONFIG_COMMON_CLK)) {
-   uclk = clk_get(dev, usb_clk);
+   uclk = devm_clk_get(dev, usb_clk);
if (IS_ERR(uclk)) {
dev_err(dev, failed to get uclk\n);
retval = PTR_ERR(uclk);
-   goto err6;
+   goto err;
}
}
 
@@ -203,15 +203,6 @@ static int usb_hcd_at91_probe(const struct hc_driver 
*driver,
/* Error handling */
at91_stop_hc(pdev);
 
-   if (IS_ENABLED(CONFIG_COMMON_CLK))
-   clk_put(uclk);
- err6:
-   clk_put(hclk);
- err5:
-   clk_put(fclk);
- err4:
-   clk_put(iclk);
-
  err:
usb_put_hcd(hcd);
return retval;
@@ -236,13 +227,6 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
usb_remove_hcd(hcd);
at91_stop_hc(pdev);
usb_put_hcd(hcd);
-
-   if (IS_ENABLED(CONFIG_COMMON_CLK))
-   clk_put(uclk);
-   clk_put(hclk);
-   clk_put(fclk);
-   clk_put(iclk);
-   fclk = iclk = hclk = NULL;
 }
 
 /*-*/
-- 
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: [PATCH v2 1/7] usb: dwc3: get usb_phy only if the platform indicates the presence of PHY's

2013-12-09 Thread Heikki Krogerus
Hi,

On Fri, Dec 06, 2013 at 02:15:30PM -0600, Felipe Balbi wrote:
 On Tue, Dec 03, 2013 at 12:39:50PM +0200, Heikki Krogerus wrote:
  On Thu, Oct 17, 2013 at 09:54:26AM -0500, Felipe Balbi wrote:
   On Wed, Oct 16, 2013 at 04:27:26PM +0300, Roger Quadros wrote:
On 10/16/2013 04:10 PM, Kishon Vijay Abraham I wrote:
Do you know if there are users of dwc3 other than exynos5250 and omap5?
If not, we should get rid of the old USB PHY altogether.
   
   Intel's Baytrail, at least. But they don't use DT.
  
  I don't see any use for the generic-phy when the device is enumerated
  from PCI. If dwc3 can live without phys, there should not be any
  problem dropping the old USB PHY support.
 
 yeah, I don't want to drop PHY support, I want to require everybody to
 provide a PHY, otherwise we have too many options to handle and that's
 never clean.

I have to clarify in case there was a misunderstanding. When I said
generic-phy I meant drivers/usb/phy/phy-generic.c and I was not
talking about Kishon's new generic PHY framework.

So I was only saying that if the dwc3-pci.c is the only thing that
needs the old usb phy support, then there should not be any problem
dropping the support for it.

Thanks,

-- 
heikki
--
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 6/7] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2013-12-09 Thread peter.c...@freescale.com
 
 
 On Thu, Dec 05, 2013 at 03:20:54PM +0800, Peter Chen wrote:
  From: Chris Ruehl chris.ru...@gtsys.com.hk
 
  * init the sts flag to 0 (missed)
  * fix write the real bit not sts value
  * Set PORTCS_STS and DEVLC_STS only if sts = 1
 
  Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/chipidea/core.c |8 +---
   1 files changed, 5 insertions(+), 3 deletions(-)
 
 If this is so important, why isn't it for 3.12-stable as well?
 
 is this really a regression?  Or just something nice to fix up?
 

It is nice to fix up.

Thanks,

Peter

--
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 7/7] usb: chipidea: put hw_phymode_configure before ci_usb_phy_init

2013-12-09 Thread Greg KH
On Mon, Dec 09, 2013 at 08:44:05AM +, peter.c...@freescale.com wrote:
 
 
  
  
  On Thu, Dec 05, 2013 at 03:20:55PM +0800, Peter Chen wrote:
   From: Chris Ruehl chris.ru...@gtsys.com.hk
  
   hw_phymode_configure configures the PORTSC registers and allow the
   following phy_inits to operate on the right parameters. This fix a
  problem
   where the UPLI (ISP1504) could not be detected, because the Viewport
  was not
   available and read the viewport return 0's only.
  
   Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
   Signed-off-by: Peter Chen peter.c...@freescale.com
   ---
drivers/usb/chipidea/core.c |4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
  
  Not needed for -stable?
  
  
 
 Not needed, the usb for that platform did not enable
 at 3.12.

Then this isn't a regression from 3.12, but a bugfix only, hm, I'll
think about it...
--
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 6/7] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2013-12-09 Thread Greg KH
On Mon, Dec 09, 2013 at 08:40:42AM +, peter.c...@freescale.com wrote:
  
  
  On Thu, Dec 05, 2013 at 03:20:54PM +0800, Peter Chen wrote:
   From: Chris Ruehl chris.ru...@gtsys.com.hk
  
   * init the sts flag to 0 (missed)
   * fix write the real bit not sts value
   * Set PORTCS_STS and DEVLC_STS only if sts = 1
  
   Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk
   Signed-off-by: Peter Chen peter.c...@freescale.com
   ---
drivers/usb/chipidea/core.c |8 +---
1 files changed, 5 insertions(+), 3 deletions(-)
  
  If this is so important, why isn't it for 3.12-stable as well?
  
  is this really a regression?  Or just something nice to fix up?
  
 
 It is nice to fix up.

Then it can't go into 3.13-final this late in the development cycle,
sorry.

This is regression fixes only at this point in time.

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


[PATCH v5 0/3] usb: ohci-at91: various improvements

2013-12-09 Thread Boris BREZILLON
Hello,

This patch series moves the different driver resources (clks and iomem)
retrieval to the device managed versions (devm_ functions).

Best Regards,

Boris

Changes since v4:
 - remove unneeded debug trace in case devm_ioremap_resource fails
   (an error message is already printed within this function)

Changes since v3:
 - replace devm_request_and_ioremap call by devm_ioremap_resource

Changes since v2:
 - split urgent fix and resource retrieval improvements

Boris BREZILLON (3):
  usb: ohci-at91: replace request_mem_region + ioremap by
devm_ioremap_resource
  usb: ohci-at91: use dev variable instead of pdev-dev
  usb: ohci-at91: use device managed clk retrieval

 drivers/usb/host/ohci-at91.c |   67 --
 1 file changed, 18 insertions(+), 49 deletions(-)

-- 
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: [PATCH v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 07:31 AM, Peter Chen wrote:
 After clear portsc.phcd, PHY needs 200us stable time for switch
 32K clock to AHB clock.

If this is a general bugbix, please move it to the start of this series
and add stable on Cc. I think I hit the bug on the second USB port of a
custom MX28 board, the stmp_reset_block() in the USB phy will fail.

Is the problem documented somewhere?

Is it possible to add the delay in the clock framework? I think only the
regulator framework has a configurable delay for the regulator to stabilize.

 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/phy/phy-mxs-usb.c |   11 +++
  1 files changed, 11 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
 index e18fdf3..7ae5225 100644
 --- a/drivers/usb/phy/phy-mxs-usb.c
 +++ b/drivers/usb/phy/phy-mxs-usb.c
 @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
   return mxs_phy-data == imx6sl_phy_data;
  }
  
 +/*
 + * PHY needs some 32K cycles to switch from 32K clock to
 + * bus (such as AHB/AXI, etc) clock.
 + */
 +static void mxs_phy_clock_switch(void)
 +{
 + usleep_range(300, 400);
 +}
 +
  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
  {
   int ret;
 @@ -276,6 +285,7 @@ static int mxs_phy_init(struct usb_phy *phy)
  {
   struct mxs_phy *mxs_phy = to_mxs_phy(phy);
  
 + mxs_phy_clock_switch();
   clk_prepare_enable(mxs_phy-clk);
   return mxs_phy_hw_init(mxs_phy);
  }
 @@ -300,6 +310,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend)
  x-io_priv + HW_USBPHY_CTRL_SET);
   clk_disable_unprepare(mxs_phy-clk);
   } else {
 + mxs_phy_clock_switch();
   clk_prepare_enable(mxs_phy-clk);
   writel(BM_USBPHY_CTRL_CLKGATE,
  x-io_priv + HW_USBPHY_CTRL_CLR);
 

Marc
-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v3 04/10] usb: dwc3: use quirks to know if a particualr platform doesn't have PHY

2013-12-09 Thread Heikki Krogerus
Hi,

On Mon, Dec 09, 2013 at 12:43:37PM +0530, Kishon Vijay Abraham I wrote:
 On Thursday 05 December 2013 01:28 PM, Heikki Krogerus wrote:
 On Thu, Dec 05, 2013 at 12:04:46PM +0530, Kishon Vijay Abraham I wrote:
 On Wednesday 04 December 2013 08:10 PM, Heikki Krogerus wrote:
 On Mon, Nov 25, 2013 at 03:31:24PM +0530, Kishon Vijay Abraham I wrote:
 There can be systems which does not have an external phy, so get
 phy only if no quirks are added that indicates the PHY is not present.
 Introduced two quirk flags to indicate the *absence* of usb2 phy and
 usb3 phy. Also remove checking if return value is -ENXIO since it's now
 changed to always enable usb_phy layer.
 
 Can you guys explain why is something like this needed? Like with
 clocks and gpios, the device drivers shouldn't need to care any more
 if the platform has the phys or not. -ENODEV tells you your platform
 
 Shouldn't we report if a particular platform needs a PHY and not able to get
 it. How will a user know if a particular controller is not working because 
 it's
 not able to get and initialize the PHYs? Don't you think in such cases it's
 better to fail (and return from probe) because the controller will not work
 anyway without the PHY?
 
 My point is that you do not need to separately tell this to the driver
 like you do with the quirks (if you did, then you would need to fix
 your framework and not hack the drivers).
 
 Like I said, ENODEV tells you that there is no phy on this platform
 for you, allowing you to safely continue. If your phy driver is not
 loaded, the framework already returns EPROBE_DEFER, right. Any other
 
 right. but that doesn't consider broken dt data. With quirks we'll
 able to tell if a controller in a particular platform has PHY or not
 without depending on the dt data.

Broken dt data? What kind of scenario are you thinking here? Do you
mean case where the dt does not describe the phy on a platform that
depends on it? Shouldn't that problem be fixed in the dt and not
hacked in the drivers? Or are you thinking about something else?

Is there a case where something like that is actually happening?

Br,

-- 
heikki
--
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: ohci-exynos: Change to use phy provided by the generic phy framework

2013-12-09 Thread Jingoo Han
On Monday, December 09, 2013 10:56 AM, Greg KH wrote:
 On Wed, Nov 06, 2013 at 10:27:49AM +0900, Jingoo Han wrote:
  Change the phy provider used from the old usb phy specific to a new one
  using the generic phy framework.
 
  Signed-off-by: Jingoo Han jg1@samsung.com
  Cc: Kamil Debski k.deb...@samsung.com
  ---
  Exynos OHCI driver also uses Exynos USB2.0 PHY. Thus, I make this
  patch based-on Kamil Debski's patchset for adding Exynos USB 2.0 PHY
  driver.
  (http://www.spinics.net/lists/linux-samsung-soc/msg24104.html)
 
   drivers/usb/host/ohci-exynos.c |   28 
   1 file changed, 8 insertions(+), 20 deletions(-)
 
 This has some fuzz when applied to my tree, care to redo it against my
 usb-next branch of the usb.git tree on git.kernel.org?

Hi Greg,

This patch should be updated, based on Kamil Debski's  V4 patchset
for adding Exynos USB 2.0 PHY driver [1].
I will send v2 patch based on Kamil Debski's  V4 patchset [1].

[1] [PATCH v4 0/9] phy: Add new Exynos USB 2.0 PHY driver 
 (http://www.spinics.net/lists/linux-usb/msg98911.html)

Thank you.

Best regards,
Jingoo Han

--
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 3/7] usb: ehci: add freescale imx28 special write register method

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 08:37:55AM +, peter.c...@freescale.com wrote:
  
  
  On Thu, Dec 05, 2013 at 03:20:51PM +0800, Peter Chen wrote:
   According to Freescale imx28 Errata, ENGR119653 USB: ARM to USB
   register error issue, All USB register write operations must
   use the ARM SWP instruction. So, we implement a special ehci_write
   for imx28.
  
   Discussion for it at below:
   http://marc.info/?l=linux-usbm=137996395529294w=2
  
   Signed-off-by: Peter Chen peter.c...@freescale.com
   Acked-by: Alan Stern st...@rowland.harvard.edu
   Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
   Tested-by: Marc Kleine-Budde m...@pengutronix.de
   ---
drivers/usb/host/ehci.h |   18 +-
1 files changed, 17 insertions(+), 1 deletions(-)
  
  How is this a regression that needs to be fixed in 3.13-final?
  
 
 Without this patchset, there is lots of usb errors at i.mx28.
 It was reported at: http://marc.info/?l=linux-usbm=137996395529294w=2.
 
 

This patchset includes [3/7], [4/7] and [5/7].

Thanks.

-- 

Best Regards,
Peter Chen

--
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 v5 08/15] usb: phy-mxs: Add implementation of nofity_suspend and notify_resume

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 09:31:28AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:30 AM, Peter Chen wrote:
  Implementation of notify_suspend and notify_resume will be different
  according to mxs_phy_data-flags.
  
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/phy/phy-mxs-usb.c |   55 
  ++---
   1 files changed, 51 insertions(+), 4 deletions(-)
  
  diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
  index 0ef930a..e3df53f 100644
  --- a/drivers/usb/phy/phy-mxs-usb.c
  +++ b/drivers/usb/phy/phy-mxs-usb.c
  @@ -166,8 +166,8 @@ static int mxs_phy_suspend(struct usb_phy *x, int 
  suspend)
   static int mxs_phy_on_connect(struct usb_phy *phy,
  enum usb_device_speed speed)
   {
  -   dev_dbg(phy-dev, %s speed device has connected\n,
  -   (speed == USB_SPEED_HIGH) ? high : non-high);
  +   dev_dbg(phy-dev, %s device has connected\n,
  +   (speed == USB_SPEED_HIGH) ? HS : FS/LS);
 
 What about creating a mxs_phy_dbg() function that adds the HS FS/LS
 prefix when printing?
 

No, sometimes, there is no speed information when we want to debug
mxs phy.

-- 

Best Regards,
Peter Chen

--
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 3/7] usb: ehci: add freescale imx28 special write register method

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 03:04 AM, Greg KH wrote:
 On Thu, Dec 05, 2013 at 03:20:51PM +0800, Peter Chen wrote:
 According to Freescale imx28 Errata, ENGR119653 USB: ARM to USB
 register error issue, All USB register write operations must
 use the ARM SWP instruction. So, we implement a special ehci_write
 for imx28.

 Discussion for it at below:
 http://marc.info/?l=linux-usbm=137996395529294w=2

 Signed-off-by: Peter Chen peter.c...@freescale.com
 Acked-by: Alan Stern st...@rowland.harvard.edu
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Tested-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/host/ehci.h |   18 +-
  1 files changed, 17 insertions(+), 1 deletions(-)
 
 How is this a regression that needs to be fixed in 3.13-final?

Yes, all three (3/7, 4/7, 5/7) should go into v3.13, add you please add
stable on Cc as well.

Thanks,
Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v5 09/15] usb: phy-mxs: Enable IC fixes for related SoCs

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 09:38:17AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:30 AM, Peter Chen wrote:
  Some PHY bugs are fixed by IC logic, but these bits are not
  enabled by default, so we enable them at driver.
 
 Which bugs are fixed by enabling this bit? Is it only suspend related?
 Can you document them or better add a pointer to the documentation.

I will add more, in fact, it fixes the bug which flag BIT(1) and BIT(2)
stands for.

 
 Further I don't like the idea of adding code, or enabling a feature on
 certain hardware, that is broken in the first place and fixing it in a
 later patch. Think about squashing it into the correct patch.

No fixes are related with this patch, you can see there is no -
at this patch.

   
  +static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy)
  +{
  +   return mxs_phy-data == imx6q_phy_data;
  +}
  +
  +static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
  +{
  +   return mxs_phy-data == imx6sl_phy_data;
  +}
 
 Are the two is_imx6* functions still needed?

Will more it to [14/15], they are needed there.

Peter

 
  +
   static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
   {
  int ret;
  @@ -123,6 +144,9 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
  BM_USBPHY_CTRL_ENUTMILEVEL3,
 base + HW_USBPHY_CTRL_SET);
   
  +   if (mxs_phy-data-flags  MXS_PHY_NEED_IP_FIX)
  +   writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
  +
  return 0;
   }
 
 Marc
 
 -- 
 Pengutronix e.K.  | Marc Kleine-Budde   |
 Industrial Linux Solutions| Phone: +49-231-2826-924 |
 Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
 Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
 



-- 

Best Regards,
Peter Chen

--
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-storage: scsiglue: Changing the command result

2013-12-09 Thread Vishal Annapurve

Hi Greg,

Attached are the patches.

Regards,
Vishal

On Monday 09 December 2013 07:29 AM, Greg KH wrote:

On Sat, Nov 16, 2013 at 12:23:50PM +0530, Vishal Annapurve wrote:

Hi,

Here are the updated patches:   

Can you please resend these in a format which I can apply them in
without having to hand-edit all three of them?

thanks,

greg k-h




01-PATCH-usb-storage-Proper-cmd-result-assignment.patch.gz
Description: GNU Zip compressed data


02-keucr-Proper-cmd-result-assignment.patch.gz
Description: GNU Zip compressed data


03-usb-storage-uas-Proper-cmd-result-assignment.patch.gz
Description: GNU Zip compressed data


Re: [PATCH v5 12/15] usb: phy: Add set_wakeup API

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 09:41:54AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:31 AM, Peter Chen wrote:
  This API is used to set wakeup enable at PHY registers, in that
  case, the PHY can be waken up from suspend due to external events,
 
 I' no native speaker, but I think it's to be woken up.

Thanks, will change.

   
   static inline int
  +usb_phy_set_wakeup(struct usb_phy *x, bool enabled)
  +{
  +   if (x  x-set_wakeup)
 
 can x be NULL?
 

Possible, this function is PHY's API, it may be called uninitialized.

Peter

  +   return x-set_wakeup(x, enabled);
  +   else
  +   return 0;
  +}
  +
  +static inline int
   usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
   {
  if (x  x-notify_connect)
  
 
 Marc
 
 -- 
 Pengutronix e.K.  | Marc Kleine-Budde   |
 Industrial Linux Solutions| Phone: +49-231-2826-924 |
 Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
 Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
 



-- 

Best Regards,
Peter Chen

--
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 v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 10:05:17AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:31 AM, Peter Chen wrote:
  After clear portsc.phcd, PHY needs 200us stable time for switch
  32K clock to AHB clock.
 
 If this is a general bugbix, please move it to the start of this series
 and add stable on Cc. I think I hit the bug on the second USB port of a
 custom MX28 board, the stmp_reset_block() in the USB phy will fail.

Not a bug-fix, just the requirement for the PHY leaves low power mode.
Does the bug exists with my this patchset, or just current mainline code?

 
 Is the problem documented somewhere?
 
 Is it possible to add the delay in the clock framework? I think only the
 regulator framework has a configurable delay for the regulator to stabilize.

It is just related to mxs PHY's hardware timing. It is better to add
it at specific driver.

Peter

 
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/phy/phy-mxs-usb.c |   11 +++
   1 files changed, 11 insertions(+), 0 deletions(-)
  
  diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
  index e18fdf3..7ae5225 100644
  --- a/drivers/usb/phy/phy-mxs-usb.c
  +++ b/drivers/usb/phy/phy-mxs-usb.c
  @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy 
  *mxs_phy)
  return mxs_phy-data == imx6sl_phy_data;
   }
   
  +/*
  + * PHY needs some 32K cycles to switch from 32K clock to
  + * bus (such as AHB/AXI, etc) clock.
  + */
  +static void mxs_phy_clock_switch(void)
  +{
  +   usleep_range(300, 400);
  +}
  +
   static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
   {
  int ret;
  @@ -276,6 +285,7 @@ static int mxs_phy_init(struct usb_phy *phy)
   {
  struct mxs_phy *mxs_phy = to_mxs_phy(phy);
   
  +   mxs_phy_clock_switch();
  clk_prepare_enable(mxs_phy-clk);
  return mxs_phy_hw_init(mxs_phy);
   }
  @@ -300,6 +310,7 @@ static int mxs_phy_suspend(struct usb_phy *x, int 
  suspend)
 x-io_priv + HW_USBPHY_CTRL_SET);
  clk_disable_unprepare(mxs_phy-clk);
  } else {
  +   mxs_phy_clock_switch();
  clk_prepare_enable(mxs_phy-clk);
  writel(BM_USBPHY_CTRL_CLKGATE,
 x-io_priv + HW_USBPHY_CTRL_CLR);
  
 
 Marc
 -- 
 Pengutronix e.K.  | Marc Kleine-Budde   |
 Industrial Linux Solutions| Phone: +49-231-2826-924 |
 Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
 Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
 



-- 

Best Regards,
Peter Chen

--
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 v5 09/15] usb: phy-mxs: Enable IC fixes for related SoCs

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 10:07 AM, Peter Chen wrote:
 On Mon, Dec 09, 2013 at 09:38:17AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:30 AM, Peter Chen wrote:
 Some PHY bugs are fixed by IC logic, but these bits are not
 enabled by default, so we enable them at driver.

 Which bugs are fixed by enabling this bit? Is it only suspend related?
 Can you document them or better add a pointer to the documentation.
 
 I will add more, in fact, it fixes the bug which flag BIT(1) and BIT(2)
 stands for.
 

 Further I don't like the idea of adding code, or enabling a feature on
 certain hardware, that is broken in the first place and fixing it in a
 later patch. Think about squashing it into the correct patch.
 
 No fixes are related with this patch, you can see there is no -
 at this patch.

Yes, there isn't any broken code (thus no -), but you first enable a
feature in the hardware and in a later patch (this one) make it work
properly.

Marc
-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] usb-storage: scsiglue: Changing the command result

2013-12-09 Thread Oliver Neukum
On Mon, 2013-12-09 at 15:14 +0530, Vishal Annapurve wrote:
 Hi Greg,
 
 Attached are the patches.
Hi,

please send patches in the clear, inline, one patch per mail
and with a Signed-off-by line, as described in the Documentation
directory of the kernel.

Regards
Oliver


--
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 v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd

2013-12-09 Thread Marc Kleine-Budde
On 12/09/2013 10:19 AM, Peter Chen wrote:
 On Mon, Dec 09, 2013 at 10:05:17AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 07:31 AM, Peter Chen wrote:
 After clear portsc.phcd, PHY needs 200us stable time for switch
 32K clock to AHB clock.

 If this is a general bugbix, please move it to the start of this series
 and add stable on Cc. I think I hit the bug on the second USB port of a
 custom MX28 board, the stmp_reset_block() in the USB phy will fail.
 
 Not a bug-fix, just the requirement for the PHY leaves low power mode.
 Does the bug exists with my this patchset, or just current mainline code?

I see, I found this strange thing on v3.8, but can try on v3.13-rc3.

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] usb-storage: scsiglue: Changing the command result

2013-12-09 Thread Greg KH
On Mon, Dec 09, 2013 at 03:14:07PM +0530, Vishal Annapurve wrote:
 Hi Greg,
 
 Attached are the patches.

As Oliver said, I can't take these, please read
Documentation/SubmittingPatches for how to do this properly.

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


[PATCH] xhci: Add quirks module option

2013-12-09 Thread Takashi Iwai
It makes easier for debugging some hardware specific issues.

Note that this option won't override the value to be set.  That is,
you can turn quirks on by this option but cannot turn them off if set
by the driver.

Signed-off-by: Takashi Iwai ti...@suse.de
---

I noticed the lack of quirks module option during investigating the
recent bug report for my Haswell S5 fix quirk
https://bugzilla.kernel.org/show_bug.cgi?id=66171

 drivers/usb/host/xhci.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 4265b48856f6..08a4fd458d22 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -40,6 +40,10 @@ static int link_quirk;
 module_param(link_quirk, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(link_quirk, Don't clear the chain bit on a link TRB);
 
+static unsigned int quirks;
+module_param(quirks, uint, S_IRUGO);
+MODULE_PARM_DESC(quirks, Bit flags for quirks to be enabled as default);
+
 /* TODO: copied from ehci-hcd.c - can this be refactored? */
 /*
  * xhci_handshake - spin reading hc until handshake completes or fails
@@ -4760,6 +4764,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t 
get_quirks)
xhci-hcc_params = xhci_readl(xhci, xhci-cap_regs-hcc_params);
xhci_print_registers(xhci);
 
+   xhci-quirks = quirks;
+
get_quirks(dev, xhci);
 
/* In xhci controllers which follow xhci 1.0 spec gives a spurious
-- 
1.8.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] xhci: Limit the spurious wakeup fix only to HP machines

2013-12-09 Thread Takashi Iwai
We've got regression reports that my previous fix for spurious wakeups
after S5 on HP Haswell machines leads to the hangup at shutdown on
some machines.  It turned out that the fix for one side triggers
another BIOS bug in other side.  So, it's exclusive.

Since the S5 wakeups have been confirmed explicitly only on HP
machines, it'd be safer to apply it only to limited machines.  As a
wild guess, limiting to machines with HP PCI SSID should suffice.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66171
Cc: sta...@vger.kernel.org
Signed-off-by: Takashi Iwai ti...@suse.de
---
 drivers/usb/host/xhci-pci.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index b8dffd59eb25..73f5208714a4 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
 * any other sleep) on Haswell machines with LPT and LPT-LP
 * with the new Intel BIOS
 */
-   xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
+   /* Limit the quirk to only known vendors, as this triggers
+* yet another BIOS bug on some other machines
+* https://bugzilla.kernel.org/show_bug.cgi?id=66171
+*/
+   if (pdev-subsystem_vendor == PCI_VENDOR_ID_HP)
+   xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
}
if (pdev-vendor == PCI_VENDOR_ID_ETRON 
pdev-device == PCI_DEVICE_ID_ASROCK_P67) {
-- 
1.8.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] net: sk == 0xffffffff fix - not for commit

2013-12-09 Thread Andrzej Pietrasiewicz
NOT FOR COMMITTING TO MAINLINE.

With g_ether loaded the sk occasionally becomes 0x.
It happens usually after transferring few hundreds of kilobytes to few
tens of megabytes. If sk is 0x then dereferencing it causes
kernel panic.

This is a *workaround*. I don't know enough net code to understand the core
of the problem. However, with this patch applied the problems are gone,
or at least pushed farther away.

The relevant stack trace below:

[   53.583351] Unable to handle kernel NULL pointer dereference at virtual 
address 0011
 ]
[   53.590077] pgd = c0004000
[   53.592761] [0011] *pgd=
[   53.596319] Internal error: Oops: 17 [#1] PREEMPT ARM
[   53.601223] Modules linked in: usb_f_ecm g_ether u_ether libcomposite
[   53.607641] CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.0-rc6+ #157
[   53.613962] task: c058e5d8 ti: c0584000 task.ti: c0584000
[   53.619345] PC is at tcp_v4_early_demux+0xbc/0x150
[   53.624105] LR is at __inet_lookup_established+0x25c/0x2e0
[   53.629562] pc : [c03595a4]lr : [c033fc0c]psr: a113
[   53.629562] sp : c0585d08  ip : c0585cd0  fp : c0585d2c
[   53.640997] r10: c058cf84  r9 : c05c1768  r8 : e7b22740
[   53.646197] r7 :   r6 : 2cb7  r5 :   r4 : e7b22740
[   53.652697] r3 : c0304504  r2 : c0585cb8  r1 : e6d3e070  r0 : 
[   53.659198] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment 
kernel
[   53.666476] Control: 10c5387d  Table: 57b48019  DAC: 0015
[   53.672194] Process swapper (pid: 0, stack limit = 0xc0584238)
[   53.678001] Stack: (0xc0585d08 to 0xc0586000)
[   53.682338] 5d00:   0381a8c0 eb89 0002 c0585d20 
e7b6e810 e7b22758
[   53.690484] 5d20: c0585d5c c0585d30 c03377f0 c03594f4 c00104e8 c0028ef4 
c058cf70 c058ddec
[   53.698629] 5d40: 0008 e7806000  e7b22740 c0585dac c0585d60 
c0311dd4 c0337480
[   53.706775] 5d60: c058cf78  6113  c0585dfc e7b22740 
c0014368 c058cf84
[   53.714921] 5d80:  e7b22740  c05c8b14 0002 c05c8b60 
 00100100
[   53.723067] 5da0: c0585dc4 c0585db0 c0312f8c c0311c20 e7b22740  
c0585dfc c0585dc8
[   53.731212] 5dc0: c031390c c0312f60 00200200 c05c8b44  c05c8b60 
000c 012a
[   53.739358] 5de0: c05c8b00 c059c548 0001 0040 c0585e3c c0585e00 
c031331c c0313874
[   53.747503] 5e00: c05c8ce3 c0584000 c05ca6c0 3f7c c0028504 0003 
000c c05ceb10
[   53.755650] 5e20: c05ceb0c 0001 c0584000 c0584000 c0585ea4 c0585e40 
c0028968 c0313238
[   53.763795] 5e40: c005cc94 c005eb24 0020 c059b3e0 3f7b c059c548 
c05ceac0 000a
[   53.771941] 5e60:  c059e6d8 c0584000 000c 0101 c05c8d70 
 6193
[   53.780086] 5e80: c0584000  c0619b00  412fc082 c0584038 
c0585ebc c0585ea8
[   53.788232] 5ea0: c0028c40 c0028814  c0584000 c0585ed4 c0585ec0 
c0028fb8 c0028bd0
[   53.796378] 5ec0: c05b5018 0058 c0585ef4 c0585ed8 c00104e8 c0028ef4 
0020 c0619b28
[   53.804524] 5ee0: c0585f20 0001 c0585f1c c0585ef8 c00085dc c00104a8 
c058c734 c00106d4
[   53.812670] 5f00: 6013  c0585f54 c058c0d0 c0585f74 c0585f20 
c0014344 c0008578
[   53.820815] 5f20:  2a9c  c058c734 c0584038 c05c92ac 
c0584000 c05c8c08
[   53.828961] 5f40: c058c0d0 412fc082 c0584038 c0585f74 c0585f68 c0585f68 
c00106d0 c00106d4
[   53.837107] 5f60: 6013  c0585f9c c0585f78 c005c2ac c00106ac 
c058c040 c0584000
[   53.845252] 5f80: c0584000 c0584000 c03aa868  c0585fb4 c0585fa0 
c03a2458 c005c198
[   53.853398] 5fa0:  c058ca08 c0585ff4 c0585fb8 c053aa74 c03a23d0 
 
[   53.861544] 5fc0: c053a540   c0566058  10c53c7d 
c058c05c c0566054
[   53.869689] 5fe0: c058f88c 30004059  c0585ff8 30008070 c053a7c8 
 
[   53.877848] [c03595a4] (tcp_v4_early_demux+0xbc/0x150) from [c03377f0] 
(ip_rcv+0x37c/0x590)
[   53.886510] [c03377f0] (ip_rcv+0x37c/0x590) from [c0311dd4] 
(__netif_receive_skb_core+0x1c0/0x624)
[   53.895779] [c0311dd4] (__netif_receive_skb_core+0x1c0/0x624) from 
[c0312f8c] (__netif_receive_skb+0x38/0x88)
[   53.906003] [c0312f8c] (__netif_receive_skb+0x38/0x88) from [c031390c] 
(process_backlog+0xa4/0x15c)
[   53.915361] [c031390c] (process_backlog+0xa4/0x15c) from [c031331c] 
(net_rx_action+0xf0/0x230)
[   53.924290] [c031331c] (net_rx_action+0xf0/0x230) from [c0028968] 
(__do_softirq+0x160/0x35c)
[   53.933040] [c0028968] (__do_softirq+0x160/0x35c) from [c0028c40] 
(do_softirq+0x7c/0x80)
[   53.941444] [c0028c40] (do_softirq+0x7c/0x80) from [c0028fb8] 
(irq_exit+0xd0/0x10c)
[   53.949423] [c0028fb8] (irq_exit+0xd0/0x10c) from [c00104e8] 
(handle_IRQ+0x4c/0x94)
[   53.957390] [c00104e8] (handle_IRQ+0x4c/0x94) from [c00085dc] 
(vic_handle_irq+0x70/0xac)
[   53.965795] [c00085dc] (vic_handle_irq+0x70/0xac) from 

Re: [PATCH v2 2/2] arm: omap: remove *.auto* from device names given in usb_bind_phy

2013-12-09 Thread Javier Martinez Canillas
Hi Kishon,

On Mon, Dec 9, 2013 at 7:07 AM, Kishon Vijay Abraham I kis...@ti.com wrote:
 Hi,


 On Saturday 07 December 2013 02:38 AM, Felipe Balbi wrote:

 Hi,

 On Fri, Dec 06, 2013 at 01:14:38PM +0100, Javier Martinez Canillas wrote:

 On Fri, Dec 6, 2013 at 1:06 PM, Kishon Vijay Abraham I kis...@ti.com
 wrote:

 Previously MUSB wrapper (OMAP) device used PLATFORM_DEVID_AUTO while
 creating
 MUSB core device. So in usb_bind_phy (binds the controller with the
 PHY), the
 device name of the controller had *.auto* in it. Since with using
 PLATFORM_DEVID_AUTO, there is no way to know the exact device name in
 advance,
 the data given in usb_bind_phy became obsolete and usb_get_phy was
 failing.
 So MUSB wrapper was modified not to use PLATFORM_DEVID_AUTO.
 Corresponding
 change is done in board file here.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
   arch/arm/mach-omap2/board-2430sdp.c|2 +-
   arch/arm/mach-omap2/board-3430sdp.c|2 +-
   arch/arm/mach-omap2/board-cm-t35.c |2 +-
   arch/arm/mach-omap2/board-devkit8000.c |2 +-
   arch/arm/mach-omap2/board-ldp.c|2 +-
   arch/arm/mach-omap2/board-omap3beagle.c|2 +-
   arch/arm/mach-omap2/board-omap3logic.c |2 +-
   arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
   arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
   arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
   arch/arm/mach-omap2/board-overo.c  |2 +-
   arch/arm/mach-omap2/board-rx51.c   |2 +-
   12 files changed, 12 insertions(+), 12 deletions(-)


 You can drop this patch since boards files are being removed for v3.14


 if we can drop this patch, the whole series is invalid, since we'll be
 using DT phandles to find PHYs going forward, no ?

 yeah. But in one of the other threads, Tony seemed ok to take a patch that
 fixes the same issue in mach-omap2/twl-common.c. So it's better to confirm
 with Tony.


Yes, I just read the other thread ([PATCH] omap: twl-common: Fix
musb-hdrc device name) and I see that these patches are fixing a
v3.13 regression and are meant for the -rc cycle and not for v3.14.

Sorry for the noise then.

Best regards,
Javier


 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


[PATCH] USB: core: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-09 Thread Vikas Sajjan
Does warm reset while activating SuperSpeed HUBs if the hub activate type
is HUB_RESET_RESUME.

When we do Suspend-to-RAM with (any one of the 16, 32, 64 Jetflash) transcend
USB 3.0 device connected on 3.0 port, during resume I noticed that the
XHCI controller has moved to sometimes RECOVERY, POLLING or INACTIVE STATE.
This behaviour is inconsistent and the connection with connected USB 3.0 device
on 3.0 port was LOST.

Doing warm reset while activating SuperSpeed HUBs if the hub
activate type is HUB_RESET_RESUME, gets the connected device to the stable 
state.

Reviewed at https://chromium-review.googlesource.com/#/c/177132/

Tested on exynos5420 and exynos5250 with Transcend Jetflash USB 3.0 device 
(8564:1000)

rebased on Greg Kroah-Hartman's usb-next
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git

Signed-off-by: Vikas Sajjan vikas.saj...@samsung.com
---
 drivers/usb/core/hub.c |   41 +
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a7c04e2..d8432b0 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -993,6 +993,21 @@ int usb_remove_device(struct usb_device *udev)
return 0;
 }
 
+#define PORT_RESET_TRIES   5
+#define SET_ADDRESS_TRIES  2
+#define GET_DESCRIPTOR_TRIES   2
+#define SET_CONFIG_TRIES   (2 * (use_both_schemes + 1))
+#define USE_NEW_SCHEME(i)  ((i) / 2 == (int)old_scheme_first)
+
+#define HUB_ROOT_RESET_TIME50  /* times are in msec */
+#define HUB_SHORT_RESET_TIME   10
+#define HUB_BH_RESET_TIME  50
+#define HUB_LONG_RESET_TIME200
+#define HUB_RESET_TIMEOUT  800
+
+static int hub_port_reset(struct usb_hub *hub, int port1,
+   struct usb_device *udev, unsigned int delay, bool warm);
+
 enum hub_activation_type {
HUB_INIT, HUB_INIT2, HUB_INIT3, /* INITs must come first */
HUB_POST_RESET, HUB_RESUME, HUB_RESET_RESUME,
@@ -1093,6 +1108,16 @@ static void hub_activate(struct usb_hub *hub, enum 
hub_activation_type type)
u16 portstatus, portchange;
 
portstatus = portchange = 0;
+
+   /* Some connected devices might be still in unknown state even
+* after reset-resume, a WARM_RESET gets the connected device
+* to the normal state.
+*/
+   if (udev  hub_is_superspeed(hub-hdev) 
+   type == HUB_RESET_RESUME)
+   hub_port_reset(hub, port1, NULL,
+   HUB_BH_RESET_TIME, true);
+
status = hub_port_status(hub, port1, portstatus, portchange);
if (udev || (portstatus  USB_PORT_STAT_CONNECTION))
dev_dbg(hub-intfdev,
@@ -2510,22 +2535,6 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
return hcd-wireless;
 }
 
-
-#define PORT_RESET_TRIES   5
-#define SET_ADDRESS_TRIES  2
-#define GET_DESCRIPTOR_TRIES   2
-#define SET_CONFIG_TRIES   (2 * (use_both_schemes + 1))
-#define USE_NEW_SCHEME(i)  ((i) / 2 == (int)old_scheme_first)
-
-#define HUB_ROOT_RESET_TIME50  /* times are in msec */
-#define HUB_SHORT_RESET_TIME   10
-#define HUB_BH_RESET_TIME  50
-#define HUB_LONG_RESET_TIME200
-#define HUB_RESET_TIMEOUT  800
-
-static int hub_port_reset(struct usb_hub *hub, int port1,
-   struct usb_device *udev, unsigned int delay, bool warm);
-
 /* Is a USB 3.0 port in the Inactive or Complinance Mode state?
  * Port worm reset is required to recover
  */
-- 
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: [PATCH] USB: core: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-09 Thread Vivek Gautam
Hi Vikas,


On Mon, Dec 9, 2013 at 5:59 PM, Vikas Sajjan vikas.saj...@linaro.org wrote:

few minor nits here. ;-)

 Does warm reset while activating SuperSpeed HUBs if the hub activate type
 is HUB_RESET_RESUME.

 When we do Suspend-to-RAM with (any one of the 16, 32, 64 Jetflash) transcend
 USB 3.0 device connected on 3.0 port, during resume I noticed that the
 XHCI controller has moved to sometimes RECOVERY, POLLING or INACTIVE STATE.
 This behaviour is inconsistent and the connection with connected USB 3.0 
 device
 on 3.0 port was LOST.

 Doing warm reset while activating SuperSpeed HUBs if the hub
 activate type is HUB_RESET_RESUME, gets the connected device to the stable 
 state.

 Reviewed at https://chromium-review.googlesource.com/#/c/177132/

 Tested on exynos5420 and exynos5250 with Transcend Jetflash USB 3.0 device 
 (8564:1000)

 rebased on Greg Kroah-Hartman's usb-next
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git

Above two lines may not be required in the commit message.


 Signed-off-by: Vikas Sajjan vikas.saj...@samsung.com
 ---
  drivers/usb/core/hub.c |   41 +
  1 file changed, 25 insertions(+), 16 deletions(-)

 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
 index a7c04e2..d8432b0 100644
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
 @@ -993,6 +993,21 @@ int usb_remove_device(struct usb_device *udev)
 return 0;
  }

 +#define PORT_RESET_TRIES   5
 +#define SET_ADDRESS_TRIES  2
 +#define GET_DESCRIPTOR_TRIES   2
 +#define SET_CONFIG_TRIES   (2 * (use_both_schemes + 1))
 +#define USE_NEW_SCHEME(i)  ((i) / 2 == (int)old_scheme_first)
 +
 +#define HUB_ROOT_RESET_TIME50  /* times are in msec */
 +#define HUB_SHORT_RESET_TIME   10
 +#define HUB_BH_RESET_TIME  50
 +#define HUB_LONG_RESET_TIME200
 +#define HUB_RESET_TIMEOUT  800
 +
 +static int hub_port_reset(struct usb_hub *hub, int port1,
 +   struct usb_device *udev, unsigned int delay, bool 
 warm);
 +
  enum hub_activation_type {
 HUB_INIT, HUB_INIT2, HUB_INIT3, /* INITs must come first */
 HUB_POST_RESET, HUB_RESUME, HUB_RESET_RESUME,
 @@ -1093,6 +1108,16 @@ static void hub_activate(struct usb_hub *hub, enum 
 hub_activation_type type)
 u16 portstatus, portchange;

 portstatus = portchange = 0;
 +
 +   /* Some connected devices might be still in unknown state even
Please take care of multiple line commenting style.

 +* after reset-resume, a WARM_RESET gets the connected device
 +* to the normal state.
 +*/
 +   if (udev  hub_is_superspeed(hub-hdev) 
 +   type == HUB_RESET_RESUME)
 +   hub_port_reset(hub, port1, NULL,
 +   HUB_BH_RESET_TIME, true);
 +
 status = hub_port_status(hub, port1, portstatus, 
 portchange);
 if (udev || (portstatus  USB_PORT_STAT_CONNECTION))
 dev_dbg(hub-intfdev,
 @@ -2510,22 +2535,6 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
 return hcd-wireless;
  }

 -
 -#define PORT_RESET_TRIES   5
 -#define SET_ADDRESS_TRIES  2
 -#define GET_DESCRIPTOR_TRIES   2
 -#define SET_CONFIG_TRIES   (2 * (use_both_schemes + 1))
 -#define USE_NEW_SCHEME(i)  ((i) / 2 == (int)old_scheme_first)
 -
 -#define HUB_ROOT_RESET_TIME50  /* times are in msec */
 -#define HUB_SHORT_RESET_TIME   10
 -#define HUB_BH_RESET_TIME  50
 -#define HUB_LONG_RESET_TIME200
 -#define HUB_RESET_TIMEOUT  800
 -
 -static int hub_port_reset(struct usb_hub *hub, int port1,
 -   struct usb_device *udev, unsigned int delay, bool 
 warm);
 -
  /* Is a USB 3.0 port in the Inactive or Complinance Mode state?
   * Port worm reset is required to recover
   */
 --
 1.7.9.5

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
--
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 v4 3/9] phy: Add new Exynos USB PHY driver

2013-12-09 Thread Kamil Debski
Hi, 

 From: Kishon Vijay Abraham I [mailto:kis...@ti.com]
 Sent: Monday, December 09, 2013 8:56 AM
 
 Hi,
 
 On Friday 06 December 2013 09:58 PM, Kamil Debski wrote:
  Hi Kishon,
 
  Thank you for the review.
 
  From: Kishon Vijay Abraham I [mailto:kis...@ti.com]
  Sent: Friday, December 06, 2013 11:59 AM
 
  Hi,
 
  On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
  Add a new driver for the Exynos USB PHY. The new driver uses the
  generic PHY framework. The driver includes support for the Exynos
  4x10
  and 4x12 SoC families.
 
  Signed-off-by: Kamil Debski k.deb...@samsung.com
  Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
  ---
 
 
 snip
 .
 .
  diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index
  d0caae9..9f4befd 100644
  --- a/drivers/phy/Makefile
  +++ b/drivers/phy/Makefile
  @@ -7,3 +7,6 @@ obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-
 exynos-dp-
  video.o
obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-
 video.o
obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o
obj-$(CONFIG_TWL4030_USB)   += phy-twl4030-usb.o
  +obj-$(CONFIG_PHY_SAMSUNG_USB2)   += phy-samsung-usb2.o
  +obj-$(CONFIG_PHY_EXYNOS4210_USB2)+= phy-exynos4210-usb2.o
  +obj-$(CONFIG_PHY_EXYNOS4212_USB2)+= phy-exynos4212-usb2.o
  diff --git a/drivers/phy/phy-exynos4210-usb2.c
  b/drivers/phy/phy-exynos4210-usb2.c
  new file mode 100644
  index 000..a02e5c2
  --- /dev/null
  +++ b/drivers/phy/phy-exynos4210-usb2.c
  @@ -0,0 +1,264 @@
  +/*
  + * Samsung SoC USB 1.1/2.0 PHY driver - Exynos 4210 support
  + *
  + * Copyright (C) 2013 Samsung Electronics Co., Ltd.
  + * Author: Kamil Debski k.deb...@samsung.com
  + *
  + * This program is free software; you can redistribute it and/or
  +modify
  + * it under the terms of the GNU General Public License version 2
  +as
  + * published by the Free Software Foundation.
  + */
  +
  +#include linux/clk.h
  +#include linux/delay.h
  +#include linux/io.h
  +#include linux/kernel.h
  +#include linux/module.h
  +#include linux/of.h
  +#include linux/of_address.h
  +#include linux/phy/phy.h
  +#include linux/platform_device.h
  +#include linux/regmap.h
  +#include linux/spinlock.h
 
  You've included most of the above header files in phy-samsung-usb2.h
  which you are including below.
 
  I agree that includes in phy-samsung-usb2.h could use a cleanup. On
  the other hand my opinion is that a .c file should include all .h
  files that are used in this .c file. Relaying on .h file to include
  another .h doesn't seem good to me.
 
 then remove it in .h file.
 
  +#include phy-samsung-usb2.h
  +
  +/* Exynos USB PHY registers */
  +
  +/* PHY power control */
  +#define EXYNOS_4210_UPHYPWR  0x0
  +
  +#define EXYNOS_4210_UPHYPWR_PHY0_SUSPEND (1  0)
 
  use BIT() here and everywhere below.
 
 
 snip
 .
 .
 
  +#ifdef CONFIG_PHY_EXYNOS4212_USB2
  + {
  + .compatible = samsung,exynos4212-usb2-phy,
  + .data = exynos4212_usb2_phy_config,
  + },
  +#endif
  + { },
  +};
 
  I think we've had enough discussion about this approach. Let's get
  the opinion of others too. Felipe? Greg?
 
  Good idea.
 
  Summary:
  We have two drivers PHY_EXYNOS4210_USB2 and PHY_EXYNOS4212_USB2 with
  almost similar register map [1] and a samsung helper driver for
 these
  two drivers.
 
  I would not call them separate drivers. It's a single USB 2.0 driver
  with the option to include support for various SoCs. This patchset
 adds:
  Exynos 4210, Exynos 4212, Exynos 5250 and S5PCV210. I know that
  another person is working on supporting S3C6410.
 
  These two PHY drivers populate the function pointers in the helper
  driver. So any phy_ops will first invoke the helper driver which
 will
  then invoke the corresponding phy driver.
 
  [1] - http://www.diffchecker.com/7yno1uvk
 
  Come on, this diff only includes the registers part of the file.
  The following functions are also different:
  - exynos421*_rate_to_clk
  - exynos421*_isol
  - exynos421*_phy_pwr
  - exynos421*_power_on
  - exynos421*_power_on
 
 But most of the differences is because your 4212 has additional
 features in HSIC and supports more clock rates.
 
  It seems that the file is too large for the tool. But still this
 makes
  a false impression that only registers are different.
 
  Advantages:
  * (more) clean and readable
  * helper driver can be used with other PHY drivers which will be
  added soon
 
  Disadvantages:
  * code duplication
 
  I would say that actually in this case less code is duplicated.
 Having
  Separate drivers would mean that most of the phy-samsung-usb2.c file
  has
 
 I actually meant a single driver for 4210 and 4212.
 
 your current code has separate drivers for different versions of the
 same IP. If you have a single driver for the different versions, it
 will lead to a lot less code duplication (hint: I'v given the exact
 'same'
 comment at-least twice in this patch).

You wrote more than 

[PATCH v2] xhci: Limit the spurious wakeup fix only to HP machines

2013-12-09 Thread Takashi Iwai
We've got regression reports that my previous fix for spurious wakeups
after S5 on HP Haswell machines leads to the automatic reboot at
shutdown on some machines.  It turned out that the fix for one side
triggers another BIOS bug in other side.  So, it's exclusive.

Since the original S5 wakeups have been confirmed only on HP machines,
it'd be safer to apply it only to limited machines.  As a wild guess,
limiting to machines with HP PCI SSID should suffice.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66171
Cc: sta...@vger.kernel.org
Signed-off-by: Takashi Iwai ti...@suse.de
---
v1-v2: Fix bug description

 drivers/usb/host/xhci-pci.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index b8dffd59eb25..73f5208714a4 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct 
xhci_hcd *xhci)
 * any other sleep) on Haswell machines with LPT and LPT-LP
 * with the new Intel BIOS
 */
-   xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
+   /* Limit the quirk to only known vendors, as this triggers
+* yet another BIOS bug on some other machines
+* https://bugzilla.kernel.org/show_bug.cgi?id=66171
+*/
+   if (pdev-subsystem_vendor == PCI_VENDOR_ID_HP)
+   xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
}
if (pdev-vendor == PCI_VENDOR_ID_ETRON 
pdev-device == PCI_DEVICE_ID_ASROCK_P67) {
-- 
1.8.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: [PATCH 3/9] ARM: fix ohci-pxa27x build error with OF enabled

2013-12-09 Thread Steve Cotton
On Mon, Dec 09, 2013 at 02:53 +0400, Sergei Ianovich wrote:
 ---8---
 $ make
   CC [M]  drivers/usb/host/ohci-pxa27x.o
 drivers/usb/host/ohci-pxa27x.c: In function ‘ohci_pxa_of_init’:
 drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function 
 ‘dma_coerce_mask_and_coherent’ [-Werror=implicit-function-declaration]
 drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function 
 ‘DMA_BIT_MASK’ [-Werror=implicit-function-declaration]
 ---8---
 
 Signed-off-by: Sergei Ianovich ynv...@gmail.com
 CC: Russell King - ARM Linux li...@arm.linux.org.uk
 
  # Changes to be committed:
 ---
  drivers/usb/host/ohci-pxa27x.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
 index e89ac4d..97983fd 100644
 --- a/drivers/usb/host/ohci-pxa27x.c
 +++ b/drivers/usb/host/ohci-pxa27x.c
 @@ -24,6 +24,7 @@
  #include linux/io.h
  #include linux/kernel.h
  #include linux/module.h
 +#include linux/dma-mapping.h
  #include linux/of_platform.h
  #include linux/of_gpio.h
  #include linux/platform_data/usb-ohci-pxa27x.h

Hi Sergei,

There's already a different patch for this
in the linux-next/master and gregkh/usb/usb-linus trees, but
not in the linux-next/stable or gregkh/usb/usb-next trees.

It adds that include 3 lines higher up, to keep the includes in
alphabetical order.

commit 9876388edfa553960815110acae4544359b385b5
Author: Daniel Mack zon...@gmail.com
AuthorDate: Fri Nov 15 14:19:02 2013 +0100
Commit: Greg Kroah-Hartman gre...@linuxfoundation.org
CommitDate: Wed Dec 4 16:57:46 2013 -0800

Cheers,
Steve
--
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 3/9] ARM: fix ohci-pxa27x build error with OF enabled

2013-12-09 Thread Sergei Ianovich
On Mon, 2013-12-09 at 14:26 +, Steve Cotton wrote:
 There's already a different patch for this
 in the linux-next/master and gregkh/usb/usb-linus trees, but
 not in the linux-next/stable or gregkh/usb/usb-next trees.
 
 It adds that include 3 lines higher up, to keep the includes in
 alphabetical order.

Thanks.

--
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


Problem with Kingston MobileLite G3 SD card reader

2013-12-09 Thread Thomas Raschbacher

Hi.

I recently bought a Kingston MobileLite G3 SD card reader 
(http://www.kingston.com/en/flash/readers#fcr-mlg3).
I now have a problem where it recognises the microSDXC card without any 
problems, but does not recognise the MSPD/SDXC slot at all (on windows I 
get 2 'drives')


the kingston page even lists linux (from 2.6) as supported but well it 
doesn'T seem to really work (any more).


Any ideas what the problem could be?
I can help debug the problem, but I'd need some pointers as to where to 
start, since it's been a while since i've been doing kernel 
hacking/debug ;)


Here are some of the kernel messages I get:

kernel: [  382.562000] hub 8-0:1.0: state 7 ports 5 chg  evt 0004
kernel: [  382.562000] ehci-pci :00:13.2: GetStatus port:2 status 
001803 0  ACK POWER sig=j CSC CONNECT
kernel: [  382.562000] hub 8-0:1.0: port 2, status 0501, change 0001, 
480 Mb/s
kernel: [  382.666000] hub 8-0:1.0: debounce: port 2: total 100ms stable 
100ms status 0x501
kernel: [  382.717000] ehci-pci :00:13.2: port 2 reset complete, 
port enabled
kernel: [  382.717000] ehci-pci :00:13.2: GetStatus port:2 status 
001005 0  ACK POWER sig=se0 PE CONNECT
kernel: [  382.768000] usb 8-2: new high-speed USB device number 3 using 
ehci-pci
kernel: [  382.822000] ehci-pci :00:13.2: port 2 reset complete, 
port enabled
kernel: [  382.822000] ehci-pci :00:13.2: GetStatus port:2 status 
001005 0  ACK POWER sig=se0 PE CONNECT

kernel: [  382.904000] usb 8-2: default language 0x0409
kernel: [  382.985000] usb 8-2: udev 3, busnum 8, minor = 898
kernel: [  382.985000] usb 8-2: New USB device found, idVendor=0bda, 
idProduct=0306
kernel: [  382.985000] usb 8-2: New USB device strings: Mfr=1, 
Product=2, SerialNumber=3

kernel: [  382.985000] usb 8-2: Product: USB3.0 Card Reader
kernel: [  382.985000] usb 8-2: Manufacturer: Realtek
kernel: [  382.985000] usb 8-2: SerialNumber: 201006010301
kernel: [  382.985000] usb 8-2: usb_probe_device
kernel: [  382.985000] usb 8-2: configuration #1 chosen from 1 choice
kernel: [  382.988000] usb 8-2: adding 8-2:1.0 (config #1, interface 0)
kernel: [  382.991000] usb-storage 8-2:1.0: usb_probe_interface
kernel: [  382.991000] usb-storage 8-2:1.0: usb_probe_interface - got id
kernel: [  382.991000] usb-storage 8-2:1.0: USB Mass Storage device 
detected

kernel: [  382.991000] scsi10 : usb-storage 8-2:1.0
mtp-probe: checking bus 8, device 3: 
/sys/devices/pci:00/:00:13.2/usb8/8-2

mtp-probe: bus: 8, device: 3 was not an MTP device
kernel: [  384.008000] scsi 10:0:0:0: Direct-Access Generic- USB3.0 
CRW-0 1.00 PQ: 0 ANSI: 4
kernel: [  384.571000] sd 10:0:0:0: [sde] 15544320 512-byte logical 
blocks: (7.95 GB/7.41 GiB)

kernel: [  384.574000] sd 10:0:0:0: [sde] Write Protect is off
kernel: [  384.574000] sd 10:0:0:0: [sde] Mode Sense: 2f 00 00 00
kernel: [  384.576000] sd 10:0:0:0: [sde] Write cache: disabled, read 
cache: enabled, doesn't support DPO or FUA

kernel: [  384.587000]  sde: sde1
kernel: [  384.592000] sd 10:0:0:0: [sde] Attached SCSI removable disk

On windows it identifies as Generic- USB3.0 CRW-0 USB Device and 
Generic- USB3.0 CRW-1 USB Device


Regards,
  Thomas Raschbacher

--
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: dwc3: omap: remove unnecessary lock

2013-12-09 Thread Santosh Shilimkar
On Saturday 07 December 2013 12:55 PM, Balbi, Felipe wrote:
 the lock was only taken inside the hardirq
 handler, which runs with IRQs disabled. There's
 no chance of any race condition happening, even
 on SMP machines. It's safe to remove that
 spinlock.
 
 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com

--
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: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-09 Thread Alan Stern
On Mon, 9 Dec 2013, Vikas Sajjan wrote:

 Does warm reset while activating SuperSpeed HUBs if the hub activate type
 is HUB_RESET_RESUME.
 
 When we do Suspend-to-RAM with (any one of the 16, 32, 64 Jetflash) transcend
 USB 3.0 device connected on 3.0 port, during resume I noticed that the
 XHCI controller has moved to sometimes RECOVERY, POLLING or INACTIVE STATE.
 This behaviour is inconsistent and the connection with connected USB 3.0 
 device
 on 3.0 port was LOST.
 
 Doing warm reset while activating SuperSpeed HUBs if the hub
 activate type is HUB_RESET_RESUME, gets the connected device to the stable 
 state.
 
 Reviewed at https://chromium-review.googlesource.com/#/c/177132/
 
 Tested on exynos5420 and exynos5250 with Transcend Jetflash USB 3.0 device 
 (8564:1000)
 
 rebased on Greg Kroah-Hartman's usb-next
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
 
 Signed-off-by: Vikas Sajjan vikas.saj...@samsung.com
 ---
  drivers/usb/core/hub.c |   41 +
  1 file changed, 25 insertions(+), 16 deletions(-)
 
 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
 index a7c04e2..d8432b0 100644
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c

 @@ -1093,6 +1108,16 @@ static void hub_activate(struct usb_hub *hub, enum 
 hub_activation_type type)
   u16 portstatus, portchange;
  
   portstatus = portchange = 0;
 +
 + /* Some connected devices might be still in unknown state even
 +  * after reset-resume, a WARM_RESET gets the connected device
 +  * to the normal state.
 +  */
 + if (udev  hub_is_superspeed(hub-hdev) 
 + type == HUB_RESET_RESUME)
 + hub_port_reset(hub, port1, NULL,
 + HUB_BH_RESET_TIME, true);

Please don't do this all the time to every attached port.  Do it only 
when it is really needed.

Shouldn't you pass udev as the third argument?  If not, please explain
why not.

Finally, I don't see why you put this in hub_activate().  Isn't it more 
closely connected with the reset-resume procedure for the child device?

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: Problem with Kingston MobileLite G3 SD card reader

2013-12-09 Thread Alan Stern
On Mon, 9 Dec 2013, Thomas Raschbacher wrote:

 Hi.
 
 I recently bought a Kingston MobileLite G3 SD card reader 
 (http://www.kingston.com/en/flash/readers#fcr-mlg3).
 I now have a problem where it recognises the microSDXC card without any 
 problems, but does not recognise the MSPD/SDXC slot at all (on windows I 
 get 2 'drives')
 
 the kingston page even lists linux (from 2.6) as supported but well it 
 doesn'T seem to really work (any more).
 
 Any ideas what the problem could be?
 I can help debug the problem, but I'd need some pointers as to where to 
 start, since it's been a while since i've been doing kernel 
 hacking/debug ;)
 
 Here are some of the kernel messages I get:

..

 On windows it identifies as Generic- USB3.0 CRW-0 USB Device and 
 Generic- USB3.0 CRW-1 USB Device

Please post a usbmon trace showing what happens when you plug in the 
card reader.  See Documentation/usb/usbmon.txt for instructions.

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] net: sk == 0xffffffff fix - not for commit

2013-12-09 Thread Eric Dumazet
On Mon, 2013-12-09 at 12:47 +0100, Andrzej Pietrasiewicz wrote:
 NOT FOR COMMITTING TO MAINLINE.
 
 With g_ether loaded the sk occasionally becomes 0x.
 It happens usually after transferring few hundreds of kilobytes to few
 tens of megabytes. If sk is 0x then dereferencing it causes
 kernel panic.
 
 This is a *workaround*. I don't know enough net code to understand the core
 of the problem. However, with this patch applied the problems are gone,
 or at least pushed farther away.

Is it happening on SMP or UP ?

Crash should happen earlier in __inet_lookup_established()


--
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: xhci_hcd debugging status, please?

2013-12-09 Thread Udo van den Heuvel
On 2013-12-09 08:53, Oliver Neukum wrote:
 You have XHCI debugging on. This is most likely a side effect
 of teh switch to dynamic debugging in 3.12. But this should be
 discussed on linux-usb.

Thanks, but some of the messages look quite hardcoded.
Is there a patch to get rid of them?


Kind regards,
Udo

--
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: Problem with Kingston MobileLite G3 SD card reader

2013-12-09 Thread Thomas Raschbacher

On 2013-12-09 16:25, Alan Stern wrote:

On Mon, 9 Dec 2013, Thomas Raschbacher wrote:


Hi.

I recently bought a Kingston MobileLite G3 SD card reader
(http://www.kingston.com/en/flash/readers#fcr-mlg3).
I now have a problem where it recognises the microSDXC card without 
any
problems, but does not recognise the MSPD/SDXC slot at all (on windows 
I

get 2 'drives')

the kingston page even lists linux (from 2.6) as supported but well it
doesn'T seem to really work (any more).

Any ideas what the problem could be?
I can help debug the problem, but I'd need some pointers as to where 
to

start, since it's been a while since i've been doing kernel
hacking/debug ;)

Here are some of the kernel messages I get:


..


On windows it identifies as Generic- USB3.0 CRW-0 USB Device and
Generic- USB3.0 CRW-1 USB Device


Please post a usbmon trace showing what happens when you plug in the
card reader.  See Documentation/usb/usbmon.txt for instructions.

Alan Stern


here are the files:
http://www.lordvan.com/Kingston_MobileLiteG3_plugin_usbmon
http://www.lordvan.com/Kingston_MobileLiteG3_unplug_usbmon

Regards
P.S.: i forgot to mention, that I run kernel 3.12.0
--
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 v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd

2013-12-09 Thread Sergei Shtylyov

Hello.

On 12/09/2013 09:31 AM, Peter Chen wrote:


After clear portsc.phcd, PHY needs 200us stable time for switch
32K clock to AHB clock.



Signed-off-by: Peter Chen peter.c...@freescale.com
---
  drivers/usb/phy/phy-mxs-usb.c |   11 +++
  1 files changed, 11 insertions(+), 0 deletions(-)



diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index e18fdf3..7ae5225 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy *mxs_phy)
return mxs_phy-data == imx6sl_phy_data;
  }

+/*
+ * PHY needs some 32K cycles to switch from 32K clock to
+ * bus (such as AHB/AXI, etc) clock.
+ */
+static void mxs_phy_clock_switch(void)
+{
+   usleep_range(300, 400);
+}
+


   Don't think this is a good name for this function since it doesn't really 
switch anything, just waits. I'd suggest something like 
mxs_phy_clock_switch_delay().


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 2/2] arm: omap: remove *.auto* from device names given in usb_bind_phy

2013-12-09 Thread Tony Lindgren
* Javier Martinez Canillas jav...@dowhile0.org [131209 03:51]:
 Hi Kishon,
 
 On Mon, Dec 9, 2013 at 7:07 AM, Kishon Vijay Abraham I kis...@ti.com wrote:
  Hi,
 
 
  On Saturday 07 December 2013 02:38 AM, Felipe Balbi wrote:
 
  Hi,
 
  On Fri, Dec 06, 2013 at 01:14:38PM +0100, Javier Martinez Canillas wrote:
 
  On Fri, Dec 6, 2013 at 1:06 PM, Kishon Vijay Abraham I kis...@ti.com
  wrote:
 
  Previously MUSB wrapper (OMAP) device used PLATFORM_DEVID_AUTO while
  creating
  MUSB core device. So in usb_bind_phy (binds the controller with the
  PHY), the
  device name of the controller had *.auto* in it. Since with using
  PLATFORM_DEVID_AUTO, there is no way to know the exact device name in
  advance,
  the data given in usb_bind_phy became obsolete and usb_get_phy was
  failing.
  So MUSB wrapper was modified not to use PLATFORM_DEVID_AUTO.
  Corresponding
  change is done in board file here.
 
  Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
  ---
arch/arm/mach-omap2/board-2430sdp.c|2 +-
arch/arm/mach-omap2/board-3430sdp.c|2 +-
arch/arm/mach-omap2/board-cm-t35.c |2 +-
arch/arm/mach-omap2/board-devkit8000.c |2 +-
arch/arm/mach-omap2/board-ldp.c|2 +-
arch/arm/mach-omap2/board-omap3beagle.c|2 +-
arch/arm/mach-omap2/board-omap3logic.c |2 +-
arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
arch/arm/mach-omap2/board-overo.c  |2 +-
arch/arm/mach-omap2/board-rx51.c   |2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
 
 
  You can drop this patch since boards files are being removed for v3.14
 
 
  if we can drop this patch, the whole series is invalid, since we'll be
  using DT phandles to find PHYs going forward, no ?
 
  yeah. But in one of the other threads, Tony seemed ok to take a patch that
  fixes the same issue in mach-omap2/twl-common.c. So it's better to confirm
  with Tony.
 
 
 Yes, I just read the other thread ([PATCH] omap: twl-common: Fix
 musb-hdrc device name) and I see that these patches are fixing a
 v3.13 regression and are meant for the -rc cycle and not for v3.14.

Sorry guys, I'm a bit lost with these USB regression fixes.
Which regression fix do we need for v3.13-rc series?

If there's an option, I'd rather not touch all the board-*.c files as
those are about to get dropped for v3.14.

Regards,

Tony
--
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: OMAP4+: hwmod data: Don't prevent RESET of USB Host module

2013-12-09 Thread Benoit Cousson

Salut Paul,

On 08/12/2013 17:26, Paul Walmsley wrote:

Hi Benoît,

On Tue, 3 Dec 2013, Roger Quadros wrote:


Without this, the USB devices are sometimes not detected on OMAP4 Panda
with u-boot v2013.10.

Unlike what the comment states, errata i660 does not state that we
can't RESET the USB host module. Instead it states that RESET is the
only way to recover from a deadlock situation.

RESET ensures that the module is in a known good state irrespective
of what bootloader does with the module, so it must be done at boot.

Reported-by: Tomi Valkeinen tomi.valkei...@ti.com
Signed-off-by: Roger Quadros rog...@ti.com


Acked-by: Paul Walmsley p...@pwsan.com

Will you pick this up for the -rc series, or do you want me or Tony to?
Roger writes that this one's pretty important.


I guess, it is better for you to take it. I don't have anything queued 
for -rc.


Acked-by: Benoit Cousson bcous...@baylibre.com

Thanks,
Benoit




- Paul



---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 12 ++--
  arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 13 +++--
  2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 1e5b12c..3318cae9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig 
omap44xx_usb_host_hs_sysc = {
.sysc_offs  = 0x0010,
.syss_offs  = 0x0014,
.sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
-  SYSC_HAS_SOFTRESET),
+  SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS),
.idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
 * hence HWMOD_SWSUP_MSTANDBY
 */

-   /*
-* During system boot; If the hwmod framework resets the module
-* the module will have smart idle settings; which can lead to deadlock
-* (above Errata Id:i660); so, dont reset the module during boot;
-* Use HWMOD_INIT_NO_RESET.
-*/
-
-   .flags  = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
- HWMOD_INIT_NO_RESET,
+   .flags  = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
  };

  /*
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 9e08d69..e297d62 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig 
omap54xx_usb_host_hs_sysc = {
.rev_offs   = 0x,
.sysc_offs  = 0x0010,
.sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-  SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+  SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+  SYSC_HAS_RESET_STATUS),
.idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = {
 * hence HWMOD_SWSUP_MSTANDBY
 */

-   /*
-* During system boot; If the hwmod framework resets the module
-* the module will have smart idle settings; which can lead to deadlock
-* (above Errata Id:i660); so, dont reset the module during boot;
-* Use HWMOD_INIT_NO_RESET.
-*/
-
-   .flags  = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
- HWMOD_INIT_NO_RESET,
+   .flags  = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
.main_clk   = l3init_60m_fclk,
.prcm = {
.omap4 = {
--
1.8.3.2




- Paul




--
Benoît Cousson
BayLibre
Embedded Linux Technology Lab
www.baylibre.com
--
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: Problem with Kingston MobileLite G3 SD card reader

2013-12-09 Thread Alan Stern
On Mon, 9 Dec 2013, Thomas Raschbacher wrote:

 On 2013-12-09 16:25, Alan Stern wrote:
  On Mon, 9 Dec 2013, Thomas Raschbacher wrote:
  
  Hi.
  
  I recently bought a Kingston MobileLite G3 SD card reader
  (http://www.kingston.com/en/flash/readers#fcr-mlg3).
  I now have a problem where it recognises the microSDXC card without 
  any
  problems, but does not recognise the MSPD/SDXC slot at all (on windows 
  I
  get 2 'drives')
  
  the kingston page even lists linux (from 2.6) as supported but well it
  doesn'T seem to really work (any more).
  
  Any ideas what the problem could be?
  I can help debug the problem, but I'd need some pointers as to where 
  to
  start, since it's been a while since i've been doing kernel
  hacking/debug ;)
  
  Here are some of the kernel messages I get:
  
  ..
  
  On windows it identifies as Generic- USB3.0 CRW-0 USB Device and
  Generic- USB3.0 CRW-1 USB Device
  
  Please post a usbmon trace showing what happens when you plug in the
  card reader.  See Documentation/usb/usbmon.txt for instructions.
  
  Alan Stern
 
 here are the files:
 http://www.lordvan.com/Kingston_MobileLiteG3_plugin_usbmon
 http://www.lordvan.com/Kingston_MobileLiteG3_unplug_usbmon
 
 Regards
 P.S.: i forgot to mention, that I run kernel 3.12.0

It looks like the problem is that your kernel was built without the
CONFIG_SCSI_MULTI_LUN option.  If you enable it then everything should
work.

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: core: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-09 Thread Sarah Sharp
On Mon, Dec 09, 2013 at 10:24:52AM -0500, Alan Stern wrote:
 On Mon, 9 Dec 2013, Vikas Sajjan wrote:
 
  Does warm reset while activating SuperSpeed HUBs if the hub activate type
  is HUB_RESET_RESUME.
  
  When we do Suspend-to-RAM with (any one of the 16, 32, 64 Jetflash) 
  transcend
  USB 3.0 device connected on 3.0 port, during resume I noticed that the
  XHCI controller has moved to sometimes RECOVERY, POLLING or INACTIVE STATE.
  This behaviour is inconsistent and the connection with connected USB 3.0 
  device
  on 3.0 port was LOST.

Does the device eventually re-connect on the USB port?  Or is warm reset
necessary to make the device connect?

Does the xHCI register restore complete after resume from S3, or is
power lost?  I'm trying to figure out whether xhci_reset is called
before your issue is triggered.

  Doing warm reset while activating SuperSpeed HUBs if the hub
  activate type is HUB_RESET_RESUME, gets the connected device to the stable 
  state.
  
  Reviewed at https://chromium-review.googlesource.com/#/c/177132/
  
  Tested on exynos5420 and exynos5250 with Transcend Jetflash USB 3.0 device 
  (8564:1000)

Is this issue specific to the particular USB device manufacturer
(Transcend)?  Does the same device lose connection on resume from S3
with other host controller vendors?  Have you seen this issue when the
USB 3.0 device is behind a USB 3.0 hub?

I ask because this sounds like a low-level link training issue that's
specific to the exynos host or USB device.  I would rather track down
which hardware is to blame than generically add a warm reset for all USB
3.0 devices.

  rebased on Greg Kroah-Hartman's usb-next
  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
  
  Signed-off-by: Vikas Sajjan vikas.saj...@samsung.com
  ---
   drivers/usb/core/hub.c |   41 +
   1 file changed, 25 insertions(+), 16 deletions(-)
  
  diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
  index a7c04e2..d8432b0 100644
  --- a/drivers/usb/core/hub.c
  +++ b/drivers/usb/core/hub.c
 
  @@ -1093,6 +1108,16 @@ static void hub_activate(struct usb_hub *hub, enum 
  hub_activation_type type)
  u16 portstatus, portchange;
   
  portstatus = portchange = 0;
  +
  +   /* Some connected devices might be still in unknown state even
  +* after reset-resume, a WARM_RESET gets the connected device
  +* to the normal state.
  +*/
  +   if (udev  hub_is_superspeed(hub-hdev) 
  +   type == HUB_RESET_RESUME)
  +   hub_port_reset(hub, port1, NULL,
  +   HUB_BH_RESET_TIME, true);
 
 Please don't do this all the time to every attached port.  Do it only 
 when it is really needed.

Agreed.  Can we at least limit the warm reset to devices directly
attached to roothubs?  You can also change this code to get the port
status and only do the warm reset if the port link state is
USB_SS_PORT_LS_POLLING, USB_SS_PORT_LS_RX_DETECT, or
USB_SS_PORT_LS_SS_INACTIVE.

 Shouldn't you pass udev as the third argument?  If not, please explain
 why not.
 
 Finally, I don't see why you put this in hub_activate().  Isn't it more 
 closely connected with the reset-resume procedure for the child device?

Sarah Sharp
--
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: wusbcore: fix short transfers

2013-12-09 Thread Thomas Pugliese
If a URB is broken up into multiple transfer segments and a short 
transfer occurs in any segment other than the last, the URB will 
currently get stuck in the driver forever.  This patch adds a check for 
a short transfer and cleans up any pending segments so the URB can 
complete properly.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/wusbcore/wa-xfer.c |  128 +++-
 1 file changed, 74 insertions(+), 54 deletions(-)

diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index a88b8c6..673ad80 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -1993,7 +1993,7 @@ static int wa_xfer_status_to_errno(u8 status)
  * the xfer will complete cleanly.
  */
 static void wa_complete_remaining_xfer_segs(struct wa_xfer *xfer,
-   struct wa_seg *incoming_seg)
+   struct wa_seg *incoming_seg, enum wa_seg_status status)
 {
int index;
struct wa_rpipe *rpipe = xfer-ep-hcpriv;
@@ -2015,7 +2015,7 @@ static void wa_complete_remaining_xfer_segs(struct 
wa_xfer *xfer,
 */
case WA_SEG_DELAYED:
xfer-segs_done++;
-   current_seg-status = incoming_seg-status;
+   current_seg-status = status;
break;
case WA_SEG_ABORTED:
break;
@@ -2028,6 +2028,58 @@ static void wa_complete_remaining_xfer_segs(struct 
wa_xfer *xfer,
}
 }
 
+/* Populate the wa-buf_in_urb based on the current transfer state. */
+static int wa_populate_buf_in_urb(struct wahc *wa, struct wa_xfer *xfer,
+   unsigned int seg_idx, unsigned int bytes_transferred)
+{
+   int result = 0;
+   struct wa_seg *seg = xfer-seg[seg_idx];
+
+   BUG_ON(wa-buf_in_urb-status == -EINPROGRESS);
+   /* this should always be 0 before a resubmit. */
+   wa-buf_in_urb-num_mapped_sgs  = 0;
+
+   if (xfer-is_dma) {
+   wa-buf_in_urb-transfer_dma = xfer-urb-transfer_dma
+   + (seg_idx * xfer-seg_size);
+   wa-buf_in_urb-transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+   wa-buf_in_urb-transfer_buffer = NULL;
+   wa-buf_in_urb-sg = NULL;
+   wa-buf_in_urb-num_sgs = 0;
+   } else {
+   /* do buffer or SG processing. */
+   wa-buf_in_urb-transfer_flags = ~URB_NO_TRANSFER_DMA_MAP;
+
+   if (xfer-urb-transfer_buffer) {
+   wa-buf_in_urb-transfer_buffer =
+   xfer-urb-transfer_buffer
+   + (seg_idx * xfer-seg_size);
+   wa-buf_in_urb-sg = NULL;
+   wa-buf_in_urb-num_sgs = 0;
+   } else {
+   /* allocate an SG list to store seg_size bytes
+   and copy the subset of the xfer-urb-sg
+   that matches the buffer subset we are
+   about to read. */
+   wa-buf_in_urb-sg = wa_xfer_create_subset_sg(
+   xfer-urb-sg,
+   seg_idx * xfer-seg_size,
+   bytes_transferred,
+   (wa-buf_in_urb-num_sgs));
+
+   if (!(wa-buf_in_urb-sg)) {
+   wa-buf_in_urb-num_sgs = 0;
+   result = -ENOMEM;
+   }
+   wa-buf_in_urb-transfer_buffer = NULL;
+   }
+   }
+   wa-buf_in_urb-transfer_buffer_length = bytes_transferred;
+   wa-buf_in_urb-context = seg;
+
+   return result;
+}
+
 /*
  * Process a xfer result completion message
  *
@@ -2041,12 +2093,13 @@ static void wa_xfer_result_chew(struct wahc *wa, struct 
wa_xfer *xfer,
int result;
struct device *dev = wa-usb_iface-dev;
unsigned long flags;
-   u8 seg_idx;
+   unsigned int seg_idx;
struct wa_seg *seg;
struct wa_rpipe *rpipe;
unsigned done = 0;
u8 usb_status;
unsigned rpipe_ready = 0;
+   unsigned bytes_transferred = le32_to_cpu(xfer_result-dwTransferLength);
 
spin_lock_irqsave(xfer-lock, flags);
seg_idx = xfer_result-bTransferSegment  0x7f;
@@ -2079,66 +2132,33 @@ static void wa_xfer_result_chew(struct wahc *wa, struct 
wa_xfer *xfer,
/* FIXME: we ignore warnings, tally them for stats */
if (usb_status  0x40)  /* Warning?... */
usb_status = 0; /* ... pass */
+   /*
+* If the last segment bit is set, complete the remaining segments.
+* When the current segment is completed, either in wa_buf_in_cb for
+* transfers with data or below for no data, the xfer will complete.
+*/
+   if (xfer_result-bTransferSegment  0x80)
+   

[PATCH] gadget: make USB_CONFIGFS_MASS_STORAGE depend on BLOCK

2013-12-09 Thread Randy Dunlap
From: Randy Dunlap rdun...@infradead.org

Make USB_CONFIGFS_MASS_STORAGE depend on BLOCK just like the other
gadget MASS_STORAGE options do.  This fixes the following build errors
that occur when BLOCK is not enabled:

drivers/usb/gadget/storage_common.c: In function 'fsg_lun_open':
drivers/usb/gadget/storage_common.c:241:3: error: implicit declaration of 
function 'bdev_logical_block_size' [-Werror=implicit-function-declaration]
drivers/usb/gadget/storage_common.c:242:3: error: implicit declaration of 
function 'blksize_bits' [-Werror=implicit-function-declaration]

Signed-off-by: Randy Dunlap rdun...@infradead.org
Cc: Andrzej Pietrasiewicz andrze...@samsung.com
Cc: Felipe Balbi ba...@ti.com
---
 drivers/usb/gadget/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- lnx-313-rc3.orig/drivers/usb/gadget/Kconfig
+++ lnx-313-rc3/drivers/usb/gadget/Kconfig
@@ -681,7 +681,7 @@ config USB_CONFIGFS_PHONET
 
 config USB_CONFIGFS_MASS_STORAGE
boolean Mass storage
-   depends on USB_CONFIGFS
+   depends on USB_CONFIGFS  BLOCK
select USB_F_MASS_STORAGE
help
  The Mass Storage Gadget acts as a USB Mass Storage disk drive.
--
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: wusbcore: use USB_CTRL_SET_TIMEOUT and USB_CTRL_GET_TIMEOUT

2013-12-09 Thread Thomas Pugliese
Use USB_CTRL_SET_TIMEOUT and USB_CTRL_GET_TIMEOUT for USB control
messages instead of an arbitrary 1s timeout value.  This is particularly
useful for WUSB since in the worst case RF scanario, a WUSB device can
be unresponsive for up to 4s and still be connected.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/host/hwa-hc.c   |   20 ++--
 drivers/usb/wusbcore/cbaf.c |8 
 drivers/usb/wusbcore/security.c |   22 --
 drivers/usb/wusbcore/wa-hc.h|5 ++---
 drivers/usb/wusbcore/wa-rpipe.c |   10 +-
 5 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index a4ec9e6..8279097 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -86,7 +86,7 @@ static int __hwahc_set_cluster_id(struct hwahc *hwahc, u8 
cluster_id)
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
cluster_id,
wa-usb_iface-cur_altsetting-desc.bInterfaceNumber,
-   NULL, 0, 1000 /* FIXME: arbitrary */);
+   NULL, 0, USB_CTRL_SET_TIMEOUT);
if (result  0)
dev_err(dev, Cannot set WUSB Cluster ID to 0x%02x: %d\n,
cluster_id, result);
@@ -106,7 +106,7 @@ static int __hwahc_op_set_num_dnts(struct wusbhc *wusbhc, 
u8 interval, u8 slots)
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
interval  8 | slots,
wa-usb_iface-cur_altsetting-desc.bInterfaceNumber,
-   NULL, 0, 1000 /* FIXME: arbitrary */);
+   NULL, 0, USB_CTRL_SET_TIMEOUT);
 }
 
 /*
@@ -281,7 +281,7 @@ static void __hwahc_op_wusbhc_stop(struct wusbhc *wusbhc, 
int delay)
  USB_DIR_OUT | USB_TYPE_CLASS | 
USB_RECIP_INTERFACE,
  delay * 1000,
  iface_no,
- NULL, 0, 1000 /* FIXME: arbitrary */);
+ NULL, 0, USB_CTRL_SET_TIMEOUT);
if (ret == 0)
msleep(delay);
 
@@ -310,7 +310,7 @@ static int __hwahc_op_bwa_set(struct wusbhc *wusbhc, s8 
stream_index,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
stream_index,
wa-usb_iface-cur_altsetting-desc.bInterfaceNumber,
-   NULL, 0, 1000 /* FIXME: arbitrary */);
+   NULL, 0, USB_CTRL_SET_TIMEOUT);
if (result  0) {
dev_err(dev, Cannot set WUSB stream index: %d\n, result);
goto out;
@@ -321,7 +321,7 @@ static int __hwahc_op_bwa_set(struct wusbhc *wusbhc, s8 
stream_index,
WUSB_REQ_SET_WUSB_MAS,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
0, wa-usb_iface-cur_altsetting-desc.bInterfaceNumber,
-   mas_le, 32, 1000 /* FIXME: arbitrary */);
+   mas_le, 32, USB_CTRL_SET_TIMEOUT);
if (result  0)
dev_err(dev, Cannot set WUSB MAS allocation: %d\n, result);
 out:
@@ -355,7 +355,7 @@ static int __hwahc_op_mmcie_add(struct wusbhc *wusbhc, u8 
interval,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
interval  8 | repeat_cnt,
handle  8 | iface_no,
-   wuie, wuie-bLength, 1000 /* FIXME: arbitrary */);
+   wuie, wuie-bLength, USB_CTRL_SET_TIMEOUT);
 }
 
 /*
@@ -372,7 +372,7 @@ static int __hwahc_op_mmcie_rm(struct wusbhc *wusbhc, u8 
handle)
WUSB_REQ_REMOVE_MMC_IE,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
0, handle  8 | iface_no,
-   NULL, 0, 1000 /* FIXME: arbitrary */);
+   NULL, 0, USB_CTRL_SET_TIMEOUT);
 }
 
 /*
@@ -415,7 +415,7 @@ static int __hwahc_op_dev_info_set(struct wusbhc *wusbhc,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
0, wusb_dev-port_idx  8 | iface_no,
dev_info, sizeof(struct hwa_dev_info),
-   1000 /* FIXME: arbitrary */);
+   USB_CTRL_SET_TIMEOUT);
kfree(dev_info);
return ret;
 }
@@ -455,7 +455,7 @@ static int __hwahc_dev_set_key(struct wusbhc *wusbhc, u8 
port_idx, u32 tkid,
USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
USB_DT_KEY  8 | key_idx,
port_idx  8 | iface_no,
-   keyd, keyd_len, 1000 /* FIXME: arbitrary */);
+   keyd, keyd_len, USB_CTRL_SET_TIMEOUT);
 
kzfree(keyd); /* clear keys etc. */
return result;
@@ -497,7 +497,7 @@ static int 

Re: [PATCH] gadget: make USB_CONFIGFS_MASS_STORAGE depend on BLOCK

2013-12-09 Thread Felipe Balbi
On Mon, Dec 09, 2013 at 11:18:25AM -0800, Randy Dunlap wrote:
 From: Randy Dunlap rdun...@infradead.org
 
 Make USB_CONFIGFS_MASS_STORAGE depend on BLOCK just like the other
 gadget MASS_STORAGE options do.  This fixes the following build errors
 that occur when BLOCK is not enabled:
 
 drivers/usb/gadget/storage_common.c: In function 'fsg_lun_open':
 drivers/usb/gadget/storage_common.c:241:3: error: implicit declaration of 
 function 'bdev_logical_block_size' [-Werror=implicit-function-declaration]
 drivers/usb/gadget/storage_common.c:242:3: error: implicit declaration of 
 function 'blksize_bits' [-Werror=implicit-function-declaration]
 
 Signed-off-by: Randy Dunlap rdun...@infradead.org
 Cc: Andrzej Pietrasiewicz andrze...@samsung.com
 Cc: Felipe Balbi ba...@ti.com

Already have a patch for that

commit bc912b0d237c1d376214616ae0c9d12b7d542ab4
Author: Andrzej Pietrasiewicz andrze...@samsung.com
Date:   Mon Nov 4 13:46:17 2013 +0100

usb: gadget: f_mass_storage: fix mass storage dependency

Legacy gadgets supporting mass storage (g_mass_storage, g_acm_ms, g_multi)
all depend on BLOCK.

Make the standalone compilation of f_mass_storage (without any legacy
gadget) dependent no BLOCK, too.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Felipe Balbi ba...@ti.com

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index a91e642..f66d96a 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET
 config USB_CONFIGFS_MASS_STORAGE
boolean Mass storage
depends on USB_CONFIGFS
+   depends on BLOCK
select USB_F_MASS_STORAGE
help
  The Mass Storage Gadget acts as a USB Mass Storage disk drive.

-- 
balbi


signature.asc
Description: Digital signature


[GIT PULL] USB fixes for v3.13-rc4

2013-12-09 Thread Felipe Balbi
Hi Greg,

Here's another set of really obvious fixes for this rc cycle. All patches have
been pending for a while.

Please consider merging on top of your usb-linus branch.

cheers

The following changes since commit 2cf93bea3d7b2dbf1e0ebfa9d381aad1b637e2aa:

  usb: gadget: f_mass_storage: call try_to_freeze only when its safe 
(2013-11-25 11:34:09 -0600)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
tags/fixes-for-v3.13-rc4

for you to fetch changes up to 851dd02b4f1fdb437586190f87217e3382a736bd:

  usb: phy-tegra-usb.c: wrong pointer check for remap UTMI (2013-12-06 14:32:15 
-0600)


usb: fixes for v3.13-rc4

DWC3 learned that it can't resume a PHY which wasn't
initialized and it also learned to not leave PHY powered
up in case of an error.

twl6030-usb PHY driver got a fix for a signedness bug in
twl6030_readb().

Tegra PHY driver got a bug fix where it could return success
even though there was an error.

Signed-of-by: Felipe Balbi ba...@ti.com


Chris Ruehl (1):
  usb: phy-tegra-usb.c: wrong pointer check for remap UTMI

Dan Carpenter (1):
  usb: phy: twl6030-usb: signedness bug in twl6030_readb()

Kishon Vijay Abraham I (2):
  usb: dwc3: invoke phy_resume after phy_init
  usb: dwc3: power off usb phy in error path

 drivers/usb/dwc3/core.c   | 8 +---
 drivers/usb/phy/phy-tegra-usb.c   | 2 +-
 drivers/usb/phy/phy-twl6030-usb.c | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)
--
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] gadget: make USB_CONFIGFS_MASS_STORAGE depend on BLOCK

2013-12-09 Thread Randy Dunlap
On 12/09/13 11:21, Felipe Balbi wrote:
 On Mon, Dec 09, 2013 at 11:18:25AM -0800, Randy Dunlap wrote:
 From: Randy Dunlap rdun...@infradead.org

 Make USB_CONFIGFS_MASS_STORAGE depend on BLOCK just like the other
 gadget MASS_STORAGE options do.  This fixes the following build errors
 that occur when BLOCK is not enabled:

 drivers/usb/gadget/storage_common.c: In function 'fsg_lun_open':
 drivers/usb/gadget/storage_common.c:241:3: error: implicit declaration of 
 function 'bdev_logical_block_size' [-Werror=implicit-function-declaration]
 drivers/usb/gadget/storage_common.c:242:3: error: implicit declaration of 
 function 'blksize_bits' [-Werror=implicit-function-declaration]

 Signed-off-by: Randy Dunlap rdun...@infradead.org
 Cc: Andrzej Pietrasiewicz andrze...@samsung.com
 Cc: Felipe Balbi ba...@ti.com
 
 Already have a patch for that

Thanks.

It wouldn't hurt to fix mainline so that it builds without this error, eh?


 commit bc912b0d237c1d376214616ae0c9d12b7d542ab4
 Author: Andrzej Pietrasiewicz andrze...@samsung.com
 Date:   Mon Nov 4 13:46:17 2013 +0100
 
 usb: gadget: f_mass_storage: fix mass storage dependency
 
 Legacy gadgets supporting mass storage (g_mass_storage, g_acm_ms, g_multi)
 all depend on BLOCK.
 
 Make the standalone compilation of f_mass_storage (without any legacy
 gadget) dependent no BLOCK, too.
 
 Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 Signed-off-by: Felipe Balbi ba...@ti.com
 
 diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
 index a91e642..f66d96a 100644
 --- a/drivers/usb/gadget/Kconfig
 +++ b/drivers/usb/gadget/Kconfig
 @@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET
  config USB_CONFIGFS_MASS_STORAGE
   boolean Mass storage
   depends on USB_CONFIGFS
 + depends on BLOCK
   select USB_F_MASS_STORAGE
   help
 The Mass Storage Gadget acts as a USB Mass Storage disk drive.
 


-- 
~Randy
--
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] gadget: make USB_CONFIGFS_MASS_STORAGE depend on BLOCK

2013-12-09 Thread Felipe Balbi
On Mon, Dec 09, 2013 at 11:27:31AM -0800, Randy Dunlap wrote:
 On 12/09/13 11:21, Felipe Balbi wrote:
  On Mon, Dec 09, 2013 at 11:18:25AM -0800, Randy Dunlap wrote:
  From: Randy Dunlap rdun...@infradead.org
 
  Make USB_CONFIGFS_MASS_STORAGE depend on BLOCK just like the other
  gadget MASS_STORAGE options do.  This fixes the following build errors
  that occur when BLOCK is not enabled:
 
  drivers/usb/gadget/storage_common.c: In function 'fsg_lun_open':
  drivers/usb/gadget/storage_common.c:241:3: error: implicit declaration of 
  function 'bdev_logical_block_size' [-Werror=implicit-function-declaration]
  drivers/usb/gadget/storage_common.c:242:3: error: implicit declaration of 
  function 'blksize_bits' [-Werror=implicit-function-declaration]
 
  Signed-off-by: Randy Dunlap rdun...@infradead.org
  Cc: Andrzej Pietrasiewicz andrze...@samsung.com
  Cc: Felipe Balbi ba...@ti.com
  
  Already have a patch for that
 
 Thanks.
 
 It wouldn't hurt to fix mainline so that it builds without this error, eh?

I'm not the one who merges patches in Linus' tree, that's only up to
Linus eh ?

That patch is already in Greg's branch and he has already sent a pull
request to Linus.

If you're concerned it takes too long to fix build errors, you can ping
Linus to see if he'll merge Greg's pull request sooner. There's nothing
I can do.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] usb: phy: R-Car Gen2: Use usb_phy_add_dev

2013-12-09 Thread Valentine

On 12/09/2013 04:35 PM, Valentine Barshak wrote:

Use add_phy_dev instead of usb_phy_add, so that devices can
be bound to the phy. This is needed to set up USB phy for
some internal PCI USB host controllers on R-Car Gen2.

Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com
---
  drivers/usb/phy/phy-rcar-gen2-usb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c 
b/drivers/usb/phy/phy-rcar-gen2-usb.c
index db3ab34..551e0a6 100644
--- a/drivers/usb/phy/phy-rcar-gen2-usb.c
+++ b/drivers/usb/phy/phy-rcar-gen2-usb.c
@@ -213,7 +213,7 @@ static int rcar_gen2_usb_phy_probe(struct platform_device 
*pdev)
priv-phy.shutdown = rcar_gen2_usb_phy_shutdown;
priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend;

-   retval = usb_add_phy(priv-phy, USB_PHY_TYPE_USB2);
+   retval = usb_add_phy_dev(priv-phy);
if (retval  0) {
dev_err(dev, Failed to add USB phy\n);
return retval;



Please, disregard this one as it uses slightly incorrect function names in the 
commit log.
I'll update the log message and submit V2 in a bit.
Sorry for the noise.

Thanks,
Val.
--
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: core: get config and string descriptors for unauthorized devices

2013-12-09 Thread Thomas Pugliese
There is no need to skip querying the config and string descriptors for 
unauthorized WUSB devices when usb_new_device is called.  It is allowed 
by WUSB spec.  The only action that needs to be delayed until 
authorization time is the set config.  This change allows user mode 
tools to see the config and string descriptors earlier in enumeration 
which is needed for some WUSB devices to function properly on Android 
systems.  It also reduces the amount of divergent code paths needed 
for WUSB devices.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/core/config.c |7 ---
 drivers/usb/core/hub.c|   39 +++
 2 files changed, 7 insertions(+), 39 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index a6b2cab..548d199 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -651,10 +651,6 @@ void usb_destroy_configuration(struct usb_device *dev)
  *
  * hub-only!! ... and only in reset path, or usb_new_device()
  * (used by real hubs and virtual root hubs)
- *
- * NOTE: if this is a WUSB device and is not authorized, we skip the
- *   whole thing. A non-authorized USB device has no
- *   configurations.
  */
 int usb_get_configuration(struct usb_device *dev)
 {
@@ -666,8 +662,6 @@ int usb_get_configuration(struct usb_device *dev)
struct usb_config_descriptor *desc;
 
cfgno = 0;
-   if (dev-authorized == 0)   /* Not really an error */
-   goto out_not_authorized;
result = -ENOMEM;
if (ncfg  USB_MAXCONFIG) {
dev_warn(ddev, too many configurations: %d, 
@@ -751,7 +745,6 @@ int usb_get_configuration(struct usb_device *dev)
 
 err:
kfree(desc);
-out_not_authorized:
dev-descriptor.bNumConfigurations = cfgno;
 err2:
if (result == -ENOMEM)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a7c04e2..32e1035 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2235,17 +2235,13 @@ static int usb_enumerate_device(struct usb_device *udev)
return err;
}
}
-   if (udev-wusb == 1  udev-authorized == 0) {
-   udev-product = kstrdup(n/a (unauthorized), GFP_KERNEL);
-   udev-manufacturer = kstrdup(n/a (unauthorized), GFP_KERNEL);
-   udev-serial = kstrdup(n/a (unauthorized), GFP_KERNEL);
-   } else {
-   /* read the standard strings and cache them if present */
-   udev-product = usb_cache_string(udev, 
udev-descriptor.iProduct);
-   udev-manufacturer = usb_cache_string(udev,
- 
udev-descriptor.iManufacturer);
-   udev-serial = usb_cache_string(udev, 
udev-descriptor.iSerialNumber);
-   }
+
+   /* read the standard strings and cache them if present */
+   udev-product = usb_cache_string(udev, udev-descriptor.iProduct);
+   udev-manufacturer = usb_cache_string(udev,
+ udev-descriptor.iManufacturer);
+   udev-serial = usb_cache_string(udev, udev-descriptor.iSerialNumber);
+
err = usb_enumerate_device_otg(udev);
if (err  0)
return err;
@@ -2427,16 +2423,6 @@ int usb_deauthorize_device(struct usb_device *usb_dev)
usb_dev-authorized = 0;
usb_set_configuration(usb_dev, -1);
 
-   kfree(usb_dev-product);
-   usb_dev-product = kstrdup(n/a (unauthorized), GFP_KERNEL);
-   kfree(usb_dev-manufacturer);
-   usb_dev-manufacturer = kstrdup(n/a (unauthorized), GFP_KERNEL);
-   kfree(usb_dev-serial);
-   usb_dev-serial = kstrdup(n/a (unauthorized), GFP_KERNEL);
-
-   usb_destroy_configuration(usb_dev);
-   usb_dev-descriptor.bNumConfigurations = 0;
-
 out_unauthorized:
usb_unlock_device(usb_dev);
return 0;
@@ -2464,17 +2450,7 @@ int usb_authorize_device(struct usb_device *usb_dev)
goto error_device_descriptor;
}
 
-   kfree(usb_dev-product);
-   usb_dev-product = NULL;
-   kfree(usb_dev-manufacturer);
-   usb_dev-manufacturer = NULL;
-   kfree(usb_dev-serial);
-   usb_dev-serial = NULL;
-
usb_dev-authorized = 1;
-   result = usb_enumerate_device(usb_dev);
-   if (result  0)
-   goto error_enumerate;
/* Choose and set the configuration.  This registers the interfaces
 * with the driver core and lets interface drivers bind to them.
 */
@@ -2490,7 +2466,6 @@ int usb_authorize_device(struct usb_device *usb_dev)
}
dev_info(usb_dev-dev, authorized to connect\n);
 
-error_enumerate:
 error_device_descriptor:
usb_autosuspend_device(usb_dev);
 error_autoresume:
-- 
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  

Re: [PATCH V2] usb: phy: R-Car Gen2: Use usb_add_phy_dev

2013-12-09 Thread Felipe Balbi
Hi,

On Mon, Dec 09, 2013 at 11:40:33PM +0400, Valentine Barshak wrote:
 Use usb_add_phy_dev instead of usb_add_phy, so that devices can
 be bound to the phy. This is needed to set up USB phy for
 some internal PCI USB host controllers on R-Car Gen2.
 
 Changes from previous version:
 * Fixed function names in the commit log
 
 Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com

Was this a regression on v3.13 or can it wait for v3.14 ?

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] usb: core: allow isoc URBs for wireless devices with an interval 6

2013-12-09 Thread Thomas Pugliese
In usb_submit_urb, do not fail if an isoc URB for a wireless USB device
has an interval  6.  Per WUSB spec, isoc endpoints can support values
from 1-16.  Valid values for interrupt URBs for wireless USB devices are
still 6-16.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/core/urb.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index e622083..07c58af 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -492,9 +492,9 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
/* too small? */
switch (dev-speed) {
case USB_SPEED_WIRELESS:
-   if (urb-interval  6)
+   if ((urb-interval  6)
+(xfertype == USB_ENDPOINT_XFER_INT))
return -EINVAL;
-   break;
default:
if (urb-interval = 0)
return -EINVAL;
-- 
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


[PATCH V2] usb: phy: R-Car Gen2: Use usb_add_phy_dev

2013-12-09 Thread Valentine Barshak
Use usb_add_phy_dev instead of usb_add_phy, so that devices can
be bound to the phy. This is needed to set up USB phy for
some internal PCI USB host controllers on R-Car Gen2.

Changes from previous version:
* Fixed function names in the commit log

Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com
---
 drivers/usb/phy/phy-rcar-gen2-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c 
b/drivers/usb/phy/phy-rcar-gen2-usb.c
index db3ab34..551e0a6 100644
--- a/drivers/usb/phy/phy-rcar-gen2-usb.c
+++ b/drivers/usb/phy/phy-rcar-gen2-usb.c
@@ -213,7 +213,7 @@ static int rcar_gen2_usb_phy_probe(struct platform_device 
*pdev)
priv-phy.shutdown = rcar_gen2_usb_phy_shutdown;
priv-phy.set_suspend = rcar_gen2_usb_phy_set_suspend;
 
-   retval = usb_add_phy(priv-phy, USB_PHY_TYPE_USB2);
+   retval = usb_add_phy_dev(priv-phy);
if (retval  0) {
dev_err(dev, Failed to add USB phy\n);
return retval;
-- 
1.8.3.1

--
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 2/2] usb: wusbcore: set packet count correctly on isoc transfers

2013-12-09 Thread Thomas Pugliese
This patch correctly sets the dwNumOfPackets field of the HWA transfer
request for isochronous transfers with multiple segments.  Previously
all segments used the value that was set for the first segment which may
not be correct.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/wusbcore/wa-xfer.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 6aeb52c..a70e142 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -1259,8 +1259,11 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct 
urb *urb)
for (cnt = 1; cnt  xfer-segs; cnt++) {
struct wa_xfer_packet_info_hwaiso *packet_desc;
struct wa_seg *seg = xfer-seg[cnt];
+   struct wa_xfer_hwaiso *xfer_iso;
 
xfer_hdr = seg-xfer_hdr;
+   xfer_iso = container_of(xfer_hdr,
+   struct wa_xfer_hwaiso, hdr);
packet_desc = ((void *)xfer_hdr) + xfer_hdr_size;
/*
 * Copy values from the 0th header. Segment specific
@@ -1270,6 +1273,8 @@ static int __wa_xfer_setup(struct wa_xfer *xfer, struct 
urb *urb)
xfer_hdr-bTransferSegment = cnt;
xfer_hdr-dwTransferLength =
cpu_to_le32(seg-isoc_size);
+   xfer_iso-dwNumOfPackets =
+   cpu_to_le32(seg-isoc_frame_count);
__wa_setup_isoc_packet_descr(packet_desc, xfer, seg);
seg-status = WA_SEG_READY;
}
-- 
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


[PATCH 1/2] usb: wusbcore: move isoc_frame_index from wa_xfer to wa_seg

2013-12-09 Thread Thomas Pugliese
If multiple segments belonging to an isoc transfer are submitted
concurrently, the isoc_frame_index field in struct wa_xfer can get
corrupted.  This patch moves the isoc_frame_index field from struct
wa_xfer to struct wa_seg to prevent this from happening.

Signed-off-by: Thomas Pugliese thomas.pugli...@gmail.com
---
 drivers/usb/wusbcore/wa-xfer.c |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 673ad80..6aeb52c 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -124,6 +124,8 @@ struct wa_seg {
u8 index;   /* which segment we are */
int isoc_frame_count;   /* number of isoc frames in this segment. */
int isoc_frame_offset;  /* starting frame offset in the xfer URB. */
+   /* Isoc frame that the current transfer buffer corresponds to. */
+   int isoc_frame_index;
int isoc_size;  /* size of all isoc frames sent by this seg. */
enum wa_seg_status status;
ssize_t result; /* bytes xfered or error */
@@ -158,8 +160,6 @@ struct wa_xfer {
unsigned is_dma:1;
size_t seg_size;
int result;
-   /* Isoc frame that the current transfer buffer corresponds to. */
-   int dto_isoc_frame_index;
 
gfp_t gfp;  /* allocation mask */
 
@@ -701,23 +701,23 @@ static void wa_seg_dto_cb(struct urb *urb)
if (usb_pipeisoc(xfer-urb-pipe)) {
/* Alereon HWA sends all isoc frames in a single transfer. */
if (wa-quirks  WUSB_QUIRK_ALEREON_HWA_CONCAT_ISOC)
-   xfer-dto_isoc_frame_index += seg-isoc_frame_count;
+   seg-isoc_frame_index += seg-isoc_frame_count;
else
-   xfer-dto_isoc_frame_index += 1;
-   if (xfer-dto_isoc_frame_index  seg-isoc_frame_count) {
+   seg-isoc_frame_index += 1;
+   if (seg-isoc_frame_index  seg-isoc_frame_count) {
data_send_done = 0;
holding_dto = 1; /* checked in error cases. */
/*
 * if this is the last isoc frame of the segment, we
 * can release DTO after sending this frame.
 */
-   if ((xfer-dto_isoc_frame_index + 1) =
+   if ((seg-isoc_frame_index + 1) =
seg-isoc_frame_count)
release_dto = 1;
}
dev_dbg(dev, xfer 0x%08X#%u: isoc frame = %d, holding_dto = 
%d, release_dto = %d.\n,
-   wa_xfer_id(xfer), seg-index,
-   xfer-dto_isoc_frame_index, holding_dto, release_dto);
+   wa_xfer_id(xfer), seg-index, seg-isoc_frame_index,
+   holding_dto, release_dto);
}
spin_unlock_irqrestore(xfer-lock, flags);
 
@@ -737,8 +737,7 @@ static void wa_seg_dto_cb(struct urb *urb)
 * send the URB and release DTO if we no longer need it.
 */
 __wa_populate_dto_urb_isoc(xfer, seg,
-   seg-isoc_frame_offset +
-   xfer-dto_isoc_frame_index);
+   seg-isoc_frame_offset + seg-isoc_frame_index);
 
/* resubmit the URB with the next isoc frame. */
result = usb_submit_urb(seg-dto_urb, GFP_ATOMIC);
@@ -1324,12 +1323,12 @@ static int __wa_seg_submit(struct wa_rpipe *rpipe, 
struct wa_xfer *xfer,
struct wahc *wa = xfer-wa;
 
result = usb_submit_urb(seg-isoc_pack_desc_urb, GFP_ATOMIC);
+   seg-isoc_frame_index = 0;
if (result  0) {
pr_err(%s: xfer %p#%u: ISO packet descriptor submit 
failed: %d\n,
   __func__, xfer, seg-index, result);
goto error_iso_pack_desc_submit;
}
-   xfer-dto_isoc_frame_index = 0;
/*
 * If this segment contains more than one isoc frame, hold
 * onto the dto resource until we send all frames.
-- 
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


[PATCH 0/2] usb: wusbcore isoc transfer fixes

2013-12-09 Thread Thomas Pugliese
This set includes two fixes for problems that can occur when isochronous 
transfers are split into multiple transfer segments.

Thomas Pugliese (2):
  usb: wusbcore: move isoc_frame_index from wa_xfer to wa_seg
  usb: wusbcore: set packet count correctly on multi-segment isoc
transfers

 drivers/usb/wusbcore/wa-xfer.c |   26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

-- 
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] usb: phy: R-Car Gen2: Use usb_add_phy_dev

2013-12-09 Thread Valentine

On 12/09/2013 11:41 PM, Felipe Balbi wrote:

Hi,

On Mon, Dec 09, 2013 at 11:40:33PM +0400, Valentine Barshak wrote:

Use usb_add_phy_dev instead of usb_add_phy, so that devices can
be bound to the phy. This is needed to set up USB phy for
some internal PCI USB host controllers on R-Car Gen2.

Changes from previous version:
* Fixed function names in the commit log

Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com


Was this a regression on v3.13 or can it wait for v3.14 ?



I hope it's OK to have it on 3.13.

The major reason for the change is to use the USB HCD phy handling
updates that are available now in the usb-next branch of Greg's tree:
commit 1ae5799ef6: usb: hcd: Initialize USB phy if needed

Thanks,
Val.
--
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


Scanner works on EHCI port, fails on XHCI Port

2013-12-09 Thread Matthias Bläsing
Hello,

I hope this is the right place to ask. I own a Canon CanoScan LiDE 25.
The scanner worked well the last few years and with my new notebook it
only works in one port. From the tree it seems to be tied to the
controller:

This works:

matthias@athena:~$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/3p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 5, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 3, Class=Human Interface Device, 
Driver=usbhid, 12M
|__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 
1.5M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 8: Dev 3, If 0, Class=Hub, Driver=hub/3p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 2: Dev 12, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 3, If 0, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 4: Dev 3, If 1, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 4: Dev 3, If 2, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 3, If 3, Class=Application Specific Interface, Driver=, 
12M
|__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
matthias@athena:~$ 


While this fails:

matthias@athena:~$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/3p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 2: Dev 16, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 5, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 3: Dev 5, If 3, Class=Human Interface Device, 
Driver=usbhid, 12M
|__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 
1.5M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 8: Dev 3, If 0, Class=Hub, Driver=hub/3p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 4: Dev 3, If 0, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 4: Dev 3, If 1, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 4: Dev 3, If 2, Class=Vendor Specific Class, Driver=, 12M
|__ Port 4: Dev 3, If 3, Class=Application Specific Interface, Driver=, 
12M
|__ Port 5: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
matthias@athena:~$ 

Attached to this email you find a usbmon trace of both cases (different
devices, as I got the trees after I made the traces).

Basic intention: I want to be able to use the scanner on the port tied
to the xhci, as I can on the EHCI one.

If I can provide more information or if there is a more appropriate
place to ask, please say so.

Thank you in advance

Matthias 
88020d55cc00 4057213234 C Ii:3:001:1 0:2048 1 = 04
88020d55cc00 4057213263 S Ii:3:001:1 -115:2048 4 
88020a9f7180 4057213307 S Ci:3:001:0 s a3 00  0002 0004 4 
88020a9f7180 4057213318 C Ci:3:001:0 0 4 = 01010100
88020a9f7180 4057213322 S Co:3:001:0 s 23 01 0010 0002  0
88020a9f7180 4057213325 C Co:3:001:0 0 0
88020a9f7180 4057213327 S Ci:3:001:0 s a3 00  0002 0004 4 
88020a9f7180 4057213329 C Ci:3:001:0 0 4 = 0101
88020d307780 4057243802 S Ci:3:001:0 s a3 00  0002 0004 4 
88020d307780 4057243830 C Ci:3:001:0 0 4 = 0101
88020a9f7180 4057275809 S Ci:3:001:0 s a3 00  0002 0004 4 
88020a9f7180 4057275829 C Ci:3:001:0 0 4 = 0101
88020f470b40 4057307784 S Ci:3:001:0 s a3 00  0002 0004 4 
88020f470b40 4057307821 C Ci:3:001:0 0 4 = 0101
88020d307780 4057339809 S Ci:3:001:0 s a3 00  0002 0004 4 
88020d307780 4057339829 C Ci:3:001:0 0 4 = 0101
88020d307780 4057339903 S Co:3:001:0 s 23 03 0004 0002  0
88020d307780 4057339910 C Co:3:001:0 0 0
88020a9f7900 4057395785 S Ci:3:001:0 s a3 00  0002 0004 4 

Re: [PATCH V2] usb: phy: R-Car Gen2: Use usb_add_phy_dev

2013-12-09 Thread Greg Kroah-Hartman
On Tue, Dec 10, 2013 at 12:16:13AM +0400, Valentine wrote:
 On 12/09/2013 11:41 PM, Felipe Balbi wrote:
  Hi,
 
  On Mon, Dec 09, 2013 at 11:40:33PM +0400, Valentine Barshak wrote:
  Use usb_add_phy_dev instead of usb_add_phy, so that devices can
  be bound to the phy. This is needed to set up USB phy for
  some internal PCI USB host controllers on R-Car Gen2.
 
  Changes from previous version:
  * Fixed function names in the commit log
 
  Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com
 
  Was this a regression on v3.13 or can it wait for v3.14 ?
 
 
 I hope it's OK to have it on 3.13.
 
 The major reason for the change is to use the USB HCD phy handling
 updates that are available now in the usb-next branch of Greg's tree:
 commit 1ae5799ef6: usb: hcd: Initialize USB phy if needed

But that patch isn't going to Linus until 3.14, so this has to wait
until then as well.

sorry,

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


Re: [PATCH V2] usb: phy: R-Car Gen2: Use usb_add_phy_dev

2013-12-09 Thread Felipe Balbi
On Mon, Dec 09, 2013 at 12:32:37PM -0800, Greg Kroah-Hartman wrote:
 On Tue, Dec 10, 2013 at 12:16:13AM +0400, Valentine wrote:
  On 12/09/2013 11:41 PM, Felipe Balbi wrote:
   Hi,
  
   On Mon, Dec 09, 2013 at 11:40:33PM +0400, Valentine Barshak wrote:
   Use usb_add_phy_dev instead of usb_add_phy, so that devices can
   be bound to the phy. This is needed to set up USB phy for
   some internal PCI USB host controllers on R-Car Gen2.
  
   Changes from previous version:
   * Fixed function names in the commit log
  
   Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com
  
   Was this a regression on v3.13 or can it wait for v3.14 ?
  
  
  I hope it's OK to have it on 3.13.
  
  The major reason for the change is to use the USB HCD phy handling
  updates that are available now in the usb-next branch of Greg's tree:
  commit 1ae5799ef6: usb: hcd: Initialize USB phy if needed
 
 But that patch isn't going to Linus until 3.14, so this has to wait
 until then as well.

3.14 it is, thanks

-- 
balbi


signature.asc
Description: Digital signature


Re: [GIT PULL] USB fixes for v3.13-rc4

2013-12-09 Thread Greg KH
On Mon, Dec 09, 2013 at 01:26:50PM -0600, Felipe Balbi wrote:
 Hi Greg,
 
 Here's another set of really obvious fixes for this rc cycle. All patches have
 been pending for a while.
 
 Please consider merging on top of your usb-linus branch.
 
 cheers
 
 The following changes since commit 2cf93bea3d7b2dbf1e0ebfa9d381aad1b637e2aa:
 
   usb: gadget: f_mass_storage: call try_to_freeze only when its safe 
 (2013-11-25 11:34:09 -0600)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
 tags/fixes-for-v3.13-rc4

Pulled and pushed out now, 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


[PATCH] usb: fix build error when USB=m USB_OTG=y

2013-12-09 Thread Felipe Balbi
when any driver using usb_bus_start_enum() is
enabled in a build with CONFIG_USB=m, we will
have a build error because of usb_bus_start_enum()
will be compiled into a module (usbcore) and
the driver (phy-fsm-usb.c or phy-isp1301-omap.c)
will be statically linked to the kernel.

The easiest fix in this situation is to move the
definition of usb_bus_start_enum() to usb-common.c
(since it can be used by both host or gadget roles),
and make that a boolean config option, instead of
tristate.

This is another example where usage of 'select'
creates problems.

Cc: sta...@vger.kernel.org
Stephen Rothwell s...@canb.auug.org.au
Signed-off-by: Felipe Balbi ba...@ti.com
---

I was originally against hiding CONFIG_USB_OTG (and
CONFIG_USB_PHY for that matter) for this specific reason.

When people rely on select to enable things they want,
there's a rather high probability of some dependencies
getting messed up and linux-next having build problems.

Greg, let me know if this patch is acceptable for you -rc
cycle, note that it fixes a build error with allmodconfig,
possibly in any arch.

 drivers/usb/Kconfig  |  2 +-
 drivers/usb/core/hcd.c   | 41 -
 drivers/usb/usb-common.c | 44 
 3 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 2642b8a..42d9970b 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -40,7 +40,7 @@ menuconfig USB_SUPPORT
 if USB_SUPPORT
 
 config USB_COMMON
-   tristate
+   bool
default y
depends on USB || USB_GADGET
 
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 6bffb8c..bed909f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2277,47 +2277,6 @@ EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
 
 /*-*/
 
-#ifdef CONFIG_USB_OTG
-
-/**
- * usb_bus_start_enum - start immediate enumeration (for OTG)
- * @bus: the bus (must use hcd framework)
- * @port_num: 1-based number of port; usually bus-otg_port
- * Context: in_interrupt()
- *
- * Starts enumeration, with an immediate reset followed later by
- * khubd identifying and possibly configuring the device.
- * This is needed by OTG controller drivers, where it helps meet
- * HNP protocol timing requirements for starting a port reset.
- *
- * Return: 0 if successful.
- */
-int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num)
-{
-   struct usb_hcd  *hcd;
-   int status = -EOPNOTSUPP;
-
-   /* NOTE: since HNP can't start by grabbing the bus's address0_sem,
-* boards with root hubs hooked up to internal devices (instead of
-* just the OTG port) may need more attention to resetting...
-*/
-   hcd = container_of (bus, struct usb_hcd, self);
-   if (port_num  hcd-driver-start_port_reset)
-   status = hcd-driver-start_port_reset(hcd, port_num);
-
-   /* run khubd shortly after (first) root port reset finishes;
-* it may issue others, until at least 50 msecs have passed.
-*/
-   if (status == 0)
-   mod_timer(hcd-rh_timer, jiffies + msecs_to_jiffies(10));
-   return status;
-}
-EXPORT_SYMBOL_GPL(usb_bus_start_enum);
-
-#endif
-
-/*-*/
-
 /**
  * usb_hcd_irq - hook IRQs to HCD framework (bus glue)
  * @irq: the IRQ being raised
diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
index d771870..f6f6f57 100644
--- a/drivers/usb/usb-common.c
+++ b/drivers/usb/usb-common.c
@@ -14,6 +14,8 @@
 #include linux/kernel.h
 #include linux/module.h
 #include linux/of.h
+#include linux/usb.h
+#include linux/usb/hcd.h
 #include linux/usb/ch9.h
 #include linux/usb/of.h
 #include linux/usb/otg.h
@@ -141,4 +143,46 @@ EXPORT_SYMBOL_GPL(of_usb_get_maximum_speed);
 
 #endif
 
+#ifdef CONFIG_USB_OTG
+
+/**
+ * usb_bus_start_enum - start immediate enumeration (for OTG)
+ * @bus: the bus (must use hcd framework)
+ * @port_num: 1-based number of port; usually bus-otg_port
+ * Context: in_interrupt()
+ *
+ * Starts enumeration, with an immediate reset followed later by
+ * khubd identifying and possibly configuring the device.
+ * This is needed by OTG controller drivers, where it helps meet
+ * HNP protocol timing requirements for starting a port reset.
+ *
+ * Return: 0 if successful.
+ */
+int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num)
+{
+   struct usb_hcd  *hcd;
+   int status = -EOPNOTSUPP;
+
+   /* NOTE: since HNP can't start by grabbing the bus's address0_sem,
+* boards with root hubs hooked up to internal devices (instead of
+* just the OTG port) may need more attention to resetting...
+*/
+   hcd = container_of (bus, struct usb_hcd, self);
+   if (port_num  hcd-driver-start_port_reset)
+ 

[PATCH v3 2/2] usb: phy: Add keystone usb phy driver

2013-12-09 Thread WingMan Kwok
Add Keystone platform USB PHY driver support. Current main purpose
of this driver is to enable the PHY reference clock gate on the
Keystone SoC. Otherwise it is a nop PHY.

Cc: Santosh Shilimkar santosh.shilim...@ti.com
Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: WingMan Kwok w-kw...@ti.com
---
 drivers/usb/phy/Kconfig|   10 +++
 drivers/usb/phy/Makefile   |1 +
 drivers/usb/phy/phy-keystone.c |  142 
 3 files changed, 153 insertions(+)
 create mode 100644 drivers/usb/phy/phy-keystone.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 08e2f39..c6792f43 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -40,6 +40,16 @@ config ISP1301_OMAP
  This driver can also be built as a module.  If so, the module
  will be called isp1301_omap.
 
+config KEYSTONE_USB_PHY
+   tristate Keystone USB PHY Driver
+   depends on ARCH_KEYSTONE
+   select USB_PHY
+   select NOP_USB_XCEIV
+   help
+ Enable this to support Keystone USB phy. This driver provides
+ interface to interact with USB 2.0 and USB 3.0 PHY that is part
+ of the Keystone SOC.
+
 config MV_U3D_PHY
bool Marvell USB 3.0 PHY controller Driver
depends on CPU_MMP3
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 022c1da..311b47b 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -30,3 +30,4 @@ obj-$(CONFIG_USB_RCAR_PHY)+= phy-rcar-usb.o
 obj-$(CONFIG_USB_RCAR_GEN2_PHY)+= phy-rcar-gen2-usb.o
 obj-$(CONFIG_USB_ULPI) += phy-ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)+= phy-ulpi-viewport.o
+obj-$(CONFIG_KEYSTONE_USB_PHY) += phy-keystone.o
diff --git a/drivers/usb/phy/phy-keystone.c b/drivers/usb/phy/phy-keystone.c
new file mode 100644
index 000..e025eb2
--- /dev/null
+++ b/drivers/usb/phy/phy-keystone.c
@@ -0,0 +1,142 @@
+/*
+ * phy-keystone - USB PHY, talking to dwc3 controller in Keystone.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: WingMan Kwok w-kw...@ti.com
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/usb/usb_phy_gen_xceiv.h
+#include linux/io.h
+#include linux/of.h
+
+#include phy-generic.h
+
+/* USB PHY control register offsets */
+#define USB_PHY_CTL_UTMI   0x
+#define USB_PHY_CTL_PIPE   0x0004
+#define USB_PHY_CTL_PARAM_10x0008
+#define USB_PHY_CTL_PARAM_20x000c
+#define USB_PHY_CTL_CLOCK  0x0010
+#define USB_PHY_CTL_PLL0x0014
+
+#define PHY_REF_SSP_EN BIT(29)
+
+struct keystone_usbphy {
+   struct usb_phy_gen_xceivusb_phy_gen;
+   void __iomem*phy_ctrl;
+};
+
+static inline u32 keystone_usbphy_readl(void __iomem *base, u32 offset)
+{
+   return readl(base + offset);
+}
+
+static inline void keystone_usbphy_writel(void __iomem *base,
+ u32 offset, u32 value)
+{
+   writel(value, base + offset);
+}
+
+static int keystone_usbphy_init(struct usb_phy *phy)
+{
+   struct keystone_usbphy *k_phy = dev_get_drvdata(phy-dev);
+   u32 val;
+
+   val  = keystone_usbphy_readl(k_phy-phy_ctrl, USB_PHY_CTL_CLOCK);
+   keystone_usbphy_writel(k_phy-phy_ctrl, USB_PHY_CTL_CLOCK,
+   val | PHY_REF_SSP_EN);
+   udelay(20);
+   return 0;
+}
+
+static void keystone_usbphy_shutdown(struct usb_phy *phy)
+{
+   struct keystone_usbphy *k_phy = dev_get_drvdata(phy-dev);
+   u32 val;
+
+   val  = keystone_usbphy_readl(k_phy-phy_ctrl, USB_PHY_CTL_CLOCK);
+   keystone_usbphy_writel(k_phy-phy_ctrl, USB_PHY_CTL_CLOCK,
+   val = ~PHY_REF_SSP_EN);
+}
+
+static int keystone_usbphy_probe(struct platform_device *pdev)
+{
+   struct device   *dev = pdev-dev;
+   struct keystone_usbphy  *k_phy;
+   struct resource *res;
+   int ret;
+
+   k_phy = devm_kzalloc(dev, sizeof(*k_phy), GFP_KERNEL);
+   if (!k_phy)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   dev_err(dev, missing usb phy resource\n);
+   return -EINVAL;
+  

[PATCH v3 1/2] usb: dwc3: Add Keystone specific glue layer

2013-12-09 Thread WingMan Kwok
Add Keystone platform specific glue layer to support
USB3 Host mode.

Cc: Santosh Shilimkar santosh.shilim...@ti.com
Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
Signed-off-by: WingMan Kwok w-kw...@ti.com
---
 drivers/usb/dwc3/Kconfig |7 ++
 drivers/usb/dwc3/Makefile|1 +
 drivers/usb/dwc3/dwc3-keystone.c |  205 ++
 3 files changed, 213 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-keystone.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 70fc430..e2c730f 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -70,6 +70,13 @@ config USB_DWC3_PCI
  One such PCIe-based platform is Synopsys' PCIe HAPS model of
  this IP.
 
+config USB_DWC3_KEYSTONE
+   tristate Texas Instruments Keystone2 Platforms
+   default USB_DWC3
+   help
+ Support of USB2/3 functionality in TI Keystone2 platforms.
+ Say 'Y' or 'M' here if you have one such device
+
 comment Debugging features
 
 config USB_DWC3_DEBUG
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index dd17601..10ac3e7 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -32,3 +32,4 @@ endif
 obj-$(CONFIG_USB_DWC3_OMAP)+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_EXYNOS)  += dwc3-exynos.o
 obj-$(CONFIG_USB_DWC3_PCI) += dwc3-pci.o
+obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c
new file mode 100644
index 000..33f71330b
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-keystone.c
@@ -0,0 +1,205 @@
+/**
+ * dwc3-keystone.c - Keystone Specific Glue layer
+ *
+ * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: WingMan Kwok w-kw...@ti.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/interrupt.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+#include linux/io.h
+#include linux/of_platform.h
+
+/* USBSS register offsets */
+#define USBSS_REVISION 0x
+#define USBSS_SYSCONFIG0x0010
+#define USBSS_IRQ_EOI  0x0018
+#define USBSS_IRQSTATUS_RAW_0  0x0020
+#define USBSS_IRQSTATUS_0  0x0024
+#define USBSS_IRQENABLE_SET_0  0x0028
+#define USBSS_IRQENABLE_CLR_0  0x002c
+
+/* IRQ register bits */
+#define USBSS_IRQ_EOI_LINE(n)  BIT(n)
+#define USBSS_IRQ_EVENT_ST BIT(0)
+#define USBSS_IRQ_COREIRQ_EN   BIT(0)
+#define USBSS_IRQ_COREIRQ_CLR  BIT(0)
+
+static u64 kdwc3_dma_mask;
+
+struct dwc3_keystone {
+   struct device   *dev;
+   struct clk  *clk;
+   void __iomem*usbss;
+};
+
+static inline u32 kdwc3_readl(void __iomem *base, u32 offset)
+{
+   return readl(base + offset);
+}
+
+static inline void kdwc3_writel(void __iomem *base, u32 offset, u32 value)
+{
+   writel(value, base + offset);
+}
+
+static void kdwc3_enable_irqs(struct dwc3_keystone *kdwc)
+{
+   u32 val;
+
+   val = kdwc3_readl(kdwc-usbss, USBSS_IRQENABLE_SET_0);
+   val = USBSS_IRQ_COREIRQ_EN;
+   kdwc3_writel(kdwc-usbss, USBSS_IRQENABLE_SET_0, val);
+}
+
+static void kdwc3_disable_irqs(struct dwc3_keystone *kdwc)
+{
+   u32 val;
+
+   val = kdwc3_readl(kdwc-usbss, USBSS_IRQENABLE_SET_0);
+   val = ~USBSS_IRQ_COREIRQ_EN;
+   kdwc3_writel(kdwc-usbss, USBSS_IRQENABLE_SET_0, val);
+}
+
+static irqreturn_t dwc3_keystone_interrupt(int irq, void *_kdwc)
+{
+   struct dwc3_keystone*kdwc = _kdwc;
+
+   kdwc3_writel(kdwc-usbss, USBSS_IRQENABLE_CLR_0, USBSS_IRQ_COREIRQ_CLR);
+   kdwc3_writel(kdwc-usbss, USBSS_IRQSTATUS_0, USBSS_IRQ_EVENT_ST);
+   kdwc3_writel(kdwc-usbss, USBSS_IRQENABLE_SET_0, USBSS_IRQ_COREIRQ_EN);
+   kdwc3_writel(kdwc-usbss, USBSS_IRQ_EOI, USBSS_IRQ_EOI_LINE(0));
+
+   return IRQ_HANDLED;
+}
+
+static int kdwc3_probe(struct platform_device *pdev)
+{
+   struct device   *dev = pdev-dev;
+   struct device_node  *node = pdev-dev.of_node;
+   struct dwc3_keystone*kdwc;
+   struct resource *res;
+   int error, irq;
+
+   kdwc = devm_kzalloc(dev, sizeof(*kdwc), GFP_KERNEL);
+   if (!kdwc)
+   return -ENOMEM;
+
+   platform_set_drvdata(pdev, kdwc);
+
+   kdwc-dev = dev;
+
+   res = 

[PATCH v3 0/2] Kesytone II USB host and PHY drivers

2013-12-09 Thread WingMan Kwok
Here is the updated version of the series which addresses comments from
earlier version [1]. The lock in the isr is removed as per the discussion.

Series adds USB host support for Keystone SOCs. Keystone SOCs uses dwc3
hardware IP implementation.  On Keystone II platforms, we use no-op phy driver.

Patchset are tested on Keystone II EVM with USB2.0 and USB3.0 flash drives
along with dts changes.

Cc: Felipe Balbi ba...@ti.com
Cc: Santosh Shilimkar santosh.shilim...@ti.com

WingMan Kwok (2):
  usb: dwc3: Add Keystone specific glue layer
  usb: phy: Add keystone usb phy driver

 drivers/usb/dwc3/Kconfig |7 ++
 drivers/usb/dwc3/Makefile|1 +
 drivers/usb/dwc3/dwc3-keystone.c |  205 ++
 drivers/usb/phy/Kconfig  |   10 ++
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/phy-keystone.c   |  142 ++
 6 files changed, 366 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-keystone.c
 create mode 100644 drivers/usb/phy/phy-keystone.c

[1] http://www.spinics.net/lists/linux-usb/msg98861.html
-- 
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: Problem with Kingston MobileLite G3 SD card reader

2013-12-09 Thread Thomas Raschbacher

On 2013-12-09 19:21, Alan Stern wrote:

On Mon, 9 Dec 2013, Thomas Raschbacher wrote:


On 2013-12-09 16:25, Alan Stern wrote:
 On Mon, 9 Dec 2013, Thomas Raschbacher wrote:

Regards
P.S.: i forgot to mention, that I run kernel 3.12.0


It looks like the problem is that your kernel was built without the
CONFIG_SCSI_MULTI_LUN option.  If you enable it then everything should
work.

Alan Stern


Ah thanks that solves the problem. Maybe this could/should be mentioned 
in the USB Storage description in the kernel config?
Or maybe even some dummy option as part of the USB Storage config 
section for this which just depends on the CONFIG_SCSI_MULTI_LUN option?


Regards

--
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 v7 4/5] usb: f_fs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-12-09 Thread David Cohen
From: Michal Nazarewicz min...@mina86.com

Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires
to be aligned to maxpacketsize of an out endpoint.  ffs_epfile_io() needs
to pad epout buffer to match above condition if quirk is found.

Signed-off-by: Michal Nazarewicz min...@mina86.com
Signed-off-by: David Cohen david.a.co...@linux.intel.com
---
 drivers/usb/gadget/f_fs.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index efa1152a4c15..918c21885d49 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -755,9 +755,10 @@ static ssize_t ffs_epfile_io(struct file *file,
 char __user *buf, size_t len, int read)
 {
struct ffs_epfile *epfile = file-private_data;
+   struct usb_gadget *gadget = epfile-ffs-gadget;
struct ffs_ep *ep;
char *data = NULL;
-   ssize_t ret;
+   ssize_t ret, data_len;
int halt;
 
/* Are we still active? */
@@ -790,7 +791,13 @@ static ssize_t ffs_epfile_io(struct file *file,
 
/* Allocate  copy */
if (!halt) {
-   data = kmalloc(len, GFP_KERNEL);
+   /*
+* Controller may require buffer size to be aligned to
+* maxpacketsize of an out endpoint.
+*/
+   data_len = read ? usb_ep_align_maybe(gadget, ep-ep, len) : len;
+
+   data = kmalloc(data_len, GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;
 
@@ -825,7 +832,7 @@ static ssize_t ffs_epfile_io(struct file *file,
req-context  = done;
req-complete = ffs_epfile_io_complete;
req-buf  = data;
-   req-length   = len;
+   req-length   = data_len;
 
ret = usb_ep_queue(ep-ep, req, GFP_ATOMIC);
 
@@ -837,9 +844,17 @@ static ssize_t ffs_epfile_io(struct file *file,
ret = -EINTR;
usb_ep_dequeue(ep-ep, req);
} else {
+   /*
+* XXX We may end up silently droping data here.
+* Since data_len (i.e. req-length) may be bigger
+* than len (after being rounded up to maxpacketsize),
+* we may end up with more data then user space has
+* space for.
+*/
ret = ep-status;
if (read  ret  0 
-   unlikely(copy_to_user(buf, data, ret)))
+   unlikely(copy_to_user(buf, data,
+ min_t(size_t, ret, len
ret = -EFAULT;
}
}
-- 
1.8.4.2

--
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 v7 5/5] usb: dwc3: set gadget's quirk ep_out_align_size

2013-12-09 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value.
This patch sets necessary quirk for it.

Signed-off-by: David Cohen david.a.co...@linux.intel.com
---
 drivers/usb/dwc3/gadget.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 5452c0fce360..b85ec110d6a0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2600,6 +2600,12 @@ int dwc3_gadget_init(struct dwc3 *dwc)
dwc-gadget.name= dwc3-gadget;
 
/*
+* Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize
+* on ep out.
+*/
+   dwc-gadget.quirk_ep_out_aligned_size = true;
+
+   /*
 * REVISIT: Here we should clear all pending IRQs to be
 * sure we're starting from a well known location.
 */
-- 
1.8.4.2

--
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 v7 0/5] add gadget quirk to adapt f_fs for DWC3

2013-12-09 Thread David Cohen
Hi,

These patches are a proposal to add gadget quirks in an immediate objective to
adapt f_fs when using DWC3 controller. But the quirk solution is generic and
can be used by other controllers to adapt gadget functions to their
non-standard restrictions.

This change is necessary to make Android's adbd service to work on Intel
Merrifield with f_fs instead of out-of-tree android gadget.

This new patch set was tested and validated in my environment:
 - Intel Merrifield was able to use DWC3/f_fs with adbd service (it wasn't
   before).

Changes from v6 to v7:
 - Downgraded patch set version to v5 as per Felipe Balbi request, with some
   changes:
   - usb_ep_align_maxpacketsize() macro was change to usp_ep_align_maybe()
 in order to check gadget-quirk_ep_out_aligned_size internally.
   - updated patch 4/5 to use new macro usp_ep_align_maybe() and to fix
 following compilation warning:
 $ drivers/usb/gadget/f_fs.c: In function 'ffs_epfile_io':
 $ drivers/usb/gadget/f_fs.c:857:124: warning: comparison of distinct 
pointer types lacks a cast [enabled by default]

---
David Cohen (3):
  usb: gadget: move bitflags to the end of usb_gadget struct
  usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget
  usb: dwc3: set gadget's quirk ep_out_align_size

Michal Nazarewicz (2):
  usb: gadget: f_fs: remove loop from I/O function
  usb: f_fs: check quirk to pad epout buf size when not aligned to
maxpacketsize

 drivers/usb/dwc3/gadget.c  |   6 +++
 drivers/usb/gadget/f_fs.c  | 115 +++--
 include/linux/usb/gadget.h |  39 +++
 3 files changed, 94 insertions(+), 66 deletions(-)

-- 
1.8.4.2

--
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 v7 1/5] usb: gadget: move bitflags to the end of usb_gadget struct

2013-12-09 Thread David Cohen
This patch moves all bitflags to the end of usb_gadget struct in order
to improve readability.

Signed-off-by: David Cohen david.a.co...@linux.intel.com
Acked-by: Michal Nazarewicz min...@mina86.com
---
 include/linux/usb/gadget.h | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 942ef5e053bf..23b3bfd0a842 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -485,6 +485,11 @@ struct usb_gadget_ops {
  * @max_speed: Maximal speed the UDC can handle.  UDC must support this
  *  and all slower speeds.
  * @state: the state we are now (attached, suspended, configured, etc)
+ * @name: Identifies the controller hardware type.  Used in diagnostics
+ * and sometimes configuration.
+ * @dev: Driver model state for this abstract device.
+ * @out_epnum: last used out ep number
+ * @in_epnum: last used in ep number
  * @sg_supported: true if we can handle scatter-gather
  * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
  * gadget driver must provide a USB OTG descriptor.
@@ -497,11 +502,6 @@ struct usb_gadget_ops {
  * only supports HNP on a different root port.
  * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
  * enabled HNP support.
- * @name: Identifies the controller hardware type.  Used in diagnostics
- * and sometimes configuration.
- * @dev: Driver model state for this abstract device.
- * @out_epnum: last used out ep number
- * @in_epnum: last used in ep number
  *
  * Gadgets have a mostly-portable gadget driver implementing device
  * functions, handling all usb configurations and interfaces.  Gadget
@@ -530,16 +530,17 @@ struct usb_gadget {
enum usb_device_speed   speed;
enum usb_device_speed   max_speed;
enum usb_device_state   state;
+   const char  *name;
+   struct device   dev;
+   unsignedout_epnum;
+   unsignedin_epnum;
+
unsignedsg_supported:1;
unsignedis_otg:1;
unsignedis_a_peripheral:1;
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
unsigneda_alt_hnp_support:1;
-   const char  *name;
-   struct device   dev;
-   unsignedout_epnum;
-   unsignedin_epnum;
 };
 #define work_to_gadget(w)  (container_of((w), struct usb_gadget, work))
 
-- 
1.8.4.2

--
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 v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread David Cohen
Due to USB controllers may have different restrictions, usb gadget layer
needs to provide a generic way to inform gadget functions to complain
with non-standard requirements.

This patch adds 'quirk_ep_out_aligned_size' field to struct usb_gadget
to inform when controller's epout requires buffer size to be aligned to
MaxPacketSize. A helper is also provided to align buffer size when
necessary.

Signed-off-by: David Cohen david.a.co...@linux.intel.com
Cc: Alan Stern st...@rowland.harvard.edu
Cc: Michal Nazarewicz min...@mina86.com
---
 include/linux/usb/gadget.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 23b3bfd0a842..cae8a6216551 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -502,6 +502,8 @@ struct usb_gadget_ops {
  * only supports HNP on a different root port.
  * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
  * enabled HNP support.
+ * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
+ * MaxPacketSize.
  *
  * Gadgets have a mostly-portable gadget driver implementing device
  * functions, handling all usb configurations and interfaces.  Gadget
@@ -541,6 +543,7 @@ struct usb_gadget {
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
unsigneda_alt_hnp_support:1;
+   unsignedquirk_ep_out_aligned_size:1;
 };
 #define work_to_gadget(w)  (container_of((w), struct usb_gadget, work))
 
@@ -559,6 +562,23 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct 
device *dev)
 
 
 /**
+ * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
+ * requires quirk_ep_out_aligned_size, otherwise reguens len.
+ * @g: controller to check for quirk
+ * @ep: the endpoint whose maxpacketsize is used to align @len
+ * @len: buffer size's length to align to @ep's maxpacketsize
+ *
+ * This helper is used in case it's required for any reason to check and maybe
+ * align buffer's size to an ep's maxpacketsize.
+ */
+static inline size_t
+usb_ep_align_maybe(struct usb_gadget *g, struct usb_ep *ep, size_t len)
+{
+   return !g-quirk_ep_out_aligned_size ? len :
+   round_up(len, (size_t)ep-desc-wMaxPacketSize);
+}
+
+/**
  * gadget_is_dualspeed - return true iff the hardware handles high speed
  * @g: controller that might support both high and full speeds
  */
-- 
1.8.4.2

--
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 v7 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-12-09 Thread David Cohen
From: Michal Nazarewicz min...@mina86.com

When endpoint changes (due to it being disabled or alt setting changed),
mimic the action as if the change happened after the request has been
queued, instead of retrying with the new endpoint.

Signed-off-by: Michal Nazarewicz min...@mina86.com
Cc: David Cohen david.a.co...@linux.intel.com
---
 drivers/usb/gadget/f_fs.c | 94 ---
 1 file changed, 40 insertions(+), 54 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 75e4b7846a8d..efa1152a4c15 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -760,73 +760,59 @@ static ssize_t ffs_epfile_io(struct file *file,
ssize_t ret;
int halt;
 
-   goto first_try;
-   do {
-   spin_unlock_irq(epfile-ffs-eps_lock);
-   mutex_unlock(epfile-mutex);
+   /* Are we still active? */
+   if (WARN_ON(epfile-ffs-state != FFS_ACTIVE)) {
+   ret = -ENODEV;
+   goto error;
+   }
 
-first_try:
-   /* Are we still active? */
-   if (WARN_ON(epfile-ffs-state != FFS_ACTIVE)) {
-   ret = -ENODEV;
+   /* Wait for endpoint to be enabled */
+   ep = epfile-ep;
+   if (!ep) {
+   if (file-f_flags  O_NONBLOCK) {
+   ret = -EAGAIN;
goto error;
}
 
-   /* Wait for endpoint to be enabled */
-   ep = epfile-ep;
-   if (!ep) {
-   if (file-f_flags  O_NONBLOCK) {
-   ret = -EAGAIN;
-   goto error;
-   }
-
-   if (wait_event_interruptible(epfile-wait,
-(ep = epfile-ep))) {
-   ret = -EINTR;
-   goto error;
-   }
-   }
-
-   /* Do we halt? */
-   halt = !read == !epfile-in;
-   if (halt  epfile-isoc) {
-   ret = -EINVAL;
+   ret = wait_event_interruptible(epfile-wait, (ep = epfile-ep));
+   if (ret) {
+   ret = -EINTR;
goto error;
}
+   }
 
-   /* Allocate  copy */
-   if (!halt  !data) {
-   data = kzalloc(len, GFP_KERNEL);
-   if (unlikely(!data))
-   return -ENOMEM;
+   /* Do we halt? */
+   halt = !read == !epfile-in;
+   if (halt  epfile-isoc) {
+   ret = -EINVAL;
+   goto error;
+   }
 
-   if (!read 
-   unlikely(__copy_from_user(data, buf, len))) {
-   ret = -EFAULT;
-   goto error;
-   }
-   }
+   /* Allocate  copy */
+   if (!halt) {
+   data = kmalloc(len, GFP_KERNEL);
+   if (unlikely(!data))
+   return -ENOMEM;
 
-   /* We will be using request */
-   ret = ffs_mutex_lock(epfile-mutex,
-file-f_flags  O_NONBLOCK);
-   if (unlikely(ret))
+   if (!read  unlikely(copy_from_user(data, buf, len))) {
+   ret = -EFAULT;
goto error;
+   }
+   }
 
-   /*
-* We're called from user space, we can use _irq rather then
-* _irqsave
-*/
-   spin_lock_irq(epfile-ffs-eps_lock);
+   /* We will be using request */
+   ret = ffs_mutex_lock(epfile-mutex, file-f_flags  O_NONBLOCK);
+   if (unlikely(ret))
+   goto error;
 
-   /*
-* While we were acquiring mutex endpoint got disabled
-* or changed?
-*/
-   } while (unlikely(epfile-ep != ep));
+   spin_lock_irq(epfile-ffs-eps_lock);
 
-   /* Halt */
-   if (unlikely(halt)) {
+   if (epfile-ep != ep) {
+   /* In the meantime, endpoint got disabled or changed. */
+   ret = -ESHUTDOWN;
+   spin_unlock_irq(epfile-ffs-eps_lock);
+   } else if (halt) {
+   /* Halt */
if (likely(epfile-ep == ep)  !WARN_ON(!ep-ep))
usb_ep_set_halt(ep-ep);
spin_unlock_irq(epfile-ffs-eps_lock);
-- 
1.8.4.2

--
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/1] AX88179_178A: Enable the hardware pseudo header in case of the NET_IP_ALIGN equals 0

2013-12-09 Thread David Miller
From: fre...@asix.com.tw
Date: Fri,  6 Dec 2013 17:58:18 +0800

 From: Freddy Xin fre...@asix.com.tw
 
 The AX88179_178A has a hardware feature that it can insert a 2-bytes pseudo
 header in front of each received frame by setting the AX_RX_CTL_IPE bit.
 This feature is used to let the IP header be aligned on a doubleword-aligned 
 address,
 but the NET_IP_ALIGN may equals to 2 and the __netdev_alloc_skb_ip_align in 
 USBNET will
 reserve 2 bytes also, so in this case the driver shouldn't enable this bit.
 
 This patch modifies the driver to set AX_RX_CTL_IPE just in case of the 
 NET_IP_ALIGN equals 0.
 
 Signed-off-by: Freddy Xin fre...@asix.com.tw

Please avoid larger than 80 column lines in your commit messages,
people use text-only tools to viee these.

Next, it makes no sense to restrict your change to NET_IP_ALIGN==0

Simply handle any case, by undoing the reservation if it's getting
in the way.  If there isn't an appropriate helper for this, add one.
--
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] xhci: Limit the spurious wakeup fix only to HP machines

2013-12-09 Thread Sarah Sharp
On Mon, Dec 09, 2013 at 02:53:36PM +0100, Takashi Iwai wrote:
 We've got regression reports that my previous fix for spurious wakeups
 after S5 on HP Haswell machines leads to the automatic reboot at
 shutdown on some machines.  It turned out that the fix for one side
 triggers another BIOS bug in other side.  So, it's exclusive.
 
 Since the original S5 wakeups have been confirmed only on HP machines,
 it'd be safer to apply it only to limited machines.  As a wild guess,
 limiting to machines with HP PCI SSID should suffice.

Thanks for the patch.  It looks like the right way to take care of this
regression, but I need confirmation from one of the original bug
reporters that it fixes their issue before I merge it.

So far we have one report that a revert of commit
638298dc66ea36623dbc2757a24fc2c4ab41b016 xhci: Fix spurious wakeups
after S5 on Haswell allows the system to shutdown without a spurious
reboot, but none of the original reporters have reported success with
this patch yet.

Sarah Sharp

 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66171
 Cc: sta...@vger.kernel.org
 Signed-off-by: Takashi Iwai ti...@suse.de
 ---
 v1-v2: Fix bug description
 
  drivers/usb/host/xhci-pci.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
 index b8dffd59eb25..73f5208714a4 100644
 --- a/drivers/usb/host/xhci-pci.c
 +++ b/drivers/usb/host/xhci-pci.c
 @@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct 
 xhci_hcd *xhci)
* any other sleep) on Haswell machines with LPT and LPT-LP
* with the new Intel BIOS
*/
 - xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
 + /* Limit the quirk to only known vendors, as this triggers
 +  * yet another BIOS bug on some other machines
 +  * https://bugzilla.kernel.org/show_bug.cgi?id=66171
 +  */
 + if (pdev-subsystem_vendor == PCI_VENDOR_ID_HP)
 + xhci-quirks |= XHCI_SPURIOUS_WAKEUP;
   }
   if (pdev-vendor == PCI_VENDOR_ID_ETRON 
   pdev-device == PCI_DEVICE_ID_ASROCK_P67) {
 -- 
 1.8.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: [PATCH v5 09/15] usb: phy-mxs: Enable IC fixes for related SoCs

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 10:52:33AM +0100, Marc Kleine-Budde wrote:
 On 12/09/2013 10:07 AM, Peter Chen wrote:
  On Mon, Dec 09, 2013 at 09:38:17AM +0100, Marc Kleine-Budde wrote:
  On 12/09/2013 07:30 AM, Peter Chen wrote:
  Some PHY bugs are fixed by IC logic, but these bits are not
  enabled by default, so we enable them at driver.
 
  Which bugs are fixed by enabling this bit? Is it only suspend related?
  Can you document them or better add a pointer to the documentation.
  
  I will add more, in fact, it fixes the bug which flag BIT(1) and BIT(2)
  stands for.
  
 
  Further I don't like the idea of adding code, or enabling a feature on
  certain hardware, that is broken in the first place and fixing it in a
  later patch. Think about squashing it into the correct patch.
  
  No fixes are related with this patch, you can see there is no -
  at this patch.
 
 Yes, there isn't any broken code (thus no -), but you first enable a
 feature in the hardware and in a later patch (this one) make it work
 properly.
 

Sorry? I haven't enabled related hardware feature at previous patches.
These two bits are enable bit, we just need to enable it.

-- 

Best Regards,
Peter Chen

--
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 v5 15/15] usb: phy-mxs: Add sync time after controller clear phcd

2013-12-09 Thread Peter Chen
On Mon, Dec 09, 2013 at 09:20:08PM +0300, Sergei Shtylyov wrote:
 Hello.
 
 On 12/09/2013 09:31 AM, Peter Chen wrote:
 
 After clear portsc.phcd, PHY needs 200us stable time for switch
 32K clock to AHB clock.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
   drivers/usb/phy/phy-mxs-usb.c |   11 +++
   1 files changed, 11 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
 index e18fdf3..7ae5225 100644
 --- a/drivers/usb/phy/phy-mxs-usb.c
 +++ b/drivers/usb/phy/phy-mxs-usb.c
 @@ -151,6 +151,15 @@ static inline bool is_imx6sl_phy(struct mxs_phy 
 *mxs_phy)
  return mxs_phy-data == imx6sl_phy_data;
   }
 
 +/*
 + * PHY needs some 32K cycles to switch from 32K clock to
 + * bus (such as AHB/AXI, etc) clock.
 + */
 +static void mxs_phy_clock_switch(void)
 +{
 +usleep_range(300, 400);
 +}
 +
 
Don't think this is a good name for this function since it
 doesn't really switch anything, just waits. I'd suggest something
 like mxs_phy_clock_switch_delay().
 

Thanks, I will change.

-- 

Best Regards,
Peter Chen

--
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 v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread Michal Nazarewicz
dOn Tue, Dec 10 2013, David Cohen wrote:
 Due to USB controllers may have different restrictions, usb gadget layer
 needs to provide a generic way to inform gadget functions to complain
 with non-standard requirements.

 This patch adds 'quirk_ep_out_aligned_size' field to struct usb_gadget
 to inform when controller's epout requires buffer size to be aligned to
 MaxPacketSize. A helper is also provided to align buffer size when
 necessary.

 Signed-off-by: David Cohen david.a.co...@linux.intel.com
 Cc: Alan Stern st...@rowland.harvard.edu
 Cc: Michal Nazarewicz min...@mina86.com

Acked-by: Michal Nazarewicz min...@mina86.com

 ---
  include/linux/usb/gadget.h | 20 
  1 file changed, 20 insertions(+)

 diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
 index 23b3bfd0a842..cae8a6216551 100644
 --- a/include/linux/usb/gadget.h
 +++ b/include/linux/usb/gadget.h
 @@ -502,6 +502,8 @@ struct usb_gadget_ops {
   *   only supports HNP on a different root port.
   * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
   *   enabled HNP support.
 + * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
 + *   MaxPacketSize.
   *
   * Gadgets have a mostly-portable gadget driver implementing device
   * functions, handling all usb configurations and interfaces.  Gadget
 @@ -541,6 +543,7 @@ struct usb_gadget {
   unsignedb_hnp_enable:1;
   unsigneda_hnp_support:1;
   unsigneda_alt_hnp_support:1;
 + unsignedquirk_ep_out_aligned_size:1;
  };
  #define work_to_gadget(w)(container_of((w), struct usb_gadget, work))
  
 @@ -559,6 +562,23 @@ static inline struct usb_gadget 
 *dev_to_usb_gadget(struct device *dev)
  
  
  /**
 + * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
 + *   requires quirk_ep_out_aligned_size, otherwise reguens len.

“returns”

 + * @g: controller to check for quirk
 + * @ep: the endpoint whose maxpacketsize is used to align @len
 + * @len: buffer size's length to align to @ep's maxpacketsize
 + *
 + * This helper is used in case it's required for any reason to check and 
 maybe
 + * align buffer's size to an ep's maxpacketsize.
 + */
 +static inline size_t
 +usb_ep_align_maybe(struct usb_gadget *g, struct usb_ep *ep, size_t len)
 +{
 + return !g-quirk_ep_out_aligned_size ? len :
 + round_up(len, (size_t)ep-desc-wMaxPacketSize);
 +}
 +
 +/**
   * gadget_is_dualspeed - return true iff the hardware handles high speed
   * @g: controller that might support both high and full speeds
   */

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +--m...@google.com--xmpp:min...@jabber.org--ooO--(_)--Ooo--


signature.asc
Description: PGP signature


Re: [PATCH v3 1/2] usb: dwc3: Add Keystone specific glue layer

2013-12-09 Thread Felipe Balbi
Hi,

On Mon, Dec 09, 2013 at 05:17:03PM -0500, WingMan Kwok wrote:
 +static void kdwc3_enable_irqs(struct dwc3_keystone *kdwc)
 +{
 + u32 val;
 +
 + val = kdwc3_readl(kdwc-usbss, USBSS_IRQENABLE_SET_0);
 + val = USBSS_IRQ_COREIRQ_EN;

this misses the | in |=. I can fix it up while applying, this time only.

 +static int kdwc3_probe(struct platform_device *pdev)
 +{
 + struct device   *dev = pdev-dev;
 + struct device_node  *node = pdev-dev.of_node;
 + struct dwc3_keystone*kdwc;
 + struct resource *res;
 + int error, irq;
 +
 + kdwc = devm_kzalloc(dev, sizeof(*kdwc), GFP_KERNEL);
 + if (!kdwc)
 + return -ENOMEM;
 +
 + platform_set_drvdata(pdev, kdwc);
 +
 + kdwc-dev = dev;
 +
 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 + if (!res) {
 + dev_err(dev, missing usbss resource\n);
 + return -EINVAL;
 + }
 +
 + kdwc-usbss = devm_ioremap_resource(dev, res);
 + if (IS_ERR(kdwc-usbss))
 + return PTR_ERR(kdwc-usbss);
 +
 + kdwc3_dma_mask = dma_get_mask(dev);
 + dev-dma_mask = kdwc3_dma_mask;
 +
 + kdwc-clk = devm_clk_get(kdwc-dev, usb);
 + if (IS_ERR_OR_NULL(kdwc-clk)) {

clk_get() will never return NULL. This time, I'll fix it while applying.

 +static int kdwc3_remove(struct platform_device *pdev)
 +{
 + struct dwc3_keystone *kdwc = platform_get_drvdata(pdev);
 +
 + kdwc3_disable_irqs(kdwc);
 + clk_disable_unprepare(kdwc-clk);

I hope the clock isn't shared between core and wrapper, otherwise you
could run into some troubles here. Can you confirm ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v3 2/2] usb: phy: Add keystone usb phy driver

2013-12-09 Thread Felipe Balbi
Hi,

On Mon, Dec 09, 2013 at 05:17:04PM -0500, WingMan Kwok wrote:
 + ret = usb_add_phy_dev(k_phy-usb_phy_gen.phy);
 + if (ret)
 + return ret;
 + k_phy-usb_phy_gen.phy.init = keystone_usbphy_init;
 + k_phy-usb_phy_gen.phy.shutdown = keystone_usbphy_shutdown;

this *must* be initialized before adding the PHY to the subsystem. So
these two lines must be moved before usb_add_phy_dev().

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 31/39] USB: remove DEFINE_PCI_DEVICE_TABLE macro

2013-12-09 Thread Felipe Balbi
On Mon, Dec 09, 2013 at 12:33:17AM -0800, 'Greg Kroah-Hartman' wrote:
 On Sun, Dec 08, 2013 at 10:03:42PM -0600, Felipe Balbi wrote:
  On Tue, Dec 03, 2013 at 08:27:58AM +0900, Jingoo Han wrote:
   Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
   is not preferred.
   
   Signed-off-by: Jingoo Han jg1@samsung.com
  
  I wonder why I wasn't Cc:ed to this email considering it touches three
  drivers I care about.
  
  Greg, I have the original ones in my tree and I would really like to
  avoid rebasing my 'next' branch. Do we keep it there or do you want to
  avoid merging those commits ?
 
 Just keep it there and we can handle the merge, it shouldn't be a big
 deal, right?

Should not. Thanks Greg.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v3 2/2] usb: phy: Add keystone usb phy driver

2013-12-09 Thread Roger Quadros
On 12/10/2013 03:47 AM, WingMan Kwok wrote:
 Add Keystone platform USB PHY driver support. Current main purpose
 of this driver is to enable the PHY reference clock gate on the
 Keystone SoC. Otherwise it is a nop PHY.
 
 Cc: Santosh Shilimkar santosh.shilim...@ti.com
 Cc: Felipe Balbi ba...@ti.com
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
 Signed-off-by: WingMan Kwok w-kw...@ti.com
 ---
  drivers/usb/phy/Kconfig|   10 +++
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/phy-keystone.c |  142 
 
  3 files changed, 153 insertions(+)
  create mode 100644 drivers/usb/phy/phy-keystone.c
 
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 08e2f39..c6792f43 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -40,6 +40,16 @@ config ISP1301_OMAP
 This driver can also be built as a module.  If so, the module
 will be called isp1301_omap.
  
 +config KEYSTONE_USB_PHY
 + tristate Keystone USB PHY Driver
 + depends on ARCH_KEYSTONE
 + select USB_PHY

NOP_USB_XCEIV selects USB_PHY so not necessary.

 + select NOP_USB_XCEIV
 + help
 +   Enable this to support Keystone USB phy. This driver provides
 +   interface to interact with USB 2.0 and USB 3.0 PHY that is part
 +   of the Keystone SOC.
 +
  config MV_U3D_PHY
   bool Marvell USB 3.0 PHY controller Driver
   depends on CPU_MMP3
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index 022c1da..311b47b 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -30,3 +30,4 @@ obj-$(CONFIG_USB_RCAR_PHY)  += phy-rcar-usb.o
  obj-$(CONFIG_USB_RCAR_GEN2_PHY)  += phy-rcar-gen2-usb.o
  obj-$(CONFIG_USB_ULPI)   += phy-ulpi.o
  obj-$(CONFIG_USB_ULPI_VIEWPORT)  += phy-ulpi-viewport.o
 +obj-$(CONFIG_KEYSTONE_USB_PHY)   += phy-keystone.o

cheers,
-roger
--
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 v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread David Cohen
On 12/09/2013 06:34 PM, Michal Nazarewicz wrote:
 dOn Tue, Dec 10 2013, David Cohen wrote:
 Due to USB controllers may have different restrictions, usb gadget layer
 needs to provide a generic way to inform gadget functions to complain
 with non-standard requirements.

 This patch adds 'quirk_ep_out_aligned_size' field to struct usb_gadget
 to inform when controller's epout requires buffer size to be aligned to
 MaxPacketSize. A helper is also provided to align buffer size when
 necessary.

 Signed-off-by: David Cohen david.a.co...@linux.intel.com
 Cc: Alan Stern st...@rowland.harvard.edu
 Cc: Michal Nazarewicz min...@mina86.com
 
 Acked-by: Michal Nazarewicz min...@mina86.com
 
 ---
  include/linux/usb/gadget.h | 20 
  1 file changed, 20 insertions(+)

 diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
 index 23b3bfd0a842..cae8a6216551 100644
 --- a/include/linux/usb/gadget.h
 +++ b/include/linux/usb/gadget.h
 @@ -502,6 +502,8 @@ struct usb_gadget_ops {
   *  only supports HNP on a different root port.
   * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
   *  enabled HNP support.
 + * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
 + *  MaxPacketSize.
   *
   * Gadgets have a mostly-portable gadget driver implementing device
   * functions, handling all usb configurations and interfaces.  Gadget
 @@ -541,6 +543,7 @@ struct usb_gadget {
  unsignedb_hnp_enable:1;
  unsigneda_hnp_support:1;
  unsigneda_alt_hnp_support:1;
 +unsignedquirk_ep_out_aligned_size:1;
  };
  #define work_to_gadget(w)   (container_of((w), struct usb_gadget, work))
  
 @@ -559,6 +562,23 @@ static inline struct usb_gadget 
 *dev_to_usb_gadget(struct device *dev)
  
  
  /**
 + * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
 + *  requires quirk_ep_out_aligned_size, otherwise reguens len.
 
 “returns”

I've got no idea how returns became reguens :)
But maybe Felipe can fix it when applying?

Br, David
--
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: storage: fix compile warning

2013-12-09 Thread Ming Lei
This patch should fix the below compile warning:

drivers/usb/storage/protocol.c: In function 'usb_stor_access_xfer_buf':
drivers/usb/storage/protocol.c:155:22: warning: comparison of distinct
pointer types lacks a cast [enabled by default]

Reported-by: kbuild test robot fengguang...@intel.com
Reported-by: Stephen Rothwell s...@canb.auug.org.au
---
 drivers/usb/storage/protocol.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index f54e5fe..599d88f 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -152,7 +152,8 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
return cnt;
 
while (sg_miter_next(miter)  cnt  buflen) {
-   unsigned int len = min(miter.length, buflen - cnt);
+   unsigned int len = min_t(unsigned, miter.length,
+   buflen - cnt);
 
if (dir == FROM_XFER_BUF)
memcpy(buffer + cnt, miter.addr, len);
-- 
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: [PATCH v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread Felipe Balbi
On Mon, Dec 09, 2013 at 07:35:19PM -0800, David Cohen wrote:
 On 12/09/2013 06:34 PM, Michal Nazarewicz wrote:
  dOn Tue, Dec 10 2013, David Cohen wrote:
  Due to USB controllers may have different restrictions, usb gadget layer
  needs to provide a generic way to inform gadget functions to complain
  with non-standard requirements.
 
  This patch adds 'quirk_ep_out_aligned_size' field to struct usb_gadget
  to inform when controller's epout requires buffer size to be aligned to
  MaxPacketSize. A helper is also provided to align buffer size when
  necessary.
 
  Signed-off-by: David Cohen david.a.co...@linux.intel.com
  Cc: Alan Stern st...@rowland.harvard.edu
  Cc: Michal Nazarewicz min...@mina86.com
  
  Acked-by: Michal Nazarewicz min...@mina86.com
  
  ---
   include/linux/usb/gadget.h | 20 
   1 file changed, 20 insertions(+)
 
  diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
  index 23b3bfd0a842..cae8a6216551 100644
  --- a/include/linux/usb/gadget.h
  +++ b/include/linux/usb/gadget.h
  @@ -502,6 +502,8 @@ struct usb_gadget_ops {
*only supports HNP on a different root port.
* @b_hnp_enable: OTG device feature flag, indicating that the A-Host
*enabled HNP support.
  + * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
  + *MaxPacketSize.
*
* Gadgets have a mostly-portable gadget driver implementing device
* functions, handling all usb configurations and interfaces.  Gadget
  @@ -541,6 +543,7 @@ struct usb_gadget {
 unsignedb_hnp_enable:1;
 unsigneda_hnp_support:1;
 unsigneda_alt_hnp_support:1;
  +  unsignedquirk_ep_out_aligned_size:1;
   };
   #define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
   
  @@ -559,6 +562,23 @@ static inline struct usb_gadget 
  *dev_to_usb_gadget(struct device *dev)
   
   
   /**
  + * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if 
  gadget
  + *requires quirk_ep_out_aligned_size, otherwise reguens len.
  
  “returns”
 
 I've got no idea how returns became reguens :)
 But maybe Felipe can fix it when applying?

Sure, but you owe me a beer hehe :-)

-- 
balbi


signature.asc
Description: Digital signature


  1   2   >