mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 05/10] ARM i.MX bootsource: add separate function for mx25 and mx35
Date: Thu, 14 Mar 2013 18:38:44 +0100	[thread overview]
Message-ID: <1363282729-18545-6-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1363282729-18545-1-git-send-email-mkl@pengutronix.de>

This patch creates a seperate function for mx25 and mx35 to save it's
bootsource.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/arm/mach-imx/boot.c                 | 22 +++++++++++++++++++++-
 arch/arm/mach-imx/imx25.c                |  6 +-----
 arch/arm/mach-imx/imx35.c                |  6 +-----
 arch/arm/mach-imx/include/mach/generic.h |  3 ++-
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 473b9d1..95a7673 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -18,6 +18,8 @@
 
 #include <io.h>
 #include <mach/generic.h>
+#include <mach/imx25-regs.h>
+#include <mach/imx35-regs.h>
 
 static const char *bootsource_str[] = {
 	[BOOTSOURCE_UNKNOWN] = "unknown",
@@ -94,7 +96,7 @@ static const enum imx_bootsource locations[4][4] = {
  * Note also that I suspect that the boot source pins are only sampled at
  * power up.
  */
-void imx_25_35_boot_save_loc(unsigned int ctrl, unsigned int type)
+static void imx25_35_boot_save_loc(unsigned int ctrl, unsigned int type)
 {
 	enum imx_bootsource src;
 
@@ -103,6 +105,24 @@ void imx_25_35_boot_save_loc(unsigned int ctrl, unsigned int type)
 	imx_set_bootsource(src);
 }
 
+void imx25_boot_save_loc(void __iomem *ccm_base)
+{
+	uint32_t val;
+
+	val = readl(ccm_base + MX25_CCM_RCSR);
+	imx25_35_boot_save_loc((val >> MX25_CCM_RCSR_MEM_CTRL_SHIFT) & 0x3,
+			       (val >> MX25_CCM_RCSR_MEM_TYPE_SHIFT) & 0x3);
+}
+
+void imx35_boot_save_loc(void __iomem *ccm_base)
+{
+	uint32_t val;
+
+	val = readl(ccm_base + MX35_CCM_RCSR);
+	imx25_35_boot_save_loc((val >> MX35_CCM_RCSR_MEM_CTRL_SHIFT) & 0x3,
+			       (val >> MX35_CCM_RCSR_MEM_TYPE_SHIFT) & 0x3);
+}
+
 #define IMX27_SYSCTRL_GPCR	0x18
 #define IMX27_GPCR_BOOT_SHIFT			16
 #define IMX27_GPCR_BOOT_MASK			(0xf << IMX27_GPCR_BOOT_SHIFT)
diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index adcd9d2..5011918 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -59,11 +59,7 @@ static struct imx_iim_platform_data imx25_iim_pdata = {
 
 static int imx25_init(void)
 {
-	uint32_t val;
-
-	val = readl(MX25_CCM_BASE_ADDR + MX25_CCM_RCSR);
-	imx_25_35_boot_save_loc((val >> MX25_CCM_RCSR_MEM_CTRL_SHIFT) & 0x3,
-			(val >> MX25_CCM_RCSR_MEM_TYPE_SHIFT) & 0x3);
+	imx25_boot_save_loc((void *)MX25_CCM_BASE_ADDR);
 
 	add_generic_device("imx_iim", 0, NULL, MX25_IIM_BASE_ADDR, SZ_4K,
 			IORESOURCE_MEM, &imx25_iim_pdata);
diff --git a/arch/arm/mach-imx/imx35.c b/arch/arm/mach-imx/imx35.c
index 7b68783..92f6964 100644
--- a/arch/arm/mach-imx/imx35.c
+++ b/arch/arm/mach-imx/imx35.c
@@ -59,13 +59,9 @@ core_initcall(imx35_l2_fix);
 
 static int imx35_init(void)
 {
-	uint32_t val;
-
 	imx35_silicon_revision();
 
-	val = readl(MX35_CCM_BASE_ADDR + MX35_CCM_RCSR);
-	imx_25_35_boot_save_loc((val >> MX35_CCM_RCSR_MEM_CTRL_SHIFT) & 0x3,
-			(val >> MX35_CCM_RCSR_MEM_TYPE_SHIFT) & 0x3);
+	imx35_boot_save_loc((void *)MX35_CCM_BASE_ADDR);
 
 	add_generic_device("imx_iim", 0, NULL, MX35_IIM_BASE_ADDR, SZ_4K,
 			IORESOURCE_MEM, NULL);
diff --git a/arch/arm/mach-imx/include/mach/generic.h b/arch/arm/mach-imx/include/mach/generic.h
index d39369b..f6e9ecf 100644
--- a/arch/arm/mach-imx/include/mach/generic.h
+++ b/arch/arm/mach-imx/include/mach/generic.h
@@ -16,7 +16,8 @@ enum imx_bootsource {
 enum imx_bootsource imx_bootsource(void);
 void imx_set_bootsource(enum imx_bootsource src);
 
-void imx_25_35_boot_save_loc(unsigned int ctrl, unsigned int type);
+void imx25_boot_save_loc(void __iomem *ccm_base);
+void imx35_boot_save_loc(void __iomem *ccm_base);
 void imx27_boot_save_loc(void __iomem *sysctrl_base);
 void imx51_boot_save_loc(void __iomem *src_base);
 void imx53_boot_save_loc(void __iomem *src_base);
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-03-14 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 17:38 [PATCH 00/10] make bootsource an arch independent framework Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 01/10] ARM i.MX bootsource: convert enums from enum imx_bootsource to uppercase Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 02/10] ARM i.MX bootsource: convert all imx*_boot_save_loc functions to void Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 03/10] ARM i.MX bootsource: imx_25_35_boot_save_loc: remove leftover do-nothing code Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 04/10] ARM i.MX bootsource: rename imx_27_boot_save_loc -> imx27_boot_save_loc Marc Kleine-Budde
2013-03-14 17:38 ` Marc Kleine-Budde [this message]
2013-03-14 17:38 ` [PATCH 06/10] bootsource: create arch independent bootsource framework Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 07/10] bootsource: use initcall to export bootsource location to environment Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 08/10] bootsource: add support for bootsource instance information Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 09/10] bootsource: add definition for usb and eeprom Marc Kleine-Budde
2013-03-14 17:38 ` [PATCH 10/10] ARM: mxs: add bootsource detection Marc Kleine-Budde

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=1363282729-18545-6-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@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