summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-gpio.c2
-rw-r--r--drivers/i2c/imx_lpi2c.c2
-rw-r--r--drivers/i2c/muxes/pca954x.c7
-rw-r--r--drivers/i2c/mxc_i2c.c12
-rw-r--r--drivers/i2c/omap24xx_i2c.c2
-rw-r--r--drivers/i2c/stm32f7_i2c.c16
-rw-r--r--drivers/i2c/tegra186_bpmp_i2c.c2
-rw-r--r--drivers/i2c/tegra_i2c.c4
8 files changed, 26 insertions, 21 deletions
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index aeeb304a87..4e8fa21473 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -322,7 +322,7 @@ static int i2c_gpio_ofdata_to_platdata(struct udevice *dev)
return 0;
error:
- error("Can't get %s gpios! Error: %d", dev->name, ret);
+ pr_err("Can't get %s gpios! Error: %d", dev->name, ret);
return ret;
}
diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
index aa97196e23..e7ec17fe9e 100644
--- a/drivers/i2c/imx_lpi2c.c
+++ b/drivers/i2c/imx_lpi2c.c
@@ -412,7 +412,7 @@ static int imx_lpi2c_probe(struct udevice *bus)
addr = devfdt_get_addr(bus);
if (addr == FDT_ADDR_T_NONE)
- return -ENODEV;
+ return -EINVAL;
i2c_bus->base = addr;
i2c_bus->index = bus->seq;
diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index 01ca1ff48d..2b70ff82bd 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -27,6 +27,7 @@ struct chip_desc {
pca954x_ismux = 0,
pca954x_isswi,
} muxtype;
+ u32 width;
};
struct pca954x_priv {
@@ -39,14 +40,17 @@ static const struct chip_desc chips[] = {
[PCA9544] = {
.enable = 0x4,
.muxtype = pca954x_ismux,
+ .width = 4,
},
[PCA9547] = {
.enable = 0x8,
.muxtype = pca954x_ismux,
+ .width = 8,
},
[PCA9548] = {
.enable = 0x8,
.muxtype = pca954x_isswi,
+ .width = 8,
},
};
@@ -89,13 +93,14 @@ static const struct udevice_id pca954x_ids[] = {
static int pca954x_ofdata_to_platdata(struct udevice *dev)
{
struct pca954x_priv *priv = dev_get_priv(dev);
+ const struct chip_desc *chip = &chips[dev_get_driver_data(dev)];
priv->addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
if (!priv->addr) {
debug("MUX not found\n");
return -ENODEV;
}
- priv->width = dev_get_driver_data(dev);
+ priv->width = chip->width;
if (!priv->width) {
debug("No I2C MUX width specified\n");
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index b7bb76c0ed..abf1da2ae3 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -176,7 +176,7 @@ static int bus_i2c_set_bus_speed(struct mxc_i2c_bus *i2c_bus, int speed)
int reg_shift = quirk ? VF610_I2C_REGSHIFT : IMX_I2C_REGSHIFT;
if (!base)
- return -ENODEV;
+ return -EINVAL;
/* Store divider value */
writeb(idx, base + (IFDR << reg_shift));
@@ -239,7 +239,7 @@ static int tx_byte(struct mxc_i2c_bus *i2c_bus, u8 byte)
if (ret < 0)
return ret;
if (ret & I2SR_RX_NO_AK)
- return -ENODEV;
+ return -EREMOTEIO;
return 0;
}
@@ -418,14 +418,14 @@ static int i2c_init_transfer(struct mxc_i2c_bus *i2c_bus, u8 chip,
VF610_I2C_REGSHIFT : IMX_I2C_REGSHIFT;
if (!i2c_bus->base)
- return -ENODEV;
+ return -EINVAL;
for (retry = 0; retry < 3; retry++) {
ret = i2c_init_transfer_(i2c_bus, chip, addr, alen);
if (ret >= 0)
return 0;
i2c_imx_stop(i2c_bus);
- if (ret == -ENODEV)
+ if (ret == -EREMOTEIO)
return ret;
printf("%s: failed for chip 0x%x retry=%d\n", __func__, chip,
@@ -754,7 +754,7 @@ static int mxc_i2c_probe(struct udevice *bus)
addr = devfdt_get_addr(bus);
if (addr == FDT_ADDR_T_NONE)
- return -ENODEV;
+ return -EINVAL;
i2c_bus->base = addr;
i2c_bus->index = bus->seq;
@@ -783,7 +783,7 @@ static int mxc_i2c_probe(struct udevice *bus)
!dm_gpio_is_valid(&i2c_bus->scl_gpio) |
ret | ret2) {
dev_err(dev, "i2c bus %d at %lu, fail to request scl/sda gpio\n", bus->seq, i2c_bus->base);
- return -ENODEV;
+ return -EINVAL;
}
}
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index c98c6276dd..5d33815146 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -755,7 +755,7 @@ static uint omap24_i2c_setspeed(struct i2c_adapter *adap, uint speed)
ret = __omap24_i2c_setspeed(i2c_base, speed, &adap->waitdelay);
if (ret) {
- error("%s: set i2c speed failed\n", __func__);
+ pr_err("%s: set i2c speed failed\n", __func__);
return ret;
}
diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
index bf5fefab7b..196f2365ea 100644
--- a/drivers/i2c/stm32f7_i2c.c
+++ b/drivers/i2c/stm32f7_i2c.c
@@ -549,7 +549,7 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup,
}
if (list_empty(solutions)) {
- error("%s: no Prescaler solution\n", __func__);
+ pr_err("%s: no Prescaler solution\n", __func__);
ret = -EPERM;
}
@@ -627,7 +627,7 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup,
}
if (!s) {
- error("%s: no solution at all\n", __func__);
+ pr_err("%s: no solution at all\n", __func__);
ret = -EPERM;
}
@@ -643,14 +643,14 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv,
int ret;
if (setup->speed >= STM32_I2C_SPEED_END) {
- error("%s: speed out of bound {%d/%d}\n", __func__,
+ pr_err("%s: speed out of bound {%d/%d}\n", __func__,
setup->speed, STM32_I2C_SPEED_END - 1);
return -EINVAL;
}
if ((setup->rise_time > i2c_specs[setup->speed].rise_max) ||
(setup->fall_time > i2c_specs[setup->speed].fall_max)) {
- error("%s :timings out of bound Rise{%d>%d}/Fall{%d>%d}\n",
+ pr_err("%s :timings out of bound Rise{%d>%d}/Fall{%d>%d}\n",
__func__,
setup->rise_time, i2c_specs[setup->speed].rise_max,
setup->fall_time, i2c_specs[setup->speed].fall_max);
@@ -658,13 +658,13 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv,
}
if (setup->dnf > STM32_I2C_DNF_MAX) {
- error("%s: DNF out of bound %d/%d\n", __func__,
+ pr_err("%s: DNF out of bound %d/%d\n", __func__,
setup->dnf, STM32_I2C_DNF_MAX);
return -EINVAL;
}
if (setup->speed_freq > i2c_specs[setup->speed].rate) {
- error("%s: Freq {%d/%d}\n", __func__,
+ pr_err("%s: Freq {%d/%d}\n", __func__,
setup->speed_freq, i2c_specs[setup->speed].rate);
return -EINVAL;
}
@@ -711,7 +711,7 @@ static int stm32_i2c_setup_timing(struct stm32_i2c_priv *i2c_priv,
setup->clock_src = clk_get_rate(&i2c_priv->clk);
if (!setup->clock_src) {
- error("%s: clock rate is 0\n", __func__);
+ pr_err("%s: clock rate is 0\n", __func__);
return -EINVAL;
}
@@ -734,7 +734,7 @@ static int stm32_i2c_setup_timing(struct stm32_i2c_priv *i2c_priv,
} while (ret);
if (ret) {
- error("%s: impossible to compute I2C timings.\n", __func__);
+ pr_err("%s: impossible to compute I2C timings.\n", __func__);
return ret;
}
diff --git a/drivers/i2c/tegra186_bpmp_i2c.c b/drivers/i2c/tegra186_bpmp_i2c.c
index 931c6de508..b46a09a4e0 100644
--- a/drivers/i2c/tegra186_bpmp_i2c.c
+++ b/drivers/i2c/tegra186_bpmp_i2c.c
@@ -94,7 +94,7 @@ static int tegra186_bpmp_i2c_probe(struct udevice *dev)
"nvidia,bpmp-bus-id", U32_MAX);
if (priv->bpmp_bus_id == U32_MAX) {
debug("%s: could not parse nvidia,bpmp-bus-id\n", __func__);
- return -ENODEV;
+ return -EINVAL;
}
return 0;
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 3255e8ed37..7d23e51b69 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -372,12 +372,12 @@ static int tegra_i2c_probe(struct udevice *dev)
ret = reset_get_by_name(dev, "i2c", &i2c_bus->reset_ctl);
if (ret) {
- error("reset_get_by_name() failed: %d\n", ret);
+ pr_err("reset_get_by_name() failed: %d\n", ret);
return ret;
}
ret = clk_get_by_name(dev, "div-clk", &i2c_bus->clk);
if (ret) {
- error("clk_get_by_name() failed: %d\n", ret);
+ pr_err("clk_get_by_name() failed: %d\n", ret);
return ret;
}