public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sunxi: Machine id hack to prevent loading buggy sunxi-3.4 kernels
@ 2015-02-20  8:08 Siarhei Siamashka
  2015-02-20  9:19 ` Hans de Goede
  0 siblings, 1 reply; 17+ messages in thread
From: Siarhei Siamashka @ 2015-02-20  8:08 UTC (permalink / raw)
  To: u-boot

Store the 'compatibility revision' number in the top 4 bits of the
machine id and pass it to the kernel. The old buggy kernels will
fail to load with a very much googlable error message on the serial
console:

  "Error: unrecognized/unsupported machine ID (r1 = 0x100010bb)"

This error message can be documented in the linux-sunxi wiki with
proper explanations about how to resolve this situation and where
to get the necessary bugfixes for the sunxi-3.4 kernel.

The fixed sunxi-3.4 kernels can implement a revision compatibility
check and clear the top 4 bits of the machine id if everything is
alright.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
---

To be used together with:
    https://groups.google.com/forum/#!topic/linux-sunxi/LOAxP3kAYs8

 include/configs/sun4i.h        | 4 ++--
 include/configs/sun5i.h        | 4 ++--
 include/configs/sun7i.h        | 4 ++--
 include/configs/sunxi-common.h | 7 +++++++
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h
index 87d269b..1537e53 100644
--- a/include/configs/sun4i.h
+++ b/include/configs/sun4i.h
@@ -13,8 +13,6 @@
  */
 #define CONFIG_CLK_FULL_SPEED		1008000000
 
-#define CONFIG_MACH_TYPE		4104
-
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
@@ -25,4 +23,6 @@
  */
 #include <configs/sunxi-common.h>
 
+#define CONFIG_MACH_TYPE	(4104 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28))
+
 #endif /* __CONFIG_H */
diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h
index 52e3a6f..e755531 100644
--- a/include/configs/sun5i.h
+++ b/include/configs/sun5i.h
@@ -13,8 +13,6 @@
  */
 #define CONFIG_CLK_FULL_SPEED		1008000000
 
-#define CONFIG_MACH_TYPE		4138
-
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	1
@@ -25,4 +23,6 @@
  */
 #include <configs/sunxi-common.h>
 
+#define CONFIG_MACH_TYPE	(4138 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28))
+
 #endif /* __CONFIG_H */
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 7cd7890..f817f73 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -14,8 +14,6 @@
  */
 #define CONFIG_CLK_FULL_SPEED		912000000
 
-#define CONFIG_MACH_TYPE		4283
-
 #ifdef CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_SUNXI
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
@@ -31,4 +29,6 @@
  */
 #include <configs/sunxi-common.h>
 
+#define CONFIG_MACH_TYPE	(4283 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28))
+
 #endif /* __CONFIG_H */
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5ece020..f3e764a 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -14,6 +14,13 @@
 #define _SUNXI_COMMON_CONFIG_H
 
 /*
+ * Compatibility guard to prevent loading old buggy sunxi-3.4 kernels.
+ * Only sunxi-3.4 kernels with appropriate fixes applied are able to
+ * pass beyond the machine id check.
+ */
+#define CONFIG_MACH_TYPE_COMPAT_REV	1
+
+/*
  * High Level Configuration Options
  */
 #define CONFIG_SUNXI		/* sunxi family */
-- 
2.0.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-09-25 18:33 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20  8:08 [U-Boot] [PATCH] sunxi: Machine id hack to prevent loading buggy sunxi-3.4 kernels Siarhei Siamashka
2015-02-20  9:19 ` Hans de Goede
2015-02-20 10:36   ` Siarhei Siamashka
2015-02-20 14:11     ` Hans de Goede
2015-02-20 18:33       ` Siarhei Siamashka
2015-02-21  9:41         ` Hans de Goede
2015-02-21 10:26           ` Ian Campbell
2015-02-21 10:49             ` Hans de Goede
2015-02-21 13:11               ` Siarhei Siamashka
2015-02-21 14:34                 ` Hans de Goede
2015-02-28 16:18               ` Ian Campbell
2015-03-01 22:07                 ` Siarhei Siamashka
2015-03-03  8:17                   ` Ian Campbell
2015-03-04 15:17                     ` Siarhei Siamashka
2015-03-04 21:37                       ` [U-Boot] [linux-sunxi] " Michal Suchanek
2015-03-02  8:40                 ` [U-Boot] " Hans de Goede
2015-09-25 18:33           ` [U-Boot] Improving DRAM settings for Allwinner A10/A13/A20 devices Siarhei Siamashka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox