Re: [PATCH] Usb: atm: usbatm: fixed a pointer variable format issue

2013-12-06 Thread Duncan Sands

On 06/12/13 04:59, learc83 wrote:

Fixed a pointer variable format issue.


This is obviously OK.

Ciao, Duncan.



Signed-off-by: Seth Archer Brown 
---
  drivers/usb/atm/usbatm.c |8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 25a7bfc..dada014 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -170,9 +170,9 @@ struct usbatm_control {
  static void usbatm_atm_dev_close(struct atm_dev *atm_dev);
  static int usbatm_atm_open(struct atm_vcc *vcc);
  static void usbatm_atm_close(struct atm_vcc *vcc);
-static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void 
__user * arg);
+static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void 
__user *arg);
  static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb);
-static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char 
*page);
+static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t *pos, char 
*page);

  static struct atmdev_ops usbatm_atm_devops = {
.dev_close  = usbatm_atm_dev_close,
@@ -739,7 +739,7 @@ static void usbatm_atm_dev_close(struct atm_dev *atm_dev)
usbatm_put_instance(instance);  /* taken in usbatm_atm_init */
  }

-static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char 
*page)
+static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t *pos, char 
*page)
  {
struct usbatm_data *instance = atm_dev->dev_data;
int left = *pos;
@@ -895,7 +895,7 @@ static void usbatm_atm_close(struct atm_vcc *vcc)
  }

  static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd,
- void __user * arg)
+ void __user *arg)
  {
struct usbatm_data *instance = atm_dev->dev_data;




--
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: [PATCHv3] usb: chipidea: add support for USB OTG controller on TI-NSPIRE

2013-12-06 Thread Peter Chen
On Wed, Dec 04, 2013 at 03:02:56PM +0800, Peter Chen wrote:
> On Mon, Nov 25, 2013 at 02:53:37PM +1100, dt.ta...@gmail.com wrote:
> > From: Daniel Tang 
> > 
> > The USB controller in TI-NSPIRE calculators are based off either Freescale's
> > USB OTG controller or the USB controller found in the IMX233, both of which
> > are Chipidea compatible.
> > 
> > This patch adds a device tree binding for the controller.
> > 
> > Signed-off-by: Daniel Tang 
> > ---
> > 
> > Changelog v3:
> >  * Removed redundant module aliases
> > 
> > Changelog v2:
> >  * Rename ci13xxx to ci_hdrc
> >  * Fixed alignment issues
> > 
> > .../devicetree/bindings/usb/ci-hdrc-nspire.txt | 17 +
> >  drivers/usb/chipidea/Makefile  |  1 +
> >  drivers/usb/chipidea/ci_hdrc_nspire.c  | 72 
> > ++
> >  3 files changed, 90 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-nspire.txt
> >  create mode 100644 drivers/usb/chipidea/ci_hdrc_nspire.c
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-nspire.txt 
> > b/Documentation/devicetree/bindings/usb/ci-hdrc-nspire.txt
> > new file mode 100644
> > index 000..5ba8e90
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-nspire.txt
> > @@ -0,0 +1,17 @@
> > +* TI-Nspire USB OTG Controller
> > +
> > +Required properties:
> > +- compatible: Should be "zevio,nspire-usb"
> > +- reg: Should contain registers location and length
> > +- interrupts: Should contain controller interrupt
> > +
> > +Recommended properies:
> > +- vbus-supply: regulator for vbus
> > +
> > +Examples:
> > +   usb0: usb@B000 {
> > +   reg = <0xB000 0x1000>;
> > +   compatible = "zevio,nspire-usb";
> > +   interrupts = <8>;
> > +   vbus-supply = <&vbus_reg>;
> > +   };
> > diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> > index a99d980..245ea4d 100644
> > --- a/drivers/usb/chipidea/Makefile
> > +++ b/drivers/usb/chipidea/Makefile
> > @@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG)  += debug.o
> >  # Glue/Bridge layers go here
> > 
> >  obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o
> > +obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_nspire.o
> > 
> >  # PCI doesn't provide stubs, need to check
> >  ifneq ($(CONFIG_PCI),)
> > diff --git a/drivers/usb/chipidea/ci_hdrc_nspire.c 
> > b/drivers/usb/chipidea/ci_hdrc_nspire.c
> > new file mode 100644
> > index 000..517ce41
> > --- /dev/null
> > +++ b/drivers/usb/chipidea/ci_hdrc_nspire.c
> > @@ -0,0 +1,72 @@
> > +/*
> > + * Copyright (C) 2013 Daniel Tang 
> > + *
> > + * 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.
> > + *
> > + * Based off drivers/usb/chipidea/ci_hdrc_msm.c
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "ci.h"
> > +
> > +static struct ci_hdrc_platform_data ci_hdrc_nspire_platdata = {
> > +   .name   = "ci_hdrc_nspire",
> > +   .flags  = CI_HDRC_REGS_SHARED,
> > +   .capoffset  = DEF_CAPOFFSET,
> > +};
> > +
> > +static int ci_hdrc_nspire_probe(struct platform_device *pdev)
> > +{
> > +   struct platform_device *ci_pdev;
> > +
> > +   dev_dbg(&pdev->dev, "ci_hdrc_nspire_probe\n");
> > +
> > +   ci_pdev = ci_hdrc_add_device(&pdev->dev,
> > +   pdev->resource, pdev->num_resources,
> > +   &ci_hdrc_nspire_platdata);
> > +
> > +   if (IS_ERR(ci_pdev)) {
> > +   dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
> > +   return PTR_ERR(ci_pdev);
> > +   }
> > +
> > +   platform_set_drvdata(pdev, ci_pdev);
> > +
> > +   return 0;
> > +}
> > +
> > +static int ci_hdrc_nspire_remove(struct platform_device *pdev)
> > +{
> > +   struct platform_device *ci_pdev = platform_get_drvdata(pdev);
> > +
> > +   ci_hdrc_remove_device(ci_pdev);
> > +
> > +   return 0;
> > +}
> > +
> > +static const struct of_device_id ci_hdrc_nspire_dt_ids[] = {
> > +   { .compatible = "zevio,nspire-usb", },
> > +   { /* sentinel */ }
> > +};
> > +
> > +static struct platform_driver ci_hdrc_nspire_driver = {
> > +   .probe = ci_hdrc_nspire_probe,
> > +   .remove = ci_hdrc_nspire_remove,
> > +   .driver = {
> > +   .name = "nspire_usb",
> > +   .owner = THIS_MODULE,
> > +   .of_match_table = ci_hdrc_nspire_dt_ids,
> > +   },
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, ci_hdrc_nspire_dt_ids);
> > +module_platform_driver(ci_hdrc_nspire_driver);
> > +
> > +MODULE_LICENSE("GPL v2");
> > --
> > 1.8.1.3
> > 
> > 
> 
> Applied, 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  ht

[PATCH 1/4] usb: chipidea: Reallocate regmap only if lpm is detected

2013-12-06 Thread Peter Chen
From: Chris Ruehl 

The regmap only needs to reallocate if the hw_read on the CAP register shows
lpm is used. Therefore the if() statement check the change.

Signed-off-by: Chris Ruehl 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 5d8981c..5075407 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -208,7 +208,8 @@ static int hw_device_init(struct ci_hdrc *ci, void __iomem 
*base)
reg = hw_read(ci, CAP_HCCPARAMS, HCCPARAMS_LEN) >>
__ffs(HCCPARAMS_LEN);
ci->hw_bank.lpm  = reg;
-   hw_alloc_regmap(ci, !!reg);
+   if (reg)
+   hw_alloc_regmap(ci, !!reg);
ci->hw_bank.size = ci->hw_bank.op - ci->hw_bank.abs;
ci->hw_bank.size += OP_LAST;
ci->hw_bank.size /= sizeof(u32);
-- 
1.7.8


--
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/4] usb: chipidea: imx: avoid unnecessary probe defer every time

2013-12-06 Thread Peter Chen
The ci_hdrc_imx's probe needs usbmisc_imx to be loadded beforehand,
so it is better we load usbmisc_imx first.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index a99d980..7345d21 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -17,5 +17,5 @@ ifneq ($(CONFIG_PCI),)
 endif
 
 ifneq ($(CONFIG_OF),)
-   obj-$(CONFIG_USB_CHIPIDEA)  += ci_hdrc_imx.o usbmisc_imx.o
+   obj-$(CONFIG_USB_CHIPIDEA)  += usbmisc_imx.o ci_hdrc_imx.o
 endif
-- 
1.7.8


--
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 4/4] usb: chipidea: usbmisc: Add support for i.MX51 CPU

2013-12-06 Thread Peter Chen
From: Alexander Shiyan 

This adds i.MX51 as the next user of the usbmisc driver.
Functionality is similar to i.MX53, so at this stage simply
reuse existing i.MX53 calls.

Signed-off-by: Alexander Shiyan 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/usbmisc_imx.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 4381c5a6..cd061ab 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -204,6 +204,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.data = &imx27_usbmisc_ops,
},
{
+   .compatible = "fsl,imx51-usbmisc",
+   .data = &imx53_usbmisc_ops,
+   },
+   {
.compatible = "fsl,imx53-usbmisc",
.data = &imx53_usbmisc_ops,
},
-- 
1.7.8


--
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/4] Chipidea Patches for 3.14

2013-12-06 Thread Peter Chen
Hi Greg,

Below four patches are for usb-next, thanks.

Alexander Shiyan (2):
  usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
  usb: chipidea: usbmisc: Add support for i.MX51 CPU

Chris Ruehl (1):
  usb: chipidea: Reallocate regmap only if lpm is detected

Peter Chen (1):
  usb: chipidea: imx: avoid unnecessary probe defer every time

 drivers/usb/chipidea/Makefile  |2 +-
 drivers/usb/chipidea/core.c|3 +-
 drivers/usb/chipidea/usbmisc_imx.c |   46 
 3 files changed, 49 insertions(+), 2 deletions(-)

-- 
1.7.8


--
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 3/4] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs

2013-12-06 Thread Peter Chen
From: Alexander Shiyan 

This adds i.MX27 and i.MX31 as the next user of the usbmisc driver.

Tested-by: Chris Ruehl 
Signed-off-by: Alexander Shiyan 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/usbmisc_imx.c |   42 
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 8a1094b..4381c5a6 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -21,6 +21,10 @@
 #define MX25_USB_PHY_CTRL_OFFSET   0x08
 #define MX25_BM_EXTERNAL_VBUS_DIVIDER  BIT(23)
 
+#define MX27_H1_PM_BIT BIT(8)
+#define MX27_H2_PM_BIT BIT(16)
+#define MX27_OTG_PM_BITBIT(24)
+
 #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08
 #define MX53_USB_UH2_CTRL_OFFSET   0x14
 #define MX53_USB_UH3_CTRL_OFFSET   0x18
@@ -68,6 +72,36 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
return 0;
 }
 
+static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
+{
+   unsigned long flags;
+   u32 val;
+
+   switch (data->index) {
+   case 0:
+   val = MX27_OTG_PM_BIT;
+   break;
+   case 1:
+   val = MX27_H1_PM_BIT;
+   break;
+   case 2:
+   val = MX27_H2_PM_BIT;
+   break;
+   default:
+   return -EINVAL;
+   };
+
+   spin_lock_irqsave(&usbmisc->lock, flags);
+   if (data->disable_oc)
+   val = readl(usbmisc->base) | val;
+   else
+   val = readl(usbmisc->base) & ~val;
+   writel(val, usbmisc->base);
+   spin_unlock_irqrestore(&usbmisc->lock, flags);
+
+   return 0;
+}
+
 static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 {
void __iomem *reg = NULL;
@@ -128,6 +162,10 @@ static const struct usbmisc_ops imx25_usbmisc_ops = {
.post = usbmisc_imx25_post,
 };
 
+static const struct usbmisc_ops imx27_usbmisc_ops = {
+   .init = usbmisc_imx27_init,
+};
+
 static const struct usbmisc_ops imx53_usbmisc_ops = {
.init = usbmisc_imx53_init,
 };
@@ -162,6 +200,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.data = &imx25_usbmisc_ops,
},
{
+   .compatible = "fsl,imx27-usbmisc",
+   .data = &imx27_usbmisc_ops,
+   },
+   {
.compatible = "fsl,imx53-usbmisc",
.data = &imx53_usbmisc_ops,
},
-- 
1.7.8


--
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 0/2] usb: chipidea: streamline regmap handling

2013-12-06 Thread Marc Kleine-Budde
On 12/06/2013 07:39 AM, Peter Chen wrote:
> On Thu, Dec 05, 2013 at 12:32:55PM +0100, Marc Kleine-Budde wrote:
>> Hello Peter,
>>
>> these patches are for your ci-for-usb-next branch. The repmap handling is
>> streamlined and the kernel shrinks by 706 bytes on i.MX28:
>>
>> add/remove: 0/0 grow/shrink: 0/30 up/down: 0/-706 (-706)
>> function old new   delta
>> hw_wait_reg  164 160  -4
>> hw_port_test_get  24  20  -4
>> hw_ep_flush  132 128  -4
>> ep_enable392 388  -4
>> ep_disable   252 248  -4
>> ci_otg_work  248 244  -4
>> ci_otg_role   24  20  -4
>> ci_hdrc_host_init148 144  -4
>> ci_hdrc_gadget_init  736 732  -4
>> ci_handle_vbus_change 92  88  -4
>> isr_setup_status_complete156 148  -8
>> hw_port_test_set  64  56  -8
>> host_start   360 352  -8
>> ci_udc_pullup 84  76  -8
>> ci_hdrc_remove   100  92  -8
>> ci_udc_wakeup172 160 -12
>> udc_id_switch_for_host76  60 -16
>> udc_id_switch_for_device  80  64 -16
>> ci_hdrc_otg_destroy   92  76 -16
>> ci_hdrc_enter_lpm204 188 -16
>> ci_irq   264 244 -20
>> hw_device_state  120  96 -24
>> _ep_queue.isra  10561028 -28
>> ci_regs_nolpm 76  19 -57
>> ci_regs_lpm   76  19 -57
>> hw_device_reset  416 352 -64
>> ep_set_halt  500 436 -64
>> hw_alloc_regmap  204 136 -68
>> ci_hdrc_probe   15121444 -68
>> udc_irq 32363136-100
>>
> 
> Hi Marc,
> 
> Thanks for doing that, would you explain more why the function
> code size can be smaller with your two patches?

In the functions one instruction (4 Bytes) is saved per register access.
When the array is embedded into the hw_bank there is one indirection less:

For example, the original code:
 870:   e591301cldr r3, [r1, #28]
 874:   e593302cldr r3, [r3, #44]   ; 0x2c
 878:   e5932000ldr r2, [r3]
 87c:   e5d13030ldrbr3, [r1, #48]   ; 0x30

With my first patch applied:
 7d8:   e5913048ldr r3, [r1, #72]   ; 0x48
 7dc:   e5932000ldr r2, [r3]
 7e0:   e5d130b4ldrbr3, [r1, #180]  ; 0xb4

With the second patch applied, we save some mem in ci_regs_nolpm and
ci_regs_lpm, because an entry only takes 1 Byte instead of 4.

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 v2 0/3] ARM: OMAP2+: USB Host bug fixes for 3.13 rc

2013-12-06 Thread Roger Quadros
Tony,

On 12/05/2013 08:48 PM, Tony Lindgren wrote:
> * Tomi Valkeinen  [131204 02:01]:
>> On 2013-12-03 16:25, Roger Quadros wrote:
>>> Hi,
>>>
>>> This is a follow up solution to the original series in [1]
>>>
>>> The first patch fixes the OMAP4 Panda USB detection problems on 3.13-rc1
>>> with u-boot v2013.10.
>>>
>>> The remaining 2 patches are required if SOFTRESET needs to be done for the
>>> USB Host module on OMAP3 platforms.
>>>
>>> Patch 2 fixes the hwmod RESET logic to prevent multiple SOFTRESETs
>>> being issued to the modules. This multiple SOFTRESET was causing problems
>>> with OMAP3 USB Host module. On Beagleboard C4 this is seen as failure to
>>> mount NFS root over external USB to Ethernet device.
>>>
>>> This might be the reason why HWMOD_INIT_NO_RESET was used for the OMAP
>>> USB host module in OMAP3 hwmod data and just carried forward in OMAP4
>>> and OMAP5 hwmod data as well.
>>>
>>> cheers,
>>> -roger
>>
>> Tested on Panda and Beagle xM. Works fine for me.
> 
> Looks like we should merge these as regression fixes during the -rc
> cycle. Paul should take a look at these first though.

At least the first one must be taken ASAP. The other two would be nice to have 
though.

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 1/2] usb: chipidea: move malloced regmap directly into struct hw_bank

2013-12-06 Thread Marc Kleine-Budde
On 12/06/2013 07:45 AM, Peter Chen wrote:
> On Thu, Dec 05, 2013 at 12:32:56PM +0100, Marc Kleine-Budde wrote:
>> Without this patch a seperate chunk of memory is allocated for the regmap
>> array. As the regmap is always used it makes no sense to allocate a seperate
>> memory block for it, this patch moves the regmap array directly into the 
>> struct
>> hw_bank.
>>
>> Signed-off-by: Marc Kleine-Budde 
>> ---
>>  drivers/usb/chipidea/ci.h   | 66 
>> ++---
>>  drivers/usb/chipidea/core.c |  8 --
>>  2 files changed, 33 insertions(+), 41 deletions(-)
>>
>> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
>> index 1c94fc5..ef99d91 100644
>> --- a/drivers/usb/chipidea/ci.h
>> +++ b/drivers/usb/chipidea/ci.h
>> @@ -26,6 +26,38 @@
>>  #define ENDPT_MAX  32
>>  
>>  
>> /**
>> + * REGISTERS
>> + 
>> */
>> +/* register size */
>> +#define REG_BITS   (32)
>> +
>> +/* register indices */
>> +enum ci_hw_regs {
>> +CAP_CAPLENGTH,
>> +CAP_HCCPARAMS,
>> +CAP_DCCPARAMS,
>> +CAP_TESTMODE,
>> +CAP_LAST = CAP_TESTMODE,
>> +OP_USBCMD,
>> +OP_USBSTS,
>> +OP_USBINTR,
>> +OP_DEVICEADDR,
>> +OP_ENDPTLISTADDR,
>> +OP_PORTSC,
>> +OP_DEVLC,
>> +OP_OTGSC,
>> +OP_USBMODE,
>> +OP_ENDPTSETUPSTAT,
>> +OP_ENDPTPRIME,
>> +OP_ENDPTFLUSH,
>> +OP_ENDPTSTAT,
>> +OP_ENDPTCOMPLETE,
>> +OP_ENDPTCTRL,
>> +/* endptctrl1..15 follow */
>> +OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
>> +};
>> +
>> +/**
>>   * STRUCTURES
>>   
>> */
>>  /**
>> @@ -98,7 +130,7 @@ struct hw_bank {
>>  void __iomem*cap;
>>  void __iomem*op;
>>  size_t  size;
>> -void __iomem**regmap;
>> +void __iomem*regmap[OP_LAST];
> 
> OP_LAST + 1?

Yes. Why didn't the compiler detect the out of bounds access of the array?

>>  };
>>  
>>  /**
>> @@ -209,38 +241,6 @@ static inline void ci_role_stop(struct ci_hdrc *ci)
>>  ci->roles[role]->stop(ci);
>>  }
>>  
>> -/**
>> - * REGISTERS
>> - 
>> */
>> -/* register size */
>> -#define REG_BITS   (32)
>> -
>> -/* register indices */
>> -enum ci_hw_regs {
>> -CAP_CAPLENGTH,
>> -CAP_HCCPARAMS,
>> -CAP_DCCPARAMS,
>> -CAP_TESTMODE,
>> -CAP_LAST = CAP_TESTMODE,
>> -OP_USBCMD,
>> -OP_USBSTS,
>> -OP_USBINTR,
>> -OP_DEVICEADDR,
>> -OP_ENDPTLISTADDR,
>> -OP_PORTSC,
>> -OP_DEVLC,
>> -OP_OTGSC,
>> -OP_USBMODE,
>> -OP_ENDPTSETUPSTAT,
>> -OP_ENDPTPRIME,
>> -OP_ENDPTFLUSH,
>> -OP_ENDPTSTAT,
>> -OP_ENDPTCOMPLETE,
>> -OP_ENDPTCTRL,
>> -/* endptctrl1..15 follow */
>> -OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
>> -};
>> -
> 
> Have you changed enum ci_hw_regs? If not, please delete above diff.
> Meanwhile, you can help delete "#define REG_BITS   (32) which"
> seems no one uses it.

I need to move the enum, because OP_LAST is needed in the struct hw_bank
now. I'll delete the REG_BITS.

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 2/2] usb: chipidea: mark register map as "const" and convert to u8

2013-12-06 Thread Marc Kleine-Budde
On 12/06/2013 07:49 AM, Peter Chen wrote:
> On Thu, Dec 05, 2013 at 12:32:57PM +0100, Marc Kleine-Budde wrote:
>> This patch makes the controller register map ci_regs_nolpm and ci_regs_lpm as
>> "const". Further, as all offset fit into a single byte, the type is changed
>> from uintptr_t to u8.
>>
>> Signed-off-by: Marc Kleine-Budde 
>> ---
>>  drivers/usb/chipidea/core.c | 80 
>> ++---
>>  1 file changed, 40 insertions(+), 40 deletions(-)
>>
>> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
>> index 02929ee..dae16b3 100644
>> --- a/drivers/usb/chipidea/core.c
>> +++ b/drivers/usb/chipidea/core.c
>> @@ -75,48 +75,48 @@
>>  #include "otg.h"
>>  
>>  /* Controller register map */
>> -static uintptr_t ci_regs_nolpm[] = {
>> -[CAP_CAPLENGTH] = 0x000UL,
>> -[CAP_HCCPARAMS] = 0x008UL,
>> -[CAP_DCCPARAMS] = 0x024UL,
>> -[CAP_TESTMODE]  = 0x038UL,
>> -[OP_USBCMD] = 0x000UL,
>> -[OP_USBSTS] = 0x004UL,
>> -[OP_USBINTR]= 0x008UL,
>> -[OP_DEVICEADDR] = 0x014UL,
>> -[OP_ENDPTLISTADDR]  = 0x018UL,
>> -[OP_PORTSC] = 0x044UL,
>> -[OP_DEVLC]  = 0x084UL,
>> -[OP_OTGSC]  = 0x064UL,
>> -[OP_USBMODE]= 0x068UL,
>> -[OP_ENDPTSETUPSTAT] = 0x06CUL,
>> -[OP_ENDPTPRIME] = 0x070UL,
>> -[OP_ENDPTFLUSH] = 0x074UL,
>> -[OP_ENDPTSTAT]  = 0x078UL,
>> -[OP_ENDPTCOMPLETE]  = 0x07CUL,
>> -[OP_ENDPTCTRL]  = 0x080UL,
>> +static const u8 ci_regs_nolpm[] = {
>> +[CAP_CAPLENGTH] = 0x00U,
>> +[CAP_HCCPARAMS] = 0x08U,
>> +[CAP_DCCPARAMS] = 0x24U,
>> +[CAP_TESTMODE]  = 0x38U,
>> +[OP_USBCMD] = 0x00U,
>> +[OP_USBSTS] = 0x04U,
>> +[OP_USBINTR]= 0x08U,
>> +[OP_DEVICEADDR] = 0x14U,
>> +[OP_ENDPTLISTADDR]  = 0x18U,
>> +[OP_PORTSC] = 0x44U,
>> +[OP_DEVLC]  = 0x84U,
>> +[OP_OTGSC]  = 0x64U,
>> +[OP_USBMODE]= 0x68U,
>> +[OP_ENDPTSETUPSTAT] = 0x6CU,
>> +[OP_ENDPTPRIME] = 0x70U,
>> +[OP_ENDPTFLUSH] = 0x74U,
>> +[OP_ENDPTSTAT]  = 0x78U,
>> +[OP_ENDPTCOMPLETE]  = 0x7CU,
>> +[OP_ENDPTCTRL]  = 0x80U,
>>  };
>>  
>> -static uintptr_t ci_regs_lpm[] = {
>> -[CAP_CAPLENGTH] = 0x000UL,
>> -[CAP_HCCPARAMS] = 0x008UL,
>> -[CAP_DCCPARAMS] = 0x024UL,
>> -[CAP_TESTMODE]  = 0x0FCUL,
>> -[OP_USBCMD] = 0x000UL,
>> -[OP_USBSTS] = 0x004UL,
>> -[OP_USBINTR]= 0x008UL,
>> -[OP_DEVICEADDR] = 0x014UL,
>> -[OP_ENDPTLISTADDR]  = 0x018UL,
>> -[OP_PORTSC] = 0x044UL,
>> -[OP_DEVLC]  = 0x084UL,
>> -[OP_OTGSC]  = 0x0C4UL,
>> -[OP_USBMODE]= 0x0C8UL,
>> -[OP_ENDPTSETUPSTAT] = 0x0D8UL,
>> -[OP_ENDPTPRIME] = 0x0DCUL,
>> -[OP_ENDPTFLUSH] = 0x0E0UL,
>> -[OP_ENDPTSTAT]  = 0x0E4UL,
>> -[OP_ENDPTCOMPLETE]  = 0x0E8UL,
>> -[OP_ENDPTCTRL]  = 0x0ECUL,
>> +static const u8 ci_regs_lpm[] = {
>> +[CAP_CAPLENGTH] = 0x00U,
>> +[CAP_HCCPARAMS] = 0x08U,
>> +[CAP_DCCPARAMS] = 0x24U,
>> +[CAP_TESTMODE]  = 0xFCU,
>> +[OP_USBCMD] = 0x00U,
>> +[OP_USBSTS] = 0x04U,
>> +[OP_USBINTR]= 0x08U,
>> +[OP_DEVICEADDR] = 0x14U,
>> +[OP_ENDPTLISTADDR]  = 0x18U,
>> +[OP_PORTSC] = 0x44U,
>> +[OP_DEVLC]  = 0x84U,
>> +[OP_OTGSC]  = 0xC4U,
>> +[OP_USBMODE]= 0xC8U,
>> +[OP_ENDPTSETUPSTAT] = 0xD8U,
>> +[OP_ENDPTPRIME] = 0xDCU,
>> +[OP_ENDPTFLUSH] = 0xE0U,
>> +[OP_ENDPTSTAT]  = 0xE4U,
>> +[OP_ENDPTCOMPLETE]  = 0xE8U,
>> +[OP_ENDPTCTRL]  = 0xECU,
>>  };
>>  
> 
> Add "const" is a good fix, but I can't see much benefit of
> change uintptr_t to u8 except reduce the kernel data segment.
> Using uintprt_t make the code easier to read as the reader
> can know it stands for pointer.

No, it's not a pointer, it's an offset that added to the address __iomem
pointer later. And it should never be used directly, it only used to
setup the regmap.

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 2/2] usb: chipidea: mark register map as "const" and convert to u8

2013-12-06 Thread Peter Chen
On Fri, Dec 06, 2013 at 10:28:12AM +0100, Marc Kleine-Budde wrote:
> On 12/06/2013 07:49 AM, Peter Chen wrote:
> > On Thu, Dec 05, 2013 at 12:32:57PM +0100, Marc Kleine-Budde wrote:
> >> This patch makes the controller register map ci_regs_nolpm and ci_regs_lpm 
> >> as
> >> "const". Further, as all offset fit into a single byte, the type is changed
> >> from uintptr_t to u8.
> >>
> >> Signed-off-by: Marc Kleine-Budde 
> >> ---
> >>  drivers/usb/chipidea/core.c | 80 
> >> ++---
> >>  1 file changed, 40 insertions(+), 40 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> >> index 02929ee..dae16b3 100644
> >> --- a/drivers/usb/chipidea/core.c
> >> +++ b/drivers/usb/chipidea/core.c
> >> @@ -75,48 +75,48 @@
> >>  #include "otg.h"
> >>  
> >>  /* Controller register map */
> >> -static uintptr_t ci_regs_nolpm[] = {
> >> -  [CAP_CAPLENGTH] = 0x000UL,
> >> -  [CAP_HCCPARAMS] = 0x008UL,
> >> -  [CAP_DCCPARAMS] = 0x024UL,
> >> -  [CAP_TESTMODE]  = 0x038UL,
> >> -  [OP_USBCMD] = 0x000UL,
> >> -  [OP_USBSTS] = 0x004UL,
> >> -  [OP_USBINTR]= 0x008UL,
> >> -  [OP_DEVICEADDR] = 0x014UL,
> >> -  [OP_ENDPTLISTADDR]  = 0x018UL,
> >> -  [OP_PORTSC] = 0x044UL,
> >> -  [OP_DEVLC]  = 0x084UL,
> >> -  [OP_OTGSC]  = 0x064UL,
> >> -  [OP_USBMODE]= 0x068UL,
> >> -  [OP_ENDPTSETUPSTAT] = 0x06CUL,
> >> -  [OP_ENDPTPRIME] = 0x070UL,
> >> -  [OP_ENDPTFLUSH] = 0x074UL,
> >> -  [OP_ENDPTSTAT]  = 0x078UL,
> >> -  [OP_ENDPTCOMPLETE]  = 0x07CUL,
> >> -  [OP_ENDPTCTRL]  = 0x080UL,
> >> +static const u8 ci_regs_nolpm[] = {
> >> +  [CAP_CAPLENGTH] = 0x00U,
> >> +  [CAP_HCCPARAMS] = 0x08U,
> >> +  [CAP_DCCPARAMS] = 0x24U,
> >> +  [CAP_TESTMODE]  = 0x38U,
> >> +  [OP_USBCMD] = 0x00U,
> >> +  [OP_USBSTS] = 0x04U,
> >> +  [OP_USBINTR]= 0x08U,
> >> +  [OP_DEVICEADDR] = 0x14U,
> >> +  [OP_ENDPTLISTADDR]  = 0x18U,
> >> +  [OP_PORTSC] = 0x44U,
> >> +  [OP_DEVLC]  = 0x84U,
> >> +  [OP_OTGSC]  = 0x64U,
> >> +  [OP_USBMODE]= 0x68U,
> >> +  [OP_ENDPTSETUPSTAT] = 0x6CU,
> >> +  [OP_ENDPTPRIME] = 0x70U,
> >> +  [OP_ENDPTFLUSH] = 0x74U,
> >> +  [OP_ENDPTSTAT]  = 0x78U,
> >> +  [OP_ENDPTCOMPLETE]  = 0x7CU,
> >> +  [OP_ENDPTCTRL]  = 0x80U,
> >>  };
> >>  
> >> -static uintptr_t ci_regs_lpm[] = {
> >> -  [CAP_CAPLENGTH] = 0x000UL,
> >> -  [CAP_HCCPARAMS] = 0x008UL,
> >> -  [CAP_DCCPARAMS] = 0x024UL,
> >> -  [CAP_TESTMODE]  = 0x0FCUL,
> >> -  [OP_USBCMD] = 0x000UL,
> >> -  [OP_USBSTS] = 0x004UL,
> >> -  [OP_USBINTR]= 0x008UL,
> >> -  [OP_DEVICEADDR] = 0x014UL,
> >> -  [OP_ENDPTLISTADDR]  = 0x018UL,
> >> -  [OP_PORTSC] = 0x044UL,
> >> -  [OP_DEVLC]  = 0x084UL,
> >> -  [OP_OTGSC]  = 0x0C4UL,
> >> -  [OP_USBMODE]= 0x0C8UL,
> >> -  [OP_ENDPTSETUPSTAT] = 0x0D8UL,
> >> -  [OP_ENDPTPRIME] = 0x0DCUL,
> >> -  [OP_ENDPTFLUSH] = 0x0E0UL,
> >> -  [OP_ENDPTSTAT]  = 0x0E4UL,
> >> -  [OP_ENDPTCOMPLETE]  = 0x0E8UL,
> >> -  [OP_ENDPTCTRL]  = 0x0ECUL,
> >> +static const u8 ci_regs_lpm[] = {
> >> +  [CAP_CAPLENGTH] = 0x00U,
> >> +  [CAP_HCCPARAMS] = 0x08U,
> >> +  [CAP_DCCPARAMS] = 0x24U,
> >> +  [CAP_TESTMODE]  = 0xFCU,
> >> +  [OP_USBCMD] = 0x00U,
> >> +  [OP_USBSTS] = 0x04U,
> >> +  [OP_USBINTR]= 0x08U,
> >> +  [OP_DEVICEADDR] = 0x14U,
> >> +  [OP_ENDPTLISTADDR]  = 0x18U,
> >> +  [OP_PORTSC] = 0x44U,
> >> +  [OP_DEVLC]  = 0x84U,
> >> +  [OP_OTGSC]  = 0xC4U,
> >> +  [OP_USBMODE]= 0xC8U,
> >> +  [OP_ENDPTSETUPSTAT] = 0xD8U,
> >> +  [OP_ENDPTPRIME] = 0xDCU,
> >> +  [OP_ENDPTFLUSH] = 0xE0U,
> >> +  [OP_ENDPTSTAT]  = 0xE4U,
> >> +  [OP_ENDPTCOMPLETE]  = 0xE8U,
> >> +  [OP_ENDPTCTRL]  = 0xECU,
> >>  };
> >>  
> > 
> > Add "const" is a good fix, but I can't see much benefit of
> > change uintptr_t to u8 except reduce the kernel data segment.
> > Using uintprt_t make the code easier to read as the reader
> > can know it stands for pointer.
> 
> No, it's not a pointer, it's an offset that added to the address __iomem
> pointer later. And it should never be used directly, it only used to
> setup the regmap.
> 

I am OK with this patch.

-- 

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 1/2] usb: chipidea: move malloced regmap directly into struct hw_bank

2013-12-06 Thread Uwe Kleine-König
Hello,

On Fri, Dec 06, 2013 at 10:21:58AM +0100, Marc Kleine-Budde wrote:
> On 12/06/2013 07:45 AM, Peter Chen wrote:
> > On Thu, Dec 05, 2013 at 12:32:56PM +0100, Marc Kleine-Budde wrote:
> >> Without this patch a seperate chunk of memory is allocated for the regmap
> >> array. As the regmap is always used it makes no sense to allocate a 
> >> seperate
> >> memory block for it, this patch moves the regmap array directly into the 
> >> struct
> >> hw_bank.
> >>
> >> Signed-off-by: Marc Kleine-Budde 
> >> ---
> >>  drivers/usb/chipidea/ci.h   | 66 
> >> ++---
> >>  drivers/usb/chipidea/core.c |  8 --
> >>  2 files changed, 33 insertions(+), 41 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> >> index 1c94fc5..ef99d91 100644
> >> --- a/drivers/usb/chipidea/ci.h
> >> +++ b/drivers/usb/chipidea/ci.h
> >> @@ -26,6 +26,38 @@
> >>  #define ENDPT_MAX  32
> >>  
> >>  
> >> /**
> >> + * REGISTERS
> >> + 
> >> */
> >> +/* register size */
> >> +#define REG_BITS   (32)
> >> +
> >> +/* register indices */
> >> +enum ci_hw_regs {
> >> +  CAP_CAPLENGTH,
> >> +  CAP_HCCPARAMS,
> >> +  CAP_DCCPARAMS,
> >> +  CAP_TESTMODE,
> >> +  CAP_LAST = CAP_TESTMODE,
> >> +  OP_USBCMD,
> >> +  OP_USBSTS,
> >> +  OP_USBINTR,
> >> +  OP_DEVICEADDR,
> >> +  OP_ENDPTLISTADDR,
> >> +  OP_PORTSC,
> >> +  OP_DEVLC,
> >> +  OP_OTGSC,
> >> +  OP_USBMODE,
> >> +  OP_ENDPTSETUPSTAT,
> >> +  OP_ENDPTPRIME,
> >> +  OP_ENDPTFLUSH,
> >> +  OP_ENDPTSTAT,
> >> +  OP_ENDPTCOMPLETE,
> >> +  OP_ENDPTCTRL,
> >> +  /* endptctrl1..15 follow */
> >> +  OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
> >> +};
> >> +
> >> +/**
> >>   * STRUCTURES
> >>   
> >> */
> >>  /**
> >> @@ -98,7 +130,7 @@ struct hw_bank {
> >>void __iomem*cap;
> >>void __iomem*op;
> >>size_t  size;
> >> -  void __iomem**regmap;
> >> +  void __iomem*regmap[OP_LAST];
> > 
> > OP_LAST + 1?
> 
> Yes. Why didn't the compiler detect the out of bounds access of the array?
I cannot find it in my C book, but IIRC for an array

sometype name[20];

in some contexts 20 is an allowed subscript (e.g. for &name[20]). Maybe
that's why gcc doesn't warn. But in general don't consider you program
to be OK just because you don't get a gcc warning :-)

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |
--
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/1] AX88179_178A: Enable the hardware pseudo header in case of the NET_IP_ALIGN equals 0

2013-12-06 Thread freddy
From: Freddy Xin 

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 
---
 drivers/net/usb/ax88179_178a.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 8e8d0fc..d84f0e0 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -473,8 +473,10 @@ static int ax88179_resume(struct usb_interface *intf)
msleep(100);
 
/* Configure RX control register => start operation */
-   tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
-   AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START | AX_RX_CTL_AP |
+   AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   if (NET_IP_ALIGN == 0)
+   tmp16 |= AX_RX_CTL_IPE;
ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
 
return usbnet_resume(intf);
@@ -599,7 +601,9 @@ static void ax88179_set_multicast(struct net_device *net)
struct ax88179_data *data = (struct ax88179_data *)dev->data;
u8 *m_filter = ((u8 *)dev->data) + 12;
 
-   data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_IPE);
+   data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB);
+   if (NET_IP_ALIGN == 0)
+   data->rxctl |= AX_RX_CTL_IPE;
 
if (net->flags & IFF_PROMISC) {
data->rxctl |= AX_RX_CTL_PRO;
@@ -1054,8 +1058,10 @@ static int ax88179_bind(struct usbnet *dev, struct 
usb_interface *intf)
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, tmp);
 
/* Configure RX control register => start operation */
-   *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
-AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START | AX_RX_CTL_AP |
+AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   if (NET_IP_ALIGN == 0)
+   *tmp16 |= AX_RX_CTL_IPE;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16);
 
*tmp = AX_MONITOR_MODE_PMETYPE | AX_MONITOR_MODE_PMEPOL |
@@ -1143,7 +1149,8 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct 
sk_buff *skb)
 
if (pkt_cnt == 0) {
/* Skip IP alignment psudo header */
-   skb_pull(skb, 2);
+   if (NET_IP_ALIGN == 0)
+   skb_pull(skb, 2);
skb->len = pkt_len;
skb_set_tail_pointer(skb, pkt_len);
skb->truesize = pkt_len + sizeof(struct sk_buff);
@@ -1154,7 +1161,8 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct 
sk_buff *skb)
ax_skb = skb_clone(skb, GFP_ATOMIC);
if (ax_skb) {
ax_skb->len = pkt_len;
-   ax_skb->data = skb->data + 2;
+   if (NET_IP_ALIGN == 0)
+   ax_skb->data = skb->data + 2;
skb_set_tail_pointer(ax_skb, pkt_len);
ax_skb->truesize = pkt_len + sizeof(struct sk_buff);
ax88179_rx_checksum(ax_skb, pkt_hdr);
@@ -1328,8 +1336,10 @@ static int ax88179_reset(struct usbnet *dev)
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, tmp);
 
/* Configure RX control register => start operation */
-   *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
-AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_START | AX_RX_CTL_AP |
+AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+   if (NET_IP_ALIGN == 0)
+   *tmp16 |= AX_RX_CTL_IPE;
ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16);
 
*tmp = AX_MONITOR_MODE_PMETYPE | AX_MONITOR_MODE_PMEPOL |
-- 
1.8.3.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 0/2] usb: chipidea: streamline regmap handling

2013-12-06 Thread Peter Chen
On Fri, Dec 06, 2013 at 10:14:33AM +0100, Marc Kleine-Budde wrote:
> On 12/06/2013 07:39 AM, Peter Chen wrote:
> > On Thu, Dec 05, 2013 at 12:32:55PM +0100, Marc Kleine-Budde wrote:
> >> Hello Peter,
> >>
> >> these patches are for your ci-for-usb-next branch. The repmap handling is
> >> streamlined and the kernel shrinks by 706 bytes on i.MX28:
> >>
> >> add/remove: 0/0 grow/shrink: 0/30 up/down: 0/-706 (-706)
> >> function old new   delta
> >> hw_wait_reg  164 160  -4
> >> hw_port_test_get  24  20  -4
> >> hw_ep_flush  132 128  -4
> >> ep_enable392 388  -4
> >> ep_disable   252 248  -4
> >> ci_otg_work  248 244  -4
> >> ci_otg_role   24  20  -4
> >> ci_hdrc_host_init148 144  -4
> >> ci_hdrc_gadget_init  736 732  -4
> >> ci_handle_vbus_change 92  88  -4
> >> isr_setup_status_complete156 148  -8
> >> hw_port_test_set  64  56  -8
> >> host_start   360 352  -8
> >> ci_udc_pullup 84  76  -8
> >> ci_hdrc_remove   100  92  -8
> >> ci_udc_wakeup172 160 -12
> >> udc_id_switch_for_host76  60 -16
> >> udc_id_switch_for_device  80  64 -16
> >> ci_hdrc_otg_destroy   92  76 -16
> >> ci_hdrc_enter_lpm204 188 -16
> >> ci_irq   264 244 -20
> >> hw_device_state  120  96 -24
> >> _ep_queue.isra  10561028 -28
> >> ci_regs_nolpm 76  19 -57
> >> ci_regs_lpm   76  19 -57
> >> hw_device_reset  416 352 -64
> >> ep_set_halt  500 436 -64
> >> hw_alloc_regmap  204 136 -68
> >> ci_hdrc_probe   15121444 -68
> >> udc_irq 32363136-100
> >>
> > 
> > Hi Marc,
> > 
> > Thanks for doing that, would you explain more why the function
> > code size can be smaller with your two patches?
> 
> In the functions one instruction (4 Bytes) is saved per register access.
> When the array is embedded into the hw_bank there is one indirection less:
> 
> For example, the original code:
>  870: e591301cldr r3, [r1, #28]
>  874: e593302cldr r3, [r3, #44]   ; 0x2c
>  878: e5932000ldr r2, [r3]
>  87c: e5d13030ldrbr3, [r1, #48]   ; 0x30
> 
> With my first patch applied:
>  7d8: e5913048ldr r3, [r1, #72]   ; 0x48
>  7dc: e5932000ldr r2, [r3]
>  7e0: e5d130b4ldrbr3, [r1, #180]  ; 0xb4
> 

Thank you for explaining it.

Peter

> With the second patch applied, we save some mem in ci_regs_nolpm and
> ci_regs_lpm, because an entry only takes 1 Byte instead of 4.
> 
> 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


[PATCH v2 0/2] usb: chipidea: streamline regmap handling

2013-12-06 Thread Marc Kleine-Budde
Hello Peter,

these patches are for your ci-for-usb-next branch. The repmap handling is
streamlined and the kernel shrinks by 706 bytes on i.MX28. Moving the regmap
into hw_bank saves on indirection instruction per register access.

add/remove: 0/0 grow/shrink: 0/30 up/down: 0/-706 (-706)
function old new   delta
hw_wait_reg  164 160  -4
hw_port_test_get  24  20  -4
hw_ep_flush  132 128  -4
ep_enable392 388  -4
ep_disable   252 248  -4
ci_otg_work  248 244  -4
ci_otg_role   24  20  -4
ci_hdrc_host_init148 144  -4
ci_hdrc_gadget_init  736 732  -4
ci_handle_vbus_change 92  88  -4
isr_setup_status_complete156 148  -8
hw_port_test_set  64  56  -8
host_start   360 352  -8
ci_udc_pullup 84  76  -8
ci_hdrc_remove   100  92  -8
ci_udc_wakeup172 160 -12
udc_id_switch_for_host76  60 -16
udc_id_switch_for_device  80  64 -16
ci_hdrc_otg_destroy   92  76 -16
ci_hdrc_enter_lpm204 188 -16
ci_irq   264 244 -20
hw_device_state  120  96 -24
_ep_queue.isra  10561028 -28
ci_regs_nolpm 76  19 -57
ci_regs_lpm   76  19 -57
hw_device_reset  416 352 -64
ep_set_halt  500 436 -64
hw_alloc_regmap  204 136 -68
ci_hdrc_probe   15121444 -68
udc_irq 32363136-100

regards,
Marc

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


[PATCH v2 2/2] usb: chipidea: mark register map as "const" and convert to u8

2013-12-06 Thread Marc Kleine-Budde
This patch makes the controller register map ci_regs_nolpm and ci_regs_lpm as
"const". Further, as all offset fit into a single byte, the type is changed
from uintptr_t to u8.

Signed-off-by: Marc Kleine-Budde 
---
no changes since v1

 drivers/usb/chipidea/core.c | 80 ++---
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 02929ee..dae16b3 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -75,48 +75,48 @@
 #include "otg.h"
 
 /* Controller register map */
-static uintptr_t ci_regs_nolpm[] = {
-   [CAP_CAPLENGTH] = 0x000UL,
-   [CAP_HCCPARAMS] = 0x008UL,
-   [CAP_DCCPARAMS] = 0x024UL,
-   [CAP_TESTMODE]  = 0x038UL,
-   [OP_USBCMD] = 0x000UL,
-   [OP_USBSTS] = 0x004UL,
-   [OP_USBINTR]= 0x008UL,
-   [OP_DEVICEADDR] = 0x014UL,
-   [OP_ENDPTLISTADDR]  = 0x018UL,
-   [OP_PORTSC] = 0x044UL,
-   [OP_DEVLC]  = 0x084UL,
-   [OP_OTGSC]  = 0x064UL,
-   [OP_USBMODE]= 0x068UL,
-   [OP_ENDPTSETUPSTAT] = 0x06CUL,
-   [OP_ENDPTPRIME] = 0x070UL,
-   [OP_ENDPTFLUSH] = 0x074UL,
-   [OP_ENDPTSTAT]  = 0x078UL,
-   [OP_ENDPTCOMPLETE]  = 0x07CUL,
-   [OP_ENDPTCTRL]  = 0x080UL,
+static const u8 ci_regs_nolpm[] = {
+   [CAP_CAPLENGTH] = 0x00U,
+   [CAP_HCCPARAMS] = 0x08U,
+   [CAP_DCCPARAMS] = 0x24U,
+   [CAP_TESTMODE]  = 0x38U,
+   [OP_USBCMD] = 0x00U,
+   [OP_USBSTS] = 0x04U,
+   [OP_USBINTR]= 0x08U,
+   [OP_DEVICEADDR] = 0x14U,
+   [OP_ENDPTLISTADDR]  = 0x18U,
+   [OP_PORTSC] = 0x44U,
+   [OP_DEVLC]  = 0x84U,
+   [OP_OTGSC]  = 0x64U,
+   [OP_USBMODE]= 0x68U,
+   [OP_ENDPTSETUPSTAT] = 0x6CU,
+   [OP_ENDPTPRIME] = 0x70U,
+   [OP_ENDPTFLUSH] = 0x74U,
+   [OP_ENDPTSTAT]  = 0x78U,
+   [OP_ENDPTCOMPLETE]  = 0x7CU,
+   [OP_ENDPTCTRL]  = 0x80U,
 };
 
-static uintptr_t ci_regs_lpm[] = {
-   [CAP_CAPLENGTH] = 0x000UL,
-   [CAP_HCCPARAMS] = 0x008UL,
-   [CAP_DCCPARAMS] = 0x024UL,
-   [CAP_TESTMODE]  = 0x0FCUL,
-   [OP_USBCMD] = 0x000UL,
-   [OP_USBSTS] = 0x004UL,
-   [OP_USBINTR]= 0x008UL,
-   [OP_DEVICEADDR] = 0x014UL,
-   [OP_ENDPTLISTADDR]  = 0x018UL,
-   [OP_PORTSC] = 0x044UL,
-   [OP_DEVLC]  = 0x084UL,
-   [OP_OTGSC]  = 0x0C4UL,
-   [OP_USBMODE]= 0x0C8UL,
-   [OP_ENDPTSETUPSTAT] = 0x0D8UL,
-   [OP_ENDPTPRIME] = 0x0DCUL,
-   [OP_ENDPTFLUSH] = 0x0E0UL,
-   [OP_ENDPTSTAT]  = 0x0E4UL,
-   [OP_ENDPTCOMPLETE]  = 0x0E8UL,
-   [OP_ENDPTCTRL]  = 0x0ECUL,
+static const u8 ci_regs_lpm[] = {
+   [CAP_CAPLENGTH] = 0x00U,
+   [CAP_HCCPARAMS] = 0x08U,
+   [CAP_DCCPARAMS] = 0x24U,
+   [CAP_TESTMODE]  = 0xFCU,
+   [OP_USBCMD] = 0x00U,
+   [OP_USBSTS] = 0x04U,
+   [OP_USBINTR]= 0x08U,
+   [OP_DEVICEADDR] = 0x14U,
+   [OP_ENDPTLISTADDR]  = 0x18U,
+   [OP_PORTSC] = 0x44U,
+   [OP_DEVLC]  = 0x84U,
+   [OP_OTGSC]  = 0xC4U,
+   [OP_USBMODE]= 0xC8U,
+   [OP_ENDPTSETUPSTAT] = 0xD8U,
+   [OP_ENDPTPRIME] = 0xDCU,
+   [OP_ENDPTFLUSH] = 0xE0U,
+   [OP_ENDPTSTAT]  = 0xE4U,
+   [OP_ENDPTCOMPLETE]  = 0xE8U,
+   [OP_ENDPTCTRL]  = 0xECU,
 };
 
 static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
-- 
1.8.4.3

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


[PATCH v2 1/2] usb: chipidea: move malloced regmap directly into struct hw_bank

2013-12-06 Thread Marc Kleine-Budde
Without this patch a seperate chunk of memory is allocated for the regmap
array. As the regmap is always used it makes no sense to allocate a seperate
memory block for it, this patch moves the regmap array directly into the struct
hw_bank.

Signed-off-by: Marc Kleine-Budde 
---
changes since v1:
- fix regmap array size (tnx Peter)
- remove REG_BITS define

 drivers/usb/chipidea/ci.h   | 63 +
 drivers/usb/chipidea/core.c |  8 --
 2 files changed, 30 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 1c94fc5..a71dc1c 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -26,6 +26,35 @@
 #define ENDPT_MAX  32
 
 /**
+ * REGISTERS
+ */
+/* register indices */
+enum ci_hw_regs {
+   CAP_CAPLENGTH,
+   CAP_HCCPARAMS,
+   CAP_DCCPARAMS,
+   CAP_TESTMODE,
+   CAP_LAST = CAP_TESTMODE,
+   OP_USBCMD,
+   OP_USBSTS,
+   OP_USBINTR,
+   OP_DEVICEADDR,
+   OP_ENDPTLISTADDR,
+   OP_PORTSC,
+   OP_DEVLC,
+   OP_OTGSC,
+   OP_USBMODE,
+   OP_ENDPTSETUPSTAT,
+   OP_ENDPTPRIME,
+   OP_ENDPTFLUSH,
+   OP_ENDPTSTAT,
+   OP_ENDPTCOMPLETE,
+   OP_ENDPTCTRL,
+   /* endptctrl1..15 follow */
+   OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
+};
+
+/**
  * STRUCTURES
  */
 /**
@@ -98,7 +127,7 @@ struct hw_bank {
void __iomem*cap;
void __iomem*op;
size_t  size;
-   void __iomem**regmap;
+   void __iomem*regmap[OP_LAST + 1];
 };
 
 /**
@@ -209,38 +238,6 @@ static inline void ci_role_stop(struct ci_hdrc *ci)
ci->roles[role]->stop(ci);
 }
 
-/**
- * REGISTERS
- */
-/* register size */
-#define REG_BITS   (32)
-
-/* register indices */
-enum ci_hw_regs {
-   CAP_CAPLENGTH,
-   CAP_HCCPARAMS,
-   CAP_DCCPARAMS,
-   CAP_TESTMODE,
-   CAP_LAST = CAP_TESTMODE,
-   OP_USBCMD,
-   OP_USBSTS,
-   OP_USBINTR,
-   OP_DEVICEADDR,
-   OP_ENDPTLISTADDR,
-   OP_PORTSC,
-   OP_DEVLC,
-   OP_OTGSC,
-   OP_USBMODE,
-   OP_ENDPTSETUPSTAT,
-   OP_ENDPTPRIME,
-   OP_ENDPTFLUSH,
-   OP_ENDPTSTAT,
-   OP_ENDPTCOMPLETE,
-   OP_ENDPTCTRL,
-   /* endptctrl1..15 follow */
-   OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
-};
-
 /**
  * hw_read: reads from a hw register
  * @reg:  register index
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 5075407..02929ee 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -123,13 +123,6 @@ static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
 {
int i;
 
-   kfree(ci->hw_bank.regmap);
-
-   ci->hw_bank.regmap = kzalloc((OP_LAST + 1) * sizeof(void *),
-GFP_KERNEL);
-   if (!ci->hw_bank.regmap)
-   return -ENOMEM;
-
for (i = 0; i < OP_ENDPTCTRL; i++)
ci->hw_bank.regmap[i] =
(i <= CAP_LAST ? ci->hw_bank.cap : ci->hw_bank.op) +
@@ -677,7 +670,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
ci_role_destroy(ci);
ci_hdrc_enter_lpm(ci, true);
ci_usb_phy_destroy(ci);
-   kfree(ci->hw_bank.regmap);
 
return 0;
 }
-- 
1.8.4.3

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


[PATCH v4 6/9] phy: Add support for S5PV210 to the Exynos USB PHY driver

2013-12-06 Thread Kamil Debski
From: Mateusz Krawczuk 

Add support for the Samsung's S5PV210 SoC to the Exynos USB PHY driver.

Signed-off-by: Mateusz Krawczuk 
[k.deb...@samsung.com: cleanup and commit description]
[k.deb...@samsung.com: make changes accordingly to the mailing list
comments]
Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 .../devicetree/bindings/phy/samsung-usbphy.txt |1 +
 drivers/phy/Kconfig|7 +
 drivers/phy/Makefile   |1 +
 drivers/phy/phy-s5pv210-usb2.c |  206 
 drivers/phy/phy-samsung-usb2.c |6 +
 drivers/phy/phy-samsung-usb2.h |1 +
 6 files changed, 222 insertions(+)
 create mode 100644 drivers/phy/phy-s5pv210-usb2.c

diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
index cadbf70..77a8e9c 100644
--- a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
@@ -3,6 +3,7 @@ Samsung S5P/EXYNOS SoC series USB PHY
 
 Required properties:
 - compatible : should be one of the listed compatibles:
+   - "samsung,s5pv210-usb2-phy"
- "samsung,exynos4210-usb2-phy"
- "samsung,exynos4212-usb2-phy"
 - reg : a list of registers used by phy driver
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index b29018f..2e433cd 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -58,6 +58,13 @@ config PHY_SAMSUNG_USB2
  This driver provides common interface to interact, for Samsung
  USB 2.0 PHY driver.
 
+config PHY_S5PV210_USB2
+   bool "Support for S5PV210"
+   depends on PHY_SAMSUNG_USB2
+   depends on ARCH_S5PV210
+   help
+ Enable USB PHY support for S5PV210
+
 config PHY_EXYNOS4210_USB2
bool "Support for Exynos 4210"
depends on PHY_SAMSUNG_USB2
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9f4befd..fefc6c2 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -8,5 +8,6 @@ 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_S5PV210_USB2) += phy-s5pv210-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-s5pv210-usb2.c b/drivers/phy/phy-s5pv210-usb2.c
new file mode 100644
index 000..528a114
--- /dev/null
+++ b/drivers/phy/phy-s5pv210-usb2.c
@@ -0,0 +1,206 @@
+/*
+ * Samsung SoC USB 1.1/2.0 PHY driver - S5PV210 support
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Authors: Kamil Debski 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "phy-samsung-usb2.h"
+
+/* Exynos USB PHY registers */
+
+/* PHY power control */
+#define S5PV210_UPHYPWR0x0
+
+#define S5PV210_UPHYPWR_PHY0_SUSPEND   (1 << 0)
+#define S5PV210_UPHYPWR_PHY0_PWR   (1 << 3)
+#define S5PV210_UPHYPWR_PHY0_OTG_PWR   (1 << 4)
+#define S5PV210_UPHYPWR_PHY0   ( \
+   S5PV210_UPHYPWR_PHY0_SUSPEND | \
+   S5PV210_UPHYPWR_PHY0_PWR | \
+   S5PV210_UPHYPWR_PHY0_OTG_PWR)
+
+#define S5PV210_UPHYPWR_PHY1_SUSPEND   (1 << 6)
+#define S5PV210_UPHYPWR_PHY1_PWR   (1 << 7)
+#define S5PV210_UPHYPWR_PHY1 ( \
+   S5PV210_UPHYPWR_PHY1_SUSPEND | \
+   S5PV210_UPHYPWR_PHY1_PWR)
+
+/* PHY clock control */
+#define S5PV210_UPHYCLK0x4
+
+#define S5PV210_UPHYCLK_PHYFSEL_MASK   (0x3 << 0)
+#define S5PV210_UPHYCLK_PHYFSEL_48MHZ  (0x0 << 0)
+#define S5PV210_UPHYCLK_PHYFSEL_24MHZ  (0x3 << 0)
+#define S5PV210_UPHYCLK_PHYFSEL_12MHZ  (0x2 << 0)
+
+#define S5PV210_UPHYCLK_PHY0_ID_PULLUP (0x1 << 2)
+#define S5PV210_UPHYCLK_PHY0_COMMON_ON (0x1 << 4)
+#define S5PV210_UPHYCLK_PHY1_COMMON_ON (0x1 << 7)
+
+/* PHY reset control */
+#define S5PV210_UPHYRST0x8
+
+#define S5PV210_URSTCON_PHY0   (1 << 0)
+#define S5PV210_URSTCON_OTG_HLINK  (1 << 1)
+#define S5PV210_URSTCON_OTG_PHYLINK(1 << 2)
+#define S5PV210_URSTCON_PHY1_ALL   (1 << 3)
+#define S5PV210_URSTCON_HOST_LINK_ALL  (1 << 4)
+
+/* Isolation, configured in the power management unit */
+#define S5PV210_USB_ISOL_DEVICE_OFFSET 0x704
+#define S5PV210_USB_ISOL_DEVICE(1 << 0)
+#define S5PV210_USB_ISOL_HOST_OFFSET   0x708
+#define S5PV210_USB_ISOL_HOST  (1 << 1)
+
+
+enum s5pv210_phy_id {
+   S5PV210_DEVICE,
+   S5PV210

[PATCH v4 7/9] phy: Add Exynos 5250 support to the Exynos USB 2.0 PHY driver

2013-12-06 Thread Kamil Debski
Add support for Exynos 5250. This driver is to replace the old
USB 2.0 PHY driver.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 .../devicetree/bindings/phy/samsung-usbphy.txt |1 +
 drivers/phy/Kconfig|8 +
 drivers/phy/Makefile   |1 +
 drivers/phy/phy-exynos5250-usb2.c  |  363 
 drivers/phy/phy-samsung-usb2.c |6 +
 drivers/phy/phy-samsung-usb2.h |1 +
 6 files changed, 380 insertions(+)
 create mode 100644 drivers/phy/phy-exynos5250-usb2.c

diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt 
b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
index 77a8e9c..94096fc 100644
--- a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
@@ -6,6 +6,7 @@ Required properties:
- "samsung,s5pv210-usb2-phy"
- "samsung,exynos4210-usb2-phy"
- "samsung,exynos4212-usb2-phy"
+   - "samsung,exynos5250-usb2-phy"
 - reg : a list of registers used by phy driver
- first and obligatory is the location of phy modules registers
 - samsung,sysreg-phandle - handle to syscon used to control the system 
registers
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 2e433cd..74e9064 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -78,4 +78,12 @@ config PHY_EXYNOS4212_USB2
depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412)
help
  Enable USB PHY support for Exynos 4212
+
+config PHY_EXYNOS5250_USB2
+   bool "Support for Exynos 5250"
+   depends on PHY_SAMSUNG_USB2
+   depends on SOC_EXYNOS5250
+   help
+ Enable USB PHY support for Exynos 5250
+
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index fefc6c2..33c3ac1 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_PHY_SAMSUNG_USB2)+= 
phy-samsung-usb2.o
 obj-$(CONFIG_PHY_S5PV210_USB2) += phy-s5pv210-usb2.o
 obj-$(CONFIG_PHY_EXYNOS4210_USB2)  += phy-exynos4210-usb2.o
 obj-$(CONFIG_PHY_EXYNOS4212_USB2)  += phy-exynos4212-usb2.o
+obj-$(CONFIG_PHY_EXYNOS5250_USB2)  += phy-exynos5250-usb2.o
diff --git a/drivers/phy/phy-exynos5250-usb2.c 
b/drivers/phy/phy-exynos5250-usb2.c
new file mode 100644
index 000..7aeebc8
--- /dev/null
+++ b/drivers/phy/phy-exynos5250-usb2.c
@@ -0,0 +1,363 @@
+/*
+ * Samsung SoC USB 1.1/2.0 PHY driver - Exynos 5250 support
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Kamil Debski 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "phy-samsung-usb2.h"
+
+/* Exynos USB PHY registers */
+#define EXYNOS_5250_REFCLKSEL_CRYSTAL  0x0
+#define EXYNOS_5250_REFCLKSEL_XO   0x1
+#define EXYNOS_5250_REFCLKSEL_CLKCORE  0x2
+
+#define EXYNOS_5250_FSEL_9MHZ6 0x0
+#define EXYNOS_5250_FSEL_10MHZ 0x1
+#define EXYNOS_5250_FSEL_12MHZ 0x2
+#define EXYNOS_5250_FSEL_19MHZ20x3
+#define EXYNOS_5250_FSEL_20MHZ 0x4
+#define EXYNOS_5250_FSEL_24MHZ 0x5
+#define EXYNOS_5250_FSEL_50MHZ 0x7
+
+/* Normal host */
+#define EXYNOS_5250_HOSTPHYCTRL0   0x0
+
+#define EXYNOS_5250_HOSTPHYCTRL0_PHYSWRSTALL   (0x1 << 31)
+#define EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_SHIFT   19
+#define EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_MASK\
+   (0x3 << EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_SHIFT)
+#define EXYNOS_5250_HOSTPHYCTRL0_FSEL_SHIFT16
+#define EXYNOS_5250_HOSTPHYCTRL0_FSEL_MASK \
+   (0x7 << EXYNOS_5250_HOSTPHYCTRL0_FSEL_SHIFT)
+#define EXYNOS_5250_HOSTPHYCTRL0_TESTBURNIN(0x1 << 11)
+#define EXYNOS_5250_HOSTPHYCTRL0_RETENABLE (0x1 << 10)
+#define EXYNOS_5250_HOSTPHYCTRL0_COMMON_ON_N   (0x1 << 9)
+#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_MASK(0x3 << 7)
+#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_DUAL(0x0 << 7)
+#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_ID0 (0x1 << 7)
+#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_ANALOGTEST  (0x2 << 7)
+#define EXYNOS_5250_HOSTPHYCTRL0_SIDDQ (0x1 << 6)
+#define EXYNOS_5250_HOSTPHYCTRL0_FORCESLEEP(0x1 << 5)
+#define EXYNOS_5250_HOSTPHYCTRL0_FORCESUSPEND  (0x1 << 4)
+#define EXYNOS_5250_HOSTPHYCTRL0_WORDINTERFACE (0x1 << 3)
+#define EXYNOS_5250_HOSTPHYCTRL0_UTMISWRST (0x1 << 2)
+#define EXYNOS_5250_HOSTPHYCTRL0_LINKSWRST (0x1 << 1)
+#define EXYNOS_5250_HOSTPHYCTRL0_PHYSWRST  (0x1 << 0)
+
+/* HSIC0 & HSCI1 */
+#define EXYNOS_5250_HOSTPHYCTRL1

[PATCH 8/9] dts: Add usb2phy to Exynos 4

2013-12-06 Thread Kamil Debski
Add support of new USB 2.0 phy driver to Exynos 4 SoC device tree.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 .../devicetree/bindings/arm/samsung/pmu.txt|2 ++
 arch/arm/boot/dts/exynos4.dtsi |   31 
 arch/arm/boot/dts/exynos4210.dtsi  |   17 +++
 arch/arm/boot/dts/exynos4x12.dtsi  |   17 +++
 4 files changed, 67 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/samsung/pmu.txt 
b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
index 307e727..bfccab0 100644
--- a/Documentation/devicetree/bindings/arm/samsung/pmu.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/pmu.txt
@@ -3,6 +3,8 @@ SAMSUNG Exynos SoC series PMU Registers
 Properties:
  - name : should be 'syscon';
  - compatible : should contain two values. First value must be one from 
following list:
+  - "samsung,exynos4210-pmu" - for Exynos4210 SoC,
+  - "samsung,exynos4212-pmu" - for Exynos4212 SoC,
   - "samsung,exynos5250-pmu" - for Exynos5250 SoC,
   - "samsung,exynos5420-pmu" - for Exynos5420 SoC.
second value must be always "syscon".
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a73eeb5..031d07a 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -253,6 +253,17 @@
status = "disabled";
};
 
+   usbotg@1248 {
+   compatible = "samsung,s3c6400-hsotg";
+   reg = <0x1248 0x2>;
+   interrupts = <0 71 0>;
+   clocks = <&clock 305>;
+   clock-names = "otg";
+   phys = <&usb2phy 0>;
+   phy-names = "usb2-phy";
+   status = "disabled";
+   };
+
ehci@1258 {
compatible = "samsung,exynos4210-ehci";
reg = <0x1258 0x100>;
@@ -260,6 +271,26 @@
clocks = <&clock 304>;
clock-names = "usbhost";
status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   phys = <&usb2phy 1>;
+   phy-names = "host";
+   reg = <0>;
+   status = "disabled";
+   };
+   port@1 {
+   phys = <&usb2phy 2>;
+   phy-names = "hsic0";
+   reg = <1>;
+   status = "disabled";
+   };
+   port@2 {
+   phys = <&usb2phy 3>;
+   phy-names = "hsic1";
+   reg = <2>;
+   status = "disabled";
+   };
};
 
ohci@1259 {
diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 057d682..f9d06bb 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -155,4 +155,21 @@
samsung,lcd-wb;
};
};
+
+   pmu_reg: syscon@1002 {
+   compatible = "samsung,exynos4210-pmu", "syscon";
+   reg = <0x1002 0x4000>;
+   };
+
+   usb2phy: phy@125B {
+   compatible = "samsung,exynos4210-usb2-phy";
+   reg = <0x125B 0x100>;
+   clocks = <&clock 305>, <&clock 2>, <&clock 2>, <&clock 2>,
+   <&clock 2>;
+   clock-names = "phy", "device", "host", "hsic0", "hsic1";
+   status = "disabled";
+   #phy-cells = <1>;
+   samsung,sysreg-phandle = <&sys_reg>;
+   samsung,pmureg-phandle = <&pmu_reg>;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi 
b/arch/arm/boot/dts/exynos4x12.dtsi
index ad531fe..712 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -176,4 +176,21 @@
};
};
};
+
+   pmu_reg: syscon@1002 {
+   compatible = "samsung,exynos4212-pmu", "syscon";
+   reg = <0x1002 0x4000>;
+   };
+
+   usb2phy: phy@125B {
+   compatible = "samsung,exynos4212-usb2-phy";
+   reg = <0x125B 0x100>;
+   clocks = <&clock 305>, <&clock 2>, <&clock 2>, <&clock 2>,
+   <&clock 2>;
+   clock-names = "phy", "device", "host", "hsic0", "hsic1";
+   status = "disabled";
+   #phy-cells = <1>;
+   samsung,sysreg-phandle = <&sys_reg>;
+   samsung,pmureg-phandle = <&pmu_reg>;
+   };
 };
-- 
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 in

[PATCH 9/9] dts: Add usb2phy to Exynos 5250

2013-12-06 Thread Kamil Debski
Add support of new USB 2.0 phy driver to the Exynos 5250 SoC device tree.

Signed-off-by: Kamil Debski 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/exynos5250.dtsi |   33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 2f264ad..922e0ed 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -163,6 +163,11 @@
interrupts = <0 47 0>;
};
 
+   sys_syscon: syscon@1004 {
+   compatible = "samsung,exynos5250-sys", "syscon";
+   reg = <0x1005 0x5000>;
+   };
+
pmu_syscon: syscon@1004 {
compatible = "samsung,exynos5250-pmu", "syscon";
reg = <0x1004 0x5000>;
@@ -505,6 +510,14 @@
 
clocks = <&clock 285>;
clock-names = "usbhost";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   phys = <&usb2_phy 1>;
+   phy-names = "host";
+   status = "ok";
+   };
};
 
usb@1212 {
@@ -516,19 +529,15 @@
clock-names = "usbhost";
};
 
-   usb2_phy: usbphy@1213 {
-   compatible = "samsung,exynos5250-usb2phy";
+   usb2_phy: phy@1213 {
+   compatible = "samsung,exynos5250-usb2-phy";
reg = <0x1213 0x100>;
-   clocks = <&clock 1>, <&clock 285>;
-   clock-names = "ext_xtal", "usbhost";
-   #address-cells = <1>;
-   #size-cells = <1>;
-   ranges;
-
-   usbphy-sys {
-   reg = <0x10040704 0x8>,
- <0x10050230 0x4>;
-   };
+   clocks = <&clock 285>, <&clock 1>, <&clock 1>, <&clock 1>,
+   <&clock 1>;
+   clock-names = "phy", "device", "host", "hsic0", "hsic1";
+   #phy-cells = <1>;
+   samsung,sysreg-phandle = <&sys_syscon>;
+   samsung,pmureg-phandle = <&pmu_syscon>;
};
 
amba {
-- 
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 v4 0/9] phy: Add new Exynos USB 2.0 PHY driver

2013-12-06 Thread Kamil Debski
Hi,

> From: Kishon Vijay Abraham I [mailto:kis...@ti.com]
> Sent: Thursday, December 05, 2013 4:07 PM
> 
> Hi,
> 
> On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
> > Hi,
> >
> > This is the fourth version of the patchset adding the new Exynos USB
> > 2.0 PHY driver. The driver uses the Generic PHY Framework.
> >
> > A month has passed since the last version. I have addressed numerous
> > comments that appeared on the mailing list in this patch. I would
> like
> > to specially thank Kishon, Tomasz, Matt and Vivek for their comments.
> >
> > This patch contains two necessary patches to the phy core.
> > It is very useful to be able to get phy using a device tree node.
> >
> > In addition this patch depends on:
> > [PATCH V11 1/3] ARM: dts: Add pmu sysreg node to exynos5250 and
> > exynos5420 dtsi files [1].
> >
> > Best wishes,
> > Kamil Debski
> 
> The last four patches are missing [1]

I am sorry, git send-email failed on the 6th patch thus that and the
Following patches were not sent. I guess it is the Murphy's law,
sending patches just before leaving office had high chances of such
a mishap.

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland
 
> [1] -> https://lkml.org/lkml/2013/12/5/166
> 
> Thanks
> Kishon
> >
> > [1] - http://www.spinics.net/lists/linux-samsung-soc/msg24528.html
> >
> > 
> > Changes from v3:
> > - using PMU and system registers indirectly via syscon
> > - change labelling
> > - change Kconfig name
> > - fixed typos/stray whitespace
> > - move of_phy_provider_register() to the end of probe
> > - add a regular error return code to the rate_to_clk functions
> > - cleanup code and remove unused code
> > - change struct names to avoid collisions
> > - add mechanism to support multiple phys by the ehci driver
> >
> > 
> > Changes from v2:
> > - rebase all patches to the usb-next branch
> > - fixes in the documentation file
> >   - remove wrong entries in the phy node (ranges, and #address- &
> #size-cells)
> >   - add clocks and clock-names as required properites
> >   - rephrase a few sentences
> > - fixes in the ehci-exynos.c file
> >   - move phy_name variable next to phy in exynos_ehci_hcd
> >   - remove otg from exynos_ehci_hcd as it was no longer used
> >   - move devm_phy_get after the Exynos5440 skip_phy check
> > - fixes in the s3c-hsotg.c file
> >   - cosmetic fixes (remove empty line that was wrongfully added)
> > - fixes in the main driver
> >   - remove cpu_type in favour for a boolean flag matched with the
> compatible
> > value
> >   - rename files, structures, variables and Kconfig entires - change
> from simple
> > "uphy" to "usb2_phy"
> >   - fix multiline comments style
> >   - simplify #ifdefs in of_device_id
> >   - fix Kconfig description
> >   - change dev_info to dev_dbg where reasonable
> >   - cosmetic changes (remove wrongful blank lines)
> >   - remove unnecessary reference counting
> >
> > 
> > Changes from v1:
> > - the changes include minor fixes of the hardware initialization of
> the PHY
> >   module
> > - some other minor fixes were introduced
> >
> > --
> > Original cover letter:
> >
> > Hi,
> >
> > This patch adds a new drive for USB PHYs for Samsung SoCs. The driver
> > is using the Generic PHY Framework created by Kishon Vijay Abrahan I.
> > It can be found here https://lkml.org/lkml/2013/8/21/29. This patch
> > adds support to Exynos4 family of SoCs. Support for Exynos3 and
> > Exynos5 is planned to be added in the near future.
> >
> > I welcome your comments.
> >
> > --
> >
> > [1] https://lkml.org/lkml/2013/8/21/29
> >
> >
> > Kamil Debski (8):
> >   phy: core: Change the way of_phy_get is called
> >   phy: core: Add devm_of_phy_get to phy-core
> >   phy: Add new Exynos USB PHY driver
> >   usb: ehci-s5p: Change to use phy provided by the generic phy
> > framework
> >   usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic
> > phy framework
> >   phy: Add Exynos 5250 support to the Exynos USB 2.0 PHY driver
> >   dts: Add usb2phy to Exynos 4
> >   dts: Add usb2phy to Exynos 5250
> >
> > Mateusz Krawczuk (1):
> >   phy: Add support for S5PV210 to the Exynos USB PHY driver
> >
> >  .../devicetree/bindings/arm/samsung/pmu.txt|2 +
> >  .../devicetree/bindings/phy/samsung-usbphy.txt |   56 +++
> >  .../devicetree/bindings/usb/samsung-hsotg.txt  |4 +
> >  Documentation/devicetree/bindings/usb/usb-ehci.txt |   35 ++
> >  arch/arm/boot/dts/exynos4.dtsi |   31 ++
> >  arch/arm/boot/dts/exynos4210.dtsi  |   17 +
> >  arch/arm/boot/dts/exynos4x12.dtsi  |   17 +
> >  arch/arm/boot/dts/exynos5250.dtsi  |   33 +-
> >  drivers/phy/Kconfig|   35 ++
> >  drivers/phy/Makefile   |5 +
> >  drivers/phy/phy-core.c |   43 ++-
> >  drivers/phy/phy-exynos42

RE: [PATCH 1/9] phy: core: Change the way of_phy_get is called

2013-12-06 Thread Kamil Debski
Hi,

> From: Kishon Vijay Abraham I [mailto:kis...@ti.com]
> Sent: Friday, December 06, 2013 6:31 AM
> 
> Hi,
> 
> On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
> > Previously the of_phy_get function took a struct device * and was
> > declared static. It was impossible to call it from another driver and
> > thus it was impossible to get phy defined
> 
> It was never intended to be called from other drivers. What's up with
> the wrapper of of_phy_get, phy_get()/devm_phy_get()? Why isn't that
> enough?

Implementing support for multiple phys in the ehci driver is a bit tricky.
Especially when we want to do it right. Please have a look at this part of
the dts file:

+ehci@1258 {
+compatible = "samsung,exynos4210-ehci";
+reg = <0x1258 0x2>;
+interrupts = <0 70 0>;
+clocks = <&clock 304>, <&clock 305>;
+clock-names = "usbhost", "otg";
+status = "disabled";
+#address-cells = <1>;
+#size-cells = <0>;
+port@0 {
+reg = <0>;
+phys = <&usb2phy 1>;
+phy-names = "host";
+status = "disabled";
+};
+port@1 {
+reg = <1>;
+phys = <&usb2phy 2>;
+phy-names = "hsic0";
+status = "disabled";
+};
+port@2 {
+reg = <2>;
+phys = <&usb2phy 3>;
+phy-names = "hsic1";
+status = "disabled";
+};
+};

With the above we have a clear specification of ports and their respective
phys. But to do this properly the ehci driver has to iterate over port
nodes. It is much easier to use devm_of_phy_get by giving the node as its
argument.

[snip]

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland


--
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-06 Thread Kishon Vijay Abraham I
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 
> Signed-off-by: Kyungmin Park 
> ---
>  .../devicetree/bindings/phy/samsung-usbphy.txt |   54 
>  drivers/phy/Kconfig|   20 ++
>  drivers/phy/Makefile   |3 +
>  drivers/phy/phy-exynos4210-usb2.c  |  264 +
>  drivers/phy/phy-exynos4212-usb2.c  |  312 
> 
>  drivers/phy/phy-samsung-usb2.c |  228 ++
>  drivers/phy/phy-samsung-usb2.h |   72 +
>  7 files changed, 953 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/samsung-usbphy.txt
>  create mode 100644 drivers/phy/phy-exynos4210-usb2.c
>  create mode 100644 drivers/phy/phy-exynos4212-usb2.c
>  create mode 100644 drivers/phy/phy-samsung-usb2.c
>  create mode 100644 drivers/phy/phy-samsung-usb2.h
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt 
> b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> new file mode 100644
> index 000..cadbf70
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt

use the existing samsung-phy.txt.
> @@ -0,0 +1,54 @@
> +Samsung S5P/EXYNOS SoC series USB PHY
> +-
> +
> +Required properties:
> +- compatible : should be one of the listed compatibles:
> + - "samsung,exynos4210-usb2-phy"
> + - "samsung,exynos4212-usb2-phy"
> +- reg : a list of registers used by phy driver
> + - first and obligatory is the location of phy modules registers
> +- samsung,sysreg-phandle - handle to syscon used to control the system 
> registers
> +- samsung,pmureg-phandle - handle to syscon used to control PMU registers
> +- #phy-cells : from the generic phy bindings, must be 1;
> +- clocks and clock-names:
> + - the "phy" clocks is required by the phy module
> + - next for each of the phys a clock has to be assidned, this clock

%s/assidned/assigned/
> +   will be used to determine clocking frequency for the phys
> +   (the labels are specified in the paragraph below)
> +
> +The first phandle argument in the PHY specifier identifies the PHY, its
> +meaning is compatible dependent. For the currently supported SoCs (Exynos 
> 4210
> +and Exynos 4212) it is as follows:
> +  0 - USB device ("device"),
> +  1 - USB host ("host"),
> +  2 - HSIC0 ("hsic0"),
> +  3 - HSIC1 ("hsic1"),
> +
> +Exynos 4210 and Exynos 4212 use mode switching and require that mode switch
> +register is supplied.
> +
> +Example:
> +
> +For Exynos 4412 (compatible with Exynos 4212):
> +
> +usbphy: phy@125B {

use lower case for address here...
> + compatible = "samsung,exynos4212-usb2-phy";
> + reg = <0x125B 0x100 0x10020704 0x0c 0x1001021c 0x4>;
and here..
> + clocks = <&clock 305>, <&clock 2>, <&clock 2>, <&clock 2>,
> + <&clock 2>;
> + clock-names = "phy", "device", "host", "hsic0", "hsic1";
> + status = "okay";
> + #phy-cells = <1>;
> + samsung,sysreg-phandle = <&sys_reg>;
> + samsung,pmureg-phandle = <&pmu_reg>;
> +};
> +
> +Then the PHY can be used in other nodes such as:
> +
> +phy-consumer@1234 {
> + phys = <&usbphy 2>;
> + phy-names = "phy";
> +};
> +
> +Refer to DT bindings documentation of particular PHY consumer devices for 
> more
> +information about required PHYs and the way of specification.
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index a344f3d..b29018f 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -51,4 +51,24 @@ config PHY_EXYNOS_DP_VIDEO
>   help
> Support for Display Port PHY found on Samsung EXYNOS SoCs.
>  
> +config PHY_SAMSUNG_USB2
> + tristate "Samsung USB 2.0 PHY driver"
> + help
> +   Enable this to support Samsung USB phy helper driver for Samsung SoCs.
> +   This driver provides common interface to interact, for Samsung
> +   USB 2.0 PHY driver.
> +
> +config PHY_EXYNOS4210_USB2
> + bool "Support for Exynos 4210"
> + depends on PHY_SAMSUNG_USB2
> + depends on CPU_EXYNOS4210

select GENERIC_PHY here?
> + help
> +   Enable USB PHY support for Exynos 4210

Add more explanation here and make checkpatch happy.
> +
> +config PHY_EXYNOS4212_USB2
> + bool "Support for Exynos 4212"
> + depends on PHY_SAMSUNG_USB2
> + depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412)

select GENERIC_PHY.
> + help
> +   Enable USB PHY support for Exynos 4212

more explanation here too..
>  endmenu
> 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 @@ ob

Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework

2013-12-06 Thread Kishon Vijay Abraham I
Hi,

On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
> Change the used phy driver to the new Exynos USB phy driver that uses the
> generic phy framework.
> 
> Signed-off-by: Kamil Debski 
> Signed-off-by: Kyungmin Park 
> ---
>  .../devicetree/bindings/usb/samsung-hsotg.txt  |4 
>  drivers/usb/gadget/s3c-hsotg.c |   11 ++-
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt 
> b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> index b83d428..9340d06 100644
> --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> @@ -24,6 +24,8 @@ Required properties:
>  - first entry: must be "otg"
>  - vusb_d-supply: phandle to voltage regulator of digital section,
>  - vusb_a-supply: phandle to voltage regulator of analog section.
> +- phys: from general PHY binding: phandle to the PHY device
> +- phy-names: from general PHY binding: should be "usb2-phy"

are you sure it's usb2-phy. The example below seems to have a different value.

Thanks
Kishon

>  
>  Example
>  -
> @@ -36,5 +38,7 @@ Example
>   clock-names = "otg";
>   vusb_d-supply = <&vusb_reg>;
>   vusb_a-supply = <&vusbdac_reg>;
> + phys = <&usb2phy 0>;
> + phy-names = "device";
>   };
>  
> diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
> index eccb147..db096fd 100644
> --- a/drivers/usb/gadget/s3c-hsotg.c
> +++ b/drivers/usb/gadget/s3c-hsotg.c
> @@ -31,6 +31,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -162,7 +163,7 @@ struct s3c_hsotg_ep {
>  struct s3c_hsotg {
>   struct device*dev;
>   struct usb_gadget_driver *driver;
> - struct usb_phy  *phy;
> + struct phy   *phy;
>   struct s3c_hsotg_plat*plat;
>  
>   spinlock_t  lock;
> @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg 
> *hsotg)
>   dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
>  
>   if (hsotg->phy)
> - usb_phy_init(hsotg->phy);
> + phy_power_on(hsotg->phy);
>   else if (hsotg->plat->phy_init)
>   hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
>  }
> @@ -2922,7 +2923,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg 
> *hsotg)
>   struct platform_device *pdev = to_platform_device(hsotg->dev);
>  
>   if (hsotg->phy)
> - usb_phy_shutdown(hsotg->phy);
> + phy_power_off(hsotg->phy);
>   else if (hsotg->plat->phy_exit)
>   hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
>  }
> @@ -3529,7 +3530,7 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg 
> *hsotg)
>  static int s3c_hsotg_probe(struct platform_device *pdev)
>  {
>   struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev);
> - struct usb_phy *phy;
> + struct phy *phy;
>   struct device *dev = &pdev->dev;
>   struct s3c_hsotg_ep *eps;
>   struct s3c_hsotg *hsotg;
> @@ -3544,7 +3545,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
>   return -ENOMEM;
>   }
>  
> - phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
> + phy = devm_phy_get(&pdev->dev, "usb2-phy");
>   if (IS_ERR(phy)) {
>   /* Fallback for pdata */
>   plat = dev_get_platdata(&pdev->dev);
> 

--
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 6/9] phy: Add support for S5PV210 to the Exynos USB PHY driver

2013-12-06 Thread Kishon Vijay Abraham I
Hi,

On Friday 06 December 2013 04:01 PM, Kamil Debski wrote:
> From: Mateusz Krawczuk 
> 
> Add support for the Samsung's S5PV210 SoC to the Exynos USB PHY driver.
> 
> Signed-off-by: Mateusz Krawczuk 
> [k.deb...@samsung.com: cleanup and commit description]
> [k.deb...@samsung.com: make changes accordingly to the mailing list
> comments]
> Signed-off-by: Kamil Debski 
> Signed-off-by: Kyungmin Park 
> ---
>  .../devicetree/bindings/phy/samsung-usbphy.txt |1 +
>  drivers/phy/Kconfig|7 +
>  drivers/phy/Makefile   |1 +
>  drivers/phy/phy-s5pv210-usb2.c |  206 
> 
>  drivers/phy/phy-samsung-usb2.c |6 +
>  drivers/phy/phy-samsung-usb2.h |1 +
>  6 files changed, 222 insertions(+)
>  create mode 100644 drivers/phy/phy-s5pv210-usb2.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt 
> b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> index cadbf70..77a8e9c 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> @@ -3,6 +3,7 @@ Samsung S5P/EXYNOS SoC series USB PHY
>  
>  Required properties:
>  - compatible : should be one of the listed compatibles:
> + - "samsung,s5pv210-usb2-phy"
>   - "samsung,exynos4210-usb2-phy"
>   - "samsung,exynos4212-usb2-phy"
>  - reg : a list of registers used by phy driver
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index b29018f..2e433cd 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -58,6 +58,13 @@ config PHY_SAMSUNG_USB2
> This driver provides common interface to interact, for Samsung
> USB 2.0 PHY driver.
>  
> +config PHY_S5PV210_USB2
> + bool "Support for S5PV210"
> + depends on PHY_SAMSUNG_USB2
> + depends on ARCH_S5PV210
> + help
> +   Enable USB PHY support for S5PV210

more description here..
> +
>  config PHY_EXYNOS4210_USB2
>   bool "Support for Exynos 4210"
>   depends on PHY_SAMSUNG_USB2
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 9f4befd..fefc6c2 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -8,5 +8,6 @@ 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_S5PV210_USB2)   += phy-s5pv210-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-s5pv210-usb2.c b/drivers/phy/phy-s5pv210-usb2.c
> new file mode 100644
> index 000..528a114
> --- /dev/null
> +++ b/drivers/phy/phy-s5pv210-usb2.c
> @@ -0,0 +1,206 @@
> +/*
> + * Samsung SoC USB 1.1/2.0 PHY driver - S5PV210 support
> + *
> + * Copyright (C) 2013 Samsung Electronics Co., Ltd.
> + * Authors: Kamil Debski 
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

I think my comments for the previous patch with a similar driver
(phy-exynos4210-usb2.c) is applicable here also.

Thanks
Kishon

> +#include "phy-samsung-usb2.h"
> +
> +/* Exynos USB PHY registers */
> +
> +/* PHY power control */
> +#define S5PV210_UPHYPWR  0x0
> +
> +#define S5PV210_UPHYPWR_PHY0_SUSPEND (1 << 0)
> +#define S5PV210_UPHYPWR_PHY0_PWR (1 << 3)
> +#define S5PV210_UPHYPWR_PHY0_OTG_PWR (1 << 4)
> +#define S5PV210_UPHYPWR_PHY0 ( \
> + S5PV210_UPHYPWR_PHY0_SUSPEND | \
> + S5PV210_UPHYPWR_PHY0_PWR | \
> + S5PV210_UPHYPWR_PHY0_OTG_PWR)
> +
> +#define S5PV210_UPHYPWR_PHY1_SUSPEND (1 << 6)
> +#define S5PV210_UPHYPWR_PHY1_PWR (1 << 7)
> +#define S5PV210_UPHYPWR_PHY1 ( \
> + S5PV210_UPHYPWR_PHY1_SUSPEND | \
> + S5PV210_UPHYPWR_PHY1_PWR)
> +
> +/* PHY clock control */
> +#define S5PV210_UPHYCLK  0x4
> +
> +#define S5PV210_UPHYCLK_PHYFSEL_MASK (0x3 << 0)
> +#define S5PV210_UPHYCLK_PHYFSEL_48MHZ(0x0 << 0)
> +#define S5PV210_UPHYCLK_PHYFSEL_24MHZ(0x3 << 0)
> +#define S5PV210_UPHYCLK_PHYFSEL_12MHZ(0x2 << 0)
> +
> +#define S5PV210_UPHYCLK_PHY0_ID_PULLUP   (0x1 << 2)
> +#define S5PV210_UPHYCLK_PHY0_COMMON_ON   (0x1 << 4)
> +#define S5PV210_UPHYCLK_PHY1_COMMON_ON   (0x1 << 7)
> +
> +/* PHY reset control */
> +#define S5PV210_UPHYRST  0x8
> +
> +#define S5PV210_URSTCON_PHY0 (1 << 0)
> +#define S5PV210_URSTCON_OTG_HLINK(1 << 1)
> +#define S5PV210_URSTCON_OTG

Re: [PATCH v4 7/9] phy: Add Exynos 5250 support to the Exynos USB 2.0 PHY driver

2013-12-06 Thread Kishon Vijay Abraham I
On Friday 06 December 2013 04:02 PM, Kamil Debski wrote:
> Add support for Exynos 5250. This driver is to replace the old
> USB 2.0 PHY driver.
> 
> Signed-off-by: Kamil Debski 
> Signed-off-by: Kyungmin Park 
> ---
>  .../devicetree/bindings/phy/samsung-usbphy.txt |1 +
>  drivers/phy/Kconfig|8 +
>  drivers/phy/Makefile   |1 +
>  drivers/phy/phy-exynos5250-usb2.c  |  363 
> 
>  drivers/phy/phy-samsung-usb2.c |6 +
>  drivers/phy/phy-samsung-usb2.h |1 +
>  6 files changed, 380 insertions(+)
>  create mode 100644 drivers/phy/phy-exynos5250-usb2.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt 
> b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> index 77a8e9c..94096fc 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> @@ -6,6 +6,7 @@ Required properties:
>   - "samsung,s5pv210-usb2-phy"
>   - "samsung,exynos4210-usb2-phy"
>   - "samsung,exynos4212-usb2-phy"
> + - "samsung,exynos5250-usb2-phy"
>  - reg : a list of registers used by phy driver
>   - first and obligatory is the location of phy modules registers
>  - samsung,sysreg-phandle - handle to syscon used to control the system 
> registers
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 2e433cd..74e9064 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -78,4 +78,12 @@ config PHY_EXYNOS4212_USB2
>   depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412)
>   help
> Enable USB PHY support for Exynos 4212
> +
> +config PHY_EXYNOS5250_USB2
> + bool "Support for Exynos 5250"
> + depends on PHY_SAMSUNG_USB2
> + depends on SOC_EXYNOS5250
> + help
> +   Enable USB PHY support for Exynos 5250

My comments for the previous patch is applicable here too..

Thanks
Kishon

> +
>  endmenu
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index fefc6c2..33c3ac1 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -11,3 +11,4 @@ obj-$(CONFIG_PHY_SAMSUNG_USB2)  += 
> phy-samsung-usb2.o
>  obj-$(CONFIG_PHY_S5PV210_USB2)   += phy-s5pv210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS4210_USB2)+= phy-exynos4210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS4212_USB2)+= phy-exynos4212-usb2.o
> +obj-$(CONFIG_PHY_EXYNOS5250_USB2)+= phy-exynos5250-usb2.o
> diff --git a/drivers/phy/phy-exynos5250-usb2.c 
> b/drivers/phy/phy-exynos5250-usb2.c
> new file mode 100644
> index 000..7aeebc8
> --- /dev/null
> +++ b/drivers/phy/phy-exynos5250-usb2.c
> @@ -0,0 +1,363 @@
> +/*
> + * Samsung SoC USB 1.1/2.0 PHY driver - Exynos 5250 support
> + *
> + * Copyright (C) 2013 Samsung Electronics Co., Ltd.
> + * Author: Kamil Debski 
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "phy-samsung-usb2.h"
> +
> +/* Exynos USB PHY registers */
> +#define EXYNOS_5250_REFCLKSEL_CRYSTAL0x0
> +#define EXYNOS_5250_REFCLKSEL_XO 0x1
> +#define EXYNOS_5250_REFCLKSEL_CLKCORE0x2
> +
> +#define EXYNOS_5250_FSEL_9MHZ6   0x0
> +#define EXYNOS_5250_FSEL_10MHZ   0x1
> +#define EXYNOS_5250_FSEL_12MHZ   0x2
> +#define EXYNOS_5250_FSEL_19MHZ2  0x3
> +#define EXYNOS_5250_FSEL_20MHZ   0x4
> +#define EXYNOS_5250_FSEL_24MHZ   0x5
> +#define EXYNOS_5250_FSEL_50MHZ   0x7
> +
> +/* Normal host */
> +#define EXYNOS_5250_HOSTPHYCTRL0 0x0
> +
> +#define EXYNOS_5250_HOSTPHYCTRL0_PHYSWRSTALL (0x1 << 31)
> +#define EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_SHIFT 19
> +#define EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_MASK  \
> + (0x3 << EXYNOS_5250_HOSTPHYCTRL0_REFCLKSEL_SHIFT)
> +#define EXYNOS_5250_HOSTPHYCTRL0_FSEL_SHIFT  16
> +#define EXYNOS_5250_HOSTPHYCTRL0_FSEL_MASK \
> + (0x7 << EXYNOS_5250_HOSTPHYCTRL0_FSEL_SHIFT)
> +#define EXYNOS_5250_HOSTPHYCTRL0_TESTBURNIN  (0x1 << 11)
> +#define EXYNOS_5250_HOSTPHYCTRL0_RETENABLE   (0x1 << 10)
> +#define EXYNOS_5250_HOSTPHYCTRL0_COMMON_ON_N (0x1 << 9)
> +#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_MASK  (0x3 << 7)
> +#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_DUAL  (0x0 << 7)
> +#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_ID0   (0x1 << 7)
> +#define EXYNOS_5250_HOSTPHYCTRL0_VATESTENB_ANALOGTEST(0x2 << 7)
> +#define EXYNOS_5250_HOSTPHYCTRL0_SIDDQ   (0x1 << 6)
> +#define EXYNOS_5250_HOSTPHYCTRL0_FORCESLEEP  (0x1 << 5)
> +#defi

[PATCH 2/2] USB: gadget: s3c-hsotg: add flush TX FIFO when kill all requests

2013-12-06 Thread Robert Baldyga
This patch adds flushing TX FIFO in kill_all_requests() function in
dedicated-fifo mode. It's because when requests are killed (when endpoint is
disabled or in case of device reset/disconnection) in FIFO can stay some
unsent data. In the worst case FIFO can stay full, and then if endpoint will
be back enabled, sending new data will be impossible.

Signed-off-by: Robert Baldyga 
Signed-off-by: Kyungmin Park 

---
 drivers/usb/gadget/s3c-hsotg.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index ad9a4ed..4a085e6 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2156,6 +2156,9 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
s3c_hsotg_complete_request(hsotg, ep, req,
   result);
}
+   if(hsotg->dedicated_fifos)
+   if ((readl(hsotg->regs + DTXFSTS(ep->index)) & 0x) * 4 < 
3072)
+   s3c_hsotg_txfifo_flush(hsotg, ep->index);
 }
 
 #define call_gadget(_hs, _entry) \
-- 
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 1/2] USB: gadget: s3c-hsotg: fix maxpacket size in s3c_hsotg_irq_enumdone

2013-12-06 Thread Robert Baldyga
This patch set maximum possible maxpacket value for each speed. Previous
values didn't allow to use maxpacket sizes greater than 64 in full speed
and 512 in high speed, although hardware is able to handle up to 1023 in fs
and 1024 in hs.

Signed-off-by: Robert Baldyga 
Signed-off-by: Kyungmin Park 

---
 drivers/usb/gadget/s3c-hsotg.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index e20bc10..ad9a4ed 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -2086,13 +2086,13 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg 
*hsotg)
case DSTS_EnumSpd_FS48:
hsotg->gadget.speed = USB_SPEED_FULL;
ep0_mps = EP0_MPS_LIMIT;
-   ep_mps = 64;
+   ep_mps = 1023;
break;
 
case DSTS_EnumSpd_HS:
hsotg->gadget.speed = USB_SPEED_HIGH;
ep0_mps = EP0_MPS_LIMIT;
-   ep_mps = 512;
+   ep_mps = 1024;
break;
 
case DSTS_EnumSpd_LS:
-- 
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 0/2] usb: s3c-hsotg: fixes for maxpacket and TX FIFO handling

2013-12-06 Thread Robert Baldyga
Hello,

This patches contains fixes for s3c-hsotg driver. They fix maxpacket sizes set
in s3c_hsotg_irq_enumdone() function, and adds flushing TX FIFO when killing all
requests in dedicated-fifo mode. More info in commit messages.

Best regards
Robert Baldyga
Samsung R&D Institute Poland

Robert Baldyga (2):
  USB: gadget: s3c-hsotg: fix maxpacket size in s3c_hsotg_irq_enumdone
  USB: gadget: s3c-hsotg: add flush TX FIFO when kill all requests

 drivers/usb/gadget/s3c-hsotg.c |7 +--
 1 file changed, 5 insertions(+), 2 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


[PATCH v2 0/2] usb: fix controller-PHY binding for OMAP3 platform

2013-12-06 Thread Kishon Vijay Abraham I
After the platform devices are created using PLATFORM_DEVID_AUTO, the
device names given in usb_bind_phy (in board file) does not match with
the actual device name causing the USB PHY library not to return the
PHY reference when the MUSB controller request for the PHY in the non-dt boot
case.
So removed creating platform devices using PLATFORM_DEVID_AUTO in omap2430.c.

Changes from v1:
* refreshed to the latested mainline kernel
* added musb_put_id from omap2430 remove.

Kishon Vijay Abraham I (2):
  usb: musb: omap: remove using PLATFORM_DEVID_AUTO in omap2430.c
  arm: omap: remove *.auto* from device names given in usb_bind_phy

 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 +-
 drivers/usb/musb/musb_core.c   |   31 +++-
 drivers/usb/musb/musb_core.h   |2 ++
 drivers/usb/musb/omap2430.c|   19 +++--
 15 files changed, 61 insertions(+), 15 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


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

2013-12-06 Thread Kishon Vijay Abraham I
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 
---
 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(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c 
b/arch/arm/mach-omap2/board-2430sdp.c
index c711ad6..cc679c6 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -246,7 +246,7 @@ static void __init omap_2430sdp_init(void)
omap_hsmmc_init(mmc);
 
omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
 
board_smc91x_init();
diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d95d0ef..873e463 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -607,7 +607,7 @@ static void __init omap_3430sdp_init(void)
omap_ads7846_init(1, gpio_pendown, 310, NULL);
omap_serial_init();
omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 8dd0ec8..ddcadfa 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -725,7 +725,7 @@ static void __init cm_t3x_common_init(void)
cm_t35_init_display();
omap_twl4030_audio_init("cm-t3x", NULL);
 
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
cm_t35_init_usbh();
cm_t35_init_camera();
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index cdc4fb9..bb589f1 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -628,7 +628,7 @@ static void __init devkit8000_init(void)
 
omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL);
 
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
usbhs_init(&usbhs_bdata);
board_nand_init(devkit8000_nand_partitions,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 4ec8d82..ec9b349 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -402,7 +402,7 @@ static void __init omap_ldp_init(void)
omap_ads7846_init(1, 54, 310, NULL);
omap_serial_init();
omap_sdrc_init(NULL, NULL);
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
0, 0, nand_default_timings);
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c 
b/arch/arm/mach-omap2/board-omap3beagle.c
index d6ed819..0cba5eb 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -561,7 +561,7 @@ static void __init omap3_beagle_init(void)
omap_sdrc_init(mt46h32m32lf6_sdrc_params,
  mt46h32m32lf6_sdrc_params);
 
-   usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
+   usb_bind_phy("musb-hdrc.0", 0, "twl4030_usb");
usb_musb_init(NULL);
 
usbhs_init(&usbhs_bdata);
diff --git a/arch/arm/mach-omap2/board-omap3logic.c 
b/arch/arm/mach-omap2/board-omap3logic.c
index bab51e6..d9a6c38 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -216,7 +216,7 @@ static void __init om

[PATCH v2 1/2] usb: musb: omap: remove using PLATFORM_DEVID_AUTO in omap2430.c

2013-12-06 Thread Kishon Vijay Abraham I
After the platform devices are created using PLATFORM_DEVID_AUTO, the
device names given in usb_bind_phy (in board file) does not match with
the actual device name causing the USB PHY library not to return the
PHY reference when the MUSB controller request for the PHY in the non-dt boot
case.
So removed creating platform devices using PLATFORM_DEVID_AUTO in omap2430.c.
This is also needed for the Generic PHY Framework.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/musb/musb_core.c |   31 ++-
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/omap2430.c  |   19 +--
 3 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0a43329..aaf734c 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -94,6 +94,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -120,7 +121,7 @@ MODULE_DESCRIPTION(DRIVER_INFO);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" MUSB_DRIVER_NAME);
-
+static DEFINE_IDA(musb_ida);
 
 /*-*/
 
@@ -131,6 +132,34 @@ static inline struct musb *dev_to_musb(struct device *dev)
 
 /*-*/
 
+int musb_get_id(struct device *dev, gfp_t gfp_mask)
+{
+   int ret;
+   int id;
+
+   ret = ida_pre_get(&musb_ida, gfp_mask);
+   if (!ret) {
+   dev_err(dev, "failed to reserve resource for id\n");
+   return -ENOMEM;
+   }
+
+   ret = ida_get_new(&musb_ida, &id);
+   if (ret < 0) {
+   dev_err(dev, "failed to allocate a new id\n");
+   return ret;
+   }
+
+   return id;
+}
+EXPORT_SYMBOL_GPL(musb_get_id);
+
+void musb_put_id(struct device *dev, int id)
+{
+   dev_dbg(dev, "removing id %d\n", id);
+   ida_remove(&musb_ida, id);
+}
+EXPORT_SYMBOL_GPL(musb_put_id);
+
 #ifndef CONFIG_BLACKFIN
 static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
 {
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 29f7cd7..63614283 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -506,6 +506,8 @@ extern const char musb_driver_name[];
 
 extern void musb_stop(struct musb *musb);
 extern void musb_start(struct musb *musb);
+int musb_get_id(struct device *dev, gfp_t gfp_mask);
+void musb_put_id(struct device *dev, int id);
 
 extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src);
 extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2a408cd..14a612c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -45,6 +45,7 @@
 
 struct omap2430_glue {
struct device   *dev;
+   int id;
struct platform_device  *musb;
enum omap_musb_vbus_id_status status;
struct work_struct  omap_musb_mailbox_work;
@@ -508,6 +509,7 @@ static int omap2430_probe(struct platform_device *pdev)
struct device_node  *np = pdev->dev.of_node;
struct musb_hdrc_config *config;
int ret = -ENOMEM;
+   int musbid;
 
glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -515,10 +517,18 @@ static int omap2430_probe(struct platform_device *pdev)
goto err0;
}
 
-   musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
+   /* get the musb id */
+   musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
+   if (musbid < 0) {
+   dev_err(&pdev->dev, "failed to allocate musb id\n");
+   ret = -ENOMEM;
+   goto err0;
+   }
+
+   musb = platform_device_alloc("musb-hdrc", musbid);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
-   goto err0;
+   goto err1;
}
 
musb->dev.parent= &pdev->dev;
@@ -528,6 +538,7 @@ static int omap2430_probe(struct platform_device *pdev)
glue->dev   = &pdev->dev;
glue->musb  = musb;
glue->status= OMAP_MUSB_UNKNOWN;
+   glue->id= musbid;
glue->control_otghs = ERR_PTR(-ENODEV);
 
if (np) {
@@ -633,6 +644,9 @@ static int omap2430_probe(struct platform_device *pdev)
 err2:
platform_device_put(musb);
 
+err1:
+   musb_put_id(&pdev->dev, musbid);
+
 err0:
return ret;
 }
@@ -643,6 +657,7 @@ static int omap2430_remove(struct platform_device *pdev)
 
cancel_work_sync(&glue->omap_musb_mailbox_work);
platform_device_unregister(glue->musb);
+   musb_put_i

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

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

On Fri, Dec 6, 2013 at 1:06 PM, Kishon Vijay Abraham I  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 
> ---
>  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

Thanks a lot and best regards,
Javier
--
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 4/9] usb: ehci-s5p: Change to use phy provided by the generic phy framework

2013-12-06 Thread Kamil Debski
Hi Alan,

Thank you for the review. Please find my replies inline.

> From: Alan Stern [mailto:st...@rowland.harvard.edu]
> Sent: Thursday, December 05, 2013 7:53 PM
> 
> On Thu, 5 Dec 2013, Kamil Debski wrote:
> 
> > Change the phy provider used from the old usb phy specific to a new
> > one using the generic phy framework.
> >
> > Signed-off-by: Kamil Debski 
> > Signed-off-by: Kyungmin Park 
> 
> > --- a/drivers/usb/host/ehci-exynos.c
> > +++ b/drivers/usb/host/ehci-exynos.c
> 
> > @@ -42,10 +42,10 @@
> >  static const char hcd_name[] = "ehci-exynos";  static struct
> > hc_driver __read_mostly exynos_ehci_hc_driver;
> >
> > +#define PHY_NUMBER 3
> >  struct exynos_ehci_hcd {
> > struct clk *clk;
> > -   struct usb_phy *phy;
> > -   struct usb_otg *otg;
> 
> Are you sure you want to remove that line?

Yes, I am. The new generic phy interface does not have the otg field in it.
 
> > +   struct phy *phy[PHY_NUMBER];
> >  };
> >
> >  #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd
> > *)(hcd_to_ehci(hcd)->priv)
> 
> > @@ -102,13 +132,24 @@ static int exynos_ehci_probe(struct
> platform_device *pdev)
> > "samsung,exynos5440-ehci"))
> > goto skip_phy;
> >
> > -   phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
> > -   if (IS_ERR(phy)) {
> > -   usb_put_hcd(hcd);
> > -   dev_warn(&pdev->dev, "no platform data or transceiver
> defined\n");
> > -   return -EPROBE_DEFER;
> > -   } else {
> > -   exynos_ehci->phy = phy;
> > +   for_each_available_child_of_node(pdev->dev.of_node, child) {
> > +   err = of_property_read_u32(child, "reg", &phy_number);
> > +   if (err) {
> > +   dev_err(&pdev->dev, "Failed to parse device
tree\n");
> > +   return err;
> > +   }
> > +   if (phy_number >= PHY_NUMBER) {
> > +   dev_err(&pdev->dev, "Failed to parse device tree -
> number out of range\n");
> > +   return -EINVAL;
> 
> Do you need to call of_node_put(child) before each of these return
> statements?

You are right, thank you for spotting this.

> 
> > +   }
> > +   phy = devm_of_phy_get(&pdev->dev, child, 0);
> > +   of_node_put(child);
> > +   if (IS_ERR(phy)) {
> > +   dev_err(&pdev->dev, "Failed to get phy number %d",
> > +   phy_number);
> > +   return PTR_ERR(phy);
> > +   }
> > +   exynos_ehci->phy[phy_number] = phy;
> > exynos_ehci->otg = phy->otg;
> 
> Did you intend to remove this line?  Above, you removed the
> exynos_ehci->otg field.  I can't see how this patch would ever compile
> without an error.

Yes, I had this in a separate fix patch which I forgot to squash. Sorry for
this.

> > }
> >
> > @@ -149,11 +190,11 @@ skip_phy:
> > goto fail_io;
> > }
> >
> > -   if (exynos_ehci->otg)
> > -   exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self);
> > -
> > -   if (exynos_ehci->phy)
> > -   usb_phy_init(exynos_ehci->phy);
> > +   err = exynos_phys_on(exynos_ehci->phy);
> > +   if (err) {
> > +   dev_err(&pdev->dev, "Failed to enabled phys\n");
> > +   goto fail_phys_on;
> 
> Why add a new statement label?  Just goto fail_io.

To me it seemed better to add a new label. I will drop it and use
goto fail_io, as you suggested.

> 
> > +   }
> >
> > ehci = hcd_to_ehci(hcd);
> > ehci->caps = hcd->regs;
> > @@ -172,8 +213,8 @@ skip_phy:
> > return 0;
> >
> >  fail_add_hcd:
> > -   if (exynos_ehci->phy)
> > -   usb_phy_shutdown(exynos_ehci->phy);
> > +   exynos_phys_off(exynos_ehci->phy);
> > +fail_phys_on:
> >  fail_io:
> > clk_disable_unprepare(exynos_ehci->clk);
> >  fail_clk:
> 
> Alan Stern

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

--
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 v4 1/4] ARM: OMAP1: USB: move omap_usb_config to platform data

2013-12-06 Thread Aaro Koskinen
Move omap_usb_config to platform data, so that OTG driver can include it.

Signed-off-by: Aaro Koskinen 
Acked-by: Tony Lindgren 
---
 arch/arm/mach-omap1/include/mach/usb.h  | 38 +---
 include/linux/platform_data/usb-omap1.h | 51 +
 2 files changed, 52 insertions(+), 37 deletions(-)
 create mode 100644 include/linux/platform_data/usb-omap1.h

diff --git a/arch/arm/mach-omap1/include/mach/usb.h 
b/arch/arm/mach-omap1/include/mach/usb.h
index 45e5ac707cbb..2c263051dc51 100644
--- a/arch/arm/mach-omap1/include/mach/usb.h
+++ b/arch/arm/mach-omap1/include/mach/usb.h
@@ -8,43 +8,7 @@
 #defineis_usb0_device(config)  0
 #endif
 
-struct omap_usb_config {
-   /* Configure drivers according to the connectors on your board:
-*  - "A" connector (rectagular)
-*  ... for host/OHCI use, set "register_host".
-*  - "B" connector (squarish) or "Mini-B"
-*  ... for device/gadget use, set "register_dev".
-*  - "Mini-AB" connector (very similar to Mini-B)
-*  ... for OTG use as device OR host, initialize "otg"
-*/
-   unsignedregister_host:1;
-   unsignedregister_dev:1;
-   u8  otg;/* port number, 1-based:  usb1 == 2 */
-
-   u8  hmc_mode;
-
-   /* implicitly true if otg:  host supports remote wakeup? */
-   u8  rwc;
-
-   /* signaling pins used to talk to transceiver on usbN:
-*  0 == usbN unused
-*  2 == usb0-only, using internal transceiver
-*  3 == 3 wire bidirectional
-*  4 == 4 wire bidirectional
-*  6 == 6 wire unidirectional (or TLL)
-*/
-   u8  pins[3];
-
-   struct platform_device *udc_device;
-   struct platform_device *ohci_device;
-   struct platform_device *otg_device;
-
-   u32 (*usb0_init)(unsigned nwires, unsigned is_device);
-   u32 (*usb1_init)(unsigned nwires);
-   u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
-
-   int (*ocpi_enable)(void);
-};
+#include 
 
 void omap_otg_init(struct omap_usb_config *config);
 
diff --git a/include/linux/platform_data/usb-omap1.h 
b/include/linux/platform_data/usb-omap1.h
new file mode 100644
index ..8c7764ddd284
--- /dev/null
+++ b/include/linux/platform_data/usb-omap1.h
@@ -0,0 +1,51 @@
+/*
+ * Platform data for OMAP1 USB
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive for
+ * more details.
+ */
+#ifndef __LINUX_USB_OMAP1_H
+#define __LINUX_USB_OMAP1_H
+
+#include 
+
+struct omap_usb_config {
+   /* Configure drivers according to the connectors on your board:
+*  - "A" connector (rectagular)
+*  ... for host/OHCI use, set "register_host".
+*  - "B" connector (squarish) or "Mini-B"
+*  ... for device/gadget use, set "register_dev".
+*  - "Mini-AB" connector (very similar to Mini-B)
+*  ... for OTG use as device OR host, initialize "otg"
+*/
+   unsignedregister_host:1;
+   unsignedregister_dev:1;
+   u8  otg;/* port number, 1-based:  usb1 == 2 */
+
+   u8  hmc_mode;
+
+   /* implicitly true if otg:  host supports remote wakeup? */
+   u8  rwc;
+
+   /* signaling pins used to talk to transceiver on usbN:
+*  0 == usbN unused
+*  2 == usb0-only, using internal transceiver
+*  3 == 3 wire bidirectional
+*  4 == 4 wire bidirectional
+*  6 == 6 wire unidirectional (or TLL)
+*/
+   u8  pins[3];
+
+   struct platform_device *udc_device;
+   struct platform_device *ohci_device;
+   struct platform_device *otg_device;
+
+   u32 (*usb0_init)(unsigned nwires, unsigned is_device);
+   u32 (*usb1_init)(unsigned nwires);
+   u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
+
+   int (*ocpi_enable)(void);
+};
+
+#endif /* __LINUX_USB_OMAP1_H */
-- 
1.8.4.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 v4 3/4] USB: OMAP1: OTG controller driver

2013-12-06 Thread Aaro Koskinen
Transceivers need to manage OTG controller state on OMAP1 to enable
switching between peripheral and host modes. Provide a driver for that.

Signed-off-by: Aaro Koskinen 
---
 drivers/usb/phy/Kconfig|  10 +++
 drivers/usb/phy/Makefile   |   1 +
 drivers/usb/phy/phy-omap-otg.c | 169 +
 3 files changed, 180 insertions(+)
 create mode 100644 drivers/usb/phy/phy-omap-otg.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index d5589f9c60a9..95d0acc117cc 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -154,6 +154,16 @@ config USB_GPIO_VBUS
  optionally control of a D+ pullup GPIO as well as a VBUS
  current limit regulator.
 
+config OMAP_OTG
+   tristate "OMAP USB OTG controller driver"
+   depends on ARCH_OMAP_OTG && EXTCON
+   help
+ Enable this to support some transceivers on OMAP1 platforms. OTG
+ controller is needed to switch between host and peripheral modes.
+
+ This driver can also be built as a module. If so, the module
+ will be called omap-otg.
+
 config USB_ISP1301
tristate "NXP ISP1301 USB transceiver support"
depends on USB || USB_GADGET
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 2135e85f46ed..ca5bcad49da2 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_NOP_USB_XCEIV)   += phy-generic.o
 obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
 obj-$(CONFIG_AM335X_CONTROL_USB)   += phy-am335x-control.o
 obj-$(CONFIG_AM335X_PHY_USB)   += phy-am335x.o
+obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
 obj-$(CONFIG_OMAP_USB3)+= phy-omap-usb3.o
 obj-$(CONFIG_SAMSUNG_USBPHY)   += phy-samsung-usb.o
diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
new file mode 100644
index ..11598cdb3189
--- /dev/null
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -0,0 +1,169 @@
+/*
+ * OMAP OTG controller driver
+ *
+ * Based on code from tahvo-usb.c and isp1301_omap.c drivers.
+ *
+ * Copyright (C) 2005-2006 Nokia Corporation
+ * Copyright (C) 2004 Texas Instruments
+ * Copyright (C) 2004 David Brownell
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct otg_device {
+   void __iomem*base;
+   boolid;
+   boolvbus;
+   struct extcon_specific_cable_nb vbus_dev;
+   struct extcon_specific_cable_nb id_dev;
+   struct notifier_block   vbus_nb;
+   struct notifier_block   id_nb;
+};
+
+#define OMAP_OTG_CTRL  0x0c
+#define OMAP_OTG_ASESSVLD  (1 << 20)
+#define OMAP_OTG_BSESSEND  (1 << 19)
+#define OMAP_OTG_BSESSVLD  (1 << 18)
+#define OMAP_OTG_VBUSVLD   (1 << 17)
+#define OMAP_OTG_ID(1 << 16)
+#define OMAP_OTG_XCEIV_OUTPUTS \
+   (OMAP_OTG_ASESSVLD | OMAP_OTG_BSESSEND | OMAP_OTG_BSESSVLD | \
+OMAP_OTG_VBUSVLD  | OMAP_OTG_ID)
+
+static void omap_otg_ctrl(struct otg_device *otg_dev, u32 outputs)
+{
+   u32 l;
+
+   l = readl(otg_dev->base + OMAP_OTG_CTRL);
+   l &= ~OMAP_OTG_XCEIV_OUTPUTS;
+   l |= outputs;
+   writel(l, otg_dev->base + OMAP_OTG_CTRL);
+}
+
+static void omap_otg_set_mode(struct otg_device *otg_dev)
+{
+   if (!otg_dev->id && otg_dev->vbus)
+   /* Set B-session valid. */
+   omap_otg_ctrl(otg_dev, OMAP_OTG_ID | OMAP_OTG_BSESSVLD);
+   else if (otg_dev->vbus)
+   /* Set A-session valid. */
+   omap_otg_ctrl(otg_dev, OMAP_OTG_ASESSVLD);
+   else if (!otg_dev->id)
+   /* Set B-session end to indicate no VBUS. */
+   omap_otg_ctrl(otg_dev, OMAP_OTG_ID | OMAP_OTG_BSESSEND);
+}
+
+static int omap_otg_id_notifier(struct notifier_block *nb,
+   unsigned long event, void *ptr)
+{
+   struct otg_device *otg_dev = container_of(nb, struct otg_device, id_nb);
+
+   otg_dev->id = event;
+   omap_otg_set_mode(otg_dev);
+
+   return NOTIFY_DONE;
+}
+
+static int omap_otg_vbus_notifier(struct notifier_block *nb,
+ unsigned long event, void *ptr)
+{
+   struct otg_device *otg_dev = container_of(nb, struct otg_device,
+ vbus_nb);
+
+   otg_dev->vbus = ev

[PATCH v4 0/4] USB: OMAP1: Tahvo USB support for 770

2013-12-06 Thread Aaro Koskinen
Hi,

These patches add support for Tahvo USB transceiver and allow using both
host and peripheral modes on Nokia 770.

Tested (peripheral mode, host mode, vbus detection) with 3.12-rc7.

History:
v4: Register sysfs files with sysfs_create_group().
Rename "vbus_state" to "vbus".
Document the sysfs ABI.
Add missing clk disable to extcon registration error path.
Add missing extcon unregistration to probe error paths.
Move IRQ registration after PHY registration.
v3: http://marc.info/?l=linux-omap&m=137157527930908&w=2
Delete accidental #include  from patch 3.
Drop board file changes, already queued to linux-omap.
v2: http://marc.info/?l=linux-omap&m=137138976406242&w=2
Use extcon framework to trigger OTG driver mode changes.
v1: http://marc.info/?l=linux-omap&m=137081763029385&w=2

Earlier RFC versions:
http://marc.info/?l=linux-omap&m=13655371679&w=2
http://marc.info/?l=linux-omap&m=136266725827698&w=2

Aaro Koskinen (4):
  ARM: OMAP1: USB: move omap_usb_config to platform data
  USB: OMAP1: add extcon to platform data
  USB: OMAP1: OTG controller driver
  USB: OMAP1: Tahvo USB transceiver driver

 Documentation/ABI/testing/sysfs-platform-tahvo-usb |  16 +
 arch/arm/mach-omap1/include/mach/usb.h |  38 +-
 drivers/usb/phy/Kconfig|  25 ++
 drivers/usb/phy/Makefile   |   2 +
 drivers/usb/phy/phy-omap-otg.c | 169 
 drivers/usb/phy/phy-tahvo.c| 461 +
 include/linux/platform_data/usb-omap1.h|  53 +++
 7 files changed, 727 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-tahvo-usb
 create mode 100644 drivers/usb/phy/phy-omap-otg.c
 create mode 100644 drivers/usb/phy/phy-tahvo.c
 create mode 100644 include/linux/platform_data/usb-omap1.h

-- 
1.8.4.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 v4 2/4] USB: OMAP1: add extcon to platform data

2013-12-06 Thread Aaro Koskinen
Add extcon field to platform data.

Signed-off-by: Aaro Koskinen 
---
 include/linux/platform_data/usb-omap1.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/platform_data/usb-omap1.h 
b/include/linux/platform_data/usb-omap1.h
index 8c7764ddd284..43b5ce139c37 100644
--- a/include/linux/platform_data/usb-omap1.h
+++ b/include/linux/platform_data/usb-omap1.h
@@ -23,6 +23,8 @@ struct omap_usb_config {
unsignedregister_dev:1;
u8  otg;/* port number, 1-based:  usb1 == 2 */
 
+   const char  *extcon;/* extcon device for OTG */
+
u8  hmc_mode;
 
/* implicitly true if otg:  host supports remote wakeup? */
-- 
1.8.4.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 v4 4/4] USB: OMAP1: Tahvo USB transceiver driver

2013-12-06 Thread Aaro Koskinen
Add Tahvo USB transceiver driver.

Based on old code from linux-omap tree. The original driver was written
by Juha Yrjölä, Tony Lindgren, and Timo Teräs.

Signed-off-by: Aaro Koskinen 
---
 Documentation/ABI/testing/sysfs-platform-tahvo-usb |  16 +
 drivers/usb/phy/Kconfig|  15 +
 drivers/usb/phy/Makefile   |   1 +
 drivers/usb/phy/phy-tahvo.c| 461 +
 4 files changed, 493 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-tahvo-usb
 create mode 100644 drivers/usb/phy/phy-tahvo.c

diff --git a/Documentation/ABI/testing/sysfs-platform-tahvo-usb 
b/Documentation/ABI/testing/sysfs-platform-tahvo-usb
new file mode 100644
index ..f6e20ce4b538
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-platform-tahvo-usb
@@ -0,0 +1,16 @@
+What:  /sys/bus/platform/devices/tahvo-usb/otg_mode
+Date:  December 2013
+Contact:   Aaro Koskinen 
+Description:
+   Set or read the current OTG mode. Valid values are "host" and
+   "peripheral".
+
+   Reading: returns the current mode.
+
+What:  /sys/bus/platform/devices/tahvo-usb/vbus
+Date:  December 2013
+Contact:   Aaro Koskinen 
+Description:
+   Read the current VBUS state.
+
+   Reading: returns "on" or "off".
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 95d0acc117cc..e0d11c227dd7 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -164,6 +164,21 @@ config OMAP_OTG
  This driver can also be built as a module. If so, the module
  will be called omap-otg.
 
+config TAHVO_USB
+   tristate "Tahvo USB transceiver driver"
+   depends on MFD_RETU && EXTCON
+   select USB_PHY
+   help
+ Enable this to support USB transceiver on Tahvo. This is used
+ at least on Nokia 770.
+
+config TAHVO_USB_HOST_BY_DEFAULT
+   depends on TAHVO_USB
+   boolean "Device in USB host mode by default"
+   help
+ Say Y here, if you want the device to enter USB host mode
+ by default on bootup.
+
 config USB_ISP1301
tristate "NXP ISP1301 USB transceiver support"
depends on USB || USB_GADGET
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index ca5bcad49da2..5359489891de 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_FSL_USB2_OTG)+= phy-fsl-usb2.o
 obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o
 obj-$(CONFIG_MV_U3D_PHY)   += phy-mv-u3d-usb.o
 obj-$(CONFIG_NOP_USB_XCEIV)+= phy-generic.o
+obj-$(CONFIG_TAHVO_USB)+= phy-tahvo.o
 obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
 obj-$(CONFIG_AM335X_CONTROL_USB)   += phy-am335x-control.o
 obj-$(CONFIG_AM335X_PHY_USB)   += phy-am335x.o
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
new file mode 100644
index ..7cf1766e1106
--- /dev/null
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -0,0 +1,461 @@
+/*
+ * Tahvo USB transceiver driver
+ *
+ * Copyright (C) 2005-2006 Nokia Corporation
+ *
+ * Parts copied from isp1301_omap.c.
+ * Copyright (C) 2004 Texas Instruments
+ * Copyright (C) 2004 David Brownell
+ *
+ * Original driver written by Juha Yrjölä, Tony Lindgren and Timo Teräs.
+ * Modified for Retu/Tahvo MFD by Aaro Koskinen.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "tahvo-usb"
+
+#define TAHVO_REG_IDSR 0x02
+#define TAHVO_REG_USBR 0x06
+
+#define USBR_SLAVE_CONTROL (1 << 8)
+#define USBR_VPPVIO_SW (1 << 7)
+#define USBR_SPEED (1 << 6)
+#define USBR_REGOUT(1 << 5)
+#define USBR_MASTER_SW2(1 << 4)
+#define USBR_MASTER_SW1(1 << 3)
+#define USBR_SLAVE_SW  (1 << 2)
+#define USBR_NSUSPEND  (1 << 1)
+#define USBR_SEMODE(1 << 0)
+
+#define TAHVO_MODE_HOST0
+#define TAHVO_MODE_PERIPHERAL  1
+
+struct tahvo_usb {
+   struct platform_device  *pt_dev;
+   struct usb_phy  phy;
+   int vbus_state;
+   struct mutexserialize;
+   struct clk  *ick;
+   int irq;
+   int tahvo_mode;
+   struct extcon_dev   extcon;
+};
+
+static const char *tahvo_cable[] = {
+   "USB-HO

Re: [PATCH v3 07/10] drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework

2013-12-06 Thread Roger Quadros
Hi Kishon,

On 11/25/2013 12:01 PM, Kishon Vijay Abraham I wrote:
> Adapted omap-usb3 PHY driver to Generic PHY Framework and moved phy-omap-usb3
> driver in drivers/usb/phy to drivers/phy and also renamed the file to
> phy-ti-pipe3 since this same driver will be used for SATA PHY and
> PCIE PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I 
> ---
>  drivers/phy/Kconfig|   11 +
>  drivers/phy/Makefile   |1 +
>  .../phy/phy-omap-usb3.c => phy/phy-ti-pipe3.c} |  232 
> 
>  drivers/usb/phy/Kconfig|   11 -
>  drivers/usb/phy/Makefile   |1 -
>  5 files changed, 149 insertions(+), 107 deletions(-)
>  rename drivers/{usb/phy/phy-omap-usb3.c => phy/phy-ti-pipe3.c} (55%)
> 
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index a344f3d..1abbfcc 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -33,6 +33,17 @@ config OMAP_USB2
> The USB OTG controller communicates with the comparator using this
> driver.
>  
> +config TI_PIPE3
> + tristate "TI PIPE3 PHY Driver"
> + depends on ARCH_OMAP2PLUS || COMPILE_TEST
> + select GENERIC_PHY
> + select OMAP_CONTROL_USB
> + help
> +   Enable this to support the PIPE3 PHY that is part of TI SOCs. This
> +   driver takes care of all the PHY functionality apart from comparator.
> +   This driver interacts with the "OMAP Control PHY Driver" to power
> +   on/off the PHY.
> +
>  config TWL4030_USB
>   tristate "TWL4030 USB Transceiver Driver"
>   depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index d0caae9..94a1a79 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -6,4 +6,5 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o
>  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_TI_PIPE3)   += phy-ti-pipe3.o
>  obj-$(CONFIG_TWL4030_USB)+= phy-twl4030-usb.o
> diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/phy/phy-ti-pipe3.c
> similarity index 55%
> rename from drivers/usb/phy/phy-omap-usb3.c
> rename to drivers/phy/phy-ti-pipe3.c
> index 0c6ba29..410b286 100644
> --- a/drivers/usb/phy/phy-omap-usb3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -1,5 +1,5 @@
>  /*
> - * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP.
> + * phy-ti-pipe3 - PIPE3 PHY driver.
>   *
>   * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
>   * This program is free software; you can redistribute it and/or modify
> @@ -19,10 +19,11 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -52,17 +53,34 @@
>  
>  /*
>   * This is an Empirical value that works, need to confirm the actual
> - * value required for the USB3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> - * to be correctly reflected in the USB3PHY_PLL_STATUS register.
> + * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> + * to be correctly reflected in the PIPE3PHY_PLL_STATUS register.
>   */
>  # define PLL_IDLE_TIME  100;
>  
> -struct usb_dpll_map {
> +struct pipe3_dpll_params {
> + u16 m;
> + u8  n;
> + u8  freq:3;
> + u8  sd;
> + u32 mf;
> +};
> +
> +struct ti_pipe3 {
> + void __iomem*pll_ctrl_base;
> + struct device   *dev;
> + struct device   *control_dev;
> + struct clk  *wkupclk;
> + struct clk  *sys_clk;
> + struct clk  *optclk;
> +};
> +
> +struct pipe3_dpll_map {
>   unsigned long rate;
> - struct usb_dpll_params params;
> + struct pipe3_dpll_params params;
>  };
>  
> -static struct usb_dpll_map dpll_map[] = {
> +static struct pipe3_dpll_map dpll_map[] = {
>   {1200, {1250, 5, 4, 20, 0} },   /* 12 MHz */
>   {1680, {3125, 20, 4, 20, 0} },  /* 16.8 MHz */
>   {1920, {1172, 8, 4, 20, 65537} },   /* 19.2 MHz */
> @@ -71,7 +89,18 @@ static struct usb_dpll_map dpll_map[] = {
>   {3840, {3125, 47, 4, 20, 92843} },  /* 38.4 MHz */
>  };
>  
> -static struct usb_dpll_params *omap_usb3_get_dpll_params(unsigned long rate)
> +static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset)
> +{
> + return __raw_readl(addr + offset);
> +}
> +
> +static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset,
> + u32 data)
> +{
> + __raw_writel(data, addr + offset);
> +}
> +
> +static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate)
>  {
>   int i;
>  
> @@ -83,110 +112,113 @@ static struct usb_dpll_params 
> *omap_usb3_get_dpll_params(unsigned long rate)

Re: [PATCH v6 2/2] usb-serial: Moxa UPORT 12XX/14XX/16XX driver

2013-12-06 Thread Johan Hovold
On Mon, Nov 11, 2013 at 06:37:44PM +0100, Andrew Lunn wrote:
> Add a driver which supports the following Moxa USB to serial converters:
> *   2 ports : UPort 1250, UPort 1250I
> *   4 ports : UPort 1410, UPort 1450, UPort 1450I
> *   8 ports : UPort 1610-8, UPort 1650-8
> *  16 ports : UPort 1610-16, UPort 1650-16
> 
> The UPORT devices don't directy fit the USB serial model. USB serial
> assumes a bulk in/out endpoint pair per serial port. Thus a dual port
> USB serial device is expected to have two bulk in/out pairs. The Moxa
> UPORT only has one pair for data transfer and places a header on each
> transfer over the endpoint indicating for which port the transfer
> relates to. There is a second endpoint pair for events, such as modem
> control lines changing state, setting baud rates etc. Again, a
> multiplexing header is used on these endpoints.
> 
> Some ports need to have a kfifo explicitily allocated since the
> framework does not allocate one if there is no associated endpoints.
> The framework will however free it on unload of the module.
> 
> All data transfers are made on port0, yet the locks are taken on PortN.
> urb->context points to PortN, even though the URB is for port0.
> 
> Where possible, code from the generic driver is called. However
> mxuport_process_read_urb_data() is mostly a cut/paste of
> usb_serial_generic_process_read_urb().
> 
> The driver will attempt to load firmware from userspace and compare
> the available version and the running version. If the available
> version is newer, it will be download into RAM of the device and
> started. This is optional and the driver appears to work O.K. with
> older firmware in the devices ROM.
> 
> This driver is based on the MOXA driver and retains MOXAs copyright.
> 
> Signed-off-by: Andrew Lunn 
> 
> ---
> 
> v1->v2
> 
> Remove debug module parameter.
> Add missing \n to dev_dbg() strings.
> Consistent dev_dbg("%s - \n", __func__);
> Don't log failed allocations.
> Remove defensive checks for NULL mx_port.
> Use snprintf() instead of sprintf().
> Use port->icount and usb_serial_generic_get_icount().
> Break firmware download into smaller functions.
> Don't DMA to/from buffers on the stack.
> Use more of the generic write functions.
> Make use of port_probe() and port_remove().
> Indent the device structure.
> Minor cleanups in mxuport_close()
> __u8 -> u8, __u16 -> u16.
> remove mxuport_wait_until_sent() and implemented mxuport_tx_empty()
> Remove mxuport_write_room() and use the generic equivelent.
> Remove unneeded struct mx_uart_config members
> Make use of generic functions for receiving data and events.
> Name mxport consistently.
> Use usb_serial_generic_tiocmiwait()
> Let line discipline handle TCFLSH ioctl.
> Import contents of mxuport.h into mxuport.c
> Use shifts and ORs to create version number.
> Use port_number, not minor
> 
> Clarify the meaning of interface in mx_uart_config.
> Remove buffer from mxuport_send_async_ctrl_urb().
> No need to multiply USB_CTRL_SET_TIMEOUT by HZ.
> Simplify buffer allocation and free.
> Swap (un)throttle to synchronous interface, remove async code.
> Pass usb_serial to mxuport_[recv|send]_ctrl_urb()
> Add missing {} on if else statement.
> Use unsigned char type, remove casts.
> Replace constants with defines.
> Add error handling when disabling HW flow control.
> Verify port is open before passing it recieved data
> Verify contents of received data & events.
> Remove broken support for alternative baud rates.
> Fix B0 and modem line handling. Remove uart_cfg structure.
> Remove hold_reason, which was set, but never used.
> s/is/if/
> Move parts of port open into port probe.
> Remove mxport->port and pass usb_serial_port instead.
> Remove mxport->flags which is no longer used.
> Allocate buffers before starting firmware download.
> Remove redundent "detected" debug message.
> Use devm_kzalloc() to simply memory handling.
> Remove repeated debug message when sending break.
> Implement mxuport_dtr_rts().
> Add locking around mcr_state.
> Remove unused lsr_state from mxuport_port.
> Support 485 via official IOCTL and sysfs.
> Use usleep_range() instread of mdelay().
> Simplify the comments.
> Use port0 as a template when setting up bulk out endpoints.
> Set bulk_in_size for unused endpoints to 0.
> Rebase to v3.12-rc2
> 
> v3->v4
> Remove support for rs485 - No hardware to test it on.
> Fix formatting of multi line comments.
> Use HEADER_SIZE instead of hard coded 4.
> Use EIO instread of ECOMM.
> Drop use of spinlocks on  mxuport_{un}throttle().
> Remove unneeded parenthesis.
> Split mxuport_process_read_urb_event() into a number of functions.
> Check for zero bytes of data.
> Don't needlessly initialize variables.
> Fold mxuport_port_init() into mxuport_port_open()
> Correctly handle the on parameter in mxuport_dtr_rts().
> Drop mxuport_get_serial_info and the now empty ioctl handler.
> Splitup mxuport_set_termios() into smaller functions
> Make use of C_* macros for cflags.
> Te

Re: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework

2013-12-06 Thread Matt Porter
On Fri, Dec 06, 2013 at 04:41:51PM +0530, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
> > Change the used phy driver to the new Exynos USB phy driver that uses the
> > generic phy framework.
> > 
> > Signed-off-by: Kamil Debski 
> > Signed-off-by: Kyungmin Park 
> > ---
> >  .../devicetree/bindings/usb/samsung-hsotg.txt  |4 
> >  drivers/usb/gadget/s3c-hsotg.c |   11 ++-
> >  2 files changed, 10 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt 
> > b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > index b83d428..9340d06 100644
> > --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > @@ -24,6 +24,8 @@ Required properties:
> >  - first entry: must be "otg"
> >  - vusb_d-supply: phandle to voltage regulator of digital section,
> >  - vusb_a-supply: phandle to voltage regulator of analog section.
> > +- phys: from general PHY binding: phandle to the PHY device
> > +- phy-names: from general PHY binding: should be "usb2-phy"
> 
> are you sure it's usb2-phy. The example below seems to have a different value.

I requested this be changed to usb2-phy, looks like he just missed the
update to the example.

> 
> >  
> >  Example
> >  -
> > @@ -36,5 +38,7 @@ Example
> > clock-names = "otg";
> > vusb_d-supply = <&vusb_reg>;
> > vusb_a-supply = <&vusbdac_reg>;
> > +   phys = <&usb2phy 0>;
> > +   phy-names = "device";
> > };
> >  
> > diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
> > index eccb147..db096fd 100644
> > --- a/drivers/usb/gadget/s3c-hsotg.c
> > +++ b/drivers/usb/gadget/s3c-hsotg.c
> > @@ -31,6 +31,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  
> >  #include 
> >  #include 
> > @@ -162,7 +163,7 @@ struct s3c_hsotg_ep {
> >  struct s3c_hsotg {
> > struct device*dev;
> > struct usb_gadget_driver *driver;
> > -   struct usb_phy  *phy;
> > +   struct phy   *phy;
> > struct s3c_hsotg_plat*plat;
> >  
> > spinlock_t  lock;
> > @@ -2905,7 +2906,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg 
> > *hsotg)
> > dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
> >  
> > if (hsotg->phy)
> > -   usb_phy_init(hsotg->phy);
> > +   phy_power_on(hsotg->phy);
> > else if (hsotg->plat->phy_init)
> > hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
> >  }
> > @@ -2922,7 +2923,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg 
> > *hsotg)
> > struct platform_device *pdev = to_platform_device(hsotg->dev);
> >  
> > if (hsotg->phy)
> > -   usb_phy_shutdown(hsotg->phy);
> > +   phy_power_off(hsotg->phy);
> > else if (hsotg->plat->phy_exit)
> > hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
> >  }
> > @@ -3529,7 +3530,7 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg 
> > *hsotg)
> >  static int s3c_hsotg_probe(struct platform_device *pdev)
> >  {
> > struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev);
> > -   struct usb_phy *phy;
> > +   struct phy *phy;
> > struct device *dev = &pdev->dev;
> > struct s3c_hsotg_ep *eps;
> > struct s3c_hsotg *hsotg;
> > @@ -3544,7 +3545,7 @@ static int s3c_hsotg_probe(struct platform_device 
> > *pdev)
> > return -ENOMEM;
> > }
> >  
> > -   phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
> > +   phy = devm_phy_get(&pdev->dev, "usb2-phy");
> > if (IS_ERR(phy)) {
> > /* Fallback for pdata */
> > plat = dev_get_platdata(&pdev->dev);
> > 
> 
--
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 coccinelle warnings

2013-12-06 Thread oliver
From: Fengguang Wu 

drivers/usb/host/ehci-mv.c:181:26-27: WARNING comparing pointer to 0, suggest !E
/c/kernel-tests/src/cocci/drivers/usb/host/ehci-mv.c:181:26-27: WARNING 
comparing pointer to 0

 Compare pointer-typed values to NULL rather than 0

Semantic patch information:
 This makes an effort to choose between !x and x == NULL.  !x is used
 if it has previously been used with the function used to initialize x.
 This relies on type information.  More type information can be obtained
 using the option -all_includes and the option -I to specify an
 include path.

Generated by: coccinelle/null/badzero.cocci

CC: Jingoo Han 
CC: Greg Kroah-Hartman 
Signed-off-by: Fengguang Wu 
---
 drivers/usb/host/ehci-mv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 417c10d..6e8afca 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -178,7 +178,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
 
ehci_mv->phy_regs = devm_ioremap(&pdev->dev, r->start,
 resource_size(r));
-   if (ehci_mv->phy_regs == 0) {
+   if (!ehci_mv->phy_regs) {
dev_err(&pdev->dev, "failed to map phy I/O memory\n");
retval = -EFAULT;
goto err_put_hcd;
-- 
1.8.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] Revert "USB: quirks: add touchscreen that is dazzeled by remote wakeup"

2013-12-06 Thread oliver
From: Oliver Neukum 

This reverts commit 614ced91fc6fbb5a1cdd12f0f1b6c9197d9f1350.
The units on this was seen were prototypes and the issue is
not seen on younger units.

Signed-off-by: Oliver Neukum 
---
 drivers/usb/core/quirks.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 12924db..8f37063 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -98,9 +98,6 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Alcor Micro Corp. Hub */
{ USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* MicroTouch Systems touchscreen */
-   { USB_DEVICE(0x0596, 0x051e), .driver_info = USB_QUIRK_RESET_RESUME },
-
/* appletouch */
{ USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
 
-- 
1.8.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 2/4 V2] ARM: mx28: Add USB PHY overcurrent pinmux

2013-12-06 Thread Michael Grzeschik
Hi Peter,

On Tue, Nov 26, 2013 at 12:08:03PM +, Peter Chen wrote:
> > The GPIO is working for this pin. But also the DIGCTL register bits
> > helped here.  Now the OC event triggers if the pin gets pulled to 3V3.
> > 
> > I am currently looking for a good place to enable the DIGCTL bits.
> > I suggest to enable them per default.  As we don't have USBMISC registers
> > in MX28, the bits should be toggled in ci_hdrc_imx.c if the of property
> > "disable-overcurrent" is not found.  I will use the syscon interface to
> > reach them with the regmap interface.
> > 
> usbmisc register doesn't stand for the register needs to be in usb controller.
> Any registers which are related to USB function can be considered as usbmisc
> registers. You will see FSL-style SoC, the over-current or other related 
> setting
> are at controller base + 0x800 (0x600), but Sigmatel-style SoC (mx28/mx23), 
> the usb
> register are not at controller register region.
> 
> My suggestion is: create usbmisc node for mx28, and put oc setting at there, 
> it can
> keep ci_hdrc_imx.c clean.
> Besides, you may need two dts user setting for oc enable and oc polarity.

IMHO usbmisc is a driver with memery mapped region. So it would probably
make more sense to use syscon for that purpose, as we only need special
registers out of the digctl register.

What do you think of that code:

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 68f7f5e..ddac5cb 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -19,12 +19,18 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ci.h"
 #include "ci_hdrc_imx.h"
 
 #define CI_HDRC_IMX_IMX28_WRITE_FIX BIT(0)
 
+#define DIGCTL_CTRL_SET0x4
+#define USB_OTG_OC_ENABLE_BIT  BIT(23)
+#define USB_H1_OC_ENABLE_BIT   BIT(24)
+
 struct ci_hdrc_imx_platform_flag {
unsigned int flags;
 };
@@ -105,6 +111,26 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
const struct of_device_id *of_id =
of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data;
+   struct device_node *np = pdev->dev.of_node;
+   struct regmap *digctl;
+
+   /* Some SoCs don't have digctl registers */
+   if (of_get_property(np, "fsl,digctl", NULL)) {
+   struct of_phandle_args args;
+   int enable_bit = USB_OTG_OC_ENABLE_BIT;
+   ret = of_parse_phandle_with_args(np, "fsl,digctl", 
"#index-cells",
+   0, &args);
+   digctl = syscon_regmap_lookup_by_phandle
+   (np, "fsl,digctl");
+   if (IS_ERR(digctl)) {
+   dev_dbg(&pdev->dev,
+   "failed to find regmap for digctl\n");
+   } else {
+   if (args.args[0])
+   enable_bit = USB_H1_OC_ENABLE_BIT;
+   regmap_write(digctl, DIGCTL_CTRL_SET, enable_bit);
+   }
+   }
 
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {


diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 600f7cb..bb61c49 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -668,11 +668,12 @@
};
};
 
-   digctl@8001c000 {
-   compatible = "fsl,imx28-digctl";
+   digctl: digctl@8001c000 {
+   #index-cells = <1>;
+   compatible = "fsl,imx28-digctl", "syscon";
reg = <0x8001c000 0x2000>;
interrupts = <89>;
-   status = "disabled";
+   status = "okay";
};
 
etm@80022000 {
@@ -976,6 +977,7 @@
interrupts = <93>;
clocks = <&clks 60>;
fsl,usbphy = <&usbphy0>;
+   fsl,digctl = <&digctl 0>;
status = "disabled";
};
 
@@ -985,6 +987,7 @@
interrupts = <92>;
clocks = <&clks 61>;
fsl,usbphy = <&usbphy1>;
+   fsl,digctl = <&digctl 1>;
status = "disabled";
};
 
Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the

Re: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Greg Kroah-Hartman
On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> >> The following changes since commit 
> >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> >>
> >>   Merge tag 'fixes-for-v3.13-rc2' of 
> >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
> >> (2013-11-27 09:49:03 -0800)
> >>
> >> are available in the git repository at:
> >>
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> >> tags/for-usb-linus-2013-12-02
> > 
> > Pulled and pushed out, thanks.
> 
> Did this commit make it into linux-3.12.3 ?

There's this cool tool called 'git' where you can look these things
up... :)

No, it's not there yet, as it's not in Linus's tree yet, give me a
chance...

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: atm: usbatm: fixed a pointer variable format issue

2013-12-06 Thread Duncan Sands

Hi Seth,

On 06/12/13 15:24, Seth Archer wrote:

Sorry, but do you mean the patch is OK, or the original is OK and no patch
necessary?


I meant that the patch is obviously OK.

Ciao, Duncan.



-Seth


On Fri, Dec 6, 2013 at 3:24 AM, Duncan Sands mailto:duncan.sa...@gmail.com>> wrote:

On 06/12/13 04:59, learc83 wrote:

Fixed a pointer variable format issue.


This is obviously OK.



--
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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread David Laight
> From: Greg Kroah-Hartman [mailto:gre...@linuxfoundation.org]
> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> > >> The following changes since commit 
> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> > >>
> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into
> usb-linus (2013-11-27 09:49:03 -0800)
> > >>
> > >> are available in the git repository at:
> > >>
> > >>
> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> > >> tags/for-usb-linus-2013-12-02
> > >
> > > Pulled and pushed out, thanks.
> >
> > Did this commit make it into linux-3.12.3 ?
> 
> There's this cool tool called 'git' where you can look these things
> up... :)

If you are really desperate to find what is in a specific kernel use
objdump -d.

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


Re: zte_ev not properly handling ZTE AC2726 CDMA modems

2013-12-06 Thread Johan Hovold
On Mon, Dec 02, 2013 at 12:09:30PM -0800, Dmitry Kunilov wrote:
> I was able to merge 3.12.1 with Broadcom code over the weekend, so I am 
> running the latest kernel now, but the problem is still there.
> I did the test as you suggested without any diagnostic patches and with 
> dynamic debugging enabled and I am attaching the output.
> I don't really see anything suspicious in the traces, which makes me 
> believe that one of those hardcoded commands in zte_ev is enabling some 
> sort of watchdog in the modem that drops the ppp connection after a 
> while. Communication with the modem doesn't really break because pppd is 
> able to reestablish the connection after it drops. If you think you need 
> a usbmon trace please let me know.

No, that's ok. Thanks for testing anyway.

Johan
--
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-06 Thread Kamil Debski
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 
> > Signed-off-by: Kyungmin Park 
> > ---
> >  .../devicetree/bindings/phy/samsung-usbphy.txt |   54 
> >  drivers/phy/Kconfig|   20 ++
> >  drivers/phy/Makefile   |3 +
> >  drivers/phy/phy-exynos4210-usb2.c  |  264
> +
> >  drivers/phy/phy-exynos4212-usb2.c  |  312
> 
> >  drivers/phy/phy-samsung-usb2.c |  228
> ++
> >  drivers/phy/phy-samsung-usb2.h |   72 +
> >  7 files changed, 953 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> >  create mode 100644 drivers/phy/phy-exynos4210-usb2.c  create mode
> > 100644 drivers/phy/phy-exynos4212-usb2.c  create mode 100644
> > drivers/phy/phy-samsung-usb2.c  create mode 100644
> > drivers/phy/phy-samsung-usb2.h
> >
> > diff --git a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> > b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> > new file mode 100644
> > index 000..cadbf70
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> 
> use the existing samsung-phy.txt.

Ok.

> > @@ -0,0 +1,54 @@
> > +Samsung S5P/EXYNOS SoC series USB PHY
> > +-
> > +
> > +Required properties:
> > +- compatible : should be one of the listed compatibles:
> > +   - "samsung,exynos4210-usb2-phy"
> > +   - "samsung,exynos4212-usb2-phy"
> > +- reg : a list of registers used by phy driver
> > +   - first and obligatory is the location of phy modules registers
> > +- samsung,sysreg-phandle - handle to syscon used to control the
> > +system registers
> > +- samsung,pmureg-phandle - handle to syscon used to control PMU
> > +registers
> > +- #phy-cells : from the generic phy bindings, must be 1;
> > +- clocks and clock-names:
> > +   - the "phy" clocks is required by the phy module
> > +   - next for each of the phys a clock has to be assidned, this
> clock
> 
> %s/assidned/assigned/

Thank you for spotting this.

> > + will be used to determine clocking frequency for the phys
> > + (the labels are specified in the paragraph below)
> > +
> > +The first phandle argument in the PHY specifier identifies the PHY,
> > +its meaning is compatible dependent. For the currently supported
> SoCs
> > +(Exynos 4210 and Exynos 4212) it is as follows:
> > +  0 - USB device ("device"),
> > +  1 - USB host ("host"),
> > +  2 - HSIC0 ("hsic0"),
> > +  3 - HSIC1 ("hsic1"),
> > +
> > +Exynos 4210 and Exynos 4212 use mode switching and require that mode
> > +switch register is supplied.
> > +
> > +Example:
> > +
> > +For Exynos 4412 (compatible with Exynos 4212):
> > +
> > +usbphy: phy@125B {
> 
> use lower case for address here...

Ok.

> > +   compatible = "samsung,exynos4212-usb2-phy";
> > +   reg = <0x125B 0x100 0x10020704 0x0c 0x1001021c 0x4>;
> and here..
> > +   clocks = <&clock 305>, <&clock 2>, <&clock 2>, <&clock 2>,
> > +   <&clock 2>;
> > +   clock-names = "phy", "device", "host", "hsic0", "hsic1";
> > +   status = "okay";
> > +   #phy-cells = <1>;
> > +   samsung,sysreg-phandle = <&sys_reg>;
> > +   samsung,pmureg-phandle = <&pmu_reg>; };
> > +
> > +Then the PHY can be used in other nodes such as:
> > +
> > +phy-consumer@1234 {
> > +   phys = <&usbphy 2>;
> > +   phy-names = "phy";
> > +};
> > +
> > +Refer to DT bindings documentation of particular PHY consumer
> devices
> > +for more information about required PHYs and the way of
> specification.
> > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index
> > a344f3d..b29018f 100644
> > --- a/drivers/phy/Kconfig
> > +++ b/drivers/phy/Kconfig
> > @@ -51,4 +51,24 @@ config PHY_EXYNOS_DP_VIDEO
> > help
> >   Support for Display Port PHY found on Samsung EXYNOS SoCs.
> >
> > +config PHY_SAMSUNG_USB2
> > +   tristate "Samsung USB 2.0 PHY driver"
> > +   help
> > + Enable this to support Samsung USB phy helper driver for
> Samsung SoCs.
> > + This driver provides common interface to interact, for Samsung
> > + USB 2.0 PHY driver.
> > +
> > +config PHY_EXYNOS4210_USB2
> > +   bool "Support for Exynos 4210"
> > +   depends on PHY_SAMSUNG_USB2
> > +   depends on CPU_EXYNOS4210
> 
> select GENERIC_PHY here?

I think that depends on PHY_SAMSUNG_USB2 is better in this place.
However, I agree that I should add select GENERIC_PHY to PHY_SAMSUNG_USB2.

The reason why I am saying this is that I like how it looks in
men

RE: [PATCH v4 5/9] usb: s3c-hsotg: Use the new Exynos USB phy driver with the generic phy framework

2013-12-06 Thread Kamil Debski
Hi,

> From: Matt Porter [mailto:matt.por...@linaro.org]
> Sent: Friday, December 06, 2013 4:01 PM
> 
> On Fri, Dec 06, 2013 at 04:41:51PM +0530, Kishon Vijay Abraham I wrote:
> > Hi,
> >
> > On Thursday 05 December 2013 05:59 PM, Kamil Debski wrote:
> > > Change the used phy driver to the new Exynos USB phy driver that
> > > uses the generic phy framework.
> > >
> > > Signed-off-by: Kamil Debski 
> > > Signed-off-by: Kyungmin Park 
> > > ---
> > >  .../devicetree/bindings/usb/samsung-hsotg.txt  |4 
> > >  drivers/usb/gadget/s3c-hsotg.c |   11 ++--
> ---
> > >  2 files changed, 10 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/usb/samsung-
> hsotg.txt
> > > b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > > index b83d428..9340d06 100644
> > > --- a/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > > +++ b/Documentation/devicetree/bindings/usb/samsung-hsotg.txt
> > > @@ -24,6 +24,8 @@ Required properties:
> > >  - first entry: must be "otg"
> > >  - vusb_d-supply: phandle to voltage regulator of digital section,
> > >  - vusb_a-supply: phandle to voltage regulator of analog section.
> > > +- phys: from general PHY binding: phandle to the PHY device
> > > +- phy-names: from general PHY binding: should be "usb2-phy"
> >
> > are you sure it's usb2-phy. The example below seems to have a
> different value.
> 
> I requested this be changed to usb2-phy, looks like he just missed the
> update to the example.

This is true. I missed the change in the example part of the file.

> 
> >
> > >
> > >  Example
> > >  -
> > > @@ -36,5 +38,7 @@ Example
> > >   clock-names = "otg";
> > >   vusb_d-supply = <&vusb_reg>;
> > >   vusb_a-supply = <&vusbdac_reg>;
> > > + phys = <&usb2phy 0>;
> > > + phy-names = "device";
> > >   };

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

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


CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Dave Mielke
I'm using kernel 3.11.4-101.fc18.x86_64 on a 64-bit Fedora 19 system.

I'd very much appreciate a bit of help from someone who understands the CP2102 
serial adapter support. When I access it through /dev/ttyUSB0, it works fine. 
When, however, I access it through usbfs, it doesn't seem to be working. When I 
study the usbmon output for both methods, they look to be effectively the same. 
I've attached the two usbmon traces to this message (as usbmon-ttyUSB0 and 
usbmon-usbfs).

The first output packet to endpoint 1 (FF,FF,11,00,00,00) probes the device. 
When ttyUSB0 is being used, there's an immediate response of the single byte 
0X10. This is correct. When usbfs is being used, the probe is resent several 
times, with no response, and then the code gives up. All of the control setup 
for the CP2102 completes without any errors. The usbfs code even includes a set 
of queries to ensure that the serial configuration is correct - it is. The 
correct settings are: 9600 baud, 1 stop bit, 8 data bits, no parity, no flow 
control.

In case it matters, urb->signr is set (to SIGRTMIN). We rely in receipt of this 
signal to know that the URB is ready to be reaped. This is working very well 
for many devices. Is there a possibility, though, that the kernel support for 
the CP2102 doesn't work this way?

I'd sure appreciate any help on this issue as I've been staring at it for a 
couple of weeks now and haven't been able to spot the problem.

-- 
Dave Mielke   | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | http://Mielke.cc/bible/
EMail: d...@mielke.cc | Canada  K2A 1H7   | http://FamilyRadio.com/
8801138a0540 3905511537 S Co:5:065:0 s 41 00 0001   0
8801138a0540 3905511739 C Co:5:065:0 0 0
8801138a0540 3905511804 S Ci:5:065:0 s c1 1d   0004 4 <
8801138a0540 3905513729 C Ci:5:065:0 0 4 = 00c20100
8801138a0540 3905513780 S Ci:5:065:0 s c1 04   0002 2 <
8801138a0540 3905515728 C Ci:5:065:0 0 2 = 0008
8801138a0540 3905515780 S Ci:5:065:0 s c1 14   0010 16 <
8801138a0540 3905517728 C Ci:5:065:0 0 16 =    

8801138a0540 3905517788 S Co:5:065:0 s 41 1e   0004 4 = 00c20100
8801138a0540 3905519728 C Co:5:065:0 0 4 >
8801f1357b40 3905519788 S Bi:5:065:1 -115 256 <
8801f1357480 3905519806 S Bi:5:065:1 -115 256 <
8801138a0540 3905519814 S Co:5:065:0 s 41 07 0303   0
8801138a0540 3905521728 C Co:5:065:0 0 0
8801138a0540 3905521922 S Co:5:065:0 s 41 1e   0004 4 = 8025
8801138a0540 3905523729 C Co:5:065:0 0 4 >
8801f1357f00 3905523925 S Bo:5:065:1 -115 6 = 1100 
8801f1357f00 3905524727 C Bo:5:065:1 0 6 >
8801f1357b40 3905533742 C Bi:5:065:1 0 1 = 10
8801f1357b40 3905533769 S Bi:5:065:1 -115 256 <
8801f1357f00 3905534088 S Bo:5:065:1 -115 8 = 2000 0200
8801f1357f00 3905534742 C Bo:5:065:1 0 8 >
8801f1357480 3905545744 C Bi:5:065:1 0 1 = 01
8801f1357480 3905545767 S Bi:5:065:1 -115 256 <
8801f1357f00 3905720408 S Bo:5:065:1 -115 22 = 3100 1000d0f4 f07c7cbe 
00460a42 8c84e200 e42c
8801f1357f00 3905720748 C Bo:5:065:1 0 22 >
8801f1357f00 3909722839 S Bo:5:065:1 -115 22 = 3100 100084e2 00626026 
44b8  
8801f1357f00 3909723834 C Bo:5:065:1 0 22 >
8801f1357f00 3913727391 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
1100  
8801f1357f00 3913727920 C Bo:5:065:1 0 22 >
8801f1357f00 3915801255 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
0a11  
8801f1357f00 3915801953 C Bo:5:065:1 0 22 >
8801f1357f00 3915968840 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
0a281100  
8801f1357f00 3915969971 C Bo:5:065:1 0 22 >
8801f1357f00 3916120839 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
0a286811  
8801f1357f00 3916120966 C Bo:5:065:1 0 22 >
8801f1357f00 3916198389 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
0a28686c 1100 
8801f1357f00 3916198964 C Bo:5:065:1 0 22 >
8801f1357f00 3916258345 S Bo:5:065:1 -115 22 = 3100 1000e4a4 a46c2c00 
0a28686c e811 
8801f1357f00 3916258963 C Bo:5:065:1 0 22 >
8801f1357f00 3916463844 S Bo:5:065:1 -115 22 = 3100 10001100  
  
8801f1357f00 3916463973 C Bo:5:065:1 0 22 >
8801f1357f00 3916471390 S Bo:5:065:1 -115 22 = 3100 1000d0f4 f07c7cbe 
00686ca4 e8e8848c 
8801f1357f00 3916471964 C Bo:5:065:1 0 22 >
8801f1357f00 3916497807 S Bo:5:065:1 -115 6 = 2800 
8801f1357f00 3916497977 C Bo:5:065:1 0 6 >
8801c67743c0 3916505997 S Co:5:065:0 s 41 1e   0004 4 = 00c20100
8801c67743c0 3916506983 C Co:5:065:0 0 4 >
8801c67743c0 3916507047 S Co:5:065:0 s 41 07 0300   0
8801c67743c0 3916508981 C Co:5:065:0 0 0
8801f1357b40 3916509984 C Bi:5:065:1 -2 0
8801f1357480 3916510984 C 

RE: [PATCH v4 3/9] phy: Add new Exynos USB PHY driver

2013-12-06 Thread Kamil Debski
Hi,

> From: Kamil Debski [mailto:k.deb...@samsung.com]
> Sent: Friday, December 06, 2013 5:28 PM
> 
> 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 
> > > Signed-off-by: Kyungmin Park 
> > > ---
> > >  .../devicetree/bindings/phy/samsung-usbphy.txt |   54 
> > >  drivers/phy/Kconfig|   20 ++
> > >  drivers/phy/Makefile   |3 +
> > >  drivers/phy/phy-exynos4210-usb2.c  |  264
> > +
> > >  drivers/phy/phy-exynos4212-usb2.c  |  312
> > 
> > >  drivers/phy/phy-samsung-usb2.c |  228
> > ++
> > >  drivers/phy/phy-samsung-usb2.h |   72 +
> > >  7 files changed, 953 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> > >  create mode 100644 drivers/phy/phy-exynos4210-usb2.c  create mode
> > > 100644 drivers/phy/phy-exynos4212-usb2.c  create mode 100644
> > > drivers/phy/phy-samsung-usb2.c  create mode 100644
> > > drivers/phy/phy-samsung-usb2.h
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> > > b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> > > new file mode 100644
> > > index 000..cadbf70
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/phy/samsung-usbphy.txt
> >
> > use the existing samsung-phy.txt.
> 
> Ok.
> 
> > > @@ -0,0 +1,54 @@
> > > +Samsung S5P/EXYNOS SoC series USB PHY
> > > +-
> > > +
> > > +Required properties:
> > > +- compatible : should be one of the listed compatibles:
> > > + - "samsung,exynos4210-usb2-phy"
> > > + - "samsung,exynos4212-usb2-phy"
> > > +- reg : a list of registers used by phy driver
> > > + - first and obligatory is the location of phy modules registers
> > > +- samsung,sysreg-phandle - handle to syscon used to control the
> > > +system registers
> > > +- samsung,pmureg-phandle - handle to syscon used to control PMU
> > > +registers
> > > +- #phy-cells : from the generic phy bindings, must be 1;
> > > +- clocks and clock-names:
> > > + - the "phy" clocks is required by the phy module
> > > + - next for each of the phys a clock has to be assidned, this
> > clock
> >
> > %s/assidned/assigned/
> 
> Thank you for spotting this.
> 
> > > +   will be used to determine clocking frequency for the phys
> > > +   (the labels are specified in the paragraph below)
> > > +
> > > +The first phandle argument in the PHY specifier identifies the PHY,
> > > +its meaning is compatible dependent. For the currently supported
> > SoCs
> > > +(Exynos 4210 and Exynos 4212) it is as follows:
> > > +  0 - USB device ("device"),
> > > +  1 - USB host ("host"),
> > > +  2 - HSIC0 ("hsic0"),
> > > +  3 - HSIC1 ("hsic1"),
> > > +
> > > +Exynos 4210 and Exynos 4212 use mode switching and require that
> > > +mode switch register is supplied.
> > > +
> > > +Example:
> > > +
> > > +For Exynos 4412 (compatible with Exynos 4212):
> > > +
> > > +usbphy: phy@125B {
> >
> > use lower case for address here...
> 
> Ok.
> 
> > > + compatible = "samsung,exynos4212-usb2-phy";
> > > + reg = <0x125B 0x100 0x10020704 0x0c 0x1001021c 0x4>;
> > and here..
> > > + clocks = <&clock 305>, <&clock 2>, <&clock 2>, <&clock 2>,
> > > + <&clock 2>;
> > > + clock-names = "phy", "device", "host", "hsic0", "hsic1";
> > > + status = "okay";
> > > + #phy-cells = <1>;
> > > + samsung,sysreg-phandle = <&sys_reg>;
> > > + samsung,pmureg-phandle = <&pmu_reg>; };
> > > +
> > > +Then the PHY can be used in other nodes such as:
> > > +
> > > +phy-consumer@1234 {
> > > + phys = <&usbphy 2>;
> > > + phy-names = "phy";
> > > +};
> > > +
> > > +Refer to DT bindings documentation of particular PHY consumer
> > devices
> > > +for more information about required PHYs and the way of
> > specification.
> > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index
> > > a344f3d..b29018f 100644
> > > --- a/drivers/phy/Kconfig
> > > +++ b/drivers/phy/Kconfig
> > > @@ -51,4 +51,24 @@ config PHY_EXYNOS_DP_VIDEO
> > >   help
> > > Support for Display Port PHY found on Samsung EXYNOS SoCs.
> > >
> > > +config PHY_SAMSUNG_USB2
> > > + tristate "Samsung USB 2.0 PHY driver"
> > > + help
> > > +   Enable this to support Samsung USB phy helper driver for
> > Samsung SoCs.
> > > +   This driver provides common interface to interact, for Samsung
> > > +   USB 2.0 PHY driver.
> > > +
> > > +config PHY_EXYNOS4210_USB2
> > > + bool "Support for 

Re: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Greg KH
On Fri, Dec 06, 2013 at 11:37:34AM -0500, Dave Mielke wrote:
> I'm using kernel 3.11.4-101.fc18.x86_64 on a 64-bit Fedora 19 system.
> 
> I'd very much appreciate a bit of help from someone who understands the 
> CP2102 
> serial adapter support. When I access it through /dev/ttyUSB0, it works fine. 
> When, however, I access it through usbfs, it doesn't seem to be working. When 
> I 
> study the usbmon output for both methods, they look to be effectively the 
> same. 
> I've attached the two usbmon traces to this message (as usbmon-ttyUSB0 and 
> usbmon-usbfs).

How are you accessing the device through usbfs?  At that point, it's a
"raw" USB device, the driver isn't connected and you now have to emulate
the driver entirely from userspace, writing a whole new "userspace
driver" for the device.  Why are you doing that?

Anyway, the source is all there for the kernel driver, if you wish to
reimplement it as a userspace program, you really are on your own,
sorry.

good luck,

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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Sarah Sharp
On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> >> The following changes since commit 
> >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> >>
> >>   Merge tag 'fixes-for-v3.13-rc2' of 
> >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
> >> (2013-11-27 09:49:03 -0800)
> >>
> >> are available in the git repository at:
> >>
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> >> tags/for-usb-linus-2013-12-02
> > 
> > Pulled and pushed out, thanks.
> 
> Did this commit make it into linux-3.12.3 ?
> 
> I ask, because the NIC still locks up with that kernel,
> and even with the patch I had been using from David Laight.
> 
> Reverting the change that originally broke it still works though.
> Could we please get this reverted until such time as a reworked
> patch can be prepared for it?

Greg, can you please revert David's patch (commit 35773dac5f86 from your
usb-linus branch)?

David said the patch fixed this lock up issue with his USB ethernet
adapter, but Mark says it doesn't fix the issue.  The patch touches some
hairy ring code in the xHCI driver, and I would rather not make any
changes to that code unless we can prove there is an issue with that
code.  We can always add the patch back later if it does turn out to fix
an issue.

David, can you please revert any local changes you've made, revert the
offending commit Mark is talking about (I think it's
http://patchwork.ozlabs.org/patch/264021/, which is commit
f27070158d6754765f2f5fd1617e8e42a0ea2318), and retest?  I want to see if
reverting that commit without making changes to the xHCI ring handling
code fixes your issues.

Thanks,
Sarah Sharp

> 
> This is what I am reverting locally to make it all work
> as it did prior to linux-3.12 was released.  Unmangled copy also attached:
> 
> --- linux/drivers/net/usb/ax88179_178a.c.orig 2013-11-03 18:41:51.0 
> -0500
> +++ linux/drivers/net/usb/ax88179_178a.c  2013-11-17 13:23:39.525734277 
> -0500
> @@ -1177,18 +1177,31 @@
>   int frame_size = dev->maxpacket;
>   int mss = skb_shinfo(skb)->gso_size;
>   int headroom;
> + int tailroom;
> 
>   tx_hdr1 = skb->len;
>   tx_hdr2 = mss;
>   if (((skb->len + 8) % frame_size) == 0)
>   tx_hdr2 |= 0x80008000;  /* Enable padding */
> 
> - headroom = skb_headroom(skb) - 8;
> + headroom = skb_headroom(skb);
> + tailroom = skb_tailroom(skb);
> 
> - if ((skb_header_cloned(skb) || headroom < 0) &&
> - pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) {
> + if (!skb_header_cloned(skb) &&
> + !skb_cloned(skb) &&
> + (headroom + tailroom) >= 8) {
> + if (headroom < 8) {
> + skb->data = memmove(skb->head + 8, skb->data, skb->len);
> + skb_set_tail_pointer(skb, skb->len);
> + }
> + } else {
> + struct sk_buff *skb2;
> +
> + skb2 = skb_copy_expand(skb, 8, 0, flags);
>   dev_kfree_skb_any(skb);
> - return NULL;
> + skb = skb2;
> + if (!skb)
> + return NULL;
>   }
> 
>   skb_push(skb, 4);

> --- linux/drivers/net/usb/ax88179_178a.c.orig 2013-11-03 18:41:51.0 
> -0500
> +++ linux/drivers/net/usb/ax88179_178a.c  2013-11-17 13:23:39.525734277 
> -0500
> @@ -1177,18 +1177,31 @@
>   int frame_size = dev->maxpacket;
>   int mss = skb_shinfo(skb)->gso_size;
>   int headroom;
> + int tailroom;
>  
>   tx_hdr1 = skb->len;
>   tx_hdr2 = mss;
>   if (((skb->len + 8) % frame_size) == 0)
>   tx_hdr2 |= 0x80008000;  /* Enable padding */
>  
> - headroom = skb_headroom(skb) - 8;
> + headroom = skb_headroom(skb);
> + tailroom = skb_tailroom(skb);
>  
> - if ((skb_header_cloned(skb) || headroom < 0) &&
> - pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) {
> + if (!skb_header_cloned(skb) &&
> + !skb_cloned(skb) &&
> + (headroom + tailroom) >= 8) {
> + if (headroom < 8) {
> + skb->data = memmove(skb->head + 8, skb->data, skb->len);
> + skb_set_tail_pointer(skb, skb->len);
> + }
> + } else {
> + struct sk_buff *skb2;
> +
> + skb2 = skb_copy_expand(skb, 8, 0, flags);
>   dev_kfree_skb_any(skb);
> - return NULL;
> + skb = skb2;
> + if (!skb)
> + return NULL;
>   }
>  
>   skb_push(skb, 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: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Dave Mielke
[quoted lines by Greg KH on 2013/12/06 at 08:59 -0800]

>How are you accessing the device through usbfs?  

Via /dev/usb//

>At that point, it's a "raw" USB device, the driver isn't connected and you now 
>have to emulate the driver entirely from userspace, 

Yes, I realize that. Our code already does that, with small hooks for 
device-specific things. It's been working well for many years.

As I've said, all the control operations to configure the CP2102 look right. In 
additiion, a set of queries verify that the configuration is correct. And, as 
observed above, our generic code has been used with other serial adapters for 
years and is working well.

>Anyway, the source is all there for the kernel driver, if you wish to 
>reimplement it as a userspace program,

As a (perhaps naive) observation, since our code and the kernel driver are 
doing essentially the same thing as confirmed by the usbmon traces I'd 
attached, our code is (supposedly) doing all the right stuff. The extra 
configuration queries we inserted, which are also in the usbmon trace, confirm 
this, too.

>you really are on your own, sorry.

I understand that that's the easy answer to give, and perhaps I shouldn't 
expect any more than that, but, really, is it really wrong to ask the "experts" 
for a bit of help? Maybe you don't want to give any, but, just maybe, someone 
who is knowledgeable regarding the CP2102 will be willing. I can only hope. 
It's not, after all, like I haven't given it a serious attempt on my own, 
already.

-- 
Dave Mielke   | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | http://Mielke.cc/bible/
EMail: d...@mielke.cc | Canada  K2A 1H7   | http://FamilyRadio.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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread David Laight
> From: Sarah Sharp
> Sent: 06 December 2013 17:03
> To: Mark Lord
> Cc: Greg Kroah-Hartman; linux-usb@vger.kernel.org; David Laight; 
> net...@vger.kernel.org
> Subject: Re: [GIT PULL] xhci: Regression fix for 3.13.
> 
> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> > >> The following changes since commit 
> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> > >>
> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into
> usb-linus (2013-11-27 09:49:03 -0800)
> > >>
> > >> are available in the git repository at:
> > >>
> > >>
> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> > >> tags/for-usb-linus-2013-12-02
> > >
> > > Pulled and pushed out, thanks.
> >
> > Did this commit make it into linux-3.12.3 ?
> >
> > I ask, because the NIC still locks up with that kernel,
> > and even with the patch I had been using from David Laight.
> >
> > Reverting the change that originally broke it still works though.
> > Could we please get this reverted until such time as a reworked
> > patch can be prepared for it?
> 
> Greg, can you please revert David's patch (commit 35773dac5f86 from your
> usb-linus branch)?
> 
> David said the patch fixed this lock up issue with his USB ethernet
> adapter, but Mark says it doesn't fix the issue.  The patch touches some
> hairy ring code in the xHCI driver, and I would rather not make any
> changes to that code unless we can prove there is an issue with that
> code.  We can always add the patch back later if it does turn out to fix
> an issue.

I thought Mark had said that my patch fixed things for him with the earlier
kernel.  It certainly makes a massive difference on my system.
And I ran with enough diagnostics to work out when the tx side stopped.
The last packet for which an ack was received was the one before the one
that straddled the ring end.

If you want to change the ax179 driver you need to stop it using
SG and segmentation offload.
The patch that mark is talking about isn't really the one that makes a 
difference.
I think it just forces the skb be linearised at that point. Which mostly
means that there won't be any fragments.

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


Re: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Dave Mielke
[quoted lines by Preston Fick on 2013/12/06 at 11:07 -0600]

>In my opinion I would just use the serial interface, unless you have a
>compelling reason to do something otherwise.

Yes, I have a compelling reason. Apparently, though, this community doesn't 
believe in being helpful.

-- 
Dave Mielke   | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | http://Mielke.cc/bible/
EMail: d...@mielke.cc | Canada  K2A 1H7   | http://FamilyRadio.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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread David Miller

Sarah, calm down.

Let Greg merge the XHCI fix and let's have people test it.

The whole holdup is because the USB subsystem is taking forever
to merge the XHCI patch.

I would have merged it in 24-48 hours if it were my subsystem. :)

--
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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Greg Kroah-Hartman
On Fri, Dec 06, 2013 at 09:03:25AM -0800, Sarah Sharp wrote:
> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> > >> The following changes since commit 
> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> > >>
> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
> > >> (2013-11-27 09:49:03 -0800)
> > >>
> > >> are available in the git repository at:
> > >>
> > >>
> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> > >> tags/for-usb-linus-2013-12-02
> > > 
> > > Pulled and pushed out, thanks.
> > 
> > Did this commit make it into linux-3.12.3 ?
> > 
> > I ask, because the NIC still locks up with that kernel,
> > and even with the patch I had been using from David Laight.
> > 
> > Reverting the change that originally broke it still works though.
> > Could we please get this reverted until such time as a reworked
> > patch can be prepared for it?
> 
> Greg, can you please revert David's patch (commit 35773dac5f86 from your
> usb-linus branch)?

Now reverted.

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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread David Miller
From: Greg Kroah-Hartman 
Date: Fri, 6 Dec 2013 09:29:47 -0800

> On Fri, Dec 06, 2013 at 09:03:25AM -0800, Sarah Sharp wrote:
>> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
>> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
>> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
>> > >> The following changes since commit 
>> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
>> > >>
>> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
>> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
>> > >> (2013-11-27 09:49:03 -0800)
>> > >>
>> > >> are available in the git repository at:
>> > >>
>> > >>
>> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
>> > >> tags/for-usb-linus-2013-12-02
>> > > 
>> > > Pulled and pushed out, thanks.
>> > 
>> > Did this commit make it into linux-3.12.3 ?
>> > 
>> > I ask, because the NIC still locks up with that kernel,
>> > and even with the patch I had been using from David Laight.
>> > 
>> > Reverting the change that originally broke it still works though.
>> > Could we please get this reverted until such time as a reworked
>> > patch can be prepared for it?
>> 
>> Greg, can you please revert David's patch (commit 35773dac5f86 from your
>> usb-linus branch)?
> 
> Now reverted.

Please NO!

Merge the XHCI change, the change you have reverted actually fixes
things for some people and the XHCI change gets rid of the stated
regression.
--
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: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Greg KH
On Fri, Dec 06, 2013 at 12:22:40PM -0500, Dave Mielke wrote:
> [quoted lines by Preston Fick on 2013/12/06 at 11:07 -0600]
> 
> >In my opinion I would just use the serial interface, unless you have a
> >compelling reason to do something otherwise.
> 
> Yes, I have a compelling reason. Apparently, though, this community doesn't 
> believe in being helpful.

Please realize what you are asking for here.  Basically you are saying,
"I don't want to use your code, so please help debug my reimplementation
of your code without being able to see it at all because I need the
help."

What would you do in our situation?  I have an inbox full of people who
are wanting to contribute to Linux, not circumvent it, and a fixed
amount of time in which to use to respond.  Which would help out more
people overall?

Best of luck with your project,

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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread David Laight
> From: David Miller [mailto:da...@davemloft.net]
> > From: Greg Kroah-Hartman 
> > Date: Fri, 6 Dec 2013 09:29:47 -0800
> 
> > On Fri, Dec 06, 2013 at 09:03:25AM -0800, Sarah Sharp wrote:
> >> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> >> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> >> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> >> > >> The following changes since commit 
> >> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> >> > >>
> >> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> >> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb
> into usb-linus (2013-11-27 09:49:03 -0800)
> >> > >>
> >> > >> are available in the git repository at:
> >> > >>
> >> > >>
> >> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> >> > >> tags/for-usb-linus-2013-12-02
> >> > >
> >> > > Pulled and pushed out, thanks.
> >> >
> >> > Did this commit make it into linux-3.12.3 ?
> >> >
> >> > I ask, because the NIC still locks up with that kernel,
> >> > and even with the patch I had been using from David Laight.
> >> >
> >> > Reverting the change that originally broke it still works though.
> >> > Could we please get this reverted until such time as a reworked
> >> > patch can be prepared for it?
> >>
> >> Greg, can you please revert David's patch (commit 35773dac5f86 from your
> >> usb-linus branch)?
> >
> > Now reverted.
> 
> Please NO!
> 
> Merge the XHCI change, the change you have reverted actually fixes
> things for some people and the XHCI change gets rid of the stated
> regression.

I know that some of the xhci ring code is rather complex [1].
But that particular patch should be completely safe as it just adds
some extra nop commands into the ring.

Possibly Mark is seeing some additional failure caused by something else.

Without my fix the xhci code carries on sending data to the usb hardware,
but no ethernet frames get transmitted.

[1] I've some thoughts on how to simplify some of the horridness, it also
ought to be possible to transmit from the USB Ge card with a similar
amount of cpu overhead as a reasonable (single queue) ethernet card.
At the moment the USB code has for horrid code paths.
But I'm not looking at that code at the moment because Sarah needs to
catch up with her patch queue.

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


Re: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0

2013-12-06 Thread Dave Mielke
[quoted lines by Greg KH on 2013/12/06 at 09:34 -0800]

>Please realize what you are asking for here.  Basically you are saying,
>"I don't want to use your code, so please help debug my reimplementation
>of your code without being able to see it at all because I need the
>help."

Our code is completely open for anyone to look at. In fact, becuase of my 
inability to ensure the correctness of the subject of this very thread, our 
project name is right in it. ;-) All you had to do, were you really interested, 
was to ask where you can find our code.

That being said, I still maintain that what really matters here is the 
comkunication with the serial adapter itself. Whatever else the code may do 
isn't really relevant. And I did include full usbmon traces of both the Linux 
way that works and our way which doesn't. If someone could point out where our 
USB Aoperations are incorrect insofar as the CP2102 is concerned, that's all 
it'd take. I'd think that it's certainly easier to take that approach than to 
try to understand a whole pile of unfamiliar code.

>What would you do in our situation?  I have an inbox full of people who
>are wanting to contribute to Linux, not circumvent it, and a fixed
>amount of time in which to use to respond.  Which would help out more
>people overall?

Two points:

First: I know what I do. In spite of the fact that I'm married, have 13 
children and 11 grandchildren, and a lot of other things to do in life, I've 
routinely offered to help anyone who asked for whatever help they needed if it 
fell in my areas of expertise. It's my position that whatever gifts any of us 
has are meant for sharing - not for hoarding.

Second: I'm not in any way trying to circumvent Linux. There are at least two 
reasons why we need our code to do it. One is that it needs to be portable to 
platforms which don't have decent USB support (okay, you could probably care 
less about that and want us to have one version that works on Linux and another 
that works everywhere else). The other is that the dyanmic nature of ttyUSB 
names makes them unusable for our purposes. Sure there's /dev/serial/by-id, but 
those names aren't very easy for users to deal with, and may even not be unique 
enough anyway if a user has two devices which use the same adapter.

>Best of luck with your project,

I don't rely on luck. Quite frankly, I think that's just your pseudo-pollite 
way of saying that you don't care.

-- 
Dave Mielke   | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario   | http://Mielke.cc/bible/
EMail: d...@mielke.cc | Canada  K2A 1H7   | http://FamilyRadio.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: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Sarah Sharp
On Fri, Dec 06, 2013 at 05:46:40PM -, David Laight wrote:
> > From: David Miller [mailto:da...@davemloft.net]
> > > From: Greg Kroah-Hartman 
> > > Date: Fri, 6 Dec 2013 09:29:47 -0800
> > 
> > > On Fri, Dec 06, 2013 at 09:03:25AM -0800, Sarah Sharp wrote:
> > >> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> > >> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > >> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> > >> > >> The following changes since commit 
> > >> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> > >> > >>
> > >> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> > >> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb
> > into usb-linus (2013-11-27 09:49:03 -0800)
> > >> > >>
> > >> > >> are available in the git repository at:
> > >> > >>
> > >> > >>
> > >> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> > >> > >> tags/for-usb-linus-2013-12-02
> > >> > >
> > >> > > Pulled and pushed out, thanks.
> > >> >
> > >> > Did this commit make it into linux-3.12.3 ?
> > >> >
> > >> > I ask, because the NIC still locks up with that kernel,
> > >> > and even with the patch I had been using from David Laight.
> > >> >
> > >> > Reverting the change that originally broke it still works though.
> > >> > Could we please get this reverted until such time as a reworked
> > >> > patch can be prepared for it?
> > >>
> > >> Greg, can you please revert David's patch (commit 35773dac5f86 from your
> > >> usb-linus branch)?
> > >
> > > Now reverted.
> > 
> > Please NO!
> > 
> > Merge the XHCI change, the change you have reverted actually fixes
> > things for some people and the XHCI change gets rid of the stated
> > regression.
> 
> I thought Mark had said that my patch fixed things for him with the
> earlier kernel.  It certainly makes a massive difference on my system.
> And I ran with enough diagnostics to work out when the tx side
> stopped.  The last packet for which an ack was received was the one
> before the one that straddled the ring end.
>
> If you want to change the ax179 driver you need to stop it using
> SG and segmentation offload.
> The patch that mark is talking about isn't really the one that makes a
> difference.
> I think it just forces the skb be linearised at that point. Which mostly
> means that there won't be any fragments.

Ok, so David verifies the xHCI driver does have an issue, and the patch
does fix the issue as stated.  Fine, let's merge that patch and see if
it helps.  Greg, can you fix this?  Sorry for the churn.

> I know that some of the xhci ring code is rather complex [1].
> But that particular patch should be completely safe as it just adds
> some extra nop commands into the ring.
> 
> Possibly Mark is seeing some additional failure caused by something else.

All right, let's get this patch into linus' tree, and track down exactly
what's causing Mark's issues after it's merged.

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


[GIT PULL] USB fixes for 3.13-rc3

2013-12-06 Thread Greg KH
The following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

  Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-3.13-rc3

for you to fetch changes up to 2d51f3cd11f414c56a87dc018196b85fd50b04a4:

  usb: hub: Use correct reset for wedged USB3 devices that are NOTATTACHED 
(2013-12-04 17:00:43 -0800)


USB fixes for 3.13-rc3

Here are a bunch of USB fixes for 3.13-rc3.

Nothing major, but we seem to have an argument about a XHCI fix, so I'm not
including a revert that Sarah requested, because that breaks a USB network
driver, and I can't revert the USB network driver fix without reintroducing
other bugs that it fixed.  So as it is, everything should now be
working.  Worse case, I can revert the XHCI fix before 3.13-final is
out, but it seems to work well here with my testing, so all should be
good.

Other than that, some driver updates based on reports.

Signed-off-by: Greg Kroah-Hartman 


Aaro Koskinen (1):
  usb: phy-generic: fix nop xceiv probe

Alan Stern (1):
  usb: dwc3: fix implementation of endpoint wedge

Andrzej Pietrasiewicz (1):
  usb: gadget: f_mass_storage: fix mass storage dependency

Apelete Seketeli (1):
  usb: fix musb gadget to enable OTG mode conditionally

Colin Leitner (4):
  USB: spcp8x5: correct handling of CS5 setting
  USB: mos7840: correct handling of CS5 setting
  USB: ftdi_sio: fixed handling of unsupported CSIZE setting
  USB: pl2303: fixed handling of CS5 setting

Daniel Mack (1):
  usb: ohci-pxa27x: include linux/dma-mapping.h

David Cluytens (1):
  USB: cdc-acm: Added support for the Lenovo RD02-D400 USB Modem

David Laight (1):
  usb: xhci: Link TRB must not occur within a USB payload burst

Fangxiaozhi (Franko) (1):
  USB: option: support new huawei devices

Felipe Balbi (4):
  usb: phy: generic: fix how we find out about our resources
  usb: gadget: storage: fix sparse warning
  usb: gadget: ffs: fix sparse warning
  usb: gadget: tcm_usb_gadget: mark bot_cleanup_old_alt static

Fengguang Wu (1):
  usb: gadget: zero: module parameters can be static

George Cherian (1):
  usb: gadget: f_mass_storage: call try_to_freeze only when its safe

Greg Kroah-Hartman (3):
  Merge tag 'fixes-for-v3.13-rc2' of git://git.kernel.org/.../balbi/usb 
into usb-linus
  Merge tag 'for-usb-linus-2013-12-02' of 
git://git.kernel.org/.../sarah/xhci into usb-linus
  USB: switch maintainership of chipidea to Peter

Gustavo Zacarias (1):
  USB: serial: option: blacklist interface 1 for Huawei E173s-6

Heikki Krogerus (1):
  usb: phy: generic: fix a compiler warning

Huang Rui (1):
  usb: tools: fix a regression issue that gcc can't link to pthread

Jisheng Zhang (1):
  usb: phy: phy-mxs-usb: set the correct platform drvdata

Johan Hovold (2):
  USB: serial: fix race in generic write
  USB: serial: fix write memory-allocation flag

Julius Werner (1):
  usb: hub: Use correct reset for wedged USB3 devices that are NOTATTACHED

Linus Walleij (1):
  usb: gadget: fix pxa25x compilation problems

Michael Grzeschik (1):
  usb: gadget: composite: reset delayed_status on reset_config

Michal Nazarewicz (1):
  usb: phy: remove dead code

Pratyush Anand (1):
  usb: gadget: mass storage: fix return of delayed status

Robert Baldyga (2):
  usb: gadget: s3c-hsotg: fix spinlock locking
  usb: gadget: s3c-hsotg: fix disconnect handling

Sebastian Andrzej Siewior (3):
  usb: musb: musb_cppi41: factor most of cppi41_dma_callback() into 
cppi41_trans_done()
  usb: musb: musb_cppi41: handle pre-mature TX complete interrupt
  usb: musb: only cancel work if it is initialized

Thomas Pugliese (3):
  usb: wusbcore: send keepalives to unauthenticated devices
  usb: wusbcore: do device lookup while holding the hc mutex
  usb: wusbcore: fix deadlock in wusbhc_gtk_rekey

Valentine Barshak (1):
  usb: phy: phy-rcar-gen2-usb: fix phy initialization

Wei Yongjun (1):
  usb: phy: phy-generic: fix return value check in usb_nop_xceiv_register()

 MAINTAINERS |   3 +-
 drivers/usb/class/cdc-acm.c |   2 +
 drivers/usb/core/hub.c  |   5 +-
 drivers/usb/dwc3/ep0.c  |   2 +
 drivers/usb/dwc3/gadget.c   |   5 +-
 drivers/usb/gadget/Kconfig  |   1 +
 drivers/usb/gadget/composite.c  |   1 +
 drivers/usb/gadget/f_fs.c   |   2 +-
 drivers/usb/gadget/f_mass_storage.c |  27 +++---
 drivers/usb/gadget/pxa25x_udc.c |   1 +
 drivers/usb/gadget/s3c-hsotg.c  |   7 +-
 drivers/usb/gadget/storage_common.h |   4 -
 drivers/usb/gadget/tcm_usb_gadget.c |   2 +-
 drivers/usb/gadget/zero.c   |   6 +-
 drivers/usb/host/ohci-pxa27x.c  |   1 +

Re: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Greg KH
On Fri, Dec 06, 2013 at 10:19:47AM -0800, Sarah Sharp wrote:
> On Fri, Dec 06, 2013 at 05:46:40PM -, David Laight wrote:
> > > From: David Miller [mailto:da...@davemloft.net]
> > > > From: Greg Kroah-Hartman 
> > > > Date: Fri, 6 Dec 2013 09:29:47 -0800
> > > 
> > > > On Fri, Dec 06, 2013 at 09:03:25AM -0800, Sarah Sharp wrote:
> > > >> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
> > > >> > On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
> > > >> > > On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
> > > >> > >> The following changes since commit 
> > > >> > >> c24cb6c8b501ebdf1aacec7960110a9741a45ced:
> > > >> > >>
> > > >> > >>   Merge tag 'fixes-for-v3.13-rc2' of 
> > > >> > >> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb
> > > into usb-linus (2013-11-27 09:49:03 -0800)
> > > >> > >>
> > > >> > >> are available in the git repository at:
> > > >> > >>
> > > >> > >>
> > > >> > >>   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
> > > >> > >> tags/for-usb-linus-2013-12-02
> > > >> > >
> > > >> > > Pulled and pushed out, thanks.
> > > >> >
> > > >> > Did this commit make it into linux-3.12.3 ?
> > > >> >
> > > >> > I ask, because the NIC still locks up with that kernel,
> > > >> > and even with the patch I had been using from David Laight.
> > > >> >
> > > >> > Reverting the change that originally broke it still works though.
> > > >> > Could we please get this reverted until such time as a reworked
> > > >> > patch can be prepared for it?
> > > >>
> > > >> Greg, can you please revert David's patch (commit 35773dac5f86 from 
> > > >> your
> > > >> usb-linus branch)?
> > > >
> > > > Now reverted.
> > > 
> > > Please NO!
> > > 
> > > Merge the XHCI change, the change you have reverted actually fixes
> > > things for some people and the XHCI change gets rid of the stated
> > > regression.
> > 
> > I thought Mark had said that my patch fixed things for him with the
> > earlier kernel.  It certainly makes a massive difference on my system.
> > And I ran with enough diagnostics to work out when the tx side
> > stopped.  The last packet for which an ack was received was the one
> > before the one that straddled the ring end.
> >
> > If you want to change the ax179 driver you need to stop it using
> > SG and segmentation offload.
> > The patch that mark is talking about isn't really the one that makes a
> > difference.
> > I think it just forces the skb be linearised at that point. Which mostly
> > means that there won't be any fragments.
> 
> Ok, so David verifies the xHCI driver does have an issue, and the patch
> does fix the issue as stated.  Fine, let's merge that patch and see if
> it helps.  Greg, can you fix this?  Sorry for the churn.

Yes, I've pushed it to Linus now, not including the revert.

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


GadgetFS EP Polling

2013-12-06 Thread palesius .
Just a shot in the dark here, but I'm working on a project where being
able to poll endpoints on gadgetfs other than EP0 would be quite
useful. I'm wondering whether they were not implemented because of a
particular insoluble problem or just because no one has gotten around
to it. Anyone have any idea?
--
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 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-06 Thread Felipe Balbi
On Tue, Nov 12, 2013 at 01:54:28PM +0100, Michal Nazarewicz wrote:
> On Tue, Nov 12 2013, David Cohen wrote:
> > On 11/11/2013 03:55 PM, Michal Nazarewicz wrote:
> >> Come to think of it, perhaps even better helper would be:
> >>
> >> static inline size_t usb_ep_align_maybe(
> >>struct usb_gadget *gadget, struct usb_ep *ep, size_t len) {
> >>return gadget->quir_ep_out_aligned_size ?
> >>round_up(len, (size_t)ep->desc->wMaxPacketSize) : len;
> >> }
> >
> > The CPU time to check unsigned:1 and possibly jump is about the same as
> > round_up() itself. For readability matters, we can round_up() directly.
> 
> I was proposing to have this function and than not have functions check
> for the flag.  I.e. instead of
> 
>   if (gadget->quirk_ep_out_aligned_size)
>   len = usb_ep_align_maxpacketsize(ep, len);
> 
> the code would just be:
> 
>   len = usb_ep_align_maybe(gadget, ep, len);

that looks very good to me, do we have a version with that already ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] usb: phy: am335x: Prevent GPIO reset line request

2013-12-06 Thread Felipe Balbi
On Sat, Nov 30, 2013 at 07:45:05PM -0300, Ezequiel Garcia wrote:
> On Thu, Nov 21, 2013 at 07:01:55AM -0600, Felipe Balbi wrote:
> > On Thu, Nov 21, 2013 at 08:55:20AM -0300, Ezequiel Garcia wrote:
> > > On Thu, Nov 21, 2013 at 12:44:51PM +0100, Sebastian Andrzej Siewior wrote:
> > > > On 11/21/2013 12:30 PM, Ezequiel Garcia wrote:
> > > > > Ah, good to know. That patch should be picked ASAP, without it the USB
> > > > > in AM335x is broken. Is it already too late to -rc1?
> > > > Yes.
> > > > 
> > > > > Who is supposed to merge that? Greg?
> > > > 
> > > > Felipe will start collecting fixes once -rc1 is out [0] so it should be
> > > > part of -rc2.
> > > > 
> > > 
> > > OK, fine by me. Please note that Felipe's commit is a much bigger (and
> > > nicer) rework of the code, and that it doesn't clearly state it fixes
> > > the current code.
> > > 
> > > Felipe: Maybe you should add some message stating it fixes a regression?
> > 
> > sure, makes sense. Sebastian had already mentioned it sounded too nice
> > of a commit log ;-)
> > 
> 
> I'm looking at -rc2 and it seems the fix was never pushed, so my board
> is probably still broken :-(
> 
> Can anybody _please_please_ fix the issue by merging some fix so we can
> use USB with mainline?

it's in Greg's tree

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 1/7] usb: dwc3: get "usb_phy" only if the platform indicates the presence of PHY's

2013-12-06 Thread Felipe Balbi
On Tue, Dec 03, 2013 at 12:39:50PM +0200, Heikki Krogerus wrote:
> Hi,
> 
> 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.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v5 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-06 Thread David Cohen
On 12/06/2013 12:13 PM, Felipe Balbi wrote:
> On Tue, Nov 12, 2013 at 01:54:28PM +0100, Michal Nazarewicz wrote:
>> On Tue, Nov 12 2013, David Cohen wrote:
>>> On 11/11/2013 03:55 PM, Michal Nazarewicz wrote:
 Come to think of it, perhaps even better helper would be:

 static inline size_t usb_ep_align_maybe(
struct usb_gadget *gadget, struct usb_ep *ep, size_t len) {
return gadget->quir_ep_out_aligned_size ?
round_up(len, (size_t)ep->desc->wMaxPacketSize) : len;
 }
>>>
>>> The CPU time to check unsigned:1 and possibly jump is about the same as
>>> round_up() itself. For readability matters, we can round_up() directly.
>>
>> I was proposing to have this function and than not have functions check
>> for the flag.  I.e. instead of
>>
>>  if (gadget->quirk_ep_out_aligned_size)
>>  len = usb_ep_align_maxpacketsize(ep, len);
>>
>> the code would just be:
>>
>>  len = usb_ep_align_maybe(gadget, ep, len);
> 
> that looks very good to me, do we have a version with that already ?

Nope. But as soon as soon as you finish the whole review, I can resend
new version with all changes at once.

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


Re: [PATCHv5.1 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-12-06 Thread Felipe Balbi
On Tue, Nov 12, 2013 at 12:57:22AM +0100, Michal Nazarewicz wrote:
> 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 
> Cc: David Cohen 

pretty obvious patch, looks good.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v5 5/5] usb: dwc3: set gadget's quirk ep_out_align_size

2013-12-06 Thread Felipe Balbi
On Mon, Nov 11, 2013 at 12:16:51PM -0800, David Cohen wrote:
> DWC3 requires epout to have buffer size aligned to MaxPacketSize value.
> This patch sets necessary quirk for it.
> 
> Signed-off-by: David Cohen 

looks good

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCHv5.1 4/5] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-12-06 Thread Felipe Balbi
On Tue, Nov 12, 2013 at 10:26:17AM -0800, David Cohen wrote:
> On 11/12/2013 04:59 AM, Michal Nazarewicz wrote:
> > On Tue, Nov 12 2013, David Cohen wrote:
> >> You need to update req->length otherwise it's going to crash DWC3.
> >> I'd rather to keep your previous version.
> > 
> > That's unfortunate.  Do you want me to resend it or will you just send
> > a v6 of your whole series?
> 
> Alan disagreed and proposed a good approach to fix req->length inside
> DWC3. We can keep this patch of yours but I'll need to change mine to
> DWC3. I'll send a v6 with update on my patch.

I rather update req->length on the functions. They own the buffer anyway

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 1/3] usb: phy-generic: Add GPIO based ChipSelect

2013-12-06 Thread Felipe Balbi
Hi,

On Mon, Dec 02, 2013 at 03:05:17PM +0800, Chris Ruehl wrote:
> @@ -231,27 +249,40 @@ static int usb_phy_gen_xceiv_probe(struct 
> platform_device *pdev)
>   return -ENOMEM;
>  
>   nop->reset_active_low = true;   /* default behaviour */
> + nop->cs_active_low = true;
>  
>   if (dev->of_node) {
>   struct device_node *node = dev->of_node;
>   enum of_gpio_flags flags;
> + enum of_gpio_flags csflags;
>  
>   if (of_property_read_u32(node, "clock-frequency", &clk_rate))
>   clk_rate = 0;
>  
>   needs_vcc = of_property_read_bool(node, "vcc-supply");
> +
>   nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios",
>   0, &flags);
> +

two unrelated changes

>   if (nop->gpio_reset == -EPROBE_DEFER)
>   return -EPROBE_DEFER;
>  
>   nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW;
>  
> + nop->gpio_chipselect = of_get_named_gpio_flags(node, "cs-gpios",
> + 0, &csflags);
> + if (gpio_is_valid(nop->gpio_chipselect))
> + nop->cs_active_low = csflags & OF_GPIO_ACTIVE_LOW;
> +
>   } else if (pdata) {
>   type = pdata->type;
>   clk_rate = pdata->clk_rate;
>   needs_vcc = pdata->needs_vcc;
>   nop->gpio_reset = pdata->gpio_reset;
> + nop->gpio_chipselect = pdata->gpio_chipselect;
> + } else {
> + nop->gpio_reset = -1;

This line is already going upstream, please remove it, i'll handle the
conflict later.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 1/5] usb: dwc3: Add Keystone specific glue layer

2013-12-06 Thread Felipe Balbi
Hi,

On Wed, Dec 04, 2013 at 03:10:07PM -0500, WingMan Kwok wrote:
> Add Keystone platform specific glue layer to support
> USB3 Host mode.
> 
> Cc: Santosh Shilimkar 
> Cc: Felipe Balbi 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: WingMan Kwok 
> ---
>  drivers/usb/dwc3/Kconfig |7 ++
>  drivers/usb/dwc3/Makefile|1 +
>  drivers/usb/dwc3/dwc3-keystone.c |  210 
> ++
>  3 files changed, 218 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..d3c0dc5
> --- /dev/null
> +++ b/drivers/usb/dwc3/dwc3-keystone.c
> @@ -0,0 +1,210 @@
> +/**
> + * dwc3-keystone.c - Keystone Specific Glue layer
> + *
> + * Copyright (C) 2010-2013 Texas Instruments Incorporated - http://www.ti.com
> + *
> + * Author: WingMan Kwok 
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* USBSS register offsets */
> +#define USBSS_REVISION   0x
> +#define USBSS_SYSCONFIG  0x0010
> +#define USBSS_IRQ_EOI0x0018
> +#define USBSS_IRQSTATUS_RAW_00x0020
> +#define USBSS_IRQSTATUS_00x0024
> +#define USBSS_IRQENABLE_SET_00x0028
> +#define USBSS_IRQENABLE_CLR_00x002c
> +
> +/* 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_CLRBIT(0)
> +
> +static u64 kdwc3_dma_mask;
> +
> +struct dwc3_keystone {
> + spinlock_t  lock;
> + 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;
> +
> + spin_lock(&kdwc->lock);

Isn't this lock unnecessary ? This handler will run with IRQs disabled
anyway.

> + 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));
> + spin_unlock(&kdwc->lock);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int kdwc3_probe(struct platform_device *pdev)
> +{
> + struct device_node  *node = pdev->dev.of_node;
> + struct device   *dev = &pdev->dev;

if you invert these lines, it'll look a little

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

2013-12-06 Thread Felipe Balbi
Hi,

On Wed, Dec 04, 2013 at 03:10:08PM -0500, 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 
> Cc: Felipe Balbi 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: WingMan Kwok 

looks good.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 4/5] ARM: dts: keystone: Add usb devicetree bindings

2013-12-06 Thread Felipe Balbi
Hi,

On Wed, Dec 04, 2013 at 03:10:10PM -0500, WingMan Kwok wrote:
> diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt 
> b/Documentation/devicetree/bindings/usb/keystone-usb.txt
> new file mode 100644
> index 000..ac2c7cc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/keystone-usb.txt
> @@ -0,0 +1,41 @@
> +TI Keystone Soc USB Controller
> +
> +DWC3 GLUE
> +
> +Required properties:
> + - compatible: should be "ti,keystone-dwc3".
> + - #address-cells, #size-cells : should be '1' if the device has sub-nodes
> +   with 'reg' property.
> + - reg : Address and length of the register set for the USB subsystem on
> +   the SOC.
> + - interrupts : The irq number of this device that is used to interrupt the
> +   MPU.
> + - ranges: allows valid 1:1 translation between child's address space and
> +   parent's address space.
> + - clocks: Clock IDs array as required by the controller.
> + - clock-names: names of clocks correseponding to IDs in the clock property.
> +
> +Sub-nodes:
> +The dwc3 core should be added as subnode to Keystone DWC3 glue.
> +- dwc3 :
> +   The binding details of dwc3 can be found in:
> +   Documentation/devicetree/bindings/usb/dwc3.txt
> +
> +Example:
> + usb: usb@268 {
> + compatible = "ti,keystone-dwc3";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x268 0x1>;
> + clocks = <&clkusb>;
> + clock-names = "usb";
> + interrupts = ;
> + ranges;
> +
> + dwc3@269 {
> + compatible = "synopsys,dwc3";
> + reg = <0x269 0x7>;
> + interrupts = ;
> + usb-phy = <&usb_phy>, <&usb_phy>;
> + };
> + };
> diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
> index d497d9e..0911bb7 100644
> --- a/arch/arm/boot/dts/keystone.dtsi
> +++ b/arch/arm/boot/dts/keystone.dtsi
> @@ -188,5 +188,23 @@
>   #size-cells = <1>;
>   reg = <0x2620738 32>;
>   };
> +
> + usb: usb@268 {

likewise, status = disabled ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 3/5] ARM: dts: keystone: Add usb phy devicetree bindings

2013-12-06 Thread Felipe Balbi
On Wed, Dec 04, 2013 at 03:10:09PM -0500, WingMan Kwok wrote:
> Added device tree support for TI's Keystone USB PHY driver and updated the
> Documentation with device tree binding information.
> 
> Cc: Santosh Shilimkar 
> Signed-off-by: WingMan Kwok 
> ---
>  .../devicetree/bindings/usb/keystone-phy.txt   |   19 +++
>  arch/arm/boot/dts/keystone.dtsi|7 +++
>  2 files changed, 26 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/keystone-phy.txt
> 
> diff --git a/Documentation/devicetree/bindings/usb/keystone-phy.txt 
> b/Documentation/devicetree/bindings/usb/keystone-phy.txt
> new file mode 100644
> index 000..300830d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/keystone-phy.txt
> @@ -0,0 +1,19 @@
> +TI Keystone USB PHY
> +
> +Required properties:
> + - compatible: should be "ti,keystone-usbphy".
> + - #address-cells, #size-cells : should be '1' if the device has sub-nodes
> +   with 'reg' property.
> + - reg : Address and length of the usb phy control register set.
> +
> +The main purpose of this PHY driver is to enable the USB PHY reference clock
> +gate on the Keystone SOC for both the USB2 and USB3 PHY. Otherwise it is just
> +an NOP PHY driver.  Hence this node is referenced as both the usb2 and usb3
> +phy node in the USB Glue layer driver node.
> +
> +usb_phy: usb_phy@2620738 {
> + compatible = "ti,keystone-usbphy";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x2620738 32>;
> +};
> diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
> index f6d6d9e..d497d9e 100644
> --- a/arch/arm/boot/dts/keystone.dtsi
> +++ b/arch/arm/boot/dts/keystone.dtsi
> @@ -181,5 +181,12 @@
>   interrupts = ;
>   clocks = <&clkspi>;
>   };
> +
> + usb_phy: usb_phy@2620738 {
> + compatible = "ti,keystone-usbphy";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x2620738 32>;

should this one have status = "disabled"; and let board dts enable the
PHY ?

-- 
balbi


signature.asc
Description: Digital signature


Re: GadgetFS EP Polling

2013-12-06 Thread Alan Stern
On Fri, 6 Dec 2013, palesius . wrote:

> Just a shot in the dark here, but I'm working on a project where being
> able to poll endpoints on gadgetfs other than EP0 would be quite
> useful. I'm wondering whether they were not implemented because of a
> particular insoluble problem or just because no one has gotten around
> to it. Anyone have any idea?

As far as I know, there was no particular problem.

If you use async I/O then maybe you won't need to poll at all.

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 1/2] USB: gadget: s3c-hsotg: fix maxpacket size in s3c_hsotg_irq_enumdone

2013-12-06 Thread Felipe Balbi
Hi,

On Fri, Dec 06, 2013 at 01:03:44PM +0100, Robert Baldyga wrote:
> This patch set maximum possible maxpacket value for each speed. Previous
> values didn't allow to use maxpacket sizes greater than 64 in full speed
> and 512 in high speed, although hardware is able to handle up to 1023 in fs
> and 1024 in hs.
> 
> Signed-off-by: Robert Baldyga 
> Signed-off-by: Kyungmin Park 

Matt, will this cause any problems for your efforts on Bcom ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v4 4/4] USB: OMAP1: Tahvo USB transceiver driver

2013-12-06 Thread Felipe Balbi
On Fri, Dec 06, 2013 at 04:13:07PM +0200, Aaro Koskinen wrote:
> Add Tahvo USB transceiver driver.
> 
> Based on old code from linux-omap tree. The original driver was written
> by Juha Yrjölä, Tony Lindgren, and Timo Teräs.
> 
> Signed-off-by: Aaro Koskinen 

compile error:


  CC [M]  drivers/usb/phy/phy-tahvo.o
drivers/usb/phy/phy-tahvo.c: In function ‘tahvo_usb_probe’:
drivers/usb/phy/phy-tahvo.c:371:2: error: too many arguments to function 
‘extcon_dev_register’
  ret = extcon_dev_register(&tu->extcon, &pdev->dev);
  ^
In file included from drivers/usb/phy/phy-tahvo.c:26:0:
include/linux/extcon.h:186:12: note: declared here
 extern int extcon_dev_register(struct extcon_dev *edev);
^
make[1]: *** [drivers/usb/phy/phy-tahvo.o] Error 1
make: *** [drivers/usb/phy/] Error 2

fixed it up with:

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 7cf1766..8bb833e 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -368,7 +368,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 
tu->extcon.name = DRIVER_NAME;
tu->extcon.supported_cable = tahvo_cable;
-   ret = extcon_dev_register(&tu->extcon, &pdev->dev);
+   tu->extcon.dev.parent = &pdev->dev;
+
+   ret = extcon_dev_register(&tu->extcon);
if (ret) {
dev_err(&pdev->dev, "could not register extcon device: %d\n",
ret);

please make sure it still works with v3.13-rc2 + this patch.

-- 
balbi


signature.asc
Description: Digital signature


BBB gadgetfs freeze patch

2013-12-06 Thread palesius .
In working on a project (http://github.com/dominicgs/USBProxy) we ran
across an issue where io on endpoint 0 would cause the system to hang.

We made the following change which resolved the problem for us. I'm
not sure if this is the "correct" fix, or if the problem is specific
to our platform BeagleBone Black with a musb-hrdc controller.

--- inode.c2013-11-18 14:46:25.255029000 -0500
+++ inode.c22013-11-19 06:30:36.579029000 -0500
@@ -679,7 +679,9 @@
 req->length = len;
 req->complete = ep_aio_complete;
 req->context = iocb;
+spin_unlock_irq(&epdata->dev->lock);
 value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
+spin_lock_irq(&epdata->dev->lock);
 if (unlikely(0 != value))
 usb_ep_free_request(epdata->ep, req);
 } else
@@ -1012,8 +1014,11 @@
 struct usb_ep*ep = dev->gadget->ep0;
 struct usb_request*req = dev->req;

-if ((retval = setup_req (ep, req, 0)) == 0)
+if ((retval = setup_req (ep, req, 0)) == 0) {
+spin_unlock_irq (&dev->lock);
 retval = usb_ep_queue (ep, req, GFP_ATOMIC);
+spin_lock_irq (&dev->lock);
+}
 dev->state = STATE_DEV_CONNECTED;

 /* assume that was SET_CONFIGURATION */
--
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-06 Thread Felipe Balbi
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  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 
> > ---
> >  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 ?

-- 
balbi


signature.asc
Description: Digital signature


Re: BBB gadgetfs freeze patch

2013-12-06 Thread Felipe Balbi
Hi,

On Fri, Dec 06, 2013 at 04:08:21PM -0500, palesius . wrote:
> In working on a project (http://github.com/dominicgs/USBProxy) we ran
> across an issue where io on endpoint 0 would cause the system to hang.
> 
> We made the following change which resolved the problem for us. I'm
> not sure if this is the "correct" fix, or if the problem is specific
> to our platform BeagleBone Black with a musb-hrdc controller.
> 
> --- inode.c2013-11-18 14:46:25.255029000 -0500
> +++ inode.c22013-11-19 06:30:36.579029000 -0500
> @@ -679,7 +679,9 @@
>  req->length = len;
>  req->complete = ep_aio_complete;
>  req->context = iocb;
> +spin_unlock_irq(&epdata->dev->lock);
>  value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
> +spin_lock_irq(&epdata->dev->lock);

usb_ep_queue() should be able to be called from atomic. Do you have some
dumps of the problem ? when BBB hangs, can you dump the stack ? (If
you're using minicom -> CTRL + A + F + P should work).

cheers

-- 
balbi


signature.asc
Description: Digital signature


Re: BBB gadgetfs freeze patch

2013-12-06 Thread palesius .
when i say it hangs i mean the entire system locks up not just my
process. I was connected over SSH (the physical ethernet not USB
ethernet) and it stops responding to pings entirely. I also tried with
it hooked up to a monitor and keyboard, and it is totally unresponsive
to keypresses as well. This was on multiple kernel versions. (3.12.0
most recently)

On Fri, Dec 6, 2013 at 4:10 PM, Felipe Balbi  wrote:
> Hi,
>
> On Fri, Dec 06, 2013 at 04:08:21PM -0500, palesius . wrote:
>> In working on a project (http://github.com/dominicgs/USBProxy) we ran
>> across an issue where io on endpoint 0 would cause the system to hang.
>>
>> We made the following change which resolved the problem for us. I'm
>> not sure if this is the "correct" fix, or if the problem is specific
>> to our platform BeagleBone Black with a musb-hrdc controller.
>>
>> --- inode.c2013-11-18 14:46:25.255029000 -0500
>> +++ inode.c22013-11-19 06:30:36.579029000 -0500
>> @@ -679,7 +679,9 @@
>>  req->length = len;
>>  req->complete = ep_aio_complete;
>>  req->context = iocb;
>> +spin_unlock_irq(&epdata->dev->lock);
>>  value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
>> +spin_lock_irq(&epdata->dev->lock);
>
> usb_ep_queue() should be able to be called from atomic. Do you have some
> dumps of the problem ? when BBB hangs, can you dump the stack ? (If
> you're using minicom -> CTRL + A + F + P should work).
>
> cheers
>
> --
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: BBB gadgetfs freeze patch

2013-12-06 Thread Alan Stern
On Fri, 6 Dec 2013, Felipe Balbi wrote:

> Hi,
> 
> On Fri, Dec 06, 2013 at 04:08:21PM -0500, palesius . wrote:
> > In working on a project (http://github.com/dominicgs/USBProxy) we ran
> > across an issue where io on endpoint 0 would cause the system to hang.
> > 
> > We made the following change which resolved the problem for us. I'm
> > not sure if this is the "correct" fix, or if the problem is specific
> > to our platform BeagleBone Black with a musb-hrdc controller.
> > 
> > --- inode.c2013-11-18 14:46:25.255029000 -0500
> > +++ inode.c22013-11-19 06:30:36.579029000 -0500
> > @@ -679,7 +679,9 @@
> >  req->length = len;
> >  req->complete = ep_aio_complete;
> >  req->context = iocb;
> > +spin_unlock_irq(&epdata->dev->lock);
> >  value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
> > +spin_lock_irq(&epdata->dev->lock);
> 
> usb_ep_queue() should be able to be called from atomic. Do you have some
> dumps of the problem ? when BBB hangs, can you dump the stack ? (If
> you're using minicom -> CTRL + A + F + P should work).

I suspect the problem is that with some UDC drivers, under some
circumstances, a transfer can complete _during_ the usb_ep_queue()  
call.  The driver copies the data from the request buffer into a
hardware FIFO, and if it all fits, goes ahead and invokes the
transfer's completion routine.

Of course, the completion routine attempts to acquire the spinlock, and 
hangs.

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 v2 1/5] usb: dwc3: Add Keystone specific glue layer

2013-12-06 Thread Santosh Shilimkar
On Friday 06 December 2013 03:28 PM, Felipe Balbi wrote:
> Hi,
> 
> On Wed, Dec 04, 2013 at 03:10:07PM -0500, WingMan Kwok wrote:
>> Add Keystone platform specific glue layer to support
>> USB3 Host mode.
>>
>> Cc: Santosh Shilimkar 
>> Cc: Felipe Balbi 
>> Cc: Greg Kroah-Hartman 
>> Signed-off-by: WingMan Kwok 
>> ---
>>  drivers/usb/dwc3/Kconfig |7 ++
>>  drivers/usb/dwc3/Makefile|1 +
>>  drivers/usb/dwc3/dwc3-keystone.c |  210 
>> ++
>>  3 files changed, 218 insertions(+)
>>  create mode 100644 drivers/usb/dwc3/dwc3-keystone.c

[..]

>> +static irqreturn_t dwc3_keystone_interrupt(int irq, void *_kdwc)
>> +{
>> +struct dwc3_keystone*kdwc = _kdwc;
>> +
>> +spin_lock(&kdwc->lock);
> 
> Isn't this lock unnecessary ? This handler will run with IRQs disabled
> anyway.
> 
Indeed.

>> +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));
>> +spin_unlock(&kdwc->lock);
>> +
>> +return IRQ_HANDLED;
>> +}
>> +
>> +static int kdwc3_probe(struct platform_device *pdev)
>> +{
>> +struct device_node  *node = pdev->dev.of_node;
>> +struct device   *dev = &pdev->dev;
> 
> if you invert these lines, it'll look a little nicer:
> 
>   struct device   *dev = &pdev->dev;
>   struct device_node  *node = dev->of_node;
> 
> everything else looks pretty good, thanks
> 
Looks good to me as well. With above update, 
Acked-by: Santosh Shilimkar 


--
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: BBB gadgetfs freeze patch

2013-12-06 Thread palesius .
well, at least on this hardware it happened with great consistency
(100% of the attempts, (at least 20)) immediately upon attempting to
setup the device. i think it happened right after opening the data
endpoints (but without any data needing to be sent to trigger it)

On Fri, Dec 6, 2013 at 4:35 PM, Alan Stern  wrote:
> On Fri, 6 Dec 2013, Felipe Balbi wrote:
>
>> Hi,
>>
>> On Fri, Dec 06, 2013 at 04:08:21PM -0500, palesius . wrote:
>> > In working on a project (http://github.com/dominicgs/USBProxy) we ran
>> > across an issue where io on endpoint 0 would cause the system to hang.
>> >
>> > We made the following change which resolved the problem for us. I'm
>> > not sure if this is the "correct" fix, or if the problem is specific
>> > to our platform BeagleBone Black with a musb-hrdc controller.
>> >
>> > --- inode.c2013-11-18 14:46:25.255029000 -0500
>> > +++ inode.c22013-11-19 06:30:36.579029000 -0500
>> > @@ -679,7 +679,9 @@
>> >  req->length = len;
>> >  req->complete = ep_aio_complete;
>> >  req->context = iocb;
>> > +spin_unlock_irq(&epdata->dev->lock);
>> >  value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
>> > +spin_lock_irq(&epdata->dev->lock);
>>
>> usb_ep_queue() should be able to be called from atomic. Do you have some
>> dumps of the problem ? when BBB hangs, can you dump the stack ? (If
>> you're using minicom -> CTRL + A + F + P should work).
>
> I suspect the problem is that with some UDC drivers, under some
> circumstances, a transfer can complete _during_ the usb_ep_queue()
> call.  The driver copies the data from the request buffer into a
> hardware FIFO, and if it all fits, goes ahead and invokes the
> transfer's completion routine.
>
> Of course, the completion routine attempts to acquire the spinlock, and
> hangs.
>
> 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 v2 2/5] usb: phy: Add keystone usb phy driver

2013-12-06 Thread Santosh Shilimkar
On Wednesday 04 December 2013 03:10 PM, 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 
> Cc: Felipe Balbi 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: WingMan Kwok 
> ---
>  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
> 
Acked-by: Santosh Shilimkar 

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


Re: [PATCH v2 3/5] ARM: dts: keystone: Add usb phy devicetree bindings

2013-12-06 Thread Santosh Shilimkar
On Friday 06 December 2013 03:30 PM, Felipe Balbi wrote:
> On Wed, Dec 04, 2013 at 03:10:09PM -0500, WingMan Kwok wrote:
>> Added device tree support for TI's Keystone USB PHY driver and updated the
>> Documentation with device tree binding information.
>>
>> Cc: Santosh Shilimkar 
>> Signed-off-by: WingMan Kwok 
>> ---
>>  .../devicetree/bindings/usb/keystone-phy.txt   |   19 
>> +++
>>  arch/arm/boot/dts/keystone.dtsi|7 +++
>>  2 files changed, 26 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/usb/keystone-phy.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/keystone-phy.txt 
>> b/Documentation/devicetree/bindings/usb/keystone-phy.txt
>> new file mode 100644
>> index 000..300830d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/keystone-phy.txt
>> @@ -0,0 +1,19 @@
>> +TI Keystone USB PHY
>> +
>> +Required properties:
>> + - compatible: should be "ti,keystone-usbphy".
>> + - #address-cells, #size-cells : should be '1' if the device has sub-nodes
>> +   with 'reg' property.
>> + - reg : Address and length of the usb phy control register set.
>> +
>> +The main purpose of this PHY driver is to enable the USB PHY reference clock
>> +gate on the Keystone SOC for both the USB2 and USB3 PHY. Otherwise it is 
>> just
>> +an NOP PHY driver.  Hence this node is referenced as both the usb2 and usb3
>> +phy node in the USB Glue layer driver node.
>> +
>> +usb_phy: usb_phy@2620738 {
>> +compatible = "ti,keystone-usbphy";
>> +#address-cells = <1>;
>> +#size-cells = <1>;
>> +reg = <0x2620738 32>;
>> +};
>> diff --git a/arch/arm/boot/dts/keystone.dtsi 
>> b/arch/arm/boot/dts/keystone.dtsi
>> index f6d6d9e..d497d9e 100644
>> --- a/arch/arm/boot/dts/keystone.dtsi
>> +++ b/arch/arm/boot/dts/keystone.dtsi
>> @@ -181,5 +181,12 @@
>>  interrupts = ;
>>  clocks = <&clkspi>;
>>  };
>> +
>> +usb_phy: usb_phy@2620738 {
>> +compatible = "ti,keystone-usbphy";
>> +#address-cells = <1>;
>> +#size-cells = <1>;
>> +reg = <0x2620738 32>;
> 
> should this one have status = "disabled"; and let board dts enable the
> PHY ?
> 
Currently there is only one board but probably not a bad idea to enable
it from board dts. Lets do that

Regards,
Santosh 
--
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 0/5] Kesytone II USB support

2013-12-06 Thread Santosh Shilimkar
Wingman,

On Wednesday 04 December 2013 03:10 PM, WingMan Kwok wrote:
> Here is the updated version of the series which addresses comments from
> earlier version [1].  The PHY register programming is moved to a separate
> PHY driver.
> 
> 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.
> 
> All three patches are posted together just for completeness. Only first patch
> is expected to go via usb tree and other two via linux-keystone tree.
>
The series looks fine now and probably can be split now.
 
> Patchset are tested on Keystone II EVM with USB2.0 and USB3.0 flash drives.
> 
> Cc: Santosh Shilimkar 
> 
> WingMan Kwok (5):
>   usb: dwc3: Add Keystone specific glue layer
>   usb: phy: Add keystone usb phy driver
Please update the minor comments on patch 1 and resubmit above
two patches so that Felipe can pick these up. 

>   ARM: dts: keystone: Add usb phy devicetree bindings
>   ARM: dts: keystone: Add usb devicetree bindings
>   ARM: keystone: defconfig: enable USB support
> 
On the dts part just enable the phy,usb3 nodes from
board dts file and have status disabled in common dts file.
With those update, please repost them and I will take
them in my 3.14 queue.

Regards,
Santosh




--
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] staging: dwc2: don't issue traffic to LS devices in FS mode

2013-12-06 Thread Paul Zimmerman
From: Nick Hudson 

I fell over the problem reported in
https://github.com/raspberrypi/linux/pull/390:

"Issuing low-speed packets when the root port is in full-speed mode
 causes the root port to stop responding. Explicitly fail when
 enqueuing URBs to a LS endpoint on a FS bus."

with my dwc2 testing in NetBSD, so I adapted the change to dwc2.

Signed-off-by: Nick Hudson 
[paulz: fixed up the patch to compile under Linux, and tested it]
Signed-off-by: Paul Zimmerman 
---
 drivers/staging/dwc2/hcd.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c
index 24b57d7..07dfe85 100644
--- a/drivers/staging/dwc2/hcd.c
+++ b/drivers/staging/dwc2/hcd.c
@@ -355,6 +355,7 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
unsigned long flags;
u32 intr_mask;
int retval;
+   int dev_speed;
 
if (!hsotg->flags.b.port_connect_status) {
/* No longer connected */
@@ -362,6 +363,19 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
return -ENODEV;
}
 
+   dev_speed = dwc2_host_get_speed(hsotg, urb->priv);
+
+   /* Some configurations cannot support LS traffic on a FS root port */
+   if ((dev_speed == USB_SPEED_LOW) &&
+   (hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED) &&
+   (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI)) {
+   u32 hprt0 = readl(hsotg->regs + HPRT0);
+   u32 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
+
+   if (prtspd == HPRT0_SPD_FULL_SPEED)
+   return -ENODEV;
+   }
+
qtd = kzalloc(sizeof(*qtd), mem_flags);
if (!qtd)
return -ENOMEM;
-- 
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] usb: phy: am335x: Prevent GPIO reset line request

2013-12-06 Thread Ezequiel Garcia
On Fri, Dec 06, 2013 at 02:16:23PM -0600, Felipe Balbi wrote:
> On Sat, Nov 30, 2013 at 07:45:05PM -0300, Ezequiel Garcia wrote:
> > On Thu, Nov 21, 2013 at 07:01:55AM -0600, Felipe Balbi wrote:
> > > On Thu, Nov 21, 2013 at 08:55:20AM -0300, Ezequiel Garcia wrote:
> > > > On Thu, Nov 21, 2013 at 12:44:51PM +0100, Sebastian Andrzej Siewior 
> > > > wrote:
> > > > > On 11/21/2013 12:30 PM, Ezequiel Garcia wrote:
> > > > > > Ah, good to know. That patch should be picked ASAP, without it the 
> > > > > > USB
> > > > > > in AM335x is broken. Is it already too late to -rc1?
> > > > > Yes.
> > > > > 
> > > > > > Who is supposed to merge that? Greg?
> > > > > 
> > > > > Felipe will start collecting fixes once -rc1 is out [0] so it should 
> > > > > be
> > > > > part of -rc2.
> > > > > 
> > > > 
> > > > OK, fine by me. Please note that Felipe's commit is a much bigger (and
> > > > nicer) rework of the code, and that it doesn't clearly state it fixes
> > > > the current code.
> > > > 
> > > > Felipe: Maybe you should add some message stating it fixes a regression?
> > > 
> > > sure, makes sense. Sebastian had already mentioned it sounded too nice
> > > of a commit log ;-)
> > > 
> > 
> > I'm looking at -rc2 and it seems the fix was never pushed, so my board
> > is probably still broken :-(
> > 
> > Can anybody _please_please_ fix the issue by merging some fix so we can
> > use USB with mainline?
> 
> it's in Greg's tree
> 

Yeah, I just saw the pull. Thanks for the notice! I'll re-test in -rc4
and let you know if I find any more problems.

FWIW, I'm not entirely happy with the solution. Probably being a bit
paranoid, but it seemed to me the fix could be smaller (and fix only
the problem) and then pospone your refactoring until v3.14.

Just my two cents and thanks again for the notice.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.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 v2 1/5] usb: dwc3: Add Keystone specific glue layer

2013-12-06 Thread Paul Zimmerman
> From: linux-usb-ow...@vger.kernel.org 
> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Santosh Shilimkar
> Sent: Friday, December 06, 2013 1:40 PM
> 
> On Friday 06 December 2013 03:28 PM, Felipe Balbi wrote:
> > Hi,
> >
> > On Wed, Dec 04, 2013 at 03:10:07PM -0500, WingMan Kwok wrote:
> >> Add Keystone platform specific glue layer to support
> >> USB3 Host mode.
> >>
> >> Cc: Santosh Shilimkar 
> >> Cc: Felipe Balbi 
> >> Cc: Greg Kroah-Hartman 
> >> Signed-off-by: WingMan Kwok 
> >> ---
> >>  drivers/usb/dwc3/Kconfig |7 ++
> >>  drivers/usb/dwc3/Makefile|1 +
> >>  drivers/usb/dwc3/dwc3-keystone.c |  210 
> >> ++
> >>  3 files changed, 218 insertions(+)
> >>  create mode 100644 drivers/usb/dwc3/dwc3-keystone.c
> 
> [..]
> 
> >> +static irqreturn_t dwc3_keystone_interrupt(int irq, void *_kdwc)
> >> +{
> >> +  struct dwc3_keystone*kdwc = _kdwc;
> >> +
> >> +  spin_lock(&kdwc->lock);
> >
> > Isn't this lock unnecessary ? This handler will run with IRQs disabled
> > anyway.
> >
> Indeed.

Say what? AFAIK it's necessary to take the driver lock inside the interrupt
handler, because of SMP. Here is the equivalent routine from dwc3-omap.c:

static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
{
struct dwc3_omap*omap = _omap;
u32 reg;

spin_lock(&omap->lock);

...
}

Has this now become unnecessary?

-- 
Paul

--
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: Handling of Zero length packet in data stage

2013-12-06 Thread Sarah Sharp
Sorry for the very delayed response on this, I'm trying to catch up on
my email from around Kernel Summit and my vacation.

On Tue, Oct 08, 2013 at 10:19:11AM -0400, Alan Stern wrote:
> On Mon, 7 Oct 2013, Sarah Sharp wrote:
> 
> > > i am using 3.10 kernel. Also i looked at tip i see same implementation for
> > > process_ctrl_td()
> > > 
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/host/xhci-ring.c
> > 
> > Yeah, the implementation has always been this way.  I've known since the
> > beginning of writing the xHCI driver that it needs to handle zero-length
> > data phases, but hadn't had ever had a report that it was required by a
> > device under Linux.
> 
> This code, near the end of process_ctrl_td(), looks a little strange:

I really hate the xHCI ring code. :(  I would rip it out and totally
start over, but I'm afraid of introducing more low-level bugs than we
already have.

The problem with process_ctrl_td() is that it's trying to process events
for all three phases of the control transfer with the same code, and
it's a mess.  Even I have to sit there with with the xHCI spec and map
out all the different ways the code handles error conditions.

>   /*
>* Did we transfer any data, despite the errors that might have
>* happened?  I.e. did we get past the setup stage?
>*/
>   if (event_trb != ep_ring->dequeue) {
>   /* The event was for the status stage */
>   if (event_trb == td->last_trb) {
>   if (td->urb->actual_length != 0) {
>   /* Don't overwrite a previously set error code
>*/
>   if ((*status == -EINPROGRESS || *status == 0) &&
>   (td->urb->transfer_flags
>& URB_SHORT_NOT_OK))
>   /* Did we already see a short data
>* stage? */
>   *status = -EREMOTEIO;
> 
> If you already saw a short data stage, why isn't the status already set
> to -EREMOTEIO?
>
> Also what's the reason for the test "td->urb->actual_length != 0"?  
> What does this have to do with getting a short data stage?  Are you 
> assuming that at this point, actual_length will be nonzero if and only 
> if there was a short data stage?
> 
>   } else {
>   td->urb->actual_length =
>   td->urb->transfer_buffer_length;
>   }
> 
> What's the purpose of this clause?
>
> It looks like the driver is confusing "actual_length == 0" with 
> "actual_length was never set".  What if actual_length _was_ previously 
> set, but it was set to 0?

Right, I understand what you're saying now.  The code is trying to
handle two separate cases in one function:

1. The setup, data, and status phases all complete successfully.  The
xHC only sends a successful completion event for the status phase.

2. The setup phase completes successfully, the data phase is short, and
the status phase is successful.  The xHC will generate a short completion
event for the short data phase, and a successful completion event for
the status phase.

Here's the code:

switch (trb_comp_code) {
case COMP_SUCCESS:
if (event_trb == ep_ring->dequeue) {
xhci_warn(xhci, "WARN: Success on ctrl setup TRB "
"without IOC set??\n");
*status = -ESHUTDOWN;
} else if (event_trb != td->last_trb) {
xhci_warn(xhci, "WARN: Success on ctrl data TRB "
"without IOC set??\n");
*status = -ESHUTDOWN;
} else {
*status = 0;
}
break;
case COMP_SHORT_TX:
if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
*status = -EREMOTEIO;
else
*status = 0;
break;

...
if (event_trb != ep_ring->dequeue) {
/* The event was for the status stage */
if (event_trb == td->last_trb) {
if (td->urb->actual_length != 0) {
/* Don't overwrite a previously set error code
 */
if ((*status == -EINPROGRESS || *status == 0) &&
(td->urb->transfer_flags
 & URB_SHORT_NOT_OK))
/* Did we already see a short data
 * stage? */
*status = -EREMOTEIO;
} else {
  

Re: [GIT PULL] xhci: Regression fix for 3.13.

2013-12-06 Thread Mark Lord
On 13-12-06 10:25 AM, Greg Kroah-Hartman wrote:
> On Fri, Dec 06, 2013 at 12:55:23AM -0500, Mark Lord wrote:
>> On 13-12-02 04:42 PM, Greg Kroah-Hartman wrote:
>>> On Mon, Dec 02, 2013 at 12:49:08PM -0800, Sarah Sharp wrote:
 The following changes since commit 
 c24cb6c8b501ebdf1aacec7960110a9741a45ced:

   Merge tag 'fixes-for-v3.13-rc2' of 
 git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
 (2013-11-27 09:49:03 -0800)

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git 
 tags/for-usb-linus-2013-12-02
>>>
>>> Pulled and pushed out, thanks.
>>
>> Did this commit make it into linux-3.12.3 ?
>
> No, it's not there yet, as it's not in Linus's tree yet, give me a chance...

Okay, good to see it moving along.

I asked about 3.12.3, because something new in that release broke
Davids workaround for me here.

But I'm with the rest of you: let's let what's in the pipeline
make it out there (3.12.4 ?) and then I'll retest and repatch that
if necessary to make things work here again.

Thanks
-- 
Mark Lord
Real-Time Remedies Inc.
ml...@pobox.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


  1   2   >