* [PATCH 0/3] usb: gadget: udc: renesas_usb3: add suspend/resume and generic phy
@ 2017-09-29 11:44 Yoshihiro Shimoda
2017-09-29 11:44 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able() Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-09-29 11:44 UTC (permalink / raw)
To: balbi, robh+dt, mark.rutland
Cc: gregkh, linux-usb, linux-renesas-soc, devicetree, Yoshihiro Shimoda
This patch set is based on the latest Felipe's usb.git / testing/next branch
(commit id = af846d7ab55c846af6d6f150e9af96295101e068)
Kazuya Mizuguchi (1):
usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able()
Yoshihiro Shimoda (2):
usb: gadget: udc: renesas_usb3: Add suspend/resume functions
usb: gadget: udc: renesas_usb3: add support for generic phy
.../devicetree/bindings/usb/renesas_usb3.txt | 4 ++
drivers/usb/gadget/udc/renesas_usb3.c | 64 ++++++++++++++++++++--
2 files changed, 64 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able()
2017-09-29 11:44 [PATCH 0/3] usb: gadget: udc: renesas_usb3: add suspend/resume and generic phy Yoshihiro Shimoda
@ 2017-09-29 11:44 ` Yoshihiro Shimoda
2017-09-29 11:45 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: Add suspend/resume functions Yoshihiro Shimoda
[not found] ` <1506685501-24988-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-09-29 11:44 UTC (permalink / raw)
To: balbi, robh+dt, mark.rutland
Cc: gregkh, linux-usb, linux-renesas-soc, devicetree,
Kazuya Mizuguchi, Yoshihiro Shimoda
From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
This patch moves pm_runtime_{en,dis}able() call timing to
renesas_usb3_{probe,remove}() for supporting PM_SLEEP feature in
the future.
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
[shimoda: Revise the commit log]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/usb/gadget/udc/renesas_usb3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index df37c1e..7d99774 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2228,7 +2228,6 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
/* hook up the driver */
usb3->driver = driver;
- pm_runtime_enable(usb3_to_dev(usb3));
pm_runtime_get_sync(usb3_to_dev(usb3));
renesas_usb3_init_controller(usb3);
@@ -2246,7 +2245,6 @@ static int renesas_usb3_stop(struct usb_gadget *gadget)
renesas_usb3_stop_controller(usb3);
pm_runtime_put(usb3_to_dev(usb3));
- pm_runtime_disable(usb3_to_dev(usb3));
return 0;
}
@@ -2394,6 +2392,7 @@ static int renesas_usb3_remove(struct platform_device *pdev)
renesas_usb3_dma_free_prd(usb3, &pdev->dev);
__renesas_usb3_ep_free_request(usb3->ep0_req);
+ pm_runtime_disable(usb3_to_dev(usb3));
return 0;
}
@@ -2629,6 +2628,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
renesas_usb3_debugfs_init(usb3, &pdev->dev);
dev_info(&pdev->dev, "probed\n");
+ pm_runtime_enable(usb3_to_dev(usb3));
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] usb: gadget: udc: renesas_usb3: Add suspend/resume functions
2017-09-29 11:44 [PATCH 0/3] usb: gadget: udc: renesas_usb3: add suspend/resume and generic phy Yoshihiro Shimoda
2017-09-29 11:44 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able() Yoshihiro Shimoda
@ 2017-09-29 11:45 ` Yoshihiro Shimoda
[not found] ` <1506685501-24988-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-09-29 11:45 UTC (permalink / raw)
To: balbi, robh+dt, mark.rutland
Cc: gregkh, linux-usb, linux-renesas-soc, devicetree, Yoshihiro Shimoda
This patch adds support suspend/resume functions
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
[shimoda: add the commit log]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/usb/gadget/udc/renesas_usb3.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 7d99774..d55a06b 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2644,11 +2644,45 @@ static int renesas_usb3_probe(struct platform_device *pdev)
return ret;
}
+#ifdef CONFIG_PM_SLEEP
+static int renesas_usb3_suspend(struct device *dev)
+{
+ struct renesas_usb3 *usb3 = dev_get_drvdata(dev);
+
+ /* Not started */
+ if (!usb3->driver)
+ return 0;
+
+ renesas_usb3_stop_controller(usb3);
+ pm_runtime_put(dev);
+
+ return 0;
+}
+
+static int renesas_usb3_resume(struct device *dev)
+{
+ struct renesas_usb3 *usb3 = dev_get_drvdata(dev);
+
+ /* Not started */
+ if (!usb3->driver)
+ return 0;
+
+ pm_runtime_get_sync(dev);
+ renesas_usb3_init_controller(usb3);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend,
+ renesas_usb3_resume);
+
static struct platform_driver renesas_usb3_driver = {
.probe = renesas_usb3_probe,
.remove = renesas_usb3_remove,
.driver = {
.name = (char *)udc_name,
+ .pm = &renesas_usb3_pm_ops,
.of_match_table = of_match_ptr(usb3_of_match),
},
};
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] usb: gadget: udc: renesas_usb3: add support for generic phy
2017-09-29 11:44 [PATCH 0/3] usb: gadget: udc: renesas_usb3: add suspend/resume and generic phy Yoshihiro Shimoda
@ 2017-09-29 11:45 ` Yoshihiro Shimoda
2017-09-29 11:45 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: Add suspend/resume functions Yoshihiro Shimoda
[not found] ` <1506685501-24988-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-09-29 11:45 UTC (permalink / raw)
To: balbi-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Yoshihiro Shimoda
This patch adds support for generic phy as an optional. If you want
to use a generic phy (e.g. phy-rcar-gen3-usb3 driver) on this driver,
you have to do "insmod phy-rcar-gen3-usb3.ko" first for now.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
.../devicetree/bindings/usb/renesas_usb3.txt | 4 ++++
drivers/usb/gadget/udc/renesas_usb3.c | 26 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/renesas_usb3.txt b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
index e280258..87a45e2 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usb3.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
@@ -15,6 +15,10 @@ Required properties:
- interrupts: Interrupt specifier for the USB3.0 Peripheral
- clocks: clock phandle and specifier pair
+Optional properties:
+ - phys: phandle + phy specifier pair
+ - phy-names: must be "usb"
+
Example of R-Car H3 ES1.x:
usb3_peri0: usb@ee020000 {
compatible = "renesas,r8a7795-usb3-peri",
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index d55a06b..3ea4e91 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -1,7 +1,7 @@
/*
* Renesas USB3.0 Peripheral driver (USB gadget)
*
- * Copyright (C) 2015 Renesas Electronics Corporation
+ * Copyright (C) 2015-2017 Renesas Electronics Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
+#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/sizes.h>
@@ -334,6 +335,7 @@ struct renesas_usb3 {
struct usb_gadget_driver *driver;
struct extcon_dev *extcon;
struct work_struct extcon_work;
+ struct phy *phy;
struct renesas_usb3_ep *usb3_ep;
int num_usb3_eps;
@@ -2228,6 +2230,9 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
/* hook up the driver */
usb3->driver = driver;
+ if (usb3->phy)
+ phy_init(usb3->phy);
+
pm_runtime_get_sync(usb3_to_dev(usb3));
renesas_usb3_init_controller(usb3);
@@ -2244,6 +2249,9 @@ static int renesas_usb3_stop(struct usb_gadget *gadget)
usb3->driver = NULL;
renesas_usb3_stop_controller(usb3);
+ if (usb3->phy)
+ phy_exit(usb3->phy);
+
pm_runtime_put(usb3_to_dev(usb3));
return 0;
@@ -2392,6 +2400,8 @@ static int renesas_usb3_remove(struct platform_device *pdev)
renesas_usb3_dma_free_prd(usb3, &pdev->dev);
__renesas_usb3_ep_free_request(usb3->ep0_req);
+ if (usb3->phy)
+ phy_put(usb3->phy);
pm_runtime_disable(usb3_to_dev(usb3));
return 0;
@@ -2623,11 +2633,19 @@ static int renesas_usb3_probe(struct platform_device *pdev)
if (ret < 0)
goto err_dev_create;
+ /*
+ * This is an optional. So, if this driver cannot get a phy,
+ * this driver will not handle a phy anymore.
+ */
+ usb3->phy = devm_phy_get(&pdev->dev, "usb");
+ if (IS_ERR(usb3->phy))
+ usb3->phy = NULL;
+
usb3->workaround_for_vbus = priv->workaround_for_vbus;
renesas_usb3_debugfs_init(usb3, &pdev->dev);
- dev_info(&pdev->dev, "probed\n");
+ dev_info(&pdev->dev, "probed%s\n", usb3->phy ? " with phy" : "");
pm_runtime_enable(usb3_to_dev(usb3));
return 0;
@@ -2654,6 +2672,8 @@ static int renesas_usb3_suspend(struct device *dev)
return 0;
renesas_usb3_stop_controller(usb3);
+ if (usb3->phy)
+ phy_exit(usb3->phy);
pm_runtime_put(dev);
return 0;
@@ -2667,6 +2687,8 @@ static int renesas_usb3_resume(struct device *dev)
if (!usb3->driver)
return 0;
+ if (usb3->phy)
+ phy_init(usb3->phy);
pm_runtime_get_sync(dev);
renesas_usb3_init_controller(usb3);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] usb: gadget: udc: renesas_usb3: add support for generic phy
@ 2017-09-29 11:45 ` Yoshihiro Shimoda
0 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-09-29 11:45 UTC (permalink / raw)
To: balbi, robh+dt, mark.rutland
Cc: gregkh, linux-usb, linux-renesas-soc, devicetree, Yoshihiro Shimoda
This patch adds support for generic phy as an optional. If you want
to use a generic phy (e.g. phy-rcar-gen3-usb3 driver) on this driver,
you have to do "insmod phy-rcar-gen3-usb3.ko" first for now.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
.../devicetree/bindings/usb/renesas_usb3.txt | 4 ++++
drivers/usb/gadget/udc/renesas_usb3.c | 26 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/renesas_usb3.txt b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
index e280258..87a45e2 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usb3.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
@@ -15,6 +15,10 @@ Required properties:
- interrupts: Interrupt specifier for the USB3.0 Peripheral
- clocks: clock phandle and specifier pair
+Optional properties:
+ - phys: phandle + phy specifier pair
+ - phy-names: must be "usb"
+
Example of R-Car H3 ES1.x:
usb3_peri0: usb@ee020000 {
compatible = "renesas,r8a7795-usb3-peri",
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index d55a06b..3ea4e91 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -1,7 +1,7 @@
/*
* Renesas USB3.0 Peripheral driver (USB gadget)
*
- * Copyright (C) 2015 Renesas Electronics Corporation
+ * Copyright (C) 2015-2017 Renesas Electronics Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
+#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/sizes.h>
@@ -334,6 +335,7 @@ struct renesas_usb3 {
struct usb_gadget_driver *driver;
struct extcon_dev *extcon;
struct work_struct extcon_work;
+ struct phy *phy;
struct renesas_usb3_ep *usb3_ep;
int num_usb3_eps;
@@ -2228,6 +2230,9 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
/* hook up the driver */
usb3->driver = driver;
+ if (usb3->phy)
+ phy_init(usb3->phy);
+
pm_runtime_get_sync(usb3_to_dev(usb3));
renesas_usb3_init_controller(usb3);
@@ -2244,6 +2249,9 @@ static int renesas_usb3_stop(struct usb_gadget *gadget)
usb3->driver = NULL;
renesas_usb3_stop_controller(usb3);
+ if (usb3->phy)
+ phy_exit(usb3->phy);
+
pm_runtime_put(usb3_to_dev(usb3));
return 0;
@@ -2392,6 +2400,8 @@ static int renesas_usb3_remove(struct platform_device *pdev)
renesas_usb3_dma_free_prd(usb3, &pdev->dev);
__renesas_usb3_ep_free_request(usb3->ep0_req);
+ if (usb3->phy)
+ phy_put(usb3->phy);
pm_runtime_disable(usb3_to_dev(usb3));
return 0;
@@ -2623,11 +2633,19 @@ static int renesas_usb3_probe(struct platform_device *pdev)
if (ret < 0)
goto err_dev_create;
+ /*
+ * This is an optional. So, if this driver cannot get a phy,
+ * this driver will not handle a phy anymore.
+ */
+ usb3->phy = devm_phy_get(&pdev->dev, "usb");
+ if (IS_ERR(usb3->phy))
+ usb3->phy = NULL;
+
usb3->workaround_for_vbus = priv->workaround_for_vbus;
renesas_usb3_debugfs_init(usb3, &pdev->dev);
- dev_info(&pdev->dev, "probed\n");
+ dev_info(&pdev->dev, "probed%s\n", usb3->phy ? " with phy" : "");
pm_runtime_enable(usb3_to_dev(usb3));
return 0;
@@ -2654,6 +2672,8 @@ static int renesas_usb3_suspend(struct device *dev)
return 0;
renesas_usb3_stop_controller(usb3);
+ if (usb3->phy)
+ phy_exit(usb3->phy);
pm_runtime_put(dev);
return 0;
@@ -2667,6 +2687,8 @@ static int renesas_usb3_resume(struct device *dev)
if (!usb3->driver)
return 0;
+ if (usb3->phy)
+ phy_init(usb3->phy);
pm_runtime_get_sync(dev);
renesas_usb3_init_controller(usb3);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] usb: gadget: udc: renesas_usb3: add support for generic phy
2017-09-29 11:45 ` Yoshihiro Shimoda
(?)
@ 2017-10-06 17:31 ` Rob Herring
-1 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2017-10-06 17:31 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: balbi, mark.rutland, gregkh, linux-usb, linux-renesas-soc, devicetree
On Fri, Sep 29, 2017 at 08:45:01PM +0900, Yoshihiro Shimoda wrote:
> This patch adds support for generic phy as an optional. If you want
> to use a generic phy (e.g. phy-rcar-gen3-usb3 driver) on this driver,
> you have to do "insmod phy-rcar-gen3-usb3.ko" first for now.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> .../devicetree/bindings/usb/renesas_usb3.txt | 4 ++++
Acked-by: Rob Herring <robh@kernel.org>
> drivers/usb/gadget/udc/renesas_usb3.c | 26 ++++++++++++++++++++--
> 2 files changed, 28 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-06 17:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 11:44 [PATCH 0/3] usb: gadget: udc: renesas_usb3: add suspend/resume and generic phy Yoshihiro Shimoda
2017-09-29 11:44 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able() Yoshihiro Shimoda
2017-09-29 11:45 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: Add suspend/resume functions Yoshihiro Shimoda
[not found] ` <1506685501-24988-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-09-29 11:45 ` [PATCH 3/3] usb: gadget: udc: renesas_usb3: add support for generic phy Yoshihiro Shimoda
2017-09-29 11:45 ` Yoshihiro Shimoda
2017-10-06 17:31 ` Rob Herring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.