From: Peter Geis <pgwipeout@gmail.com>
To: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-rockchip@lists.infradead.org, heiko@sntech.de,
michael.riesch@wolfvision.net, Peter Geis <pgwipeout@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 07/11] usb: dwc3: convert dwc3-of-simple to use match-data
Date: Sat, 26 Feb 2022 13:41:43 -0500 [thread overview]
Message-ID: <20220226184147.769964-8-pgwipeout@gmail.com> (raw)
In-Reply-To: <20220226184147.769964-1-pgwipeout@gmail.com>
The upcoming support for rk3568 will reuse data from rk3399.
Instead of adding a bunch of of_device_is_compatible as we add support
for new devices, lets get ahead of the problem and use of_match_data
instead.
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
drivers/usb/dwc3/dwc3-of-simple.c | 39 ++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index 9dc6295df6b1..57ba9427ad74 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -30,12 +30,16 @@ struct dwc3_of_simple {
bool need_reset;
};
+struct dwc3_of_simple_data {
+ bool need_reset;
+};
+
static int dwc3_of_simple_probe(struct platform_device *pdev)
{
struct dwc3_of_simple *simple;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
-
+ const struct dwc3_of_simple_data *data = of_device_get_match_data(dev);
int ret;
simple = devm_kzalloc(dev, sizeof(*simple), GFP_KERNEL);
@@ -49,8 +53,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
* Some controllers need to toggle the usb3-otg reset before trying to
* initialize the PHY, otherwise the PHY times out.
*/
- if (of_device_is_compatible(np, "rockchip,rk3399-dwc3"))
- simple->need_reset = true;
+ if (data->need_reset)
+ simple->need_reset = data->need_reset;
simple->resets = of_reset_control_array_get(np, false, true,
true);
@@ -170,13 +174,30 @@ static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = {
dwc3_of_simple_runtime_resume, NULL)
};
+static const struct dwc3_of_simple_data dwc3_of_simple_data_rk3399 = {
+ .need_reset = true,
+};
+
static const struct of_device_id of_dwc3_simple_match[] = {
- { .compatible = "allwinner,sun50i-h6-dwc3" },
- { .compatible = "cavium,octeon-7130-usb-uctl" },
- { .compatible = "hisilicon,hi3670-dwc3" },
- { .compatible = "intel,keembay-dwc3" },
- { .compatible = "rockchip,rk3399-dwc3" },
- { .compatible = "sprd,sc9860-dwc3" },
+ {
+ .compatible = "allwinner,sun50i-h6-dwc3",
+ },
+ {
+ .compatible = "cavium,octeon-7130-usb-uctl",
+ },
+ {
+ .compatible = "hisilicon,hi3670-dwc3",
+ },
+ {
+ .compatible = "intel,keembay-dwc3",
+ },
+ {
+ .compatible = "rockchip,rk3399-dwc3",
+ .data = &dwc3_of_simple_data_rk3399,
+ },
+ {
+ .compatible = "sprd,sc9860-dwc3",
+ },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, of_dwc3_simple_match);
--
2.25.1
next prev parent reply other threads:[~2022-02-26 18:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-26 18:41 [PATCH v2 00/11] enable usb support on rk356x Peter Geis
2022-02-26 18:41 ` [PATCH v2 03/11] dt-bindings: usb: dwc3: add description for rk3568 Peter Geis
2022-03-04 23:13 ` Rob Herring
2022-02-26 18:41 ` [PATCH v2 05/11] usb: dwc3: core: do not use 3.0 clock when operating in 2.0 mode Peter Geis
2022-02-26 18:41 ` [PATCH v2 06/11] usb: dwc3: reorder dwc-of-simple compatibles Peter Geis
2022-02-26 18:41 ` Peter Geis [this message]
2022-02-26 18:41 ` [PATCH v2 08/11] usb: dwc3: add rk3568 dwc3 support Peter Geis
2022-02-26 21:43 ` Johan Jonker
2022-02-26 23:48 ` Peter Geis
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=20220226184147.769964-8-pgwipeout@gmail.com \
--to=pgwipeout@gmail.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.riesch@wolfvision.net \
/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).