linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@prisktech.co.nz (Tony Prisk)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] USB: Update EHCI-platform driver to devicetree.
Date: Sun, 21 Oct 2012 07:11:29 +1300	[thread overview]
Message-ID: <1350756689.5882.5.camel@gitbox> (raw)
In-Reply-To: <2209384.BKaXW2gI8I@bender>

On Sat, 2012-10-20 at 15:01 +0200, Florian Fainelli wrote:
> Hi Tony,
> 
> On Saturday 20 October 2012 16:17:32 Tony Prisk wrote:
> > This patch adds devicetree support to the EHCI-platform driver,
> > and removes the now unneeded ehci-vt8500.c
> > 
> > Existing platform properties are maintained, with the exception
> > the power_(on/off) and suspend function pointers.
> 
> Ok, so I have recently sent a bit patchset to remove most OHCI/EHCI drivers
> that could be converted to the generic variants, series starts here:
> 1349701906-16481-1-git-send-email-florian at openwrt.org
> 
> in this patchset I added a new property to the EHCI platform data:
> need_io_watchdog, which needs to be handled too from DT ideally.
> 
> Adding device tree bindings is on my TODO after having a generic way
> to pass clocks to the ehci/ohci platform drivers, so you are right on time :)
> 
> [snip]
> 
> > +	if (np) {
> > +		/*
> > +		 * No platform data is being passed, so initalize pdata.
> > +		 * Limitation: we can't support power_on, power_off or
> > +		 * power_suspend function pointers from DT.
> > +		 * TODO: The missing functions could be replaced with
> > +		 * power sequence handlers.
> > +		 */
> > +		pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
> 
> Missing allocation failure handling here. And you should free this in
> ehci_platform_remove() accordingly.

Oops - good catch. Will fix.
> 
> > +		dev->dev.platform_data = pdata;
> > +
> > +		/* Read the optional properties from DT node */
> > +		of_property_read_u32(np, "caps-offset", &pdata->caps_offset);
> > +		if (of_property_read_bool(np, "has-tt"))
> > +			pdata->has_tt = 1;
> > +		if (of_property_read_bool(np, "has-synopsys-hc-bug"))
> > +			pdata->has_synopsys_hc_bug = 1;
> > +		if (of_property_read_bool(np, "big-endian-desc"))
> > +			pdata->big_endian_desc = 1;
> > +		if (of_property_read_bool(np, "big-endian-mmio"))
> > +			pdata->big_endian_mmio = 1;
> 
> I would rather we remain compatible with ehci-ppc-of, by handling the 
> big-endian property you set big_endian_mmiod and big_endian_desc to 1, and
> by setting them individually, you get what you expect.

I noticed in the usb-ehci.txt binding document, it lists
big-endian-regs, big-endian-desc and big-endian so perhaps we should
rename all these to match.
> 
> > +
> > +		/* Right now device-tree probed devices don't get dma_mask set.
> > +		 * Since shared usb code relies on it, set it here for now.
> > +		 * Once we have dma capability bindings this can go away.
> > +		 */
> > +		if (!dev->dev.dma_mask)
> > +			dev->dev.dma_mask = &ehci_dma_mask;
> > +	}
> > +
> >  	if (!pdata) {
> >  		WARN_ON(1);
> >  		return -ENODEV;
> > @@ -215,6 +250,16 @@ static const struct platform_device_id ehci_platform_table[] = {
> >  	{ "ehci-platform", 0 },
> >  	{ }
> >  };
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id ehci_platform_ids[] = {
> > +	{ .compatible = "ehci-platform", },
> > +	{}
> 
> ehci-platform is very linux-specific, so this should either be:
> "linux,ehci-platform", or "usb-ehci", pretty much like the ppc-of ehci driver.

Anyone has any preferences? This change should also be applied to
platform-uhci to keep everything uniform (and ohci-platform eventually
as well).

  parent reply	other threads:[~2012-10-20 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  3:17 [RFC PATCH 0/2] Update ehci-platform driver to support devicetree Tony Prisk
2012-10-20  3:17 ` [PATCH 1/2] USB: Update EHCI-platform driver to devicetree Tony Prisk
2012-10-20 13:01   ` Florian Fainelli
2012-10-20 14:31     ` Alan Stern
2012-10-20 22:20       ` Tony Prisk
2012-10-20 18:11     ` Tony Prisk [this message]
2012-10-20  3:17 ` [PATCH 2/2] USB: doc: Binding document for ehci-platform driver Tony Prisk
2012-10-20 14:34 ` [RFC PATCH 0/2] Update ehci-platform driver to support devicetree Alan Stern

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=1350756689.5882.5.camel@gitbox \
    --to=linux@prisktech.co.nz \
    --cc=linux-arm-kernel@lists.infradead.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).