mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 04/16] ARM: OMAP: Make cpu_is_* macros runtime if necessary
Date: Fri, 22 Nov 2013 15:54:31 +0100	[thread overview]
Message-ID: <1385132083-7484-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1385132083-7484-1-git-send-email-s.hauer@pengutronix.de>

Currently unused, just preparation for the next steps when we'll
get multiarch support for OMAP.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-omap/include/mach/generic.h | 40 ++++++++++++++++++++++---------
 arch/arm/mach-omap/omap_generic.c         | 11 +++++----
 2 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/generic.h b/arch/arm/mach-omap/include/mach/generic.h
index b05fdee..f4e18f3 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -10,28 +10,46 @@
 #define OMAP_I2C_REV_ON_3630            0x00000040
 #define OMAP_I2C_REV_ON_4430_PLUS       0x50400002
 
-#ifdef CONFIG_ARCH_OMAP
-#define cpu_is_omap2430()	(1)
-#else
-#define cpu_is_omap2430()	(0)
-#endif
+extern unsigned int __omap_cpu_type;
+
+#define OMAP_CPU_OMAP3		3
+#define OMAP_CPU_OMAP4		4
+#define OMAP_CPU_AM33XX		33
 
 #ifdef CONFIG_ARCH_OMAP3
-#define cpu_is_omap34xx()	(1)
+# ifdef omap_cpu_type
+#  undef omap_cpu_type
+#  define omap_cpu_type __omap_cpu_type
+# else
+#  define omap_cpu_type OMAP_CPU_OMAP3
+# endif
+# define cpu_is_omap3()		(omap_cpu_type == OMAP_CPU_OMAP3)
 #else
-#define cpu_is_omap34xx()	(0)
+# define cpu_is_omap3()		(0)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
-#define cpu_is_omap4xxx()	(1)
+# ifdef omap_cpu_type
+#  undef omap_cpu_type
+#  define omap_cpu_type __omap_cpu_type
+# else
+#  define omap_cpu_type OMAP_CPU_OMAP4
+# endif
+# define cpu_is_omap4()		(omap_cpu_type == OMAP_CPU_OMAP4)
 #else
-#define cpu_is_omap4xxx()	(0)
+# define cpu_is_omap4()		(0)
 #endif
 
 #ifdef CONFIG_ARCH_AM33XX
-#define cpu_is_am33xx()		(1)
+# ifdef omap_cpu_type
+#  undef omap_cpu_type
+#  define omap_cpu_type __omap_cpu_type
+# else
+#  define omap_cpu_type OMAP_CPU_AM33XX
+# endif
+# define cpu_is_am33xx()		(omap_cpu_type == OMAP_CPU_AM33XX)
 #else
-#define cpu_is_am33xx()		(0)
+# define cpu_is_am33xx()	(0)
 #endif
 
 struct omap_barebox_part {
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 2c12ad4..b999ea4 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -29,14 +29,17 @@
 #include <mach/omap3-generic.h>
 #include <mach/omap4-generic.h>
 
+unsigned int __omap_cpu_type;
+
 static void *omap_sram_start(void)
 {
 	if (cpu_is_am33xx())
 		return (void *)AM33XX_SRAM0_START;
-	if (cpu_is_omap34xx())
+	if (cpu_is_omap3())
 		return (void *)OMAP3_SRAM_BASE;
-	if (cpu_is_omap4xxx())
+	if (cpu_is_omap4())
 		return (void *)OMAP44XX_SRAM_BASE;
+	return NULL;
 }
 
 void __noreturn omap_start_barebox(void *barebox)
@@ -136,9 +139,9 @@ late_initcall(omap_env_init);
 
 void __noreturn reset_cpu(unsigned long addr)
 {
-	if (cpu_is_omap34xx())
+	if (cpu_is_omap3())
 		omap3_reset_cpu(addr);
-	if (cpu_is_omap4xxx())
+	if (cpu_is_omap4())
 		omap4_reset_cpu(addr);
 	if (cpu_is_am33xx())
 		am33xx_reset_cpu(addr);
-- 
1.8.4.2


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

  parent reply	other threads:[~2013-11-22 14:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 14:54 OMAP: devicetree preparation patches Sascha Hauer
2013-11-22 14:54 ` [PATCH 01/16] ARM: OMAP: select SoC variant from boards Sascha Hauer
2013-11-22 14:54 ` [PATCH 02/16] ARM: OMAP: Add SoC prefix to running_in_* functions Sascha Hauer
2013-11-22 14:54 ` [PATCH 03/16] ARM: OMAP: select correct reset_cpu function at runtime Sascha Hauer
2013-11-22 14:54 ` Sascha Hauer [this message]
2013-11-22 14:54 ` [PATCH 05/16] ARM: dtb: create dt-bindings link Sascha Hauer
2013-11-22 14:54 ` [PATCH 06/16] dt-bindings: Add gpio header file Sascha Hauer
2013-11-22 14:54 ` [PATCH 07/16] dt-bindings: Add omap/am33xx pinctrl " Sascha Hauer
2013-11-22 14:54 ` [PATCH 08/16] images: socfpga: Do not pollute Make variable namespace Sascha Hauer
2013-11-22 14:54 ` [PATCH 09/16] ARM: Add am33xx SoC dtsi file Sascha Hauer
2013-11-22 14:54 ` [PATCH 10/16] ARM: am335x: Add reg-shift property to uarts Sascha Hauer
2013-11-22 14:54 ` [PATCH 11/16] ARM: dts: AM33xx: Add gpio aliases Sascha Hauer
2013-11-22 14:54 ` [PATCH 12/16] ARM: am33xx: Add am33xx_ prefix to SoC specific functions Sascha Hauer
2013-11-22 14:54 ` [PATCH 13/16] ARM: OMAP: Make debug_ll UART Kconfig selectable Sascha Hauer
2013-11-22 14:54 ` [PATCH 14/16] ARM: OMAP: centralize omap startup Sascha Hauer
2013-11-22 14:54 ` [PATCH 15/16] ARM: am33xx: compile SoC files for pbl aswell Sascha Hauer
2013-11-22 18:23   ` [SPAM] " Jean-Christophe PLAGNIOL-VILLARD
2013-11-22 18:35     ` Sascha Hauer
2013-11-22 18:41       ` Alexander Aring
2013-11-22 20:30         ` Sascha Hauer
2013-11-23 14:54       ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-25  8:13         ` Sascha Hauer
2013-11-25 15:59           ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-22 14:54 ` [PATCH 16/16] ARM: OMAP: let UART selection depend on its only user Sascha Hauer

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=1385132083-7484-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@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