[RFC][PATCH v2 11/13] usb: add "dual-role" mode to dr_mode device tree helper

From: Roger Quadros
Date: Tue Apr 14 2015 - 06:43:40 EST


We need to differentiat between "otg" and "dual-role" operation.
dual-role means capability to operate as host or device depending
on the ID pin status but no support for any of the OTG features
like SRP, HNP and on the fly role-swap.

The only way to change the role for a dual-role device is to
toggle the ID pin by changing the cable.

Signed-off-by: Roger Quadros <rogerq@xxxxxx>
---
Documentation/devicetree/bindings/usb/generic.txt | 2 +-
drivers/usb/common/common.c | 1 +
include/linux/usb/otg.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt
index 477d5bb..64438f9 100644
--- a/Documentation/devicetree/bindings/usb/generic.txt
+++ b/Documentation/devicetree/bindings/usb/generic.txt
@@ -8,7 +8,7 @@ Optional properties:
HW capability.
- dr_mode: tells Dual-Role USB controllers that we want to work on a
particular mode. Valid arguments are "host",
- "peripheral" and "otg". In case this attribute isn't
+ "peripheral", "otg", "dual-role". In case this attribute isn't
passed via DT, USB DRD controllers should default to
OTG.

diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index b530fd4..faf51fe 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -87,6 +87,7 @@ static const char *const usb_dr_modes[] = {
[USB_DR_MODE_HOST] = "host",
[USB_DR_MODE_PERIPHERAL] = "peripheral",
[USB_DR_MODE_OTG] = "otg",
+ [USB_DR_MODE_DRD] = "dual-role",
};

/**
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 52661c5..d6057fb 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -102,6 +102,7 @@ enum usb_dr_mode {
USB_DR_MODE_HOST,
USB_DR_MODE_PERIPHERAL,
USB_DR_MODE_OTG,
+ USB_DR_MODE_DRD,
};

#endif /* __LINUX_USB_OTG_H */
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/