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 @@ { 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 @@ 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 */