mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] ARM: i.MX: add barebox,bootsource-mmc aliases
@ 2024-02-20 10:44 Sascha Hauer
  2024-02-20 12:35 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2024-02-20 10:44 UTC (permalink / raw)
  To: Barebox List

Several boards overwrite the standard mmc aliases to give them a board
specific numbering. This breaks our assumption that the bootsource
instance number matches the mmc alias numbering. barebox supports
barebox,bootsource-mmc aliases to provide a mapping between the
bootsource and the device nodes that provides them. Add these aliases
for the newer i.MX SoCs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/dts/imx51.dtsi   | 4 ++++
 arch/arm/dts/imx53.dtsi   | 4 ++++
 arch/arm/dts/imx6qdl.dtsi | 4 ++++
 arch/arm/dts/imx8mm.dtsi  | 3 +++
 arch/arm/dts/imx8mn.dtsi  | 3 +++
 arch/arm/dts/imx8mp.dtsi  | 3 +++
 arch/arm/dts/imx8mq.dtsi  | 5 +++++
 arch/arm/dts/imx93.dtsi   | 6 ++++++
 arch/arm/mach-imx/boot.c  | 4 ++--
 9 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/imx51.dtsi b/arch/arm/dts/imx51.dtsi
index 828a6c2e1b..2be6b955e2 100644
--- a/arch/arm/dts/imx51.dtsi
+++ b/arch/arm/dts/imx51.dtsi
@@ -2,5 +2,9 @@ /{
 	aliases {
 		pwm0 = &pwm1;
 		pwm1 = &pwm2;
+		barebox,bootsource-mmc0 = &esdhc1;
+		barebox,bootsource-mmc1 = &esdhc2;
+		barebox,bootsource-mmc2 = &esdhc3;
+		barebox,bootsource-mmc3 = &esdhc4;
 	};
 };
diff --git a/arch/arm/dts/imx53.dtsi b/arch/arm/dts/imx53.dtsi
index 96fdd73ed0..5be1d7a53f 100644
--- a/arch/arm/dts/imx53.dtsi
+++ b/arch/arm/dts/imx53.dtsi
@@ -3,5 +3,9 @@ aliases {
 		pwm0 = &pwm1;
 		pwm1 = &pwm2;
 		ipu0 = &ipu;
+		barebox,bootsource-mmc0 = &esdhc1;
+		barebox,bootsource-mmc1 = &esdhc2;
+		barebox,bootsource-mmc2 = &esdhc3;
+		barebox,bootsource-mmc3 = &esdhc4;
 	};
 };
diff --git a/arch/arm/dts/imx6qdl.dtsi b/arch/arm/dts/imx6qdl.dtsi
index c3e02d2117..5afb772a84 100644
--- a/arch/arm/dts/imx6qdl.dtsi
+++ b/arch/arm/dts/imx6qdl.dtsi
@@ -7,6 +7,10 @@ aliases {
 		pwm3 = &pwm4;
 		ipu0 = &ipu1;
 		gpr.reboot_mode = &reboot_mode_gpr;
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+		barebox,bootsource-mmc2 = &usdhc3;
+		barebox,bootsource-mmc3 = &usdhc4;
 	};
 };
 
diff --git a/arch/arm/dts/imx8mm.dtsi b/arch/arm/dts/imx8mm.dtsi
index 982174375e..d3d0129421 100644
--- a/arch/arm/dts/imx8mm.dtsi
+++ b/arch/arm/dts/imx8mm.dtsi
@@ -9,6 +9,9 @@ aliases {
 		pwm1 = &pwm2;
 		pwm2 = &pwm3;
 		pwm3 = &pwm4;
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+		barebox,bootsource-mmc2 = &usdhc3;
 	};
 };
 
diff --git a/arch/arm/dts/imx8mn.dtsi b/arch/arm/dts/imx8mn.dtsi
index 098bf0a367..6f3f943548 100644
--- a/arch/arm/dts/imx8mn.dtsi
+++ b/arch/arm/dts/imx8mn.dtsi
@@ -8,6 +8,9 @@ aliases {
 		pwm1 = &pwm2;
 		pwm2 = &pwm3;
 		pwm3 = &pwm4;
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+		barebox,bootsource-mmc2 = &usdhc3;
 	};
 };
 
diff --git a/arch/arm/dts/imx8mp.dtsi b/arch/arm/dts/imx8mp.dtsi
index 3eb3c7a5df..9d87ddaea8 100644
--- a/arch/arm/dts/imx8mp.dtsi
+++ b/arch/arm/dts/imx8mp.dtsi
@@ -14,6 +14,9 @@ aliases {
 		pwm1 = &pwm2;
 		pwm2 = &pwm3;
 		pwm3 = &pwm4;
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+		barebox,bootsource-mmc2 = &usdhc3;
 	};
 };
 
diff --git a/arch/arm/dts/imx8mq.dtsi b/arch/arm/dts/imx8mq.dtsi
index e56cdfe130..d90afbe628 100644
--- a/arch/arm/dts/imx8mq.dtsi
+++ b/arch/arm/dts/imx8mq.dtsi
@@ -5,6 +5,11 @@
  */
 
 / {
+	aliases {
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+	};
+
 	remoteproc_cm4: remoteproc-cm4 {
 		compatible = "fsl,imx8mq-cm4";
 		clocks = <&clk IMX8MQ_CLK_M4_CORE>;
diff --git a/arch/arm/dts/imx93.dtsi b/arch/arm/dts/imx93.dtsi
index 7abaabcbd7..dd24c732d3 100644
--- a/arch/arm/dts/imx93.dtsi
+++ b/arch/arm/dts/imx93.dtsi
@@ -1,4 +1,10 @@
 /{
+	aliases {
+		barebox,bootsource-mmc0 = &usdhc1;
+		barebox,bootsource-mmc1 = &usdhc2;
+		barebox,bootsource-mmc2 = &usdhc3;
+	};
+
 	soc@0 {
 		usbphynop1: usbphynop1 {
 			compatible = "usb-nop-xceiv";
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 153da83560..3fea22d05f 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -34,7 +34,7 @@ imx_boot_save_loc(void (*get_boot_source)(enum bootsource *, int *))
 
 	get_boot_source(&src, &instance);
 
-	bootsource_set_raw(src, instance);
+	bootsource_set(src, instance);
 }
 
 
@@ -319,7 +319,7 @@ void imx53_boot_save_loc(void)
 
 	imx53_get_boot_source(&src, &instance);
 
-	bootsource_set_raw(src, instance);
+	bootsource_set(src, instance);
 }
 
 #define IMX6_SRC_SBMR1	0x04
-- 
2.39.2




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

* Re: [PATCH v2] ARM: i.MX: add barebox,bootsource-mmc aliases
  2024-02-20 10:44 [PATCH v2] ARM: i.MX: add barebox,bootsource-mmc aliases Sascha Hauer
@ 2024-02-20 12:35 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2024-02-20 12:35 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

On 20.02.24 11:44, Sascha Hauer wrote:
> Several boards overwrite the standard mmc aliases to give them a board
> specific numbering. This breaks our assumption that the bootsource
> instance number matches the mmc alias numbering. barebox supports
> barebox,bootsource-mmc aliases to provide a mapping between the
> bootsource and the device nodes that provides them. Add these aliases
> for the newer i.MX SoCs.

I just checked all instances of bootsource_get_instance() in arch/arm/boards
for i.MX boards and I think this should not break any boards in-tree.

Boards out-of-tree that reorder aliases and call bootsource_get_instance()
will break though. Can you think of a way to avoid that?

Thanks,
Ahmad

> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/dts/imx51.dtsi   | 4 ++++
>  arch/arm/dts/imx53.dtsi   | 4 ++++
>  arch/arm/dts/imx6qdl.dtsi | 4 ++++
>  arch/arm/dts/imx8mm.dtsi  | 3 +++
>  arch/arm/dts/imx8mn.dtsi  | 3 +++
>  arch/arm/dts/imx8mp.dtsi  | 3 +++
>  arch/arm/dts/imx8mq.dtsi  | 5 +++++
>  arch/arm/dts/imx93.dtsi   | 6 ++++++
>  arch/arm/mach-imx/boot.c  | 4 ++--
>  9 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/dts/imx51.dtsi b/arch/arm/dts/imx51.dtsi
> index 828a6c2e1b..2be6b955e2 100644
> --- a/arch/arm/dts/imx51.dtsi
> +++ b/arch/arm/dts/imx51.dtsi
> @@ -2,5 +2,9 @@ /{
>  	aliases {
>  		pwm0 = &pwm1;
>  		pwm1 = &pwm2;
> +		barebox,bootsource-mmc0 = &esdhc1;
> +		barebox,bootsource-mmc1 = &esdhc2;
> +		barebox,bootsource-mmc2 = &esdhc3;
> +		barebox,bootsource-mmc3 = &esdhc4;
>  	};
>  };
> diff --git a/arch/arm/dts/imx53.dtsi b/arch/arm/dts/imx53.dtsi
> index 96fdd73ed0..5be1d7a53f 100644
> --- a/arch/arm/dts/imx53.dtsi
> +++ b/arch/arm/dts/imx53.dtsi
> @@ -3,5 +3,9 @@ aliases {
>  		pwm0 = &pwm1;
>  		pwm1 = &pwm2;
>  		ipu0 = &ipu;
> +		barebox,bootsource-mmc0 = &esdhc1;
> +		barebox,bootsource-mmc1 = &esdhc2;
> +		barebox,bootsource-mmc2 = &esdhc3;
> +		barebox,bootsource-mmc3 = &esdhc4;
>  	};
>  };
> diff --git a/arch/arm/dts/imx6qdl.dtsi b/arch/arm/dts/imx6qdl.dtsi
> index c3e02d2117..5afb772a84 100644
> --- a/arch/arm/dts/imx6qdl.dtsi
> +++ b/arch/arm/dts/imx6qdl.dtsi
> @@ -7,6 +7,10 @@ aliases {
>  		pwm3 = &pwm4;
>  		ipu0 = &ipu1;
>  		gpr.reboot_mode = &reboot_mode_gpr;
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +		barebox,bootsource-mmc2 = &usdhc3;
> +		barebox,bootsource-mmc3 = &usdhc4;
>  	};
>  };
>  
> diff --git a/arch/arm/dts/imx8mm.dtsi b/arch/arm/dts/imx8mm.dtsi
> index 982174375e..d3d0129421 100644
> --- a/arch/arm/dts/imx8mm.dtsi
> +++ b/arch/arm/dts/imx8mm.dtsi
> @@ -9,6 +9,9 @@ aliases {
>  		pwm1 = &pwm2;
>  		pwm2 = &pwm3;
>  		pwm3 = &pwm4;
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +		barebox,bootsource-mmc2 = &usdhc3;
>  	};
>  };
>  
> diff --git a/arch/arm/dts/imx8mn.dtsi b/arch/arm/dts/imx8mn.dtsi
> index 098bf0a367..6f3f943548 100644
> --- a/arch/arm/dts/imx8mn.dtsi
> +++ b/arch/arm/dts/imx8mn.dtsi
> @@ -8,6 +8,9 @@ aliases {
>  		pwm1 = &pwm2;
>  		pwm2 = &pwm3;
>  		pwm3 = &pwm4;
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +		barebox,bootsource-mmc2 = &usdhc3;
>  	};
>  };
>  
> diff --git a/arch/arm/dts/imx8mp.dtsi b/arch/arm/dts/imx8mp.dtsi
> index 3eb3c7a5df..9d87ddaea8 100644
> --- a/arch/arm/dts/imx8mp.dtsi
> +++ b/arch/arm/dts/imx8mp.dtsi
> @@ -14,6 +14,9 @@ aliases {
>  		pwm1 = &pwm2;
>  		pwm2 = &pwm3;
>  		pwm3 = &pwm4;
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +		barebox,bootsource-mmc2 = &usdhc3;
>  	};
>  };
>  
> diff --git a/arch/arm/dts/imx8mq.dtsi b/arch/arm/dts/imx8mq.dtsi
> index e56cdfe130..d90afbe628 100644
> --- a/arch/arm/dts/imx8mq.dtsi
> +++ b/arch/arm/dts/imx8mq.dtsi
> @@ -5,6 +5,11 @@
>   */
>  
>  / {
> +	aliases {
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +	};
> +
>  	remoteproc_cm4: remoteproc-cm4 {
>  		compatible = "fsl,imx8mq-cm4";
>  		clocks = <&clk IMX8MQ_CLK_M4_CORE>;
> diff --git a/arch/arm/dts/imx93.dtsi b/arch/arm/dts/imx93.dtsi
> index 7abaabcbd7..dd24c732d3 100644
> --- a/arch/arm/dts/imx93.dtsi
> +++ b/arch/arm/dts/imx93.dtsi
> @@ -1,4 +1,10 @@
>  /{
> +	aliases {
> +		barebox,bootsource-mmc0 = &usdhc1;
> +		barebox,bootsource-mmc1 = &usdhc2;
> +		barebox,bootsource-mmc2 = &usdhc3;
> +	};
> +
>  	soc@0 {
>  		usbphynop1: usbphynop1 {
>  			compatible = "usb-nop-xceiv";
> diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> index 153da83560..3fea22d05f 100644
> --- a/arch/arm/mach-imx/boot.c
> +++ b/arch/arm/mach-imx/boot.c
> @@ -34,7 +34,7 @@ imx_boot_save_loc(void (*get_boot_source)(enum bootsource *, int *))
>  
>  	get_boot_source(&src, &instance);
>  
> -	bootsource_set_raw(src, instance);
> +	bootsource_set(src, instance);
>  }
>  
>  
> @@ -319,7 +319,7 @@ void imx53_boot_save_loc(void)
>  
>  	imx53_get_boot_source(&src, &instance);
>  
> -	bootsource_set_raw(src, instance);
> +	bootsource_set(src, instance);
>  }
>  
>  #define IMX6_SRC_SBMR1	0x04

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

end of thread, other threads:[~2024-02-20 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 10:44 [PATCH v2] ARM: i.MX: add barebox,bootsource-mmc aliases Sascha Hauer
2024-02-20 12:35 ` Ahmad Fatoum

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