mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFT][PATCH 0/3] TQMa6x cleanup
@ 2023-05-11  8:58 Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK Roland Hieber
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Roland Hieber @ 2023-05-11  8:58 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

Hi,

I came across this when working on a similar board, but I don't have a TQ MBa6x
to test these changes, so if someone has one and could try these patches, that
would be great!

 - Roland

Roland Hieber (3):
  ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK
  ARM: i.MX: TQMa6x: migrate flash partitions to device tree
  ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable

 arch/arm/boards/tqma6x/board.c    | 25 +++++++++++++++----------
 arch/arm/boards/tqma6x/lowlevel.c |  8 ++------
 arch/arm/dts/imx6dl-mba6x.dts     | 13 +++++++++++++
 arch/arm/dts/imx6q-mba6x.dts      | 13 +++++++++++++
 4 files changed, 43 insertions(+), 16 deletions(-)

-- 
2.39.2




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

* [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK
  2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
@ 2023-05-11  8:58 ` Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 2/3] ARM: i.MX: TQMa6x: migrate flash partitions to device tree Roland Hieber
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Roland Hieber @ 2023-05-11  8:58 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 arch/arm/boards/tqma6x/lowlevel.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/tqma6x/lowlevel.c b/arch/arm/boards/tqma6x/lowlevel.c
index 9283e3f009f8..6e9c9bed0bf8 100644
--- a/arch/arm/boards/tqma6x/lowlevel.c
+++ b/arch/arm/boards/tqma6x/lowlevel.c
@@ -16,14 +16,12 @@
 extern char __dtb_imx6q_mba6x_start[];
 extern char __dtb_imx6dl_mba6x_start[];
 
-ENTRY_FUNCTION(start_imx6q_mba6x, r0, r1, r2)
+ENTRY_FUNCTION_WITHSTACK(start_imx6q_mba6x, 0x00920000, r0, r1, r2)
 {
 	void *fdt;
 
 	imx6_cpu_lowlevel_init();
 
-	arm_setup_stack(0x00920000);
-
 	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
 		writel(0x2, 0x020e0338);
 		imx6_uart_setup_ll();
@@ -37,14 +35,12 @@ ENTRY_FUNCTION(start_imx6q_mba6x, r0, r1, r2)
 	barebox_arm_entry(0x10000000, SZ_1G, fdt);
 }
 
-ENTRY_FUNCTION(start_imx6dl_mba6x, r0, r1, r2)
+ENTRY_FUNCTION_WITHSTACK(start_imx6dl_mba6x, 0x00920000, r0, r1, r2)
 {
 	void *fdt;
 
 	imx6_cpu_lowlevel_init();
 
-	arm_setup_stack(0x00920000);
-
 	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
 		writel(0x2, 0x020e035c);
 		imx6_uart_setup_ll();
-- 
2.39.2




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

* [RFT][PATCH 2/3] ARM: i.MX: TQMa6x: migrate flash partitions to device tree
  2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK Roland Hieber
@ 2023-05-11  8:58 ` Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable Roland Hieber
  2023-05-12 11:27 ` [RFT][PATCH 0/3] TQMa6x cleanup Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Roland Hieber @ 2023-05-11  8:58 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

This way the partitions are easier to adapt, and the board code becomes
more generic.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 arch/arm/boards/tqma6x/board.c |  2 --
 arch/arm/dts/imx6dl-mba6x.dts  | 13 +++++++++++++
 arch/arm/dts/imx6q-mba6x.dts   | 13 +++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c
index 5f59a259e620..ae339887568a 100644
--- a/arch/arm/boards/tqma6x/board.c
+++ b/arch/arm/boards/tqma6x/board.c
@@ -84,8 +84,6 @@ static int tqma6x_env_init(void)
 	if (!of_machine_is_compatible("tq,mba6x"))
 		return 0;
 
-	devfs_add_partition("m25p0", 0, SZ_512K, DEVFS_PARTITION_FIXED, "m25p0.barebox");
-
 	imx6_bbu_internal_spi_i2c_register_handler("spiflash", "/dev/m25p0.barebox",
 		BBU_HANDLER_FLAG_DEFAULT);
 	imx6_bbu_internal_mmcboot_register_handler("emmc", "mmc2", 0);
diff --git a/arch/arm/dts/imx6dl-mba6x.dts b/arch/arm/dts/imx6dl-mba6x.dts
index dddc3d384ccc..612acba3239b 100644
--- a/arch/arm/dts/imx6dl-mba6x.dts
+++ b/arch/arm/dts/imx6dl-mba6x.dts
@@ -27,6 +27,19 @@
 	};
 };
 
+&flash {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0x0 0x80000>;
+		};
+	};
+};
+
 &iomuxc {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_hog>;
diff --git a/arch/arm/dts/imx6q-mba6x.dts b/arch/arm/dts/imx6q-mba6x.dts
index 64635b958213..5154580fae73 100644
--- a/arch/arm/dts/imx6q-mba6x.dts
+++ b/arch/arm/dts/imx6q-mba6x.dts
@@ -27,6 +27,19 @@
 	};
 };
 
+&flash {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0x0 0x80000>;
+		};
+	};
+};
+
 &iomuxc {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_hog>;
-- 
2.39.2




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

* [RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable
  2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK Roland Hieber
  2023-05-11  8:58 ` [RFT][PATCH 2/3] ARM: i.MX: TQMa6x: migrate flash partitions to device tree Roland Hieber
@ 2023-05-11  8:58 ` Roland Hieber
  2023-05-12 11:27 ` [RFT][PATCH 0/3] TQMa6x cleanup Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Roland Hieber @ 2023-05-11  8:58 UTC (permalink / raw)
  To: barebox; +Cc: Roland Hieber

The SPI flash and eMMC are hard-wired on the TQMa6x SoM, so this
function is not specific for the mba6x baseboard but can be used on
other boards with a TQMa6x SoM too.

tqma6x_enet_init is specific to the mba6x board, so rename it to reflect
that fact.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 arch/arm/boards/tqma6x/board.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c
index ae339887568a..4bb7223a6e7a 100644
--- a/arch/arm/boards/tqma6x/board.c
+++ b/arch/arm/boards/tqma6x/board.c
@@ -53,7 +53,7 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
 	return 0;
 }
 
-static int tqma6x_enet_init(void)
+static int tq_mba6x_enet_init(void)
 {
 	if (!of_machine_is_compatible("tq,mba6x"))
 		return 0;
@@ -77,18 +77,25 @@ static int tqma6x_enet_init(void)
 
 	return 0;
 }
-fs_initcall(tqma6x_enet_init);
+fs_initcall(tq_mba6x_enet_init);
 
-static int tqma6x_env_init(void)
+static int tqma6x_init(void)
 {
-	if (!of_machine_is_compatible("tq,mba6x"))
-		return 0;
-
 	imx6_bbu_internal_spi_i2c_register_handler("spiflash", "/dev/m25p0.barebox",
 		BBU_HANDLER_FLAG_DEFAULT);
 	imx6_bbu_internal_mmcboot_register_handler("emmc", "mmc2", 0);
 
-	device_detect_by_name("mmc2");
+	device_detect_by_name("mmc2"); // eMMC
+
+	return 0;
+}
+
+static int tq_mba6x_env_init(void)
+{
+	if (!of_machine_is_compatible("tq,mba6x"))
+		return 0;
+
+	tqma6x_init();
 
 	default_environment_path_set("/dev/mmc2.boot1");
 
@@ -96,4 +103,4 @@ static int tqma6x_env_init(void)
 
 	return 0;
 }
-late_initcall(tqma6x_env_init);
+late_initcall(tq_mba6x_env_init);
-- 
2.39.2




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

* Re: [RFT][PATCH 0/3] TQMa6x cleanup
  2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
                   ` (2 preceding siblings ...)
  2023-05-11  8:58 ` [RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable Roland Hieber
@ 2023-05-12 11:27 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2023-05-12 11:27 UTC (permalink / raw)
  To: Roland Hieber; +Cc: barebox

On Thu, May 11, 2023 at 10:58:00AM +0200, Roland Hieber wrote:
> Hi,
> 
> I came across this when working on a similar board, but I don't have a TQ MBa6x
> to test these changes, so if someone has one and could try these patches, that
> would be great!
> 
>  - Roland
> 
> Roland Hieber (3):
>   ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK
>   ARM: i.MX: TQMa6x: migrate flash partitions to device tree
>   ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable

Applied, thanks

Sascha

-- 
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] 5+ messages in thread

end of thread, other threads:[~2023-05-12 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11  8:58 [RFT][PATCH 0/3] TQMa6x cleanup Roland Hieber
2023-05-11  8:58 ` [RFT][PATCH 1/3] ARM: i.MX6: tqma6x: make use of ENTRY_FUNCTION_WITHSTACK Roland Hieber
2023-05-11  8:58 ` [RFT][PATCH 2/3] ARM: i.MX: TQMa6x: migrate flash partitions to device tree Roland Hieber
2023-05-11  8:58 ` [RFT][PATCH 3/3] ARM: i.MX6: TQMa6x: make tqma6x_env_init reusable Roland Hieber
2023-05-12 11:27 ` [RFT][PATCH 0/3] TQMa6x cleanup Sascha Hauer

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