net: dsa: add support for Broadcom Starfighter 2
Subsystems (6)
cover net: dsa: add support for Broadcom Starfighter 2
Hi all,
This patchset adds support for Broadcom's Starfighter 2 switch which is used in a wide number of recent ARM-based SoCs from different groups within Broadcom.
This switch is usually integrated in that sort of hardware setup:
Integrated GPHY <=> Port 0
External RGMII/MII devices <=> Ports 1 to 6
MoCA PHY <=> Port 7
CPU <=> Port 8
An internal MDIO bus is used to configure the integrated GPHY as well as external (RG)MII entities which are connected to the switch, hence the UniMAC MDIO driver
I am sending this as a RFC although most of the dsa changes should not be too controversial as they basically just leverage Device Tree to help us fetch platform-specific informations.
The switch driver is fairly simple, but if accepted, future features will be added (classification engine, Wake-on-LAN support, power management ...)
This switch is used with the recently submitted SYSTEMPORT Ethernet MAC driver which supports hardare insertion/extraction of switch tags, hence avoiding the memmove() on the packet contents in both directions, I will send RFC patches for this as well in case other NICs out there also support a similar feature.
Thanks!
Florian Fainelli (11):
net: phy: add generic UniMAC MDIO bus driver
net: dsa: add Broadcom tag hook
net: dsa: provide a switch device device tree node pointer
net: dsa: retain a per-port device_node pointer
net: dsa: allow for more complex PHY setups
net: dsa: allow switches to working without tagging
net: dsa: allow drivers to do link adjustment
net: dsa: allow updating fixed PHY link information
net: dsa: add Broadcom SF2 switch driver
net: dsa: add Broadcom tag RX/TX handler
net: dsa: bcm_sf2: enable Broadcom tags
.../bindings/net/broadcom-mdio-unimac.txt | 33 ++ drivers/net/dsa/Kconfig | 11 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/bcm_sf2.c | 497 +++++++++++++++++++++ drivers/net/dsa/bcm_sf2.h | 135 ++++++ drivers/net/dsa/bcm_sf2_regs.h | 207 +++++++++ drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-unimac.c | 210 +++++++++ include/linux/netdevice.h | 10 + include/net/dsa.h | 23 + include/uapi/linux/if_ether.h | 1 + net/dsa/Kconfig | 3 + net/dsa/Makefile | 1 + net/dsa/dsa.c | 9 + net/dsa/dsa_priv.h | 8 + net/dsa/slave.c | 120 ++++- net/dsa/tag_brcm.c | 170 +++++++ net/ethernet/eth.c | 2 + 19 files changed, 1446 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/broadcom-mdio-unimac.txt create mode 100644 drivers/net/dsa/bcm_sf2.c create mode 100644 drivers/net/dsa/bcm_sf2.h create mode 100644 drivers/net/dsa/bcm_sf2_regs.h create mode 100644 drivers/net/phy/mdio-unimac.c create mode 100644 net/dsa/tag_brcm.c
Signature · 1 line
1.9.1
RFC 1/11 net: phy: add generic UniMAC MDIO bus driver
Add a generic UniMAC MDIO bus driver which can be used by the BCMGENET driver as-is, and with some extend by the Starfighter 2 MDIO bus controller.
--- .../bindings/net/broadcom-mdio-unimac.txt | 33 ++++ drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-unimac.c | 210 +++++++++++++++++++++ 4 files changed, 250 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/broadcom-mdio-unimac.txt create mode 100644 drivers/net/phy/mdio-unimac.c
Documentation/devicetree/bindings/net/broadcom-mdio-unimac.txt new file +33 -0
@@ -0,0 +1,33 @@ +* Broadcom UniMAC MDIO bus controller + +Required properties: +- compatible: should be "brcm,unimac-mdio" +- reg: address and length of the regsiter set for the device, first one is the + base register, and the second one is optional and for indirect accesses +- reg-names: name(s) of the register must be "mdio" and optional "mdio_indir_rw" +- #size-cells: must be 1 +- #address-cells: must be 0 + +Optional properties: +- interrupts: must be two interrupts, one for MDIO done, one for MDIO error +- interrupt-names: must be "mdio_done" for the first interrupt and "mdio_error" + for the second + +Child nodes of this MDIO bus controller node are standard Ethernet PHY device +nodes as described in Documentation/devicetree/bindings/net/phy.txt + +Example: + +mdio@403c0 { + compatible = "brcm,unimac-mdio"; + reg = <0x403c0 0x8 0x40300 0x18>; + reg-names = "mdio", "mdio_indir_rw"; + #size-cells = <1>; + #address-cells = <0>; + + ... + phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; +};
drivers/net/phy/Kconfig +6 -0
@@ -199,6 +199,12 @@ config MDIO_BUS_MUX_MMIOREG Currently, only 8-bit registers are supported. +config MDIO_UNIMAC + tristate "Broadcom UniMAC MDIO bus controller" + help + This module provides a driver for the Broadcom UniMAC MDIO busses. + It is required by the Broadcom GENET Ethernet device drivers. + endif # PHYLIB config MICREL_KS8995MA
drivers/net/phy/Makefile +1 -0
@@ -33,3 +33,4 @@ obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) += mdio-mux-mmioreg.o obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o +obj-$(CONFIG_MDIO_UNIMAC) += mdio-unimac.o
drivers/net/phy/mdio-unimac.c new file +210 -0
210 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC 2/11 net: dsa: add Broadcom tag hook
In reply to Florian FainelliRegister a fake Ethertype for the Broadcom tag to allow us to hook into a given Ethernet device receive path and parse this Broadcom tag.
--- include/linux/netdevice.h | 10 ++++++++++ include/net/dsa.h | 5 +++++ include/uapi/linux/if_ether.h | 1 + net/ethernet/eth.c | 2 ++ 4 files changed, 18 insertions(+)
include/linux/netdevice.h +10 -0
@@ -1675,6 +1675,16 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)return 0 ; } +static inline bool netdev_uses_brcm_tags (struct net_device *dev) +{ +#ifdef CONFIG_NET_DSA_TAG_BRCM +if (dev->dsa_ptr !=NULL ) +return dsa_uses_brcm_tags (dev->dsa_ptr); +#endif + +return 0 ; +} +/** * netdev_priv - access network device private data * @dev: network device
include/net/dsa.h +5 -0
@@ -203,4 +203,9 @@ static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst) return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); } +static inline bool dsa_uses_brcm_tags (struct dsa_switch_tree *dst) +{ +return !!(dst->tag_protocol ==htons (ETH_P_BRCMTAG )); +} +#endif
include/uapi/linux/if_ether.h +1 -0
@@ -128,6 +128,7 @@#define ETH_P_PHONET 0x00F5/* Nokia Phonet frames */ #define ETH_P_IEEE802154 0x00F6/* IEEE802.15.4 frame */ #define ETH_P_CAIF 0x00F7/* ST-Ericsson CAIF protocol */ +#define ETH_P_BRCMTAG 0x00F8/* Broadcom tag (4 bytes *) */ /* * This is an Ethernet frame header.
net/ethernet/eth.c +2 -0
@@ -186,6 +186,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)if (unlikely (netdev_uses_trailer_tags (dev)))return htons (ETH_P_TRAILER ); +if (netdev_uses_brcm_tags (dev)) +return htons (ETH_P_BRCMTAG );if (likely (ntohs (eth->h_proto) >=ETH_P_802_3_MIN ))return eth->h_proto;
Signature · 1 line
1.9.1
RFC 3/11 net: dsa: provide a switch device device tree node pointer
In reply to Florian FainelliWe might need to fetch additional resources from the device tree node pointer, such as register ranges or other properties. Keep a device_node pointer around for this.
--- include/net/dsa.h | 7 +++++++ net/dsa/dsa.c | 1 + 2 files changed, 8 insertions(+)
include/net/dsa.h +7 -0
@@ -15,6 +15,7 @@#include <linux/list.h> #include <linux/timer.h> #include <linux/workqueue.h> +#include <linux/of.h> #define DSA_MAX_SWITCHES 4#define DSA_MAX_PORTS 12
@@ -26,6 +27,12 @@ struct dsa_chip_data {struct device *mii_bus;int sw_addr; +/* Device tree node pointer for this specific switch chip +* used during switch setup in case additional properties +* and resources needs to be used +*/ +struct device_node *of_node; +/* * The names of the switch's ports. Use "cpu" to * designate the switch port that the cpu is connected to,
net/dsa/dsa.c +1 -0
@@ -410,6 +410,7 @@ static int dsa_of_probe(struct platform_device *pdev)for_each_available_child_of_node (np, child) { cd = &pd->chip[chip_index]; + cd->of_node = child; cd->mii_bus = &mdio_bus->dev; sw_addr =of_get_property (child,"reg" ,NULL );
Signature · 1 line
1.9.1
RFC 4/11 net: dsa: retain a per-port device_node pointer
In reply to Florian FainelliWe will later use the per-port device_node pointer to fetch a bunch of port-specific properties.
--- include/net/dsa.h | 1 + net/dsa/dsa.c | 2 ++ 2 files changed, 3 insertions(+)
include/net/dsa.h +1 -0
@@ -41,6 +41,7 @@ struct dsa_chip_data {* or any other string to indicate this is a physical port. */ char *port_names[DSA_MAX_PORTS ]; +struct device_node *port_dn[DSA_MAX_PORTS ];/* * An array (with nr_chips elements) of which element [a]
net/dsa/dsa.c +2 -0
@@ -432,6 +432,8 @@ static int dsa_of_probe(struct platform_device *pdev)if (!port_name)continue ; + cd->port_dn[port_index] = port; + cd->port_names[port_index] =kstrdup (port_name,GFP_KERNEL );if (!cd->port_names[port_index]) {
Signature · 1 line
1.9.1
RFC 5/11 net: dsa: allow for more complex PHY setups
In reply to Florian FainelliModify the DSA slave interface to be bound to an arbitray PHY, not just the ones that are available as child PHY devices of the switch MDIO bus.
This allows us for instance to have external PHYs connected to a separate MDIO bus, but yet also connected to a given switch port.
--- net/dsa/dsa_priv.h | 4 ++++ net/dsa/slave.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-)
net/dsa/dsa_priv.h +4 -0
@@ -33,6 +33,10 @@ struct dsa_slave_priv {* to this port. */ struct phy_device *phy; +phy_interface_t phy_interface; +int old_link; +int old_pause; +int old_duplex; };/* dsa.c */
net/dsa/slave.c +58 -1
84 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC 6/11 net: dsa: allow switches to working without tagging
In reply to Florian FainelliIn case switch port tagging is disabled, allow us to continue using the master net_device operations instead of the tag-specific ones.
--- net/dsa/slave.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
net/dsa/slave.c +23 -1
@@ -332,6 +332,27 @@ static const struct net_device_ops trailer_netdev_ops = { };#endif +static netdev_tx_t dsa_slave_dummy_xmit (struct sk_buff *skb,struct net_device *dev) +{ +struct dsa_slave_priv *p =netdev_priv (dev); + + skb->dev = p->parent->dst->master_netdev; +dev_queue_xmit (skb); + +return NETDEV_TX_OK ; +} + +static const struct net_device_ops dummy_netdev_ops = { + .ndo_init = dsa_slave_init, + .ndo_open = dsa_slave_open, + .ndo_stop = dsa_slave_close, + .ndo_start_xmit = dsa_slave_dummy_xmit, + .ndo_change_rx_flags = dsa_slave_change_rx_flags, + .ndo_set_rx_mode = dsa_slave_set_rx_mode, + .ndo_set_mac_address = dsa_slave_set_mac_address, + .ndo_do_ioctl = dsa_slave_ioctl, +}; +static void dsa_slave_adjust_link (struct net_device *dev) {struct dsa_slave_priv *p =netdev_priv (dev);
@@ -422,7 +443,8 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,break ;#endif default : -BUG (); + slave_dev->netdev_ops = &dummy_netdev_ops; +break ; } parent->of_node = ds->pd->port_dn[port];
Signature · 1 line
1.9.1
RFC 7/11 net: dsa: allow drivers to do link adjustment
In reply to Florian FainelliWhenever libphy determines that the link status of a given PHY/port has changed, allow to call into the switch driver link adjustment callback so proper actions can be taken care of by the switch driver.
--- include/net/dsa.h | 7 +++++++ net/dsa/slave.c | 4 ++++ 2 files changed, 11 insertions(+)
include/net/dsa.h +7 -0
@@ -16,6 +16,7 @@#include <linux/timer.h> #include <linux/workqueue.h> #include <linux/of.h> +#include <linux/phy.h> #define DSA_MAX_SWITCHES 4#define DSA_MAX_PORTS 12
@@ -178,6 +179,12 @@ struct dsa_switch_driver {void (*poll_link)(struct dsa_switch *ds);/* +* Link state adjustment (called from libphy) +*/ +void (*adjust_link)(struct dsa_switch *ds,int port, +struct phy_device *phydev); + +/* * ethtool hardware statistics. */ void (*get_strings)(struct dsa_switch *ds,int port,uint8_t *data);
net/dsa/slave.c +4 -0
@@ -356,6 +356,7 @@ static const struct net_device_ops dummy_netdev_ops = {static void dsa_slave_adjust_link (struct net_device *dev) {struct dsa_slave_priv *p =netdev_priv (dev); +struct dsa_switch *ds = p->parent;unsigned int status_changed =0 ;if (p->old_link != p->phy->link) {
@@ -373,6 +374,9 @@ static void dsa_slave_adjust_link(struct net_device *dev) p->old_pause = p->phy->pause; } +if (ds->drv->adjust_link && status_changed) + ds->drv->adjust_link (ds, p->port, p->phy); +if (status_changed)phy_print_status (p->phy); }
Signature · 1 line
1.9.1
RFC 8/11 net: dsa: allow updating fixed PHY link information
In reply to Florian FainelliAllow switch drivers to hook a PHY link update callback to perform port-specific link work.
--- include/net/dsa.h | 3 +++ net/dsa/slave.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
include/net/dsa.h +3 -0
@@ -17,6 +17,7 @@#include <linux/workqueue.h> #include <linux/of.h> #include <linux/phy.h> +#include <linux/phy_fixed.h> #define DSA_MAX_SWITCHES 4#define DSA_MAX_PORTS 12
@@ -183,6 +184,8 @@ struct dsa_switch_driver {*/ void (*adjust_link)(struct dsa_switch *ds,int port,struct phy_device *phydev); +void (*fixed_link_update)(struct dsa_switch *ds,int port, +struct fixed_phy_status *st);/* * ethtool hardware statistics.
net/dsa/slave.c +17 -1
@@ -381,6 +381,18 @@ static void dsa_slave_adjust_link(struct net_device *dev)phy_print_status (p->phy); } +static int dsa_slave_fixed_link_update (struct net_device *dev, +struct fixed_phy_status *status) +{ +struct dsa_slave_priv *p =netdev_priv (dev); +struct dsa_switch *ds = p->parent; + +if (ds->drv->fixed_link_update) + ds->drv->fixed_link_update (ds, p->port, status); + +return 0 ; +} +/* slave device setup *******************************************************/ static void dsa_slave_phy_setup (struct dsa_slave_priv *p,struct net_device *slave_dev)
@@ -396,10 +408,14 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, p->phy =of_phy_connect (slave_dev, phy_dn, dsa_slave_adjust_link,0 , p->phy_interface); - else + else { p->phy =of_phy_connect_fixed_link (slave_dev, dsa_slave_adjust_link, p->phy_interface); +if (p->phy) +fixed_phy_set_link_update (p->phy, + dsa_slave_fixed_link_update); + }/* We could not connect to a designated PHY, so use the switch internal * MDIO bus instead
Signature · 1 line
1.9.1
RFC 9/11 net: dsa: add Broadcom SF2 switch driver
In reply to Florian FainelliAdd basic support for the Broadcom Starfigther 2 switch chip using a DSA driver. For now we just do the basic initialization to put the switch into a forwarding mode as well as allowing reading its per-port MIB counters.
--- drivers/net/dsa/Kconfig | 10 + drivers/net/dsa/Makefile | 1 + drivers/net/dsa/bcm_sf2.c | 482 +++++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/bcm_sf2.h | 135 ++++++++++++ drivers/net/dsa/bcm_sf2_regs.h | 167 ++++++++++++++ 5 files changed, 795 insertions(+) create mode 100644 drivers/net/dsa/bcm_sf2.c create mode 100644 drivers/net/dsa/bcm_sf2.h create mode 100644 drivers/net/dsa/bcm_sf2_regs.h
drivers/net/dsa/Kconfig +10 -0
@@ -36,4 +36,14 @@ config NET_DSA_MV88E6123_61_65 This enables support for the Marvell 88E6123/6161/6165 ethernet switch chips. +config NET_DSA_BCM_SF2 + tristate "Broadcom Starfighter 2 Ethernet switch support" + select NET_DSA + select FIXED_PHY + select BCM7XXX_PHY + select MDIO_UNIMAC + ---help--- + This enables support for the Broadcom Starfighter 2 ethernet + switch chips. + endmenu
drivers/net/dsa/Makefile +1 -0
@@ -7,3 +7,4 @@ endif ifdef CONFIG_NET_DSA_MV88E6131 mv88e6xxx_drv-y += mv88e6131.o endif +obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm_sf2.o
drivers/net/dsa/bcm_sf2.c new file +482 -0
482 lines not on this page · raw message
drivers/net/dsa/bcm_sf2.h new file +135 -0
135 lines not on this page · raw message
drivers/net/dsa/bcm_sf2_regs.h new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC 10/11 net: dsa: add Broadcom tag RX/TX handler
In reply to Florian FainelliAdd support for the 4-bytes Broadcom tag that built-in switches such as the Starfighter 2 might insert when receiving packets, or that we need to insert while targetting specific switch ports.
--- net/dsa/Kconfig | 3 + net/dsa/Makefile | 1 + net/dsa/dsa.c | 6 ++ net/dsa/dsa_priv.h | 4 ++ net/dsa/slave.c | 17 ++++++ net/dsa/tag_brcm.c | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 201 insertions(+) create mode 100644 net/dsa/tag_brcm.c
net/dsa/Kconfig +3 -0
@@ -12,6 +12,9 @@ config NET_DSA if NET_DSA # tagging formats +config NET_DSA_TAG_BRCM + bool + config NET_DSA_TAG_DSA bool
net/dsa/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_NET_DSA) += dsa_core.o dsa_core-y += dsa.o slave.o # tagging formats +dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
net/dsa/dsa.c +6 -0
@@ -645,6 +645,9 @@ static int __init dsa_init_module(void)#ifdef CONFIG_NET_DSA_TAG_TRAILER dev_add_pack (&trailer_packet_type);#endif +#ifdef CONFIG_NET_DSA_TAG_BRCM +dev_add_pack (&brcm_tag_packet_type); +#endif return 0 ; }module_init (dsa_init_module);
@@ -660,6 +663,9 @@ static void __exit dsa_cleanup_module(void)#ifdef CONFIG_NET_DSA_TAG_DSA dev_remove_pack (&dsa_packet_type);#endif +#ifdef CONFIG_NET_DSA_TAG_BRCM +dev_remove_pack (&brcm_tag_packet_type); +#endif platform_driver_unregister (&dsa_driver); }module_exit (dsa_cleanup_module);
net/dsa/dsa_priv.h +4 -0
@@ -60,5 +60,9 @@ extern struct packet_type edsa_packet_type;netdev_tx_t trailer_xmit (struct sk_buff *skb,struct net_device *dev);extern struct packet_type trailer_packet_type; +/* tag_brcm.c */ +netdev_tx_t brcm_tag_xmit (struct sk_buff *skb,struct net_device *dev); +extern struct packet_type brcm_tag_packet_type; +#endif
net/dsa/slave.c +17 -0
@@ -295,6 +295,18 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = { .get_sset_count = dsa_slave_get_sset_count, }; +#ifdef CONFIG_NET_DSA_TAG_BRCM +static const struct net_device_ops brcm_netdev_ops = { + .ndo_init = dsa_slave_init, + .ndo_open = dsa_slave_open, + .ndo_stop = dsa_slave_close, + .ndo_start_xmit = brcm_tag_xmit, + .ndo_change_rx_flags = dsa_slave_change_rx_flags, + .ndo_set_rx_mode = dsa_slave_set_rx_mode, + .ndo_set_mac_address = dsa_slave_set_mac_address, + .ndo_do_ioctl = dsa_slave_ioctl, +}; +#endif #ifdef CONFIG_NET_DSA_TAG_DSA static const struct net_device_ops dsa_netdev_ops = { .ndo_init = dsa_slave_init,
@@ -462,6 +474,11 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, slave_dev->netdev_ops = &trailer_netdev_ops;break ;#endif +#ifdef CONFIG_NET_DSA_TAG_BRCM +case htons (ETH_P_BRCMTAG ): + slave_dev->netdev_ops = &brcm_netdev_ops; +break ; +#endif default : slave_dev->netdev_ops = &dummy_netdev_ops;break ;
net/dsa/tag_brcm.c new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC 11/11 net: dsa: bcm_sf2: enable Broadcom tags
In reply to Florian FainelliSelect the Broadcom tag mangler/unmangler and configure the IMP port of the switch to dispatch the frames to/from the per-port network devices.
--- drivers/net/dsa/Kconfig | 1 + drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++-- drivers/net/dsa/bcm_sf2_regs.h | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-)
drivers/net/dsa/Kconfig +1 -0
@@ -39,6 +39,7 @@ config NET_DSA_MV88E6123_61_65 config NET_DSA_BCM_SF2 tristate "Broadcom Starfighter 2 Ethernet switch support" select NET_DSA + select NET_DSA_TAG_BRCM select FIXED_PHY select BCM7XXX_PHY select MDIO_UNIMAC
drivers/net/dsa/bcm_sf2.c +17 -2
@@ -164,15 +164,30 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)break ; } -/* Disable Broadcom tags for IMP port */ +/* Enable Broadcom tags for IMP port */ reg =core_readl (priv,CORE_BRCM_HDR_CTRL ); - reg &= ~val; + reg |= val;core_writel (priv, reg,CORE_BRCM_HDR_CTRL ); +/* Enable reception Broadcom tag for CPU TX (switch RX) to +* allow us to tag outgoing frames +*/ + reg =core_readl (priv,CORE_BRCM_HDR_RX_DIS ); + reg &= ~(1 << port); +core_writel (priv, reg,CORE_BRCM_HDR_RX_DIS ); + +/* Enable transmission of Broadcom tags from the switch (CPU RX) to +* allow delivering frames to the per-port net_devices +*/ + reg =core_readl (priv,CORE_BRCM_HDR_TX_DIS ); + reg &= ~(1 << port); +core_writel (priv, reg,CORE_BRCM_HDR_TX_DIS ); +/* Force link status for IMP port */ reg =core_readl (priv,CORE_STS_OVERRIDE_IMP ); reg |= (MII_SW_OR |LINK_STS );core_writel (priv, reg,CORE_STS_OVERRIDE_IMP ); + }static void bcm_sf2_port_setup (struct dsa_switch *ds,int port)
drivers/net/dsa/bcm_sf2_regs.h +40 -0
@@ -127,6 +127,19 @@#define GMII_SPEED_UP_2G (1 << 6)#define MII_SW_OR (1 << 7) +#define CORE_NEW_CTRL 0x00084 +#define IP_MC (1 << 0) +#define OUTRANGEERR_DISCARD (1 << 1) +#define INRANGEERR_DISCARD (1 << 2) +#define CABLE_DIAG_LEN (1 << 3) +#define OVERRIDE_AUTO_PD_WAR (1 << 4) +#define EN_AUTO_PD_WAR (1 << 5) +#define UC_FWD_EN (1 << 6) +#define MC_FWD_EN (1 << 7) + +#define CORE_SFT_LRN_CTRL 0x000f8 +#define SW_LEARN_CNTL (x) (1 << (x)) +#define CORE_STS_OVERRIDE_GMIIP_PORT (x) (0x160 + (x) * 4)#define LINK_STS (1 << 0)#define DUPLX_MODE (1 << 1)
@@ -152,11 +165,38 @@#define CORE_PAUSESTS 0x00428#define PAUSESTS_TX_PAUSE_SHIFT 9 +#define CORE_GMNCFGCFG 0x0800 +#define RST_MIB_CNT (1 << 0) +#define RXBPDU_EN (1 << 1) +#define CORE_BRCM_HDR_CTRL 0x0080c#define BRCM_HDR_EN_P8 (1 << 0)#define BRCM_HDR_EN_P5 (1 << 1)#define BRCM_HDR_EN_P7 (1 << 2) +#define CORE_BRCM_HDR_CTRL2 0x0828 + +#define CORE_HL_PRTC_CTRL 0x0940 +#define ARP_EN (1 << 0) +#define RARP_EN (1 << 1) +#define DHCP_EN (1 << 2) +#define ICMPV4_EN (1 << 3) +#define ICMPV6_EN (1 << 4) +#define ICMPV6_FWD_MODE (1 << 5) +#define IGMP_DIP_EN (1 << 8) +#define IGMP_RPTLVE_EN (1 << 9) +#define IGMP_RTPLVE_FWD_MODE (1 << 10) +#define IGMP_QRY_EN (1 << 11) +#define IGMP_QRY_FWD_MODE (1 << 12) +#define IGMP_UKN_EN (1 << 13) +#define IGMP_UKN_FWD_MODE (1 << 14) +#define MLD_RPTDONE_EN (1 << 15) +#define MLD_RPTDONE_FWD_MODE (1 << 16) +#define MLD_QRY_EN (1 << 17) +#define MLD_QRY_FWD_MODE (1 << 18) + +#define CORE_RST_MIB_CNT_EN 0x0950 +#define CORE_BRCM_HDR_RX_DIS 0x0980#define CORE_BRCM_HDR_TX_DIS 0x0988
Signature · 1 line
1.9.1