aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/dsa_loop_bdinfo.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2017-03-30 21:43:21 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-01 15:39:32 -0400
commit98cd1552ea27e512c7e99e2aa76042a26e4fb25c (patch)
treeaba74b9bf561693e0fae899c347b33cd8698eec5 /drivers/net/dsa/dsa_loop_bdinfo.c
parent772c3bdad10db607b1035ae74cc817e81a114021 (diff)
net: dsa: Mock-up driver
This patch adds support for a DSA mock-up driver which essentially does the following: - registers/unregisters 4 fixed PHYs to the slave network devices - uses eth0 (configurable) as the master netdev - registers the switch as a fixed MDIO device against the fixed MDIO bus at address 31 - includes dynamic debug prints for dsa_switch_ops functions that can be enabled to get call traces This is a good way to test modular builds as well as exercise the DSA APIs without requiring access to real hardware. This does not test the data-path, although this could be added later on. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/dsa_loop_bdinfo.c')
-rw-r--r--drivers/net/dsa/dsa_loop_bdinfo.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/dsa/dsa_loop_bdinfo.c b/drivers/net/dsa/dsa_loop_bdinfo.c
new file mode 100644
index 000000000000..fb8d5dc71013
--- /dev/null
+++ b/drivers/net/dsa/dsa_loop_bdinfo.c
@@ -0,0 +1,34 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/phy.h>
4#include <net/dsa.h>
5
6#include "dsa_loop.h"
7
8static struct dsa_loop_pdata dsa_loop_pdata = {
9 .cd = {
10 .port_names[0] = "lan1",
11 .port_names[1] = "lan2",
12 .port_names[2] = "lan3",
13 .port_names[3] = "lan4",
14 .port_names[DSA_LOOP_CPU_PORT] = "cpu",
15 },
16 .name = "DSA mockup driver",
17 .enabled_ports = 0x1f,
18 .netdev = "eth0",
19};
20
21static const struct mdio_board_info bdinfo = {
22 .bus_id = "fixed-0",
23 .modalias = "dsa-loop",
24 .mdio_addr = 31,
25 .platform_data = &dsa_loop_pdata,
26};
27
28static int __init dsa_loop_bdinfo_init(void)
29{
30 return mdiobus_register_board_info(&bdinfo, 1);
31}
32arch_initcall(dsa_loop_bdinfo_init)
33
34MODULE_LICENSE("GPL");