Commit 4849ee61 authored by Lucas Stach's avatar Lucas Stach Committed by Greg Kroah-Hartman

usb: usb251xb: Reallow swap-dx-lanes to apply to the upstream port

This is a partial revert of 73d31def "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: stable@vger.kernel.org #5.2
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20190719084407.28041-3-l.stach@pengutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 79f6fafa
...@@ -375,7 +375,8 @@ static int usb251xb_connect(struct usb251xb *hub) ...@@ -375,7 +375,8 @@ static int usb251xb_connect(struct usb251xb *hub)
#ifdef CONFIG_OF #ifdef CONFIG_OF
static void usb251xb_get_ports_field(struct usb251xb *hub, 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 device *dev = hub->dev;
struct property *prop; struct property *prop;
...@@ -383,7 +384,7 @@ static void usb251xb_get_ports_field(struct usb251xb *hub, ...@@ -383,7 +384,7 @@ static void usb251xb_get_ports_field(struct usb251xb *hub,
u32 port; u32 port;
of_property_for_each_u32(dev->of_node, prop_name, prop, p, 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); *fld |= BIT(port);
else else
dev_warn(dev, "port %u doesn't exist\n", port); dev_warn(dev, "port %u doesn't exist\n", port);
...@@ -501,15 +502,15 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, ...@@ -501,15 +502,15 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
hub->non_rem_dev = USB251XB_DEF_NON_REMOVABLE_DEVICES; hub->non_rem_dev = USB251XB_DEF_NON_REMOVABLE_DEVICES;
usb251xb_get_ports_field(hub, "non-removable-ports", data->port_cnt, 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; hub->port_disable_sp = USB251XB_DEF_PORT_DISABLE_SELF;
usb251xb_get_ports_field(hub, "sp-disabled-ports", data->port_cnt, 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; hub->port_disable_bp = USB251XB_DEF_PORT_DISABLE_BUS;
usb251xb_get_ports_field(hub, "bp-disabled-ports", data->port_cnt, 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; hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
if (!of_property_read_u32(np, "sp-max-total-current-microamp", if (!of_property_read_u32(np, "sp-max-total-current-microamp",
...@@ -573,7 +574,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, ...@@ -573,7 +574,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
*/ */
hub->port_swap = USB251XB_DEF_PORT_SWAP; hub->port_swap = USB251XB_DEF_PORT_SWAP;
usb251xb_get_ports_field(hub, "swap-dx-lanes", data->port_cnt, 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 /* The following parameters are currently not exposed to devicetree, but
* may be as soon as needed. * may be as soon as needed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment