Re: [PATCH 1/3] usb: misc: usb3503: Fix up whitespace

2013-05-31 Thread Dongjin Kim
Signed-off-by: Dongjin Kim 

On Sat, Jun 1, 2013 at 10:34 AM, Julius Werner  wrote:
> Remove an erroneous tab that should be a space.
>
> Signed-off-by: Julius Werner 
> ---
>  drivers/usb/misc/usb3503.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
> index d3a1cce..73aeb87 100644
> --- a/drivers/usb/misc/usb3503.c
> +++ b/drivers/usb/misc/usb3503.c
> @@ -208,7 +208,7 @@ static int usb3503_probe(struct i2c_client *i2c, const 
> struct i2c_device_id *id)
> hub->gpio_connect = of_get_named_gpio(np, "intn-gpios", 0);
> if (hub->gpio_connect == -EPROBE_DEFER)
> return -EPROBE_DEFER;
> -   hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0);
> +   hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0);
> if (hub->gpio_reset == -EPROBE_DEFER)
> return -EPROBE_DEFER;
> of_property_read_u32(np, "initial-mode", &mode);
> --
> 1.7.12.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 3/3] usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

2013-05-31 Thread Dongjin Kim
Signed-off-by: Dongjin Kim 

On Sat, Jun 1, 2013 at 10:34 AM, Julius Werner  wrote:
> The usb3503 driver sleeps a flat 100ms when resetting the chip, with a
> comment about waiting for the reference clock. This seems to be a
> board-specific detail that should not hold up boot across all platforms.
> This patch reduces the sleep to the 4ms initialization delay that the
> chip itself actually requires (as per its data sheet). If certain boards
> require more time to set up the reference clock, they should change this
> through local patches or add a proper, configurable synchronization
> mechanism.
>
> Signed-off-by: Julius Werner 
> ---
>  drivers/usb/misc/usb3503.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
> index a647a2e..a1d509f 100644
> --- a/drivers/usb/misc/usb3503.c
> +++ b/drivers/usb/misc/usb3503.c
> @@ -107,11 +107,9 @@ static int usb3503_reset(int gpio_reset, int state)
> if (gpio_is_valid(gpio_reset))
> gpio_set_value(gpio_reset, state);
>
> -   /* Wait RefClk when RESET_N is released, otherwise Hub will
> -* not transition to Hub Communication Stage.
> -*/
> +   /* Wait T_HUBINIT == 4ms for hub logic to stabilize */
> if (state)
> -   msleep(100);
> +   usleep_range(4000, 1);
>
> return 0;
>  }
> --
> 1.7.12.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/3] usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3

2013-05-31 Thread Dongjin Kim
Hi,

I have sent two patches for the same issue, these two are merged into
Greg's tree. Please review the patches.

[1] https://patchwork.kernel.org/patch/2599021
[2] https://patchwork.kernel.org/patch/2599031

Many thanks,
Dongjin.

On Sat, Jun 1, 2013 at 10:34 AM, Julius Werner  wrote:
> The usb3503 driver currently disables port 2 and 3 without explaination.
> It doesn't make sense to do this in a mainline Linux driver that should
> support all platforms which use this chip. If specific use cases really
> require ports to be disabled, this should either be done through local
> patches or a configurable mechanism (such as a device tree property).
> Until then, let's keep all ports enabled.
>
> Signed-off-by: Julius Werner 
> ---
>  drivers/usb/misc/usb3503.c | 8 
>  1 file changed, 8 deletions(-)
>
> diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
> index 73aeb87..a647a2e 100644
> --- a/drivers/usb/misc/usb3503.c
> +++ b/drivers/usb/misc/usb3503.c
> @@ -134,14 +134,6 @@ static int usb3503_switch_mode(struct usb3503 *hub, enum 
> usb3503_mode mode)
> goto err_hubmode;
> }
>
> -   /* PDS : Port2,3 Disable For Self Powered Operation */
> -   err = usb3503_set_bits(i2c, USB3503_PDS,
> -   (USB3503_PORT2 | USB3503_PORT3));
> -   if (err < 0) {
> -   dev_err(&i2c->dev, "PDS failed (%d)\n", err);
> -   goto err_hubmode;
> -   }
> -
> /* CFG1 : SELF_BUS_PWR -> Self-Powerd operation */
> err = usb3503_set_bits(i2c, USB3503_CFG1, 
> USB3503_SELF_BUS_PWR);
> if (err < 0) {
> --
> 1.7.12.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 0/3] usb: misc: usb3503: Fix up usb3503 driver

2013-05-31 Thread Olof Johansson
2013/5/31 Julius Werner :
> This patch set contains a few minor changes to the recently added SMSC
> USB3503 driver. It addresses issues that seem to be either left-over
> stopgaps from an early development stage or board-specific hacks,
> changing them to defaults that should be most sane and useable for all
> platforms that contain this chip.
>
> Julius Werner (3):
>   usb: misc: usb3503: Fix up whitespace
>   usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3
>   usb: misc: usb3503: Remove 100ms sleep on reset, conform to data
> sheet
>
>  drivers/usb/misc/usb3503.c | 16 +++-
>  1 file changed, 3 insertions(+), 13 deletions(-)

Series:

Acked-by: Olof Johansson 


-Olof
--
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: gadget: f_uac2: Fix broken prm to uac2 mapping

2013-05-31 Thread Jassi Brar
On Sat, Jun 1, 2013 at 2:47 AM, Felipe Balbi  wrote:
> HI,
>
> On Thu, May 30, 2013 at 06:23:33PM +0530, Jassi Brar wrote:
>> From: Jassi Brar 
>>
>> prm_to_uac2() is broken because it tests against pointer it itself
>> mapped onto, which will never be different.
>> Fix the mapping by adding pointer to parent chip in each rtd param
>> and removing the prm_to_uac2().
>>
>> Reported-by: Julien Rouviere 
>> Signed-off-by: Jassi Brar 
>
> when was this bug introduced ? Is it critical for v3.10 ? can it wait
> for v3.11 ? Does it need to go to stable ?
>
The bug has already been there. It is hit only in rare error path and
is not critical.

Thanks,
Jassi
--
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/3] usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

2013-05-31 Thread Julius Werner
The usb3503 driver sleeps a flat 100ms when resetting the chip, with a
comment about waiting for the reference clock. This seems to be a
board-specific detail that should not hold up boot across all platforms.
This patch reduces the sleep to the 4ms initialization delay that the
chip itself actually requires (as per its data sheet). If certain boards
require more time to set up the reference clock, they should change this
through local patches or add a proper, configurable synchronization
mechanism.

Signed-off-by: Julius Werner 
---
 drivers/usb/misc/usb3503.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index a647a2e..a1d509f 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -107,11 +107,9 @@ static int usb3503_reset(int gpio_reset, int state)
if (gpio_is_valid(gpio_reset))
gpio_set_value(gpio_reset, state);
 
-   /* Wait RefClk when RESET_N is released, otherwise Hub will
-* not transition to Hub Communication Stage.
-*/
+   /* Wait T_HUBINIT == 4ms for hub logic to stabilize */
if (state)
-   msleep(100);
+   usleep_range(4000, 1);
 
return 0;
 }
-- 
1.7.12.4

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


[PATCH 1/3] usb: misc: usb3503: Fix up whitespace

2013-05-31 Thread Julius Werner
Remove an erroneous tab that should be a space.

Signed-off-by: Julius Werner 
---
 drivers/usb/misc/usb3503.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index d3a1cce..73aeb87 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -208,7 +208,7 @@ static int usb3503_probe(struct i2c_client *i2c, const 
struct i2c_device_id *id)
hub->gpio_connect = of_get_named_gpio(np, "intn-gpios", 0);
if (hub->gpio_connect == -EPROBE_DEFER)
return -EPROBE_DEFER;
-   hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0);
+   hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0);
if (hub->gpio_reset == -EPROBE_DEFER)
return -EPROBE_DEFER;
of_property_read_u32(np, "initial-mode", &mode);
-- 
1.7.12.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 2/3] usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3

2013-05-31 Thread Julius Werner
The usb3503 driver currently disables port 2 and 3 without explaination.
It doesn't make sense to do this in a mainline Linux driver that should
support all platforms which use this chip. If specific use cases really
require ports to be disabled, this should either be done through local
patches or a configurable mechanism (such as a device tree property).
Until then, let's keep all ports enabled.

Signed-off-by: Julius Werner 
---
 drivers/usb/misc/usb3503.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 73aeb87..a647a2e 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -134,14 +134,6 @@ static int usb3503_switch_mode(struct usb3503 *hub, enum 
usb3503_mode mode)
goto err_hubmode;
}
 
-   /* PDS : Port2,3 Disable For Self Powered Operation */
-   err = usb3503_set_bits(i2c, USB3503_PDS,
-   (USB3503_PORT2 | USB3503_PORT3));
-   if (err < 0) {
-   dev_err(&i2c->dev, "PDS failed (%d)\n", err);
-   goto err_hubmode;
-   }
-
/* CFG1 : SELF_BUS_PWR -> Self-Powerd operation */
err = usb3503_set_bits(i2c, USB3503_CFG1, USB3503_SELF_BUS_PWR);
if (err < 0) {
-- 
1.7.12.4

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


[PATCH 0/3] usb: misc: usb3503: Fix up usb3503 driver

2013-05-31 Thread Julius Werner
This patch set contains a few minor changes to the recently added SMSC
USB3503 driver. It addresses issues that seem to be either left-over
stopgaps from an early development stage or board-specific hacks,
changing them to defaults that should be most sane and useable for all
platforms that contain this chip.

Julius Werner (3):
  usb: misc: usb3503: Fix up whitespace
  usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3
  usb: misc: usb3503: Remove 100ms sleep on reset, conform to data
sheet

 drivers/usb/misc/usb3503.c | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

-- 
1.7.12.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] usb: musb: Fix format specifier warning

2013-05-31 Thread Randy Dunlap
On 05/31/13 15:34, Andy Shevchenko wrote:
> On Fri, May 31, 2013 at 11:22 PM, Emil Goode  wrote:
>> This patch fixes a format specifier warning. dma_addr_t can be either
>> u32 or u64 so we should cast to the largest type and change the format
>> specifier to %llx.
> 
> dma_addr_t is derived from phys_addr_t, thus you may use %pa specifier
> which is available from v3.8(?).
> 
> Something like this:
> dma_addr_t src_addr;
> dev_dbg(dev, "DMA addr: %pa\n", src_addr);

Isn't that:

  deb_dbg(dev, "DMA addr: %pa\n", &src_addr);


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


Re: [PATCH] usb: musb: Fix format specifier warning

2013-05-31 Thread Andy Shevchenko
On Fri, May 31, 2013 at 11:22 PM, Emil Goode  wrote:
> This patch fixes a format specifier warning. dma_addr_t can be either
> u32 or u64 so we should cast to the largest type and change the format
> specifier to %llx.

dma_addr_t is derived from phys_addr_t, thus you may use %pa specifier
which is available from v3.8(?).

Something like this:
dma_addr_t src_addr;
dev_dbg(dev, "DMA addr: %pa\n", src_addr);

--
With Best Regards,
Andy Shevchenko
--
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: gadget: f_uac2: Fix broken prm to uac2 mapping

2013-05-31 Thread Felipe Balbi
HI,

On Thu, May 30, 2013 at 06:23:33PM +0530, Jassi Brar wrote:
> From: Jassi Brar 
> 
> prm_to_uac2() is broken because it tests against pointer it itself
> mapped onto, which will never be different.
> Fix the mapping by adding pointer to parent chip in each rtd param
> and removing the prm_to_uac2().
> 
> Reported-by: Julien Rouviere 
> Signed-off-by: Jassi Brar 

when was this bug introduced ? Is it critical for v3.10 ? can it wait
for v3.11 ? Does it need to go to stable ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2] usb: musb: Fix format specifier warning

2013-05-31 Thread Felipe Balbi
Hi,

On Fri, May 31, 2013 at 10:49:49PM +0200, Emil Goode wrote:
> This patch fixes a format specifier warning. dma_addr_t can be either
> u32 or u64 so we should cast to the largest type and change the format
> specifier to %llx.
> The addition of urb->transfer_dma and urb->actual_length is also done a
> few lines below. I have moved this code up and pass the variable buf to
> dev_dbg.
> 
> Sparse output:
> drivers/usb/musb/musb_host.c:1761:4: warning:
>   format ‘%x’ expects argument of type ‘unsigned int’,
>   but argument 6 has type ‘dma_addr_t’ [-Wformat]
> 
> Signed-off-by: Emil Goode 

already sent this one yesterday:

http://marc.info/?l=linux-usb&m=136987256218081

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v2] usb: musb: Fix format specifier warning

2013-05-31 Thread Emil Goode
This patch fixes a format specifier warning. dma_addr_t can be either
u32 or u64 so we should cast to the largest type and change the format
specifier to %llx.
The addition of urb->transfer_dma and urb->actual_length is also done a
few lines below. I have moved this code up and pass the variable buf to
dev_dbg.

Sparse output:
drivers/usb/musb/musb_host.c:1761:4: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 6 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode 
---
v2: Added missing braces according to Doc/CodingStyle

 drivers/usb/musb/musb_host.c |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 094cf80..45c4e8b 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1756,11 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum)
dma_addr_t  buf;
 
rx_count = musb_readw(epio, MUSB_RXCOUNT);
+   buf = urb->transfer_dma + urb->actual_length;
 
-   dev_dbg(musb->controller, "RX%d count %d, buffer 0x%x 
len %d/%d\n",
+   dev_dbg(musb->controller, "RX%d count %d, buffer 0x%llx 
len %d/%d\n",
epnum, rx_count,
-   urb->transfer_dma
-   + urb->actual_length,
+   (unsigned long long)buf,
qh->offset,
urb->transfer_buffer_length);
 
@@ -1785,14 +1785,13 @@ void musb_host_rx(struct musb *musb, u8 epnum)
rx_count, d->length);
 
length = d->length;
-   } else
+   } else {
length = rx_count;
+   }
d->status = d_status;
buf = urb->transfer_dma + d->offset;
} else {
length = rx_count;
-   buf = urb->transfer_dma +
-   urb->actual_length;
}
 
dma->desired_mode = 0;
-- 
1.7.10.4

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


Re: [PATCH] usb: musb: Fix format specifier warning

2013-05-31 Thread Sergei Shtylyov

Hello.

On 06/01/2013 12:22 AM, Emil Goode wrote:


This patch fixes a format specifier warning. dma_addr_t can be either
u32 or u64 so we should cast to the largest type and change the format
specifier to %llx.
The addition of urb->transfer_dma and urb->actual_length is also done a
few lines below. I have moved this code up and pass the variable buf to
dev_dbg.

Sparse output:
drivers/usb/musb/musb_host.c:1761:4: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 6 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode 
---
  drivers/usb/musb/musb_host.c |   11 ---
  1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 094cf80..d647ccb 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c

[...]

@@ -1789,11 +1789,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
length = rx_count;
d->status = d_status;
buf = urb->transfer_dma + d->offset;
-   } else {
+   } else


   You should keep {} on the *else* branch since *if* branch has {},
according to Documentation/CodingStyle.


length = rx_count;
-   buf = urb->transfer_dma +
-   urb->actual_length;
-   }


WBR, Sergei


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


[PATCH] usb: musb: Fix format specifier warning

2013-05-31 Thread Emil Goode
This patch fixes a format specifier warning. dma_addr_t can be either
u32 or u64 so we should cast to the largest type and change the format
specifier to %llx.
The addition of urb->transfer_dma and urb->actual_length is also done a
few lines below. I have moved this code up and pass the variable buf to
dev_dbg.

Sparse output:
drivers/usb/musb/musb_host.c:1761:4: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 6 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode 
---
 drivers/usb/musb/musb_host.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 094cf80..d647ccb 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1756,11 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum)
dma_addr_t  buf;
 
rx_count = musb_readw(epio, MUSB_RXCOUNT);
+   buf = urb->transfer_dma + urb->actual_length;
 
-   dev_dbg(musb->controller, "RX%d count %d, buffer 0x%x 
len %d/%d\n",
+   dev_dbg(musb->controller, "RX%d count %d, buffer 0x%llx 
len %d/%d\n",
epnum, rx_count,
-   urb->transfer_dma
-   + urb->actual_length,
+   (unsigned long long)buf,
qh->offset,
urb->transfer_buffer_length);
 
@@ -1789,11 +1789,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
length = rx_count;
d->status = d_status;
buf = urb->transfer_dma + d->offset;
-   } else {
+   } else
length = rx_count;
-   buf = urb->transfer_dma +
-   urb->actual_length;
-   }
 
dma->desired_mode = 0;
 #ifdef USE_MODE1
-- 
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] Allow the USB HCD to create Wireless USB root hubs

2013-05-31 Thread Thomas Pugliese
This patch adds Wireless USB root hub support to the USB HCD.  It allows 
the HWA to create its root hub which previously failed because the HCD 
treated wireless root hubs the same as USB2 high speed hubs.  The creation 
of the root hub would fail in that case due to lack of TTs which wireless 
root hubs do not support.

Signed-off-by: Thomas Pugliese 

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d53547d..014dc99 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -149,6 +149,27 @@ static const u8 usb3_rh_dev_descriptor[18] = {
0x01/*  __u8  bNumConfigurations; */
 };
 
+/* usb 2.5 (wireless USB 1.0) root hub device descriptor */
+static const u8 usb25_rh_dev_descriptor[18] = {
+   0x12,   /*  __u8  bLength; */
+   0x01,   /*  __u8  bDescriptorType; Device */
+   0x50, 0x02, /*  __le16 bcdUSB; v2.5 */
+
+   0x09,   /*  __u8  bDeviceClass; HUB_CLASSCODE */
+   0x00,   /*  __u8  bDeviceSubClass; */
+   0x00,   /*  __u8  bDeviceProtocol; [ usb 2.0 no TT ] */
+   0xFF,   /*  __u8  bMaxPacketSize0; always 0xFF (WUSB Spec 7.4.1). */
+
+   0x6b, 0x1d, /*  __le16 idVendor; Linux Foundation 0x1d6b */
+   0x02, 0x00, /*  __le16 idProduct; device 0x0002 */
+   KERNEL_VER, KERNEL_REL, /*  __le16 bcdDevice */
+
+   0x03,   /*  __u8  iManufacturer; */
+   0x02,   /*  __u8  iProduct; */
+   0x01,   /*  __u8  iSerialNumber; */
+   0x01/*  __u8  bNumConfigurations; */
+};
+
 /* usb 2.0 root hub device descriptor */
 static const u8 usb2_rh_dev_descriptor [18] = {
0x12,   /*  __u8  bLength; */
@@ -527,6 +548,9 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb 
*urb)
case HCD_USB3:
bufp = usb3_rh_dev_descriptor;
break;
+   case HCD_USB25:
+   bufp = usb25_rh_dev_descriptor;
+   break;
case HCD_USB2:
bufp = usb2_rh_dev_descriptor;
break;
@@ -546,6 +570,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb 
*urb)
bufp = ss_rh_config_descriptor;
len = sizeof ss_rh_config_descriptor;
break;
+   case HCD_USB25:
case HCD_USB2:
bufp = hs_rh_config_descriptor;
len = sizeof hs_rh_config_descriptor;
@@ -2511,6 +2536,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
case HCD_USB2:
rhdev->speed = USB_SPEED_HIGH;
break;
+   case HCD_USB25:
+   rhdev->speed = USB_SPEED_WIRELESS;
+   break;
case HCD_USB3:
rhdev->speed = USB_SPEED_SUPER;
break;
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index 104730d..1452dd5 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -577,7 +577,7 @@ static struct hc_driver hwahc_hc_driver = {
.product_desc = "Wireless USB HWA host controller",
.hcd_priv_size = sizeof(struct hwahc) - sizeof(struct usb_hcd),
.irq = NULL,/* FIXME */
-   .flags = HCD_USB2,  /* FIXME */
+   .flags = HCD_USB25,
.reset = hwahc_op_reset,
.start = hwahc_op_start,
.stop = hwahc_op_stop,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index f5f5c7d..1e88377 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -218,6 +218,7 @@ struct hc_driver {
 #defineHCD_SHARED  0x0004  /* Two (or more) usb_hcds share 
HW */
 #defineHCD_USB11   0x0010  /* USB 1.1 */
 #defineHCD_USB20x0020  /* USB 2.0 */
+#defineHCD_USB25   0x0030  /* Wireless USB 1.0 (USB 2.5)*/
 #defineHCD_USB30x0040  /* USB 3.0 */
 #defineHCD_MASK0x0070
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

2013-05-31 Thread Sergei Shtylyov

Hello.

On 05/31/2013 10:38 PM, Michael Grzeschik wrote:


From: Sascha Hauer 

Signed-off-by: Sascha Hauer 
---
  drivers/usb/chipidea/ci13xxx_imx.c | 41 ++
  1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 4d64541..48c446b 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c

[...]

@@ -140,19 +139,21 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)

[...]

+   phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
+


Empty line is not really needed here, don't you think?


+   if (PTR_ERR(phy) == -EPROBE_DEFER) {


   Hm, can PTR_ERR() be called on non-error pointers? Seems so...


+   ret = -EPROBE_DEFER;
+   goto err_clk;
+   }
+
+   if (!IS_ERR(phy)) {
+   ret = usb_phy_init(phy);
+   if (ret) {
+   dev_err(&pdev->dev, "unable to init phy: %d\n", ret);
+   goto err_clk;
}
+
+   data->phy = phy;
}


Shouldn't this come first instead, with the above PTR_ERR() 
condition in

the *else* branch?

WBR, Sergei

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


[PATCH 7/7] usb: chipidea: usbmisc: use module_platform_driver

2013-05-31 Thread Michael Grzeschik
From: Philipp Zabel 

Signed-off-by: Philipp Zabel 
---
 drivers/usb/chipidea/usbmisc_imx.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 714a6bd..588bae8 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -243,17 +243,7 @@ static struct platform_driver usbmisc_imx_driver = {
 },
 };
 
-int usbmisc_imx_drv_init(void)
-{
-   return platform_driver_register(&usbmisc_imx_driver);
-}
-subsys_initcall(usbmisc_imx_drv_init);
-
-void usbmisc_imx_drv_exit(void)
-{
-   platform_driver_unregister(&usbmisc_imx_driver);
-}
-module_exit(usbmisc_imx_drv_exit);
+module_platform_driver(usbmisc_imx_driver);
 
 MODULE_ALIAS("platform:usbmisc-imx");
 MODULE_LICENSE("GPL v2");
-- 
1.8.2.rc2

--
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 v6 0/7] USB: add devicetree helpers for determining dr_mode and phy_type

2013-05-31 Thread Michael Grzeschik
changes since v5:
- fixed compiling issues with non dt kernels in helper functions
- moved ci13xxx_imx glue calls into dr_mode and phy_type helpers to core.c
- added missing PTS option into PTW, PTS patch
- added kernel parameter patch to force core into fullspeed mode
- fixed kmalloc pdata patch in ci13xxx_imx.c

Michael Grzeschik (4):
  USB: add devicetree helpers for determining dr_mode and phy_type
  USB: chipidea: ci13xxx-imx: move static pdata into probe function
  USB: chipidea: add PTW, PTS and STS handling
  usb: chipidea: udc: add force-full-speed option

Philipp Zabel (1):
  usb: chipidea: usbmisc: use module_platform_driver

Sascha Hauer (2):
  USB chipidea: introduce dual role mode pdata flags
  USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

 .../devicetree/bindings/usb/ci13xxx-imx.txt|  6 ++
 drivers/usb/chipidea/bits.h| 17 -
 drivers/usb/chipidea/ci13xxx_imx.c | 60 
 drivers/usb/chipidea/core.c| 84 --
 drivers/usb/chipidea/usbmisc_imx.c | 12 +---
 drivers/usb/phy/Makefile   |  1 +
 drivers/usb/phy/of.c   | 47 
 drivers/usb/usb-common.c   | 35 +
 include/linux/usb/chipidea.h   |  3 +-
 include/linux/usb/of.h | 28 
 include/linux/usb/otg.h|  7 ++
 include/linux/usb/phy.h|  9 +++
 12 files changed, 258 insertions(+), 51 deletions(-)
 create mode 100644 drivers/usb/phy/of.c
 create mode 100644 include/linux/usb/of.h

-- 
1.8.2.rc2

--
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/7] USB: chipidea: add PTW, PTS and STS handling

2013-05-31 Thread Michael Grzeschik
From: Michael Grzeschik 

This patch makes it possible to configure the PTW, PTS and STS bits
inside the portsc register for host and device mode before the driver
starts and the phy can be addressed as hardware implementation is
designed.

Signed-off-by: Michael Grzeschik 
Signed-off-by: Marc Kleine-Budde 
Signed-off-by: Sascha Hauer 
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt|  5 +++
 drivers/usb/chipidea/bits.h| 15 ++-
 drivers/usb/chipidea/core.c| 49 ++
 include/linux/usb/chipidea.h   |  1 +
 4 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index 1c04a4c..184a8e0 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -5,6 +5,11 @@ Required properties:
 - reg: Should contain registers location and length
 - interrupts: Should contain controller interrupt
 
+Recommended properies:
+- phy_type: the type of the phy connected to the core. Should be one
+  of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
+  property the PORTSC register won't be touched
+
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
 - fsl,usbmisc: phandler of non-core register device, with one argument
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 050de85..93efe4e 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -48,10 +48,23 @@
 #define PORTSC_SUSP   BIT(7)
 #define PORTSC_HSPBIT(9)
 #define PORTSC_PTC(0x0FUL << 16)
+/* PTS and PTW for non lpm version only */
+#define PORTSC_PTS(d) d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 
0))
+#define PORTSC_PTWBIT(28)
+#define PORTSC_STSBIT(29)
 
 /* DEVLC */
 #define DEVLC_PSPD(0x03UL << 25)
-#defineDEVLC_PSPD_HS  (0x02UL << 25)
+#define DEVLC_PSPD_HS (0x02UL << 25)
+#define DEVLC_PTW BIT(27)
+#define DEVLC_STS BIT(28)
+#define DEVLC_PTS(d)  (((d) & 0x7) << 29)
+
+/* Encoding for DEVLC_PTS and PORTSC_PTS */
+#define PTS_UTMI  0
+#define PTS_ULPI  2
+#define PTS_SERIAL3
+#define PTS_HSIC  4
 
 /* OTGSC */
 #define OTGSC_IDPU   BIT(5)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 49b098b..b49b682 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -64,6 +64,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ci.h"
 #include "udc.h"
@@ -208,6 +210,45 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem 
*base)
return 0;
 }
 
+static void hw_phymode_configure(struct ci13xxx *ci)
+{
+   u32 portsc, lpm, sts;
+
+   switch (ci->platdata->phy_mode) {
+   case USBPHY_INTERFACE_MODE_UTMI:
+   portsc = PORTSC_PTS(PTS_UTMI);
+   lpm = DEVLC_PTS(PTS_UTMI);
+   break;
+   case USBPHY_INTERFACE_MODE_UTMIW:
+   portsc = PORTSC_PTS(PTS_UTMI) | PORTSC_PTW;
+   lpm = DEVLC_PTS(PTS_UTMI) | DEVLC_PTW;
+   break;
+   case USBPHY_INTERFACE_MODE_ULPI:
+   portsc = PORTSC_PTS(PTS_ULPI);
+   lpm = DEVLC_PTS(PTS_ULPI);
+   break;
+   case USBPHY_INTERFACE_MODE_SERIAL:
+   portsc = PORTSC_PTS(PTS_SERIAL);
+   lpm = DEVLC_PTS(PTS_SERIAL);
+   sts = 1;
+   break;
+   case USBPHY_INTERFACE_MODE_HSIC:
+   portsc = PORTSC_PTS(PTS_HSIC);
+   lpm = DEVLC_PTS(PTS_HSIC);
+   break;
+   default:
+   return;
+   }
+
+   if (ci->hw_bank.lpm) {
+   hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm);
+   hw_write(ci, OP_DEVLC, DEVLC_STS, sts);
+   } else {
+   hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc);
+   hw_write(ci, OP_PORTSC, PORTSC_STS, sts);
+   }
+}
+
 /**
  * hw_device_reset: resets chip (execute without interruption)
  * @ci: the controller
@@ -369,6 +410,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return -ENODEV;
}
 
+   if (!dev->of_node && dev->parent)
+   dev->of_node = dev->parent->of_node;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
@@ -408,6 +452,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return -ENODEV;
}
 
+   if (!ci->platdata->phy_mode)
+   ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
+
/* initialize role(s) before the interrupt is requested */
ret = ci_hdrc_host_init(ci);
   

[PATCH 5/7] USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

2013-05-31 Thread Michael Grzeschik
From: Sascha Hauer 

Signed-off-by: Sascha Hauer 
---
 drivers/usb/chipidea/ci13xxx_imx.c | 41 ++
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 4d64541..48c446b 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -29,7 +29,6 @@
((struct usb_phy *)platform_get_drvdata(pdev))
 
 struct ci13xxx_imx_data {
-   struct device_node *phy_np;
struct usb_phy *phy;
struct platform_device *ci_pdev;
struct clk *clk;
@@ -98,12 +97,12 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
  CI13XXX_PULLUP_ON_VBUS |
  CI13XXX_DISABLE_STREAMING,
};
-   struct platform_device *plat_ci, *phy_pdev;
-   struct device_node *phy_np;
+   struct platform_device *plat_ci;
struct resource *res;
struct regulator *reg_vbus;
struct pinctrl *pinctrl;
int ret;
+   struct usb_phy *phy;
 
if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL)
&& !usbmisc_ops)
@@ -140,19 +139,21 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
return ret;
}
 
-   phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
-   if (phy_np) {
-   data->phy_np = phy_np;
-   phy_pdev = of_find_device_by_node(phy_np);
-   if (phy_pdev) {
-   struct usb_phy *phy;
-   phy = pdev_to_phy(phy_pdev);
-   if (phy &&
-   try_module_get(phy_pdev->dev.driver->owner)) {
-   usb_phy_init(phy);
-   data->phy = phy;
-   }
+   phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
+
+   if (PTR_ERR(phy) == -EPROBE_DEFER) {
+   ret = -EPROBE_DEFER;
+   goto err_clk;
+   }
+
+   if (!IS_ERR(phy)) {
+   ret = usb_phy_init(phy);
+   if (ret) {
+   dev_err(&pdev->dev, "unable to init phy: %d\n", ret);
+   goto err_clk;
}
+
+   data->phy = phy;
}
 
/* we only support host now, so enable vbus here */
@@ -163,7 +164,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Failed to enable vbus regulator, err=%d\n",
ret);
-   goto put_np;
+   goto err_clk;
}
data->reg_vbus = reg_vbus;
} else {
@@ -202,7 +203,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"usbmisc post failed, ret=%d\n", ret);
-   goto put_np;
+   goto err;
}
}
 
@@ -217,9 +218,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 err:
if (reg_vbus)
regulator_disable(reg_vbus);
-put_np:
-   if (phy_np)
-   of_node_put(phy_np);
+err_clk:
clk_disable_unprepare(data->clk);
return ret;
 }
@@ -239,8 +238,6 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
module_put(data->phy->dev->driver->owner);
}
 
-   of_node_put(data->phy_np);
-
clk_disable_unprepare(data->clk);
 
platform_set_drvdata(pdev, NULL);
-- 
1.8.2.rc2

--
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 6/7] usb: chipidea: udc: add force-full-speed option

2013-05-31 Thread Michael Grzeschik
From: Michael Grzeschik 

This patch makes it possible to set the chipidea udc
into full-speed only mode. It can be set by the oftree
property "force-full-speed".

Signed-off-by: Michael Grzeschik 
Signed-off-by: Marc Kleine-Budde 
---
 drivers/usb/chipidea/bits.h |  2 ++
 drivers/usb/chipidea/core.c | 11 +++
 2 files changed, 13 insertions(+)

diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
index 93efe4e..4c14ab7 100644
--- a/drivers/usb/chipidea/bits.h
+++ b/drivers/usb/chipidea/bits.h
@@ -49,11 +49,13 @@
 #define PORTSC_HSPBIT(9)
 #define PORTSC_PTC(0x0FUL << 16)
 /* PTS and PTW for non lpm version only */
+#define PORTSC_PFSC   BIT(24)
 #define PORTSC_PTS(d) d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 
0))
 #define PORTSC_PTWBIT(28)
 #define PORTSC_STSBIT(29)
 
 /* DEVLC */
+#define DEVLC_PFSCBIT(23)
 #define DEVLC_PSPD(0x03UL << 25)
 #define DEVLC_PSPD_HS (0x02UL << 25)
 #define DEVLC_PTW BIT(27)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index dcf2a0b..4b8b3e7 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -73,6 +73,11 @@
 #include "host.h"
 #include "debug.h"
 
+/* force full-speed operation */
+static bool full_speed;
+module_param(full_speed, bool, 0444);
+MODULE_PARM_DESC(full_speed, "force full-speed mode");
+
 /* Controller register map */
 static uintptr_t ci_regs_nolpm[] = {
[CAP_CAPLENGTH] = 0x000UL,
@@ -265,6 +270,12 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
while (hw_read(ci, OP_USBCMD, USBCMD_RST))
udelay(10); /* not RTOS friendly */
 
+   if (full_speed) {
+   if (ci->hw_bank.lpm)
+   hw_write(ci, OP_PORTSC, DEVLC_PFSC, DEVLC_PFSC);
+   else
+   hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
+   }
 
if (ci->platdata->notify_event)
ci->platdata->notify_event(ci,
-- 
1.8.2.rc2

--
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/7] USB chipidea: introduce dual role mode pdata flags

2013-05-31 Thread Michael Grzeschik
From: Sascha Hauer 

Even if a chipidea core is otg capable the board may not. This allows
to explicitly set the core to host/peripheral mode. Without these
flags the driver falls back to the old behaviour.

Signed-off-by: Sascha Hauer 
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt|  1 +
 drivers/usb/chipidea/core.c| 24 --
 include/linux/usb/chipidea.h   |  2 +-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index 184a8e0..b4b5b79 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -9,6 +9,7 @@ Recommended properies:
 - phy_type: the type of the phy connected to the core. Should be one
   of "utmi", "utmi_wide", "ulpi", "serial" or "hsic". Without this
   property the PORTSC register won't be touched
+- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
 
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index b49b682..dcf2a0b 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -404,6 +404,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
struct resource *res;
void __iomem*base;
int ret;
+   enum usb_dr_mode dr_mode;
 
if (!dev->platform_data) {
dev_err(dev, "platform data missing\n");
@@ -455,14 +456,25 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ci->platdata->phy_mode)
ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
 
+   if (!ci->platdata->dr_mode)
+   ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
+
+   if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
+   ci->platdata->dr_mode = USB_DR_MODE_OTG;
+
+   dr_mode = ci->platdata->dr_mode;
/* initialize role(s) before the interrupt is requested */
-   ret = ci_hdrc_host_init(ci);
-   if (ret)
-   dev_info(dev, "doesn't support host\n");
+   if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
+   ret = ci_hdrc_host_init(ci);
+   if (ret)
+   dev_info(dev, "doesn't support host\n");
+   }
 
-   ret = ci_hdrc_gadget_init(ci);
-   if (ret)
-   dev_info(dev, "doesn't support gadget\n");
+   if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_PERIPHERAL) {
+   ret = ci_hdrc_gadget_init(ci);
+   if (ret)
+   dev_info(dev, "doesn't support gadget\n");
+   }
 
if (!ci->roles[CI_ROLE_HOST] && !ci->roles[CI_ROLE_GADGET]) {
dev_err(dev, "no supported roles\n");
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 1a2aa18..b314647 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -20,7 +20,7 @@ struct ci13xxx_platform_data {
 #define CI13XXX_REQUIRE_TRANSCEIVERBIT(1)
 #define CI13XXX_PULLUP_ON_VBUS BIT(2)
 #define CI13XXX_DISABLE_STREAMING  BIT(3)
-
+   enum usb_dr_modedr_mode;
 #define CI13XXX_CONTROLLER_RESET_EVENT 0
 #define CI13XXX_CONTROLLER_STOPPED_EVENT   1
void(*notify_event) (struct ci13xxx *ci, unsigned event);
-- 
1.8.2.rc2

--
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/7] USB: chipidea: ci13xxx-imx: move static pdata into probe function

2013-05-31 Thread Michael Grzeschik
From: Michael Grzeschik 

The pdata structure gets copied anyway inside ci13xxx_add_device
by platform_device_add. We don't need to have it static.

Signed-off-by: Michael Grzeschik 
Signed-off-by: Marc Kleine-Budde 
Signed-off-by: Sascha Hauer 
Reviewed-by: Peter Chen 
---
 drivers/usb/chipidea/ci13xxx_imx.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index 73f9d5f..4d64541 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -88,17 +88,16 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
 
 /* End of common functions shared by usbmisc drivers*/
 
-static struct ci13xxx_platform_data ci13xxx_imx_platdata  = {
-   .name   = "ci13xxx_imx",
-   .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_PULLUP_ON_VBUS |
- CI13XXX_DISABLE_STREAMING,
-   .capoffset  = DEF_CAPOFFSET,
-};
-
 static int ci13xxx_imx_probe(struct platform_device *pdev)
 {
struct ci13xxx_imx_data *data;
+   struct ci13xxx_platform_data pdata = {
+   .name   = "ci13xxx_imx",
+   .capoffset  = DEF_CAPOFFSET,
+   .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
+ CI13XXX_PULLUP_ON_VBUS |
+ CI13XXX_DISABLE_STREAMING,
+   };
struct platform_device *plat_ci, *phy_pdev;
struct device_node *phy_np;
struct resource *res;
@@ -171,7 +170,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
reg_vbus = NULL;
}
 
-   ci13xxx_imx_platdata.phy = data->phy;
+   pdata.phy = data->phy;
 
if (!pdev->dev.dma_mask)
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
@@ -189,7 +188,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
 
plat_ci = ci13xxx_add_device(&pdev->dev,
pdev->resource, pdev->num_resources,
-   &ci13xxx_imx_platdata);
+   &pdata);
if (IS_ERR(plat_ci)) {
ret = PTR_ERR(plat_ci);
dev_err(&pdev->dev,
-- 
1.8.2.rc2

--
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/7] USB: add devicetree helpers for determining dr_mode and phy_type

2013-05-31 Thread Michael Grzeschik
From: Michael Grzeschik 

This adds two little devicetree helper functions for determining the
dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
the devicetree.

Signed-off-by: Michael Grzeschik 
Signed-off-by: Marc Kleine-Budde 
Signed-off-by: Sascha Hauer 
---
 drivers/usb/phy/Makefile |  1 +
 drivers/usb/phy/of.c | 47 +++
 drivers/usb/usb-common.c | 35 +++
 include/linux/usb/of.h   | 28 
 include/linux/usb/otg.h  |  7 +++
 include/linux/usb/phy.h  |  9 +
 6 files changed, 127 insertions(+)
 create mode 100644 drivers/usb/phy/of.c
 create mode 100644 include/linux/usb/of.h

diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index a9169cb..070eca3 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -5,6 +5,7 @@
 ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_USB_PHY)  += phy.o
+obj-$(CONFIG_OF)   += of.o
 
 # transceiver drivers, keep the list sorted
 
diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
new file mode 100644
index 000..e6f3b74
--- /dev/null
+++ b/drivers/usb/phy/of.c
@@ -0,0 +1,47 @@
+/*
+ * USB of helper code
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const char *usbphy_modes[] = {
+   [USBPHY_INTERFACE_MODE_UNKNOWN] = "",
+   [USBPHY_INTERFACE_MODE_UTMI]= "utmi",
+   [USBPHY_INTERFACE_MODE_UTMIW]   = "utmi_wide",
+   [USBPHY_INTERFACE_MODE_ULPI]= "ulpi",
+   [USBPHY_INTERFACE_MODE_SERIAL]  = "serial",
+   [USBPHY_INTERFACE_MODE_HSIC]= "hsic",
+};
+
+/**
+ * of_usb_get_phy_mode - Get phy mode for given device_node
+ * @np:Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'phy_type',
+ * and returns the correspondig enum usb_phy_interface
+ */
+enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
+{
+   const char *phy_type;
+   int err, i;
+
+   err = of_property_read_string(np, "phy_type", &phy_type);
+   if (err < 0)
+   return USBPHY_INTERFACE_MODE_UNKNOWN;
+
+   for (i = 0; i < ARRAY_SIZE(usbphy_modes); i++)
+   if (!strcmp(phy_type, usbphy_modes[i]))
+   return i;
+
+   return USBPHY_INTERFACE_MODE_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_phy_mode);
diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
index 0db0a91..027582d 100644
--- a/drivers/usb/usb-common.c
+++ b/drivers/usb/usb-common.c
@@ -13,7 +13,9 @@
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 const char *usb_otg_state_string(enum usb_otg_state state)
@@ -79,4 +81,37 @@ const char *usb_state_string(enum usb_device_state state)
 }
 EXPORT_SYMBOL_GPL(usb_state_string);
 
+#ifdef CONFIG_OF
+static const char *usb_dr_modes[] = {
+   [USB_DR_MODE_UNKNOWN]   = "",
+   [USB_DR_MODE_HOST]  = "host",
+   [USB_DR_MODE_PERIPHERAL]= "peripheral",
+   [USB_DR_MODE_OTG]   = "otg",
+};
+
+/**
+ * of_usb_get_dr_mode - Get dual role mode for given device_node
+ * @np:Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the correspondig enum usb_dr_mode
+ */
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
+{
+   const char *dr_mode;
+   int err, i;
+
+   err = of_property_read_string(np, "dr_mode", &dr_mode);
+   if (err < 0)
+   return USB_DR_MODE_UNKNOWN;
+
+   for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++)
+   if (!strcmp(dr_mode, usb_dr_modes[i]))
+   return i;
+
+   return USB_DR_MODE_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(of_usb_get_dr_mode);
+#endif
+
 MODULE_LICENSE("GPL");
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
new file mode 100644
index 000..e460a24
--- /dev/null
+++ b/include/linux/usb/of.h
@@ -0,0 +1,28 @@
+/*
+ * OF helpers for usb devices.
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef __LINUX_USB_OF_H
+#define __LINUX_USB_OF_H
+
+#include 
+#include 
+
+#ifdef CONFIG_OF
+enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
+#else
+static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node 
*np)
+{
+   return USBPHY_INTERFACE_MODE_UNKNOWN;
+}
+
+static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
+{
+   return USB_DR_MODE_UNKNOWN;
+}
+#endif
+
+#endif /* __LINUX_USB_OF_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 291e01b..154332

Re: MUSB multiplatform work?

2013-05-31 Thread Tony Lindgren
* Felipe Balbi  [130530 21:06]:
> On Thu, May 30, 2013 at 01:54:49PM -0700, Tony Lindgren wrote:
> > * Tony Lindgren  [130530 13:25]:
> > > 
> > > TUSB we can make depend on ARMv7, the only implementation we have
> > > is for omap2420, which is ARMv6. This should solve the issue for
> > > ARMv7 multiplatform builds for now.
> > 
> > Sorry mean depend on !ARMv7. But thinking about it more, that does
> > not make much sense as it would break things for omap2plus_defconfig
> > at least which is multiplatform v6 and v7. For now TUSB can be made
> > to depend on MACH_NOKIA_N8X0. I doubt that anybody is using the add
> > on cards for H4 boards any longer..
> 
> could also be made to depend on BROKEN. I don't think anyone *really*
> cares about that glue layer other than the very few in the world who
> still like the nostalgic feeling of booting current linux releases on
> n8x0 devices.

Unfortunately that's the best test case we have for GPMC and DMA stress
testing so it's good to keep around.

And n8x0 is still quite usable general purpose pocket computer with
keyboard and WLAN and tons of storage :)

Regards,

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


[PATCH] USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device

2013-05-31 Thread Robert Butora
The patch adds a new HIDCOM device and does not affect other devices
driven by the cypress_M8 module. Changes are:
- add VendorID ProductID to device tables
- skip unstable speed check because FRWD uses 115200bps
- skip reset at probe which is an issue workaround for this
particular device.

Signed-off-by: Robert Butora 
---
 drivers/usb/serial/cypress_m8.c |   18 +-
 drivers/usb/serial/cypress_m8.h |4 
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index d341555..0821201 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -65,6 +65,7 @@ static const struct usb_device_id id_table_earthmate[] = {
 static const struct usb_device_id id_table_cyphidcomrs232[] = {
{ USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
{ USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
+   { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
{ } /* Terminating entry */
 };
 
@@ -78,6 +79,7 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) },
{ USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
{ USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
+   { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
{ USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
{ } /* Terminating entry */
 };
@@ -229,6 +231,12 @@ static struct usb_serial_driver * const serial_drivers[] = 
{
  * Cypress serial helper functions
  */
 
+/* FRWD Dongle hidcom needs to skip reset and speed checks */
+static inline bool is_frwd(struct usb_device *dev)
+{
+   return ((le16_to_cpu(dev->descriptor.idVendor) == VENDOR_ID_FRWD) &&
+   (le16_to_cpu(dev->descriptor.idProduct) == 
PRODUCT_ID_CYPHIDCOM_FRWD));
+}
 
 static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
 {
@@ -238,6 +246,10 @@ static int analyze_baud_rate(struct usb_serial_port *port, 
speed_t new_rate)
if (unstable_bauds)
return new_rate;
 
+   /* FRWD Dongle uses 115200 bps */
+   if (is_frwd(port->serial->dev))
+   return new_rate;
+
/*
 * The general purpose firmware for the Cypress M8 allows for
 * a maximum speed of 57600bps (I have no idea whether DeLorme
@@ -448,7 +460,11 @@ static int cypress_generic_port_probe(struct 
usb_serial_port *port)
return -ENOMEM;
}
 
-   usb_reset_configuration(serial->dev);
+   /* Skip reset for FRWD device. It is a workaound:
+  device hangs if it receives SET_CONFIGURE in Configured
+  state. */
+   if (!is_frwd(serial->dev))
+   usb_reset_configuration(serial->dev);
 
priv->cmd_ctrl = 0;
priv->line_control = 0;
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index 67cf608..b461311 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -24,6 +24,10 @@
 #define VENDOR_ID_CYPRESS  0x04b4
 #define PRODUCT_ID_CYPHIDCOM   0x5500
 
+/* FRWD Dongle - a GPS sports watch */
+#define VENDOR_ID_FRWD 0x6737
+#define PRODUCT_ID_CYPHIDCOM_FRWD  0x0001
+
 /* Powercom UPS, chip CY7C63723 */
 #define VENDOR_ID_POWERCOM 0x0d9f
 #define PRODUCT_ID_UPS 0x0002
-- 
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 V8 0/3] USB: OHCI: Start splitting up the driver

2013-05-31 Thread Arnd Bergmann
On Friday 31 May 2013 10:12:38 Alan Stern wrote:
> On Thu, 30 May 2013, Arnd Bergmann wrote:
> 
> > > I'll try to replicate your result.  I don't have my USB audio device 
> > > here today, so it will have to wait until tomorrow.
> > 
> > Strange enough, it seems to be working now, on a different base.
> > 
> > The kernel I tried last (based on yesterday's linux-next) also
> > had other issues and was very slow, so it may have been something
> > different.
> 
> My test ran successfully, no problems.  I guess we can ignore this.

Ok, good.

Arnd
--
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 V8 0/3] USB: OHCI: Start splitting up the driver

2013-05-31 Thread Alan Stern
On Thu, 30 May 2013, Arnd Bergmann wrote:

> > I'll try to replicate your result.  I don't have my USB audio device 
> > here today, so it will have to wait until tomorrow.
> 
> Strange enough, it seems to be working now, on a different base.
> 
> The kernel I tried last (based on yesterday's linux-next) also
> had other issues and was very slow, so it may have been something
> different.

My test ran successfully, no problems.  I guess we can ignore this.

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/2] USB: OHCI: make ohci-platform a separate driver

2013-05-31 Thread Alan Stern
On Fri, 31 May 2013 manjunath.gou...@linaro.org wrote:

> From: Manjunath Goudar 
> 
> This patch splits the ohci-platform code from ohci-hcd out
> into its own separate driver module.This work is part of enabling
> multi-platform kernels on ARM.
> 
> In V2:
>   -Passed "hcd" argment instead of "ohci" in ohci_setup() because it is
>using "struct usb_hcd" argment.

> @@ -30,58 +42,17 @@ static int ohci_platform_reset(struct usb_hcd *hcd)

...

> + return ohci_setup(ohci_to_hcd(ohci));

You don't need to use ohci_to_hcd(), because the hcd value is already a 
parameter in this function.

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: [RFC PATCH 2/2] USB: OHCI: add a name for the platform-private field

2013-05-31 Thread Alan Stern
On Fri, 31 May 2013, Manjunath Goudar wrote:

> On 30 May 2013 22:56, Alan Stern  wrote:
> 
> > On Thu, 30 May 2013, Manjunath Goudar wrote:
> >
> > > This patch adds an ohci->priv field for private use by OHCI
> > > platform drivers.
> > >
> > > Until now none of the platform drivers has used this private space,
> > > but that's about to change in the next patch of this series.
> >
> > As far as I'm concerned, this doesn't need to be in a patch of its own.
> > It can be merged into the 1/3 patch of the previous series.  After all,
> > that patch adds the extra_priv_size field in ohci_driver_overrides,
> > which doesn't make much sense unless there's a way to refer to the
> > private part of the ohci_hcd structure
> 
> 
> 
>  Already 1/3 patch is merged into main line kernel.

Yeah, too late now.

> Two days back only I started making ohci-spera a separate driver ,that time
> I felt extra_priv_size field is required in ohci_driver_overrides that what
> I created separate patch.
> 
> extra_priv_size patch is related to Spear patch,If you are agree,I can add
> this patch with Spear patch,making Spear patch series.

No, we may as well keep it separate like this.

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: Linux USB file storage gadget with new UDC

2013-05-31 Thread Alan Stern
On Fri, 31 May 2013, victor yeo wrote:

> When i run USB 2.0 Command Verifier on file gadget and UDC driver, an
> error in Command Verifier says "Device must support being set to
> Addressed/Configured state".  Does it mean the gadget cannot support
> putting device in addressed state or configured state, as in
> supporting the Set Address and Set Configuration requests?

I don't know what it means.  The gadget _does_ support being set to the 
Addressed and Configured states.  If it didn't support these things, 
you would not have been able to test it 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 -next] usb: fusbh200-hcd: fix error handling in fusbh200_hcd_fusbh200_probe()

2013-05-31 Thread Wei Yongjun
On 05/31/2013 08:29 PM, Greg KH wrote:
> On Fri, May 31, 2013 at 08:05:22PM +0800, Wei Yongjun wrote:
>> On 05/31/2013 07:21 PM, gre...@linuxfoundation.org wrote:
>>> On Fri, May 31, 2013 at 02:35:41AM +, Wendy Yuan-Hsin Chen(??元馨) wrote:
 -Original Message-
 From: Wei Yongjun [mailto:weiyj...@gmail.com] 
 Sent: Tuesday, May 21, 2013 10:41 AM
 To: gre...@linuxfoundation.org; Wendy Yuan-Hsin Chen(??元馨)
 Cc: yongjun_...@trendmicro.com.cn; linux-usb@vger.kernel.org
 Subject: [PATCH -next] usb: fusbh200-hcd: fix error handling in 
 fusbh200_hcd_fusbh200_probe()
>>> Why the forward of a previous patch?  I don't see this original one in
>>> my mailboxes anywhere, what happened to it?
>> Does this patch lost? Should I resend this one with Acked-by: Yuan-Hsin Chen?

I just found this patch has been applied:

http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=244435b8eecba7bb8b791350de3f08e638a331f2

> Yes.
>
>
>


--
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 -next] usb: fusbh200-hcd: fix error handling in fusbh200_hcd_fusbh200_probe()

2013-05-31 Thread Greg KH
On Fri, May 31, 2013 at 08:05:22PM +0800, Wei Yongjun wrote:
> On 05/31/2013 07:21 PM, gre...@linuxfoundation.org wrote:
> > On Fri, May 31, 2013 at 02:35:41AM +, Wendy Yuan-Hsin Chen(??元馨) wrote:
> >> -Original Message-
> >> From: Wei Yongjun [mailto:weiyj...@gmail.com] 
> >> Sent: Tuesday, May 21, 2013 10:41 AM
> >> To: gre...@linuxfoundation.org; Wendy Yuan-Hsin Chen(??元馨)
> >> Cc: yongjun_...@trendmicro.com.cn; linux-usb@vger.kernel.org
> >> Subject: [PATCH -next] usb: fusbh200-hcd: fix error handling in 
> >> fusbh200_hcd_fusbh200_probe()
> > Why the forward of a previous patch?  I don't see this original one in
> > my mailboxes anywhere, what happened to it?
> 
> Does this patch lost? Should I resend this one with Acked-by: Yuan-Hsin Chen?

Yes.

--
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: OHCI: add a name for the platform-private field

2013-05-31 Thread manjunath . goudar
From: Manjunath Goudar 

This patch adds an ohci->priv field for private use by OHCI
platform drivers.

Until now none of the platform drivers has used this private space,
but that's about to change in the next patch of this series.

In V2:
No changes.

Signed-off-by: Manjunath Goudar 
Cc: Arnd Bergmann 
Cc: Greg KH 
Cc: Alan Stern 
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/ohci.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 3b58482..e2e5faa 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -421,6 +421,9 @@ struct ohci_hcd {
struct dentry   *debug_periodic;
struct dentry   *debug_registers;
 #endif
+   /* platform-specific data -- must come last */
+   unsigned long   priv[0] __aligned(sizeof(s64));
+
 };
 
 #ifdef CONFIG_PCI
-- 
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: OHCI: Splitting ohci-platform into independent driver

2013-05-31 Thread manjunath . goudar
From: Manjunath Goudar 

This series patch begins the process of splitting ohci-platform up
into independent driver modules and add a name for the platform-private field.

Patch 1/2 separate ohci-platform into independent driver modules.

V1 to V2:
Passed "hcd" argment instead of "ohci" in ohci_setup().

Patch 2/2 adds an ohci->priv field for private use by OHCI platform drivers.
V1 to V2:
No changes. 


Manjunath Goudar (2):
  USB: OHCI: make ohci-platform a separate driver
  USB: OHCI: add a name for the platform-private field

 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 drivers/usb/host/ohci.h  |3 ++
 5 files changed, 47 insertions(+), 53 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 1/2] USB: OHCI: make ohci-platform a separate driver

2013-05-31 Thread manjunath . goudar
From: Manjunath Goudar 

This patch splits the ohci-platform code from ohci-hcd out
into its own separate driver module.This work is part of enabling
multi-platform kernels on ARM.

In V2:
  -Passed "hcd" argment instead of "ohci" in ohci_setup() because it is
   using "struct usb_hcd" argment.

Signed-off-by: Manjunath Goudar 
Acked-by: Alan Stern 
Cc: Arnd Bergmann 
Cc: Greg KH 
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 4 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a0a2f3a..5391a38 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -501,7 +501,7 @@ config USB_CNS3XXX_OHCI
  It is needed for low-speed USB 1.0 device support.
 
 config USB_OHCI_HCD_PLATFORM
-   bool "Generic OHCI driver for a platform device"
+   tristate "Generic OHCI driver for a platform device"
default n
---help---
  Adds an OHCI host driver for a generic platform device, which
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 2214ded..8a89c3d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o
 
 obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
 obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o
+obj-$(CONFIG_USB_OHCI_HCD_PLATFORM)+= ohci-platform.o
 
 obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
 obj-$(CONFIG_USB_FHCI_HCD) += fhci.o
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 237be7c..39c7624 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1258,12 +1258,8 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVERohci_hcd_tilegx_driver
 #endif
 
-#ifdef CONFIG_USB_OHCI_HCD_PLATFORM
-#include "ohci-platform.c"
-#define PLATFORM_DRIVERohci_platform_driver
-#endif
-
 #if!IS_ENABLED(CONFIG_USB_OHCI_HCD_PCI) && \
+   !IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM) && \
!defined(PLATFORM_DRIVER) &&\
!defined(OMAP1_PLATFORM_DRIVER) &&  \
!defined(OMAP3_PLATFORM_DRIVER) &&  \
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 76a3531..288feed 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -13,16 +13,28 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include "ohci.h"
+
+#define DRIVER_DESC "OHCI generic platform driver"
+
+static const char hcd_name[] = "ohci-platform";
 
 static int ohci_platform_reset(struct usb_hcd *hcd)
 {
struct platform_device *pdev = to_platform_device(hcd->self.controller);
struct usb_ohci_pdata *pdata = pdev->dev.platform_data;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
 
if (pdata->big_endian_desc)
ohci->flags |= OHCI_QUIRK_BE_DESC;
@@ -30,58 +42,17 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
ohci->flags |= OHCI_QUIRK_BE_MMIO;
if (pdata->no_big_frame_no)
ohci->flags |= OHCI_QUIRK_FRAME_NO;
-
-   ohci_hcd_init(ohci);
-
if (pdata->num_ports)
ohci->num_ports = pdata->num_ports;
 
-   err = ohci_init(ohci);
-
-   return err;
-}
-
-static int ohci_platform_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
-
-   err = ohci_run(ohci);
-   if (err < 0) {
-   ohci_err(ohci, "can't start\n");
-   ohci_stop(hcd);
-   }
-
-   return err;
+   return ohci_setup(ohci_to_hcd(ohci));
 }
 
-static const struct hc_driver ohci_platform_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = "Generic Platform OHCI Controller",
-   .hcd_priv_size  = sizeof(struct ohci_hcd),
+static struct hc_driver __read_mostly ohci_platform_hc_driver;
 
-   .irq= ohci_irq,
-   .flags  = HCD_MEMORY | HCD_USB11,
-
-   .reset  = ohci_platform_reset,
-   .start  = ohci_platform_start,
-   .stop   = ohci_stop,
-   .shutdown   = ohci_shutdown,
-
-   .urb_enqueue= ohci_urb_enqueue,
-   .urb_dequeue= ohci_urb_dequeue,
-   .endpoint_disable   = ohci_endpoint_disable,
-
-   .get_frame_number   = ohci_get_frame,
-
-   .hub_status_data= ohci_hub_status_data,
-   .hub_control= ohci_hub_control,
-#ifdef CONFIG_PM
-   .bus_suspend= ohci_bus_suspend,
-   .bus_resume = ohci_bus_resume,
-#endif
-
-  

Re: [PATCH -next] usb: fusbh200-hcd: fix error handling in fusbh200_hcd_fusbh200_probe()

2013-05-31 Thread Wei Yongjun
On 05/31/2013 07:21 PM, gre...@linuxfoundation.org wrote:
> On Fri, May 31, 2013 at 02:35:41AM +, Wendy Yuan-Hsin Chen(��元馨) wrote:
>> -Original Message-
>> From: Wei Yongjun [mailto:weiyj...@gmail.com] 
>> Sent: Tuesday, May 21, 2013 10:41 AM
>> To: gre...@linuxfoundation.org; Wendy Yuan-Hsin Chen(��元馨)
>> Cc: yongjun_...@trendmicro.com.cn; linux-usb@vger.kernel.org
>> Subject: [PATCH -next] usb: fusbh200-hcd: fix error handling in 
>> fusbh200_hcd_fusbh200_probe()
> Why the forward of a previous patch?  I don't see this original one in
> my mailboxes anywhere, what happened to it?

Does this patch lost? Should I resend this one with Acked-by: Yuan-Hsin Chen?

>
>> From: Wei Yongjun 
>>
>> Fix to release all resources when fusbh200_setup() fail instead of only 
>> return error.
>>
>> Signed-off-by: Wei Yongjun 
>>
>> Acked-by: Yuan-Hsin Chen 
>>
>> ---
>>  drivers/usb/host/fusbh200-hcd.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/fusbh200-hcd.c 
>> b/drivers/usb/host/fusbh200-hcd.c index 79ce799..7f3293b 100644
>> --- a/drivers/usb/host/fusbh200-hcd.c
>> +++ b/drivers/usb/host/fusbh200-hcd.c
>> @@ -5864,7 +5864,7 @@ static int fusbh200_hcd_fusbh200_probe(struct 
>> platform_device *pdev)
>>  
>>  retval = fusbh200_setup(hcd);
>>  if (retval)
>> -return retval;
>> +goto fail_add_hcd;
>>  
>>  fusbh200_init(fusbh200);
>>  
>>
>>
>> * Confidentiality Notice 
>> This electronic message and any attachments may contain
>> confidential and legally privileged information or
>> information which is otherwise protected from disclosure.
>> If you are not the intended recipient,please do not disclose
>> the contents, either in whole or in part, to anyone,and
>> immediately delete the message and any attachments from
>> your computer system and destroy all hard copies.
>> Thank you for your cooperation.
>> ***
> This footer prevents me from being able to apply your patch, please
> remove it and resend it.
>
> thanks,
>
> greg k-h
>
>


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


[PATCH v2 2/2] USB: ehci-omap: select NOP_USB_XCEIV PHY driver

2013-05-31 Thread Roger Quadros
ehci-omap needs NOP_USB_XCEIV PHY driver to function
properly, so select it. As the USB PHY drivers no longer
depend on USB_PHY, it is safe to select the PHY drivers.

Signed-off-by: Roger Quadros 
Tested-by: Adrien Vergé 
---
 drivers/usb/host/Kconfig |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 7ded784..48e1b70 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -150,13 +150,11 @@ config USB_EHCI_MXC
 config USB_EHCI_HCD_OMAP
tristate "EHCI support for OMAP3 and later chips"
depends on ARCH_OMAP
+   select NOP_USB_XCEIV
default y
---help---
  Enables support for the on-chip EHCI controller on
  OMAP3 and later chips.
- If your system uses a PHY on the USB port, you will need to
- enable USB_PHY and the appropriate PHY driver as well. Most
- boards need the NOP_USB_XCEIV PHY driver.
 
 config USB_EHCI_HCD_ORION
tristate  "Support for Marvell EBU on-chip EHCI USB controller"
-- 
1.7.4.1

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


[PATCH v2 1/2] USB: PHY: Make PHY driver selection possible by controller drivers

2013-05-31 Thread Roger Quadros
Convert PHY Drivers from menuconfig to menu so that the PHY drivers
can be explicitely selected by the controller drivers.

USB_PHY is no longer a user visible option. It is upto to the PHY
drivers to select it if needed. This patch does so for the existing
PHY drivers that use the USB_PHY library.

Doing so moves the USB_PHY and PHY driver selection problem from the
end user to the PHY and controller driver developer.

e.g.

Earlier, a controller driver (e.g. EHCI_OMAP) that needs to select
a PHY driver (e.g. NOP_PHY) couldn't do so because the PHY driver
depended on USB_PHY. Making the controller driver depend on USB_PHY
has a negative effect i.e. it becomes invisible to the user till
USB_PHY is enabled. Most end users will not familiar with this.

With this patch, the end user just needs to select the controller driver
needed for his/her platform without worrying about which PHY driver to
select.

Also update USB_EHCI_MSM, USB_LPC32XX and USB_OMAP to not depend
on USB_PHY any more. They can safely select the necessary PHY drivers.

CC: Pavankumar Kondeti 
CC: Roland Stigge 
Signed-off-by: Roger Quadros 
[USB_LPC32XX part] Acked-by: Roland Stigge 
---
 drivers/usb/Makefile   |3 +--
 drivers/usb/gadget/Kconfig |2 --
 drivers/usb/host/Kconfig   |1 -
 drivers/usb/phy/Kconfig|   31 +--
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index c41feba..411c34c 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -43,8 +43,7 @@ obj-$(CONFIG_USB_MICROTEK)+= image/
 
 obj-$(CONFIG_USB_SERIAL)   += serial/
 
-obj-$(CONFIG_USB)  += misc/
-obj-$(CONFIG_USB_PHY)  += phy/
+obj-$(CONFIG_USB)  += misc/ phy/
 obj-$(CONFIG_EARLY_PRINTK_DBGP)+= early/
 
 obj-$(CONFIG_USB_ATM)  += atm/
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index f41aa0d..86d5d80 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -144,7 +144,6 @@ config USB_AT91
 config USB_LPC32XX
tristate "LPC32XX USB Peripheral Controller"
depends on ARCH_LPC32XX
-   depends on USB_PHY
select USB_ISP1301
help
   This option selects the USB device controller in the LPC32xx SoC.
@@ -195,7 +194,6 @@ config USB_FUSB300
 config USB_OMAP
tristate "OMAP USB Device Controller"
depends on ARCH_OMAP1
-   depends on USB_PHY
select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG
help
   Many Texas Instruments OMAP processors have flexible full
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 344d5e2..7ded784 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -188,7 +188,6 @@ config USB_EHCI_HCD_AT91
 config USB_EHCI_MSM
tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller"
depends on ARCH_MSM
-   depends on USB_PHY
select USB_EHCI_ROOT_HUB_TT
select USB_MSM_OTG
---help---
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 7ef3eb8..b57f7f0 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -1,16 +1,11 @@
 #
 # Physical Layer USB driver configuration
 #
-menuconfig USB_PHY
-   bool "USB Physical Layer drivers"
-   help
- USB controllers (those which are host, device or DRD) need a
- device to handle the physical layer signalling, commonly called
- a PHY.
-
- The following drivers add support for such PHY devices.
+menu "USB Physical Layer drivers"
 
-if USB_PHY
+config USB_PHY
+   bool
+   default n
 
 #
 # USB Transceiver Drivers
@@ -18,6 +13,7 @@ if USB_PHY
 config AB8500_USB
tristate "AB8500 USB Transceiver Driver"
depends on AB8500_CORE
+   select USB_PHY
help
  Enable this to support the USB OTG transceiver in AB8500 chip.
  This transceiver supports high and full speed devices plus,
@@ -27,12 +23,14 @@ config FSL_USB2_OTG
bool "Freescale USB OTG Transceiver Driver"
depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
select USB_OTG
+   select USB_PHY
help
  Enable this to support Freescale USB OTG transceiver.
 
 config ISP1301_OMAP
tristate "Philips ISP1301 with OMAP OTG"
depends on I2C && ARCH_OMAP_OTG
+   select USB_PHY
help
  If you say yes here you get support for the Philips ISP1301
  USB-On-The-Go transceiver working with the OMAP OTG controller.
@@ -46,12 +44,14 @@ config ISP1301_OMAP
 config MV_U3D_PHY
bool "Marvell USB 3.0 PHY controller Driver"
depends on CPU_MMP3
+   select USB_PHY
help
  Enable this to support Marvell USB 3.0 phy controller for Marvell
  SoC.
 
 config NOP_USB_XCEIV
tristate "NOP USB Transceiver Driver"
+   select USB_PHY
help
  This driv

[PATCH v2 0/2] USB: PHY: Improve PHY selection logic

2013-05-31 Thread Roger Quadros
Hi,

Improve Kconfig so that the relevant PHY driver can be explicitely
selected by the controller driver instead of relying on the user
to do so.

Detailed description in patch 1.

v2:
- Merge patches 3-5 into the first patch to prevent circular dependency
between the Kconfig options during bisection.

cheers,
-roger

Roger Quadros (2):
  USB: PHY: Make PHY driver selection possible by controller drivers
  USB: ehci-omap: select NOP_USB_XCEIV PHY driver

 drivers/usb/Makefile   |3 +--
 drivers/usb/gadget/Kconfig |2 --
 drivers/usb/host/Kconfig   |5 +
 drivers/usb/phy/Kconfig|   31 +--
 4 files changed, 23 insertions(+), 18 deletions(-)

-- 
1.7.4.1

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


Re: [PATCH -next] usb: fusbh200-hcd: fix error handling in fusbh200_hcd_fusbh200_probe()

2013-05-31 Thread gre...@linuxfoundation.org
On Fri, May 31, 2013 at 02:35:41AM +, Wendy Yuan-Hsin Chen(陳元馨) wrote:
> 
> -Original Message-
> From: Wei Yongjun [mailto:weiyj...@gmail.com] 
> Sent: Tuesday, May 21, 2013 10:41 AM
> To: gre...@linuxfoundation.org; Wendy Yuan-Hsin Chen(陳元馨)
> Cc: yongjun_...@trendmicro.com.cn; linux-usb@vger.kernel.org
> Subject: [PATCH -next] usb: fusbh200-hcd: fix error handling in 
> fusbh200_hcd_fusbh200_probe()

Why the forward of a previous patch?  I don't see this original one in
my mailboxes anywhere, what happened to it?

> 
> From: Wei Yongjun 
> 
> Fix to release all resources when fusbh200_setup() fail instead of only 
> return error.
> 
> Signed-off-by: Wei Yongjun 
> 
> Acked-by: Yuan-Hsin Chen 
> 
> ---
>  drivers/usb/host/fusbh200-hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/fusbh200-hcd.c 
> b/drivers/usb/host/fusbh200-hcd.c index 79ce799..7f3293b 100644
> --- a/drivers/usb/host/fusbh200-hcd.c
> +++ b/drivers/usb/host/fusbh200-hcd.c
> @@ -5864,7 +5864,7 @@ static int fusbh200_hcd_fusbh200_probe(struct 
> platform_device *pdev)
>  
>   retval = fusbh200_setup(hcd);
>   if (retval)
> - return retval;
> + goto fail_add_hcd;
>  
>   fusbh200_init(fusbh200);
>  
> 
> 
> * Confidentiality Notice 
> This electronic message and any attachments may contain
> confidential and legally privileged information or
> information which is otherwise protected from disclosure.
> If you are not the intended recipient,please do not disclose
> the contents, either in whole or in part, to anyone,and
> immediately delete the message and any attachments from
> your computer system and destroy all hard copies.
> Thank you for your cooperation.
> ***

This footer prevents me from being able to apply your patch, please
remove it and resend it.

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: [RFC Patch] USB: Add check for portnum in the usb_acpi_find_device()

2013-05-31 Thread Greg KH
On Fri, May 31, 2013 at 02:18:06PM +0800, Lan Tianyu wrote:
> This patch is to add a check of "portnum" which from the usb
> port dev's name.

Why do we need this now?

> The "portnum" will be used as array index
> for struct usb_hub->ports in the usb_set_hub_port_connect_type().

Is something failing today without this check?  We don't add code to the
kernel until we need it...

thanks,

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


[PATCH 06/11] usb: musb: dsps: Adopt pinctrl support

2013-05-31 Thread Hebbar Gururaja
Amend the musb controller to optionally take a pin control handle and
set the state of the pins to:

- "default" on boot, resume
- "sleep" on suspend()

By optionally putting the pins into sleep state in the suspend callback
we can accomplish two things.
- One is to minimize current leakage from pins and thus save power,
- second, we can prevent the IP from driving pins output in an
uncontrolled manner, which may happen if the power domain drops the
domain regulator.

If any of the above pin states are missing in dt, a warning message
about the missing state is displayed.
If certain pin-states are not available, to remove this warning message
pass respective state name with null phandler.

Todo:
- if an idle state is available for pins, add support for it.

Signed-off-by: Hebbar Gururaja 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: linux-usb@vger.kernel.org
---
:100644 100644 e1b661d... a9580fe... M  drivers/usb/musb/musb_dsps.c
 drivers/usb/musb/musb_dsps.c |   46 ++
 1 file changed, 46 insertions(+)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e1b661d..a9580fe 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -124,6 +125,11 @@ struct dsps_glue {
struct timer_list timer[2]; /* otg_workaround timer */
unsigned long last_timer[2];/* last timer data for each instance */
u32 __iomem *usb_ctrl[2];
+
+   /* two pin states - default, sleep */
+   struct pinctrl  *pinctrl;
+   struct pinctrl_state*pins_default;
+   struct pinctrl_state*pins_sleep;
 };
 
 #defineDSPS_AM33XX_CONTROL_MODULE_PHYS_0   0x44e10620
@@ -636,6 +642,36 @@ static int dsps_probe(struct platform_device *pdev)
ret = -ENOMEM;
goto err1;
}
+
+   glue->pinctrl = devm_pinctrl_get(&pdev->dev);
+   if (!IS_ERR(glue->pinctrl)) {
+   glue->pins_default = pinctrl_lookup_state(glue->pinctrl,
+PINCTRL_STATE_DEFAULT);
+   if (IS_ERR(glue->pins_default))
+   dev_dbg(&pdev->dev, "could not get default pinstate\n");
+   else
+   if (pinctrl_select_state(glue->pinctrl,
+glue->pins_default))
+   dev_err(&pdev->dev,
+   "could not set default pinstate\n");
+
+   glue->pins_sleep = pinctrl_lookup_state(glue->pinctrl,
+  PINCTRL_STATE_SLEEP);
+   if (IS_ERR(glue->pins_sleep))
+   dev_dbg(&pdev->dev, "could not get sleep pinstate\n");
+   } else {
+   /*
+   * Since we continue even when pinctrl node is not found,
+   * Invalidate pins as not available. This is to make sure that
+   * IS_ERR(pins_xxx) results in failure when used.
+   */
+   glue->pins_default = ERR_PTR(-ENODATA);
+   glue->pins_sleep = ERR_PTR(-ENODATA);
+
+   dev_dbg(&pdev->dev, "did not get pins for i2c error: %li\n",
+   PTR_ERR(glue->pinctrl));
+   }
+
platform_set_drvdata(pdev, glue);
 
/* enable the usbss clocks */
@@ -700,6 +736,11 @@ static int dsps_suspend(struct device *dev)
for (i = 0; i < wrp->instances; i++)
musb_dsps_phy_control(glue, i, 0);
 
+   /* Optionally let pins go into sleep states */
+   if (!IS_ERR(glue->pins_sleep))
+   if (pinctrl_select_state(glue->pinctrl, glue->pins_sleep))
+   dev_err(dev, "could not set pins to sleep state\n");
+
return 0;
 }
 
@@ -710,6 +751,11 @@ static int dsps_resume(struct device *dev)
const struct dsps_musb_wrapper *wrp = glue->wrp;
int i;
 
+   /* Optionaly enable pins to be muxed in and configured */
+   if (!IS_ERR(glue->pins_default))
+   if (pinctrl_select_state(glue->pinctrl, glue->pins_default))
+   dev_err(dev, "could not set default pins\n");
+
for (i = 0; i < wrp->instances; i++)
musb_dsps_phy_control(glue, i, 1);
 
-- 
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: Linux USB file storage gadget with new UDC

2013-05-31 Thread victor yeo
Hi,

On Thu, May 30, 2013 at 10:44 PM, Alan Stern  wrote:
> On Thu, 30 May 2013, victor yeo wrote:
>
>> I tested the g_zero with USB 2.0 Command Verifier. After the Command
>> Verifier is run, the UDC gadget driver queue function is continuously
>> being called, and the linux command prompt is frozen. Please see the
>> attached UDC driver log. It looks like endpoint 1 in direction is
>> called by USB 2.0 Command Verifier continuously. Is this weird?
>
> I don't know.
>
> You can't tell what's going on just by looking at the gadget.  You have
> to know what the host is doing as well.
>
> Alan Stern

When i run USB 2.0 Command Verifier on file gadget and UDC driver, an
error in Command Verifier says "Device must support being set to
Addressed/Configured state".  Does it mean the gadget cannot support
putting device in addressed state or configured state, as in
supporting the Set Address and Set Configuration requests?

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


Re: [PATCH] usb: dwc3: Addition of "dr_mode" dt property.

2013-05-31 Thread Michael Grzeschik
Hi,

On Thu, May 30, 2013 at 03:14:54PM -0500, Ruchika Kharwar wrote:
> This patch adds an optional parameter "dr_mode" to the dwc3 core device node.
> In the case the compile flag for the DWC3 controller is set to
> "USB_DWC3_DUAL_ROLE" a device tree could restrain to either functionality of
> host or gadget. In the case the device tree does not use this optional flag or
> specifies it superfluously to "drd" the functionality will be that
> of a dual role device.
> 
> Signed-off-by: Ruchika Kharwar 
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt |3 ++-
>  drivers/usb/dwc3/core.c|   21 +
>  2 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
> b/Documentation/devicetree/bindings/usb/dwc3.txt
> index 7a95c65..2f5d584 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -10,7 +10,8 @@ Required properties:
>  
>  Optional properties:
>   - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
> -
> + - dr_mode: determines the mode of core. Supported modes are "gadget", "host"
> +   and "drd".
>  This is usually a subnode to DWC3 glue to which it is connected.
>  
>  dwc3@4a03 {
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index c35d49d..e11660a 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -378,7 +378,7 @@ static int dwc3_probe(struct platform_device *pdev)
>   void*mem;
>  
>   u8  mode;
> -
> + char*dr_mode;
>   mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
>   if (!mem) {
>   dev_err(dev, "not enough memory\n");
> @@ -520,9 +520,22 @@ static int dwc3_probe(struct platform_device *pdev)
>   mode = DWC3_MODE_HOST;
>   else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
>   mode = DWC3_MODE_DEVICE;
> - else
> - mode = DWC3_MODE_DRD;
> -
> + else {
> + if (of_property_read_string(node, "dr_mode", &dr_mode))
> + mode = DWC3_MODE_DRD;
> + else {
> + if (strcmp(dr_mode, "host") == 0)
> + mode = DWC3_MODE_HOST;
> + else if (strcmp(dr_mode, "gadget") == 0)
> + mode = DWC3_MODE_DEVICE;
> + else if (strcmp(dr_mode, "drd") == 0)
> + mode = DWC3_MODE_DRD;
> + else {
> + dev_err(dev, "invalid dr_mode property 
> value\n");
> + goto err2;
> + }
> + }
> + }
>   switch (mode) {
>   case DWC3_MODE_DEVICE:
>   dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
> -- 

Why not help to make use of that code?

https://patchwork.kernel.org/patch/2193321/

We currently stuck in the discussion about all possible dr_mode
properties. There came up a device that is host and device capable,
but not otg.

What does the property drd stand for?

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