diff options
author | Andrew Lunn <andrew@lunn.ch> | 2018-05-19 23:31:35 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-21 01:58:27 +0300 |
commit | 00baabe5286c41d21ed4a78f479b021eba1f0d51 (patch) | |
tree | 4d8fee548a2e1e414b8bd9bb59725294e2be170d /drivers/net/dsa | |
parent | 877b7cb0b6f283593a663134ee52703f12c895cc (diff) | |
download | linux-00baabe5286c41d21ed4a78f479b021eba1f0d51.tar.xz |
net: dsa: mv88e6xxx: Add support for EEPROM via platform data
Add the size of the EEPROM to the platform data, so it can also be
instantiated by a platform device.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 11 | ||||
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.h | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 5b40382036ea..1fa1f820a437 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -4386,7 +4386,6 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) struct device_node *np = dev->of_node; const struct mv88e6xxx_info *compat_info; struct mv88e6xxx_chip *chip; - u32 eeprom_len; int port; int err; @@ -4436,9 +4435,13 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) mv88e6xxx_phy_init(chip); - if (chip->info->ops->get_eeprom && - !of_property_read_u32(np, "eeprom-length", &eeprom_len)) - chip->eeprom_len = eeprom_len; + if (chip->info->ops->get_eeprom) { + if (np) + of_property_read_u32(np, "eeprom-length", + &chip->eeprom_len); + else + chip->eeprom_len = pdata->eeprom_len; + } mutex_lock(&chip->reg_lock); err = mv88e6xxx_switch_reset(chip); diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 012268046442..8ac3fbb15352 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -238,7 +238,7 @@ struct mv88e6xxx_chip { struct gpio_desc *reset; /* set to size of eeprom if supported by the switch */ - int eeprom_len; + u32 eeprom_len; /* List of mdio busses */ struct list_head mdios; |