summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/crystalfontz-cfa10036
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-11 13:49:26 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-12 14:17:52 +0200
commita471c714fa64241c30cc7db3bee50a104643514c (patch)
treefd742b58774fd9a83ff88556c1cd4b7c7befbf7c /arch/arm/boards/crystalfontz-cfa10036
parent0a21d8bbc3cd129d8f0ad2455417d4ce3f875a5d (diff)
downloadbarebox-a471c714fa64241c30cc7db3bee50a104643514c.tar.gz
barebox-a471c714fa64241c30cc7db3bee50a104643514c.tar.xz
ARM: MXS: fix breakage for non-DT boards
boarddata, the third argument passed from barebox PBL to barebox proper, is usually either a pointer to an optionally compressed flattened device tree or a machien type integer casted to a pointer. In order to support device trees located in the first 8192 bytes of address space, barebox has been trying to dereference boarddata, before falling back to treating it as integer. This resulted in breakage as boarddata may be an integer not divisible by 4 and thus an unaligned exception would occur. The already existing barebox_arm_boarddata mechanism sidesteps this issue: With it, the machine type integer is not passed as is, but the address of a suitably aligned structure that contains it is passed instead. Searching for MACH_TYPE in arch/arm/boards shows 5 boards to be affected in-tree, which are all fixed with this commit. Fixes: 390bc7834ffc ("ARM: start: check for machine type last") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Bastian Krause <bst@pengutronix.de> Link: https://lore.barebox.org/20221011114927.546670-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/crystalfontz-cfa10036')
-rw-r--r--arch/arm/boards/crystalfontz-cfa10036/lowlevel.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c b/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
index 92b42aa893..8ebea0fedc 100644
--- a/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
+++ b/arch/arm/boards/crystalfontz-cfa10036/lowlevel.c
@@ -7,8 +7,22 @@
#include <mach/imx28-regs.h>
#include <generated/mach-types.h>
+static noinline void continue_imx_entry(size_t size)
+{
+ static struct barebox_arm_boarddata boarddata = {
+ .magic = BAREBOX_ARM_BOARDDATA_MAGIC,
+ .machine = MACH_TYPE_CFA10036,
+ };
+
+ barebox_arm_entry(IMX_MEMORY_BASE, size, &boarddata);
+}
+
ENTRY_FUNCTION(start_cfa10036, r0, r1, r2)
{
arm_cpu_lowlevel_init();
- barebox_arm_entry(IMX_MEMORY_BASE, SZ_128M, (void *)MACH_TYPE_CFA10036);
+
+ relocate_to_current_adr();
+ setup_c();
+
+ continue_imx_entry(SZ_128M);
}