Skip to content

Commit

Permalink
i2c: mxs: correctly setup speed for non devicetree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wolfram Sang committed Sep 12, 2012
1 parent c076ada commit 72ee734
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/i2c/busses/i2c-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 72ee734

Please sign in to comment.