[RFC PATCH 0/8] MXS: Add i.MX28 USB Host driver

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 18 03:02:23 EDT 2012


On Tue, Apr 17, 2012 at 10:29:21PM +0200, Marek Vasut wrote:
> > > 
> > > So the PHY actually registers the EHCI driver (plat_bus->phy->ehci)?
> > > That's slightly weird, don't you think?
> > 
> > Your hardware device is a device consisting of a ehci core and a USB device
> > core. Currently we register the child devices independently which leads
> > to the mentioned problems. Instead we should register the USB core as a
> > whole and pass the resources to either the client or the host driver.
> 
> Ok, giving it a second thought -- you mean to create "stub" driver, which claims 
> and toggles the clock _and_ registers both the EHCI host driver and PHY driver 
> under itself in the hierarchy. Is that correct?

No, the registration of the phy is fine the way it is. The stub driver
should only register the ehci and the usb device. Maybe some pseudo code
helps describing what I mean:

arch/arm/mach-mxs:

	mx28_register_usbphy0();
	mx28_register_usb0();

drivers/usb/otg/mxs-otg.c:

	probe() {
		clk_get();
		clk_prepare_enable();

		usb_get_phy(&pdev->dev);

		if (pdata->mode == USB_OTG_MODE_HOST)
			usb_add_hcd(priv->host);
		else
			usb_gadget_vbus_connect(priv->gadget);
	}

	module_platform_driver(mxs_otg_driver);

drivers/usb/otg/mxs-otg-phy.c:

	probe() {
		clk_get();
		clk_prepare_enable();
		usb_register_phy(phy, "mxs-otg.0");
	}

	module_platform_driver(mxs_otg_phy_driver);


The mxs-otg part can be reused on i.MX aswell, whereas mxs-otg-phy is
mxs (and i.MX6 how we just learned) specific.
What currently is missing is a usb_get_phy() with a device argument to
get the phy specific to a device. That's a problem, but you currently
have it aswell with your current approach

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-arm-kernel mailing list