summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2012-09-08 17:28:06 +0200
committerWolfram Sang <w.sang@pengutronix.de>2012-09-12 17:55:22 +0200
commit72ee734a6716aac5aaf336da70a811e308d2a84e (patch)
treebdf487c3eb7b9d539f605bbe063b6987624d9bfb
parentc076ada4e4aaf45e1a31ad6de7c6cce36081e045 (diff)
downloadlwn-72ee734a6716aac5aaf336da70a811e308d2a84e.tar.gz
lwn-72ee734a6716aac5aaf336da70a811e308d2a84e.zip
i2c: mxs: correctly setup speed for non devicetree
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@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-mxs.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 088c5c1ed17d..51f05b8520ed 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);