summaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/mvsw61xx.c
diff options
context:
space:
mode:
authorLuka Perkov <luka@openwrt.org>2015-01-11 17:20:03 +0000
committerLuka Perkov <luka@openwrt.org>2015-01-11 17:20:03 +0000
commit1e39f3aef8589eafeea6428e1a5287f30094ffa5 (patch)
tree7601e342ffa346d047bc92ba2cc2a176df587748 /target/linux/generic/files/drivers/net/phy/mvsw61xx.c
parenta1872182bb252ac9d731cbc8af0e9ddb75fc8cb0 (diff)
downloadmaster-31e0f0ae-1e39f3aef8589eafeea6428e1a5287f30094ffa5.tar.gz
master-31e0f0ae-1e39f3aef8589eafeea6428e1a5287f30094ffa5.tar.bz2
master-31e0f0ae-1e39f3aef8589eafeea6428e1a5287f30094ffa5.zip
mvsw61xx: rework chip recognition
Recognizes 88E6171/6172/6176 at the moment. Signed-off-by: Claudio Leite <leitec@staticky.com> SVN-Revision: 43936
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/mvsw61xx.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/mvsw61xx.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/mvsw61xx.c b/target/linux/generic/files/drivers/net/phy/mvsw61xx.c
index 7199de0eb2..865bd1147b 100644
--- a/target/linux/generic/files/drivers/net/phy/mvsw61xx.c
+++ b/target/linux/generic/files/drivers/net/phy/mvsw61xx.c
@@ -740,8 +740,8 @@ static int mvsw61xx_probe(struct platform_device *pdev)
struct mvsw61xx_state *state;
struct device_node *np = pdev->dev.of_node;
struct device_node *mdio;
+ char *model_str;
u32 val;
- u16 reg;
int err;
state = kzalloc(sizeof(*state), GFP_KERNEL);
@@ -776,17 +776,28 @@ static int mvsw61xx_probe(struct platform_device *pdev)
state->base_addr = MV_BASE;
}
- reg = r16(state->bus, state->is_indirect, state->base_addr,
- MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
- if (reg != MV_IDENT_VALUE) {
- dev_err(&pdev->dev, "No switch found at 0x%02x\n",
+ state->model = r16(state->bus, state->is_indirect, state->base_addr,
+ MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK;
+
+ switch(state->model) {
+ case MV_IDENT_VALUE_6171:
+ model_str = MV_IDENT_STR_6171;
+ break;
+ case MV_IDENT_VALUE_6172:
+ model_str = MV_IDENT_STR_6172;
+ break;
+ case MV_IDENT_VALUE_6176:
+ model_str = MV_IDENT_STR_6176;
+ break;
+ default:
+ dev_err(&pdev->dev, "No compatible switch found at 0x%02x\n",
state->base_addr);
err = -ENODEV;
goto out_err;
}
platform_set_drvdata(pdev, state);
- dev_info(&pdev->dev, "Found %s at %s:%02x\n", MV_IDENT_STR,
+ dev_info(&pdev->dev, "Found %s at %s:%02x\n", model_str,
state->bus->id, state->base_addr);
dev_info(&pdev->dev, "Using %sdirect addressing\n",
@@ -808,7 +819,7 @@ static int mvsw61xx_probe(struct platform_device *pdev)
state->dev.vlans = MV_VLANS;
state->dev.cpu_port = state->cpu_port0;
state->dev.ports = MV_PORTS;
- state->dev.name = MV_IDENT_STR;
+ state->dev.name = model_str;
state->dev.ops = &mvsw61xx_ops;
state->dev.alias = dev_name(&pdev->dev);
@@ -839,6 +850,8 @@ mvsw61xx_remove(struct platform_device *pdev)
static const struct of_device_id mvsw61xx_match[] = {
{ .compatible = "marvell,88e6171" },
+ { .compatible = "marvell,88e6172" },
+ { .compatible = "marvell,88e6176" },
{ }
};
MODULE_DEVICE_TABLE(of, mvsw61xx_match);