summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurz <akurz@blala.de>2017-02-11 23:31:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-14 08:48:25 +0100
commit45164aadfaccf3c138e6a0f3d93df05ddb3a52aa (patch)
tree6e788f4b9ea9693e4df2a7c13bcc7ac376636bae
parent4afb09cc67098a71513db9e39a3d3ebeff64c527 (diff)
downloadbarebox-45164aadfaccf3c138e6a0f3d93df05ddb3a52aa.tar.gz
i.MX: i2c: fix i2c-fsl for non-OF boards
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 <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-imx.c14
1 files 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 */