linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: s.trumtrar@pengutronix.de (Steffen Trumtrar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: zynq: read scu base from SoC
Date: Sat, 23 Mar 2013 13:57:28 +0100	[thread overview]
Message-ID: <1364043450-18700-2-git-send-email-s.trumtrar@pengutronix.de> (raw)
In-Reply-To: <1364043450-18700-1-git-send-email-s.trumtrar@pengutronix.de>

Instead of hardcoding the base address of the SCU get it from the device.
While at it, add the SCU to the DT.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Josh Cartwright <josh.cartwright@ni.com>
---
 arch/arm/boot/dts/zynq-7000.dtsi |  5 +++++
 arch/arm/mach-zynq/common.c      | 34 ++++++++++++++++++++++------------
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 88564fa..c103082 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -199,6 +199,11 @@
 			};
 		};
 
+		scu: scu at f8f000000 {
+			compatible = "arm,cortex-a9-scu";
+			reg = <0xf8f00000 0x58>;
+		};
+
 		timer: timer at f8f00600 {
 			compatible = "arm,cortex-a9-twd-timer";
 			reg = <0xf8f00600 0x20>;
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 920e20a..014131c 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -32,11 +32,14 @@
 #include <asm/mach-types.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
+#include <asm/smp_scu.h>
 #include <asm/smp_twd.h>
 #include <asm/hardware/cache-l2x0.h>
 
 #include "common.h"
 
+void __iomem *scu_base;
+
 static struct of_device_id zynq_of_bus_ids[] __initdata = {
 	{ .compatible = "simple-bus", },
 	{}
@@ -56,17 +59,6 @@ static void __init xilinx_init_machine(void)
 	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
 }
 
-#define SCU_PERIPH_PHYS		0xF8F00000
-#define SCU_PERIPH_SIZE		SZ_8K
-#define SCU_PERIPH_VIRT		(VMALLOC_END - SCU_PERIPH_SIZE)
-
-static struct map_desc scu_desc __initdata = {
-	.virtual	= SCU_PERIPH_VIRT,
-	.pfn		= __phys_to_pfn(SCU_PERIPH_PHYS),
-	.length		= SCU_PERIPH_SIZE,
-	.type		= MT_DEVICE,
-};
-
 static void __init xilinx_zynq_timer_init(void)
 {
 	struct device_node *np;
@@ -82,13 +74,31 @@ static void __init xilinx_zynq_timer_init(void)
 	xttcps_timer_init();
 }
 
+static struct map_desc zynq_cortex_a9_scu_map __initdata = {
+	.length	= SZ_8K,
+	.type	= MT_DEVICE,
+};
+
+void __init zynq_scu_map_io(void)
+{
+	if (scu_a9_has_base()) {
+		unsigned long base;
+
+		base = scu_a9_get_base();
+		zynq_cortex_a9_scu_map.pfn = __phys_to_pfn(base);
+		zynq_cortex_a9_scu_map.virtual = base;
+		iotable_init(&zynq_cortex_a9_scu_map, 1);
+		scu_base = ioremap(base, zynq_cortex_a9_scu_map.length);
+	}
+}
+
 /**
  * xilinx_map_io() - Create memory mappings needed for early I/O.
  */
 static void __init xilinx_map_io(void)
 {
 	debug_ll_io_init();
-	iotable_init(&scu_desc, 1);
+	zynq_scu_map_io();
 }
 
 static const char *xilinx_dt_match[] = {
-- 
1.8.2.rc2

  reply	other threads:[~2013-03-23 12:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23 12:57 [PATCH 0/3] ARM: zynq: add SMP support for zynq7000 Steffen Trumtrar
2013-03-23 12:57 ` Steffen Trumtrar [this message]
2013-03-25 14:01   ` [PATCH 1/3] ARM: zynq: read scu base from SoC Michal Simek
2013-03-25 14:25     ` Steffen Trumtrar
2013-03-25 14:59       ` Michal Simek
2013-03-26 11:08         ` Steffen Trumtrar
2013-03-26 12:35           ` Michal Simek
2013-03-26 12:46             ` Steffen Trumtrar
2013-03-26 12:53               ` Michal Simek
2013-03-26 13:01                 ` Steffen Trumtrar
2013-03-23 12:57 ` [PATCH 2/3] ARM: zynq: get slcr base earlier Steffen Trumtrar
2013-03-25 14:04   ` Michal Simek
2013-03-25 14:39     ` Steffen Trumtrar
2013-03-25 14:55       ` Michal Simek
2013-03-23 12:57 ` [PATCH 3/3] ARM: zynq: add SMP support Steffen Trumtrar
2013-03-25 14:27   ` Michal Simek
2013-03-25 16:34     ` Steffen Trumtrar
2013-03-25 16:47       ` Michal Simek

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=1364043450-18700-2-git-send-email-s.trumtrar@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).