Skip to content

Commit 4849ee6

Browse files
lynxeye-devgregkh
authored andcommitted
usb: usb251xb: Reallow swap-dx-lanes to apply to the upstream port
This is a partial revert of 73d31de "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. CC: [email protected] #5.2 Signed-off-by: Lucas Stach <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 79f6faf commit 4849ee6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/usb/misc/usb251xb.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,16 @@ static int usb251xb_connect(struct usb251xb *hub)
375375

376376
#ifdef CONFIG_OF
377377
static void usb251xb_get_ports_field(struct usb251xb *hub,
378-
const char *prop_name, u8 port_cnt, u8 *fld)
378+
const char *prop_name, u8 port_cnt,
379+
bool ds_only, u8 *fld)
379380
{
380381
struct device *dev = hub->dev;
381382
struct property *prop;
382383
const __be32 *p;
383384
u32 port;
384385

385386
of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) {
386-
if ((port >= 1) && (port <= port_cnt))
387+
if ((port >= ds_only ? 1 : 0) && (port <= port_cnt))
387388
*fld |= BIT(port);
388389
else
389390
dev_warn(dev, "port %u doesn't exist\n", port);
@@ -501,15 +502,15 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
501502

502503
hub->non_rem_dev = USB251XB_DEF_NON_REMOVABLE_DEVICES;
503504
usb251xb_get_ports_field(hub, "non-removable-ports", data->port_cnt,
504-
&hub->non_rem_dev);
505+
true, &hub->non_rem_dev);
505506

506507
hub->port_disable_sp = USB251XB_DEF_PORT_DISABLE_SELF;
507508
usb251xb_get_ports_field(hub, "sp-disabled-ports", data->port_cnt,
508-
&hub->port_disable_sp);
509+
true, &hub->port_disable_sp);
509510

510511
hub->port_disable_bp = USB251XB_DEF_PORT_DISABLE_BUS;
511512
usb251xb_get_ports_field(hub, "bp-disabled-ports", data->port_cnt,
512-
&hub->port_disable_bp);
513+
true, &hub->port_disable_bp);
513514

514515
hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
515516
if (!of_property_read_u32(np, "sp-max-total-current-microamp",
@@ -573,7 +574,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
573574
*/
574575
hub->port_swap = USB251XB_DEF_PORT_SWAP;
575576
usb251xb_get_ports_field(hub, "swap-dx-lanes", data->port_cnt,
576-
&hub->port_swap);
577+
false, &hub->port_swap);
577578

578579
/* The following parameters are currently not exposed to devicetree, but
579580
* may be as soon as needed.

0 commit comments

Comments
 (0)