Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: mv88e6xxx: factorize the switch driver

Now that all drivers support the same set of functions and the same
setup code, drop every model-specific DSA switch driver and replace them
with a common mv88e6xxx driver.

This merges the info tables into one, removes the function exports, the
model-specific files, and update the defconfigs.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vivien Didelot and committed by
David S. Miller
f81ec90f b9729e53

+302 -630
+1 -4
arch/arm/configs/multi_v5_defconfig
··· 91 91 CONFIG_SATA_MV=y 92 92 CONFIG_NETDEVICES=y 93 93 CONFIG_NET_DSA_MV88E6060=y 94 - CONFIG_NET_DSA_MV88E6131=y 95 - CONFIG_NET_DSA_MV88E6123=y 96 - CONFIG_NET_DSA_MV88E6171=y 97 - CONFIG_NET_DSA_MV88E6352=y 94 + CONFIG_NET_DSA_MV88E6XXX=y 98 95 CONFIG_MV643XX_ETH=y 99 96 CONFIG_R8169=y 100 97 CONFIG_MARVELL_PHY=y
+1 -1
arch/arm/configs/mvebu_v7_defconfig
··· 66 66 CONFIG_AHCI_MVEBU=y 67 67 CONFIG_SATA_MV=y 68 68 CONFIG_NETDEVICES=y 69 - CONFIG_NET_DSA_MV88E6171=y 69 + CONFIG_NET_DSA_MV88E6XXX=y 70 70 CONFIG_MV643XX_ETH=y 71 71 CONFIG_MVNETA=y 72 72 CONFIG_MVPP2=y
+1 -2
arch/arm/configs/orion5x_defconfig
··· 85 85 CONFIG_SATA_MV=y 86 86 CONFIG_NETDEVICES=y 87 87 CONFIG_MII=y 88 - CONFIG_NET_DSA_MV88E6131=y 89 - CONFIG_NET_DSA_MV88E6123=y 88 + CONFIG_NET_DSA_MV88E6XXX=y 90 89 CONFIG_MV643XX_ETH=y 91 90 CONFIG_MARVELL_PHY=y 92 91 # CONFIG_INPUT_MOUSEDEV is not set
+1 -2
arch/tile/configs/tilegx_defconfig
··· 221 221 CONFIG_TUN=y 222 222 CONFIG_VETH=m 223 223 CONFIG_NET_DSA_MV88E6060=y 224 - CONFIG_NET_DSA_MV88E6131=y 225 - CONFIG_NET_DSA_MV88E6123=y 224 + CONFIG_NET_DSA_MV88E6XXX=y 226 225 CONFIG_SKY2=y 227 226 CONFIG_PTP_1588_CLOCK_TILEGX=y 228 227 # CONFIG_WLAN is not set
+1 -2
arch/tile/configs/tilepro_defconfig
··· 340 340 CONFIG_TUN=y 341 341 CONFIG_VETH=m 342 342 CONFIG_NET_DSA_MV88E6060=y 343 - CONFIG_NET_DSA_MV88E6131=y 344 - CONFIG_NET_DSA_MV88E6123=y 343 + CONFIG_NET_DSA_MV88E6XXX=y 345 344 # CONFIG_NET_VENDOR_3COM is not set 346 345 CONFIG_E1000E=y 347 346 # CONFIG_WLAN is not set
+4 -36
drivers/net/dsa/Kconfig
··· 1 1 menu "Distributed Switch Architecture drivers" 2 2 depends on HAVE_NET_DSA 3 3 4 - config NET_DSA_MV88E6XXX 5 - tristate 6 - default n 7 - 8 4 config NET_DSA_MV88E6060 9 5 tristate "Marvell 88E6060 ethernet switch chip support" 10 6 depends on NET_DSA ··· 9 13 This enables support for the Marvell 88E6060 ethernet switch 10 14 chip. 11 15 12 - config NET_DSA_MV88E6131 13 - tristate "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support" 16 + config NET_DSA_MV88E6XXX 17 + tristate "Marvell 88E6xxx Ethernet switch chip support" 14 18 depends on NET_DSA 15 - select NET_DSA_MV88E6XXX 16 19 select NET_DSA_TAG_EDSA 17 20 ---help--- 18 - This enables support for the Marvell 88E6085/6095/6095F/6131 19 - ethernet switch chips. 20 - 21 - config NET_DSA_MV88E6123 22 - tristate "Marvell 88E6123/6161/6165 ethernet switch chip support" 23 - depends on NET_DSA 24 - select NET_DSA_MV88E6XXX 25 - select NET_DSA_TAG_EDSA 26 - ---help--- 27 - This enables support for the Marvell 88E6123/6161/6165 28 - ethernet switch chips. 29 - 30 - config NET_DSA_MV88E6171 31 - tristate "Marvell 88E6171/6175/6350/6351 ethernet switch chip support" 32 - depends on NET_DSA 33 - select NET_DSA_MV88E6XXX 34 - select NET_DSA_TAG_EDSA 35 - ---help--- 36 - This enables support for the Marvell 88E6171/6175/6350/6351 37 - ethernet switches chips. 38 - 39 - config NET_DSA_MV88E6352 40 - tristate "Marvell 88E6172/6176/6320/6321/6352 ethernet switch chip support" 41 - depends on NET_DSA 42 - select NET_DSA_MV88E6XXX 43 - select NET_DSA_TAG_EDSA 44 - ---help--- 45 - This enables support for the Marvell 88E6172, 88E6176, 88E6320, 46 - 88E6321 and 88E6352 ethernet switch chips. 21 + This enables support for most of the Marvell 88E6xxx models of 22 + Ethernet switch chips, except 88E6060. 47 23 48 24 config NET_DSA_BCM_SF2 49 25 tristate "Broadcom Starfighter 2 Ethernet switch support"
+1 -14
drivers/net/dsa/Makefile
··· 1 1 obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o 2 - obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o 3 - mv88e6xxx_drv-y += mv88e6xxx.o 4 - ifdef CONFIG_NET_DSA_MV88E6123 5 - mv88e6xxx_drv-y += mv88e6123.o 6 - endif 7 - ifdef CONFIG_NET_DSA_MV88E6131 8 - mv88e6xxx_drv-y += mv88e6131.o 9 - endif 10 - ifdef CONFIG_NET_DSA_MV88E6352 11 - mv88e6xxx_drv-y += mv88e6352.o 12 - endif 13 - ifdef CONFIG_NET_DSA_MV88E6171 14 - mv88e6xxx_drv-y += mv88e6171.o 15 - endif 2 + obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o 16 3 obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm_sf2.o
-93
drivers/net/dsa/mv88e6123.c
··· 1 - /* 2 - * net/dsa/mv88e6123_61_65.c - Marvell 88e6123/6161/6165 switch chip support 3 - * Copyright (c) 2008-2009 Marvell Semiconductor 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - */ 10 - 11 - #include <linux/delay.h> 12 - #include <linux/jiffies.h> 13 - #include <linux/list.h> 14 - #include <linux/module.h> 15 - #include <linux/netdevice.h> 16 - #include <linux/phy.h> 17 - #include <net/dsa.h> 18 - #include "mv88e6xxx.h" 19 - 20 - static const struct mv88e6xxx_info mv88e6123_table[] = { 21 - { 22 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6123, 23 - .family = MV88E6XXX_FAMILY_6165, 24 - .name = "Marvell 88E6123", 25 - .num_databases = 4096, 26 - .num_ports = 3, 27 - .flags = MV88E6XXX_FLAGS_FAMILY_6165, 28 - }, { 29 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6161, 30 - .family = MV88E6XXX_FAMILY_6165, 31 - .name = "Marvell 88E6161", 32 - .num_databases = 4096, 33 - .num_ports = 6, 34 - .flags = MV88E6XXX_FLAGS_FAMILY_6165, 35 - }, { 36 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6165, 37 - .family = MV88E6XXX_FAMILY_6165, 38 - .name = "Marvell 88E6165", 39 - .num_databases = 4096, 40 - .num_ports = 6, 41 - .flags = MV88E6XXX_FLAGS_FAMILY_6165, 42 - } 43 - }; 44 - 45 - static const char *mv88e6123_drv_probe(struct device *dsa_dev, 46 - struct device *host_dev, int sw_addr, 47 - void **priv) 48 - { 49 - return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv, 50 - mv88e6123_table, 51 - ARRAY_SIZE(mv88e6123_table)); 52 - } 53 - 54 - struct dsa_switch_driver mv88e6123_switch_driver = { 55 - .tag_protocol = DSA_TAG_PROTO_EDSA, 56 - .probe = mv88e6123_drv_probe, 57 - .setup = mv88e6xxx_setup, 58 - .set_addr = mv88e6xxx_set_addr, 59 - .phy_read = mv88e6xxx_phy_read, 60 - .phy_write = mv88e6xxx_phy_write, 61 - .set_eee = mv88e6xxx_set_eee, 62 - .get_eee = mv88e6xxx_get_eee, 63 - .get_strings = mv88e6xxx_get_strings, 64 - .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, 65 - .get_sset_count = mv88e6xxx_get_sset_count, 66 - .adjust_link = mv88e6xxx_adjust_link, 67 - #ifdef CONFIG_NET_DSA_HWMON 68 - .get_temp = mv88e6xxx_get_temp, 69 - .get_temp_limit = mv88e6xxx_get_temp_limit, 70 - .set_temp_limit = mv88e6xxx_set_temp_limit, 71 - .get_temp_alarm = mv88e6xxx_get_temp_alarm, 72 - #endif 73 - .get_eeprom = mv88e6xxx_get_eeprom, 74 - .set_eeprom = mv88e6xxx_set_eeprom, 75 - .get_regs_len = mv88e6xxx_get_regs_len, 76 - .get_regs = mv88e6xxx_get_regs, 77 - .port_bridge_join = mv88e6xxx_port_bridge_join, 78 - .port_bridge_leave = mv88e6xxx_port_bridge_leave, 79 - .port_stp_state_set = mv88e6xxx_port_stp_state_set, 80 - .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, 81 - .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, 82 - .port_vlan_add = mv88e6xxx_port_vlan_add, 83 - .port_vlan_del = mv88e6xxx_port_vlan_del, 84 - .port_vlan_dump = mv88e6xxx_port_vlan_dump, 85 - .port_fdb_prepare = mv88e6xxx_port_fdb_prepare, 86 - .port_fdb_add = mv88e6xxx_port_fdb_add, 87 - .port_fdb_del = mv88e6xxx_port_fdb_del, 88 - .port_fdb_dump = mv88e6xxx_port_fdb_dump, 89 - }; 90 - 91 - MODULE_ALIAS("platform:mv88e6123"); 92 - MODULE_ALIAS("platform:mv88e6161"); 93 - MODULE_ALIAS("platform:mv88e6165");
-101
drivers/net/dsa/mv88e6131.c
··· 1 - /* 2 - * net/dsa/mv88e6131.c - Marvell 88e6095/6095f/6131 switch chip support 3 - * Copyright (c) 2008-2009 Marvell Semiconductor 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - */ 10 - 11 - #include <linux/delay.h> 12 - #include <linux/jiffies.h> 13 - #include <linux/list.h> 14 - #include <linux/module.h> 15 - #include <linux/netdevice.h> 16 - #include <linux/phy.h> 17 - #include <net/dsa.h> 18 - #include "mv88e6xxx.h" 19 - 20 - static const struct mv88e6xxx_info mv88e6131_table[] = { 21 - { 22 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6095, 23 - .family = MV88E6XXX_FAMILY_6095, 24 - .name = "Marvell 88E6095/88E6095F", 25 - .num_databases = 256, 26 - .num_ports = 11, 27 - .flags = MV88E6XXX_FLAGS_FAMILY_6095, 28 - }, { 29 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6085, 30 - .family = MV88E6XXX_FAMILY_6097, 31 - .name = "Marvell 88E6085", 32 - .num_databases = 4096, 33 - .num_ports = 10, 34 - .flags = MV88E6XXX_FLAGS_FAMILY_6097, 35 - }, { 36 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6131, 37 - .family = MV88E6XXX_FAMILY_6185, 38 - .name = "Marvell 88E6131", 39 - .num_databases = 256, 40 - .num_ports = 8, 41 - .flags = MV88E6XXX_FLAGS_FAMILY_6185, 42 - }, { 43 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6185, 44 - .family = MV88E6XXX_FAMILY_6185, 45 - .name = "Marvell 88E6185", 46 - .num_databases = 256, 47 - .num_ports = 10, 48 - .flags = MV88E6XXX_FLAGS_FAMILY_6185, 49 - } 50 - }; 51 - 52 - static const char *mv88e6131_drv_probe(struct device *dsa_dev, 53 - struct device *host_dev, int sw_addr, 54 - void **priv) 55 - { 56 - return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv, 57 - mv88e6131_table, 58 - ARRAY_SIZE(mv88e6131_table)); 59 - } 60 - 61 - struct dsa_switch_driver mv88e6131_switch_driver = { 62 - .tag_protocol = DSA_TAG_PROTO_EDSA, 63 - .probe = mv88e6131_drv_probe, 64 - .setup = mv88e6xxx_setup, 65 - .set_addr = mv88e6xxx_set_addr, 66 - .phy_read = mv88e6xxx_phy_read, 67 - .phy_write = mv88e6xxx_phy_write, 68 - .set_eee = mv88e6xxx_set_eee, 69 - .get_eee = mv88e6xxx_get_eee, 70 - .get_strings = mv88e6xxx_get_strings, 71 - .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, 72 - .get_sset_count = mv88e6xxx_get_sset_count, 73 - .get_eeprom = mv88e6xxx_get_eeprom, 74 - .set_eeprom = mv88e6xxx_set_eeprom, 75 - .get_regs_len = mv88e6xxx_get_regs_len, 76 - .get_regs = mv88e6xxx_get_regs, 77 - #ifdef CONFIG_NET_DSA_HWMON 78 - .get_temp = mv88e6xxx_get_temp, 79 - .get_temp_limit = mv88e6xxx_get_temp_limit, 80 - .set_temp_limit = mv88e6xxx_set_temp_limit, 81 - .get_temp_alarm = mv88e6xxx_get_temp_alarm, 82 - #endif 83 - .adjust_link = mv88e6xxx_adjust_link, 84 - .port_bridge_join = mv88e6xxx_port_bridge_join, 85 - .port_bridge_leave = mv88e6xxx_port_bridge_leave, 86 - .port_stp_state_set = mv88e6xxx_port_stp_state_set, 87 - .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, 88 - .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, 89 - .port_vlan_add = mv88e6xxx_port_vlan_add, 90 - .port_vlan_del = mv88e6xxx_port_vlan_del, 91 - .port_vlan_dump = mv88e6xxx_port_vlan_dump, 92 - .port_fdb_prepare = mv88e6xxx_port_fdb_prepare, 93 - .port_fdb_add = mv88e6xxx_port_fdb_add, 94 - .port_fdb_del = mv88e6xxx_port_fdb_del, 95 - .port_fdb_dump = mv88e6xxx_port_fdb_dump, 96 - }; 97 - 98 - MODULE_ALIAS("platform:mv88e6085"); 99 - MODULE_ALIAS("platform:mv88e6095"); 100 - MODULE_ALIAS("platform:mv88e6095f"); 101 - MODULE_ALIAS("platform:mv88e6131");
-101
drivers/net/dsa/mv88e6171.c
··· 1 - /* net/dsa/mv88e6171.c - Marvell 88e6171 switch chip support 2 - * Copyright (c) 2008-2009 Marvell Semiconductor 3 - * Copyright (c) 2014 Claudio Leite <leitec@staticky.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - */ 10 - 11 - #include <linux/delay.h> 12 - #include <linux/jiffies.h> 13 - #include <linux/list.h> 14 - #include <linux/module.h> 15 - #include <linux/netdevice.h> 16 - #include <linux/phy.h> 17 - #include <net/dsa.h> 18 - #include "mv88e6xxx.h" 19 - 20 - static const struct mv88e6xxx_info mv88e6171_table[] = { 21 - { 22 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6171, 23 - .family = MV88E6XXX_FAMILY_6351, 24 - .name = "Marvell 88E6171", 25 - .num_databases = 4096, 26 - .num_ports = 7, 27 - .flags = MV88E6XXX_FLAGS_FAMILY_6351, 28 - }, { 29 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6175, 30 - .family = MV88E6XXX_FAMILY_6351, 31 - .name = "Marvell 88E6175", 32 - .num_databases = 4096, 33 - .num_ports = 7, 34 - .flags = MV88E6XXX_FLAGS_FAMILY_6351, 35 - }, { 36 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6350, 37 - .family = MV88E6XXX_FAMILY_6351, 38 - .name = "Marvell 88E6350", 39 - .num_databases = 4096, 40 - .num_ports = 7, 41 - .flags = MV88E6XXX_FLAGS_FAMILY_6351, 42 - }, { 43 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6351, 44 - .family = MV88E6XXX_FAMILY_6351, 45 - .name = "Marvell 88E6351", 46 - .num_databases = 4096, 47 - .num_ports = 7, 48 - .flags = MV88E6XXX_FLAGS_FAMILY_6351, 49 - } 50 - }; 51 - 52 - static const char *mv88e6171_drv_probe(struct device *dsa_dev, 53 - struct device *host_dev, int sw_addr, 54 - void **priv) 55 - { 56 - return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv, 57 - mv88e6171_table, 58 - ARRAY_SIZE(mv88e6171_table)); 59 - } 60 - 61 - struct dsa_switch_driver mv88e6171_switch_driver = { 62 - .tag_protocol = DSA_TAG_PROTO_EDSA, 63 - .probe = mv88e6171_drv_probe, 64 - .setup = mv88e6xxx_setup, 65 - .set_addr = mv88e6xxx_set_addr, 66 - .phy_read = mv88e6xxx_phy_read, 67 - .phy_write = mv88e6xxx_phy_write, 68 - .set_eee = mv88e6xxx_set_eee, 69 - .get_eee = mv88e6xxx_get_eee, 70 - .get_strings = mv88e6xxx_get_strings, 71 - .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, 72 - .get_sset_count = mv88e6xxx_get_sset_count, 73 - .adjust_link = mv88e6xxx_adjust_link, 74 - #ifdef CONFIG_NET_DSA_HWMON 75 - .get_temp = mv88e6xxx_get_temp, 76 - .get_temp_limit = mv88e6xxx_get_temp_limit, 77 - .set_temp_limit = mv88e6xxx_set_temp_limit, 78 - .get_temp_alarm = mv88e6xxx_get_temp_alarm, 79 - #endif 80 - .get_eeprom = mv88e6xxx_get_eeprom, 81 - .set_eeprom = mv88e6xxx_set_eeprom, 82 - .get_regs_len = mv88e6xxx_get_regs_len, 83 - .get_regs = mv88e6xxx_get_regs, 84 - .port_bridge_join = mv88e6xxx_port_bridge_join, 85 - .port_bridge_leave = mv88e6xxx_port_bridge_leave, 86 - .port_stp_state_set = mv88e6xxx_port_stp_state_set, 87 - .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, 88 - .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, 89 - .port_vlan_add = mv88e6xxx_port_vlan_add, 90 - .port_vlan_del = mv88e6xxx_port_vlan_del, 91 - .port_vlan_dump = mv88e6xxx_port_vlan_dump, 92 - .port_fdb_prepare = mv88e6xxx_port_fdb_prepare, 93 - .port_fdb_add = mv88e6xxx_port_fdb_add, 94 - .port_fdb_del = mv88e6xxx_port_fdb_del, 95 - .port_fdb_dump = mv88e6xxx_port_fdb_dump, 96 - }; 97 - 98 - MODULE_ALIAS("platform:mv88e6171"); 99 - MODULE_ALIAS("platform:mv88e6175"); 100 - MODULE_ALIAS("platform:mv88e6350"); 101 - MODULE_ALIAS("platform:mv88e6351");
-121
drivers/net/dsa/mv88e6352.c
··· 1 - /* 2 - * net/dsa/mv88e6352.c - Marvell 88e6352 switch chip support 3 - * 4 - * Copyright (c) 2014 Guenter Roeck 5 - * 6 - * Derived from mv88e6123_61_65.c 7 - * Copyright (c) 2008-2009 Marvell Semiconductor 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - */ 14 - 15 - #include <linux/delay.h> 16 - #include <linux/jiffies.h> 17 - #include <linux/list.h> 18 - #include <linux/module.h> 19 - #include <linux/netdevice.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/phy.h> 22 - #include <net/dsa.h> 23 - #include "mv88e6xxx.h" 24 - 25 - static const struct mv88e6xxx_info mv88e6352_table[] = { 26 - { 27 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6320, 28 - .family = MV88E6XXX_FAMILY_6320, 29 - .name = "Marvell 88E6320", 30 - .num_databases = 4096, 31 - .num_ports = 7, 32 - .flags = MV88E6XXX_FLAGS_FAMILY_6320, 33 - }, { 34 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6321, 35 - .family = MV88E6XXX_FAMILY_6320, 36 - .name = "Marvell 88E6321", 37 - .num_databases = 4096, 38 - .num_ports = 7, 39 - .flags = MV88E6XXX_FLAGS_FAMILY_6320, 40 - }, { 41 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6172, 42 - .family = MV88E6XXX_FAMILY_6352, 43 - .name = "Marvell 88E6172", 44 - .num_databases = 4096, 45 - .num_ports = 7, 46 - .flags = MV88E6XXX_FLAGS_FAMILY_6352, 47 - }, { 48 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6176, 49 - .family = MV88E6XXX_FAMILY_6352, 50 - .name = "Marvell 88E6176", 51 - .num_databases = 4096, 52 - .num_ports = 7, 53 - .flags = MV88E6XXX_FLAGS_FAMILY_6352, 54 - }, { 55 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6240, 56 - .family = MV88E6XXX_FAMILY_6352, 57 - .name = "Marvell 88E6240", 58 - .num_databases = 4096, 59 - .num_ports = 7, 60 - .flags = MV88E6XXX_FLAGS_FAMILY_6352, 61 - }, { 62 - .prod_num = PORT_SWITCH_ID_PROD_NUM_6352, 63 - .family = MV88E6XXX_FAMILY_6352, 64 - .name = "Marvell 88E6352", 65 - .num_databases = 4096, 66 - .num_ports = 7, 67 - .flags = MV88E6XXX_FLAGS_FAMILY_6352, 68 - } 69 - }; 70 - 71 - static const char *mv88e6352_drv_probe(struct device *dsa_dev, 72 - struct device *host_dev, int sw_addr, 73 - void **priv) 74 - { 75 - return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv, 76 - mv88e6352_table, 77 - ARRAY_SIZE(mv88e6352_table)); 78 - } 79 - 80 - struct dsa_switch_driver mv88e6352_switch_driver = { 81 - .tag_protocol = DSA_TAG_PROTO_EDSA, 82 - .probe = mv88e6352_drv_probe, 83 - .setup = mv88e6xxx_setup, 84 - .set_addr = mv88e6xxx_set_addr, 85 - .phy_read = mv88e6xxx_phy_read, 86 - .phy_write = mv88e6xxx_phy_write, 87 - .get_strings = mv88e6xxx_get_strings, 88 - .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, 89 - .get_sset_count = mv88e6xxx_get_sset_count, 90 - .adjust_link = mv88e6xxx_adjust_link, 91 - .set_eee = mv88e6xxx_set_eee, 92 - .get_eee = mv88e6xxx_get_eee, 93 - #ifdef CONFIG_NET_DSA_HWMON 94 - .get_temp = mv88e6xxx_get_temp, 95 - .get_temp_limit = mv88e6xxx_get_temp_limit, 96 - .set_temp_limit = mv88e6xxx_set_temp_limit, 97 - .get_temp_alarm = mv88e6xxx_get_temp_alarm, 98 - #endif 99 - .get_eeprom = mv88e6xxx_get_eeprom, 100 - .set_eeprom = mv88e6xxx_set_eeprom, 101 - .get_regs_len = mv88e6xxx_get_regs_len, 102 - .get_regs = mv88e6xxx_get_regs, 103 - .port_bridge_join = mv88e6xxx_port_bridge_join, 104 - .port_bridge_leave = mv88e6xxx_port_bridge_leave, 105 - .port_stp_state_set = mv88e6xxx_port_stp_state_set, 106 - .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, 107 - .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, 108 - .port_vlan_add = mv88e6xxx_port_vlan_add, 109 - .port_vlan_del = mv88e6xxx_port_vlan_del, 110 - .port_vlan_dump = mv88e6xxx_port_vlan_dump, 111 - .port_fdb_prepare = mv88e6xxx_port_fdb_prepare, 112 - .port_fdb_add = mv88e6xxx_port_fdb_add, 113 - .port_fdb_del = mv88e6xxx_port_fdb_del, 114 - .port_fdb_dump = mv88e6xxx_port_fdb_dump, 115 - }; 116 - 117 - MODULE_ALIAS("platform:mv88e6172"); 118 - MODULE_ALIAS("platform:mv88e6176"); 119 - MODULE_ALIAS("platform:mv88e6320"); 120 - MODULE_ALIAS("platform:mv88e6321"); 121 - MODULE_ALIAS("platform:mv88e6352");
+271 -83
drivers/net/dsa/mv88e6xxx.c
··· 467 467 * phy. However, in the case of a fixed link phy, we force the port 468 468 * settings from the fixed link settings. 469 469 */ 470 - void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, 471 - struct phy_device *phydev) 470 + static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, 471 + struct phy_device *phydev) 472 472 { 473 473 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 474 474 u32 reg; ··· 714 714 return value; 715 715 } 716 716 717 - void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, uint8_t *data) 717 + static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, 718 + uint8_t *data) 718 719 { 719 720 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 720 721 struct mv88e6xxx_hw_stat *stat; ··· 731 730 } 732 731 } 733 732 734 - int mv88e6xxx_get_sset_count(struct dsa_switch *ds) 733 + static int mv88e6xxx_get_sset_count(struct dsa_switch *ds) 735 734 { 736 735 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 737 736 struct mv88e6xxx_hw_stat *stat; ··· 745 744 return j; 746 745 } 747 746 748 - void 749 - mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, 750 - int port, uint64_t *data) 747 + static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, 748 + uint64_t *data) 751 749 { 752 750 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 753 751 struct mv88e6xxx_hw_stat *stat; ··· 771 771 mutex_unlock(&ps->smi_mutex); 772 772 } 773 773 774 - int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) 774 + static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) 775 775 { 776 776 return 32 * sizeof(u16); 777 777 } 778 778 779 - void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, 780 - struct ethtool_regs *regs, void *_p) 779 + static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, 780 + struct ethtool_regs *regs, void *_p) 781 781 { 782 782 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 783 783 u16 *p = _p; ··· 876 876 return ret; 877 877 } 878 878 879 - int mv88e6xxx_get_eeprom(struct dsa_switch *ds, struct ethtool_eeprom *eeprom, 880 - u8 *data) 879 + static int mv88e6xxx_get_eeprom(struct dsa_switch *ds, 880 + struct ethtool_eeprom *eeprom, u8 *data) 881 881 { 882 882 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 883 883 int offset; ··· 982 982 return ret; 983 983 } 984 984 985 - int mv88e6xxx_set_eeprom(struct dsa_switch *ds, struct ethtool_eeprom *eeprom, 986 - u8 *data) 985 + static int mv88e6xxx_set_eeprom(struct dsa_switch *ds, 986 + struct ethtool_eeprom *eeprom, u8 *data) 987 987 { 988 988 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 989 989 int offset; ··· 1104 1104 return _mv88e6xxx_phy_wait(ps); 1105 1105 } 1106 1106 1107 - int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) 1107 + static int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, 1108 + struct ethtool_eee *e) 1108 1109 { 1109 1110 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 1110 1111 int reg; ··· 1134 1133 return reg; 1135 1134 } 1136 1135 1137 - int mv88e6xxx_set_eee(struct dsa_switch *ds, int port, 1138 - struct phy_device *phydev, struct ethtool_eee *e) 1136 + static int mv88e6xxx_set_eee(struct dsa_switch *ds, int port, 1137 + struct phy_device *phydev, struct ethtool_eee *e) 1139 1138 { 1140 1139 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 1141 1140 int reg; ··· 1365 1364 return _mv88e6xxx_reg_write(ps, REG_PORT(port), PORT_BASE_VLAN, reg); 1366 1365 } 1367 1366 1368 - void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state) 1367 + static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, 1368 + u8 state) 1369 1369 { 1370 1370 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 1371 1371 int stp_state; ··· 1589 1587 return 0; 1590 1588 } 1591 1589 1592 - int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, 1593 - struct switchdev_obj_port_vlan *vlan, 1594 - int (*cb)(struct switchdev_obj *obj)) 1590 + static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, 1591 + struct switchdev_obj_port_vlan *vlan, 1592 + int (*cb)(struct switchdev_obj *obj)) 1595 1593 { 1596 1594 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 1597 1595 struct mv88e6xxx_vtu_stu_entry next; ··· 2016 2014 [PORT_CONTROL_2_8021Q_SECURE] = "Secure", 2017 2015 }; 2018 2016 2019 - int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, 2020 - bool vlan_filtering) 2017 + static int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, 2018 + bool vlan_filtering) 2021 2019 { 2022 2020 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2023 2021 u16 old, new = vlan_filtering ? PORT_CONTROL_2_8021Q_SECURE : ··· 2056 2054 return ret; 2057 2055 } 2058 2056 2059 - int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, 2060 - const struct switchdev_obj_port_vlan *vlan, 2061 - struct switchdev_trans *trans) 2057 + static int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, 2058 + const struct switchdev_obj_port_vlan *vlan, 2059 + struct switchdev_trans *trans) 2062 2060 { 2063 2061 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2064 2062 int err; ··· 2097 2095 return _mv88e6xxx_vtu_loadpurge(ps, &vlan); 2098 2096 } 2099 2097 2100 - void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, 2101 - const struct switchdev_obj_port_vlan *vlan, 2102 - struct switchdev_trans *trans) 2098 + static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, 2099 + const struct switchdev_obj_port_vlan *vlan, 2100 + struct switchdev_trans *trans) 2103 2101 { 2104 2102 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2105 2103 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; ··· 2159 2157 return _mv88e6xxx_atu_remove(ps, vlan.fid, port, false); 2160 2158 } 2161 2159 2162 - int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, 2163 - const struct switchdev_obj_port_vlan *vlan) 2160 + static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, 2161 + const struct switchdev_obj_port_vlan *vlan) 2164 2162 { 2165 2163 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2166 2164 u16 pvid, vid; ··· 2273 2271 return _mv88e6xxx_atu_load(ps, &entry); 2274 2272 } 2275 2273 2276 - int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port, 2277 - const struct switchdev_obj_port_fdb *fdb, 2278 - struct switchdev_trans *trans) 2274 + static int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port, 2275 + const struct switchdev_obj_port_fdb *fdb, 2276 + struct switchdev_trans *trans) 2279 2277 { 2280 2278 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2281 2279 ··· 2288 2286 return 0; 2289 2287 } 2290 2288 2291 - void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, 2292 - const struct switchdev_obj_port_fdb *fdb, 2293 - struct switchdev_trans *trans) 2289 + static void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, 2290 + const struct switchdev_obj_port_fdb *fdb, 2291 + struct switchdev_trans *trans) 2294 2292 { 2295 2293 int state = is_multicast_ether_addr(fdb->addr) ? 2296 2294 GLOBAL_ATU_DATA_STATE_MC_STATIC : ··· 2306 2304 mutex_unlock(&ps->smi_mutex); 2307 2305 } 2308 2306 2309 - int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, 2310 - const struct switchdev_obj_port_fdb *fdb) 2307 + static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, 2308 + const struct switchdev_obj_port_fdb *fdb) 2311 2309 { 2312 2310 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2313 2311 int ret; ··· 2409 2407 return err; 2410 2408 } 2411 2409 2412 - int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, 2413 - struct switchdev_obj_port_fdb *fdb, 2414 - int (*cb)(struct switchdev_obj *obj)) 2410 + static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, 2411 + struct switchdev_obj_port_fdb *fdb, 2412 + int (*cb)(struct switchdev_obj *obj)) 2415 2413 { 2416 2414 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2417 2415 struct mv88e6xxx_vtu_stu_entry vlan = { ··· 2459 2457 return err; 2460 2458 } 2461 2459 2462 - int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, 2463 - struct net_device *bridge) 2460 + static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, 2461 + struct net_device *bridge) 2464 2462 { 2465 2463 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2466 2464 int i, err = 0; ··· 2486 2484 return err; 2487 2485 } 2488 2486 2489 - void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port) 2487 + static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port) 2490 2488 { 2491 2489 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 2492 2490 struct net_device *bridge = ps->ports[port].bridge_dev; ··· 3110 3108 return err; 3111 3109 } 3112 3110 3113 - int mv88e6xxx_setup(struct dsa_switch *ds) 3111 + static int mv88e6xxx_setup(struct dsa_switch *ds) 3114 3112 { 3115 3113 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3116 3114 int err; ··· 3183 3181 return -EINVAL; 3184 3182 } 3185 3183 3186 - int 3187 - mv88e6xxx_phy_read(struct dsa_switch *ds, int port, int regnum) 3184 + static int mv88e6xxx_phy_read(struct dsa_switch *ds, int port, int regnum) 3188 3185 { 3189 3186 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3190 3187 int addr = mv88e6xxx_port_to_phy_addr(ps, port); ··· 3205 3204 return ret; 3206 3205 } 3207 3206 3208 - int 3209 - mv88e6xxx_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val) 3207 + static int mv88e6xxx_phy_write(struct dsa_switch *ds, int port, int regnum, 3208 + u16 val) 3210 3209 { 3211 3210 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3212 3211 int addr = mv88e6xxx_port_to_phy_addr(ps, port); ··· 3292 3291 return 0; 3293 3292 } 3294 3293 3295 - int mv88e6xxx_get_temp(struct dsa_switch *ds, int *temp) 3294 + static int mv88e6xxx_get_temp(struct dsa_switch *ds, int *temp) 3296 3295 { 3297 3296 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3298 3297 ··· 3305 3304 return mv88e61xx_get_temp(ds, temp); 3306 3305 } 3307 3306 3308 - int mv88e6xxx_get_temp_limit(struct dsa_switch *ds, int *temp) 3307 + static int mv88e6xxx_get_temp_limit(struct dsa_switch *ds, int *temp) 3309 3308 { 3310 3309 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3311 3310 int phy = mv88e6xxx_6320_family(ps) ? 3 : 0; ··· 3325 3324 return 0; 3326 3325 } 3327 3326 3328 - int mv88e6xxx_set_temp_limit(struct dsa_switch *ds, int temp) 3327 + static int mv88e6xxx_set_temp_limit(struct dsa_switch *ds, int temp) 3329 3328 { 3330 3329 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3331 3330 int phy = mv88e6xxx_6320_family(ps) ? 3 : 0; ··· 3342 3341 (ret & 0xe0ff) | (temp << 8)); 3343 3342 } 3344 3343 3345 - int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm) 3344 + static int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm) 3346 3345 { 3347 3346 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 3348 3347 int phy = mv88e6xxx_6320_family(ps) ? 3 : 0; ··· 3363 3362 } 3364 3363 #endif /* CONFIG_NET_DSA_HWMON */ 3365 3364 3365 + static const struct mv88e6xxx_info mv88e6xxx_table[] = { 3366 + [MV88E6085] = { 3367 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6085, 3368 + .family = MV88E6XXX_FAMILY_6097, 3369 + .name = "Marvell 88E6085", 3370 + .num_databases = 4096, 3371 + .num_ports = 10, 3372 + .flags = MV88E6XXX_FLAGS_FAMILY_6097, 3373 + }, 3374 + 3375 + [MV88E6095] = { 3376 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6095, 3377 + .family = MV88E6XXX_FAMILY_6095, 3378 + .name = "Marvell 88E6095/88E6095F", 3379 + .num_databases = 256, 3380 + .num_ports = 11, 3381 + .flags = MV88E6XXX_FLAGS_FAMILY_6095, 3382 + }, 3383 + 3384 + [MV88E6123] = { 3385 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6123, 3386 + .family = MV88E6XXX_FAMILY_6165, 3387 + .name = "Marvell 88E6123", 3388 + .num_databases = 4096, 3389 + .num_ports = 3, 3390 + .flags = MV88E6XXX_FLAGS_FAMILY_6165, 3391 + }, 3392 + 3393 + [MV88E6131] = { 3394 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6131, 3395 + .family = MV88E6XXX_FAMILY_6185, 3396 + .name = "Marvell 88E6131", 3397 + .num_databases = 256, 3398 + .num_ports = 8, 3399 + .flags = MV88E6XXX_FLAGS_FAMILY_6185, 3400 + }, 3401 + 3402 + [MV88E6161] = { 3403 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6161, 3404 + .family = MV88E6XXX_FAMILY_6165, 3405 + .name = "Marvell 88E6161", 3406 + .num_databases = 4096, 3407 + .num_ports = 6, 3408 + .flags = MV88E6XXX_FLAGS_FAMILY_6165, 3409 + }, 3410 + 3411 + [MV88E6165] = { 3412 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6165, 3413 + .family = MV88E6XXX_FAMILY_6165, 3414 + .name = "Marvell 88E6165", 3415 + .num_databases = 4096, 3416 + .num_ports = 6, 3417 + .flags = MV88E6XXX_FLAGS_FAMILY_6165, 3418 + }, 3419 + 3420 + [MV88E6171] = { 3421 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6171, 3422 + .family = MV88E6XXX_FAMILY_6351, 3423 + .name = "Marvell 88E6171", 3424 + .num_databases = 4096, 3425 + .num_ports = 7, 3426 + .flags = MV88E6XXX_FLAGS_FAMILY_6351, 3427 + }, 3428 + 3429 + [MV88E6172] = { 3430 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6172, 3431 + .family = MV88E6XXX_FAMILY_6352, 3432 + .name = "Marvell 88E6172", 3433 + .num_databases = 4096, 3434 + .num_ports = 7, 3435 + .flags = MV88E6XXX_FLAGS_FAMILY_6352, 3436 + }, 3437 + 3438 + [MV88E6175] = { 3439 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6175, 3440 + .family = MV88E6XXX_FAMILY_6351, 3441 + .name = "Marvell 88E6175", 3442 + .num_databases = 4096, 3443 + .num_ports = 7, 3444 + .flags = MV88E6XXX_FLAGS_FAMILY_6351, 3445 + }, 3446 + 3447 + [MV88E6176] = { 3448 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6176, 3449 + .family = MV88E6XXX_FAMILY_6352, 3450 + .name = "Marvell 88E6176", 3451 + .num_databases = 4096, 3452 + .num_ports = 7, 3453 + .flags = MV88E6XXX_FLAGS_FAMILY_6352, 3454 + }, 3455 + 3456 + [MV88E6185] = { 3457 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6185, 3458 + .family = MV88E6XXX_FAMILY_6185, 3459 + .name = "Marvell 88E6185", 3460 + .num_databases = 256, 3461 + .num_ports = 10, 3462 + .flags = MV88E6XXX_FLAGS_FAMILY_6185, 3463 + }, 3464 + 3465 + [MV88E6240] = { 3466 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6240, 3467 + .family = MV88E6XXX_FAMILY_6352, 3468 + .name = "Marvell 88E6240", 3469 + .num_databases = 4096, 3470 + .num_ports = 7, 3471 + .flags = MV88E6XXX_FLAGS_FAMILY_6352, 3472 + }, 3473 + 3474 + [MV88E6320] = { 3475 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6320, 3476 + .family = MV88E6XXX_FAMILY_6320, 3477 + .name = "Marvell 88E6320", 3478 + .num_databases = 4096, 3479 + .num_ports = 7, 3480 + .flags = MV88E6XXX_FLAGS_FAMILY_6320, 3481 + }, 3482 + 3483 + [MV88E6321] = { 3484 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6321, 3485 + .family = MV88E6XXX_FAMILY_6320, 3486 + .name = "Marvell 88E6321", 3487 + .num_databases = 4096, 3488 + .num_ports = 7, 3489 + .flags = MV88E6XXX_FLAGS_FAMILY_6320, 3490 + }, 3491 + 3492 + [MV88E6350] = { 3493 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6350, 3494 + .family = MV88E6XXX_FAMILY_6351, 3495 + .name = "Marvell 88E6350", 3496 + .num_databases = 4096, 3497 + .num_ports = 7, 3498 + .flags = MV88E6XXX_FLAGS_FAMILY_6351, 3499 + }, 3500 + 3501 + [MV88E6351] = { 3502 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6351, 3503 + .family = MV88E6XXX_FAMILY_6351, 3504 + .name = "Marvell 88E6351", 3505 + .num_databases = 4096, 3506 + .num_ports = 7, 3507 + .flags = MV88E6XXX_FLAGS_FAMILY_6351, 3508 + }, 3509 + 3510 + [MV88E6352] = { 3511 + .prod_num = PORT_SWITCH_ID_PROD_NUM_6352, 3512 + .family = MV88E6XXX_FAMILY_6352, 3513 + .name = "Marvell 88E6352", 3514 + .num_databases = 4096, 3515 + .num_ports = 7, 3516 + .flags = MV88E6XXX_FLAGS_FAMILY_6352, 3517 + }, 3518 + }; 3519 + 3366 3520 static const struct mv88e6xxx_info * 3367 3521 mv88e6xxx_lookup_info(unsigned int prod_num, const struct mv88e6xxx_info *table, 3368 3522 unsigned int num) ··· 3531 3375 return NULL; 3532 3376 } 3533 3377 3534 - const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev, 3535 - int sw_addr, void **priv, 3536 - const struct mv88e6xxx_info *table, 3537 - unsigned int num) 3378 + static const char *mv88e6xxx_probe(struct device *dsa_dev, 3379 + struct device *host_dev, int sw_addr, 3380 + void **priv) 3538 3381 { 3539 3382 const struct mv88e6xxx_info *info; 3540 3383 struct mv88e6xxx_priv_state *ps; ··· 3552 3397 prod_num = (id & 0xfff0) >> 4; 3553 3398 rev = id & 0x000f; 3554 3399 3555 - info = mv88e6xxx_lookup_info(prod_num, table, num); 3400 + info = mv88e6xxx_lookup_info(prod_num, mv88e6xxx_table, 3401 + ARRAY_SIZE(mv88e6xxx_table)); 3556 3402 if (!info) 3557 3403 return NULL; 3558 3404 ··· 3575 3419 return name; 3576 3420 } 3577 3421 3422 + struct dsa_switch_driver mv88e6xxx_switch_driver = { 3423 + .tag_protocol = DSA_TAG_PROTO_EDSA, 3424 + .probe = mv88e6xxx_probe, 3425 + .setup = mv88e6xxx_setup, 3426 + .set_addr = mv88e6xxx_set_addr, 3427 + .phy_read = mv88e6xxx_phy_read, 3428 + .phy_write = mv88e6xxx_phy_write, 3429 + .adjust_link = mv88e6xxx_adjust_link, 3430 + .get_strings = mv88e6xxx_get_strings, 3431 + .get_ethtool_stats = mv88e6xxx_get_ethtool_stats, 3432 + .get_sset_count = mv88e6xxx_get_sset_count, 3433 + .set_eee = mv88e6xxx_set_eee, 3434 + .get_eee = mv88e6xxx_get_eee, 3435 + #ifdef CONFIG_NET_DSA_HWMON 3436 + .get_temp = mv88e6xxx_get_temp, 3437 + .get_temp_limit = mv88e6xxx_get_temp_limit, 3438 + .set_temp_limit = mv88e6xxx_set_temp_limit, 3439 + .get_temp_alarm = mv88e6xxx_get_temp_alarm, 3440 + #endif 3441 + .get_eeprom = mv88e6xxx_get_eeprom, 3442 + .set_eeprom = mv88e6xxx_set_eeprom, 3443 + .get_regs_len = mv88e6xxx_get_regs_len, 3444 + .get_regs = mv88e6xxx_get_regs, 3445 + .port_bridge_join = mv88e6xxx_port_bridge_join, 3446 + .port_bridge_leave = mv88e6xxx_port_bridge_leave, 3447 + .port_stp_state_set = mv88e6xxx_port_stp_state_set, 3448 + .port_vlan_filtering = mv88e6xxx_port_vlan_filtering, 3449 + .port_vlan_prepare = mv88e6xxx_port_vlan_prepare, 3450 + .port_vlan_add = mv88e6xxx_port_vlan_add, 3451 + .port_vlan_del = mv88e6xxx_port_vlan_del, 3452 + .port_vlan_dump = mv88e6xxx_port_vlan_dump, 3453 + .port_fdb_prepare = mv88e6xxx_port_fdb_prepare, 3454 + .port_fdb_add = mv88e6xxx_port_fdb_add, 3455 + .port_fdb_del = mv88e6xxx_port_fdb_del, 3456 + .port_fdb_dump = mv88e6xxx_port_fdb_dump, 3457 + }; 3458 + 3578 3459 static int __init mv88e6xxx_init(void) 3579 3460 { 3580 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6131) 3581 - register_switch_driver(&mv88e6131_switch_driver); 3582 - #endif 3583 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6123) 3584 - register_switch_driver(&mv88e6123_switch_driver); 3585 - #endif 3586 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6352) 3587 - register_switch_driver(&mv88e6352_switch_driver); 3588 - #endif 3589 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6171) 3590 - register_switch_driver(&mv88e6171_switch_driver); 3591 - #endif 3461 + register_switch_driver(&mv88e6xxx_switch_driver); 3462 + 3592 3463 return 0; 3593 3464 } 3594 3465 module_init(mv88e6xxx_init); 3595 3466 3596 3467 static void __exit mv88e6xxx_cleanup(void) 3597 3468 { 3598 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6171) 3599 - unregister_switch_driver(&mv88e6171_switch_driver); 3600 - #endif 3601 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6352) 3602 - unregister_switch_driver(&mv88e6352_switch_driver); 3603 - #endif 3604 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6123) 3605 - unregister_switch_driver(&mv88e6123_switch_driver); 3606 - #endif 3607 - #if IS_ENABLED(CONFIG_NET_DSA_MV88E6131) 3608 - unregister_switch_driver(&mv88e6131_switch_driver); 3609 - #endif 3469 + unregister_switch_driver(&mv88e6xxx_switch_driver); 3610 3470 } 3611 3471 module_exit(mv88e6xxx_cleanup); 3612 3472 3473 + MODULE_ALIAS("platform:mv88e6085"); 3474 + MODULE_ALIAS("platform:mv88e6095"); 3475 + MODULE_ALIAS("platform:mv88e6095f"); 3476 + MODULE_ALIAS("platform:mv88e6123"); 3477 + MODULE_ALIAS("platform:mv88e6131"); 3478 + MODULE_ALIAS("platform:mv88e6161"); 3479 + MODULE_ALIAS("platform:mv88e6165"); 3480 + MODULE_ALIAS("platform:mv88e6171"); 3481 + MODULE_ALIAS("platform:mv88e6172"); 3482 + MODULE_ALIAS("platform:mv88e6175"); 3483 + MODULE_ALIAS("platform:mv88e6176"); 3484 + MODULE_ALIAS("platform:mv88e6320"); 3485 + MODULE_ALIAS("platform:mv88e6321"); 3486 + MODULE_ALIAS("platform:mv88e6350"); 3487 + MODULE_ALIAS("platform:mv88e6351"); 3488 + MODULE_ALIAS("platform:mv88e6352"); 3613 3489 MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>"); 3614 3490 MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips"); 3615 3491 MODULE_LICENSE("GPL");
+21 -70
drivers/net/dsa/mv88e6xxx.h
··· 338 338 339 339 #define MV88E6XXX_N_FID 4096 340 340 341 + /* List of supported models */ 342 + enum mv88e6xxx_model { 343 + MV88E6085, 344 + MV88E6095, 345 + MV88E6123, 346 + MV88E6131, 347 + MV88E6161, 348 + MV88E6165, 349 + MV88E6171, 350 + MV88E6172, 351 + MV88E6175, 352 + MV88E6176, 353 + MV88E6185, 354 + MV88E6240, 355 + MV88E6320, 356 + MV88E6321, 357 + MV88E6350, 358 + MV88E6351, 359 + MV88E6352, 360 + }; 361 + 341 362 enum mv88e6xxx_family { 342 363 MV88E6XXX_FAMILY_NONE, 343 364 MV88E6XXX_FAMILY_6065, /* 6031 6035 6061 6065 */ ··· 603 582 { 604 583 return (ps->info->flags & flags) == flags; 605 584 } 606 - 607 - const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev, 608 - int sw_addr, void **priv, 609 - const struct mv88e6xxx_info *table, 610 - unsigned int num); 611 - 612 - int mv88e6xxx_setup(struct dsa_switch *ds); 613 - int mv88e6xxx_reg_read(struct mv88e6xxx_priv_state *ps, int addr, int reg); 614 - int mv88e6xxx_reg_write(struct mv88e6xxx_priv_state *ps, int addr, 615 - int reg, u16 val); 616 - int mv88e6xxx_set_addr(struct dsa_switch *ds, u8 *addr); 617 - int mv88e6xxx_phy_read(struct dsa_switch *ds, int port, int regnum); 618 - int mv88e6xxx_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val); 619 - void mv88e6xxx_get_strings(struct dsa_switch *ds, int port, uint8_t *data); 620 - void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, 621 - uint64_t *data); 622 - int mv88e6xxx_get_sset_count(struct dsa_switch *ds); 623 - int mv88e6xxx_get_sset_count_basic(struct dsa_switch *ds); 624 - void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, 625 - struct phy_device *phydev); 626 - int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port); 627 - void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, 628 - struct ethtool_regs *regs, void *_p); 629 - int mv88e6xxx_get_temp(struct dsa_switch *ds, int *temp); 630 - int mv88e6xxx_get_temp_limit(struct dsa_switch *ds, int *temp); 631 - int mv88e6xxx_set_temp_limit(struct dsa_switch *ds, int temp); 632 - int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm); 633 - int mv88e6xxx_get_eeprom(struct dsa_switch *ds, struct ethtool_eeprom *eeprom, 634 - u8 *data); 635 - int mv88e6xxx_set_eeprom(struct dsa_switch *ds, struct ethtool_eeprom *eeprom, 636 - u8 *data); 637 - int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e); 638 - int mv88e6xxx_set_eee(struct dsa_switch *ds, int port, 639 - struct phy_device *phydev, struct ethtool_eee *e); 640 - int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, 641 - struct net_device *bridge); 642 - void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port); 643 - void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state); 644 - int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, 645 - bool vlan_filtering); 646 - int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, 647 - const struct switchdev_obj_port_vlan *vlan, 648 - struct switchdev_trans *trans); 649 - void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, 650 - const struct switchdev_obj_port_vlan *vlan, 651 - struct switchdev_trans *trans); 652 - int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, 653 - const struct switchdev_obj_port_vlan *vlan); 654 - int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port, 655 - struct switchdev_obj_port_vlan *vlan, 656 - int (*cb)(struct switchdev_obj *obj)); 657 - int mv88e6xxx_port_fdb_prepare(struct dsa_switch *ds, int port, 658 - const struct switchdev_obj_port_fdb *fdb, 659 - struct switchdev_trans *trans); 660 - void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, 661 - const struct switchdev_obj_port_fdb *fdb, 662 - struct switchdev_trans *trans); 663 - int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port, 664 - const struct switchdev_obj_port_fdb *fdb); 665 - int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, 666 - struct switchdev_obj_port_fdb *fdb, 667 - int (*cb)(struct switchdev_obj *obj)); 668 - int mv88e6xxx_phy_page_read(struct dsa_switch *ds, int port, int page, int reg); 669 - int mv88e6xxx_phy_page_write(struct dsa_switch *ds, int port, int page, 670 - int reg, int val); 671 - 672 - extern struct dsa_switch_driver mv88e6131_switch_driver; 673 - extern struct dsa_switch_driver mv88e6123_switch_driver; 674 - extern struct dsa_switch_driver mv88e6352_switch_driver; 675 - extern struct dsa_switch_driver mv88e6171_switch_driver; 676 585 677 586 #endif