aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2015-01-20 19:42:00 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-25 19:02:13 -0500
commit691c9a8fdcbbb27682f151a23e36df35fc250c03 (patch)
treeffedce71dac53a1526ed0abca5a67a90a7317269
parent799d44442c4821dec65fc59baa4ddc6783a25c54 (diff)
net: dsa: bcm_sf2: factor interrupt disabling in a function
Factor the interrupt disabling in a function: bcm_sf2_intr_disable() since we are doing the same thing in the setup and suspend paths. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/bcm_sf2.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index feb29c4526f7..09f6b3cc1f66 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -400,6 +400,16 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv)
400 return 0; 400 return 0;
401} 401}
402 402
403static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv)
404{
405 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
406 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
407 intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
408 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
409 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
410 intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
411}
412
403static int bcm_sf2_sw_setup(struct dsa_switch *ds) 413static int bcm_sf2_sw_setup(struct dsa_switch *ds)
404{ 414{
405 const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; 415 const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME;
@@ -440,12 +450,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
440 } 450 }
441 451
442 /* Disable all interrupts and request them */ 452 /* Disable all interrupts and request them */
443 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); 453 bcm_sf2_intr_disable(priv);
444 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
445 intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
446 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
447 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
448 intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
449 454
450 ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0, 455 ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0,
451 "switch_0", priv); 456 "switch_0", priv);
@@ -747,12 +752,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
747 struct bcm_sf2_priv *priv = ds_to_priv(ds); 752 struct bcm_sf2_priv *priv = ds_to_priv(ds);
748 unsigned int port; 753 unsigned int port;
749 754
750 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); 755 bcm_sf2_intr_disable(priv);
751 intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
752 intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
753 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
754 intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
755 intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
756 756
757 /* Disable all ports physically present including the IMP 757 /* Disable all ports physically present including the IMP
758 * port, the other ones have already been disabled during 758 * port, the other ones have already been disabled during