2013-06-01 01:35:59

by Julius Werner

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

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


2013-06-01 01:36:10

by Julius Werner

[permalink] [raw]
Subject: [PATCH 3/3] usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

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 <[email protected]>
---
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, 10000);

return 0;
}
--
1.7.12.4

2013-06-01 01:36:17

by Julius Werner

[permalink] [raw]
Subject: [PATCH 2/3] usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3

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 <[email protected]>
---
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

2013-06-01 01:36:25

by Julius Werner

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

Remove an erroneous tab that should be a space.

Signed-off-by: Julius Werner <[email protected]>
---
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

2013-06-01 02:55:38

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH 0/3] usb: misc: usb3503: Fix up usb3503 driver

2013/5/31 Julius Werner <[email protected]>:
> 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 <[email protected]>


-Olof

2013-06-01 03:02:15

by Dongjin Kim

[permalink] [raw]
Subject: Re: [PATCH 2/3] usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3

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 <[email protected]> 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 <[email protected]>
> ---
> 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
>

2013-06-01 03:10:41

by Dongjin Kim

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

Signed-off-by: Dongjin Kim <[email protected]>

On Sat, Jun 1, 2013 at 10:34 AM, Julius Werner <[email protected]> wrote:
> Remove an erroneous tab that should be a space.
>
> Signed-off-by: Julius Werner <[email protected]>
> ---
> 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
>

2013-06-01 03:12:11

by Dongjin Kim

[permalink] [raw]
Subject: Re: [PATCH 3/3] usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

Signed-off-by: Dongjin Kim <[email protected]>

On Sat, Jun 1, 2013 at 10:34 AM, Julius Werner <[email protected]> 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 <[email protected]>
> ---
> 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, 10000);
>
> return 0;
> }
> --
> 1.7.12.4
>