* [PATCH 0/2] usb: chipidea changes for v5.6-rc1
@ 2020-01-22 1:46 Peter Chen
2020-01-22 1:46 ` [PATCH 1/2] usb: chipidea: handle single role for usb role class Peter Chen
2020-01-22 1:47 ` [PATCH 2/2] usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined Peter Chen
0 siblings, 2 replies; 3+ messages in thread
From: Peter Chen @ 2020-01-22 1:46 UTC (permalink / raw)
To: gregkh@linuxfoundation.org; +Cc: linux-usb@vger.kernel.org, Peter Chen
Hi Greg,
The main changes are handle the use case for single role
user. Since the New Year holiday is coming at China, I
send it you a little earlier.
Jun Li (2):
usb: chipidea: handle single role for usb role class
usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not
defined
drivers/usb/chipidea/ci.h | 10 ++++++++++
drivers/usb/chipidea/core.c | 4 +++-
drivers/usb/chipidea/host.h | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/2] usb: chipidea: handle single role for usb role class
2020-01-22 1:46 [PATCH 0/2] usb: chipidea changes for v5.6-rc1 Peter Chen
@ 2020-01-22 1:46 ` Peter Chen
2020-01-22 1:47 ` [PATCH 2/2] usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined Peter Chen
1 sibling, 0 replies; 3+ messages in thread
From: Peter Chen @ 2020-01-22 1:46 UTC (permalink / raw)
To: gregkh@linuxfoundation.org; +Cc: linux-usb@vger.kernel.org, Jun Li, Peter Chen
From: Jun Li <jun.li@nxp.com>
If usb port is configed to be single role, but usb role class
is trying to set unavailable role, don't try to do role change.
Signed-off-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/chipidea/ci.h | 10 ++++++++++
drivers/usb/chipidea/core.c | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 6911aef500e9..d49d5e1235d0 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -302,6 +302,16 @@ static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci)
return USB_ROLE_NONE;
}
+static inline enum ci_role usb_role_to_ci_role(enum usb_role role)
+{
+ if (role == USB_ROLE_HOST)
+ return CI_ROLE_HOST;
+ else if (role == USB_ROLE_DEVICE)
+ return CI_ROLE_GADGET;
+ else
+ return CI_ROLE_END;
+}
+
/**
* hw_read_id_reg: reads from a identification register
* @ci: the controller
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index dce5db41501c..52139c2a9924 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -618,9 +618,11 @@ static int ci_usb_role_switch_set(struct device *dev, enum usb_role role)
struct ci_hdrc *ci = dev_get_drvdata(dev);
struct ci_hdrc_cable *cable = NULL;
enum usb_role current_role = ci_role_to_usb_role(ci);
+ enum ci_role ci_role = usb_role_to_ci_role(role);
unsigned long flags;
- if (current_role == role)
+ if ((ci_role != CI_ROLE_END && !ci->roles[ci_role]) ||
+ (current_role == role))
return 0;
pm_runtime_get_sync(ci->dev);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined
2020-01-22 1:46 [PATCH 0/2] usb: chipidea changes for v5.6-rc1 Peter Chen
2020-01-22 1:46 ` [PATCH 1/2] usb: chipidea: handle single role for usb role class Peter Chen
@ 2020-01-22 1:47 ` Peter Chen
1 sibling, 0 replies; 3+ messages in thread
From: Peter Chen @ 2020-01-22 1:47 UTC (permalink / raw)
To: gregkh@linuxfoundation.org; +Cc: linux-usb@vger.kernel.org, Jun Li, Peter Chen
From: Jun Li <jun.li@nxp.com>
Otherwise, there is a build warning if this header file is included
by non host source file, eg, otg.c.
Signed-off-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/chipidea/host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h
index 70112cf0f195..2625aa01a911 100644
--- a/drivers/usb/chipidea/host.h
+++ b/drivers/usb/chipidea/host.h
@@ -20,7 +20,7 @@ static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci)
}
-static void ci_hdrc_host_driver_init(void)
+static inline void ci_hdrc_host_driver_init(void)
{
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-22 1:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-22 1:46 [PATCH 0/2] usb: chipidea changes for v5.6-rc1 Peter Chen
2020-01-22 1:46 ` [PATCH 1/2] usb: chipidea: handle single role for usb role class Peter Chen
2020-01-22 1:47 ` [PATCH 2/2] usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined Peter Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox