* [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
@ 2026-11-03 18:55 ` Jhon Wilker Rodrigues Aquino
2026-11-03 18:59 ` sashiko-bot
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2 siblings, 1 reply; 11+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 18:55 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Add an example that enables charging on ports 1 and 2.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
index 0329a6aaaa928..0eb3035553c37 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
+++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
@@ -230,6 +230,12 @@ properties:
Specifies the time it takes from the time the host initiates the
power-on sequence to a port until the port has adequate power.
+ battery-charging-enable:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |
+ Specifies the downstream ports which will have battery charging enabled.
+ Battery charging is disabled on all ports by default.
+
swap-dx-lanes:
$ref: /schemas/types.yaml#/definitions/uint32-array
description: |
@@ -264,6 +270,7 @@ examples:
manufacturer = "Foo";
product = "Foo-Bar";
serial = "1234567890A";
+ battery-charging-enable = <1 2>;
/* correct misplaced usb connectors on port 1,2 */
swap-dx-lanes = <1 2>;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 18:55 ` Jhon Wilker Rodrigues Aquino
2026-11-03 19:03 ` sashiko-bot
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2 siblings, 1 reply; 11+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 18:55 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Parse the battery-charging-enable port list from the device tree and set the corresponding bits in the hub configuration register.
Keep charging disabled by default when the property is omitted.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
drivers/usb/misc/usb251xb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index fb0693742f018..166eb541ef161 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -577,6 +577,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
(wchar_t *)hub->serial,
USB251XB_STRING_BUFSIZE);
+ hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
+ usb251xb_get_ports_field(hub, "battery-charging-enable", data->port_cnt,
+ true, &hub->bat_charge_en);
+
/*
* The datasheet documents the register as 'Port Swap' but in real the
* register controls the USB DP/DM signal swapping for each port.
@@ -588,7 +592,6 @@ 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->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
hub->boost_57 = USB251XB_DEF_BOOST_57;
hub->boost_14 = USB251XB_DEF_BOOST_14;
hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
@ 2026-11-03 19:03 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-11-03 19:03 UTC (permalink / raw)
To: Jhon Wilker Rodrigues Aquino; +Cc: linux-usb, devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] usb: misc: usb251xb: missing bat_support check in usb251xb_get_ofdata()
--
commit 7116fd963729fc92bbd453fc4d055b0129eabda3
Author: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
usb: misc: usb251xb: configure battery charging from DT
This commit parses the battery-charging-enable port list from the device tree
to configure the battery charging enable register on USB251xB hubs.
> diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
> index fb0693742f018..166eb541ef161 100644
> --- a/drivers/usb/misc/usb251xb.c
> +++ b/drivers/usb/misc/usb251xb.c
> @@ -577,6 +577,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
> (wchar_t *)hub->serial,
> USB251XB_STRING_BUFSIZE);
>
> + hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
> + usb251xb_get_ports_field(hub, "battery-charging-enable", data->port_cnt,
> + true, &hub->bat_charge_en);
[Severity: Medium]
Should parsing "battery-charging-enable" in usb251xb_get_ofdata() be gated on
data->bat_support?
Commit dd99d106de25 ("usb: misc: usb251xb: Add structure for holding chip
specific values") introduced bat_support in struct usb251xb_data, setting it
to false for usb2517_data and usb2517i_data because the USB2517/USB2517i
variants do not support battery charging:
static const struct usb251xb_data usb2517_data = {
.product_id = 0x2517,
.port_cnt = 7,
.led_support = true,
.bat_support = false,
.product_str = "USB2517",
};
Earlier in usb251xb_get_ofdata(), the variant-specific LED property checks
data->led_support before applying the configuration:
if (data->led_support && of_get_property(np, "led-usb-mode", NULL))
hub->conf_data3 &= ~BIT(1);
Without a similar check on data->bat_support here, bat_support remains unused
and probing a USB2517 or USB2517i node with "battery-charging-enable" present
in the device tree will populate hub->bat_charge_en and write non-zero values
to the reserved register 0xD0 (USB251XB_ADDR_BATTERY_CHARGING_ENABLE) during
usb251xb_connect().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103185514.72144-1-jhonwilker0112@gmail.com?part=2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2 siblings, 2 replies; 11+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Add a Device Tree property to configure battery charging on selected downstream
ports of Microchip USB251x hubs.
The first patch documents the battery-charging-enable property and adds an
example enabling charging on ports 1 and 2. The second parses the port list and
sets the corresponding hub configuration bits. Charging remains disabled on
all ports when the property is omitted.
Changes in v2:
- Only parse battery-charging-enable when the chip variant supports battery charging.
Jhon Wilker Rodrigues Aquino (2):
dt-bindings: usb: microchip,usb251xb: add battery-charging-enable
property
usb: misc: usb251xb: configure battery charging from DT
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
drivers/usb/misc/usb251xb.c | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:05 ` sashiko-bot
2026-11-03 20:52 ` Krzysztof Kozlowski
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
1 sibling, 2 replies; 11+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Add an example that enables charging on ports 1 and 2.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
index 0329a6aaaa928..0eb3035553c37 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
+++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
@@ -230,6 +230,12 @@ properties:
Specifies the time it takes from the time the host initiates the
power-on sequence to a port until the port has adequate power.
+ battery-charging-enable:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |
+ Specifies the downstream ports which will have battery charging enabled.
+ Battery charging is disabled on all ports by default.
+
swap-dx-lanes:
$ref: /schemas/types.yaml#/definitions/uint32-array
description: |
@@ -264,6 +270,7 @@ examples:
manufacturer = "Foo";
product = "Foo-Bar";
serial = "1234567890A";
+ battery-charging-enable = <1 2>;
/* correct misplaced usb connectors on port 1,2 */
swap-dx-lanes = <1 2>;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:05 ` sashiko-bot
2026-11-03 20:52 ` Krzysztof Kozlowski
1 sibling, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-11-03 20:05 UTC (permalink / raw)
To: Jhon Wilker Rodrigues Aquino; +Cc: linux-usb
> From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
>
> Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
>
> Add an example that enables charging on ports 1 and 2.
>
> Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103200154.125681-1-jhonwilker0112@gmail.com?part=1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 20:05 ` sashiko-bot
@ 2026-11-03 20:52 ` Krzysztof Kozlowski
1 sibling, 0 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 20:52 UTC (permalink / raw)
To: Jhon Wilker Rodrigues Aquino, Richard Leitner, Greg Kroah-Hartman,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
On 03/11/2026 21:01, Jhon Wilker Rodrigues Aquino wrote:
> From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Do not attach (thread) your patchsets to some other threads (unrelated
or older versions). This buries them deep in the mailbox and might
interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830
>
> Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597
Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.
>
> Add an example that enables charging on ports 1 and 2.
>
> Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
> ---
> Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
> index 0329a6aaaa928..0eb3035553c37 100644
> --- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
> +++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
> @@ -230,6 +230,12 @@ properties:
> Specifies the time it takes from the time the host initiates the
> power-on sequence to a port until the port has adequate power.
>
> + battery-charging-enable:
Custom properties needs prefix, see writing bindings.
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: |
Do not need '|' unless you need to preserve formatting.
> + Specifies the downstream ports which will have battery charging enabled.
> + Battery charging is disabled on all ports by default.
Why wouldn't you enable charging on all ports? You have entire
description (and/or commit msg) to explain why you are doing this and
why this is exactly hardware property.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:06 ` sashiko-bot
1 sibling, 1 reply; 11+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Parse the battery-charging-enable port list from the device tree and set the corresponding bits in the hub configuration register.
Keep charging disabled by default when the property is omitted.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
drivers/usb/misc/usb251xb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index fb0693742f018..7c0086a554cfe 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -577,6 +577,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
(wchar_t *)hub->serial,
USB251XB_STRING_BUFSIZE);
+ hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
+ if (data->bat_support)
+ usb251xb_get_ports_field(hub, "battery-charging-enable",
+ data->port_cnt, true, &hub->bat_charge_en);
+
/*
* The datasheet documents the register as 'Port Swap' but in real the
* register controls the USB DP/DM signal swapping for each port.
@@ -588,7 +593,6 @@ 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->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
hub->boost_57 = USB251XB_DEF_BOOST_57;
hub->boost_14 = USB251XB_DEF_BOOST_14;
hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread