Skip to contentSkip to conversation

usb: usb251xb: add boost-up property support

PATCH Superseded Tommaso Merciai 4 participants 6 messages Jan 21, 2022 – Jan 28, 2022

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: usb251xb: add boost-up property support

Add u8 property to support boost-up register of usb251xb hub. boost-up property control USB electrical drive strenght This register can be set:

- Normal mode -> 0x00

 - Low         -> 0x01
 - Medium      -> 0x10
 - High        -> 0x11

(Normal Default)

References:
- http://www.mouser.com/catalog/specsheets/2514.pdf p29

---
 drivers/usb/misc/usb251xb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/usb251xb.c +7 -1
index 507deef1f709..74fd8ac0c303 100644
@@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	struct device_node *np = dev->of_node;
 	int len, err;
 	u32 property_u32 = 0;
+	u8 property_u8 = 0;
 	const char *cproperty_char;
 	char str[USB251XB_STRING_BUFSIZE / 2];
 
@@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
 
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;
+	} else {
+		hub->boost_up = USB251XB_DEF_BOOST_UP;
+	}
+
 	cproperty_char = of_get_property(np, "manufacturer", NULL);
 	strlcpy(str, cproperty_char ? : USB251XB_DEF_MANUFACTURER_STRING,
 		sizeof(str));
@@ -584,7 +591,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_up = USB251XB_DEF_BOOST_UP;
 	hub->boost_57 = USB251XB_DEF_BOOST_57;
 	hub->boost_14 = USB251XB_DEF_BOOST_14;
 	hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
Signature · 1 line
2.25.1
#1 lore raw

Hi Tommaso,

thanks for implementing the boost up register.

Quoted 32 lines · Tommaso Merciai

Add u8 property to support boost-up register of usb251xb hub. boost-up property control USB electrical drive strenght This register can be set:

- Normal mode -> 0x00

 - Low         -> 0x01
 - Medium      -> 0x10
 - High        -> 0x11

(Normal Default)

References:
- http://www.mouser.com/catalog/specsheets/2514.pdf p29

---
 drivers/usb/misc/usb251xb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/usb251xb.c +1 -0
index 507deef1f709..74fd8ac0c303 100644
@@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	struct device_node *np = dev->of_node;
 	int len, err;
 	u32 property_u32 = 0;
+	u8 property_u8 = 0;
 	const char *cproperty_char;
 	char str[USB251XB_STRING_BUFSIZE / 2];
 

drivers/usb/misc/usb251xb.c static int usb251xb_get_ofdata(struct usb251xb *hub, · line 548

Quoted 5 lines
drivers/usb/misc/usb251xb.c +2 -0
@@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
 
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;

IMHO we don't need the property_u8 var here as you could pass &hub->boost_up directly to of_property_read_u8() ?

regards;rl

#2 lore raw
Quoted 40 lines · Richard Leitner - SKIDATA

Hi Tommaso,

thanks for implementing the boost up register.

Quoted 35 lines · Tommaso Merciai

Add u8 property to support boost-up register of usb251xb hub. boost-up property control USB electrical drive strenght This register can be set:

- Normal mode -> 0x00

 - Low         -> 0x01
 - Medium      -> 0x10
 - High        -> 0x11

(Normal Default)

References:
- http://www.mouser.com/catalog/specsheets/2514.pdf p29

---
 drivers/usb/misc/usb251xb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/usb251xb.c +1 -0
index 507deef1f709..74fd8ac0c303 100644
@@ -402,6 +402,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	struct device_node *np = dev->of_node;
 	int len, err;
 	u32 property_u32 = 0;
+	u8 property_u8 = 0;
 	const char *cproperty_char;
 	char str[USB251XB_STRING_BUFSIZE / 2];
 
@@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
 
Quoted 5 lines

drivers/usb/misc/usb251xb.c static int usb251xb_get_ofdata(struct usb251xb *hub, · line 548

Quoted 2 lines
drivers/usb/misc/usb251xb.c +2 -0
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;

IMHO we don't need the property_u8 var here as you could pass &hub->boost_up directly to of_property_read_u8() ?

Hi Richard,
Thanks for your reply. You mean like:

if (!of_property_read_u8(np, "boost-up", &hub->boost_up))

Let me know. I'll fix that in v2.

Thanks,
Tommaso

Quoted 2 lines

regards;rl

#3 lore raw
Quoted 9 lines · Tommaso Merciai
Quoted 7 lines · Richard Leitner - SKIDATA

drivers/usb/misc/usb251xb.c static int usb251xb_get_ofdata(struct usb251xb *hub, · line 548

Quoted 3 lines · Tommaso Merciai
drivers/usb/misc/usb251xb.c +2 -0
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;

IMHO we don't need the property_u8 var here as you could pass &hub->boost_up directly to of_property_read_u8() ?

Quoted 4 lines

Hi Richard,
Thanks for your reply. You mean like:

if (!of_property_read_u8(np, "boost-up", &hub->boost_up))

exactly.

Quoted 3 lines

Let me know. I'll fix that in v2.

great!

thanks & regards;rl

#4 lore raw
Quoted 10 lines · Richard Leitner
Quoted 9 lines · Tommaso Merciai
Quoted 7 lines · Richard Leitner - SKIDATA

drivers/usb/misc/usb251xb.c static int usb251xb_get_ofdata(struct usb251xb *hub, · line 548

Quoted 3 lines · Tommaso Merciai
drivers/usb/misc/usb251xb.c +2 -0
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;

IMHO we don't need the property_u8 var here as you could pass &hub->boost_up directly to of_property_read_u8() ?

Quoted 6 lines
Quoted 4 lines

Hi Richard,
Thanks for your reply. You mean like:

if (!of_property_read_u8(np, "boost-up", &hub->boost_up))

exactly.

Thanks Richard,
I'll send v2.

Thanks,
Tommaso

Quoted 8 lines
Quoted 4 lines

Let me know. I'll fix that in v2.

great!

thanks & regards;rl

#5 lore raw
In reply to Tommaso Merciai

Hello!

Quoted 2 lines · Tommaso Merciai

Add u8 property to support boost-up register of usb251xb hub. boost-up property control USB electrical drive strenght

Strength.

Quoted 22 lines

This register can be set:

- Normal mode -> 0x00

 - Low         -> 0x01
 - Medium      -> 0x10
 - High        -> 0x11

(Normal Default)

References:
- http://www.mouser.com/catalog/specsheets/2514.pdf p29

---
 drivers/usb/misc/usb251xb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/usb251xb.c +0 -0
index 507deef1f709..74fd8ac0c303 100644

drivers/usb/misc/usb251xb.c static int usb251xb_get_ofdata(struct usb251xb *hub, · line 551

Quoted 8 lines
drivers/usb/misc/usb251xb.c +5 -0
@@ -543,6 +544,12 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1))
 		hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
 
+	if (!of_property_read_u8(np, "boost-up", &property_u8)){
+		hub->boost_up = property_u8;
+	} else {
+		hub->boost_up = USB251XB_DEF_BOOST_UP;
+	}

No need for {} here at all.

[...]

MBR, Sergey