Commit 00baabe5 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

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: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 877b7cb0
...@@ -4386,7 +4386,6 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) ...@@ -4386,7 +4386,6 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
const struct mv88e6xxx_info *compat_info; const struct mv88e6xxx_info *compat_info;
struct mv88e6xxx_chip *chip; struct mv88e6xxx_chip *chip;
u32 eeprom_len;
int port; int port;
int err; int err;
...@@ -4436,9 +4435,13 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) ...@@ -4436,9 +4435,13 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
mv88e6xxx_phy_init(chip); mv88e6xxx_phy_init(chip);
if (chip->info->ops->get_eeprom && if (chip->info->ops->get_eeprom) {
!of_property_read_u32(np, "eeprom-length", &eeprom_len)) if (np)
chip->eeprom_len = eeprom_len; of_property_read_u32(np, "eeprom-length",
&chip->eeprom_len);
else
chip->eeprom_len = pdata->eeprom_len;
}
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
err = mv88e6xxx_switch_reset(chip); err = mv88e6xxx_switch_reset(chip);
......
...@@ -238,7 +238,7 @@ struct mv88e6xxx_chip { ...@@ -238,7 +238,7 @@ struct mv88e6xxx_chip {
struct gpio_desc *reset; struct gpio_desc *reset;
/* set to size of eeprom if supported by the switch */ /* set to size of eeprom if supported by the switch */
int eeprom_len; u32 eeprom_len;
/* List of mdio busses */ /* List of mdio busses */
struct list_head mdios; struct list_head mdios;
......
...@@ -12,6 +12,7 @@ struct dsa_mv88e6xxx_pdata { ...@@ -12,6 +12,7 @@ struct dsa_mv88e6xxx_pdata {
const char *compatible; const char *compatible;
unsigned int enabled_ports; unsigned int enabled_ports;
struct net_device *netdev; struct net_device *netdev;
u32 eeprom_len;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment