linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings
@ 2017-03-06  8:24 Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 1/4] usb: usb251xb: remove max_{power,current}_{sp,bp} properties Richard Leitner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Richard Leitner @ 2017-03-06  8:24 UTC (permalink / raw)
  To: linux-usb, devicetree, linux-kernel
  Cc: robh+dt, gregkh, mark.rutland, dev, Richard Leitner

This patchset improves/fixes the USB251xB/xBi devicetree bindings as
recommended by Rob Herring.

CHANGES v2:
	- Require exact values for oc-delay-us property
	- Remove erroneous be32_to_cpu call in power-on-time-ms prop parsing
	- Remove reference to inexistent file from MAINTAINERS

Richard Leitner (4):
  usb: usb251xb: remove max_{power,current}_{sp,bp} properties
  usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time
  doc: dt-bindings: usb251xb: mark reg as required
  MAINTAINERS: usb251xb: remove reference inexistent file

 Documentation/devicetree/bindings/usb/usb251xb.txt | 53 +++++++------------
 MAINTAINERS                                        |  1 -
 drivers/usb/misc/usb251xb.c                        | 59 +++++++++-------------
 3 files changed, 42 insertions(+), 71 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] usb: usb251xb: remove max_{power,current}_{sp,bp} properties
  2017-03-06  8:24 [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings Richard Leitner
@ 2017-03-06  8:24 ` Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time Richard Leitner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Richard Leitner @ 2017-03-06  8:24 UTC (permalink / raw)
  To: linux-usb, devicetree, linux-kernel
  Cc: robh+dt, gregkh, mark.rutland, dev, Richard Leitner

Remove the max_{power,current}_{sp,bp} properties of the usb251xb driver
from devicetree. This is done to simplify the dt bindings as requested
by Rob Herring in https://lkml.org/lkml/2017/2/15/1283. If those
properties are ever needed by somebody they can be enabled again easily.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/usb/usb251xb.txt | 20 ------------------
 drivers/usb/misc/usb251xb.c                        | 24 ++++------------------
 2 files changed, 4 insertions(+), 40 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt
index 0c065f7..a5efd10 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.txt
+++ b/Documentation/devicetree/bindings/usb/usb251xb.txt
@@ -40,26 +40,6 @@ Optional properties :
 	device connected.
  - sp-disabled-ports : Specifies the ports which will be self-power disabled
  - bp-disabled-ports : Specifies the ports which will be bus-power disabled
- - max-sp-power : Specifies the maximum current the hub consumes from an
-	upstream port when operating as self-powered hub including the power
-	consumption of a permanently attached peripheral if the hub is
-	configured as a compound device. The value is given in mA in a 0 - 500
-	range (default is 2).
- - max-bp-power : Specifies the maximum current the hub consumes from an
-	upstream port when operating as bus-powered hub including the power
-	consumption of a permanently attached peripheral if the hub is
-	configured as a compound device. The value is given in mA in a 0 - 500
-	range (default is 100).
- - max-sp-current : Specifies the maximum current the hub consumes from an
-	upstream port when operating as self-powered hub EXCLUDING the power
-	consumption of a permanently attached peripheral if the hub is
-	configured as a compound device. The value is given in mA in a 0 - 500
-	range (default is 2).
- - max-bp-current : Specifies the maximum current the hub consumes from an
-	upstream port when operating as bus-powered hub EXCLUDING the power
-	consumption of a permanently attached peripheral if the hub is
-	configured as a compound device. The value is given in mA in a 0 - 500
-	range (default is 100).
  - power-on-time : Specifies the time it takes from the time the host initiates
 	the power-on sequence to a port until the port has adequate power. The
 	value is given in ms in a 0 - 510 range (default is 100ms).
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 4e18600..3f9c306 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -432,26 +432,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 		}
 	}
 
-	hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
-	if (!of_property_read_u32(np, "max-sp-power", property_u32))
-		hub->max_power_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
-					  250);
-
-	hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
-	if (!of_property_read_u32(np, "max-bp-power", property_u32))
-		hub->max_power_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
-					  250);
-
-	hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
-	if (!of_property_read_u32(np, "max-sp-current", property_u32))
-		hub->max_current_sp = min_t(u8, be32_to_cpu(*property_u32) / 2,
-					    250);
-
-	hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
-	if (!of_property_read_u32(np, "max-bp-current", property_u32))
-		hub->max_current_bp = min_t(u8, be32_to_cpu(*property_u32) / 2,
-					    250);
-
 	hub->power_on_time = USB251XB_DEF_POWER_ON_TIME;
 	if (!of_property_read_u32(np, "power-on-time", property_u32))
 		hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2,
@@ -492,6 +472,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	/* The following parameters are currently not exposed to devicetree, but
 	 * may be as soon as needed.
 	 */
+	hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
+	hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS;
+	hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF;
+	hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS;
 	hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
 	hub->boost_up = USB251XB_DEF_BOOST_UP;
 	hub->boost_x = USB251XB_DEF_BOOST_X;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time
  2017-03-06  8:24 [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 1/4] usb: usb251xb: remove max_{power,current}_{sp,bp} properties Richard Leitner
@ 2017-03-06  8:24 ` Richard Leitner
  2017-03-15 20:12   ` Rob Herring
  2017-03-06  8:24 ` [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 4/4] MAINTAINERS: usb251xb: remove reference inexistent file Richard Leitner
  3 siblings, 1 reply; 7+ messages in thread
From: Richard Leitner @ 2017-03-06  8:24 UTC (permalink / raw)
  To: linux-usb, devicetree, linux-kernel
  Cc: robh+dt, gregkh, mark.rutland, dev, Richard Leitner

Rename oc-delay-* to oc-delay-us and make it expect a time value.
Furthermore add -ms suffix to power-on-time. There changes were
suggested by Rob Herring in https://lkml.org/lkml/2017/2/15/1283.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 Documentation/devicetree/bindings/usb/usb251xb.txt | 10 ++++---
 drivers/usb/misc/usb251xb.c                        | 35 ++++++++++++----------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt
index a5efd10..91499ae 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.txt
+++ b/Documentation/devicetree/bindings/usb/usb251xb.txt
@@ -31,7 +31,9 @@ Optional properties :
 	(default is individual)
  - dynamic-power-switching : enable auto-switching from self- to bus-powered
 	operation if the local power source is removed or unavailable
- - oc-delay-{100us,4ms,8ms,16ms} : set over current timer delay (default is 8ms)
+ - oc-delay-us : Delay time (in microseconds) for filtering the over-current
+	sense inputs. Valid values are 100, 4000, 8000 (default) and 16000. If
+	an invalid value is given, the default is used instead.
  - compound-device : indicated the hub is part of a compound device
  - port-mapping-mode : enable port mapping mode
  - string-support : enable string descriptor support (required for manufacturer,
@@ -40,9 +42,9 @@ Optional properties :
 	device connected.
  - sp-disabled-ports : Specifies the ports which will be self-power disabled
  - bp-disabled-ports : Specifies the ports which will be bus-power disabled
- - power-on-time : Specifies the time it takes from the time the host initiates
-	the power-on sequence to a port until the port has adequate power. The
-	value is given in ms in a 0 - 510 range (default is 100ms).
+ - power-on-time-ms : Specifies the time it takes from the time the host
+	initiates the power-on sequence to a port until the port has adequate
+	power. The value is given in ms in a 0 - 510 range (default is 100ms).
 
 Examples:
 	usb2512b@2c {
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 3f9c306..91f66d68 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -375,18 +375,24 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_get_property(np, "dynamic-power-switching", NULL))
 		hub->conf_data2 |= BIT(7);
 
-	if (of_get_property(np, "oc-delay-100us", NULL)) {
-		hub->conf_data2 &= ~BIT(5);
-		hub->conf_data2 &= ~BIT(4);
-	} else if (of_get_property(np, "oc-delay-4ms", NULL)) {
-		hub->conf_data2 &= ~BIT(5);
-		hub->conf_data2 |= BIT(4);
-	} else if (of_get_property(np, "oc-delay-8ms", NULL)) {
-		hub->conf_data2 |= BIT(5);
-		hub->conf_data2 &= ~BIT(4);
-	} else if (of_get_property(np, "oc-delay-16ms", NULL)) {
-		hub->conf_data2 |= BIT(5);
-		hub->conf_data2 |= BIT(4);
+	if (!of_property_read_u32(np, "oc-delay-us", property_u32)) {
+		if (*property_u32 == 100) {
+			/* 100 us*/
+			hub->conf_data2 &= ~BIT(5);
+			hub->conf_data2 &= ~BIT(4);
+		} else if (*property_u32 == 4000) {
+			/* 4 ms */
+			hub->conf_data2 &= ~BIT(5);
+			hub->conf_data2 |= BIT(4);
+		} else if (*property_u32 == 16000) {
+			/* 16 ms */
+			hub->conf_data2 |= BIT(5);
+			hub->conf_data2 |= BIT(4);
+		} else {
+			/* 8 ms (DEFAULT) */
+			hub->conf_data2 |= BIT(5);
+			hub->conf_data2 &= ~BIT(4);
+		}
 	}
 
 	if (of_get_property(np, "compound-device", NULL))
@@ -433,9 +439,8 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	}
 
 	hub->power_on_time = USB251XB_DEF_POWER_ON_TIME;
-	if (!of_property_read_u32(np, "power-on-time", property_u32))
-		hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2,
-					   255);
+	if (!of_property_read_u32(np, "power-on-time-ms", property_u32))
+		hub->power_on_time = min_t(u8, *property_u32 / 2, 255);
 
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required
  2017-03-06  8:24 [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 1/4] usb: usb251xb: remove max_{power,current}_{sp,bp} properties Richard Leitner
  2017-03-06  8:24 ` [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time Richard Leitner
@ 2017-03-06  8:24 ` Richard Leitner
  2017-03-15 20:15   ` Rob Herring
  2017-03-06  8:24 ` [PATCH v2 4/4] MAINTAINERS: usb251xb: remove reference inexistent file Richard Leitner
  3 siblings, 1 reply; 7+ messages in thread
From: Richard Leitner @ 2017-03-06  8:24 UTC (permalink / raw)
  To: linux-usb, devicetree, linux-kernel
  Cc: robh+dt, gregkh, mark.rutland, dev, Richard Leitner

Mark the reg property as required and furthermore fix some typos and
spellings in the documentation.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 Documentation/devicetree/bindings/usb/usb251xb.txt | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt
index 91499ae..3957d4e 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.txt
+++ b/Documentation/devicetree/bindings/usb/usb251xb.txt
@@ -7,18 +7,18 @@ Required properties :
  - compatible : Should be "microchip,usb251xb" or one of the specific types:
 	"microchip,usb2512b", "microchip,usb2512bi", "microchip,usb2513b",
 	"microchip,usb2513bi", "microchip,usb2514b", "microchip,usb2514bi"
- - hub-reset-gpios : Should specify the gpio for hub reset
+ - reset-gpios : Should specify the gpio for hub reset
+ - reg : I2C address on the selected bus (default is <0x2C>)
 
 Optional properties :
- - reg : I2C address on the selected bus (default is <0x2C>)
  - skip-config : Skip Hub configuration, but only send the USB-Attach command
- - vendor-id : USB Vendor ID of the hub (16 bit, default is 0x0424)
- - product-id : USB Product ID of the hub (16 bit, default depends on type)
- - device-id : USB Device ID of the hub (16 bit, default is 0x0bb3)
- - language-id : USB Language ID (16 bit, default is 0x0000)
- - manufacturer : USB Manufacturer string (max 31 characters long)
- - product : USB Product string (max 31 characters long)
- - serial : USB Serial string (max 31 characters long)
+ - vendor-id : Set USB Vendor ID of the hub (16 bit, default is 0x0424)
+ - product-id : Set USB Product ID of the hub (16 bit, default depends on type)
+ - device-id : Set USB Device ID of the hub (16 bit, default is 0x0bb3)
+ - language-id : Set USB Language ID (16 bit, default is 0x0000)
+ - manufacturer : Set USB Manufacturer string (max 31 characters long)
+ - product : Set USB Product string (max 31 characters long)
+ - serial : Set USB Serial string (max 31 characters long)
  - {bus,self}-powered : selects between self- and bus-powered operation (default
 	is self-powered)
  - disable-hi-speed : disable USB Hi-Speed support
@@ -34,7 +34,7 @@ Optional properties :
  - oc-delay-us : Delay time (in microseconds) for filtering the over-current
 	sense inputs. Valid values are 100, 4000, 8000 (default) and 16000. If
 	an invalid value is given, the default is used instead.
- - compound-device : indicated the hub is part of a compound device
+ - compound-device : indicate the hub is part of a compound device
  - port-mapping-mode : enable port mapping mode
  - string-support : enable string descriptor support (required for manufacturer,
 	product and serial string configuration)
@@ -49,7 +49,8 @@ Optional properties :
 Examples:
 	usb2512b@2c {
 		compatible = "microchip,usb2512b";
-		hub-reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+		reg = <0x2c>;
+		reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
 	};
 
 	usb2514b@2c {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] MAINTAINERS: usb251xb: remove reference inexistent file
  2017-03-06  8:24 [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings Richard Leitner
                   ` (2 preceding siblings ...)
  2017-03-06  8:24 ` [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required Richard Leitner
@ 2017-03-06  8:24 ` Richard Leitner
  3 siblings, 0 replies; 7+ messages in thread
From: Richard Leitner @ 2017-03-06  8:24 UTC (permalink / raw)
  To: linux-usb, devicetree, linux-kernel
  Cc: robh+dt, gregkh, mark.rutland, dev, Richard Leitner

The platform_data header file was dropped in the merged version of the
USB251xB driver. Therefore remove its reference from the MAINTAINERS file.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c265a5f..c776906 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8307,7 +8307,6 @@ M:	Richard Leitner <richard.leitner@skidata.com>
 L:	linux-usb@vger.kernel.org
 S:	Maintained
 F:	drivers/usb/misc/usb251xb.c
-F:	include/linux/platform_data/usb251xb.h
 F:	Documentation/devicetree/bindings/usb/usb251xb.txt
 
 MICROSOFT SURFACE PRO 3 BUTTON DRIVER
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time
  2017-03-06  8:24 ` [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time Richard Leitner
@ 2017-03-15 20:12   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2017-03-15 20:12 UTC (permalink / raw)
  To: Richard Leitner
  Cc: linux-usb, devicetree, linux-kernel, gregkh, mark.rutland, dev

On Mon, Mar 06, 2017 at 09:24:21AM +0100, Richard Leitner wrote:
> Rename oc-delay-* to oc-delay-us and make it expect a time value.
> Furthermore add -ms suffix to power-on-time. There changes were
> suggested by Rob Herring in https://lkml.org/lkml/2017/2/15/1283.
> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
>  Documentation/devicetree/bindings/usb/usb251xb.txt | 10 ++++---

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/usb/misc/usb251xb.c                        | 35 ++++++++++++----------
>  2 files changed, 26 insertions(+), 19 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required
  2017-03-06  8:24 ` [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required Richard Leitner
@ 2017-03-15 20:15   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2017-03-15 20:15 UTC (permalink / raw)
  To: Richard Leitner
  Cc: linux-usb, devicetree, linux-kernel, gregkh, mark.rutland, dev

On Mon, Mar 06, 2017 at 09:24:22AM +0100, Richard Leitner wrote:
> Mark the reg property as required and furthermore fix some typos and
> spellings in the documentation.
> 
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
>  Documentation/devicetree/bindings/usb/usb251xb.txt | 23 +++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-15 20:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06  8:24 [PATCH v2 0/4] usb: misc: fix/improve USB251xB/xBi dt bindings Richard Leitner
2017-03-06  8:24 ` [PATCH v2 1/4] usb: usb251xb: remove max_{power,current}_{sp,bp} properties Richard Leitner
2017-03-06  8:24 ` [PATCH v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time Richard Leitner
2017-03-15 20:12   ` Rob Herring
2017-03-06  8:24 ` [PATCH v2 3/4] doc: dt-bindings: usb251xb: mark reg as required Richard Leitner
2017-03-15 20:15   ` Rob Herring
2017-03-06  8:24 ` [PATCH v2 4/4] MAINTAINERS: usb251xb: remove reference inexistent file Richard Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).