Commit f458995b authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: bcm_sf2: Utilize core B53 driver when possible

The Broadcom Starfighter2 is almost entirely register compatible with
B53, yet for historical reasons came up first in the tree and is now
being updated to utilize b53_common.c to the fullest extent possible. A
few things need to be adjusted to allow that:

- the switch "core" registers currently operate on a 32-bit address,
  whereas b53 passes a page + reg pair to offset from, so we need to
  convert that, thankfully there is a generic formula to do that

- the link managemenent is not self contained with the B53/CORE register
  set, but instead is in the SWITCH_REG block which is part of the
  integration glue logic, so we keep that entirely custom here because
  this really is part of the existing bcm_sf2 implementation

- there are additional power management constraints on the port's
  memories that make us keep the port_enable/disable callbacks custom
  for now, also, we support tagging whereas b53_common does not support
  that yet

All the VLAN and bridge code is entirely identical though so, avoid
duplicating it. Other things will be migrated in the future like EEE and
possibly Wake-on-LAN.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48aea33a
...@@ -16,6 +16,7 @@ config NET_DSA_BCM_SF2 ...@@ -16,6 +16,7 @@ config NET_DSA_BCM_SF2
select FIXED_PHY select FIXED_PHY
select BCM7XXX_PHY select BCM7XXX_PHY
select MDIO_BCM_UNIMAC select MDIO_BCM_UNIMAC
select B53
---help--- ---help---
This enables support for the Broadcom Starfighter 2 Ethernet This enables support for the Broadcom Starfighter 2 Ethernet
switch chips. switch chips.
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <net/dsa.h> #include <net/dsa.h>
#include "bcm_sf2_regs.h" #include "bcm_sf2_regs.h"
#include "b53/b53_priv.h"
struct bcm_sf2_hw_params { struct bcm_sf2_hw_params {
u16 top_rev; u16 top_rev;
...@@ -134,6 +135,9 @@ struct bcm_sf2_priv { ...@@ -134,6 +135,9 @@ struct bcm_sf2_priv {
u32 irq1_stat; u32 irq1_stat;
u32 irq1_mask; u32 irq1_mask;
/* Backing b53_device */
struct b53_device *dev;
/* Mutex protecting access to the MIB counters */ /* Mutex protecting access to the MIB counters */
struct mutex stats_mutex; struct mutex stats_mutex;
...@@ -160,6 +164,13 @@ struct bcm_sf2_priv { ...@@ -160,6 +164,13 @@ struct bcm_sf2_priv {
struct bcm_sf2_vlan vlans[VLAN_N_VID]; struct bcm_sf2_vlan vlans[VLAN_N_VID];
}; };
static inline struct bcm_sf2_priv *bcm_sf2_to_priv(struct dsa_switch *ds)
{
struct b53_device *dev = ds_to_priv(ds);
return dev->priv;
}
struct bcm_sf2_hw_stats { struct bcm_sf2_hw_stats {
const char *string; const char *string;
u16 reg; u16 reg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment