mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: i.MX50: Amazon Kindle: Add missing compatibility checks
Date: Thu, 11 May 2017 08:02:07 +0200	[thread overview]
Message-ID: <20170511060207.11121-1-s.hauer@pengutronix.de> (raw)

Add the checks to prevent Kindle specific code on other machines.
This also adds compatible strings for the Kindle machines as they
currently lack them.

Reported-by: Stefan Riedmüller <S.Riedmueller@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/kindle-mx50/board.c  | 19 +++++++++++++++++++
 arch/arm/dts/imx50-kindle-d01100.dts |  2 +-
 arch/arm/dts/imx50-kindle-d01200.dts |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/kindle-mx50/board.c b/arch/arm/boards/kindle-mx50/board.c
index fa4beb7f3c..7bd4f91e0b 100644
--- a/arch/arm/boards/kindle-mx50/board.c
+++ b/arch/arm/boards/kindle-mx50/board.c
@@ -120,8 +120,17 @@ static void kindle_rev_init(void)
 	free(buf);
 }
 
+static int is_mx50_kindle(void)
+{
+	return of_machine_is_compatible("amazon,kindle-d01100") ||
+		of_machine_is_compatible("amazon,kindle-d01200");
+}
+
 static int kindle_mx50_late_init(void)
 {
+	if (!is_mx50_kindle())
+		return 0;
+
 	armlinux_set_revision(0x50000 | imx_silicon_revision());
 	/* Compatibility ATAGs for original kernel */
 	armlinux_set_atag_appender(kindle_mx50_append_atags);
@@ -134,6 +143,9 @@ late_initcall(kindle_mx50_late_init);
 
 static int kindle_mx50_mem_init(void)
 {
+	if (!is_mx50_kindle())
+		return 0;
+
 	arm_add_mem_device("ram0", MX50_CSD0_BASE_ADDR, SZ_256M);
 	return 0;
 }
@@ -142,6 +154,10 @@ mem_initcall(kindle_mx50_mem_init);
 static int kindle_mx50_devices_init(void)
 {
 	struct device_d *dev;
+
+	if (!is_mx50_kindle())
+		return 0;
+
 	/* Probe the eMMC to allow reading the board serial and revision */
 	dev = get_device_by_name("mci0");
 	if (dev)
@@ -155,6 +171,9 @@ device_initcall(kindle_mx50_devices_init);
 
 static int kindle_mx50_postcore_init(void)
 {
+	if (!is_mx50_kindle())
+		return 0;
+
 	imx50_init_lowlevel(800);
 
 	return 0;
diff --git a/arch/arm/dts/imx50-kindle-d01100.dts b/arch/arm/dts/imx50-kindle-d01100.dts
index edbc929120..23bfbb5d24 100644
--- a/arch/arm/dts/imx50-kindle-d01100.dts
+++ b/arch/arm/dts/imx50-kindle-d01100.dts
@@ -17,7 +17,7 @@
 
 / {
 	model = "Amazon Kindle D01100";
-	compatible = "fsl,imx50";
+	compatible = "amazon,kindle-d01100", "fsl,imx50";
 
 	chosen {
 		linux,stdout-path = &uart1;
diff --git a/arch/arm/dts/imx50-kindle-d01200.dts b/arch/arm/dts/imx50-kindle-d01200.dts
index 8f93c1b520..d8e5ed3283 100644
--- a/arch/arm/dts/imx50-kindle-d01200.dts
+++ b/arch/arm/dts/imx50-kindle-d01200.dts
@@ -17,7 +17,7 @@
 
 / {
 	model = "Amazon Kindle D01200";
-	compatible = "fsl,imx50";
+	compatible = "amazon,kindle-d01200", "fsl,imx50";
 
 	chosen {
 		linux,stdout-path = &uart1;
-- 
2.11.0


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

                 reply	other threads:[~2017-05-11  6:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170511060207.11121-1-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