All of lore.kernel.org
 help / color / mirror / Atom feed
From: LW@KARO-electronics.de (Lothar Waßmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 5/6] ARM: mxs: add usb phy operations
Date: Wed, 27 Jul 2011 11:24:57 +0200	[thread overview]
Message-ID: <20015.55657.95716.938713@ipc1.ka-ro> (raw)
In-Reply-To: <97D3A72708D04647A5AC84A04996E5B5166AD6@039-SN1MPN1-006.039d.mgd.msft.net>

Hi,

Lin Tony-B19295 writes:
> > -----Original Message-----
> > From: Lothar Wa?mann [mailto:LW at KARO-electronics.de]
> > Sent: Wednesday, July 27, 2011 4:48 PM
> > To: Lin Tony-B19295
> > Cc: linux-usb at vger.kernel.org; koen.beel.barco at gmail.com;
> > stern at rowland.harvard.edu; s.hauer at pengutronix.de; linux-arm-
> > kernel at lists.infradead.org
> > Subject: Re: [PATCH v3 5/6] ARM: mxs: add usb phy operations
> > 
> > Hi,
> > 
> > Tony Lin writes:
> > > add usb phy register definitions and functions usb host driver will
> > > use these callback functions to initialize usb phy and change working
> > > mode
> > >
> > > Signed-off-by: Tony Lin <tony.lin@freescale.com>
> > > ---
> > >  arch/arm/mach-mxs/Kconfig           |    1 +
> > >  arch/arm/mach-mxs/Makefile          |    1 +
> > >  arch/arm/mach-mxs/mxs_usb.c         |  288
> > +++++++++++++++++++++++++++++++++++
> > >  arch/arm/mach-mxs/regs-usbphy-mxs.h |  240
> > > +++++++++++++++++++++++++++++
> > >  4 files changed, 530 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
> > > index 4cd0231..1c4264f 100644
> > > --- a/arch/arm/mach-mxs/Kconfig
> > > +++ b/arch/arm/mach-mxs/Kconfig
> > > @@ -49,6 +49,7 @@ config MACH_MX28EVK
> > >  	select MXS_HAVE_PLATFORM_MXS_MMC
> > >  	select MXS_HAVE_PLATFORM_MXSFB
> > >  	select MXS_OCOTP
> > > +	select USB_ARCH_HAS_EHCI
> > >  	help
> > >  	  Include support for MX28EVK platform. This includes specific
> > >  	  configurations for the board and its peripherals.
> > > diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
> > > index 6c38262..726c49f 100644
> > > --- a/arch/arm/mach-mxs/Makefile
> > > +++ b/arch/arm/mach-mxs/Makefile
> > > @@ -12,5 +12,6 @@ obj-$(CONFIG_MACH_MX23EVK) += mach-mx23evk.o
> > >  obj-$(CONFIG_MACH_MX28EVK) += mach-mx28evk.o
> > >  obj-$(CONFIG_MODULE_TX28) += module-tx28.o
> > >  obj-$(CONFIG_MACH_TX28)    += mach-tx28.o
> > > +obj-$(CONFIG_USB_EHCI_MXC)   += mxs_usb.o
> > >
> > >  obj-y += devices/
> > > diff --git a/arch/arm/mach-mxs/mxs_usb.c b/arch/arm/mach-mxs/mxs_usb.c
> > > new file mode 100644 index 0000000..9acc611
> > > --- /dev/null
> > > +++ b/arch/arm/mach-mxs/mxs_usb.c
> > [...]
> > > +static struct mxs_usb_private_date usbh_private = {
> > > +	.internal_phy_clk_already_on = 0,
> > > +};
> > > +
> > > +static struct mxc_usbh_platform_data usbh_config = {
> > > +	.init = fsl_usb_host_init,
> > > +	.exit = fsl_usb_host_uninit,
> > > +	.portsc = MXC_EHCI_MODE_ULPI,
> > > +	.otg = NULL,
> > > +	.plt_irq_handler = fsl_plt_usbh_irq_handler,
> > > +	.ppriv = &usbh_private,
> >         ^^^^^^^^^^^^^^^^^^^^^^^
> > This is an abuse of the platform_data. platform_data is meant to convey
> > platform specific information to a driver, not for drivers storing their
> > internal state. It should be handled read-only by drivers.
> > 
> > If you want to associate driver internal data with a platform_device you
> > should use platform_set_drvdata()/platform_get_drvdata() to
> > store/retrieve a pointer to the driver's internal data.
> > 
> > 
> The ppriv is not for storing driver internal state. Actually driver needs some callback functions which locates in platform.
> So that this pointer stores platform specific information used in callbacks to distinguish such as register address, clk
> Information.
>
Your fsl_usb_host_init() function has this:
|+	ppriv->phy_regs = ioremap(MX28_USBPHY1_BASE_ADDR, SZ_8K);
|+	ppriv->ctrl_regs = ioremap(MX28_USBCTRL1_BASE_ADDR, SZ_8K);
|+	ppriv->usb_clk = clk_get(&pdev->dev, "usb1");
|+	ppriv->usb_phy_clk = clk_get(&pdev->dev, "usb1_phy");

Thus the driver is modifying the data provided via the platform_data
pointer!



Lothar Wa?mann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________

  reply	other threads:[~2011-07-27  9:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  5:29 [PATCH v3 0/6] ARM: mx28: add usb host function Tony Lin
2011-07-27  5:29 ` [PATCH v3 1/6] ARM: mxs: ehci: consolidate definitions and structures to share among platforms Tony Lin
2011-07-27  5:29 ` [PATCH v3 2/6] ARM: mxs: enable usb1 phy power supply Tony Lin
2011-07-27  5:29 ` [PATCH v3 3/6] ARM: mxs: add usb clocks to clock tree Tony Lin
2011-07-27  5:29 ` [PATCH v3 4/6] ARM: mxs: make ehci-mxc more flexible to be used on different platforms Tony Lin
2011-07-27  8:19   ` Marc Kleine-Budde
2011-07-27  5:29 ` [PATCH v3 5/6] ARM: mxs: add usb phy operations Tony Lin
2011-07-27  8:03   ` Sascha Hauer
2011-07-27  8:16     ` Lin Tony-B19295
2011-07-28  7:39     ` Lin Tony-B19295
2011-07-28 11:27     ` Russell King - ARM Linux
2011-07-27  8:48   ` Lothar Waßmann
2011-07-27  9:10     ` Lin Tony-B19295
2011-07-27  9:24       ` Lothar Waßmann [this message]
2011-07-27  8:57   ` Marc Kleine-Budde
2011-07-27  5:29 ` [PATCH v3 6/6] ARM: mxs: add usb host function to default config Tony Lin
2011-07-27  9:01 ` [PATCH v3 0/6] ARM: mx28: add usb host function Marc Kleine-Budde
2011-07-27  9:15   ` Lin Tony-B19295

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=20015.55657.95716.938713@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.