From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdXtM-0002X7-2Z for barebox@lists.infradead.org; Tue, 14 Feb 2017 07:51:21 +0000 Date: Tue, 14 Feb 2017 08:50:53 +0100 From: Sascha Hauer Message-ID: <20170214075053.pnowzjtopzro7fkc@pengutronix.de> References: <1486852299-30432-1-git-send-email-akurz@blala.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1486852299-30432-1-git-send-email-akurz@blala.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards To: Alexander Kurz Cc: barebox@lists.infradead.org On Sat, Feb 11, 2017 at 11:31:38PM +0100, Alexander Kurz wrote: > With commit 4ed5b778a56b ("i.MX: i2c: Add Vybrid support") i2c-fsl probe > returns -EINVAL for all non-OF boards. > Since newer planforms, especially vf610 are restricted OF-only it is safe to > assume "fsl,imx21-i2c" if CONFIG_OFDEVICE is not set. > > Signed-off-by: Alexander Kurz Sorry, I should have read these mails before doing the release. Now they have to wait for another month. Applied both to master. Sascha > --- > drivers/i2c/busses/i2c-imx.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 5677443..4ff4f5c 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -153,6 +153,8 @@ static struct fsl_i2c_clk_pair vf610_i2c_clk_div[] = { > { 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E }, > }; > > +static const struct fsl_i2c_hwdata imx21_i2c_hwdata; > + > struct fsl_i2c_hwdata { > unsigned regshift; > struct fsl_i2c_clk_pair *clk_div; > @@ -676,10 +678,14 @@ static int __init i2c_fsl_probe(struct device_d *pdev) > clk_enable(i2c_fsl->clk); > #endif > > - i2c_fsl->hwdata = of_device_get_match_data(pdev); > - if (!i2c_fsl->hwdata) { > - ret = -EINVAL; > - goto fail; > + if (IS_ENABLED(CONFIG_OFDEVICE)) { > + i2c_fsl->hwdata = of_device_get_match_data(pdev); > + if (!i2c_fsl->hwdata) { > + ret = -EINVAL; > + goto fail; > + } > + } else { > + i2c_fsl->hwdata = &imx21_i2c_hwdata; > } > > /* Setup i2c_fsl driver structure */ > -- > 2.1.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- 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 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox