devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
	Tony Prisk <linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org>,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>,
	linux-usb <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v2 1/2] ohci-platform: Add support for devicetree instantiation
Date: Thu, 09 Jan 2014 14:32:28 +0100	[thread overview]
Message-ID: <52CEA4EC.5010007@redhat.com> (raw)
In-Reply-To: <CAGVrzcbsvm1MLj0U=jSZRRsorz6XLEoNTv4vhseL4Oq06FDz=A@mail.gmail.com>

Hi,

On 01/08/2014 09:36 PM, Florian Fainelli wrote:
> Hello,
>
> 2014/1/8 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>:
>> Add support for ohci-platform instantiation from devicetree, including
>> optionally getting clks and a phy from devicetree, and enabling / disabling
>> those on power_on / off.
>>
>> This should allow using ohci-platform from devicetree in various cases.
>> Specifically after this commit it can be used for the ohci controller found
>> on Allwinner sunxi SoCs.
>>
>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>>   .../devicetree/bindings/usb/platform-ohci.txt      |  25 ++++
>>   drivers/usb/host/ohci-platform.c                   | 148 ++++++++++++++++++---
>>   2 files changed, 153 insertions(+), 20 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/usb/platform-ohci.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/platform-ohci.txt b/Documentation/devicetree/bindings/usb/platform-ohci.txt
>> new file mode 100644
>> index 0000000..44bfa57
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/platform-ohci.txt
>
> ohci-mmio might be a better name than platform maybe?

We already have platform-uhci too, and this matches the name of
the .c file so that people can actually correlate the 2.

>
> [snip]
>
>> +static int ohci_platform_power_on(struct platform_device *dev)
>> +{
>> +       struct usb_hcd *hcd = platform_get_drvdata(dev);
>> +       struct ohci_platform_priv *priv =
>> +               (struct ohci_platform_priv *)hcd_to_ohci(hcd)->priv;
>> +       int clk, ret;
>> +
>> +       for (clk = 0; priv->clks[clk] && clk < OHCI_MAX_CLKS; clk++) {
>> +               ret = clk_prepare_enable(priv->clks[clk]);
>> +               if (ret)
>> +                       goto err_disable_clks;
>> +       }
>
> Do we really need to cap this to OHCI_MAX_CLKS, the next driver which
> has 4 clocks will have to bump this, so maybe a linked-list would be
> best?

I can make OHCI_MAX_CLKS 4 or 8 if that makes you happy, other then
that I greatly prefer to keep this KISS. Devices with 3 clks are already
quite rare, so its not like we're going to need to bump this every other
week a linked list where a simple array suffices is just overkill and
unnecessarily complicates things.

>
>> +
>> +       if (priv->phy) {
>> +               ret = phy_init(priv->phy);
>> +               if (ret)
>> +                       goto err_disable_clks;
>> +
>> +               ret = phy_power_on(priv->phy);
>> +               if (ret)
>> +                       goto err_exit_phy;
>> +       }
>
> Although I do value the idea of having DT probing for ohci-platform,
> ehci-platform et al, I am not sure if this really belongs in the
> generic OHCI platform driver, or if we should rather have small glue
> drivers which register the ohci-platform driver and which provides all
> the platform-specific power_on, power_off, suspend callbacks to the
> ohci platform driver? Such glue driver would be the one which gets
> probed based off a specific compatible string a

This can already be done by having a platform driver with its own
compatible string providing platform data with the hooks. The whole idea
here is to avoid having to write such a glue driver for every other soc,
so cover the common simple case, and use glue drivers for more complicated
scenarios.

> At first glance it does look like this covers 80% of the existing OHCI
> drivers out there, so this is good. We might also want to support
> clock pointers provided via platform_data so we can remove ohci-at91,
> ohci-ep93xx, ohci-spear and friends in the future.

Lets first get the generic devicetree support merged as is, if after
that people want to extend it, so that (more) existing ohci drivers can
be removed, they are very much welcome to do so. Preferably people
with access to the hardware, so that they can actually test the changes.

> ohci-ppc-of could also probably be removed once we add quirks and
> endian properties parsing to ohci-platform?

Add-on patches extending my initial work are welcome. Again probably
best done by people who actually have access to the relevant hw.

Regards,

Hans

  reply	other threads:[~2014-01-09 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 16:30 [PATCH v2 0/2] ohci and ehci-platform clks, phy and dt support Hans de Goede
     [not found] ` <1389198608-24339-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-08 16:30   ` [PATCH v2 1/2] ohci-platform: Add support for devicetree instantiation Hans de Goede
     [not found]     ` <1389198608-24339-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-08 20:36       ` Florian Fainelli
2014-01-09 13:32         ` Hans de Goede [this message]
2014-01-08 16:30   ` [PATCH v2 2/2] ehci-platform: Add support for clks and phy passed through devicetree Hans de Goede
     [not found]     ` <1389198608-24339-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-08 18:16       ` Maxime Ripard
2014-01-09 13:26         ` Hans de Goede
     [not found]           ` <52CEA386.6060103-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-09 15:47             ` Alan Stern
     [not found]               ` <Pine.LNX.4.44L0.1401091043380.1493-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-01-09 17:45                 ` Hans de Goede

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=52CEA4EC.5010007@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@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;
as well as URLs for NNTP newsgroup(s).