summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/bcm_sf2.h
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-12-29 20:16:42 +0300
committerJakub Kicinski <kuba@kernel.org>2021-12-31 04:28:32 +0300
commitaf30f8eaa8fe4ff1987280f716309711997bd979 (patch)
tree20da6fd77b6d221ca28f1df0a65169dfe195e1db /drivers/net/dsa/bcm_sf2.h
parentd6c6d0bb2cb3af91c9c1546af7cdf4770d0df443 (diff)
downloadlinux-af30f8eaa8fe4ff1987280f716309711997bd979.tar.xz
net: dsa: bcm_sf2: refactor LED regs access
1. Define more regs. Some switches (e.g. BCM4908) have up to 6 regs. 2. Add helper for handling non-lineral port <-> reg mappings. 3. Add support for 12 B LED reg blocks on BCM4908 (different layout) Complete support for LEDs setup will be implemented once Linux receives a proper design & implementation for "hardware" LEDs. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20211229171642.22942-1-zajec5@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dsa/bcm_sf2.h')
-rw-r--r--drivers/net/dsa/bcm_sf2.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h
index 0d48402068d3..00afc94ce522 100644
--- a/drivers/net/dsa/bcm_sf2.h
+++ b/drivers/net/dsa/bcm_sf2.h
@@ -210,6 +210,16 @@ SF2_IO_MACRO(acb);
SWITCH_INTR_L2(0);
SWITCH_INTR_L2(1);
+static inline u32 reg_led_readl(struct bcm_sf2_priv *priv, u16 off, u16 reg)
+{
+ return readl_relaxed(priv->reg + priv->reg_offsets[off] + reg);
+}
+
+static inline void reg_led_writel(struct bcm_sf2_priv *priv, u32 val, u16 off, u16 reg)
+{
+ writel_relaxed(val, priv->reg + priv->reg_offsets[off] + reg);
+}
+
/* RXNFC */
int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc, u32 *rule_locs);