From: Lubomir Rintel <lkundrak@v3.sk>
To: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Eric Miao <eric.y.miao@gmail.com>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Kishon Vijay Abraham I <kishon@ti.com>,
Alan Stern <stern@rowland.harvard.edu>,
Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH 11/14] USB: EHCI: ehci-mv: add DT support
Date: Wed, 22 Aug 2018 22:43:04 +0200 [thread overview]
Message-ID: <20180822204307.13251-12-lkundrak@v3.sk> (raw)
In-Reply-To: <20180822204307.13251-1-lkundrak@v3.sk>
Add Device tree support.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/usb/host/ehci-mv.c | 41 +++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 43b300c90875..f26109eafdbf 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -34,11 +34,11 @@ struct ehci_hcd_mv {
void __iomem *op_regs;
struct usb_phy *otg;
+ struct clk *clk;
- struct mv_usb_platform_data *pdata;
struct phy *phy;
- struct clk *clk;
+ int (*set_vbus)(unsigned int vbus);
};
static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
@@ -100,11 +100,6 @@ static int mv_ehci_probe(struct platform_device *pdev)
int retval = -ENODEV;
u32 offset;
- if (!pdata) {
- dev_err(&pdev->dev, "missing platform_data\n");
- return -ENODEV;
- }
-
if (usb_disabled())
return -ENODEV;
@@ -114,7 +109,12 @@ static int mv_ehci_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hcd);
ehci_mv = hcd_to_ehci_hcd_mv(hcd);
- ehci_mv->pdata = pdata;
+
+ ehci_mv->mode = MV_USB_MODE_HOST;
+ if (pdata) {
+ ehci_mv->mode = pdata->mode;
+ ehci_mv->set_vbus = pdata->set_vbus;
+ }
ehci_mv->phy = devm_phy_get(&pdev->dev, "usb");
if (IS_ERR(ehci_mv->phy)) {
@@ -166,7 +166,6 @@ static int mv_ehci_probe(struct platform_device *pdev)
ehci = hcd_to_ehci(hcd);
ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;
- ehci_mv->mode = pdata->mode;
if (ehci_mv->mode == MV_USB_MODE_OTG) {
ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
if (IS_ERR(ehci_mv->otg)) {
@@ -191,8 +190,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
/* otg will enable clock before use as host */
mv_ehci_disable(ehci_mv);
} else {
- if (pdata->set_vbus)
- pdata->set_vbus(1);
+ if (ehci_mv->set_vbus)
+ ehci_mv->set_vbus(1);
retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
if (retval) {
@@ -211,8 +210,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
return 0;
err_set_vbus:
- if (pdata->set_vbus)
- pdata->set_vbus(0);
+ if (ehci_mv->set_vbus)
+ ehci_mv->set_vbus(0);
err_disable_clk:
mv_ehci_disable(ehci_mv);
err_put_hcd:
@@ -233,8 +232,8 @@ static int mv_ehci_remove(struct platform_device *pdev)
otg_set_host(ehci_mv->otg->otg, NULL);
if (ehci_mv->mode == MV_USB_MODE_HOST) {
- if (ehci_mv->pdata->set_vbus)
- ehci_mv->pdata->set_vbus(0);
+ if (ehci_mv->set_vbus)
+ ehci_mv->set_vbus(0);
mv_ehci_disable(ehci_mv);
}
@@ -265,14 +264,20 @@ static void mv_ehci_shutdown(struct platform_device *pdev)
hcd->driver->shutdown(hcd);
}
+static const struct of_device_id ehci_mv_dt_ids[] = {
+ { .compatible = "marvell,pxau2o-ehci", },
+ {},
+};
+
static struct platform_driver ehci_mv_driver = {
.probe = mv_ehci_probe,
.remove = mv_ehci_remove,
.shutdown = mv_ehci_shutdown,
.driver = {
- .name = "mv-ehci",
- .bus = &platform_bus_type,
- },
+ .name = "mv-ehci",
+ .bus = &platform_bus_type,
+ .of_match_table = ehci_mv_dt_ids,
+ },
.id_table = ehci_id_table,
};
--
2.17.1
next prev parent reply other threads:[~2018-08-22 20:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-22 20:42 [PATCH 00/14] Convert ehci-mv to DT Lubomir Rintel
2018-08-22 20:42 ` [PATCH 01/14] phy: phy-pxa-usb: add a new driver Lubomir Rintel
2018-09-25 5:23 ` Kishon Vijay Abraham I
2018-10-07 18:47 ` Lubomir Rintel
2018-10-08 13:21 ` Greg Kroah-Hartman
2018-10-09 14:51 ` Lubomir Rintel
2018-10-09 14:57 ` Greg Kroah-Hartman
2018-08-22 20:42 ` [PATCH 02/14] dt-bindings: phy-pxa-usb: add bindings Lubomir Rintel
2018-11-05 9:19 ` Pavel Machek
2018-08-22 20:42 ` [PATCH 03/14] USB: EHCI: make ehci-mv a separate driver Lubomir Rintel
2018-08-22 20:42 ` [PATCH 04/14] ARM: mmp: add a pxa-usb-phy device Lubomir Rintel
2018-08-22 20:42 ` [PATCH 05/14] ARM: ttc_dkb: add an instance of pxa-usb-phy Lubomir Rintel
2018-11-05 9:19 ` Pavel Machek
2018-08-22 20:42 ` [PATCH 06/14] ARM: aspenite: " Lubomir Rintel
2018-11-05 9:19 ` Pavel Machek
2018-08-22 20:43 ` [PATCH 07/14] USB: EHCI: ehci-mv: remove private_init Lubomir Rintel
2018-08-22 20:43 ` [PATCH 08/14] USB: EHCI: ehci-mv: use phy-pxa-usb Lubomir Rintel
2018-08-22 20:43 ` [PATCH 09/14] USB: phy-mv-usb: " Lubomir Rintel
2018-11-05 9:19 ` Pavel Machek
2018-08-22 20:43 ` [PATCH 10/14] USB: gadget: mv-udc: " Lubomir Rintel
2018-11-05 9:20 ` Pavel Machek
2018-08-22 20:43 ` Lubomir Rintel [this message]
2018-08-22 20:43 ` [PATCH 12/14] dt-bindings: ehci-mv: add bindings Lubomir Rintel
2018-11-02 20:47 ` Pavel Machek
2018-08-22 20:43 ` [PATCH 13/14] DT: marvell,mmp2: add OTG PHY Lubomir Rintel
2018-11-05 9:20 ` Pavel Machek
2018-08-22 20:43 ` [PATCH 14/14] DT: marvell,mmp2: add USB OTG host controller Lubomir Rintel
2018-11-05 9:20 ` Pavel Machek
2018-08-28 15:04 ` [PATCH 00/14] Convert ehci-mv to DT Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180822204307.13251-12-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=eric.y.miao@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=haojian.zhuang@gmail.com \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).