diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-gpio.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-uniphier-f.c | 114 | ||||
-rw-r--r-- | drivers/i2c/i2c-uniphier.c | 63 | ||||
-rw-r--r-- | drivers/i2c/imx_lpi2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/muxes/pca954x.c | 7 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 12 | ||||
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/rk_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/stm32f7_i2c.c | 16 | ||||
-rw-r--r-- | drivers/i2c/tegra186_bpmp_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/tegra_i2c.c | 4 |
11 files changed, 112 insertions, 113 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/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index e51537b80e..eb6c9f3d20 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -6,13 +6,12 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include <common.h> -#include <dm.h> -#include <linux/types.h> +#include <linux/errno.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/sizes.h> -#include <linux/errno.h> +#include <linux/types.h> +#include <dm.h> #include <i2c.h> #include <fdtdec.h> @@ -64,35 +63,27 @@ struct uniphier_fi2c_regs { #define FIOCLK 50000000 -struct uniphier_fi2c_dev { +struct uniphier_fi2c_priv { + struct udevice *dev; struct uniphier_fi2c_regs __iomem *regs; /* register base */ unsigned long fioclk; /* internal operation clock */ unsigned long timeout; /* time out (us) */ }; -static int reset_bus(struct uniphier_fi2c_regs __iomem *regs) +static void uniphier_fi2c_reset(struct uniphier_fi2c_priv *priv) { - u32 val; - int ret; - - /* bus forcible reset */ - writel(I2C_RST_RST, ®s->rst); - ret = readl_poll_timeout(®s->rst, val, !(val & I2C_RST_RST), 1); - if (ret < 0) - debug("error: fail to reset I2C controller\n"); - - return ret; + writel(I2C_RST_RST, &priv->regs->rst); } -static int check_device_busy(struct uniphier_fi2c_regs __iomem *regs) +static int uniphier_fi2c_check_bus_busy(struct uniphier_fi2c_priv *priv) { u32 val; int ret; - ret = readl_poll_timeout(®s->sr, val, !(val & I2C_SR_DB), 100); + ret = readl_poll_timeout(&priv->regs->sr, val, !(val & I2C_SR_DB), 100); if (ret < 0) { - debug("error: device busy too long. reset...\n"); - ret = reset_bus(regs); + dev_dbg(priv->dev, "error: device busy too long. reset...\n"); + uniphier_fi2c_reset(priv); } return ret; @@ -101,8 +92,7 @@ static int check_device_busy(struct uniphier_fi2c_regs __iomem *regs) static int uniphier_fi2c_probe(struct udevice *dev) { fdt_addr_t addr; - struct uniphier_fi2c_dev *priv = dev_get_priv(dev); - int ret; + struct uniphier_fi2c_priv *priv = dev_get_priv(dev); addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) @@ -114,85 +104,85 @@ static int uniphier_fi2c_probe(struct udevice *dev) priv->fioclk = FIOCLK; + priv->dev = dev; + /* bus forcible reset */ - ret = reset_bus(priv->regs); - if (ret < 0) - return ret; + uniphier_fi2c_reset(priv); writel(I2C_BRST_FOEN | I2C_BRST_RSCLO, &priv->regs->brst); return 0; } -static int wait_for_irq(struct uniphier_fi2c_dev *dev, u32 flags, +static int wait_for_irq(struct uniphier_fi2c_priv *priv, u32 flags, bool *stop) { u32 irq; int ret; - ret = readl_poll_timeout(&dev->regs->intr, irq, irq & flags, - dev->timeout); + ret = readl_poll_timeout(&priv->regs->intr, irq, irq & flags, + priv->timeout); if (ret < 0) { - debug("error: time out\n"); + dev_dbg(priv->dev, "error: time out\n"); return ret; } if (irq & I2C_INT_AL) { - debug("error: arbitration lost\n"); + dev_dbg(priv->dev, "error: arbitration lost\n"); *stop = false; return ret; } if (irq & I2C_INT_NA) { - debug("error: no answer\n"); + dev_dbg(priv->dev, "error: no answer\n"); return ret; } return 0; } -static int issue_stop(struct uniphier_fi2c_dev *dev, int old_ret) +static int issue_stop(struct uniphier_fi2c_priv *priv, int old_ret) { int ret; - debug("stop condition\n"); - writel(I2C_CR_MST | I2C_CR_STO, &dev->regs->cr); + dev_dbg(priv->dev, "stop condition\n"); + writel(I2C_CR_MST | I2C_CR_STO, &priv->regs->cr); - ret = check_device_busy(dev->regs); + ret = uniphier_fi2c_check_bus_busy(priv); if (ret < 0) - debug("error: device busy after operation\n"); + dev_dbg(priv->dev, "error: device busy after operation\n"); return old_ret ? old_ret : ret; } -static int uniphier_fi2c_transmit(struct uniphier_fi2c_dev *dev, uint addr, +static int uniphier_fi2c_transmit(struct uniphier_fi2c_priv *priv, uint addr, uint len, const u8 *buf, bool *stop) { int ret; const u32 irq_flags = I2C_INT_TE | I2C_INT_NA | I2C_INT_AL; - struct uniphier_fi2c_regs __iomem *regs = dev->regs; + struct uniphier_fi2c_regs __iomem *regs = priv->regs; - debug("%s: addr = %x, len = %d\n", __func__, addr, len); + dev_dbg(priv->dev, "%s: addr = %x, len = %d\n", __func__, addr, len); writel(I2C_DTTX_CMD | addr << 1, ®s->dttx); writel(irq_flags, ®s->ie); writel(irq_flags, ®s->ic); - debug("start condition\n"); + dev_dbg(priv->dev, "start condition\n"); writel(I2C_CR_MST | I2C_CR_STA, ®s->cr); - ret = wait_for_irq(dev, irq_flags, stop); + ret = wait_for_irq(priv, irq_flags, stop); if (ret < 0) goto error; while (len--) { - debug("sending %x\n", *buf); + dev_dbg(priv->dev, "sending %x\n", *buf); writel(*buf++, ®s->dttx); writel(irq_flags, ®s->ic); - ret = wait_for_irq(dev, irq_flags, stop); + ret = wait_for_irq(priv, irq_flags, stop); if (ret < 0) goto error; } @@ -201,26 +191,26 @@ error: writel(irq_flags, ®s->ic); if (*stop) - ret = issue_stop(dev, ret); + ret = issue_stop(priv, ret); return ret; } -static int uniphier_fi2c_receive(struct uniphier_fi2c_dev *dev, uint addr, +static int uniphier_fi2c_receive(struct uniphier_fi2c_priv *priv, uint addr, uint len, u8 *buf, bool *stop) { int ret = 0; const u32 irq_flags = I2C_INT_RB | I2C_INT_NA | I2C_INT_AL; - struct uniphier_fi2c_regs __iomem *regs = dev->regs; + struct uniphier_fi2c_regs __iomem *regs = priv->regs; - debug("%s: addr = %x, len = %d\n", __func__, addr, len); + dev_dbg(priv->dev, "%s: addr = %x, len = %d\n", __func__, addr, len); /* * In case 'len == 0', only the slave address should be sent * for probing, which is covered by the transmit function. */ if (len == 0) - return uniphier_fi2c_transmit(dev, addr, len, buf, stop); + return uniphier_fi2c_transmit(priv, addr, len, buf, stop); writel(I2C_DTTX_CMD | I2C_DTTX_RD | addr << 1, ®s->dttx); @@ -228,17 +218,17 @@ static int uniphier_fi2c_receive(struct uniphier_fi2c_dev *dev, uint addr, writel(irq_flags, ®s->ie); writel(irq_flags, ®s->ic); - debug("start condition\n"); + dev_dbg(priv->dev, "start condition\n"); writel(I2C_CR_MST | I2C_CR_STA | (len == 1 ? I2C_CR_NACK : 0), ®s->cr); while (len--) { - ret = wait_for_irq(dev, irq_flags, stop); + ret = wait_for_irq(priv, irq_flags, stop); if (ret < 0) goto error; *buf++ = readl(®s->dtrx); - debug("received %x\n", *(buf - 1)); + dev_dbg(priv->dev, "received %x\n", *(buf - 1)); if (len == 1) writel(I2C_CR_MST | I2C_CR_NACK, ®s->cr); @@ -250,7 +240,7 @@ error: writel(irq_flags, ®s->ic); if (*stop) - ret = issue_stop(dev, ret); + ret = issue_stop(priv, ret); return ret; } @@ -259,10 +249,10 @@ static int uniphier_fi2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) { int ret; - struct uniphier_fi2c_dev *dev = dev_get_priv(bus); + struct uniphier_fi2c_priv *priv = dev_get_priv(bus); bool stop; - ret = check_device_busy(dev->regs); + ret = uniphier_fi2c_check_bus_busy(priv); if (ret < 0) return ret; @@ -271,10 +261,10 @@ static int uniphier_fi2c_xfer(struct udevice *bus, struct i2c_msg *msg, stop = nmsgs > 1 && msg[1].flags & I2C_M_RD ? false : true; if (msg->flags & I2C_M_RD) - ret = uniphier_fi2c_receive(dev, msg->addr, msg->len, + ret = uniphier_fi2c_receive(priv, msg->addr, msg->len, msg->buf, &stop); else - ret = uniphier_fi2c_transmit(dev, msg->addr, msg->len, + ret = uniphier_fi2c_transmit(priv, msg->addr, msg->len, msg->buf, &stop); if (ret < 0) @@ -288,21 +278,21 @@ static int uniphier_fi2c_set_bus_speed(struct udevice *bus, unsigned int speed) { int ret; unsigned int clk_count; - struct uniphier_fi2c_dev *dev = dev_get_priv(bus); - struct uniphier_fi2c_regs __iomem *regs = dev->regs; + struct uniphier_fi2c_priv *priv = dev_get_priv(bus); + struct uniphier_fi2c_regs __iomem *regs = priv->regs; /* max supported frequency is 400 kHz */ if (speed > 400000) return -EINVAL; - ret = check_device_busy(dev->regs); + ret = uniphier_fi2c_check_bus_busy(priv); if (ret < 0) return ret; /* make sure the bus is idle when changing the frequency */ writel(I2C_BRST_RSCLO, ®s->brst); - clk_count = dev->fioclk / speed; + clk_count = priv->fioclk / speed; writel(clk_count, ®s->cyc); writel(clk_count / 2, ®s->lctl); @@ -316,7 +306,7 @@ static int uniphier_fi2c_set_bus_speed(struct udevice *bus, unsigned int speed) * 1000000 * 9 / speed usec. * This time out value is long enough. */ - dev->timeout = 100000000L / speed; + priv->timeout = 100000000L / speed; return 0; } @@ -336,6 +326,6 @@ U_BOOT_DRIVER(uniphier_fi2c) = { .id = UCLASS_I2C, .of_match = uniphier_fi2c_of_match, .probe = uniphier_fi2c_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_fi2c_dev), + .priv_auto_alloc_size = sizeof(struct uniphier_fi2c_priv), .ops = &uniphier_fi2c_ops, }; diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index 3412e2a189..0f2734eb02 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -6,14 +6,14 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include <common.h> -#include <dm.h> -#include <linux/types.h> +#include <linux/delay.h> +#include <linux/errno.h> #include <linux/io.h> #include <linux/sizes.h> -#include <linux/errno.h> -#include <i2c.h> +#include <linux/types.h> +#include <dm.h> #include <fdtdec.h> +#include <i2c.h> struct uniphier_i2c_regs { u32 dtrm; /* data transmission */ @@ -38,7 +38,8 @@ struct uniphier_i2c_regs { #define IOBUS_FREQ 100000000 -struct uniphier_i2c_dev { +struct uniphier_i2c_priv { + struct udevice *dev; struct uniphier_i2c_regs __iomem *regs; /* register base */ unsigned long input_clk; /* master clock (Hz) */ unsigned long wait_us; /* wait for every byte transfer (us) */ @@ -47,7 +48,7 @@ struct uniphier_i2c_dev { static int uniphier_i2c_probe(struct udevice *dev) { fdt_addr_t addr; - struct uniphier_i2c_dev *priv = dev_get_priv(dev); + struct uniphier_i2c_priv *priv = dev_get_priv(dev); addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) @@ -59,15 +60,17 @@ static int uniphier_i2c_probe(struct udevice *dev) priv->input_clk = IOBUS_FREQ; + priv->dev = dev; + /* deassert reset */ writel(0x3, &priv->regs->brst); return 0; } -static int send_and_recv_byte(struct uniphier_i2c_dev *dev, u32 dtrm) +static int send_and_recv_byte(struct uniphier_i2c_priv *priv, u32 dtrm) { - writel(dtrm, &dev->regs->dtrm); + writel(dtrm, &priv->regs->dtrm); /* * This controller only provides interruption to inform the completion @@ -75,72 +78,72 @@ static int send_and_recv_byte(struct uniphier_i2c_dev *dev, u32 dtrm) * Unfortunately, U-Boot does not have a good support of interrupt. * Wait for a while. */ - udelay(dev->wait_us); + udelay(priv->wait_us); - return readl(&dev->regs->drec); + return readl(&priv->regs->drec); } -static int send_byte(struct uniphier_i2c_dev *dev, u32 dtrm, bool *stop) +static int send_byte(struct uniphier_i2c_priv *priv, u32 dtrm, bool *stop) { int ret = 0; u32 drec; - drec = send_and_recv_byte(dev, dtrm); + drec = send_and_recv_byte(priv, dtrm); if (drec & I2C_DREC_LAB) { - debug("uniphier_i2c: bus arbitration failed\n"); + dev_dbg(priv->dev, "uniphier_i2c: bus arbitration failed\n"); *stop = false; ret = -EREMOTEIO; } if (drec & I2C_DREC_LRB) { - debug("uniphier_i2c: slave did not return ACK\n"); + dev_dbg(priv->dev, "uniphier_i2c: slave did not return ACK\n"); ret = -EREMOTEIO; } return ret; } -static int uniphier_i2c_transmit(struct uniphier_i2c_dev *dev, uint addr, +static int uniphier_i2c_transmit(struct uniphier_i2c_priv *priv, uint addr, uint len, const u8 *buf, bool *stop) { int ret; - debug("%s: addr = %x, len = %d\n", __func__, addr, len); + dev_dbg(priv->dev, "%s: addr = %x, len = %d\n", __func__, addr, len); - ret = send_byte(dev, I2C_DTRM_STA | I2C_DTRM_NACK | addr << 1, stop); + ret = send_byte(priv, I2C_DTRM_STA | I2C_DTRM_NACK | addr << 1, stop); if (ret < 0) goto fail; while (len--) { - ret = send_byte(dev, I2C_DTRM_NACK | *buf++, stop); + ret = send_byte(priv, I2C_DTRM_NACK | *buf++, stop); if (ret < 0) goto fail; } fail: if (*stop) - writel(I2C_DTRM_STO | I2C_DTRM_NACK, &dev->regs->dtrm); + writel(I2C_DTRM_STO | I2C_DTRM_NACK, &priv->regs->dtrm); return ret; } -static int uniphier_i2c_receive(struct uniphier_i2c_dev *dev, uint addr, +static int uniphier_i2c_receive(struct uniphier_i2c_priv *priv, uint addr, uint len, u8 *buf, bool *stop) { int ret; - debug("%s: addr = %x, len = %d\n", __func__, addr, len); + dev_dbg(priv->dev, "%s: addr = %x, len = %d\n", __func__, addr, len); - ret = send_byte(dev, I2C_DTRM_STA | I2C_DTRM_NACK | + ret = send_byte(priv, I2C_DTRM_STA | I2C_DTRM_NACK | I2C_DTRM_RD | addr << 1, stop); if (ret < 0) goto fail; while (len--) - *buf++ = send_and_recv_byte(dev, len ? 0 : I2C_DTRM_NACK); + *buf++ = send_and_recv_byte(priv, len ? 0 : I2C_DTRM_NACK); fail: if (*stop) - writel(I2C_DTRM_STO | I2C_DTRM_NACK, &dev->regs->dtrm); + writel(I2C_DTRM_STO | I2C_DTRM_NACK, &priv->regs->dtrm); return ret; } @@ -149,7 +152,7 @@ static int uniphier_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) { int ret = 0; - struct uniphier_i2c_dev *dev = dev_get_priv(bus); + struct uniphier_i2c_priv *priv = dev_get_priv(bus); bool stop; for (; nmsgs > 0; nmsgs--, msg++) { @@ -157,10 +160,10 @@ static int uniphier_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, stop = nmsgs > 1 && msg[1].flags & I2C_M_RD ? false : true; if (msg->flags & I2C_M_RD) - ret = uniphier_i2c_receive(dev, msg->addr, msg->len, + ret = uniphier_i2c_receive(priv, msg->addr, msg->len, msg->buf, &stop); else - ret = uniphier_i2c_transmit(dev, msg->addr, msg->len, + ret = uniphier_i2c_transmit(priv, msg->addr, msg->len, msg->buf, &stop); if (ret < 0) @@ -172,7 +175,7 @@ static int uniphier_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, static int uniphier_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) { - struct uniphier_i2c_dev *priv = dev_get_priv(bus); + struct uniphier_i2c_priv *priv = dev_get_priv(bus); /* max supported frequency is 400 kHz */ if (speed > 400000) @@ -211,6 +214,6 @@ U_BOOT_DRIVER(uniphier_i2c) = { .id = UCLASS_I2C, .of_match = uniphier_i2c_of_match, .probe = uniphier_i2c_probe, - .priv_auto_alloc_size = sizeof(struct uniphier_i2c_dev), + .priv_auto_alloc_size = sizeof(struct uniphier_i2c_priv), .ops = &uniphier_i2c_ops, }; 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/rk_i2c.c b/drivers/i2c/rk_i2c.c index 840b3f6046..332280c220 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -396,6 +396,7 @@ static const struct udevice_id rockchip_i2c_ids[] = { { .compatible = "rockchip,rk3066-i2c" }, { .compatible = "rockchip,rk3188-i2c" }, { .compatible = "rockchip,rk3288-i2c" }, + { .compatible = "rockchip,rk3328-i2c" }, { .compatible = "rockchip,rk3399-i2c" }, { } }; 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; } |