Skip to contentSkip to conversation

usb: misc: usb3503: Fix up usb3503 driver

PATCH In review Julius Werner 3 participants 8 messages Jun 1, 2013 USB

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
1.7.12.4
#1 lore raw

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

Remove an erroneous tab that should be a space.

---
 drivers/usb/misc/usb3503.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usb3503.c +1 -1
index d3a1cce..73aeb87 100644
@@ -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);
Signature · 1 line
1.7.12.4
#2 lore raw

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

Quoted 23 lines · Julius Werner

Remove an erroneous tab that should be a space.

---
 drivers/usb/misc/usb3503.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usb3503.c +1 -2
index d3a1cce..73aeb87 100644
@@ -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

#3 lore raw

PATCH 2/3 usb: misc: usb3503: Remove hardcoded disabling of ports 2 and 3

In reply to 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.

---
 drivers/usb/misc/usb3503.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/usb/misc/usb3503.c +0 -8
index 73aeb87..a647a2e 100644
@@ -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) {
Signature · 1 line
1.7.12.4
#4 lore raw

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.

Quoted 34 lines · 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.

---
 drivers/usb/misc/usb3503.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/usb/misc/usb3503.c +0 -9
index 73aeb87..a647a2e 100644
@@ -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

#5 lore raw

PATCH 3/3 usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

In reply to 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.

---
 drivers/usb/misc/usb3503.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/misc/usb3503.c +2 -4
index a647a2e..a1d509f 100644
@@ -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;
 }
Signature · 1 line
1.7.12.4
#6 lore raw

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

Quoted 35 lines · 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.

---
 drivers/usb/misc/usb3503.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/misc/usb3503.c +2 -5
index a647a2e..a1d509f 100644
@@ -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

Acked-by on the v1 series
#7 lore raw
In reply to Julius Werner

2013/5/31 Julius Werner <[email protected]>:

Quoted 6 lines

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.

Quoted 8 lines

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:

-Olof