All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xing Zheng <zhengxing@rock-chips.com>
To: heiko@sntech.de
Cc: linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	zhengxing@rock-chips.com
Subject: [PATCH v3 8/8] rockchip: make sure timer5 is enabled on rk3036 platforms
Date: Tue, 29 Sep 2015 10:44:31 +0800	[thread overview]
Message-ID: <1443494671-16035-1-git-send-email-zhengxing@rock-chips.com> (raw)
In-Reply-To: <1443492833-15630-1-git-send-email-zhengxing@rock-chips.com>

The timer5 supplies the architected timer and thus as has to run when
the system clocksource and clockevents drivers are registered.

---

Changes in v3:
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

 arch/arm/mach-rockchip/rockchip.c |   44 +++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index b6cf3b4..d483b71 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -29,31 +29,38 @@
 #include "core.h"
 #include "pm.h"
 
+#define RK3036_TIMER_PHYS 0x20044000
+
 #define RK3288_GRF_SOC_CON0 0x244
 #define RK3288_TIMER6_7_PHYS 0xff810000
 
+static void rockchip_init_arch_timer_supply(resource_size_t phys, int offs)
+{
+	void __iomem *reg_base = ioremap(phys, SZ_16K);
+
+	/*
+	 * Most/all uboot versions for Rockchip SoCs don't enable
+	 * timer which is needed for the architected timer to work.
+	 * So make sure it is running during early boot.
+	 */
+	if (reg_base) {
+		writel(0, reg_base + offs + 0x10);
+		writel(0xffffffff, reg_base + offs);
+		writel(0xffffffff, reg_base + offs + 0x04);
+		writel(1, reg_base + offs + 0x10);
+		dsb();
+		iounmap(reg_base);
+	} else {
+		pr_err("rockchip: could not map timer registers\n");
+	}
+}
+
 static void __init rockchip_timer_init(void)
 {
 	if (of_machine_is_compatible("rockchip,rk3288")) {
 		struct regmap *grf;
-		void __iomem *reg_base;
 
-		/*
-		 * Most/all uboot versions for rk3288 don't enable timer7
-		 * which is needed for the architected timer to work.
-		 * So make sure it is running during early boot.
-		 */
-		reg_base = ioremap(RK3288_TIMER6_7_PHYS, SZ_16K);
-		if (reg_base) {
-			writel(0, reg_base + 0x30);
-			writel(0xffffffff, reg_base + 0x20);
-			writel(0xffffffff, reg_base + 0x24);
-			writel(1, reg_base + 0x30);
-			dsb();
-			iounmap(reg_base);
-		} else {
-			pr_err("rockchip: could not map timer7 registers\n");
-		}
+		rockchip_init_arch_timer_supply(RK3288_TIMER6_7_PHYS, 0x20);
 
 		/*
 		 * Disable auto jtag/sdmmc switching that causes issues
@@ -64,6 +71,8 @@ static void __init rockchip_timer_init(void)
 			regmap_write(grf, RK3288_GRF_SOC_CON0, 0x10000000);
 		else
 			pr_err("rockchip: could not get grf syscon\n");
+	} else if (of_machine_is_compatible("rockchip,rk3036")) {
+		rockchip_init_arch_timer_supply(RK3036_TIMER_PHYS, 0xa0);
 	}
 
 	of_clk_init(NULL);
@@ -79,6 +88,7 @@ static void __init rockchip_dt_init(void)
 
 static const char * const rockchip_board_dt_compat[] = {
 	"rockchip,rk2928",
+	"rockchip,rk3036",
 	"rockchip,rk3066a",
 	"rockchip,rk3066b",
 	"rockchip,rk3188",
-- 
1.7.9.5



WARNING: multiple messages have this Message-ID (diff)
From: zhengxing@rock-chips.com (Xing Zheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 8/8] rockchip: make sure timer5 is enabled on rk3036 platforms
Date: Tue, 29 Sep 2015 10:44:31 +0800	[thread overview]
Message-ID: <1443494671-16035-1-git-send-email-zhengxing@rock-chips.com> (raw)
In-Reply-To: <1443492833-15630-1-git-send-email-zhengxing@rock-chips.com>

The timer5 supplies the architected timer and thus as has to run when
the system clocksource and clockevents drivers are registered.

---

Changes in v3:
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

 arch/arm/mach-rockchip/rockchip.c |   44 +++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index b6cf3b4..d483b71 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -29,31 +29,38 @@
 #include "core.h"
 #include "pm.h"
 
+#define RK3036_TIMER_PHYS 0x20044000
+
 #define RK3288_GRF_SOC_CON0 0x244
 #define RK3288_TIMER6_7_PHYS 0xff810000
 
+static void rockchip_init_arch_timer_supply(resource_size_t phys, int offs)
+{
+	void __iomem *reg_base = ioremap(phys, SZ_16K);
+
+	/*
+	 * Most/all uboot versions for Rockchip SoCs don't enable
+	 * timer which is needed for the architected timer to work.
+	 * So make sure it is running during early boot.
+	 */
+	if (reg_base) {
+		writel(0, reg_base + offs + 0x10);
+		writel(0xffffffff, reg_base + offs);
+		writel(0xffffffff, reg_base + offs + 0x04);
+		writel(1, reg_base + offs + 0x10);
+		dsb();
+		iounmap(reg_base);
+	} else {
+		pr_err("rockchip: could not map timer registers\n");
+	}
+}
+
 static void __init rockchip_timer_init(void)
 {
 	if (of_machine_is_compatible("rockchip,rk3288")) {
 		struct regmap *grf;
-		void __iomem *reg_base;
 
-		/*
-		 * Most/all uboot versions for rk3288 don't enable timer7
-		 * which is needed for the architected timer to work.
-		 * So make sure it is running during early boot.
-		 */
-		reg_base = ioremap(RK3288_TIMER6_7_PHYS, SZ_16K);
-		if (reg_base) {
-			writel(0, reg_base + 0x30);
-			writel(0xffffffff, reg_base + 0x20);
-			writel(0xffffffff, reg_base + 0x24);
-			writel(1, reg_base + 0x30);
-			dsb();
-			iounmap(reg_base);
-		} else {
-			pr_err("rockchip: could not map timer7 registers\n");
-		}
+		rockchip_init_arch_timer_supply(RK3288_TIMER6_7_PHYS, 0x20);
 
 		/*
 		 * Disable auto jtag/sdmmc switching that causes issues
@@ -64,6 +71,8 @@ static void __init rockchip_timer_init(void)
 			regmap_write(grf, RK3288_GRF_SOC_CON0, 0x10000000);
 		else
 			pr_err("rockchip: could not get grf syscon\n");
+	} else if (of_machine_is_compatible("rockchip,rk3036")) {
+		rockchip_init_arch_timer_supply(RK3036_TIMER_PHYS, 0xa0);
 	}
 
 	of_clk_init(NULL);
@@ -79,6 +88,7 @@ static void __init rockchip_dt_init(void)
 
 static const char * const rockchip_board_dt_compat[] = {
 	"rockchip,rk2928",
+	"rockchip,rk3036",
 	"rockchip,rk3066a",
 	"rockchip,rk3066b",
 	"rockchip,rk3188",
-- 
1.7.9.5

  parent reply	other threads:[~2015-09-29  2:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29  2:13 [PATCH v3 0/8] Build and support rk3036 SoC platform Xing Zheng
2015-09-29  2:13 ` Xing Zheng
2015-09-29  2:13 ` [PATCH v3 1/8] ARM: dts: rockchip: add core rk3036 dts Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-10-04 16:54   ` kbuild test robot
2015-10-04 16:54     ` kbuild test robot
2015-10-04 16:54     ` kbuild test robot
2015-09-29  2:13 ` [PATCH v3 2/8] clk: rockchip: add dt-binding header for rk3036 Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-09-29  2:13 ` [PATCH v3 3/8] clk: rockchip: add clock controller " Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-09-29  2:13 ` [PATCH v3 4/8] dt-bindings: add documentation of rk3036 clock controller Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-09-29  2:13 ` [PATCH v3 5/8] clk: rockchip: add new clock type and controller for rk3036 Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-10-01  8:12   ` Heiko Stübner
2015-10-01  8:12     ` Heiko Stübner
2015-10-01  8:46     ` zhengxing
2015-10-01  8:46       ` zhengxing
2015-09-29  2:13 ` [PATCH v3 6/8] ARM: rockchip: add support smp " Xing Zheng
2015-09-29  2:13   ` Xing Zheng
2015-10-02  9:19   ` Heiko Stübner
2015-10-02  9:19     ` Heiko Stübner
2015-10-02  9:19     ` Heiko Stübner
2015-09-29  2:37 ` [PATCH v3 7/8] ARM: dts: enable " Xing Zheng
2015-09-29  2:37   ` Xing Zheng
2015-09-29  2:37   ` Xing Zheng
2015-09-29  2:44 ` Xing Zheng [this message]
2015-09-29  2:44   ` [PATCH v3 8/8] rockchip: make sure timer5 is enabled on rk3036 platforms Xing Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443494671-16035-1-git-send-email-zhengxing@rock-chips.com \
    --to=zhengxing@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.