linux-mips
[Top] [All Lists]

[PATCH 3/3] MIPS: BCM63XX: use the new reset helper

To: linux-mips@linux-mips.org
Subject: [PATCH 3/3] MIPS: BCM63XX: use the new reset helper
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sun, 28 Oct 2012 14:17:55 +0100
Cc: Ralf Baechle <ralf@linux-mips.org>, John Crispin <blogic@openwrt.org>, Maxime Bizon <mbizon@freebox.fr>, Florian Fainelli <florian@openwrt.org>, Kevin Cernekee <cernekee@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=lLsLSsszVtj8hbyzwwyvazVk9TlIoQHJFDPuOEi64h8=; b=Szk4JPcg1pp3aQsdogFAFzbGvbNJLpaTXoiSYmfn+9FiqwrSCcq1vgt/Fq9qqKZUVB x0cWCHlVl+lia3me99I4ERRWuNeTMzJdKnL+P1J35gv57EDVQuVCTrDDtCYVKuVrJrkd oM11cDmO8Et3PWlhxF86mhEvleMn8gybn2b5fjJksut+oLRfcDCIlK4OdbxNH/BCi2uT TlPE87/ANp2sYpMngt/XOfsWvOEczDzMNZ3eNF9Z1qowYsOBtuPImkV30ztwhRcjiLt6 UX8NamGWnbRl8u0BVE94K1/7VLlBRDD5XewGLuXrdtRv9ZVBQEI/kYZtGuwakeTUK3wy 3Xpg==
In-reply-to: <1351430275-14509-1-git-send-email-jonas.gorski@gmail.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1351430275-14509-1-git-send-email-jonas.gorski@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Use the new reset helper where appropriate.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/bcm63xx/clk.c     |   19 +++++--------------
 arch/mips/pci/pci-bcm63xx.c |   19 ++++++-------------
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 89a5fb0..b9e948d 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -14,6 +14,7 @@
 #include <bcm63xx_cpu.h>
 #include <bcm63xx_io.h>
 #include <bcm63xx_regs.h>
+#include <bcm63xx_reset.h>
 #include <bcm63xx_clk.h>
 
 static DEFINE_MUTEX(clocks_mutex);
@@ -124,15 +125,10 @@ static void enetsw_set(struct clk *clk, int enable)
                        CKCTL_6368_SWPKT_USB_EN |
                        CKCTL_6368_SWPKT_SAR_EN, enable);
        if (enable) {
-               u32 val;
-
                /* reset switch core afer clock change */
-               val = bcm_perf_readl(PERF_SOFTRESET_6368_REG);
-               val &= ~SOFTRESET_6368_ENETSW_MASK;
-               bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
+               bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 1);
                msleep(10);
-               val |= SOFTRESET_6368_ENETSW_MASK;
-               bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
+               bcm63xx_core_set_reset(BCM63XX_RESET_ENETSW, 0);
                msleep(10);
        }
 }
@@ -222,15 +218,10 @@ static void xtm_set(struct clk *clk, int enable)
                        CKCTL_6368_SWPKT_SAR_EN, enable);
 
        if (enable) {
-               u32 val;
-
                /* reset sar core afer clock change */
-               val = bcm_perf_readl(PERF_SOFTRESET_6368_REG);
-               val &= ~SOFTRESET_6368_SAR_MASK;
-               bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
+               bcm63xx_core_set_reset(BCM63XX_RESET_SAR, 1);
                mdelay(1);
-               val |= SOFTRESET_6368_SAR_MASK;
-               bcm_perf_writel(val, PERF_SOFTRESET_6368_REG);
+               bcm63xx_core_set_reset(BCM63XX_RESET_SAR, 0);
                mdelay(1);
        }
 }
diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c
index fa8c320..ca179b6 100644
--- a/arch/mips/pci/pci-bcm63xx.c
+++ b/arch/mips/pci/pci-bcm63xx.c
@@ -14,6 +14,8 @@
 #include <linux/clk.h>
 #include <asm/bootinfo.h>
 
+#include <bcm63xx_reset.h>
+
 #include "pci-bcm63xx.h"
 
 /*
@@ -126,23 +128,14 @@ static void __init bcm63xx_reset_pcie(void)
        bcm_misc_writel(val, MISC_SERDES_CTRL_REG);
 
        /* reset the PCIe core */
-       val = bcm_perf_readl(PERF_SOFTRESET_6328_REG);
-
-       val &= ~SOFTRESET_6328_PCIE_MASK;
-       val &= ~SOFTRESET_6328_PCIE_CORE_MASK;
-       val &= ~SOFTRESET_6328_PCIE_HARD_MASK;
-       val &= ~SOFTRESET_6328_PCIE_EXT_MASK;
-       bcm_perf_writel(val, PERF_SOFTRESET_6328_REG);
+       bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 1);
+       bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 1);
        mdelay(10);
 
-       val |= SOFTRESET_6328_PCIE_MASK;
-       val |= SOFTRESET_6328_PCIE_CORE_MASK;
-       val |= SOFTRESET_6328_PCIE_HARD_MASK;
-       bcm_perf_writel(val, PERF_SOFTRESET_6328_REG);
+       bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 0);
        mdelay(10);
 
-       val |= SOFTRESET_6328_PCIE_EXT_MASK;
-       bcm_perf_writel(val, PERF_SOFTRESET_6328_REG);
+       bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 0);
        mdelay(200);
 }
 
-- 
1.7.2.5


<Prev in Thread] Current Thread [Next in Thread>