From: Alan Stern <stern@rowland.harvard.edu>
To: Vincent Shih <vincent.sunplus@gmail.com>
Cc: gregkh@linuxfoundation.org, p.zabel@pengutronix.de,
davem@davemloft.net, vladimir.oltean@nxp.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
devicetree@vger.kernel.org, wells.lu@sunplus.com
Subject: Re: [PATCH v4 1/2] usb: host: ehci-sunplus: Add driver for ehci in Sunplus SP7021
Date: Fri, 29 Apr 2022 21:26:11 -0400 [thread overview]
Message-ID: <YmyQM3Yp31E1lfrn@rowland.harvard.edu> (raw)
In-Reply-To: <1651220876-26705-2-git-send-email-vincent.sunplus@gmail.com>
On Fri, Apr 29, 2022 at 04:27:55PM +0800, Vincent Shih wrote:
> Add driver for ehci in Sunplus SP7021
>
> Signed-off-by: Vincent Shih <vincent.sunplus@gmail.com>
> ---
> diff --git a/drivers/usb/host/ehci-sunplus.c b/drivers/usb/host/ehci-sunplus.c
> new file mode 100644
> index 0000000..4d8e20d
> --- /dev/null
> +++ b/drivers/usb/host/ehci-sunplus.c
> +static struct usb_ehci_pdata usb_ehci_pdata = {
> + .has_tt = 1,
> + .has_synopsys_hc_bug = 1,
> + .big_endian_desc = 1,
> + .big_endian_mmio = 1,
> + .power_on = sp_ehci_platform_power_on,
> + .power_suspend = sp_ehci_platform_power_off,
> + .power_off = sp_ehci_platform_power_off,
> +
> +};
> +
> +static int ehci_sunplus_reset(struct usb_hcd *hcd)
> +{
> + struct platform_device *pdev = to_platform_device(hcd->self.controller);
> + struct usb_ehci_pdata *pdata = pdev->dev.platform_data;
> + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
> + int retval;
> +
> + hcd->has_tt = pdata->has_tt;
> + ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
> + ehci->big_endian_desc = pdata->big_endian_desc;
> + ehci->big_endian_mmio = pdata->big_endian_mmio;
By the way, you don't need to add all this pdata stuff. You can just
set hcd->has_tt, ehci->has_synopsys_hc_bug, ehci_big_endian_desc, and
ehci->big_endian_mmio directly, since you already know what their values
should be.
It looks like you simply copied the code from the ehci-platform driver.
But that driver has to handle many different kinds of platform devices,
so it needs to be told about their individual differences, whereas your
driver only has to handle one kind.
In fact, there's no obvious reason why you didn't just use the
ehci-platform driver instead of writing your own driver.
That's the sort of thing you need to explain the patch description.
Alan Stern
next prev parent reply other threads:[~2022-04-30 1:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 8:27 [PATCH v4 0/2] Add driver for EHCI in Sunplus SP7021 Vincent Shih
2022-04-29 8:27 ` [PATCH v4 1/2] usb: host: ehci-sunplus: Add driver for ehci " Vincent Shih
2022-04-29 12:07 ` Philipp Zabel
2022-04-29 15:37 ` Alan Stern
2022-04-30 1:26 ` Alan Stern [this message]
2022-04-29 8:27 ` [PATCH v4 2/2] dt-bindings: usb: Add bindings doc for Sunplus EHCI driver Vincent Shih
2022-04-29 20:53 ` Krzysztof Kozlowski
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=YmyQM3Yp31E1lfrn@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=vincent.sunplus@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=wells.lu@sunplus.com \
/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).