devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] USB: Update EHCI-platform driver to devicetree.
       [not found]   ` <1350703053-4661-2-git-send-email-linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org>
@ 2012-10-20 13:01     ` Florian Fainelli
  2012-10-20 14:31       ` Alan Stern
  2012-10-20 18:11       ` Tony Prisk
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2012-10-20 13:01 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Tony Prisk, Greg KH, linux-usb-u79uwXL29TY76Z2rM5mHXA, Alan Stern,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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-p3rKhJxN3npAfugRpC6u6w@public.gmane.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.

> +		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.

> +
> +		/* 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.
-- 
Florian
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] USB: Update EHCI-platform driver to devicetree.
  2012-10-20 13:01     ` [PATCH 1/2] USB: Update EHCI-platform driver to devicetree Florian Fainelli
@ 2012-10-20 14:31       ` Alan Stern
       [not found]         ` <Pine.LNX.4.44L0.1210201027280.24222-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
  2012-10-20 18:11       ` Tony Prisk
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Stern @ 2012-10-20 14:31 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Tony Prisk,
	Greg KH, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Sat, 20 Oct 2012, 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-p3rKhJxN3npAfugRpC6u6w@public.gmane.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.

Actually the new property is "no_io_watchdog".  See

	http://marc.info/?l=linux-usb&m=134970247511140&w=2

> 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 :)

At some point we'll need a way to handle the power_{on,off,suspend} 
callbacks.  I don't know how that should be done.

Alan Stern

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] USB: Update EHCI-platform driver to devicetree.
  2012-10-20 13:01     ` [PATCH 1/2] USB: Update EHCI-platform driver to devicetree Florian Fainelli
  2012-10-20 14:31       ` Alan Stern
@ 2012-10-20 18:11       ` Tony Prisk
  1 sibling, 0 replies; 4+ messages in thread
From: Tony Prisk @ 2012-10-20 18:11 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Greg KH,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Alan Stern,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

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-p3rKhJxN3npAfugRpC6u6w@public.gmane.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).

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] USB: Update EHCI-platform driver to devicetree.
       [not found]         ` <Pine.LNX.4.44L0.1210201027280.24222-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
@ 2012-10-20 22:20           ` Tony Prisk
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Prisk @ 2012-10-20 22:20 UTC (permalink / raw)
  To: Alan Stern
  Cc: Florian Fainelli,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Greg KH,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Sat, 2012-10-20 at 10:31 -0400, Alan Stern wrote:
> On Sat, 20 Oct 2012, 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-p3rKhJxN3npAfugRpC6u6w@public.gmane.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.
> 
> Actually the new property is "no_io_watchdog".  See
> 
> 	http://marc.info/?l=linux-usb&m=134970247511140&w=2
> 
> > 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 :)
> 
> At some point we'll need a way to handle the power_{on,off,suspend} 
> callbacks.  I don't know how that should be done.
> 
> Alan Stern

I actually included a comment in the patch regarding the missing
functions:

> +                * 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.
> +                */

I don't know anything about the power sequence code, but have seen some
patches for pwm backlight using it. I don't know if it would allow
everything that's needed, but it seems to have support for voltage
regulators and gpios (among other things).

Regards
Tony P

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-20 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1350703053-4661-1-git-send-email-linux@prisktech.co.nz>
     [not found] ` <1350703053-4661-2-git-send-email-linux@prisktech.co.nz>
     [not found]   ` <1350703053-4661-2-git-send-email-linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org>
2012-10-20 13:01     ` [PATCH 1/2] USB: Update EHCI-platform driver to devicetree Florian Fainelli
2012-10-20 14:31       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.1210201027280.24222-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-10-20 22:20           ` Tony Prisk
2012-10-20 18:11       ` Tony Prisk

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).