diff mbox series

[1/2] usb: usb251xb: Set boost value for up- and downstream ports

Message ID PH0PR17MB48482AD591AFD471637B16E28E0C9@PH0PR17MB4848.namprd17.prod.outlook.com
State New
Headers show
Series [1/2] usb: usb251xb: Set boost value for up- and downstream ports | expand

Commit Message

Neumann, Bastian March 11, 2022, 12:09 p.m. UTC
This patch adds devicetree properties to enable signal boosting on USB ports.

Signed-off-by: Bastian Neumann <bastian.neumann@dentsplysirona.com>
---
 drivers/usb/misc/usb251xb.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

--
2.30.2


-----------------------------------------------------------------------------------------------------------
Sirona Dental Systems GmbH
Sitz der Gesellschaft / registered address: Fabrikstraße 31, 64625 Bensheim
Registergericht / court of registry: Amtsgericht Darmstadt, HRB 24948
Geschäftsführer / Managing Director: Dr. Cord Stähler, Jan Siefert, Rainer Raschke
Aufsichtsratsvorsitzender / Chairman of the Supervisory Board: Dr. Alexander Voelcker

-----------------------------------------------------------------------------------------------------------


Diese E-Mail ist ausschliesslich fuer den angesprochenen Adressaten
bestimmt und kann vertrauliche Informationen beinhalten.
--
This e-mail is intended only for the designated recipient(s). It may
contain confidential or proprietary information.
------------------------------------------------------------------------------------------------------------
diff mbox series

Patch

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 04c4e3fed094..625106343d12 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -575,6 +575,36 @@  static int usb251xb_get_ofdata(struct usb251xb *hub,
                              (wchar_t *)hub->serial,
                              USB251XB_STRING_BUFSIZE);

+       hub->boost_up = USB251XB_DEF_BOOST_UP;
+       if (!of_property_read_u32(np, "boost-up",
+           &property_u32))
+               hub->boost_up |= (property_u32 << 0);
+
+       hub->boost_14 = USB251XB_DEF_BOOST_14;
+       if (!of_property_read_u32(np, "boost-1",
+           &property_u32))
+               hub->boost_14 |= (property_u32 << 0);
+       if (!of_property_read_u32(np, "boost-2",
+           &property_u32))
+               hub->boost_14 |= (property_u32 << 2);
+       if (!of_property_read_u32(np, "boost-3",
+           &property_u32))
+               hub->boost_14 |= (property_u32 << 4);
+       if (!of_property_read_u32(np, "boost-4",
+           &property_u32))
+               hub->boost_14 |= (property_u32 << 6);
+       hub->boost_57 = USB251XB_DEF_BOOST_57;
+       if (!of_property_read_u32(np, "boost-5",
+           &property_u32))
+               hub->boost_57 |= (property_u32 << 0);
+       if (!of_property_read_u32(np, "boost-6",
+           &property_u32))
+               hub->boost_57 |= (property_u32 << 2);
+       if (!of_property_read_u32(np, "boost-7",
+           &property_u32))
+               hub->boost_57 |= (property_u32 << 4);
+
+
        /*
         * The datasheet documents the register as 'Port Swap' but in real the
         * register controls the USB DP/DM signal swapping for each port.
@@ -587,8 +617,6 @@  static int usb251xb_get_ofdata(struct usb251xb *hub,
         * 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;
        hub->port_map34 = USB251XB_DEF_PORT_MAP_34;
        hub->port_map56 = USB251XB_DEF_PORT_MAP_56;