public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Yoshihiro Shimoda
	<yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Cc: "mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org"
	<mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	SH-Linux <linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/3] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
Date: Wed, 21 May 2014 10:04:07 +0200	[thread overview]
Message-ID: <5594897.Dm70JHoDO1@wuerfel> (raw)
In-Reply-To: <537C5B98.7060401-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

On Wednesday 21 May 2014 16:54:00 Yoshihiro Shimoda wrote:
> 
> (2014/05/20 19:11), Arnd Bergmann wrote:
> > On Monday 19 May 2014 19:08:05 Yoshihiro Shimoda wrote:
> >>
> >>  #include "xhci.h"
> >>  #include "xhci-mvebu.h"
> >> +#include "xhci-rcar.h"
> >>
> >>  static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
> >>  {
> >> @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd)
> >>
> >>  static int xhci_plat_start(struct usb_hcd *hcd)
> >>  {
> >> +    struct device_node *of_node = hcd->self.controller->of_node;
> >> +
> >> +    if (of_device_is_compatible(of_node, "renesas,r8a7790-xhci") ||
> >> +        of_device_is_compatible(of_node, "renesas,r8a7790-xhci"))
> >> +            xhci_rcar_start(hcd);
> >> +
> >>      return xhci_run(hcd);
> >>  }
> >>
> >> @@ -165,6 +172,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
> >>                      goto unmap_registers;
> >>      }
> >>
> >> +    if (of_device_is_compatible(pdev->dev.of_node,
> >> +                                "renesas,r8a7790-xhci") ||
> >> +        of_device_is_compatible(pdev->dev.of_node,
> >> +                                "renesas,r8a7791-xhci")) {
> >> +            ret = xhci_rcar_init_quirk(pdev);
> >> +            if (ret)
> >> +                    goto disable_clk;
> >> +    }
> >> +
> >>      ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> >>      if (ret)
> >>              goto disable_clk;
> >> @@ -270,6 +286,8 @@ static const struct of_device_id usb_xhci_of_match[] = {
> >>      { .compatible = "xhci-platform" },
> >>      { .compatible = "marvell,armada-375-xhci"},
> >>      { .compatible = "marvell,armada-380-xhci"},
> >> +    { .compatible = "renesas,r8a7790-xhci"},
> >> +    { .compatible = "renesas,r8a7791-xhci"},
> >>      { },
> >>  };
> >>  MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
> > 
> > Like the drivers before, this is way more than a quirk, and deserves to
> > be its own driver. It would be better to have an abstract way to split
> > out soc specific xhci front-ends and export functions from the xhci-platform
> > code.
> 
> Thank you for your comment. But, I couldn't understand your comment...
> Did you mean that xhci-rcar.c should call of_device_is_compatible(of_node, "renesas,...")?
> If so, I will modify this patch.


What I mean is that there should be a separate module that contains all the
renesas specific code, and that module should register a platform driver
that contains the match table for its own IDs.

Then instead of having a common xhci_plat_probe() that gets called as the
->probe() callback of the driver, you have a rcar_xhci_probe() function
that calls into common helper functions exported by the base driver, just
as we do things for all other drivers. See ehci or ahci for instance.


	Arnd
--
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

  parent reply	other threads:[~2014-05-21  8:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 10:08 [PATCH 2/3] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers Yoshihiro Shimoda
     [not found] ` <5379D805.3070002-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2014-05-19 10:21   ` Magnus Damm
2014-05-20  9:34     ` Yoshihiro Shimoda
2014-05-19 11:58 ` Geert Uytterhoeven
2014-05-20  9:35   ` Yoshihiro Shimoda
     [not found]     ` <537B21CA.6080702-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2014-05-20 10:14       ` Geert Uytterhoeven
2014-05-21  7:54         ` Yoshihiro Shimoda
2014-05-19 12:14 ` Sergei Shtylyov
2014-05-20  9:35   ` Yoshihiro Shimoda
2014-05-20 10:11 ` Arnd Bergmann
2014-05-21  7:54   ` Yoshihiro Shimoda
     [not found]     ` <537C5B98.7060401-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2014-05-21  8:04       ` Arnd Bergmann [this message]
2014-05-21  8:16         ` Yoshihiro Shimoda

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=5594897.Dm70JHoDO1@wuerfel \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org \
    /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