* [PATCH 1/3] ARM: i.MX8M bootsource: alias i.MX8MN functions as i.MX8MP functions
@ 2022-10-20 7:58 Sascha Hauer
2022-10-20 7:58 ` [PATCH 2/3] ARM: i.MX8M bootsource: pull imx6_bootsource_serial() out of __imx7_get_boot_source() Sascha Hauer
2022-10-20 7:58 ` [PATCH 3/3] ARM: i.MX bootsource: adapt boot device detection for imx8mp Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-10-20 7:58 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Scholz
Until now imx8mp_get_boot_source() and imx8mm_get_boot_source() are
both the same. There are subtle differences between the SoCs though
implemented in subsequent patches. i.MX8MN will be the same as i.MX8MP
then, so alias imx8mn_get_boot_source() to imx8mp_get_boot_source()
instead of imx8mm_get_boot_source().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/boot.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 8c9febb50a..999bd3ab91 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -678,12 +678,6 @@ void imx8mm_boot_save_loc(void)
imx_boot_save_loc(imx8mm_get_boot_source);
}
-void imx8mn_get_boot_source(enum bootsource *src, int *instance)
- __alias(imx8mm_get_boot_source);
-
-void imx8mn_boot_save_loc(void)
- __alias(imx8mm_boot_save_loc);
-
void imx8mp_get_boot_source(enum bootsource *src, int *instance)
{
unsigned long addr;
@@ -699,3 +693,9 @@ void imx8mp_boot_save_loc(void)
{
imx_boot_save_loc(imx8mp_get_boot_source);
}
+
+void imx8mn_get_boot_source(enum bootsource *src, int *instance)
+ __alias(imx8mp_get_boot_source);
+
+void imx8mn_boot_save_loc(void)
+ __alias(imx8mp_boot_save_loc);
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] ARM: i.MX8M bootsource: pull imx6_bootsource_serial() out of __imx7_get_boot_source()
2022-10-20 7:58 [PATCH 1/3] ARM: i.MX8M bootsource: alias i.MX8MN functions as i.MX8MP functions Sascha Hauer
@ 2022-10-20 7:58 ` Sascha Hauer
2022-10-20 7:58 ` [PATCH 3/3] ARM: i.MX bootsource: adapt boot device detection for imx8mp Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-10-20 7:58 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Scholz
i.MX8MP and i.MX8MN will need a special variant of
imx6_bootsource_serial(), so pull the call to that function out of
__imx7_get_boot_source().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/boot.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 999bd3ab91..7b3334d5e2 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -497,11 +497,6 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
{
const struct imx_boot_sw_info *info;
- if (imx6_bootsource_serial(sbmr2)) {
- *src = BOOTSOURCE_SERIAL;
- return;
- }
-
info = (const void *)(unsigned long)
readl(boot_sw_info_pointer_addr);
@@ -539,6 +534,11 @@ void imx7_get_boot_source(enum bootsource *src, int *instance)
void __iomem *src_base = IOMEM(MX7_SRC_BASE_ADDR);
uint32_t sbmr2 = readl(src_base + 0x70);
+ if (imx6_bootsource_serial(sbmr2)) {
+ *src = BOOTSOURCE_SERIAL;
+ return;
+ }
+
__imx7_get_boot_source(src, instance, IMX7_BOOT_SW_INFO_POINTER_ADDR,
sbmr2);
}
@@ -654,6 +654,11 @@ void imx8mq_get_boot_source(enum bootsource *src, int *instance)
IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0 :
IMX8M_BOOT_SW_INFO_POINTER_ADDR_B0;
+ if (imx6_bootsource_serial(sbmr2)) {
+ *src = BOOTSOURCE_SERIAL;
+ return;
+ }
+
__imx7_get_boot_source(src, instance, addr, sbmr2);
}
@@ -668,6 +673,11 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance)
void __iomem *src_base = IOMEM(MX8MM_SRC_BASE_ADDR);
uint32_t sbmr2 = readl(src_base + 0x70);
+ if (imx6_bootsource_serial(sbmr2)) {
+ *src = BOOTSOURCE_SERIAL;
+ return;
+ }
+
addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
__imx7_get_boot_source(src, instance, addr, sbmr2);
@@ -684,6 +694,11 @@ void imx8mp_get_boot_source(enum bootsource *src, int *instance)
void __iomem *src_base = IOMEM(MX8MP_SRC_BASE_ADDR);
uint32_t sbmr2 = readl(src_base + 0x70);
+ if (imx6_bootsource_serial(sbmr2)) {
+ *src = BOOTSOURCE_SERIAL;
+ return;
+ }
+
addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
__imx7_get_boot_source(src, instance, addr, sbmr2);
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] ARM: i.MX bootsource: adapt boot device detection for imx8mp
2022-10-20 7:58 [PATCH 1/3] ARM: i.MX8M bootsource: alias i.MX8MN functions as i.MX8MP functions Sascha Hauer
2022-10-20 7:58 ` [PATCH 2/3] ARM: i.MX8M bootsource: pull imx6_bootsource_serial() out of __imx7_get_boot_source() Sascha Hauer
@ 2022-10-20 7:58 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-10-20 7:58 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Scholz
imx8mp uses sbmr2[27..24] for encoding the bootmode while existing
code reads only sbmr2[25..24].
This can detect BOOTSOURCE_SERIAL for the wrong mode.
Based on:
https://lore.barebox.org/barebox/20221014115354.4072202-1-enrico.scholz@sigma-chemnitz.de/T/#u
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/boot.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 7b3334d5e2..c0193cfa43 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -202,7 +202,8 @@ void imx51_boot_save_loc(void)
}
#define IMX53_SRC_SBMR 0x4
-#define SRC_SBMR_BMOD GENMASK(25, 24)
+#define IMX53_SRC_SBMR_BMOD GENMASK(25, 24)
+#define IMX8MP_SRC_SBMR_BMOD GENMASK(27, 24)
#define IMX53_BMOD_SERIAL 0b11
#define __BOOT_CFG(n, m, l) GENMASK((m) + ((n) - 1) * 8, \
@@ -234,7 +235,12 @@ __MAKE_BOOT_CFG_BITS(4)
static unsigned int imx53_get_bmod(uint32_t r)
{
- return FIELD_GET(SRC_SBMR_BMOD, r);
+ return FIELD_GET(IMX53_SRC_SBMR_BMOD, r);
+}
+
+static unsigned int imx8mp_get_bmod(uint32_t r)
+{
+ return FIELD_GET(IMX8MP_SRC_SBMR_BMOD, r);
}
static int imx53_bootsource_internal(uint32_t r)
@@ -317,6 +323,8 @@ void imx53_boot_save_loc(void)
#define IMX6_SRC_GPR10 0x44
#define IMX6_BMOD_SERIAL 0b01
#define IMX6_BMOD_RESERVED 0b11
+#define IMX8MP_BMOD_FUSES 0b0000
+#define IMX8MP_BMOD_SERIAL 0b0001
#define IMX6_BMOD_FUSES 0b00
#define BT_FUSE_SEL BIT(4)
#define GPR10_BOOT_FROM_GPR9 BIT(28)
@@ -338,6 +346,18 @@ static bool imx6_bootsource_serial(uint32_t sbmr2)
!(sbmr2 & BT_FUSE_SEL));
}
+static bool imx8mp_bootsource_serial(uint32_t sbmr2)
+{
+ return imx8mp_get_bmod(sbmr2) == IMX8MP_BMOD_SERIAL ||
+ /*
+ * If boot from fuses is selected and fuses are not
+ * programmed by setting BT_FUSE_SEL, ROM code will
+ * fallback to serial mode
+ */
+ (imx8mp_get_bmod(sbmr2) == IMX8MP_BMOD_FUSES &&
+ !(sbmr2 & BT_FUSE_SEL));
+}
+
static bool imx6_bootsource_serial_forced(uint32_t bootmode)
{
if (cpu_mx6_is_mx6ul() || cpu_mx6_is_mx6ull())
@@ -694,7 +714,7 @@ void imx8mp_get_boot_source(enum bootsource *src, int *instance)
void __iomem *src_base = IOMEM(MX8MP_SRC_BASE_ADDR);
uint32_t sbmr2 = readl(src_base + 0x70);
- if (imx6_bootsource_serial(sbmr2)) {
+ if (imx8mp_bootsource_serial(sbmr2)) {
*src = BOOTSOURCE_SERIAL;
return;
}
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-20 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 7:58 [PATCH 1/3] ARM: i.MX8M bootsource: alias i.MX8MN functions as i.MX8MP functions Sascha Hauer
2022-10-20 7:58 ` [PATCH 2/3] ARM: i.MX8M bootsource: pull imx6_bootsource_serial() out of __imx7_get_boot_source() Sascha Hauer
2022-10-20 7:58 ` [PATCH 3/3] ARM: i.MX bootsource: adapt boot device detection for imx8mp Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox