mvsw6171: rename to 'mvsw61xx'

In preparation for properly supporting switches
beyond the 88E6171.

Signed-off-by: Claudio Leite <leitec@staticky.com>

SVN-Revision: 43935
This commit is contained in:
Luka Perkov 2015-01-11 17:19:58 +00:00
parent e0daabc8ec
commit a1872182bb
13 changed files with 142 additions and 142 deletions

View file

@ -2144,7 +2144,7 @@ CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y
# CONFIG_MUTEX_SPIN_ON_OWNER is not set # CONFIG_MUTEX_SPIN_ON_OWNER is not set
# CONFIG_MV643XX_ETH is not set # CONFIG_MV643XX_ETH is not set
# CONFIG_MVMDIO is not set # CONFIG_MVMDIO is not set
# CONFIG_MVSW6171_PHY is not set # CONFIG_MVSW61XX_PHY is not set
# CONFIG_MVSWITCH_PHY is not set # CONFIG_MVSWITCH_PHY is not set
# CONFIG_MWAVE is not set # CONFIG_MWAVE is not set
# CONFIG_MWL8K is not set # CONFIG_MWL8K is not set

View file

@ -2246,7 +2246,7 @@ CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y
# CONFIG_MUTEX_SPIN_ON_OWNER is not set # CONFIG_MUTEX_SPIN_ON_OWNER is not set
# CONFIG_MV643XX_ETH is not set # CONFIG_MV643XX_ETH is not set
# CONFIG_MVMDIO is not set # CONFIG_MVMDIO is not set
# CONFIG_MVSW6171_PHY is not set # CONFIG_MVSW61XX_PHY is not set
# CONFIG_MVSWITCH_PHY is not set # CONFIG_MVSWITCH_PHY is not set
# CONFIG_MWAVE is not set # CONFIG_MWAVE is not set
# CONFIG_MWL8K is not set # CONFIG_MWL8K is not set

View file

@ -1,5 +1,5 @@
/* /*
* Marvell 88E6171 switch driver * Marvell 88E61xx switch driver
* *
* Copyright (c) 2014 Claudio Leite <leitec@staticky.com> * Copyright (c) 2014 Claudio Leite <leitec@staticky.com>
* *
@ -23,12 +23,12 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "mvsw6171.h" #include "mvsw61xx.h"
MODULE_DESCRIPTION("Marvell 88E6171 Switch driver"); MODULE_DESCRIPTION("Marvell 88E61xx Switch driver");
MODULE_AUTHOR("Claudio Leite <leitec@staticky.com>"); MODULE_AUTHOR("Claudio Leite <leitec@staticky.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:mvsw6171"); MODULE_ALIAS("platform:mvsw61xx");
/* /*
* Register access is done through direct or indirect addressing, * Register access is done through direct or indirect addressing,
@ -43,7 +43,7 @@ MODULE_ALIAS("platform:mvsw6171");
*/ */
static int static int
mvsw6171_wait_mask_raw(struct mii_bus *bus, int addr, mvsw61xx_wait_mask_raw(struct mii_bus *bus, int addr,
int reg, u16 mask, u16 val) int reg, u16 mask, u16 val)
{ {
int i = 100; int i = 100;
@ -67,7 +67,7 @@ r16(struct mii_bus *bus, bool indirect, int base_addr, int addr, int reg)
return bus->read(bus, addr, reg); return bus->read(bus, addr, reg);
/* Indirect read: First, make sure switch is free */ /* Indirect read: First, make sure switch is free */
mvsw6171_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD,
MV_INDIRECT_INPROGRESS, 0); MV_INDIRECT_INPROGRESS, 0);
/* Load address and request read */ /* Load address and request read */
@ -76,7 +76,7 @@ r16(struct mii_bus *bus, bool indirect, int base_addr, int addr, int reg)
ind_addr); ind_addr);
/* Wait until it's ready */ /* Wait until it's ready */
mvsw6171_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD,
MV_INDIRECT_INPROGRESS, 0); MV_INDIRECT_INPROGRESS, 0);
/* Read the requested data */ /* Read the requested data */
@ -95,14 +95,14 @@ w16(struct mii_bus *bus, bool indirect, int base_addr, int addr,
} }
/* Indirect write: First, make sure switch is free */ /* Indirect write: First, make sure switch is free */
mvsw6171_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD,
MV_INDIRECT_INPROGRESS, 0); MV_INDIRECT_INPROGRESS, 0);
/* Load the data to be written */ /* Load the data to be written */
bus->write(bus, base_addr, MV_INDIRECT_REG_DATA, val); bus->write(bus, base_addr, MV_INDIRECT_REG_DATA, val);
/* Wait again for switch to be free */ /* Wait again for switch to be free */
mvsw6171_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD, mvsw61xx_wait_mask_raw(bus, base_addr, MV_INDIRECT_REG_CMD,
MV_INDIRECT_INPROGRESS, 0); MV_INDIRECT_INPROGRESS, 0);
/* Load address, and issue write command */ /* Load address, and issue write command */
@ -116,7 +116,7 @@ w16(struct mii_bus *bus, bool indirect, int base_addr, int addr,
static inline u16 static inline u16
sr16(struct switch_dev *dev, int addr, int reg) sr16(struct switch_dev *dev, int addr, int reg)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
return r16(state->bus, state->is_indirect, state->base_addr, addr, reg); return r16(state->bus, state->is_indirect, state->base_addr, addr, reg);
} }
@ -124,13 +124,13 @@ sr16(struct switch_dev *dev, int addr, int reg)
static inline void static inline void
sw16(struct switch_dev *dev, int addr, int reg, u16 val) sw16(struct switch_dev *dev, int addr, int reg, u16 val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
w16(state->bus, state->is_indirect, state->base_addr, addr, reg, val); w16(state->bus, state->is_indirect, state->base_addr, addr, reg, val);
} }
static int static int
mvsw6171_wait_mask_s(struct switch_dev *dev, int addr, mvsw61xx_wait_mask_s(struct switch_dev *dev, int addr,
int reg, u16 mask, u16 val) int reg, u16 mask, u16 val)
{ {
int i = 100; int i = 100;
@ -146,10 +146,10 @@ mvsw6171_wait_mask_s(struct switch_dev *dev, int addr,
} }
static int static int
mvsw6171_get_port_mask(struct switch_dev *dev, mvsw61xx_get_port_mask(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
char *buf = state->buf; char *buf = state->buf;
int port, len, i; int port, len, i;
u16 reg; u16 reg;
@ -172,10 +172,10 @@ mvsw6171_get_port_mask(struct switch_dev *dev,
} }
static int static int
mvsw6171_get_port_qmode(struct switch_dev *dev, mvsw61xx_get_port_qmode(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
val->value.i = state->ports[val->port_vlan].qmode; val->value.i = state->ports[val->port_vlan].qmode;
@ -183,10 +183,10 @@ mvsw6171_get_port_qmode(struct switch_dev *dev,
} }
static int static int
mvsw6171_set_port_qmode(struct switch_dev *dev, mvsw61xx_set_port_qmode(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
state->ports[val->port_vlan].qmode = val->value.i; state->ports[val->port_vlan].qmode = val->value.i;
@ -194,9 +194,9 @@ mvsw6171_set_port_qmode(struct switch_dev *dev,
} }
static int static int
mvsw6171_get_pvid(struct switch_dev *dev, int port, int *val) mvsw61xx_get_pvid(struct switch_dev *dev, int port, int *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
*val = state->ports[port].pvid; *val = state->ports[port].pvid;
@ -204,9 +204,9 @@ mvsw6171_get_pvid(struct switch_dev *dev, int port, int *val)
} }
static int static int
mvsw6171_set_pvid(struct switch_dev *dev, int port, int val) mvsw61xx_set_pvid(struct switch_dev *dev, int port, int val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
if (val < 0 || val >= MV_VLANS) if (val < 0 || val >= MV_VLANS)
return -EINVAL; return -EINVAL;
@ -217,10 +217,10 @@ mvsw6171_set_pvid(struct switch_dev *dev, int port, int val)
} }
static int static int
mvsw6171_get_port_status(struct switch_dev *dev, mvsw61xx_get_port_status(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
char *buf = state->buf; char *buf = state->buf;
u16 status, speed; u16 status, speed;
int len; int len;
@ -261,7 +261,7 @@ mvsw6171_get_port_status(struct switch_dev *dev,
} }
static int static int
mvsw6171_get_port_speed(struct switch_dev *dev, mvsw61xx_get_port_speed(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
u16 status, speed; u16 status, speed;
@ -289,10 +289,10 @@ mvsw6171_get_port_speed(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_get_vlan_ports(struct switch_dev *dev, static int mvsw61xx_get_vlan_ports(struct switch_dev *dev,
struct switch_val *val) struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int i, j, mode, vno; int i, j, mode, vno;
vno = val->port_vlan; vno = val->port_vlan;
@ -320,10 +320,10 @@ static int mvsw6171_get_vlan_ports(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_set_vlan_ports(struct switch_dev *dev, static int mvsw61xx_set_vlan_ports(struct switch_dev *dev,
struct switch_val *val) struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int i, mode, pno, vno; int i, mode, pno, vno;
vno = val->port_vlan; vno = val->port_vlan;
@ -362,10 +362,10 @@ static int mvsw6171_set_vlan_ports(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_get_vlan_port_based(struct switch_dev *dev, static int mvsw61xx_get_vlan_port_based(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int vno = val->port_vlan; int vno = val->port_vlan;
if (vno <= 0 || vno >= dev->vlans) if (vno <= 0 || vno >= dev->vlans)
@ -379,10 +379,10 @@ static int mvsw6171_get_vlan_port_based(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_set_vlan_port_based(struct switch_dev *dev, static int mvsw61xx_set_vlan_port_based(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int vno = val->port_vlan; int vno = val->port_vlan;
if (vno <= 0 || vno >= dev->vlans) if (vno <= 0 || vno >= dev->vlans)
@ -396,10 +396,10 @@ static int mvsw6171_set_vlan_port_based(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_get_vid(struct switch_dev *dev, static int mvsw61xx_get_vid(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int vno = val->port_vlan; int vno = val->port_vlan;
if (vno <= 0 || vno >= dev->vlans) if (vno <= 0 || vno >= dev->vlans)
@ -410,10 +410,10 @@ static int mvsw6171_get_vid(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_set_vid(struct switch_dev *dev, static int mvsw61xx_set_vid(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int vno = val->port_vlan; int vno = val->port_vlan;
if (vno <= 0 || vno >= dev->vlans) if (vno <= 0 || vno >= dev->vlans)
@ -424,34 +424,34 @@ static int mvsw6171_set_vid(struct switch_dev *dev,
return 0; return 0;
} }
static int mvsw6171_get_enable_vlan(struct switch_dev *dev, static int mvsw61xx_get_enable_vlan(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
val->value.i = state->vlan_enabled; val->value.i = state->vlan_enabled;
return 0; return 0;
} }
static int mvsw6171_set_enable_vlan(struct switch_dev *dev, static int mvsw61xx_set_enable_vlan(struct switch_dev *dev,
const struct switch_attr *attr, struct switch_val *val) const struct switch_attr *attr, struct switch_val *val)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
state->vlan_enabled = val->value.i; state->vlan_enabled = val->value.i;
return 0; return 0;
} }
static int mvsw6171_vtu_program(struct switch_dev *dev) static int mvsw61xx_vtu_program(struct switch_dev *dev)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
u16 v1, v2; u16 v1, v2;
int i; int i;
/* Flush */ /* Flush */
mvsw6171_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP),
MV_VTUOP_INPROGRESS, 0); MV_VTUOP_INPROGRESS, 0);
sw16(dev, MV_GLOBALREG(VTU_OP), sw16(dev, MV_GLOBALREG(VTU_OP),
MV_VTUOP_INPROGRESS | MV_VTUOP_VALID); MV_VTUOP_INPROGRESS | MV_VTUOP_VALID);
@ -463,7 +463,7 @@ static int mvsw6171_vtu_program(struct switch_dev *dev)
state->vlans[i].port_based == true) state->vlans[i].port_based == true)
continue; continue;
mvsw6171_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP),
MV_VTUOP_INPROGRESS, 0); MV_VTUOP_INPROGRESS, 0);
sw16(dev, MV_GLOBALREG(VTU_VID), sw16(dev, MV_GLOBALREG(VTU_VID),
@ -477,16 +477,16 @@ static int mvsw6171_vtu_program(struct switch_dev *dev)
sw16(dev, MV_GLOBALREG(VTU_OP), sw16(dev, MV_GLOBALREG(VTU_OP),
MV_VTUOP_INPROGRESS | MV_VTUOP_LOAD); MV_VTUOP_INPROGRESS | MV_VTUOP_LOAD);
mvsw6171_wait_mask_s(dev, MV_GLOBALREG(VTU_OP), mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(VTU_OP),
MV_VTUOP_INPROGRESS, 0); MV_VTUOP_INPROGRESS, 0);
} }
return 0; return 0;
} }
static void mvsw6171_vlan_port_config(struct switch_dev *dev, int vno) static void mvsw61xx_vlan_port_config(struct switch_dev *dev, int vno)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int i, mode; int i, mode;
for (i = 0; i < dev->ports; i++) { for (i = 0; i < dev->ports; i++) {
@ -505,16 +505,16 @@ static void mvsw6171_vlan_port_config(struct switch_dev *dev, int vno)
} }
} }
static int mvsw6171_update_state(struct switch_dev *dev) static int mvsw61xx_update_state(struct switch_dev *dev)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int i; int i;
u16 reg; u16 reg;
if (!state->registered) if (!state->registered)
return -EINVAL; return -EINVAL;
mvsw6171_vtu_program(dev); mvsw61xx_vtu_program(dev);
/* /*
* Set 802.1q-only mode if vlan_enabled is true. * Set 802.1q-only mode if vlan_enabled is true.
@ -549,7 +549,7 @@ static int mvsw6171_update_state(struct switch_dev *dev)
} }
for (i = 0; i < dev->vlans; i++) for (i = 0; i < dev->vlans; i++)
mvsw6171_vlan_port_config(dev, i); mvsw61xx_vlan_port_config(dev, i);
for (i = 0; i < dev->ports; i++) { for (i = 0; i < dev->ports; i++) {
reg = sr16(dev, MV_PORTREG(VLANID, i)) & ~MV_PVID_MASK; reg = sr16(dev, MV_PORTREG(VLANID, i)) & ~MV_PVID_MASK;
@ -571,14 +571,14 @@ static int mvsw6171_update_state(struct switch_dev *dev)
return 0; return 0;
} }
static int mvsw6171_apply(struct switch_dev *dev) static int mvsw61xx_apply(struct switch_dev *dev)
{ {
return mvsw6171_update_state(dev); return mvsw61xx_update_state(dev);
} }
static int mvsw6171_reset(struct switch_dev *dev) static int mvsw61xx_reset(struct switch_dev *dev)
{ {
struct mvsw6171_state *state = get_state(dev); struct mvsw61xx_state *state = get_state(dev);
int i; int i;
u16 reg; u16 reg;
@ -592,7 +592,7 @@ static int mvsw6171_reset(struct switch_dev *dev)
reg = sr16(dev, MV_GLOBALREG(CONTROL)) | MV_CONTROL_RESET; reg = sr16(dev, MV_GLOBALREG(CONTROL)) | MV_CONTROL_RESET;
sw16(dev, MV_GLOBALREG(CONTROL), reg); sw16(dev, MV_GLOBALREG(CONTROL), reg);
if (mvsw6171_wait_mask_s(dev, MV_GLOBALREG(CONTROL), if (mvsw61xx_wait_mask_s(dev, MV_GLOBALREG(CONTROL),
MV_CONTROL_RESET, 0) < 0) MV_CONTROL_RESET, 0) < 0)
return -ETIMEDOUT; return -ETIMEDOUT;
@ -619,7 +619,7 @@ static int mvsw6171_reset(struct switch_dev *dev)
state->vlan_enabled = 0; state->vlan_enabled = 0;
mvsw6171_update_state(dev); mvsw61xx_update_state(dev);
/* Re-enable ports */ /* Re-enable ports */
for (i = 0; i < dev->ports; i++) { for (i = 0; i < dev->ports; i++) {
@ -632,112 +632,112 @@ static int mvsw6171_reset(struct switch_dev *dev)
} }
enum { enum {
MVSW6171_ENABLE_VLAN, MVSW61XX_ENABLE_VLAN,
}; };
enum { enum {
MVSW6171_VLAN_PORT_BASED, MVSW61XX_VLAN_PORT_BASED,
MVSW6171_VLAN_ID, MVSW61XX_VLAN_ID,
}; };
enum { enum {
MVSW6171_PORT_MASK, MVSW61XX_PORT_MASK,
MVSW6171_PORT_QMODE, MVSW61XX_PORT_QMODE,
MVSW6171_PORT_STATUS, MVSW61XX_PORT_STATUS,
MVSW6171_PORT_LINK, MVSW61XX_PORT_LINK,
}; };
static const struct switch_attr mvsw6171_global[] = { static const struct switch_attr mvsw61xx_global[] = {
[MVSW6171_ENABLE_VLAN] = { [MVSW61XX_ENABLE_VLAN] = {
.id = MVSW6171_ENABLE_VLAN, .id = MVSW61XX_ENABLE_VLAN,
.type = SWITCH_TYPE_INT, .type = SWITCH_TYPE_INT,
.name = "enable_vlan", .name = "enable_vlan",
.description = "Enable 802.1q VLAN support", .description = "Enable 802.1q VLAN support",
.get = mvsw6171_get_enable_vlan, .get = mvsw61xx_get_enable_vlan,
.set = mvsw6171_set_enable_vlan, .set = mvsw61xx_set_enable_vlan,
}, },
}; };
static const struct switch_attr mvsw6171_vlan[] = { static const struct switch_attr mvsw61xx_vlan[] = {
[MVSW6171_VLAN_PORT_BASED] = { [MVSW61XX_VLAN_PORT_BASED] = {
.id = MVSW6171_VLAN_PORT_BASED, .id = MVSW61XX_VLAN_PORT_BASED,
.type = SWITCH_TYPE_INT, .type = SWITCH_TYPE_INT,
.name = "port_based", .name = "port_based",
.description = "Use port-based (non-802.1q) VLAN only", .description = "Use port-based (non-802.1q) VLAN only",
.get = mvsw6171_get_vlan_port_based, .get = mvsw61xx_get_vlan_port_based,
.set = mvsw6171_set_vlan_port_based, .set = mvsw61xx_set_vlan_port_based,
}, },
[MVSW6171_VLAN_ID] = { [MVSW61XX_VLAN_ID] = {
.id = MVSW6171_VLAN_ID, .id = MVSW61XX_VLAN_ID,
.type = SWITCH_TYPE_INT, .type = SWITCH_TYPE_INT,
.name = "vid", .name = "vid",
.description = "Get/set VLAN ID", .description = "Get/set VLAN ID",
.get = mvsw6171_get_vid, .get = mvsw61xx_get_vid,
.set = mvsw6171_set_vid, .set = mvsw61xx_set_vid,
}, },
}; };
static const struct switch_attr mvsw6171_port[] = { static const struct switch_attr mvsw61xx_port[] = {
[MVSW6171_PORT_MASK] = { [MVSW61XX_PORT_MASK] = {
.id = MVSW6171_PORT_MASK, .id = MVSW61XX_PORT_MASK,
.type = SWITCH_TYPE_STRING, .type = SWITCH_TYPE_STRING,
.description = "Port-based VLAN mask", .description = "Port-based VLAN mask",
.name = "mask", .name = "mask",
.get = mvsw6171_get_port_mask, .get = mvsw61xx_get_port_mask,
.set = NULL, .set = NULL,
}, },
[MVSW6171_PORT_QMODE] = { [MVSW61XX_PORT_QMODE] = {
.id = MVSW6171_PORT_QMODE, .id = MVSW61XX_PORT_QMODE,
.type = SWITCH_TYPE_INT, .type = SWITCH_TYPE_INT,
.description = "802.1q mode: 0=off/1=fallback/2=check/3=secure", .description = "802.1q mode: 0=off/1=fallback/2=check/3=secure",
.name = "qmode", .name = "qmode",
.get = mvsw6171_get_port_qmode, .get = mvsw61xx_get_port_qmode,
.set = mvsw6171_set_port_qmode, .set = mvsw61xx_set_port_qmode,
}, },
[MVSW6171_PORT_STATUS] = { [MVSW61XX_PORT_STATUS] = {
.id = MVSW6171_PORT_STATUS, .id = MVSW61XX_PORT_STATUS,
.type = SWITCH_TYPE_STRING, .type = SWITCH_TYPE_STRING,
.description = "Return port status", .description = "Return port status",
.name = "status", .name = "status",
.get = mvsw6171_get_port_status, .get = mvsw61xx_get_port_status,
.set = NULL, .set = NULL,
}, },
[MVSW6171_PORT_LINK] = { [MVSW61XX_PORT_LINK] = {
.id = MVSW6171_PORT_LINK, .id = MVSW61XX_PORT_LINK,
.type = SWITCH_TYPE_INT, .type = SWITCH_TYPE_INT,
.description = "Get link speed", .description = "Get link speed",
.name = "link", .name = "link",
.get = mvsw6171_get_port_speed, .get = mvsw61xx_get_port_speed,
.set = NULL, .set = NULL,
}, },
}; };
static const struct switch_dev_ops mvsw6171_ops = { static const struct switch_dev_ops mvsw61xx_ops = {
.attr_global = { .attr_global = {
.attr = mvsw6171_global, .attr = mvsw61xx_global,
.n_attr = ARRAY_SIZE(mvsw6171_global), .n_attr = ARRAY_SIZE(mvsw61xx_global),
}, },
.attr_vlan = { .attr_vlan = {
.attr = mvsw6171_vlan, .attr = mvsw61xx_vlan,
.n_attr = ARRAY_SIZE(mvsw6171_vlan), .n_attr = ARRAY_SIZE(mvsw61xx_vlan),
}, },
.attr_port = { .attr_port = {
.attr = mvsw6171_port, .attr = mvsw61xx_port,
.n_attr = ARRAY_SIZE(mvsw6171_port), .n_attr = ARRAY_SIZE(mvsw61xx_port),
}, },
.get_port_pvid = mvsw6171_get_pvid, .get_port_pvid = mvsw61xx_get_pvid,
.set_port_pvid = mvsw6171_set_pvid, .set_port_pvid = mvsw61xx_set_pvid,
.get_vlan_ports = mvsw6171_get_vlan_ports, .get_vlan_ports = mvsw61xx_get_vlan_ports,
.set_vlan_ports = mvsw6171_set_vlan_ports, .set_vlan_ports = mvsw61xx_set_vlan_ports,
.apply_config = mvsw6171_apply, .apply_config = mvsw61xx_apply,
.reset_switch = mvsw6171_reset, .reset_switch = mvsw61xx_reset,
}; };
/* end swconfig stuff */ /* end swconfig stuff */
static int mvsw6171_probe(struct platform_device *pdev) static int mvsw61xx_probe(struct platform_device *pdev)
{ {
struct mvsw6171_state *state; struct mvsw61xx_state *state;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct device_node *mdio; struct device_node *mdio;
u32 val; u32 val;
@ -809,7 +809,7 @@ static int mvsw6171_probe(struct platform_device *pdev)
state->dev.cpu_port = state->cpu_port0; state->dev.cpu_port = state->cpu_port0;
state->dev.ports = MV_PORTS; state->dev.ports = MV_PORTS;
state->dev.name = MV_IDENT_STR; state->dev.name = MV_IDENT_STR;
state->dev.ops = &mvsw6171_ops; state->dev.ops = &mvsw61xx_ops;
state->dev.alias = dev_name(&pdev->dev); state->dev.alias = dev_name(&pdev->dev);
err = register_switch(&state->dev, NULL); err = register_switch(&state->dev, NULL);
@ -825,9 +825,9 @@ out_err:
} }
static int static int
mvsw6171_remove(struct platform_device *pdev) mvsw61xx_remove(struct platform_device *pdev)
{ {
struct mvsw6171_state *state = platform_get_drvdata(pdev); struct mvsw61xx_state *state = platform_get_drvdata(pdev);
if (state->registered) if (state->registered)
unregister_switch(&state->dev); unregister_switch(&state->dev);
@ -837,30 +837,30 @@ mvsw6171_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id mvsw6171_match[] = { static const struct of_device_id mvsw61xx_match[] = {
{ .compatible = "marvell,88e6171" }, { .compatible = "marvell,88e6171" },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, mvsw6171_match); MODULE_DEVICE_TABLE(of, mvsw61xx_match);
static struct platform_driver mvsw6171_driver = { static struct platform_driver mvsw61xx_driver = {
.probe = mvsw6171_probe, .probe = mvsw61xx_probe,
.remove = mvsw6171_remove, .remove = mvsw61xx_remove,
.driver = { .driver = {
.name = "mvsw6171", .name = "mvsw61xx",
.of_match_table = of_match_ptr(mvsw6171_match), .of_match_table = of_match_ptr(mvsw61xx_match),
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
}; };
static int __init mvsw6171_module_init(void) static int __init mvsw61xx_module_init(void)
{ {
return platform_driver_register(&mvsw6171_driver); return platform_driver_register(&mvsw61xx_driver);
} }
late_initcall(mvsw6171_module_init); late_initcall(mvsw61xx_module_init);
static void __exit mvsw6171_module_exit(void) static void __exit mvsw61xx_module_exit(void)
{ {
platform_driver_unregister(&mvsw6171_driver); platform_driver_unregister(&mvsw61xx_driver);
} }
module_exit(mvsw6171_module_exit); module_exit(mvsw61xx_module_exit);

View file

@ -1,5 +1,5 @@
/* /*
* Marvell 88E6171 switch driver * Marvell 88E61xx switch driver
* *
* Copyright (c) 2014 Claudio Leite <leitec@staticky.com> * Copyright (c) 2014 Claudio Leite <leitec@staticky.com>
* *
@ -10,8 +10,8 @@
* Free Software Foundation * Free Software Foundation
*/ */
#ifndef __MVSW6171_H #ifndef __MVSW61XX_H
#define __MVSW6171_H #define __MVSW61XX_H
#define MV_PORTS 7 #define MV_PORTS 7
#define MV_PORTS_MASK ((1 << MV_PORTS) - 1) #define MV_PORTS_MASK ((1 << MV_PORTS) - 1)
@ -196,7 +196,7 @@ enum {
#define MV_PVID_MASK 0x0fff #define MV_PVID_MASK 0x0fff
struct mvsw6171_state { struct mvsw61xx_state {
struct switch_dev dev; struct switch_dev dev;
struct mii_bus *bus; struct mii_bus *bus;
int base_addr; int base_addr;
@ -225,6 +225,6 @@ struct mvsw6171_state {
char buf[128]; char buf[128];
}; };
#define get_state(_dev) container_of((_dev), struct mvsw6171_state, dev) #define get_state(_dev) container_of((_dev), struct mvsw61xx_state, dev)
#endif #endif

View file

@ -4,7 +4,7 @@
tristate "Driver for Marvell 88E6060 switches" tristate "Driver for Marvell 88E6060 switches"
select ETHERNET_PACKET_MANGLE select ETHERNET_PACKET_MANGLE
+config MVSW6171_PHY +config MVSW61XX_PHY
+ tristate "Driver for Marvell 88E6171/6172 switches" + tristate "Driver for Marvell 88E6171/6172 switches"
+ select SWCONFIG + select SWCONFIG
+ +
@ -17,7 +17,7 @@
obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o
obj-$(CONFIG_ADM6996_PHY) += adm6996.o obj-$(CONFIG_ADM6996_PHY) += adm6996.o
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
+obj-$(CONFIG_MVSW6171_PHY) += mvsw6171.o +obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o
obj-$(CONFIG_IP17XX_PHY) += ip17xx.o obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_REALTEK_PHY) += realtek.o
obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o

View file

@ -4,7 +4,7 @@
tristate "Driver for Marvell 88E6060 switches" tristate "Driver for Marvell 88E6060 switches"
select ETHERNET_PACKET_MANGLE select ETHERNET_PACKET_MANGLE
+config MVSW6171_PHY +config MVSW61XX_PHY
+ tristate "Driver for Marvell 88E6171/6172 switches" + tristate "Driver for Marvell 88E6171/6172 switches"
+ select SWCONFIG + select SWCONFIG
+ +
@ -17,7 +17,7 @@
obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o
obj-$(CONFIG_ADM6996_PHY) += adm6996.o obj-$(CONFIG_ADM6996_PHY) += adm6996.o
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
+obj-$(CONFIG_MVSW6171_PHY) += mvsw6171.o +obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o
obj-$(CONFIG_IP17XX_PHY) += ip17xx.o obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
obj-$(CONFIG_REALTEK_PHY) += realtek.o obj-$(CONFIG_REALTEK_PHY) += realtek.o
obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o

View file

@ -206,7 +206,7 @@ CONFIG_MVEBU_CLK_COMMON=y
CONFIG_MVEBU_MBUS=y CONFIG_MVEBU_MBUS=y
CONFIG_MVMDIO=y CONFIG_MVMDIO=y
# CONFIG_MVNETA is not set # CONFIG_MVNETA is not set
CONFIG_MVSW6171_PHY=y CONFIG_MVSW61XX_PHY=y
CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_KUSER_HELPERS=y
CONFIG_NEED_PER_CPU_KM=y CONFIG_NEED_PER_CPU_KM=y

View file

@ -219,7 +219,7 @@ CONFIG_MVEBU_CLK_COMMON=y
CONFIG_MVEBU_MBUS=y CONFIG_MVEBU_MBUS=y
CONFIG_MVMDIO=y CONFIG_MVMDIO=y
# CONFIG_MVNETA is not set # CONFIG_MVNETA is not set
CONFIG_MVSW6171_PHY=y CONFIG_MVSW61XX_PHY=y
CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_KUSER_HELPERS=y
CONFIG_NEED_PER_CPU_KM=y CONFIG_NEED_PER_CPU_KM=y

View file

@ -121,7 +121,7 @@
+ }; + };
+ }; + };
+ +
+ mvsw6171 { + mvsw61xx {
+ compatible = "marvell,88e6171"; + compatible = "marvell,88e6171";
+ status = "okay"; + status = "okay";
+ reg = <0x10>; + reg = <0x10>;

View file

@ -121,7 +121,7 @@
+ }; + };
+ }; + };
+ +
+ mvsw6171 { + mvsw61xx {
+ compatible = "marvell,88e6171"; + compatible = "marvell,88e6171";
+ status = "okay"; + status = "okay";
+ reg = <0x10>; + reg = <0x10>;

View file

@ -209,7 +209,7 @@ CONFIG_MVEBU_DEVBUS=y
CONFIG_MVEBU_MBUS=y CONFIG_MVEBU_MBUS=y
CONFIG_MVMDIO=y CONFIG_MVMDIO=y
CONFIG_MVNETA=y CONFIG_MVNETA=y
CONFIG_MVSW6171_PHY=y CONFIG_MVSW61XX_PHY=y
CONFIG_MV_XOR=y CONFIG_MV_XOR=y
CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_DMA_MAP_STATE=y
# CONFIG_NEON is not set # CONFIG_NEON is not set

View file

@ -247,7 +247,7 @@ CONFIG_MVEBU_DEVBUS=y
CONFIG_MVEBU_MBUS=y CONFIG_MVEBU_MBUS=y
CONFIG_MVMDIO=y CONFIG_MVMDIO=y
CONFIG_MVNETA=y CONFIG_MVNETA=y
CONFIG_MVSW6171_PHY=y CONFIG_MVSW61XX_PHY=y
CONFIG_MV_XOR=y CONFIG_MV_XOR=y
CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_DMA_MAP_STATE=y
# CONFIG_NEON is not set # CONFIG_NEON is not set

View file

@ -276,7 +276,7 @@
4500 1>; 4500 1>;
}; };
mvsw6172 { mvsw61xx {
compatible = "marvell,88e6171"; compatible = "marvell,88e6171";
status = "okay"; status = "okay";
reg = <0x10>; reg = <0x10>;