Skip to content
Snippets Groups Projects
Commit 1b22c5ba authored by Tom Rini's avatar Tom Rini
Browse files
parents 2ee87b0c 5bc90a89
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ struct chip_desc { ...@@ -27,6 +27,7 @@ struct chip_desc {
pca954x_ismux = 0, pca954x_ismux = 0,
pca954x_isswi, pca954x_isswi,
} muxtype; } muxtype;
u32 width;
}; };
struct pca954x_priv { struct pca954x_priv {
...@@ -39,14 +40,17 @@ static const struct chip_desc chips[] = { ...@@ -39,14 +40,17 @@ static const struct chip_desc chips[] = {
[PCA9544] = { [PCA9544] = {
.enable = 0x4, .enable = 0x4,
.muxtype = pca954x_ismux, .muxtype = pca954x_ismux,
.width = 4,
}, },
[PCA9547] = { [PCA9547] = {
.enable = 0x8, .enable = 0x8,
.muxtype = pca954x_ismux, .muxtype = pca954x_ismux,
.width = 8,
}, },
[PCA9548] = { [PCA9548] = {
.enable = 0x8, .enable = 0x8,
.muxtype = pca954x_isswi, .muxtype = pca954x_isswi,
.width = 8,
}, },
}; };
...@@ -89,13 +93,14 @@ static const struct udevice_id pca954x_ids[] = { ...@@ -89,13 +93,14 @@ static const struct udevice_id pca954x_ids[] = {
static int pca954x_ofdata_to_platdata(struct udevice *dev) static int pca954x_ofdata_to_platdata(struct udevice *dev)
{ {
struct pca954x_priv *priv = dev_get_priv(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); priv->addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
if (!priv->addr) { if (!priv->addr) {
debug("MUX not found\n"); debug("MUX not found\n");
return -ENODEV; return -ENODEV;
} }
priv->width = dev_get_driver_data(dev); priv->width = chip->width;
if (!priv->width) { if (!priv->width) {
debug("No I2C MUX width specified\n"); debug("No I2C MUX width specified\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment