From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Subject: Re: [PATCH 6/8] CI13xxx: Add i.MX233/i.MX28 binding code Date: Wed, 16 May 2012 15:41:17 +0200 Message-ID: <201205161541.17508.marex@denx.de> References: <1337070219-3630-1-git-send-email-marex@denx.de> <1337070219-3630-7-git-send-email-marex@denx.de> <20120516083613.GG17359@arwen.pp.htv.fi> Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <20120516083613.GG17359-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: balbi-l0cyMroinI0@public.gmane.org Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Alan Stern , Detlev Zundel , Dong Aisheng , Fabio Estevam , Greg Kroah-Hartman , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sascha Hauer , Shawn Guo , Stefano Babic , Uwe =?iso-8859-1?q?Kleine-K=F6nig?= , Wolfgang Denk , Wolfram Sang List-Id: linux-i2c@vger.kernel.org Dear Felipe Balbi, > On Tue, May 15, 2012 at 10:23:37AM +0200, Marek Vasut wrote: > > This codes connects the CI13xxx driver with the core found inside o= f > > the Freescale i.MX244/i.MX28 CPU. > >=20 > > Signed-off-by: Marek Vasut > > Cc: Alan Stern > > Cc: Detlev Zundel > > CC: Dong Aisheng > > CC: Fabio Estevam > > Cc: Felipe Balbi > > Cc: Greg Kroah-Hartman > > Cc: Linux ARM kernel > > Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > > CC: Sascha Hauer > > CC: Shawn Guo > > Cc: Stefano Babic > > CC: Uwe Kleine-K=F6nig > > Cc: Wolfgang Denk > > Cc: Wolfram Sang > > --- > >=20 > > drivers/usb/chipidea/Makefile | 4 + > > drivers/usb/chipidea/ci13xxx_mxs.c | 201 > > ++++++++++++++++++++++++++++++++++++ 2 files changed, 205 insertio= ns(+) > > create mode 100644 drivers/usb/chipidea/ci13xxx_mxs.c > >=20 > > diff --git a/drivers/usb/chipidea/Makefile > > b/drivers/usb/chipidea/Makefile index cc34937..266d57d 100644 > > --- a/drivers/usb/chipidea/Makefile > > +++ b/drivers/usb/chipidea/Makefile > > @@ -12,3 +12,7 @@ endif > >=20 > > ifneq ($(CONFIG_ARCH_MSM),) > > =20 > > obj-$(CONFIG_USB_CHIPIDEA) +=3D ci13xxx_msm.o > > =20 > > endif > >=20 > > + > > +ifneq ($(CONFIG_ARCH_MXS),) > > + obj-$(CONFIG_USB_CHIPIDEA) +=3D ci13xxx_mxs.o > > +endif >=20 > NAK... let it compile everywhere. I just followed the pattern here, honestly I think this is quite OK so = far.=20 =46urther improvements can be made indeed. > > diff --git a/drivers/usb/chipidea/ci13xxx_mxs.c > > b/drivers/usb/chipidea/ci13xxx_mxs.c new file mode 100644 > > index 0000000..fcca90b > > --- /dev/null > > +++ b/drivers/usb/chipidea/ci13xxx_mxs.c > > @@ -0,0 +1,201 @@ > > +/* > > + * drivers/usb/chipidea/ci13xxx_mxs.c > > + * > > + * Freescale i.MX233/i.MX28 USB glue driver to CI13xxx core. > > + * > > + * Copyright (C) 2012 Marek Vasut > > + * on behalf of DENX Software Engineering GmbH > > + * > > + * This program is free software; you can redistribute it and/or m= odify > > + * it under the terms of the GNU General Public License as publish= ed by > > + * the Free Software Foundation; either version 2 of the License, = or > > + * (at your option) any later version. > > + * > > + * This program is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + * You should have received a copy of the GNU General Public Licen= se > > + * along with this program; if not, write to the Free Software > > + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#include "ci.h" > > + > > +static void ci13xxx_mxs_notify(struct ci13xxx *ci, unsigned event) > > +{ > > + uint32_t status; > > + struct usb_phy *phy; > > + struct mxs_ci13xxx_phy_notify notify; > > + > > + phy =3D usb_get_transceiver(); > > + if (!phy) > > + return; > > + > > + if (event !=3D CI13XXX_CONTROLLER_HOST_IRQ_EVENT) > > + return; > > + > > + status =3D hw_read(ci, OP_USBSTS, ~0); > > + > > + notify.discon =3D status & STS_PCD; > > + > > + usb_phy_notify(phy, ¬ify); > > +} > > + > > +static struct ci13xxx_udc_driver ci13xxx_mxs_udc_driver =3D { > > + .name =3D "ci13xxx_mxs", > > + .flags =3D /*CI13XXX_REGS_SHARED |*/ > > + CI13XXX_REQUIRE_TRANSCEIVER | > > + CI13XXX_PULLUP_ON_VBUS | > > + CI13XXX_DISABLE_STREAMING, > > + .capoffset =3D 0x100, > > + .notify_event =3D ci13xxx_mxs_notify, > > +}; > > + > > +struct ci13xxx_mxs_data { > > + struct clk *clk; > > + struct platform_device *pdev; > > +}; > > + > > +static int __devinit ci13xxx_mxs_probe(struct platform_device *pde= v) > > +{ > > + struct ci13xxx_mxs_data *data; > > + int ret; > > + struct usb_phy *phy; > > + > > + phy =3D usb_get_transceiver(); > > + if (!phy) > > + return -EPROBE_DEFER; > > + > > + data =3D devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); > > + if (!data) { > > + dev_err(&pdev->dev, "Failed to allocate CI13xxx-MXS data!\n"); > > + return -ENOMEM; > > + } > > + > > + ret =3D usb_phy_init(phy); > > + if (ret) { > > + dev_err(&pdev->dev, "Failed to initialize PHY!\n"); > > + return -EINVAL; > > + } > > + > > + data->pdev =3D platform_device_alloc("ci_hdrc", -1); > > + if (!data->pdev) { > > + dev_err(&pdev->dev, > > + "Failed to allocate ci_hdrc platform device!\n"); > > + ret =3D -ENOMEM; > > + goto put_phy; > > + } > > + > > + /* Add DMA mask */ > > + data->pdev->dev.dma_mask =3D devm_kzalloc(&pdev->dev, > > + sizeof(*data->pdev->dev.dma_mask), > > + GFP_KERNEL); > > + if (!data->pdev->dev.dma_mask) { > > + ret =3D -ENOMEM; > > + goto put_platform; > > + } > > + > > + *data->pdev->dev.dma_mask =3D DMA_BIT_MASK(32); > > + data->pdev->dev.coherent_dma_mask =3D DMA_BIT_MASK(32); >=20 > why don't you just point to the parent's ? Good idea, thanks :)