11 #include <linux/list.h>
12 #include <linux/netdevice.h>
14 #include <linux/slab.h>
15 #include <linux/module.h>
37 list_del_init(&drv->
list);
43 dsa_switch_probe(
struct mii_bus *
bus,
int sw_addr,
char **_name)
58 name = drv->
probe(bus, sw_addr);
87 drv = dsa_switch_probe(bus, pd->
sw_addr, &name);
121 if (!
strcmp(name,
"cpu")) {
129 }
else if (!
strcmp(name,
"dsa")) {
142 if (ds->
dst->cpu_switch == index)
149 ret = drv->
setup(ds);
179 if (slave_dev ==
NULL) {
181 "slave device for port %d(%s)\n",
199 static void dsa_switch_destroy(
struct dsa_switch *ds)
205 static void dsa_link_poll_work(
struct work_struct *ugly)
212 for (i = 0; i < dst->
pd->nr_chips; i++) {
216 ds->
drv->poll_link(ds);
222 static void dsa_link_poll_timer(
unsigned long _dst)
231 static int dev_is_class(
struct device *
dev,
void *
class)
239 static struct device *dev_find_class(
struct device *parent,
char *
class)
241 if (dev_is_class(parent,
class)) {
253 d = dev_find_class(dev,
"mdio_bus");
270 d = dev_find_class(dev,
"net");
286 static int dsa_version_printed;
292 if (!dsa_version_printed++)
299 dev = dev_to_net_device(pd->
netdev);
303 if (dev->dsa_ptr !=
NULL) {
314 platform_set_drvdata(pdev, dst);
321 for (i = 0; i < pd->
nr_chips; i++) {
325 bus = dev_to_mii_bus(pd->
chip[i].mii_bus);
328 "dsa switch\n", dev->
name, i);
332 ds = dsa_switch_setup(dst, i, &pdev->
dev, bus);
335 "instance (error %ld)\n", dev->
name, i,
341 if (ds->
drv->poll_link !=
NULL)
351 dev->dsa_ptr = (
void *)dst;
375 for (i = 0; i < dst->
pd->nr_chips; i++) {
379 dsa_switch_destroy(ds);
391 .remove = dsa_remove,
392 .shutdown = dsa_shutdown,
399 static int __init dsa_init_module(
void)
407 #ifdef CONFIG_NET_DSA_TAG_DSA
410 #ifdef CONFIG_NET_DSA_TAG_EDSA
413 #ifdef CONFIG_NET_DSA_TAG_TRAILER
420 static void __exit dsa_cleanup_module(
void)
422 #ifdef CONFIG_NET_DSA_TAG_TRAILER
425 #ifdef CONFIG_NET_DSA_TAG_EDSA
428 #ifdef CONFIG_NET_DSA_TAG_DSA