Revert "usb: usb251xb: Add US lanes inversion dts-bindings"
Subsystems (3)
PATCH 1/3 Revert "usb: usb251xb: Add US lanes inversion dts-bindings"
This reverts commit 3342ce35a1, as there is no need for this separate property and it breaks compatibility with existing devicetree files (arch/arm64/boot/dts/freescale/imx8mq.dtsi).
--- Documentation/devicetree/bindings/usb/usb251xb.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/usb/usb251xb.txt +2 -4
@@ -64,10 +64,8 @@ Optional properties : - 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). - - swap-dx-lanes : Specifies the downstream ports which will swap the - differential-pair (D+/D-), default is not-swapped. - - swap-us-lanes : Selects the upstream port differential-pair (D+/D-) - swapping (boolean, default is not-swapped) + - swap-dx-lanes : Specifies the ports which will swap the differential-pair + (D+/D-), default is not-swapped. Examples: usb2512b@2c {
Signature · 1 line
2.20.1
PATCH 2/3 Revert "usb: usb251xb: Add US port lanes inversion property"
This property isn't needed and not yet used anywhere. The swap-dx-lanes property is perfectly fine for doing the swap on the upstream port lanes.
--- drivers/usb/misc/usb251xb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/misc/usb251xb.c +0 -2
@@ -574,8 +574,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, hub->port_swap =USB251XB_DEF_PORT_SWAP ;usb251xb_get_ports_field (hub,"swap-dx-lanes" , data->port_cnt, &hub->port_swap); -if (of_get_property (np,"swap-us-lanes" ,NULL )) - hub->port_swap |=BIT (0 );/* The following parameters are currently not exposed to devicetree, but * may be as soon as needed.
Signature · 1 line
2.20.1
PATCH 3/3 usb: usb251xb: Reallow swap-dx-lanes to apply to the upstream port
In reply to Lucas StachThis is a partial revert of 73d31def1aab "usb: usb251xb: Create a ports field collector method", which broke a existing devicetree (arch/arm64/boot/dts/freescale/imx8mq.dtsi).
There is no reason why the swap-dx-lanes property should not apply to the upstream port. The reason given in the breaking commit was that it's inconsitent with respect to other port properties, but in fact it is not. All other properties which only apply to the downstream ports explicitly reject port 0, so there is pretty strong precedence that the driver referred to the upstream port as port 0. So there is no inconsistency in this property at all, other than the swapping being also applicable to the upstream port.
--- drivers/usb/misc/usb251xb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/usb/misc/usb251xb.c +7 -6
@@ -375,7 +375,8 @@ static int usb251xb_connect(struct usb251xb *hub)#ifdef CONFIG_OF static void usb251xb_get_ports_field (struct usb251xb *hub, -const char *prop_name,u8 port_cnt,u8 *fld) +const char *prop_name,u8 port_cnt, +bool ds_only,u8 *fld) {struct device *dev = hub->dev;struct property *prop;
@@ -383,7 +384,7 @@ static void usb251xb_get_ports_field(struct usb251xb *hub,u32 port;of_property_for_each_u32 (dev->of_node, prop_name, prop, p, port) { -if ((port >=1 ) && (port <= port_cnt)) +if ((port >= ds_only ?1 :0 ) && (port <= port_cnt)) *fld |=BIT (port);else dev_warn (dev,"port %u doesn't exist\n" , port);
@@ -501,15 +502,15 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, hub->non_rem_dev =USB251XB_DEF_NON_REMOVABLE_DEVICES ;usb251xb_get_ports_field (hub,"non-removable-ports" , data->port_cnt, - &hub->non_rem_dev); + true, &hub->non_rem_dev); hub->port_disable_sp =USB251XB_DEF_PORT_DISABLE_SELF ;usb251xb_get_ports_field (hub,"sp-disabled-ports" , data->port_cnt, - &hub->port_disable_sp); + true, &hub->port_disable_sp); hub->port_disable_bp =USB251XB_DEF_PORT_DISABLE_BUS ;usb251xb_get_ports_field (hub,"bp-disabled-ports" , data->port_cnt, - &hub->port_disable_bp); + true, &hub->port_disable_bp); hub->max_power_sp =USB251XB_DEF_MAX_POWER_SELF ; if (!of_property_read_u32(np, "sp-max-total-current-microamp",
@@ -573,7 +574,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,*/ hub->port_swap =USB251XB_DEF_PORT_SWAP ;usb251xb_get_ports_field (hub,"swap-dx-lanes" , data->port_cnt, - &hub->port_swap); + false, &hub->port_swap);/* The following parameters are currently not exposed to devicetree, but * may be as soon as needed.
Signature · 1 line
2.20.1
Hello Lucas
Quoted 4 lines · Lucas Stach
This reverts commit
3342ce35a1, as there is no need for this separate property and it breaks compatibility with existing devicetree files (arch/arm64/boot/dts/freescale/imx8mq.dtsi).
Hmm, didn't know there had been anything staged to merge and touching this property before submitting the update. We must have done it nearly at the same time, or your patch hasn't been merged at the time I prepared mine.
Anyway why would you prefer to change the interface again instead of following the existing way? Firstly It is much easier to fix the dts-file than to revert the interface back and break dts-files of possible other users. Secondly the chip documentation doesn't have anything regarding port 0. It states to swap the Ports from 1 to 4 (usb2514) corresponding to the bits 1 - 4 of the 'PORT SWAP' register, while bit 0 is connected with explicitly named Upstream Port (without any numbering). Thirdly having a separate property for US port makes the driver bindings interface a bit better readable/logical, since in current implementation there is no implicit/unspoken/hidden rule that port 0 corresponds to the Upstream Port, Port 0 just doesn't exists (following the chip datasheet text), and the other port-related properties are only applicable for downstream ports. So the driver code rejects them being utilized for a port with 0 identifier. The only port-related setting being exposed by the interface is the swap-port-one and it has a separately bound property 'swap-us-lanes' for the Upstream port.
As for me, all of this makes more sense than having an implicit Port 0 - Upstream port binding (as you suggest). Although the final decision of which solution is better is after the subsystem maintainer after all.
Regards,
-Sergey
Quoted 26 lines
CC [email protected] #5.2Signed-off-by Lucas Stach <[email protected]>--- Documentation/devicetree/bindings/usb/usb251xb.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Documentation/devicetree/bindings/usb/usb251xb.txt +2
-4@@ -64,10 +64,8 @@ Optional properties : - 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). - - swap-dx-lanes : Specifies the downstream ports which will swap the - differential-pair (D+/D-), default is not-swapped. - - swap-us-lanes : Selects the upstream port differential-pair (D+/D-) - swapping (boolean, default is not-swapped) + - swap-dx-lanes : Specifies the ports which will swap the differential-pair + (D+/D-), default is not-swapped. Examples: usb2512b@2c {Signature · 1 line
2.20.1
Hi Serge,
Quoted 8 lines · Serge Semin
Hello Lucas
Quoted 4 lines · Lucas Stach
This reverts commit
3342ce35a1, as there is no need for this separate property and it breaks compatibility with existing devicetree files (arch/arm64/boot/dts/freescale/imx8mq.dtsi).
Quoted 7 lines
Hmm, didn't know there had been anything staged to merge and touching this property before submitting the update. We must have done it nearly at the same time, or your patch hasn't been merged at the time I prepared mine.
Anyway why would you prefer to change the interface again instead of following the existing way? Firstly It is much easier to fix the dts-file than to revert the interface back and break dts-files of possible other users.
Since the dtbs are firmware thats not possible everytime. You can't even say that nobody uses that binding because it's not grepable within the kernel repo. Most vendors do not publish their dts files but use the bindings and rely on stable bindings.
Quoted 1 line
Secondly the chip documentation doesn't have anything regarding port 0.
Thats not true. I've checked the usb2517 documentation and PRTSP register description. Bit-0 points to the upstream port and the dt-binding is such generic to cover that too. By swap-dx-lanes I mean swap d+/d- lanes else it would be something like swap-downstream-lanes. Since the upstream port have d+/d- lanes too it would be covered too.
Quoted 8 lines
It states to swap the Ports from 1 to 4 (usb2514) corresponding to the bits 1 - 4 of the 'PORT SWAP' register, while bit 0 is connected with explicitly named Upstream Port (without any numbering). Thirdly having a separate property for US port makes the driver bindings interface a bit better readable/logical, since in current implementation there is no implicit/unspoken/hidden rule that port 0 corresponds to the Upstream Port, Port 0 just doesn't exists (following the chip datasheet text), and the other port-related properties are only applicable for downstream ports. So the driver code rejects them being
So the correct fix should be extending the documentation rather than introducing a new binding?
Quoted 7 lines
utilized for a port with 0 identifier. The only port-related setting being exposed by the interface is the swap-port-one and it has a separately bound property 'swap-us-lanes' for the Upstream port.
As for me, all of this makes more sense than having an implicit Port 0 - Upstream port binding (as you suggest). Although the final decision of which solution is better is after the subsystem maintainer after all.
That's true but he had to cover the dt-backward compatibility.
Regards,
Marco
Quoted 31 lines
Regards,
-SergeyQuoted 26 lines
CC [email protected] #5.2Signed-off-by Lucas Stach <[email protected]>--- Documentation/devicetree/bindings/usb/usb251xb.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)Documentation/devicetree/bindings/usb/usb251xb.txt +2
-4@@ -64,10 +64,8 @@ Optional properties : - 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). - - swap-dx-lanes : Specifies the downstream ports which will swap the - differential-pair (D+/D-), default is not-swapped. - - swap-us-lanes : Selects the upstream port differential-pair (D+/D-) - swapping (boolean, default is not-swapped) + - swap-dx-lanes : Specifies the ports which will swap the differential-pair + (D+/D-), default is not-swapped. Examples: usb2512b@2c {Signature · 1 line
2.20.1
Signature · 4 lines
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-5555 |