Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1458777
| From | Jonas Gorski <jonas.gorski@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree |
| Date | 2016-08-09 16:10 +0200 |
| Message-ID | <s4fTb-bN-9@gated-at.bofh.it> (permalink) |
| References | <s4eu6-7y7-3@gated-at.bofh.it> <s4eu7-7y7-45@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On 9 August 2016 at 14:35, Paul Burton <paul.burton@imgtec.com> wrote:
> Introduce support for probing the SEAD3 EHCI driver using device tree.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> drivers/usb/host/ehci-sead3.c | 29 +++++++++++++++++++++++------
> 1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
> index 3d86cc2..05db1ae 100644
> --- a/drivers/usb/host/ehci-sead3.c
> +++ b/drivers/usb/host/ehci-sead3.c
> @@ -20,6 +20,7 @@
> */
>
> #include <linux/err.h>
> +#include <linux/of_irq.h>
> #include <linux/platform_device.h>
>
> static int ehci_sead3_setup(struct usb_hcd *hcd)
> @@ -96,15 +97,25 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
> {
> struct usb_hcd *hcd;
> struct resource *res;
> - int ret;
> + int ret, irq;
>
> if (usb_disabled())
> return -ENODEV;
>
> - if (pdev->resource[1].flags != IORESOURCE_IRQ) {
> - pr_debug("resource[1] is not IORESOURCE_IRQ");
> - return -ENOMEM;
> + if (pdev->dev.of_node) {
> + irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> + if (!irq) {
> + dev_err(&pdev->dev, "failed to map IRQ\n");
> + return -ENODEV;
> + }
> + } else {
> + if (pdev->resource[1].flags != IORESOURCE_IRQ) {
> + pr_debug("resource[1] is not IORESOURCE_IRQ");
> + return -ENOMEM;
> + }
> + irq = pdev->resource[1].start;
> }
> +
Why not just use platform_get_irq(pdev, 0) instead of this whole
block? Then you wouldn't need to care anymore whether resource 1 is
the IRQ resource (and avoid a potential overrun when the device has
only one resource), or if it is probed through of.
> hcd = usb_create_hcd(&ehci_sead3_hc_driver, &pdev->dev, "SEAD-3");
> if (!hcd)
> return -ENOMEM;
> @@ -121,8 +132,7 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
> /* Root hub has integrated TT. */
> hcd->has_tt = 1;
>
> - ret = usb_add_hcd(hcd, pdev->resource[1].start,
> - IRQF_SHARED);
> + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> if (ret == 0) {
> platform_set_drvdata(pdev, hcd);
> device_wakeup_enable(hcd->self.controller);
> @@ -172,12 +182,19 @@ static const struct dev_pm_ops sead3_ehci_pmops = {
> #define SEAD3_EHCI_PMOPS NULL
> #endif
>
> +static const struct of_device_id sead3_ehci_of_match[] = {
> + { .compatible = "mti,sead3-ehci" },
I don't see this compatible documented anywhere, please add binding
documentation for it first (and CC devicetree@vger ).
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, sead3_ehci_of_match);
> +
> static struct platform_driver ehci_hcd_sead3_driver = {
> .probe = ehci_hcd_sead3_drv_probe,
> .remove = ehci_hcd_sead3_drv_remove,
> .shutdown = usb_hcd_platform_shutdown,
> .driver = {
> .name = "sead3-ehci",
> + .of_match_table = sead3_ehci_of_match,
> .pm = SEAD3_EHCI_PMOPS,
> }
> };
Regards
Jonas
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/20] MIPS: SEAD3 device tree conversion Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 02/20] MIPS: SEAD3: Probe interrupt controllers using DT kbuild test robot <lkp@intel.com> - 2016-08-10 20:30 +0200
[PATCH 12/20] MIPS: SEAD3: Reset via generic syscon-reboot driver & DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 01/20] MIPS: SEAD3: Split obj-y entries across lines Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 07/20] MIPS: SEAD3: Probe EHCI controller using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 05/20] MIPS: SEAD3: Probe ethernet controller using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 14/20] MIPS: SEAD3: Parse memsize in DT shim Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 06/20] usb: host: ehci-sead3: Support probing using device tree Jonas Gorski <jonas.gorski@gmail.com> - 2016-08-09 16:10 +0200
[PATCH 11/20] leds: Remove SEAD3 driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 08/20] usb: host: ehci-sead3: Remove non-DT probe code Alan Stern <stern@rowland.harvard.edu> - 2016-08-09 16:30 +0200
[PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT kbuild test robot <lkp@intel.com> - 2016-08-10 20:30 +0200
Re: [PATCH 03/20] MIPS: SEAD3: Probe UARTs using DT kbuild test robot <lkp@intel.com> - 2016-08-10 21:40 +0200
[PATCH 04/20] MIPS: SEAD3: Use generic ns16550a earlycon support Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 13/20] MIPS: SEAD3: Use generic restart-poweroff driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:40 +0200
[PATCH 15/20] MIPS: SEAD3: Drop use of cobalt fbdev driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 19/20] MIPS: SEAD3: Use img-ascii-lcd driver Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 17/20] dt-bindings: img-ascii-lcd: Document a binding for simple ASCII LCDs Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 16/20] fbdev: cobalt_lcdfb: Drop SEAD3 support Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
Re: [PATCH 16/20] fbdev: cobalt_lcdfb: Drop SEAD3 support Tomi Valkeinen <tomi.valkeinen@ti.com> - 2016-08-10 20:50 +0200
[PATCH 20/20] MIPS: SEAD3: Remove custom read_persistent_clock Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
[PATCH 18/20] auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays Paul Burton <paul.burton@imgtec.com> - 2016-08-09 14:50 +0200
csiph-web