summaryrefslogtreecommitdiff
path: root/arch/arm/mach-rockchip
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2023-04-12 12:52:52 +0100
committerKever Yang <kever.yang@rock-chips.com>2023-05-09 22:50:01 +0800
commit51c54080ff8fd93d22331a3ef5abe0cee77ce285 (patch)
tree069ba406eea7160c7849de3854a53cf8974fe17c /arch/arm/mach-rockchip
parentafb4f55565551133e3dc74ddffeb5486d79fab45 (diff)
downloadu-boot-51c54080ff8fd93d22331a3ef5abe0cee77ce285.tar.gz
u-boot-51c54080ff8fd93d22331a3ef5abe0cee77ce285.tar.bz2
u-boot-51c54080ff8fd93d22331a3ef5abe0cee77ce285.zip
rockchip: use standard dr_mode parsing function
Instead of duplicating the string values here, use usb_get_dr_mode() to handle the property lookup and converting the values to an enum. This is implemented with a switch in preparation for the next patch which adds extra handling for peripheral mode. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'arch/arm/mach-rockchip')
-rw-r--r--arch/arm/mach-rockchip/board.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index f1f70c81d0..6d33d65780 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -212,6 +212,7 @@ void enable_caches(void)
#include <usb.h>
#if defined(CONFIG_USB_GADGET_DWC2_OTG)
+#include <linux/usb/otg.h>
#include <usb/dwc2_udc.h>
static struct dwc2_plat_otg_data otg_data = {
@@ -223,18 +224,23 @@ static struct dwc2_plat_otg_data otg_data = {
int board_usb_init(int index, enum usb_init_type init)
{
ofnode node;
- const char *mode;
bool matched = false;
/* find the usb_otg node */
node = ofnode_by_compatible(ofnode_null(), "snps,dwc2");
while (ofnode_valid(node)) {
- mode = ofnode_read_string(node, "dr_mode");
- if (mode && strcmp(mode, "otg") == 0) {
+ switch (usb_get_dr_mode(node)) {
+ case USB_DR_MODE_OTG:
matched = true;
break;
+
+ default:
+ break;
}
+ if (matched)
+ break;
+
node = ofnode_by_compatible(node, "snps,dwc2");
}
if (!matched) {