linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: mxs: correctly setup speed for non devicetree
@ 2012-09-08 15:38 Wolfram Sang
       [not found] ` <1347118732-4896-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2012-09-08 15:38 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Marek Vasut, Wolfram Sang

Commit cd4f2d4 (i2c: mxs: Set I2C timing registers for mxs-i2c) only
covered the case for devicetree and made platform_data based boards
bail out with -EINVAL. Correctly support the latter one, too.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 drivers/i2c/busses/i2c-mxs.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 088c5c1..51f05b8 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -365,10 +365,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
 	struct device_node *node = dev->of_node;
 	int ret;
 
-	if (!node)
-		return -EINVAL;
-
-	i2c->speed = &mxs_i2c_95kHz_config;
 	ret = of_property_read_u32(node, "clock-frequency", &speed);
 	if (ret)
 		dev_warn(dev, "No I2C speed selected, using 100kHz\n");
@@ -419,10 +415,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
 		return err;
 
 	i2c->dev = dev;
+	i2c->speed = &mxs_i2c_95kHz_config;
 
-	err = mxs_i2c_get_ofdata(i2c);
-	if (err)
-		return err;
+	if (dev->of_node) {
+		err = mxs_i2c_get_ofdata(i2c);
+		if (err)
+			return err;
+	}
 
 	platform_set_drvdata(pdev, i2c);
 
-- 
1.7.10.4

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

* Re: [PATCH] i2c: mxs: correctly setup speed for non devicetree
       [not found] ` <1347118732-4896-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-09-15 18:09   ` Marek Vasut
       [not found]     ` <201209152009.44320.marex-ynQEQJNshbs@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2012-09-15 18:09 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Shawn Guo

Dear Wolfram Sang,

> Commit cd4f2d4 (i2c: mxs: Set I2C timing registers for mxs-i2c) only
> covered the case for devicetree and made platform_data based boards
> bail out with -EINVAL. Correctly support the latter one, too.

MXS is now DT only, so this patch is pointless. Rather make it depend on 
CONFIG_OF and be done with it, maybe remove the non-DT code.

> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-mxs.c |   13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 088c5c1..51f05b8 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -365,10 +365,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
>  	struct device_node *node = dev->of_node;
>  	int ret;
> 
> -	if (!node)
> -		return -EINVAL;
> -
> -	i2c->speed = &mxs_i2c_95kHz_config;
>  	ret = of_property_read_u32(node, "clock-frequency", &speed);
>  	if (ret)
>  		dev_warn(dev, "No I2C speed selected, using 100kHz\n");
> @@ -419,10 +415,13 @@ static int __devinit mxs_i2c_probe(struct
> platform_device *pdev) return err;
> 
>  	i2c->dev = dev;
> +	i2c->speed = &mxs_i2c_95kHz_config;
> 
> -	err = mxs_i2c_get_ofdata(i2c);
> -	if (err)
> -		return err;
> +	if (dev->of_node) {
> +		err = mxs_i2c_get_ofdata(i2c);
> +		if (err)
> +			return err;
> +	}
> 
>  	platform_set_drvdata(pdev, i2c);

Best regards,
Marek Vasut

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

* Re: [PATCH] i2c: mxs: correctly setup speed for non devicetree
       [not found]     ` <201209152009.44320.marex-ynQEQJNshbs@public.gmane.org>
@ 2012-09-16  8:15       ` Wolfram Sang
       [not found]         ` <20120916081525.GA4367-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2012-09-16  8:15 UTC (permalink / raw)
  To: Marek Vasut; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Shawn Guo

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]


> > Commit cd4f2d4 (i2c: mxs: Set I2C timing registers for mxs-i2c) only
> > covered the case for devicetree and made platform_data based boards
> > bail out with -EINVAL. Correctly support the latter one, too.
> 
> MXS is now DT only, so this patch is pointless.

This is not true for 3.5.

> Rather make it depend on CONFIG_OF 

I wanted to avoid ifdeffery.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] i2c: mxs: correctly setup speed for non devicetree
       [not found]         ` <20120916081525.GA4367-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-09-16 10:05           ` Marek Vasut
       [not found]             ` <201209161205.42575.marex-ynQEQJNshbs@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2012-09-16 10:05 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Shawn Guo

Dear Wolfram Sang,

> > > Commit cd4f2d4 (i2c: mxs: Set I2C timing registers for mxs-i2c) only
> > > covered the case for devicetree and made platform_data based boards
> > > bail out with -EINVAL. Correctly support the latter one, too.
> > 
> > MXS is now DT only, so this patch is pointless.
> 
> This is not true for 3.5.

Did that patch made it into 3.5 ?

> > Rather make it depend on CONFIG_OF
> 
> I wanted to avoid ifdeffery.

Best regards,
Marek Vasut

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

* Re: [PATCH] i2c: mxs: correctly setup speed for non devicetree
       [not found]             ` <201209161205.42575.marex-ynQEQJNshbs@public.gmane.org>
@ 2012-09-16 10:24               ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2012-09-16 10:24 UTC (permalink / raw)
  To: Marek Vasut; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Shawn Guo

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

On Sun, Sep 16, 2012 at 12:05:42PM +0200, Marek Vasut wrote:
> Dear Wolfram Sang,
> 
> > > > Commit cd4f2d4 (i2c: mxs: Set I2C timing registers for mxs-i2c) only
> > > > covered the case for devicetree and made platform_data based boards
> > > > bail out with -EINVAL. Correctly support the latter one, too.
> > > 
> > > MXS is now DT only, so this patch is pointless.
> > 
> > This is not true for 3.5.
> 
> Did that patch made it into 3.5 ?

Yup.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2012-09-16 10:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-08 15:38 [PATCH] i2c: mxs: correctly setup speed for non devicetree Wolfram Sang
     [not found] ` <1347118732-4896-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-15 18:09   ` Marek Vasut
     [not found]     ` <201209152009.44320.marex-ynQEQJNshbs@public.gmane.org>
2012-09-16  8:15       ` Wolfram Sang
     [not found]         ` <20120916081525.GA4367-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-16 10:05           ` Marek Vasut
     [not found]             ` <201209161205.42575.marex-ynQEQJNshbs@public.gmane.org>
2012-09-16 10:24               ` Wolfram Sang

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