summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mv88e6xxx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/mv88e6xxx')
-rw-r--r--drivers/net/phy/mv88e6xxx/Makefile1
-rw-r--r--drivers/net/phy/mv88e6xxx/chip.c57
-rw-r--r--drivers/net/phy/mv88e6xxx/chip.h4
-rw-r--r--drivers/net/phy/mv88e6xxx/global2.c1
-rw-r--r--drivers/net/phy/mv88e6xxx/global2.h1
-rw-r--r--drivers/net/phy/mv88e6xxx/port.c33
-rw-r--r--drivers/net/phy/mv88e6xxx/port.h3
7 files changed, 71 insertions, 29 deletions
diff --git a/drivers/net/phy/mv88e6xxx/Makefile b/drivers/net/phy/mv88e6xxx/Makefile
index e1d4b1b9d7..4f569509e5 100644
--- a/drivers/net/phy/mv88e6xxx/Makefile
+++ b/drivers/net/phy/mv88e6xxx/Makefile
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
obj-y += mv88e6xxx.o
mv88e6xxx-objs := chip.o
diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
index b1bffe5cbc..b9b02c52f2 100644
--- a/drivers/net/phy/mv88e6xxx/chip.c
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <init.h>
#include <linux/mii.h>
@@ -35,6 +36,7 @@ enum mv88e6xxx_model {
MV88E6190X,
MV88E6191,
MV88E6240,
+ MV88E6250,
MV88E6290,
MV88E6320,
MV88E6321,
@@ -223,6 +225,18 @@ static const struct mv88e6xxx_ops mv88e6240_ops = {
.port_link_state = mv88e6352_port_link_state,
};
+static const struct mv88e6xxx_ops mv88e6250_ops = {
+ /* MV88E6XXX_FAMILY_6250 */
+ .get_eeprom = mv88e6xxx_g2_get_eeprom16,
+ .set_eeprom = mv88e6xxx_g2_set_eeprom16,
+ .phy_read = mv88e6xxx_g2_smi_phy_read,
+ .phy_write = mv88e6xxx_g2_smi_phy_write,
+ .port_set_link = mv88e6xxx_port_set_link,
+ .port_set_duplex = mv88e6xxx_port_set_duplex,
+ .port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+ .port_set_speed = mv88e6250_port_set_speed,
+};
+
static const struct mv88e6xxx_ops mv88e6290_ops = {
/* MV88E6XXX_FAMILY_6390 */
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
@@ -524,6 +538,17 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.ops = &mv88e6240_ops,
},
+ [MV88E6250] = {
+ .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6250,
+ .family = MV88E6XXX_FAMILY_6250,
+ .name = "Marvell 88E6250",
+ .num_ports = 7,
+ .port_base_addr = 0x08,
+ .global1_addr = 0xf,
+ .global2_addr = 0x7,
+ .ops = &mv88e6250_ops,
+ },
+
[MV88E6290] = {
.prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6290,
.family = MV88E6XXX_FAMILY_6390,
@@ -779,10 +804,9 @@ static int mv88e6xxx_switch_reset(struct mv88e6xxx_chip *chip)
return 0;
}
-static int mv88e6xxx_eeprom_read(struct device_d *dev, const int offset,
- void *val, int bytes)
+static int mv88e6xxx_eeprom_read(void *ctx, unsigned offset, void *val, size_t bytes)
{
- struct mv88e6xxx_chip *chip = dev->parent->priv;
+ struct mv88e6xxx_chip *chip = ctx;
struct ethtool_eeprom eeprom = {
.offset = offset,
.len = bytes,
@@ -794,10 +818,9 @@ static int mv88e6xxx_eeprom_read(struct device_d *dev, const int offset,
return chip->info->ops->get_eeprom(chip, &eeprom, val);
}
-static int mv88e6xxx_eeprom_write(struct device_d *dev, const int offset,
- const void *val, int bytes)
+static int mv88e6xxx_eeprom_write(void *ctx, unsigned offset, const void *val, size_t bytes)
{
- struct mv88e6xxx_chip *chip = dev->parent->priv;
+ struct mv88e6xxx_chip *chip = ctx;
struct ethtool_eeprom eeprom = {
.offset = offset,
.len = bytes,
@@ -809,14 +832,9 @@ static int mv88e6xxx_eeprom_write(struct device_d *dev, const int offset,
return chip->info->ops->set_eeprom(chip, &eeprom, (void *)val);
}
-static const struct nvmem_bus mv88e6xxx_eeprom_nvmem_bus = {
- .write = mv88e6xxx_eeprom_write,
- .read = mv88e6xxx_eeprom_read,
-};
-
-static int mv88e6xxx_probe(struct device_d *dev)
+static int mv88e6xxx_probe(struct device *dev)
{
- struct device_node *np = dev->device_node;
+ struct device_node *np = dev->of_node;
struct device_node *mdio_node;
struct mv88e6xxx_chip *chip;
enum of_gpio_flags of_flags;
@@ -883,11 +901,13 @@ static int mv88e6xxx_probe(struct device_d *dev)
struct nvmem_config config = {
.name = basprintf("%s-eeprom", dev_name(dev)),
.dev = dev,
+ .priv = chip,
.word_size = 1,
.stride = 1,
.size = eeprom_len,
.read_only = false,
- .bus = &mv88e6xxx_eeprom_nvmem_bus,
+ .reg_write = mv88e6xxx_eeprom_write,
+ .reg_read = mv88e6xxx_eeprom_read,
};
if (IS_ERR(nvmem_register(&config)))
@@ -917,7 +937,7 @@ static int mv88e6xxx_probe(struct device_d *dev)
mdio_node = of_get_child_by_name(np, "mdio");
if (mdio_node)
- chip->miibus.dev.device_node = mdio_node;
+ chip->miibus.dev.of_node = mdio_node;
err = mv88e6xxx_port_probe(chip);
if (err)
@@ -932,13 +952,18 @@ static const struct of_device_id mv88e6xxx_of_match[] = {
.data = &mv88e6xxx_table[MV88E6085],
},
{
+ .compatible = "marvell,mv88e6250",
+ .data = &mv88e6xxx_table[MV88E6250],
+ },
+ {
.compatible = "marvell,mv88e6190",
.data = &mv88e6xxx_table[MV88E6190],
},
{},
};
+MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match);
-static struct driver_d mv88e6xxx_driver = {
+static struct driver mv88e6xxx_driver = {
.name = "mv88e6085",
.probe = mv88e6xxx_probe,
.of_compatible = mv88e6xxx_of_match,
diff --git a/drivers/net/phy/mv88e6xxx/chip.h b/drivers/net/phy/mv88e6xxx/chip.h
index 57f74a39a0..aec6c2891f 100644
--- a/drivers/net/phy/mv88e6xxx/chip.h
+++ b/drivers/net/phy/mv88e6xxx/chip.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _MV88E6XXX_CHIP_H
#define _MV88E6XXX_CHIP_H
@@ -18,6 +19,7 @@ enum mv88e6xxx_family {
MV88E6XXX_FAMILY_6165, /* 6123 6161 6165 */
MV88E6XXX_FAMILY_6185, /* 6108 6121 6122 6131 6152 6155 6182 6185 */
MV88E6XXX_FAMILY_6320, /* 6320 6321 */
+ MV88E6XXX_FAMILY_6250, /* 6250 */
MV88E6XXX_FAMILY_6341, /* 6141 6341 */
MV88E6XXX_FAMILY_6351, /* 6171 6175 6350 6351 */
MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */
@@ -48,7 +50,7 @@ struct mv88e6xxx_chip {
const struct mv88e6xxx_info *info;
struct mii_bus *parent_miibus;
struct mii_bus miibus;
- struct device_d *dev;
+ struct device *dev;
int reset;
/* Array of port structures. */
diff --git a/drivers/net/phy/mv88e6xxx/global2.c b/drivers/net/phy/mv88e6xxx/global2.c
index 970a7291e7..2728a66eea 100644
--- a/drivers/net/phy/mv88e6xxx/global2.c
+++ b/drivers/net/phy/mv88e6xxx/global2.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <linux/ethtool.h>
#include <linux/bitfield.h>
diff --git a/drivers/net/phy/mv88e6xxx/global2.h b/drivers/net/phy/mv88e6xxx/global2.h
index 4e23b04232..0f2dc53c29 100644
--- a/drivers/net/phy/mv88e6xxx/global2.h
+++ b/drivers/net/phy/mv88e6xxx/global2.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _MV88E6XXX_GLOBAL2_H
#define _MV88E6XXX_GLOBAL2_H
diff --git a/drivers/net/phy/mv88e6xxx/port.c b/drivers/net/phy/mv88e6xxx/port.c
index 52f95d622c..29ea4ec882 100644
--- a/drivers/net/phy/mv88e6xxx/port.c
+++ b/drivers/net/phy/mv88e6xxx/port.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <init.h>
@@ -276,6 +277,18 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
}
+/* Support 10, 100 (e.g. 88E6250 family) */
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
+{
+ if (speed == SPEED_MAX)
+ speed = 100;
+
+ if (speed > 100)
+ return -EOPNOTSUPP;
+
+ return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
+}
+
/* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */
int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
{
@@ -547,21 +560,17 @@ static struct phy_driver mv88e6xxx_port_driver = {
.read_status = mv88e6xxx_port_read_status,
};
-static int __init mv88e6xxx_port_driver_register(void)
-{
- return phy_driver_register(&mv88e6xxx_port_driver);
-}
-fs_initcall(mv88e6xxx_port_driver_register);
+device_phy_driver(mv88e6xxx_port_driver);
int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip)
{
- struct device_d *dev = chip->dev;
- struct device_node *np = dev->device_node;
+ struct device *dev = chip->dev;
+ struct device_node *np = dev->of_node;
struct device_node *port_node, *switch_node;
struct device_node *port_nodes[DSA_MAX_PORTS] = { NULL };
int err, i;
- switch_node = of_find_node_by_name(np, "ports");
+ switch_node = of_find_node_by_name_address(np, "ports");
if (!switch_node)
return -EINVAL;
@@ -571,8 +580,8 @@ int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip)
err = of_property_read_u32(port_node, "reg", &nr);
if (err) {
dev_err(dev,
- "Error: Failed to find reg for child %s\n",
- port_node->full_name);
+ "Error: Failed to find reg for child %pOF\n",
+ port_node);
continue;
}
@@ -650,7 +659,7 @@ int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip)
phydev = phy_device_create(chip->parent_miibus,
chip->info->port_base_addr + i,
MV88E6XXX_SWITCH_PORT_PHY_ID);
- phydev->dev.device_node = port_nodes[i];
+ phydev->dev.of_node = port_nodes[i];
phydev->dev.priv = chip;
phydev->duplex = DUPLEX_UNFORCED;
@@ -660,4 +669,4 @@ int mv88e6xxx_port_probe(struct mv88e6xxx_chip *chip)
}
return 0;
-} \ No newline at end of file
+}
diff --git a/drivers/net/phy/mv88e6xxx/port.h b/drivers/net/phy/mv88e6xxx/port.h
index 07d937ecbd..4bc5072948 100644
--- a/drivers/net/phy/mv88e6xxx/port.h
+++ b/drivers/net/phy/mv88e6xxx/port.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _MV88E6XXX_PORT_H
#define _MV88E6XXX_PORT_H
@@ -89,6 +90,7 @@
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6191 0x1910
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6185 0x1a70
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6240 0x2400
+#define MV88E6XXX_PORT_SWITCH_ID_PROD_6250 0x2500
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6290 0x2900
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6321 0x3100
#define MV88E6XXX_PORT_SWITCH_ID_PROD_6141 0x3400
@@ -120,6 +122,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link);
int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup);
int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);