linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: shawnguo@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Fabio Estevam <festevam@gmail.com>,
	arnd@arndb.de, linux-imx@nxp.com, kernel@pengutronix.de
Subject: [PATCH v2 01/11] ARM: imx27: Retrieve the SYSCTRL base address from devicetree
Date: Wed, 16 Sep 2020 21:41:15 -0300	[thread overview]
Message-ID: <20200917004125.18487-2-festevam@gmail.com> (raw)
In-Reply-To: <20200917004125.18487-1-festevam@gmail.com>

Now that imx27 has been converted to a devicetree-only platform,
retrieve the SYSCTRL base address from devicetree.

To keep devicetree compatibilty the SYSCTRL base address will be
retrieved from the CCM base address plus an 0x800 offset.

This is not a problem as the imx27.dtsi describes the CCM register
range as 0x1000.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Do not introduce a sysctrl node to avoid breaking DT compatibility (Arnd)

 arch/arm/mach-imx/cpu-imx27.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c
index a969aa71b60f..bf70e13bbe9e 100644
--- a/arch/arm/mach-imx/cpu-imx27.c
+++ b/arch/arm/mach-imx/cpu-imx27.c
@@ -9,6 +9,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/of_address.h>
 #include <linux/module.h>
 
 #include "hardware.h"
@@ -17,16 +18,23 @@ static int mx27_cpu_rev = -1;
 static int mx27_cpu_partnumber;
 
 #define SYS_CHIP_ID             0x00    /* The offset of CHIP ID register */
+#define SYSCTRL_OFFSET		0x800	/* Offset from CCM base address */
 
 static int mx27_read_cpu_rev(void)
 {
+	void __iomem *ccm_base;
+	struct device_node *np;
 	u32 val;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
+	ccm_base = of_iomap(np, 0);
+	BUG_ON(!ccm_base);
 	/*
 	 * now we have access to the IO registers. As we need
 	 * the silicon revision very early we read it here to
 	 * avoid any further hooks
 	*/
-	val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID));
+	val = imx_readl(ccm_base + SYSCTRL_OFFSET + SYS_CHIP_ID);
 
 	mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-17  0:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  0:41 [PATCH v2 00/11] ARM: imx: Further cleanups due to dt-only conversion Fabio Estevam
2020-09-17  0:41 ` Fabio Estevam [this message]
2020-09-17  0:41 ` [PATCH v2 02/11] ARM: imx27: Retrieve the CCM base address from devicetree Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 03/11] ARM: imx31: Retrieve the IIM " Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 04/11] ARM: imx3: Retrieve the CCM " Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 05/11] ARM: imx3: Retrieve the AVIC " Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 06/11] ARM: imx35: Retrieve the IIM " Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 07/11] ARM: imx: Remove unused definitions Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 08/11] clk: imx: imx27: Remove mx27_clocks_init() Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 09/11] clk: imx: imx31: Remove mx31_clocks_init() Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 10/11] clk: imx: imx35: Remove mx35_clocks_init() Fabio Estevam
2020-09-17  0:41 ` [PATCH v2 11/11] clk: imx: imx21: Remove clock driver Fabio Estevam
2020-09-17  8:12 ` [PATCH v2 00/11] ARM: imx: Further cleanups due to dt-only conversion Arnd Bergmann
2020-09-22  6:09 ` Shawn Guo

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=20200917004125.18487-2-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=arnd@arndb.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=shawnguo@kernel.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).