summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2017-09-29 10:53:36 +1300
committerHeiko Schocher <hs@denx.de>2017-10-11 06:17:22 +0200
commit5bc90a8953a902152bd640322ffc8111dccbe3ab (patch)
treedcb31609ff5744d36595d474bbcd64d1cfe33a89 /drivers
parent45c9d96ae40b0c4292eb67d687f0bf698a0ce72b (diff)
downloadu-boot-5bc90a8953a902152bd640322ffc8111dccbe3ab.tar.gz
u-boot-5bc90a8953a902152bd640322ffc8111dccbe3ab.tar.xz
u-boot-5bc90a8953a902152bd640322ffc8111dccbe3ab.zip
i2c: muxes: pca954x: look up width from chip_desc
Commit 8e6eda7cda6c ("drivers/i2c/muxes/pca954x: Add pca9547 I2C mux support") introduced a chip_desc for the pca954x devices but failed to update pca954x_ofdata_to_platdata() to be aware of it. Make pca954x_ofdata_to_platdata() lookup the chip_desc to validate the device width. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Marek Behun <marek.behun@nic.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/muxes/pca954x.c7
1 files changed, 6 insertions, 1 deletions
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");