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

Merge branch 'net-dsa-bcm_sf2-Add-support-for-optional-reset-controller-line'

Florian Fainelli says:

====================
net: dsa: bcm_sf2: Add support for optional reset controller line

This patch series definest the optional reset controller line for the
BCM7445/BCM7278 integrated Ethernet switches and updates the driver to
drive that reset line in lieu of the internal watchdog based reset since
it does not work on BCM7278.

Changes in v2:
- make the reset_control_assert() conditional to BCM7278 in the remove
function as well
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+28
+6
Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt
··· 44 44 Admission Control Block supports reporting the number of packets in-flight in a 45 45 switch queue 46 46 47 + - resets: a single phandle and reset identifier pair. See 48 + Documentation/devicetree/binding/reset/reset.txt for details. 49 + 50 + - reset-names: If the "reset" property is specified, this property should have 51 + the value "switch" to denote the switch reset line. 52 + 47 53 Port subnodes: 48 54 49 55 Optional properties:
+19
drivers/net/dsa/bcm_sf2.c
··· 350 350 { 351 351 unsigned int timeout = 1000; 352 352 u32 reg; 353 + int ret; 354 + 355 + /* The watchdog reset does not work on 7278, we need to hit the 356 + * "external" reset line through the reset controller. 357 + */ 358 + if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) { 359 + ret = reset_control_assert(priv->rcdev); 360 + if (ret) 361 + return ret; 362 + 363 + return reset_control_deassert(priv->rcdev); 364 + } 353 365 354 366 reg = core_readl(priv, CORE_WATCHDOG_CTRL); 355 367 reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; ··· 1104 1092 priv->core_reg_align = data->core_reg_align; 1105 1093 priv->num_cfp_rules = data->num_cfp_rules; 1106 1094 1095 + priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev, 1096 + "switch"); 1097 + if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER) 1098 + return PTR_ERR(priv->rcdev); 1099 + 1107 1100 /* Auto-detection using standard registers will not work, so 1108 1101 * provide an indication of what kind of device we are for 1109 1102 * b53_common to work with ··· 1241 1224 /* Disable all ports and interrupts */ 1242 1225 bcm_sf2_sw_suspend(priv->dev->ds); 1243 1226 bcm_sf2_mdio_unregister(priv); 1227 + if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) 1228 + reset_control_assert(priv->rcdev); 1244 1229 1245 1230 return 0; 1246 1231 }
+3
drivers/net/dsa/bcm_sf2.h
··· 18 18 #include <linux/types.h> 19 19 #include <linux/bitops.h> 20 20 #include <linux/if_vlan.h> 21 + #include <linux/reset.h> 21 22 22 23 #include <net/dsa.h> 23 24 ··· 64 63 void __iomem *intrl2_1; 65 64 void __iomem *fcb; 66 65 void __iomem *acb; 66 + 67 + struct reset_control *rcdev; 67 68 68 69 /* Register offsets indirection tables */ 69 70 u32 type;