mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 16:43:09 +02:00
merge swconfig (+drivers) improvements from trunk
git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@22677 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
e26bac435d
commit
7af90ad2ab
@ -82,7 +82,7 @@ CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IP175C_PHY=y
|
||||
CONFIG_IP17XX_PHY=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
# CONFIG_LEDS_GPIO is not set
|
||||
# CONFIG_LEMOTE_FULONG is not set
|
||||
|
@ -84,7 +84,7 @@ CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IP175C_PHY=y
|
||||
CONFIG_IP17XX_PHY=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
# CONFIG_LEDS_GPIO is not set
|
||||
# CONFIG_MACH_ALCHEMY is not set
|
||||
|
@ -870,7 +870,7 @@ CONFIG_INPUT_MISC=y
|
||||
CONFIG_IOSCHED_DEADLINE=y
|
||||
CONFIG_IOSCHED_NOOP=y
|
||||
# CONFIG_IP1000 is not set
|
||||
# CONFIG_IP175C_PHY is not set
|
||||
# CONFIG_IP17XX_PHY is not set
|
||||
# CONFIG_IP6_NF_FILTER is not set
|
||||
# CONFIG_IP6_NF_IPTABLES is not set
|
||||
# CONFIG_IP6_NF_MANGLE is not set
|
||||
|
@ -921,7 +921,7 @@ CONFIG_INPUT_MISC=y
|
||||
CONFIG_IOSCHED_DEADLINE=y
|
||||
CONFIG_IOSCHED_NOOP=y
|
||||
# CONFIG_IP1000 is not set
|
||||
# CONFIG_IP175C_PHY is not set
|
||||
# CONFIG_IP17XX_PHY is not set
|
||||
# CONFIG_IP6_NF_FILTER is not set
|
||||
# CONFIG_IP6_NF_IPTABLES is not set
|
||||
# CONFIG_IP6_NF_MANGLE is not set
|
||||
|
@ -52,7 +52,6 @@ struct ar8216_priv {
|
||||
u8 vlan_tagged;
|
||||
u16 pvid[AR8216_NUM_PORTS];
|
||||
};
|
||||
static struct switch_dev athdev;
|
||||
|
||||
#define to_ar8216(_dev) container_of(_dev, struct ar8216_priv, dev)
|
||||
|
||||
@ -631,11 +630,34 @@ ar8216_reset_switch(struct switch_dev *dev)
|
||||
return ar8216_hw_apply(dev);
|
||||
}
|
||||
|
||||
|
||||
static const struct switch_dev_ops ar8216_ops = {
|
||||
.attr_global = {
|
||||
.attr = ar8216_globals,
|
||||
.n_attr = ARRAY_SIZE(ar8216_globals),
|
||||
},
|
||||
.attr_port = {
|
||||
.attr = ar8216_port,
|
||||
.n_attr = ARRAY_SIZE(ar8216_port),
|
||||
},
|
||||
.attr_vlan = {
|
||||
.attr = ar8216_vlan,
|
||||
.n_attr = ARRAY_SIZE(ar8216_vlan),
|
||||
},
|
||||
.get_port_pvid = ar8216_get_pvid,
|
||||
.set_port_pvid = ar8216_set_pvid,
|
||||
.get_vlan_ports = ar8216_get_ports,
|
||||
.set_vlan_ports = ar8216_set_ports,
|
||||
.apply_config = ar8216_hw_apply,
|
||||
.reset_switch = ar8216_reset_switch,
|
||||
};
|
||||
|
||||
static int
|
||||
ar8216_config_init(struct phy_device *pdev)
|
||||
{
|
||||
struct ar8216_priv *priv;
|
||||
struct net_device *dev = pdev->attached_dev;
|
||||
struct switch_dev *swdev;
|
||||
int ret;
|
||||
|
||||
priv = kzalloc(sizeof(struct ar8216_priv), GFP_KERNEL);
|
||||
@ -667,14 +689,22 @@ ar8216_config_init(struct phy_device *pdev)
|
||||
mutex_init(&priv->reg_mutex);
|
||||
priv->read = ar8216_mii_read;
|
||||
priv->write = ar8216_mii_write;
|
||||
memcpy(&priv->dev, &athdev, sizeof(struct switch_dev));
|
||||
|
||||
pdev->priv = priv;
|
||||
|
||||
swdev = &priv->dev;
|
||||
swdev->cpu_port = AR8216_PORT_CPU;
|
||||
swdev->ops = &ar8216_ops;
|
||||
|
||||
if (priv->chip == AR8316) {
|
||||
priv->dev.name = "Atheros AR8316";
|
||||
priv->dev.vlans = AR8X16_MAX_VLANS;
|
||||
swdev->name = "Atheros AR8316";
|
||||
swdev->vlans = AR8X16_MAX_VLANS;
|
||||
/* port 5 connected to the other mac, therefore unusable */
|
||||
priv->dev.ports = (AR8216_NUM_PORTS - 1);
|
||||
swdev->ports = (AR8216_NUM_PORTS - 1);
|
||||
} else {
|
||||
swdev->name = "Atheros AR8216";
|
||||
swdev->vlans = AR8216_NUM_VLANS;
|
||||
swdev->ports = AR8216_NUM_PORTS;
|
||||
}
|
||||
|
||||
if ((ret = register_switch(&priv->dev, pdev->attached_dev)) < 0) {
|
||||
@ -782,32 +812,6 @@ ar8216_remove(struct phy_device *pdev)
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
/* template */
|
||||
static struct switch_dev athdev = {
|
||||
.name = "Atheros AR8216",
|
||||
.cpu_port = AR8216_PORT_CPU,
|
||||
.ports = AR8216_NUM_PORTS,
|
||||
.vlans = AR8216_NUM_VLANS,
|
||||
.attr_global = {
|
||||
.attr = ar8216_globals,
|
||||
.n_attr = ARRAY_SIZE(ar8216_globals),
|
||||
},
|
||||
.attr_port = {
|
||||
.attr = ar8216_port,
|
||||
.n_attr = ARRAY_SIZE(ar8216_port),
|
||||
},
|
||||
.attr_vlan = {
|
||||
.attr = ar8216_vlan,
|
||||
.n_attr = ARRAY_SIZE(ar8216_vlan),
|
||||
},
|
||||
.get_port_pvid = ar8216_get_pvid,
|
||||
.set_port_pvid = ar8216_set_pvid,
|
||||
.get_vlan_ports = ar8216_get_ports,
|
||||
.set_vlan_ports = ar8216_set_ports,
|
||||
.apply_config = ar8216_hw_apply,
|
||||
.reset_switch = ar8216_reset_switch,
|
||||
};
|
||||
|
||||
static struct phy_driver ar8216_driver = {
|
||||
.phy_id = 0x004d0000,
|
||||
.name = "Atheros AR8216/AR8316",
|
||||
|
File diff suppressed because it is too large
Load Diff
1395
target/linux/generic-2.6/files/drivers/net/phy/ip17xx.c
Normal file
1395
target/linux/generic-2.6/files/drivers/net/phy/ip17xx.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -250,11 +250,6 @@ static const struct rtl_reg rtl_regs[] = {
|
||||
};
|
||||
|
||||
|
||||
/* IFXMIPS compat stuff - remove after PHY layer migration */
|
||||
static struct switch_dev rtldev;
|
||||
/* END IFXMIPS compat stuff */
|
||||
|
||||
|
||||
static inline void
|
||||
rtl_set_page(struct rtl_priv *priv, unsigned int page)
|
||||
{
|
||||
@ -706,64 +701,6 @@ rtl_set_ports(struct switch_dev *dev, struct switch_val *val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rtl8306_config_init(struct phy_device *pdev)
|
||||
{
|
||||
struct net_device *netdev = pdev->attached_dev;
|
||||
struct rtl_priv *priv = pdev->priv;
|
||||
struct switch_dev *dev = &priv->dev;
|
||||
struct switch_val val;
|
||||
unsigned int chipid, chipver, chiptype;
|
||||
int err;
|
||||
|
||||
/* Only init the switch for the primary PHY */
|
||||
if (pdev->addr != 0)
|
||||
return 0;
|
||||
|
||||
val.value.i = 1;
|
||||
memcpy(&priv->dev, &rtldev, sizeof(struct switch_dev));
|
||||
priv->do_cpu = 0;
|
||||
priv->page = -1;
|
||||
priv->bus = pdev->bus;
|
||||
|
||||
dev->priv = priv;
|
||||
|
||||
chipid = rtl_get(dev, RTL_REG_CHIPID);
|
||||
chipver = rtl_get(dev, RTL_REG_CHIPVER);
|
||||
chiptype = rtl_get(dev, RTL_REG_CHIPTYPE);
|
||||
switch(chiptype) {
|
||||
case 0:
|
||||
case 2:
|
||||
strncpy(priv->hwname, RTL_NAME_S, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_S;
|
||||
break;
|
||||
case 1:
|
||||
strncpy(priv->hwname, RTL_NAME_SD, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_SD;
|
||||
break;
|
||||
case 3:
|
||||
strncpy(priv->hwname, RTL_NAME_SDM, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_SDM;
|
||||
break;
|
||||
default:
|
||||
strncpy(priv->hwname, RTL_NAME_UNKNOWN, sizeof(priv->hwname));
|
||||
break;
|
||||
}
|
||||
|
||||
dev->name = priv->hwname;
|
||||
rtl_hw_init(dev);
|
||||
|
||||
printk(KERN_INFO "Registering %s switch with Chip ID: 0x%04x, version: 0x%04x\n", priv->hwname, chipid, chipver);
|
||||
|
||||
err = register_switch(dev, netdev);
|
||||
if (err < 0) {
|
||||
kfree(priv);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct switch_attr rtl_globals[] = {
|
||||
{
|
||||
.type = SWITCH_TYPE_INT,
|
||||
@ -897,11 +834,7 @@ static struct switch_attr rtl_vlan[] = {
|
||||
},
|
||||
};
|
||||
|
||||
/* template */
|
||||
static struct switch_dev rtldev = {
|
||||
.cpu_port = RTL8306_PORT_CPU,
|
||||
.ports = RTL8306_NUM_PORTS,
|
||||
.vlans = RTL8306_NUM_VLANS,
|
||||
static const struct switch_dev_ops rtl8306_ops = {
|
||||
.attr_global = {
|
||||
.attr = rtl_globals,
|
||||
.n_attr = ARRAY_SIZE(rtl_globals),
|
||||
@ -920,6 +853,65 @@ static struct switch_dev rtldev = {
|
||||
.apply_config = rtl_hw_apply,
|
||||
};
|
||||
|
||||
static int
|
||||
rtl8306_config_init(struct phy_device *pdev)
|
||||
{
|
||||
struct net_device *netdev = pdev->attached_dev;
|
||||
struct rtl_priv *priv = pdev->priv;
|
||||
struct switch_dev *dev = &priv->dev;
|
||||
struct switch_val val;
|
||||
unsigned int chipid, chipver, chiptype;
|
||||
int err;
|
||||
|
||||
/* Only init the switch for the primary PHY */
|
||||
if (pdev->addr != 0)
|
||||
return 0;
|
||||
|
||||
val.value.i = 1;
|
||||
priv->dev.cpu_port = RTL8306_PORT_CPU;
|
||||
priv->dev.ports = RTL8306_NUM_PORTS;
|
||||
priv->dev.vlans = RTL8306_NUM_VLANS;
|
||||
priv->dev.ops = &rtl8306_ops;
|
||||
priv->do_cpu = 0;
|
||||
priv->page = -1;
|
||||
priv->bus = pdev->bus;
|
||||
|
||||
chipid = rtl_get(dev, RTL_REG_CHIPID);
|
||||
chipver = rtl_get(dev, RTL_REG_CHIPVER);
|
||||
chiptype = rtl_get(dev, RTL_REG_CHIPTYPE);
|
||||
switch(chiptype) {
|
||||
case 0:
|
||||
case 2:
|
||||
strncpy(priv->hwname, RTL_NAME_S, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_S;
|
||||
break;
|
||||
case 1:
|
||||
strncpy(priv->hwname, RTL_NAME_SD, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_SD;
|
||||
break;
|
||||
case 3:
|
||||
strncpy(priv->hwname, RTL_NAME_SDM, sizeof(priv->hwname));
|
||||
priv->type = RTL_TYPE_SDM;
|
||||
break;
|
||||
default:
|
||||
strncpy(priv->hwname, RTL_NAME_UNKNOWN, sizeof(priv->hwname));
|
||||
break;
|
||||
}
|
||||
|
||||
dev->name = priv->hwname;
|
||||
rtl_hw_init(dev);
|
||||
|
||||
printk(KERN_INFO "Registering %s switch with Chip ID: 0x%04x, version: 0x%04x\n", priv->hwname, chipid, chipver);
|
||||
|
||||
err = register_switch(dev, netdev);
|
||||
if (err < 0) {
|
||||
kfree(priv);
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
rtl8306_fixup(struct phy_device *pdev)
|
||||
|
@ -307,8 +307,8 @@ static int rtl8366_mc_is_used(struct rtl8366_smi *smi, int mc_index, int *used)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtl8366_set_vlan(struct rtl8366_smi *smi, int vid, u32 member, u32 untag,
|
||||
u32 fid)
|
||||
static int rtl8366_set_vlan(struct rtl8366_smi *smi, int vid, u32 member,
|
||||
u32 untag, u32 fid)
|
||||
{
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
int err;
|
||||
@ -347,47 +347,8 @@ int rtl8366_set_vlan(struct rtl8366_smi *smi, int vid, u32 member, u32 untag,
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_set_vlan);
|
||||
|
||||
int rtl8366_reset_vlan(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct rtl8366_vlan_mc vlanmc;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
/* clear VLAN member configurations */
|
||||
vlanmc.vid = 0;
|
||||
vlanmc.priority = 0;
|
||||
vlanmc.member = 0;
|
||||
vlanmc.untag = 0;
|
||||
vlanmc.fid = 0;
|
||||
for (i = 0; i < smi->num_vlan_mc; i++) {
|
||||
err = smi->ops->set_vlan_mc(smi, i, &vlanmc);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
for (i = 0; i < smi->num_ports; i++) {
|
||||
if (i == smi->cpu_port)
|
||||
continue;
|
||||
|
||||
err = rtl8366_set_vlan(smi, (i + 1),
|
||||
(1 << i) | (1 << smi->cpu_port),
|
||||
(1 << i) | (1 << smi->cpu_port),
|
||||
0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = rtl8366_set_pvid(smi, i, (i + 1));
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_reset_vlan);
|
||||
|
||||
int rtl8366_get_pvid(struct rtl8366_smi *smi, int port, int *val)
|
||||
static int rtl8366_get_pvid(struct rtl8366_smi *smi, int port, int *val)
|
||||
{
|
||||
struct rtl8366_vlan_mc vlanmc;
|
||||
int err;
|
||||
@ -404,9 +365,9 @@ int rtl8366_get_pvid(struct rtl8366_smi *smi, int port, int *val)
|
||||
*val = vlanmc.vid;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_get_pvid);
|
||||
|
||||
int rtl8366_set_pvid(struct rtl8366_smi *smi, unsigned port, unsigned vid)
|
||||
static int rtl8366_set_pvid(struct rtl8366_smi *smi, unsigned port,
|
||||
unsigned vid)
|
||||
{
|
||||
struct rtl8366_vlan_mc vlanmc;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
@ -486,7 +447,44 @@ int rtl8366_set_pvid(struct rtl8366_smi *smi, unsigned port, unsigned vid)
|
||||
|
||||
return -ENOSPC;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_set_pvid);
|
||||
|
||||
int rtl8366_reset_vlan(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct rtl8366_vlan_mc vlanmc;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
/* clear VLAN member configurations */
|
||||
vlanmc.vid = 0;
|
||||
vlanmc.priority = 0;
|
||||
vlanmc.member = 0;
|
||||
vlanmc.untag = 0;
|
||||
vlanmc.fid = 0;
|
||||
for (i = 0; i < smi->num_vlan_mc; i++) {
|
||||
err = smi->ops->set_vlan_mc(smi, i, &vlanmc);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
for (i = 0; i < smi->num_ports; i++) {
|
||||
if (i == smi->cpu_port)
|
||||
continue;
|
||||
|
||||
err = rtl8366_set_vlan(smi, (i + 1),
|
||||
(1 << i) | (1 << smi->cpu_port),
|
||||
(1 << i) | (1 << smi->cpu_port),
|
||||
0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = rtl8366_set_pvid(smi, i, (i + 1));
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_reset_vlan);
|
||||
|
||||
#ifdef CONFIG_RTL8366S_PHY_DEBUG_FS
|
||||
int rtl8366_debugfs_open(struct inode *inode, struct file *file)
|
||||
@ -522,6 +520,34 @@ static ssize_t rtl8366_read_debugfs_vlan_mc(struct file *file,
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t rtl8366_read_debugfs_pvid(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct rtl8366_smi *smi = (struct rtl8366_smi *)file->private_data;
|
||||
char *buf = smi->buf;
|
||||
int len = 0;
|
||||
int i;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len, "%4s %4s\n",
|
||||
"port", "pvid");
|
||||
|
||||
for (i = 0; i < smi->num_ports; i++) {
|
||||
int pvid;
|
||||
int err;
|
||||
|
||||
err = rtl8366_get_pvid(smi, i, &pvid);
|
||||
if (err)
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%4d error\n", i);
|
||||
else
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%4d %4d\n", i, pvid);
|
||||
}
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t rtl8366_read_debugfs_reg(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
@ -636,6 +662,12 @@ static const struct file_operations fops_rtl8366_vlan_mc = {
|
||||
.owner = THIS_MODULE
|
||||
};
|
||||
|
||||
static const struct file_operations fops_rtl8366_pvid = {
|
||||
.read = rtl8366_read_debugfs_pvid,
|
||||
.open = rtl8366_debugfs_open,
|
||||
.owner = THIS_MODULE
|
||||
};
|
||||
|
||||
static const struct file_operations fops_rtl8366_mibs = {
|
||||
.read = rtl8366_read_debugfs_mibs,
|
||||
.open = rtl8366_debugfs_open,
|
||||
@ -681,6 +713,14 @@ static void rtl8366_debugfs_init(struct rtl8366_smi *smi)
|
||||
return;
|
||||
}
|
||||
|
||||
node = debugfs_create_file("pvid", S_IRUSR, root, smi,
|
||||
&fops_rtl8366_pvid);
|
||||
if (!node) {
|
||||
dev_err(smi->parent, "Creating debugfs file '%s' failed\n",
|
||||
"pvid");
|
||||
return;
|
||||
}
|
||||
|
||||
node = debugfs_create_file("mibs", S_IRUSR, smi->debugfs_root, smi,
|
||||
&fops_rtl8366_mibs);
|
||||
if (!node)
|
||||
@ -741,13 +781,168 @@ static void rtl8366_smi_mii_cleanup(struct rtl8366_smi *smi)
|
||||
mdiobus_free(smi->mii_bus);
|
||||
}
|
||||
|
||||
int rtl8366_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_get_pvid(smi, port, val);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_get_port_pvid);
|
||||
|
||||
int rtl8366_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_set_pvid(smi, port, val);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_set_port_pvid);
|
||||
|
||||
int rtl8366_sw_get_port_mib(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
int i, len = 0;
|
||||
unsigned long long counter = 0;
|
||||
char *buf = smi->buf;
|
||||
|
||||
if (val->port_vlan >= smi->num_ports)
|
||||
return -EINVAL;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"Port %d MIB counters\n",
|
||||
val->port_vlan);
|
||||
|
||||
for (i = 0; i < smi->num_mib_counters; ++i) {
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%-36s: ", smi->mib_counters[i].name);
|
||||
if (!smi->ops->get_mib_counter(smi, i, val->port_vlan,
|
||||
&counter))
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%llu\n", counter);
|
||||
else
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%s\n", "error");
|
||||
}
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_get_port_mib);
|
||||
|
||||
int rtl8366_sw_get_vlan_info(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
int i;
|
||||
u32 len = 0;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
char *buf = smi->buf;
|
||||
int err;
|
||||
|
||||
if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
|
||||
return -EINVAL;
|
||||
|
||||
memset(buf, '\0', sizeof(smi->buf));
|
||||
|
||||
err = smi->ops->get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"VLAN %d: Ports: '", vlan4k.vid);
|
||||
|
||||
for (i = 0; i < smi->num_ports; i++) {
|
||||
if (!(vlan4k.member & (1 << i)))
|
||||
continue;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len, "%d%s", i,
|
||||
(vlan4k.untag & (1 << i)) ? "" : "t");
|
||||
}
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"', members=%04x, untag=%04x, fid=%u",
|
||||
vlan4k.member, vlan4k.untag, vlan4k.fid);
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_get_vlan_info);
|
||||
|
||||
int rtl8366_sw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
int i;
|
||||
|
||||
if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
|
||||
return -EINVAL;
|
||||
|
||||
smi->ops->get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
|
||||
port = &val->value.ports[0];
|
||||
val->len = 0;
|
||||
for (i = 0; i < smi->num_ports; i++) {
|
||||
if (!(vlan4k.member & BIT(i)))
|
||||
continue;
|
||||
|
||||
port->id = i;
|
||||
port->flags = (vlan4k.untag & BIT(i)) ?
|
||||
0 : BIT(SWITCH_PORT_FLAG_TAGGED);
|
||||
val->len++;
|
||||
port++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_get_vlan_ports);
|
||||
|
||||
int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
u32 member = 0;
|
||||
u32 untag = 0;
|
||||
int i;
|
||||
|
||||
if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
|
||||
return -EINVAL;
|
||||
|
||||
port = &val->value.ports[0];
|
||||
for (i = 0; i < val->len; i++, port++) {
|
||||
member |= BIT(port->id);
|
||||
|
||||
if (!(port->flags & BIT(SWITCH_PORT_FLAG_TAGGED)))
|
||||
untag |= BIT(port->id);
|
||||
}
|
||||
|
||||
return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_sw_set_vlan_ports);
|
||||
|
||||
struct rtl8366_smi *rtl8366_smi_alloc(struct device *parent)
|
||||
{
|
||||
struct rtl8366_smi *smi;
|
||||
|
||||
BUG_ON(!parent);
|
||||
|
||||
smi = kzalloc(sizeof(*smi), GFP_KERNEL);
|
||||
if (!smi) {
|
||||
dev_err(parent, "no memory for private data\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
smi->parent = parent;
|
||||
return smi;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rtl8366_smi_alloc);
|
||||
|
||||
int rtl8366_smi_init(struct rtl8366_smi *smi)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!smi->parent)
|
||||
return -EINVAL;
|
||||
|
||||
if (!smi->ops)
|
||||
return -EINVAL;
|
||||
|
||||
@ -776,6 +971,12 @@ int rtl8366_smi_init(struct rtl8366_smi *smi)
|
||||
goto err_free_sck;
|
||||
}
|
||||
|
||||
err = smi->ops->setup(smi);
|
||||
if (err) {
|
||||
dev_err(smi->parent, "chip setup failed, err=%d\n", err);
|
||||
goto err_free_sck;
|
||||
}
|
||||
|
||||
err = rtl8366_smi_mii_init(smi);
|
||||
if (err)
|
||||
goto err_free_sck;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define _RTL8366_SMI_H
|
||||
|
||||
#include <linux/phy.h>
|
||||
#include <linux/switch.h>
|
||||
|
||||
struct rtl8366_smi_ops;
|
||||
struct rtl8366_vlan_ops;
|
||||
@ -34,6 +35,7 @@ struct rtl8366_smi {
|
||||
spinlock_t lock;
|
||||
struct mii_bus *mii_bus;
|
||||
int mii_irq[PHY_MAX_ADDR];
|
||||
struct switch_dev sw_dev;
|
||||
|
||||
unsigned int cpu_port;
|
||||
unsigned int num_ports;
|
||||
@ -67,6 +69,7 @@ struct rtl8366_vlan_4k {
|
||||
|
||||
struct rtl8366_smi_ops {
|
||||
int (*detect)(struct rtl8366_smi *smi);
|
||||
int (*setup)(struct rtl8366_smi *smi);
|
||||
|
||||
int (*mii_read)(struct mii_bus *bus, int addr, int reg);
|
||||
int (*mii_write)(struct mii_bus *bus, int addr, int reg, u16 val);
|
||||
@ -83,22 +86,36 @@ struct rtl8366_smi_ops {
|
||||
int (*set_mc_index)(struct rtl8366_smi *smi, int port, int index);
|
||||
int (*get_mib_counter)(struct rtl8366_smi *smi, int counter,
|
||||
int port, unsigned long long *val);
|
||||
int (*is_vlan_valid)(struct rtl8366_smi *smi, unsigned vlan);
|
||||
};
|
||||
|
||||
struct rtl8366_smi *rtl8366_smi_alloc(struct device *parent);
|
||||
int rtl8366_smi_init(struct rtl8366_smi *smi);
|
||||
void rtl8366_smi_cleanup(struct rtl8366_smi *smi);
|
||||
int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data);
|
||||
int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data);
|
||||
int rtl8366_smi_rmwr(struct rtl8366_smi *smi, u32 addr, u32 mask, u32 data);
|
||||
|
||||
int rtl8366_set_vlan(struct rtl8366_smi *smi, int vid, u32 member, u32 untag,
|
||||
u32 fid);
|
||||
int rtl8366_reset_vlan(struct rtl8366_smi *smi);
|
||||
int rtl8366_get_pvid(struct rtl8366_smi *smi, int port, int *val);
|
||||
int rtl8366_set_pvid(struct rtl8366_smi *smi, unsigned port, unsigned vid);
|
||||
|
||||
#ifdef CONFIG_RTL8366S_PHY_DEBUG_FS
|
||||
int rtl8366_debugfs_open(struct inode *inode, struct file *file);
|
||||
#endif
|
||||
|
||||
static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
|
||||
{
|
||||
return container_of(sw, struct rtl8366_smi, sw_dev);
|
||||
}
|
||||
|
||||
int rtl8366_sw_get_port_pvid(struct switch_dev *dev, int port, int *val);
|
||||
int rtl8366_sw_set_port_pvid(struct switch_dev *dev, int port, int val);
|
||||
int rtl8366_sw_get_port_mib(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
int rtl8366_sw_get_vlan_info(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val);
|
||||
int rtl8366_sw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val);
|
||||
int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val);
|
||||
|
||||
#endif /* _RTL8366_SMI_H */
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/switch.h>
|
||||
#include <linux/rtl8366rb.h>
|
||||
|
||||
#include "rtl8366_smi.h"
|
||||
@ -107,7 +106,7 @@
|
||||
#define RTL8366RB_TABLE_VLAN_READ_CTRL 0x0E01
|
||||
#define RTL8366RB_TABLE_VLAN_WRITE_CTRL 0x0F01
|
||||
|
||||
#define RTL8366RB_VLAN_MEMCONF_BASE 0x0020
|
||||
#define RTL8366RB_VLAN_MC_BASE(_x) (0x0020 + (_x) * 3)
|
||||
|
||||
|
||||
#define RTL8366RB_PORT_LINK_STATUS_BASE 0x0014
|
||||
@ -156,32 +155,13 @@
|
||||
|
||||
#define RTL8366RB_PORT_ALL_INTERNAL RTL8366RB_PORT_CPU
|
||||
|
||||
struct rtl8366rb {
|
||||
struct device *parent;
|
||||
struct rtl8366_smi smi;
|
||||
struct switch_dev dev;
|
||||
};
|
||||
|
||||
struct rtl8366rb_vlan_mc {
|
||||
u16 reserved2:1;
|
||||
u16 priority:3;
|
||||
u16 vid:12;
|
||||
u16 untag:8;
|
||||
u16 member:8;
|
||||
u16 stag_mbr:8;
|
||||
u16 stag_idx:3;
|
||||
u16 reserved1:2;
|
||||
u16 fid:3;
|
||||
};
|
||||
|
||||
struct rtl8366rb_vlan_4k {
|
||||
u16 reserved1:4;
|
||||
u16 vid:12;
|
||||
u16 untag:8;
|
||||
u16 member:8;
|
||||
u16 reserved2:13;
|
||||
u16 fid:3;
|
||||
};
|
||||
#define RTL8366RB_VLAN_VID_MASK 0xfff
|
||||
#define RTL8366RB_VLAN_PRIORITY_SHIFT 12
|
||||
#define RTL8366RB_VLAN_PRIORITY_MASK 0x7
|
||||
#define RTL8366RB_VLAN_UNTAG_SHIFT 8
|
||||
#define RTL8366RB_VLAN_UNTAG_MASK 0xff
|
||||
#define RTL8366RB_VLAN_MEMBER_MASK 0xff
|
||||
#define RTL8366RB_VLAN_FID_MASK 0x7
|
||||
|
||||
static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = {
|
||||
{ 0, 0, 4, "IfInOctets" },
|
||||
@ -233,22 +213,6 @@ static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = {
|
||||
return err; \
|
||||
} while (0)
|
||||
|
||||
static inline struct rtl8366rb *smi_to_rtl8366rb(struct rtl8366_smi *smi)
|
||||
{
|
||||
return container_of(smi, struct rtl8366rb, smi);
|
||||
}
|
||||
|
||||
static inline struct rtl8366rb *sw_to_rtl8366rb(struct switch_dev *sw)
|
||||
{
|
||||
return container_of(sw, struct rtl8366rb, dev);
|
||||
}
|
||||
|
||||
static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
|
||||
{
|
||||
struct rtl8366rb *rtl = sw_to_rtl8366rb(sw);
|
||||
return &rtl->smi;
|
||||
}
|
||||
|
||||
static int rtl8366rb_reset_chip(struct rtl8366_smi *smi)
|
||||
{
|
||||
int timeout = 10;
|
||||
@ -419,22 +383,18 @@ static int rtl8366rb_get_mib_counter(struct rtl8366_smi *smi, int counter,
|
||||
static int rtl8366rb_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
struct rtl8366_vlan_4k *vlan4k)
|
||||
{
|
||||
struct rtl8366rb_vlan_4k vlan4k_priv;
|
||||
u32 data[3];
|
||||
int err;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
memset(vlan4k, '\0', sizeof(struct rtl8366_vlan_4k));
|
||||
vlan4k_priv.vid = vid;
|
||||
|
||||
if (vid >= RTL8366RB_NUM_VIDS)
|
||||
return -EINVAL;
|
||||
|
||||
tableaddr = (u16 *)&vlan4k_priv;
|
||||
|
||||
/* write VID */
|
||||
data = *tableaddr;
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_VLAN_TABLE_WRITE_BASE, data);
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_VLAN_TABLE_WRITE_BASE,
|
||||
vid & RTL8366RB_VLAN_VID_MASK);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -444,31 +404,19 @@ static int rtl8366rb_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = rtl8366_smi_read_reg(smi, RTL8366RB_VLAN_TABLE_READ_BASE, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
err = rtl8366_smi_read_reg(smi, RTL8366RB_VLAN_TABLE_READ_BASE + 1,
|
||||
&data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
err = rtl8366_smi_read_reg(smi, RTL8366RB_VLAN_TABLE_READ_BASE + 2,
|
||||
&data);
|
||||
if (err)
|
||||
return err;
|
||||
*tableaddr = data;
|
||||
for (i = 0; i < 3; i++) {
|
||||
err = rtl8366_smi_read_reg(smi,
|
||||
RTL8366RB_VLAN_TABLE_READ_BASE + i,
|
||||
&data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
vlan4k->vid = vid;
|
||||
vlan4k->untag = vlan4k_priv.untag;
|
||||
vlan4k->member = vlan4k_priv.member;
|
||||
vlan4k->fid = vlan4k_priv.fid;
|
||||
vlan4k->untag = (data[1] >> RTL8366RB_VLAN_UNTAG_SHIFT) &
|
||||
RTL8366RB_VLAN_UNTAG_MASK;
|
||||
vlan4k->member = data[1] & RTL8366RB_VLAN_MEMBER_MASK;
|
||||
vlan4k->fid = data[2] & RTL8366RB_VLAN_FID_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -476,10 +424,9 @@ static int rtl8366rb_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
static int rtl8366rb_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
const struct rtl8366_vlan_4k *vlan4k)
|
||||
{
|
||||
struct rtl8366rb_vlan_4k vlan4k_priv;
|
||||
u32 data[3];
|
||||
int err;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
if (vlan4k->vid >= RTL8366RB_NUM_VIDS ||
|
||||
vlan4k->member > RTL8366RB_PORT_ALL ||
|
||||
@ -487,36 +434,19 @@ static int rtl8366rb_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
vlan4k->fid > RTL8366RB_FIDMAX)
|
||||
return -EINVAL;
|
||||
|
||||
vlan4k_priv.vid = vlan4k->vid;
|
||||
vlan4k_priv.untag = vlan4k->untag;
|
||||
vlan4k_priv.member = vlan4k->member;
|
||||
vlan4k_priv.fid = vlan4k->fid;
|
||||
data[0] = vlan4k->vid & RTL8366RB_VLAN_VID_MASK;
|
||||
data[1] = (vlan4k->member & RTL8366RB_VLAN_MEMBER_MASK) |
|
||||
((vlan4k->untag & RTL8366RB_VLAN_UNTAG_MASK) <<
|
||||
RTL8366RB_VLAN_UNTAG_SHIFT);
|
||||
data[2] = vlan4k->fid & RTL8366RB_VLAN_FID_MASK;
|
||||
|
||||
tableaddr = (u16 *)&vlan4k_priv;
|
||||
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_VLAN_TABLE_WRITE_BASE, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
tableaddr++;
|
||||
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_VLAN_TABLE_WRITE_BASE + 1,
|
||||
data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
tableaddr++;
|
||||
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_VLAN_TABLE_WRITE_BASE + 2,
|
||||
data);
|
||||
if (err)
|
||||
return err;
|
||||
for (i = 0; i < 3; i++) {
|
||||
err = rtl8366_smi_write_reg(smi,
|
||||
RTL8366RB_VLAN_TABLE_WRITE_BASE + i,
|
||||
data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* write table access control word */
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366RB_TABLE_ACCESS_CTRL_REG,
|
||||
@ -528,47 +458,30 @@ static int rtl8366rb_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
static int rtl8366rb_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
struct rtl8366_vlan_mc *vlanmc)
|
||||
{
|
||||
struct rtl8366rb_vlan_mc vlanmc_priv;
|
||||
u32 data[3];
|
||||
int err;
|
||||
u32 addr;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
memset(vlanmc, '\0', sizeof(struct rtl8366_vlan_mc));
|
||||
|
||||
if (index >= RTL8366RB_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
tableaddr = (u16 *)&vlanmc_priv;
|
||||
for (i = 0; i < 3; i++) {
|
||||
err = rtl8366_smi_read_reg(smi,
|
||||
RTL8366RB_VLAN_MC_BASE(index) + i,
|
||||
&data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + (index * 3);
|
||||
err = rtl8366_smi_read_reg(smi, addr, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + 1 + (index * 3);
|
||||
err = rtl8366_smi_read_reg(smi, addr, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + 2 + (index * 3);
|
||||
err = rtl8366_smi_read_reg(smi, addr, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
|
||||
vlanmc->vid = vlanmc_priv.vid;
|
||||
vlanmc->priority = vlanmc_priv.priority;
|
||||
vlanmc->untag = vlanmc_priv.untag;
|
||||
vlanmc->member = vlanmc_priv.member;
|
||||
vlanmc->fid = vlanmc_priv.fid;
|
||||
vlanmc->vid = data[0] & RTL8366RB_VLAN_VID_MASK;
|
||||
vlanmc->priority = (data[0] >> RTL8366RB_VLAN_PRIORITY_SHIFT) &
|
||||
RTL8366RB_VLAN_PRIORITY_MASK;
|
||||
vlanmc->untag = (data[1] >> RTL8366RB_VLAN_UNTAG_SHIFT) &
|
||||
RTL8366RB_VLAN_UNTAG_MASK;
|
||||
vlanmc->member = data[1] & RTL8366RB_VLAN_MEMBER_MASK;
|
||||
vlanmc->fid = data[2] & RTL8366RB_VLAN_FID_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -576,11 +489,9 @@ static int rtl8366rb_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
static int rtl8366rb_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
const struct rtl8366_vlan_mc *vlanmc)
|
||||
{
|
||||
struct rtl8366rb_vlan_mc vlanmc_priv;
|
||||
u32 data[3];
|
||||
int err;
|
||||
u32 addr;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
if (index >= RTL8366RB_NUM_VLANS ||
|
||||
vlanmc->vid >= RTL8366RB_NUM_VIDS ||
|
||||
@ -590,40 +501,22 @@ static int rtl8366rb_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
vlanmc->fid > RTL8366RB_FIDMAX)
|
||||
return -EINVAL;
|
||||
|
||||
vlanmc_priv.vid = vlanmc->vid;
|
||||
vlanmc_priv.priority = vlanmc->priority;
|
||||
vlanmc_priv.untag = vlanmc->untag;
|
||||
vlanmc_priv.member = vlanmc->member;
|
||||
vlanmc_priv.stag_mbr = 0;
|
||||
vlanmc_priv.stag_idx = 0;
|
||||
vlanmc_priv.fid = vlanmc->fid;
|
||||
data[0] = (vlanmc->vid & RTL8366RB_VLAN_VID_MASK) |
|
||||
((vlanmc->priority & RTL8366RB_VLAN_PRIORITY_MASK) <<
|
||||
RTL8366RB_VLAN_PRIORITY_SHIFT);
|
||||
data[1] = (vlanmc->member & RTL8366RB_VLAN_MEMBER_MASK) |
|
||||
((vlanmc->untag & RTL8366RB_VLAN_UNTAG_MASK) <<
|
||||
RTL8366RB_VLAN_UNTAG_SHIFT);
|
||||
data[2] = vlanmc->fid & RTL8366RB_VLAN_FID_MASK;
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + (index * 3);
|
||||
for (i = 0; i < 3; i++) {
|
||||
err = rtl8366_smi_write_reg(smi,
|
||||
RTL8366RB_VLAN_MC_BASE(index) + i,
|
||||
data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
tableaddr = (u16 *)&vlanmc_priv;
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, addr, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + 1 + (index * 3);
|
||||
|
||||
tableaddr++;
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, addr, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
addr = RTL8366RB_VLAN_MEMCONF_BASE + 2 + (index * 3);
|
||||
|
||||
tableaddr++;
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, addr, data);
|
||||
if (err)
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -659,6 +552,14 @@ static int rtl8366rb_set_mc_index(struct rtl8366_smi *smi, int port, int index)
|
||||
RTL8366RB_PORT_VLAN_CTRL_SHIFT(port));
|
||||
}
|
||||
|
||||
static int rtl8366rb_is_vlan_valid(struct rtl8366_smi *smi, unsigned vlan)
|
||||
{
|
||||
if (vlan == 0 || vlan >= RTL8366RB_NUM_VLANS)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int rtl8366rb_vlan_set_vlan(struct rtl8366_smi *smi, int enable)
|
||||
{
|
||||
return rtl8366_smi_rmwr(smi, RTL8366RB_SGCR, RTL8366RB_SGCR_EN_VLAN,
|
||||
@ -677,13 +578,9 @@ static int rtl8366rb_sw_reset_mibs(struct switch_dev *dev,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
int err = 0;
|
||||
|
||||
if (val->value.i == 1)
|
||||
err = rtl8366_smi_rmwr(smi, RTL8366RB_MIB_CTRL_REG, 0,
|
||||
RTL8366RB_MIB_CTRL_GLOBAL_RESET);
|
||||
|
||||
return err;
|
||||
return rtl8366_smi_rmwr(smi, RTL8366RB_MIB_CTRL_REG, 0,
|
||||
RTL8366RB_MIB_CTRL_GLOBAL_RESET);
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_get_vlan_enable(struct switch_dev *dev,
|
||||
@ -843,47 +740,6 @@ static int rtl8366rb_sw_get_port_link(struct switch_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_get_vlan_info(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
int i;
|
||||
u32 len = 0;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
char *buf = smi->buf;
|
||||
int err;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366RB_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
memset(buf, '\0', sizeof(smi->buf));
|
||||
|
||||
err = rtl8366rb_get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"VLAN %d: Ports: '", vlan4k.vid);
|
||||
|
||||
for (i = 0; i < RTL8366RB_NUM_PORTS; i++) {
|
||||
if (!(vlan4k.member & (1 << i)))
|
||||
continue;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len, "%d%s", i,
|
||||
(vlan4k.untag & (1 << i)) ? "" : "t");
|
||||
}
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"', members=%04x, untag=%04x, fid=%u",
|
||||
vlan4k.member, vlan4k.untag, vlan4k.fid);
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_set_port_led(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
@ -938,101 +794,6 @@ static int rtl8366rb_sw_reset_port_mibs(struct switch_dev *dev,
|
||||
RTL8366RB_MIB_CTRL_PORT_RESET(val->port_vlan));
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_get_port_mib(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
int i, len = 0;
|
||||
unsigned long long counter = 0;
|
||||
char *buf = smi->buf;
|
||||
|
||||
if (val->port_vlan >= RTL8366RB_NUM_PORTS)
|
||||
return -EINVAL;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"Port %d MIB counters\n",
|
||||
val->port_vlan);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rtl8366rb_mib_counters); ++i) {
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%-36s: ", rtl8366rb_mib_counters[i].name);
|
||||
if (!rtl8366rb_get_mib_counter(smi, i, val->port_vlan, &counter))
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%llu\n", counter);
|
||||
else
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%s\n", "error");
|
||||
}
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_get_vlan_ports(struct switch_dev *dev,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
int i;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366RB_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
rtl8366rb_get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
|
||||
port = &val->value.ports[0];
|
||||
val->len = 0;
|
||||
for (i = 0; i < RTL8366RB_NUM_PORTS; i++) {
|
||||
if (!(vlan4k.member & BIT(i)))
|
||||
continue;
|
||||
|
||||
port->id = i;
|
||||
port->flags = (vlan4k.untag & BIT(i)) ?
|
||||
0 : BIT(SWITCH_PORT_FLAG_TAGGED);
|
||||
val->len++;
|
||||
port++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_set_vlan_ports(struct switch_dev *dev,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
u32 member = 0;
|
||||
u32 untag = 0;
|
||||
int i;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366RB_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
port = &val->value.ports[0];
|
||||
for (i = 0; i < val->len; i++, port++) {
|
||||
member |= BIT(port->id);
|
||||
|
||||
if (!(port->flags & BIT(SWITCH_PORT_FLAG_TAGGED)))
|
||||
untag |= BIT(port->id);
|
||||
}
|
||||
|
||||
return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_get_pvid(smi, port, val);
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_set_pvid(smi, port, val);
|
||||
}
|
||||
|
||||
static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
@ -1074,12 +835,10 @@ static struct switch_attr rtl8366rb_globals[] = {
|
||||
.max = 1,
|
||||
.ofs = 2
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.type = SWITCH_TYPE_NOVAL,
|
||||
.name = "reset_mibs",
|
||||
.description = "Reset all MIB counters",
|
||||
.set = rtl8366rb_sw_reset_mibs,
|
||||
.get = NULL,
|
||||
.max = 1
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.name = "blinkrate",
|
||||
@ -1100,19 +859,17 @@ static struct switch_attr rtl8366rb_port[] = {
|
||||
.set = NULL,
|
||||
.get = rtl8366rb_sw_get_port_link,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.type = SWITCH_TYPE_NOVAL,
|
||||
.name = "reset_mib",
|
||||
.description = "Reset single port MIB counters",
|
||||
.max = 1,
|
||||
.set = rtl8366rb_sw_reset_port_mibs,
|
||||
.get = NULL,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_STRING,
|
||||
.name = "mib",
|
||||
.description = "Get MIB counters for port",
|
||||
.max = 33,
|
||||
.set = NULL,
|
||||
.get = rtl8366rb_sw_get_port_mib,
|
||||
.get = rtl8366_sw_get_port_mib,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.name = "led",
|
||||
@ -1130,16 +887,11 @@ static struct switch_attr rtl8366rb_vlan[] = {
|
||||
.description = "Get vlan information",
|
||||
.max = 1,
|
||||
.set = NULL,
|
||||
.get = rtl8366rb_sw_get_vlan_info,
|
||||
.get = rtl8366_sw_get_vlan_info,
|
||||
},
|
||||
};
|
||||
|
||||
/* template */
|
||||
static struct switch_dev rtl8366_switch_dev = {
|
||||
.name = "RTL8366S",
|
||||
.cpu_port = RTL8366RB_PORT_NUM_CPU,
|
||||
.ports = RTL8366RB_NUM_PORTS,
|
||||
.vlans = RTL8366RB_NUM_VLANS,
|
||||
static const struct switch_dev_ops rtl8366_ops = {
|
||||
.attr_global = {
|
||||
.attr = rtl8366rb_globals,
|
||||
.n_attr = ARRAY_SIZE(rtl8366rb_globals),
|
||||
@ -1153,32 +905,35 @@ static struct switch_dev rtl8366_switch_dev = {
|
||||
.n_attr = ARRAY_SIZE(rtl8366rb_vlan),
|
||||
},
|
||||
|
||||
.get_vlan_ports = rtl8366rb_sw_get_vlan_ports,
|
||||
.set_vlan_ports = rtl8366rb_sw_set_vlan_ports,
|
||||
.get_port_pvid = rtl8366rb_sw_get_port_pvid,
|
||||
.set_port_pvid = rtl8366rb_sw_set_port_pvid,
|
||||
.get_vlan_ports = rtl8366_sw_get_vlan_ports,
|
||||
.set_vlan_ports = rtl8366_sw_set_vlan_ports,
|
||||
.get_port_pvid = rtl8366_sw_get_port_pvid,
|
||||
.set_port_pvid = rtl8366_sw_set_port_pvid,
|
||||
.reset_switch = rtl8366rb_sw_reset_switch,
|
||||
};
|
||||
|
||||
static int rtl8366rb_switch_init(struct rtl8366rb *rtl)
|
||||
static int rtl8366rb_switch_init(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct switch_dev *dev = &rtl->dev;
|
||||
struct switch_dev *dev = &smi->sw_dev;
|
||||
int err;
|
||||
|
||||
memcpy(dev, &rtl8366_switch_dev, sizeof(struct switch_dev));
|
||||
dev->priv = rtl;
|
||||
dev->devname = dev_name(rtl->parent);
|
||||
dev->name = "RTL8366RB";
|
||||
dev->cpu_port = RTL8366RB_PORT_NUM_CPU;
|
||||
dev->ports = RTL8366RB_NUM_PORTS;
|
||||
dev->vlans = RTL8366RB_NUM_VLANS;
|
||||
dev->ops = &rtl8366_ops;
|
||||
dev->devname = dev_name(smi->parent);
|
||||
|
||||
err = register_switch(dev, NULL);
|
||||
if (err)
|
||||
dev_err(rtl->parent, "switch registration failed\n");
|
||||
dev_err(smi->parent, "switch registration failed\n");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void rtl8366rb_switch_cleanup(struct rtl8366rb *rtl)
|
||||
static void rtl8366rb_switch_cleanup(struct rtl8366_smi *smi)
|
||||
{
|
||||
unregister_switch(&rtl->dev);
|
||||
unregister_switch(&smi->sw_dev);
|
||||
}
|
||||
|
||||
static int rtl8366rb_mii_read(struct mii_bus *bus, int addr, int reg)
|
||||
@ -1213,9 +968,8 @@ static int rtl8366rb_mii_bus_match(struct mii_bus *bus)
|
||||
bus->write == rtl8366rb_mii_write);
|
||||
}
|
||||
|
||||
static int rtl8366rb_setup(struct rtl8366rb *rtl)
|
||||
static int rtl8366rb_setup(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct rtl8366_smi *smi = &rtl->smi;
|
||||
int ret;
|
||||
|
||||
ret = rtl8366rb_reset_chip(smi);
|
||||
@ -1261,6 +1015,8 @@ static int rtl8366rb_detect(struct rtl8366_smi *smi)
|
||||
|
||||
static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
|
||||
.detect = rtl8366rb_detect,
|
||||
.setup = rtl8366rb_setup,
|
||||
|
||||
.mii_read = rtl8366rb_mii_read,
|
||||
.mii_write = rtl8366rb_mii_write,
|
||||
|
||||
@ -1271,13 +1027,13 @@ static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
|
||||
.get_mc_index = rtl8366rb_get_mc_index,
|
||||
.set_mc_index = rtl8366rb_set_mc_index,
|
||||
.get_mib_counter = rtl8366rb_get_mib_counter,
|
||||
.is_vlan_valid = rtl8366rb_is_vlan_valid,
|
||||
};
|
||||
|
||||
static int __init rtl8366rb_probe(struct platform_device *pdev)
|
||||
{
|
||||
static int rtl8366_smi_version_printed;
|
||||
struct rtl8366rb_platform_data *pdata;
|
||||
struct rtl8366rb *rtl;
|
||||
struct rtl8366_smi *smi;
|
||||
int err;
|
||||
|
||||
@ -1292,17 +1048,12 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
rtl = kzalloc(sizeof(*rtl), GFP_KERNEL);
|
||||
if (!rtl) {
|
||||
dev_err(&pdev->dev, "no memory for private data\n");
|
||||
smi = rtl8366_smi_alloc(&pdev->dev);
|
||||
if (!smi) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
rtl->parent = &pdev->dev;
|
||||
|
||||
smi = &rtl->smi;
|
||||
smi->parent = &pdev->dev;
|
||||
smi->gpio_sda = pdata->gpio_sda;
|
||||
smi->gpio_sck = pdata->gpio_sck;
|
||||
smi->ops = &rtl8366rb_smi_ops;
|
||||
@ -1314,15 +1065,11 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
|
||||
|
||||
err = rtl8366_smi_init(smi);
|
||||
if (err)
|
||||
goto err_free_rtl;
|
||||
goto err_free_smi;
|
||||
|
||||
platform_set_drvdata(pdev, rtl);
|
||||
platform_set_drvdata(pdev, smi);
|
||||
|
||||
err = rtl8366rb_setup(rtl);
|
||||
if (err)
|
||||
goto err_clear_drvdata;
|
||||
|
||||
err = rtl8366rb_switch_init(rtl);
|
||||
err = rtl8366rb_switch_init(smi);
|
||||
if (err)
|
||||
goto err_clear_drvdata;
|
||||
|
||||
@ -1331,8 +1078,8 @@ static int __init rtl8366rb_probe(struct platform_device *pdev)
|
||||
err_clear_drvdata:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
rtl8366_smi_cleanup(smi);
|
||||
err_free_rtl:
|
||||
kfree(rtl);
|
||||
err_free_smi:
|
||||
kfree(smi);
|
||||
err_out:
|
||||
return err;
|
||||
}
|
||||
@ -1365,13 +1112,13 @@ static struct phy_driver rtl8366rb_phy_driver = {
|
||||
|
||||
static int __devexit rtl8366rb_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rtl8366rb *rtl = platform_get_drvdata(pdev);
|
||||
struct rtl8366_smi *smi = platform_get_drvdata(pdev);
|
||||
|
||||
if (rtl) {
|
||||
rtl8366rb_switch_cleanup(rtl);
|
||||
if (smi) {
|
||||
rtl8366rb_switch_cleanup(smi);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
rtl8366_smi_cleanup(&rtl->smi);
|
||||
kfree(rtl);
|
||||
rtl8366_smi_cleanup(smi);
|
||||
kfree(smi);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/switch.h>
|
||||
#include <linux/rtl8366s.h>
|
||||
|
||||
#include "rtl8366_smi.h"
|
||||
@ -110,7 +109,7 @@
|
||||
#define RTL8366S_TABLE_VLAN_READ_CTRL 0x0E01
|
||||
#define RTL8366S_TABLE_VLAN_WRITE_CTRL 0x0F01
|
||||
|
||||
#define RTL8366S_VLAN_MEMCONF_BASE 0x0016
|
||||
#define RTL8366S_VLAN_MC_BASE(_x) (0x0016 + (_x) * 2)
|
||||
|
||||
#define RTL8366S_VLAN_MEMBERINGRESS_REG 0x0379
|
||||
|
||||
@ -161,32 +160,14 @@
|
||||
#define RTL8366S_PORT_ALL_INTERNAL (RTL8366S_PORT_UNKNOWN | \
|
||||
RTL8366S_PORT_CPU)
|
||||
|
||||
struct rtl8366s {
|
||||
struct device *parent;
|
||||
struct rtl8366_smi smi;
|
||||
struct switch_dev dev;
|
||||
};
|
||||
|
||||
struct rtl8366s_vlan_mc {
|
||||
u16 reserved2:1;
|
||||
u16 priority:3;
|
||||
u16 vid:12;
|
||||
|
||||
u16 reserved1:1;
|
||||
u16 fid:3;
|
||||
u16 untag:6;
|
||||
u16 member:6;
|
||||
};
|
||||
|
||||
struct rtl8366s_vlan_4k {
|
||||
u16 reserved1:4;
|
||||
u16 vid:12;
|
||||
|
||||
u16 reserved2:1;
|
||||
u16 fid:3;
|
||||
u16 untag:6;
|
||||
u16 member:6;
|
||||
};
|
||||
#define RTL8366S_VLAN_VID_MASK 0xfff
|
||||
#define RTL8366S_VLAN_PRIORITY_SHIFT 12
|
||||
#define RTL8366S_VLAN_PRIORITY_MASK 0x7
|
||||
#define RTL8366S_VLAN_MEMBER_MASK 0x3f
|
||||
#define RTL8366S_VLAN_UNTAG_SHIFT 6
|
||||
#define RTL8366S_VLAN_UNTAG_MASK 0x3f
|
||||
#define RTL8366S_VLAN_FID_SHIFT 12
|
||||
#define RTL8366S_VLAN_FID_MASK 0x7
|
||||
|
||||
static struct rtl8366_mib_counter rtl8366s_mib_counters[] = {
|
||||
{ 0, 0, 4, "IfInOctets" },
|
||||
@ -243,22 +224,6 @@ static struct rtl8366_mib_counter rtl8366s_mib_counters[] = {
|
||||
return err; \
|
||||
} while (0)
|
||||
|
||||
static inline struct rtl8366s *smi_to_rtl8366s(struct rtl8366_smi *smi)
|
||||
{
|
||||
return container_of(smi, struct rtl8366s, smi);
|
||||
}
|
||||
|
||||
static inline struct rtl8366s *sw_to_rtl8366s(struct switch_dev *sw)
|
||||
{
|
||||
return container_of(sw, struct rtl8366s, dev);
|
||||
}
|
||||
|
||||
static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
|
||||
{
|
||||
struct rtl8366s *rtl = sw_to_rtl8366s(sw);
|
||||
return &rtl->smi;
|
||||
}
|
||||
|
||||
static int rtl8366s_reset_chip(struct rtl8366_smi *smi)
|
||||
{
|
||||
int timeout = 10;
|
||||
@ -442,22 +407,18 @@ static int rtl8366_get_mib_counter(struct rtl8366_smi *smi, int counter,
|
||||
static int rtl8366s_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
struct rtl8366_vlan_4k *vlan4k)
|
||||
{
|
||||
struct rtl8366s_vlan_4k vlan4k_priv;
|
||||
u32 data[2];
|
||||
int err;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
memset(vlan4k, '\0', sizeof(struct rtl8366_vlan_4k));
|
||||
vlan4k_priv.vid = vid;
|
||||
|
||||
if (vid >= RTL8366S_NUM_VIDS)
|
||||
return -EINVAL;
|
||||
|
||||
tableaddr = (u16 *)&vlan4k_priv;
|
||||
|
||||
/* write VID */
|
||||
data = *tableaddr;
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TABLE_WRITE_BASE, data);
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TABLE_WRITE_BASE,
|
||||
vid & RTL8366S_VLAN_VID_MASK);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -467,24 +428,20 @@ static int rtl8366s_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = rtl8366_smi_read_reg(smi, RTL8366S_VLAN_TABLE_READ_BASE, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
err = rtl8366_smi_read_reg(smi, RTL8366S_VLAN_TABLE_READ_BASE + 1,
|
||||
&data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
for (i = 0; i < 2; i++) {
|
||||
err = rtl8366_smi_read_reg(smi,
|
||||
RTL8366S_VLAN_TABLE_READ_BASE + i,
|
||||
&data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
vlan4k->vid = vid;
|
||||
vlan4k->untag = vlan4k_priv.untag;
|
||||
vlan4k->member = vlan4k_priv.member;
|
||||
vlan4k->fid = vlan4k_priv.fid;
|
||||
vlan4k->untag = (data[1] >> RTL8366S_VLAN_UNTAG_SHIFT) &
|
||||
RTL8366S_VLAN_UNTAG_MASK;
|
||||
vlan4k->member = data[1] & RTL8366S_VLAN_MEMBER_MASK;
|
||||
vlan4k->fid = (data[1] >> RTL8366S_VLAN_FID_SHIFT) &
|
||||
RTL8366S_VLAN_FID_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -492,10 +449,9 @@ static int rtl8366s_get_vlan_4k(struct rtl8366_smi *smi, u32 vid,
|
||||
static int rtl8366s_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
const struct rtl8366_vlan_4k *vlan4k)
|
||||
{
|
||||
struct rtl8366s_vlan_4k vlan4k_priv;
|
||||
u32 data[2];
|
||||
int err;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
if (vlan4k->vid >= RTL8366S_NUM_VIDS ||
|
||||
vlan4k->member > RTL8366S_PORT_ALL ||
|
||||
@ -503,27 +459,20 @@ static int rtl8366s_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
vlan4k->fid > RTL8366S_FIDMAX)
|
||||
return -EINVAL;
|
||||
|
||||
vlan4k_priv.vid = vlan4k->vid;
|
||||
vlan4k_priv.untag = vlan4k->untag;
|
||||
vlan4k_priv.member = vlan4k->member;
|
||||
vlan4k_priv.fid = vlan4k->fid;
|
||||
data[0] = vlan4k->vid & RTL8366S_VLAN_VID_MASK;
|
||||
data[1] = (vlan4k->member & RTL8366S_VLAN_MEMBER_MASK) |
|
||||
((vlan4k->untag & RTL8366S_VLAN_UNTAG_MASK) <<
|
||||
RTL8366S_VLAN_UNTAG_SHIFT) |
|
||||
((vlan4k->fid & RTL8366S_VLAN_FID_MASK) <<
|
||||
RTL8366S_VLAN_FID_SHIFT);
|
||||
|
||||
tableaddr = (u16 *)&vlan4k_priv;
|
||||
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TABLE_WRITE_BASE, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
tableaddr++;
|
||||
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366S_VLAN_TABLE_WRITE_BASE + 1,
|
||||
data);
|
||||
if (err)
|
||||
return err;
|
||||
for (i = 0; i < 2; i++) {
|
||||
err = rtl8366_smi_write_reg(smi,
|
||||
RTL8366S_VLAN_TABLE_WRITE_BASE + i,
|
||||
data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* write table access control word */
|
||||
err = rtl8366_smi_write_reg(smi, RTL8366S_TABLE_ACCESS_CTRL_REG,
|
||||
@ -535,39 +484,31 @@ static int rtl8366s_set_vlan_4k(struct rtl8366_smi *smi,
|
||||
static int rtl8366s_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
struct rtl8366_vlan_mc *vlanmc)
|
||||
{
|
||||
struct rtl8366s_vlan_mc vlanmc_priv;
|
||||
u32 data[2];
|
||||
int err;
|
||||
u32 addr;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
memset(vlanmc, '\0', sizeof(struct rtl8366_vlan_mc));
|
||||
|
||||
if (index >= RTL8366S_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
tableaddr = (u16 *)&vlanmc_priv;
|
||||
for (i = 0; i < 2; i++) {
|
||||
err = rtl8366_smi_read_reg(smi,
|
||||
RTL8366S_VLAN_MC_BASE(index) + i,
|
||||
&data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
addr = RTL8366S_VLAN_MEMCONF_BASE + (index << 1);
|
||||
err = rtl8366_smi_read_reg(smi, addr, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
tableaddr++;
|
||||
|
||||
addr = RTL8366S_VLAN_MEMCONF_BASE + 1 + (index << 1);
|
||||
err = rtl8366_smi_read_reg(smi, addr, &data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*tableaddr = data;
|
||||
|
||||
vlanmc->vid = vlanmc_priv.vid;
|
||||
vlanmc->priority = vlanmc_priv.priority;
|
||||
vlanmc->untag = vlanmc_priv.untag;
|
||||
vlanmc->member = vlanmc_priv.member;
|
||||
vlanmc->fid = vlanmc_priv.fid;
|
||||
vlanmc->vid = data[0] & RTL8366S_VLAN_VID_MASK;
|
||||
vlanmc->priority = (data[0] >> RTL8366S_VLAN_PRIORITY_SHIFT) &
|
||||
RTL8366S_VLAN_PRIORITY_MASK;
|
||||
vlanmc->untag = (data[1] >> RTL8366S_VLAN_UNTAG_SHIFT) &
|
||||
RTL8366S_VLAN_UNTAG_MASK;
|
||||
vlanmc->member = data[1] & RTL8366S_VLAN_MEMBER_MASK;
|
||||
vlanmc->fid = (data[1] >> RTL8366S_VLAN_FID_SHIFT) &
|
||||
RTL8366S_VLAN_FID_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -575,11 +516,9 @@ static int rtl8366s_get_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
static int rtl8366s_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
const struct rtl8366_vlan_mc *vlanmc)
|
||||
{
|
||||
struct rtl8366s_vlan_mc vlanmc_priv;
|
||||
u32 data[2];
|
||||
int err;
|
||||
u32 addr;
|
||||
u32 data;
|
||||
u16 *tableaddr;
|
||||
int i;
|
||||
|
||||
if (index >= RTL8366S_NUM_VLANS ||
|
||||
vlanmc->vid >= RTL8366S_NUM_VIDS ||
|
||||
@ -589,29 +528,22 @@ static int rtl8366s_set_vlan_mc(struct rtl8366_smi *smi, u32 index,
|
||||
vlanmc->fid > RTL8366S_FIDMAX)
|
||||
return -EINVAL;
|
||||
|
||||
vlanmc_priv.vid = vlanmc->vid;
|
||||
vlanmc_priv.priority = vlanmc->priority;
|
||||
vlanmc_priv.untag = vlanmc->untag;
|
||||
vlanmc_priv.member = vlanmc->member;
|
||||
vlanmc_priv.fid = vlanmc->fid;
|
||||
data[0] = (vlanmc->vid & RTL8366S_VLAN_VID_MASK) |
|
||||
((vlanmc->priority & RTL8366S_VLAN_PRIORITY_MASK) <<
|
||||
RTL8366S_VLAN_PRIORITY_SHIFT);
|
||||
data[1] = (vlanmc->member & RTL8366S_VLAN_MEMBER_MASK) |
|
||||
((vlanmc->untag & RTL8366S_VLAN_UNTAG_MASK) <<
|
||||
RTL8366S_VLAN_UNTAG_SHIFT) |
|
||||
((vlanmc->fid & RTL8366S_VLAN_FID_MASK) <<
|
||||
RTL8366S_VLAN_FID_SHIFT);
|
||||
|
||||
addr = RTL8366S_VLAN_MEMCONF_BASE + (index << 1);
|
||||
|
||||
tableaddr = (u16 *)&vlanmc_priv;
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, addr, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
addr = RTL8366S_VLAN_MEMCONF_BASE + 1 + (index << 1);
|
||||
|
||||
tableaddr++;
|
||||
data = *tableaddr;
|
||||
|
||||
err = rtl8366_smi_write_reg(smi, addr, data);
|
||||
if (err)
|
||||
return err;
|
||||
for (i = 0; i < 2; i++) {
|
||||
err = rtl8366_smi_write_reg(smi,
|
||||
RTL8366S_VLAN_MC_BASE(index) + i,
|
||||
data[i]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -659,17 +591,21 @@ static int rtl8366s_vlan_set_4ktable(struct rtl8366_smi *smi, int enable)
|
||||
1, (enable) ? 1 : 0);
|
||||
}
|
||||
|
||||
static int rtl8366s_is_vlan_valid(struct rtl8366_smi *smi, unsigned vlan)
|
||||
{
|
||||
if (vlan == 0 || vlan >= RTL8366S_NUM_VLANS)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_reset_mibs(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
int err = 0;
|
||||
|
||||
if (val->value.i == 1)
|
||||
err = rtl8366_smi_rmwr(smi, RTL8366S_MIB_CTRL_REG, 0, (1 << 2));
|
||||
|
||||
return err;
|
||||
return rtl8366_smi_rmwr(smi, RTL8366S_MIB_CTRL_REG, 0, (1 << 2));
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_get_vlan_enable(struct switch_dev *dev,
|
||||
@ -829,47 +765,6 @@ static int rtl8366s_sw_get_port_link(struct switch_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_get_vlan_info(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
int i;
|
||||
u32 len = 0;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
char *buf = smi->buf;
|
||||
int err;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366S_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
memset(buf, '\0', sizeof(smi->buf));
|
||||
|
||||
err = rtl8366s_get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"VLAN %d: Ports: '", vlan4k.vid);
|
||||
|
||||
for (i = 0; i < RTL8366S_NUM_PORTS; i++) {
|
||||
if (!(vlan4k.member & (1 << i)))
|
||||
continue;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len, "%d%s", i,
|
||||
(vlan4k.untag & (1 << i)) ? "" : "t");
|
||||
}
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"', members=%04x, untag=%04x, fid=%u",
|
||||
vlan4k.member, vlan4k.untag, vlan4k.fid);
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_set_port_led(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
@ -926,101 +821,6 @@ static int rtl8366s_sw_reset_port_mibs(struct switch_dev *dev,
|
||||
0, (1 << (val->port_vlan + 3)));
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_get_port_mib(struct switch_dev *dev,
|
||||
const struct switch_attr *attr,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
int i, len = 0;
|
||||
unsigned long long counter = 0;
|
||||
char *buf = smi->buf;
|
||||
|
||||
if (val->port_vlan >= RTL8366S_NUM_PORTS)
|
||||
return -EINVAL;
|
||||
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"Port %d MIB counters\n",
|
||||
val->port_vlan);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rtl8366s_mib_counters); ++i) {
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%-36s: ", rtl8366s_mib_counters[i].name);
|
||||
if (!rtl8366_get_mib_counter(smi, i, val->port_vlan, &counter))
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%llu\n", counter);
|
||||
else
|
||||
len += snprintf(buf + len, sizeof(smi->buf) - len,
|
||||
"%s\n", "error");
|
||||
}
|
||||
|
||||
val->value.s = buf;
|
||||
val->len = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_get_vlan_ports(struct switch_dev *dev,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
struct rtl8366_vlan_4k vlan4k;
|
||||
int i;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366S_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
rtl8366s_get_vlan_4k(smi, val->port_vlan, &vlan4k);
|
||||
|
||||
port = &val->value.ports[0];
|
||||
val->len = 0;
|
||||
for (i = 0; i < RTL8366S_NUM_PORTS; i++) {
|
||||
if (!(vlan4k.member & BIT(i)))
|
||||
continue;
|
||||
|
||||
port->id = i;
|
||||
port->flags = (vlan4k.untag & BIT(i)) ?
|
||||
0 : BIT(SWITCH_PORT_FLAG_TAGGED);
|
||||
val->len++;
|
||||
port++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_set_vlan_ports(struct switch_dev *dev,
|
||||
struct switch_val *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
struct switch_port *port;
|
||||
u32 member = 0;
|
||||
u32 untag = 0;
|
||||
int i;
|
||||
|
||||
if (val->port_vlan == 0 || val->port_vlan >= RTL8366S_NUM_VLANS)
|
||||
return -EINVAL;
|
||||
|
||||
port = &val->value.ports[0];
|
||||
for (i = 0; i < val->len; i++, port++) {
|
||||
member |= BIT(port->id);
|
||||
|
||||
if (!(port->flags & BIT(SWITCH_PORT_FLAG_TAGGED)))
|
||||
untag |= BIT(port->id);
|
||||
}
|
||||
|
||||
return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_get_pvid(smi, port, val);
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_set_port_pvid(struct switch_dev *dev, int port, int val)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
return rtl8366_set_pvid(smi, port, val);
|
||||
}
|
||||
|
||||
static int rtl8366s_sw_reset_switch(struct switch_dev *dev)
|
||||
{
|
||||
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
|
||||
@ -1062,12 +862,10 @@ static struct switch_attr rtl8366s_globals[] = {
|
||||
.max = 1,
|
||||
.ofs = 2
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.type = SWITCH_TYPE_NOVAL,
|
||||
.name = "reset_mibs",
|
||||
.description = "Reset all MIB counters",
|
||||
.set = rtl8366s_sw_reset_mibs,
|
||||
.get = NULL,
|
||||
.max = 1
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.name = "blinkrate",
|
||||
@ -1088,19 +886,17 @@ static struct switch_attr rtl8366s_port[] = {
|
||||
.set = NULL,
|
||||
.get = rtl8366s_sw_get_port_link,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.type = SWITCH_TYPE_NOVAL,
|
||||
.name = "reset_mib",
|
||||
.description = "Reset single port MIB counters",
|
||||
.max = 1,
|
||||
.set = rtl8366s_sw_reset_port_mibs,
|
||||
.get = NULL,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_STRING,
|
||||
.name = "mib",
|
||||
.description = "Get MIB counters for port",
|
||||
.max = 33,
|
||||
.set = NULL,
|
||||
.get = rtl8366s_sw_get_port_mib,
|
||||
.get = rtl8366_sw_get_port_mib,
|
||||
}, {
|
||||
.type = SWITCH_TYPE_INT,
|
||||
.name = "led",
|
||||
@ -1118,16 +914,11 @@ static struct switch_attr rtl8366s_vlan[] = {
|
||||
.description = "Get vlan information",
|
||||
.max = 1,
|
||||
.set = NULL,
|
||||
.get = rtl8366s_sw_get_vlan_info,
|
||||
.get = rtl8366_sw_get_vlan_info,
|
||||
},
|
||||
};
|
||||
|
||||
/* template */
|
||||
static struct switch_dev rtl8366_switch_dev = {
|
||||
.name = "RTL8366S",
|
||||
.cpu_port = RTL8366S_PORT_NUM_CPU,
|
||||
.ports = RTL8366S_NUM_PORTS,
|
||||
.vlans = RTL8366S_NUM_VLANS,
|
||||
static const struct switch_dev_ops rtl8366_ops = {
|
||||
.attr_global = {
|
||||
.attr = rtl8366s_globals,
|
||||
.n_attr = ARRAY_SIZE(rtl8366s_globals),
|
||||
@ -1141,32 +932,35 @@ static struct switch_dev rtl8366_switch_dev = {
|
||||
.n_attr = ARRAY_SIZE(rtl8366s_vlan),
|
||||
},
|
||||
|
||||
.get_vlan_ports = rtl8366s_sw_get_vlan_ports,
|
||||
.set_vlan_ports = rtl8366s_sw_set_vlan_ports,
|
||||
.get_port_pvid = rtl8366s_sw_get_port_pvid,
|
||||
.set_port_pvid = rtl8366s_sw_set_port_pvid,
|
||||
.get_vlan_ports = rtl8366_sw_get_vlan_ports,
|
||||
.set_vlan_ports = rtl8366_sw_set_vlan_ports,
|
||||
.get_port_pvid = rtl8366_sw_get_port_pvid,
|
||||
.set_port_pvid = rtl8366_sw_set_port_pvid,
|
||||
.reset_switch = rtl8366s_sw_reset_switch,
|
||||
};
|
||||
|
||||
static int rtl8366s_switch_init(struct rtl8366s *rtl)
|
||||
static int rtl8366s_switch_init(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct switch_dev *dev = &rtl->dev;
|
||||
struct switch_dev *dev = &smi->sw_dev;
|
||||
int err;
|
||||
|
||||
memcpy(dev, &rtl8366_switch_dev, sizeof(struct switch_dev));
|
||||
dev->priv = rtl;
|
||||
dev->devname = dev_name(rtl->parent);
|
||||
dev->name = "RTL8366S";
|
||||
dev->cpu_port = RTL8366S_PORT_NUM_CPU;
|
||||
dev->ports = RTL8366S_NUM_PORTS;
|
||||
dev->vlans = RTL8366S_NUM_VLANS;
|
||||
dev->ops = &rtl8366_ops;
|
||||
dev->devname = dev_name(smi->parent);
|
||||
|
||||
err = register_switch(dev, NULL);
|
||||
if (err)
|
||||
dev_err(rtl->parent, "switch registration failed\n");
|
||||
dev_err(smi->parent, "switch registration failed\n");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void rtl8366s_switch_cleanup(struct rtl8366s *rtl)
|
||||
static void rtl8366s_switch_cleanup(struct rtl8366_smi *smi)
|
||||
{
|
||||
unregister_switch(&rtl->dev);
|
||||
unregister_switch(&smi->sw_dev);
|
||||
}
|
||||
|
||||
static int rtl8366s_mii_read(struct mii_bus *bus, int addr, int reg)
|
||||
@ -1201,9 +995,8 @@ static int rtl8366s_mii_bus_match(struct mii_bus *bus)
|
||||
bus->write == rtl8366s_mii_write);
|
||||
}
|
||||
|
||||
static int rtl8366s_setup(struct rtl8366s *rtl)
|
||||
static int rtl8366s_setup(struct rtl8366_smi *smi)
|
||||
{
|
||||
struct rtl8366_smi *smi = &rtl->smi;
|
||||
int ret;
|
||||
|
||||
ret = rtl8366s_reset_chip(smi);
|
||||
@ -1249,6 +1042,8 @@ static int rtl8366s_detect(struct rtl8366_smi *smi)
|
||||
|
||||
static struct rtl8366_smi_ops rtl8366s_smi_ops = {
|
||||
.detect = rtl8366s_detect,
|
||||
.setup = rtl8366s_setup,
|
||||
|
||||
.mii_read = rtl8366s_mii_read,
|
||||
.mii_write = rtl8366s_mii_write,
|
||||
|
||||
@ -1259,13 +1054,13 @@ static struct rtl8366_smi_ops rtl8366s_smi_ops = {
|
||||
.get_mc_index = rtl8366s_get_mc_index,
|
||||
.set_mc_index = rtl8366s_set_mc_index,
|
||||
.get_mib_counter = rtl8366_get_mib_counter,
|
||||
.is_vlan_valid = rtl8366s_is_vlan_valid,
|
||||
};
|
||||
|
||||
static int __init rtl8366s_probe(struct platform_device *pdev)
|
||||
{
|
||||
static int rtl8366_smi_version_printed;
|
||||
struct rtl8366s_platform_data *pdata;
|
||||
struct rtl8366s *rtl;
|
||||
struct rtl8366_smi *smi;
|
||||
int err;
|
||||
|
||||
@ -1280,17 +1075,12 @@ static int __init rtl8366s_probe(struct platform_device *pdev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
rtl = kzalloc(sizeof(*rtl), GFP_KERNEL);
|
||||
if (!rtl) {
|
||||
dev_err(&pdev->dev, "no memory for private data\n");
|
||||
smi = rtl8366_smi_alloc(&pdev->dev);
|
||||
if (!smi) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
rtl->parent = &pdev->dev;
|
||||
|
||||
smi = &rtl->smi;
|
||||
smi->parent = &pdev->dev;
|
||||
smi->gpio_sda = pdata->gpio_sda;
|
||||
smi->gpio_sck = pdata->gpio_sck;
|
||||
smi->ops = &rtl8366s_smi_ops;
|
||||
@ -1302,15 +1092,11 @@ static int __init rtl8366s_probe(struct platform_device *pdev)
|
||||
|
||||
err = rtl8366_smi_init(smi);
|
||||
if (err)
|
||||
goto err_free_rtl;
|
||||
goto err_free_smi;
|
||||
|
||||
platform_set_drvdata(pdev, rtl);
|
||||
platform_set_drvdata(pdev, smi);
|
||||
|
||||
err = rtl8366s_setup(rtl);
|
||||
if (err)
|
||||
goto err_clear_drvdata;
|
||||
|
||||
err = rtl8366s_switch_init(rtl);
|
||||
err = rtl8366s_switch_init(smi);
|
||||
if (err)
|
||||
goto err_clear_drvdata;
|
||||
|
||||
@ -1319,8 +1105,8 @@ static int __init rtl8366s_probe(struct platform_device *pdev)
|
||||
err_clear_drvdata:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
rtl8366_smi_cleanup(smi);
|
||||
err_free_rtl:
|
||||
kfree(rtl);
|
||||
err_free_smi:
|
||||
kfree(smi);
|
||||
err_out:
|
||||
return err;
|
||||
}
|
||||
@ -1353,13 +1139,13 @@ static struct phy_driver rtl8366s_phy_driver = {
|
||||
|
||||
static int __devexit rtl8366s_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rtl8366s *rtl = platform_get_drvdata(pdev);
|
||||
struct rtl8366_smi *smi = platform_get_drvdata(pdev);
|
||||
|
||||
if (rtl) {
|
||||
rtl8366s_switch_cleanup(rtl);
|
||||
if (smi) {
|
||||
rtl8366s_switch_cleanup(smi);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
rtl8366_smi_cleanup(&rtl->smi);
|
||||
kfree(rtl);
|
||||
rtl8366_smi_cleanup(smi);
|
||||
kfree(smi);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -65,10 +65,10 @@ swconfig_get_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr,
|
||||
if (val->port_vlan >= dev->vlans)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->get_vlan_ports)
|
||||
if (!dev->ops->get_vlan_ports)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ret = dev->get_vlan_ports(dev, val);
|
||||
ret = dev->ops->get_vlan_ports(dev, val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -76,6 +76,7 @@ static int
|
||||
swconfig_set_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||
{
|
||||
struct switch_port *ports = val->value.ports;
|
||||
const struct switch_dev_ops *ops = dev->ops;
|
||||
int i;
|
||||
|
||||
if (val->port_vlan >= dev->vlans)
|
||||
@ -85,18 +86,19 @@ swconfig_set_vlan_ports(struct switch_dev *dev, const struct switch_attr *attr,
|
||||
if (val->len > dev->ports)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->set_vlan_ports)
|
||||
if (!ops->set_vlan_ports)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
for (i = 0; i < val->len; i++) {
|
||||
if (ports[i].id >= dev->ports)
|
||||
return -EINVAL;
|
||||
|
||||
if (dev->set_port_pvid && !(ports[i].flags & (1 << SWITCH_PORT_FLAG_TAGGED)))
|
||||
dev->set_port_pvid(dev, ports[i].id, val->port_vlan);
|
||||
if (ops->set_port_pvid &&
|
||||
!(ports[i].flags & (1 << SWITCH_PORT_FLAG_TAGGED)))
|
||||
ops->set_port_pvid(dev, ports[i].id, val->port_vlan);
|
||||
}
|
||||
|
||||
return dev->set_vlan_ports(dev, val);
|
||||
return ops->set_vlan_ports(dev, val);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -105,10 +107,10 @@ swconfig_set_pvid(struct switch_dev *dev, const struct switch_attr *attr, struct
|
||||
if (val->port_vlan >= dev->ports)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->set_port_pvid)
|
||||
if (!dev->ops->set_port_pvid)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->set_port_pvid(dev, val->port_vlan, val->value.i);
|
||||
return dev->ops->set_port_pvid(dev, val->port_vlan, val->value.i);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -117,30 +119,30 @@ swconfig_get_pvid(struct switch_dev *dev, const struct switch_attr *attr, struct
|
||||
if (val->port_vlan >= dev->ports)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dev->get_port_pvid)
|
||||
if (!dev->ops->get_port_pvid)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->get_port_pvid(dev, val->port_vlan, &val->value.i);
|
||||
return dev->ops->get_port_pvid(dev, val->port_vlan, &val->value.i);
|
||||
}
|
||||
|
||||
static int
|
||||
swconfig_apply_config(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||
{
|
||||
/* don't complain if not supported by the switch driver */
|
||||
if (!dev->apply_config)
|
||||
if (!dev->ops->apply_config)
|
||||
return 0;
|
||||
|
||||
return dev->apply_config(dev);
|
||||
return dev->ops->apply_config(dev);
|
||||
}
|
||||
|
||||
static int
|
||||
swconfig_reset_switch(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
|
||||
{
|
||||
/* don't complain if not supported by the switch driver */
|
||||
if (!dev->reset_switch)
|
||||
if (!dev->ops->reset_switch)
|
||||
return 0;
|
||||
|
||||
return dev->reset_switch(dev);
|
||||
return dev->ops->reset_switch(dev);
|
||||
}
|
||||
|
||||
enum global_defaults {
|
||||
@ -194,14 +196,16 @@ static struct switch_attr default_vlan[] = {
|
||||
|
||||
static void swconfig_defaults_init(struct switch_dev *dev)
|
||||
{
|
||||
const struct switch_dev_ops *ops = dev->ops;
|
||||
|
||||
dev->def_global = 0;
|
||||
dev->def_vlan = 0;
|
||||
dev->def_port = 0;
|
||||
|
||||
if (dev->get_vlan_ports || dev->set_vlan_ports)
|
||||
if (ops->get_vlan_ports || ops->set_vlan_ports)
|
||||
set_bit(VLAN_PORTS, &dev->def_vlan);
|
||||
|
||||
if (dev->get_port_pvid || dev->set_port_pvid)
|
||||
if (ops->get_port_pvid || ops->set_port_pvid)
|
||||
set_bit(PORT_PVID, &dev->def_port);
|
||||
|
||||
/* always present, can be no-op */
|
||||
@ -335,7 +339,7 @@ swconfig_send_multipart(struct swconfig_callback *cb, void *arg)
|
||||
if (cb->close(cb, arg) < 0)
|
||||
goto error;
|
||||
}
|
||||
err = genlmsg_unicast(cb->msg, info->snd_pid);
|
||||
err = genlmsg_reply(cb->msg, info);
|
||||
cb->msg = NULL;
|
||||
if (err < 0)
|
||||
goto error;
|
||||
@ -371,19 +375,19 @@ swconfig_list_attrs(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
switch(hdr->cmd) {
|
||||
case SWITCH_CMD_LIST_GLOBAL:
|
||||
alist = &dev->attr_global;
|
||||
alist = &dev->ops->attr_global;
|
||||
def_list = default_global;
|
||||
def_active = &dev->def_global;
|
||||
n_def = ARRAY_SIZE(default_global);
|
||||
break;
|
||||
case SWITCH_CMD_LIST_VLAN:
|
||||
alist = &dev->attr_vlan;
|
||||
alist = &dev->ops->attr_vlan;
|
||||
def_list = default_vlan;
|
||||
def_active = &dev->def_vlan;
|
||||
n_def = ARRAY_SIZE(default_vlan);
|
||||
break;
|
||||
case SWITCH_CMD_LIST_PORT:
|
||||
alist = &dev->attr_port;
|
||||
alist = &dev->ops->attr_port;
|
||||
def_list = default_port;
|
||||
def_active = &dev->def_port;
|
||||
n_def = ARRAY_SIZE(default_port);
|
||||
@ -419,7 +423,7 @@ swconfig_list_attrs(struct sk_buff *skb, struct genl_info *info)
|
||||
if (!cb.msg)
|
||||
return 0;
|
||||
|
||||
return genlmsg_unicast(cb.msg, info->snd_pid);
|
||||
return genlmsg_reply(cb.msg, info);
|
||||
|
||||
error:
|
||||
if (cb.msg)
|
||||
@ -449,14 +453,14 @@ swconfig_lookup_attr(struct switch_dev *dev, struct genl_info *info,
|
||||
switch(hdr->cmd) {
|
||||
case SWITCH_CMD_SET_GLOBAL:
|
||||
case SWITCH_CMD_GET_GLOBAL:
|
||||
alist = &dev->attr_global;
|
||||
alist = &dev->ops->attr_global;
|
||||
def_list = default_global;
|
||||
def_active = &dev->def_global;
|
||||
n_def = ARRAY_SIZE(default_global);
|
||||
break;
|
||||
case SWITCH_CMD_SET_VLAN:
|
||||
case SWITCH_CMD_GET_VLAN:
|
||||
alist = &dev->attr_vlan;
|
||||
alist = &dev->ops->attr_vlan;
|
||||
def_list = default_vlan;
|
||||
def_active = &dev->def_vlan;
|
||||
n_def = ARRAY_SIZE(default_vlan);
|
||||
@ -468,7 +472,7 @@ swconfig_lookup_attr(struct switch_dev *dev, struct genl_info *info,
|
||||
break;
|
||||
case SWITCH_CMD_SET_PORT:
|
||||
case SWITCH_CMD_GET_PORT:
|
||||
alist = &dev->attr_port;
|
||||
alist = &dev->ops->attr_port;
|
||||
def_list = default_port;
|
||||
def_active = &dev->def_port;
|
||||
n_def = ARRAY_SIZE(default_port);
|
||||
@ -732,7 +736,7 @@ swconfig_get_attr(struct sk_buff *skb, struct genl_info *info)
|
||||
goto nla_put_failure;
|
||||
|
||||
swconfig_put_dev(dev);
|
||||
return genlmsg_unicast(msg, info->snd_pid);
|
||||
return genlmsg_reply(msg, info);
|
||||
|
||||
nla_put_failure:
|
||||
if (msg)
|
||||
|
@ -102,16 +102,50 @@ struct switch_attrlist;
|
||||
int register_switch(struct switch_dev *dev, struct net_device *netdev);
|
||||
void unregister_switch(struct switch_dev *dev);
|
||||
|
||||
/**
|
||||
* struct switch_attrlist - attribute list
|
||||
*
|
||||
* @n_attr: number of attributes
|
||||
* @attr: pointer to the attributes array
|
||||
*/
|
||||
struct switch_attrlist {
|
||||
/* filled in by the driver */
|
||||
int n_attr;
|
||||
const struct switch_attr *attr;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct switch_dev_ops - switch driver operations
|
||||
*
|
||||
* @attr_global: global switch attribute list
|
||||
* @attr_port: port attribute list
|
||||
* @attr_vlan: vlan attribute list
|
||||
*
|
||||
* Callbacks:
|
||||
*
|
||||
* @get_vlan_ports: read the port list of a VLAN
|
||||
* @set_vlan_ports: set the port list of a VLAN
|
||||
*
|
||||
* @get_port_pvid: get the primary VLAN ID of a port
|
||||
* @set_port_pvid: set the primary VLAN ID of a port
|
||||
*
|
||||
* @apply_config: apply all changed settings to the switch
|
||||
* @reset_switch: resetting the switch
|
||||
*/
|
||||
struct switch_dev_ops {
|
||||
struct switch_attrlist attr_global, attr_port, attr_vlan;
|
||||
|
||||
int (*get_vlan_ports)(struct switch_dev *dev, struct switch_val *val);
|
||||
int (*set_vlan_ports)(struct switch_dev *dev, struct switch_val *val);
|
||||
|
||||
int (*get_port_pvid)(struct switch_dev *dev, int port, int *val);
|
||||
int (*set_port_pvid)(struct switch_dev *dev, int port, int val);
|
||||
|
||||
int (*apply_config)(struct switch_dev *dev);
|
||||
int (*reset_switch)(struct switch_dev *dev);
|
||||
};
|
||||
|
||||
struct switch_dev {
|
||||
int id;
|
||||
void *priv;
|
||||
const struct switch_dev_ops *ops;
|
||||
const char *name;
|
||||
|
||||
/* NB: either devname or netdev must be set */
|
||||
@ -121,19 +155,14 @@ struct switch_dev {
|
||||
int ports;
|
||||
int vlans;
|
||||
int cpu_port;
|
||||
struct switch_attrlist attr_global, attr_port, attr_vlan;
|
||||
|
||||
spinlock_t lock;
|
||||
struct switch_port *portbuf;
|
||||
/* the following fields are internal for swconfig */
|
||||
int id;
|
||||
struct list_head dev_list;
|
||||
unsigned long def_global, def_port, def_vlan;
|
||||
|
||||
int (*get_vlan_ports)(struct switch_dev *dev, struct switch_val *val);
|
||||
int (*set_vlan_ports)(struct switch_dev *dev, struct switch_val *val);
|
||||
int (*get_port_pvid)(struct switch_dev *dev, int port, int *val);
|
||||
int (*set_port_pvid)(struct switch_dev *dev, int port, int val);
|
||||
int (*apply_config)(struct switch_dev *dev);
|
||||
int (*reset_switch)(struct switch_dev *dev);
|
||||
spinlock_t lock;
|
||||
struct switch_port *portbuf;
|
||||
};
|
||||
|
||||
struct switch_port {
|
||||
|
@ -4,7 +4,7 @@
|
||||
config MVSWITCH_PHY
|
||||
tristate "Driver for Marvell 88E6060 switches"
|
||||
|
||||
+config IP175C_PHY
|
||||
+config IP17XX_PHY
|
||||
+ tristate "Driver for IC+ IP175C/IP178C switches"
|
||||
+ select SWCONFIG
|
||||
+
|
||||
@ -17,7 +17,7 @@
|
||||
obj-$(CONFIG_ICPLUS_PHY) += icplus.o
|
||||
obj-$(CONFIG_ADM6996_PHY) += adm6996.o
|
||||
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
+obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
|
||||
obj-$(CONFIG_FIXED_PHY) += fixed.o
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -100,6 +100,10 @@ config IP175C_PHY
|
||||
@@ -100,6 +100,10 @@ config IP17XX_PHY
|
||||
tristate "Driver for IC+ IP175C/IP178C switches"
|
||||
select SWCONFIG
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -17,6 +17,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o
|
||||
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
+obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
|
||||
|
@ -14,7 +14,7 @@
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -18,6 +18,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o
|
||||
|
@ -32,7 +32,7 @@
|
||||
endif # PHYLIB
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -19,6 +19,9 @@ obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
@@ -19,6 +19,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
obj-$(CONFIG_RTL8306_PHY) += rtl8306.o
|
||||
|
@ -1,29 +0,0 @@
|
||||
--- a/drivers/net/phy/swconfig.c
|
||||
+++ b/drivers/net/phy/swconfig.c
|
||||
@@ -335,7 +335,7 @@ swconfig_send_multipart(struct swconfig_
|
||||
if (cb->close(cb, arg) < 0)
|
||||
goto error;
|
||||
}
|
||||
- err = genlmsg_unicast(cb->msg, info->snd_pid);
|
||||
+ err = genlmsg_reply(cb->msg, info);
|
||||
cb->msg = NULL;
|
||||
if (err < 0)
|
||||
goto error;
|
||||
@@ -419,7 +419,7 @@ swconfig_list_attrs(struct sk_buff *skb,
|
||||
if (!cb.msg)
|
||||
return 0;
|
||||
|
||||
- return genlmsg_unicast(cb.msg, info->snd_pid);
|
||||
+ return genlmsg_reply(cb.msg, info);
|
||||
|
||||
error:
|
||||
if (cb.msg)
|
||||
@@ -728,7 +728,7 @@ swconfig_get_attr(struct sk_buff *skb, s
|
||||
goto nla_put_failure;
|
||||
|
||||
swconfig_put_dev(dev);
|
||||
- return genlmsg_unicast(msg, info->snd_pid);
|
||||
+ return genlmsg_reply(msg, info);
|
||||
|
||||
nla_put_failure:
|
||||
if (msg)
|
@ -4,7 +4,7 @@
|
||||
config MVSWITCH_PHY
|
||||
tristate "Driver for Marvell 88E6060 switches"
|
||||
|
||||
+config IP175C_PHY
|
||||
+config IP17XX_PHY
|
||||
+ tristate "Driver for IC+ IP175C/IP178C switches"
|
||||
+ select SWCONFIG
|
||||
+
|
||||
@ -17,7 +17,7 @@
|
||||
obj-$(CONFIG_ICPLUS_PHY) += icplus.o
|
||||
obj-$(CONFIG_ADM6996_PHY) += adm6996.o
|
||||
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
+obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
|
||||
obj-$(CONFIG_FIXED_PHY) += fixed.o
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -106,6 +106,10 @@ config IP175C_PHY
|
||||
@@ -106,6 +106,10 @@ config IP17XX_PHY
|
||||
tristate "Driver for IC+ IP175C/IP178C switches"
|
||||
select SWCONFIG
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -18,6 +18,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o
|
||||
obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
+obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
|
||||
|
@ -14,7 +14,7 @@
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -19,6 +19,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o
|
||||
obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
obj-$(CONFIG_IP17XX) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o
|
||||
|
@ -32,7 +32,7 @@
|
||||
endif # PHYLIB
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -20,6 +20,9 @@ obj-$(CONFIG_IP175C_PHY) += ip175c.o
|
||||
@@ -20,6 +20,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
obj-$(CONFIG_AR8216_PHY) += ar8216.o
|
||||
obj-$(CONFIG_RTL8306_PHY) += rtl8306.o
|
||||
|
Loading…
Reference in New Issue
Block a user