mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] ARM: boards: kontron-samx6i: fix memory detection helper
@ 2021-01-18 20:29 Marco Felsch
  2021-01-18 20:29 ` [PATCH 2/6] ARM: boards: kontron-samx6i: simplify memory detection function Marco Felsch
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marco Felsch @ 2021-01-18 20:29 UTC (permalink / raw)
  To: barebox

According the vendor u-boot version [1] the version pin is not involved
in the memory size detection algorithm. So drop the usage here.

Also fix the id0 gpio request. Instead of requesting GPIO6_6 we need to
request GPIO6_7.

Last we need to fix the size for the solo/duallite modules. Those
modules are populated with at least 256M of RAM according [1].

I fixed also the alignment while on it.

[1] https://github.com/kontron/u-boot-smarc-samx7/blob/master/board/kontron/amx6/amx6.c

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/boards/kontron-samx6i/mem.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boards/kontron-samx6i/mem.c b/arch/arm/boards/kontron-samx6i/mem.c
index 3b9fbd464a..8132624e3b 100644
--- a/arch/arm/boards/kontron-samx6i/mem.c
+++ b/arch/arm/boards/kontron-samx6i/mem.c
@@ -17,7 +17,6 @@
 
 #include "mem.h"
 
-#define PCBVERSION_PIN IMX_GPIO_NR(2, 2)
 #define PCBID0_PIN IMX_GPIO_NR(6, 7)
 #define PCBID1_PIN IMX_GPIO_NR(6, 9)
 
@@ -25,43 +24,34 @@
 	IOMUX_PAD(0x0658, 0x0270, 5, 0x0000, 0, 0)
 #define MX6S_PAD_NANDF_WP_B__GPIO_6_9 \
 	IOMUX_PAD(0x0690, 0x02A8, 5, 0x0000, 0, 0)
-#define MX6S_PAD_NANDF_D2__GPIO_2_2 \
-	IOMUX_PAD(0x028c, 0x0674, 5, 0x0000, 0, 0)
 
 resource_size_t samx6i_get_size(void)
 {
 	resource_size_t size = 0;
-	int ver, id0, id1;
+	int id0, id1;
 	int cpu_type = __imx6_cpu_type();
 	void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR);
 	void __iomem *gpio6 = IOMEM(MX6_GPIO6_BASE_ADDR);
-	void __iomem *gpio2 = IOMEM(MX6_GPIO2_BASE_ADDR);
 
 	if (cpu_type == IMX6_CPUTYPE_IMX6D ||
-			cpu_type == IMX6_CPUTYPE_IMX6Q) {
+	    cpu_type == IMX6_CPUTYPE_IMX6Q) {
 		imx_setup_pad(iomuxbase, MX6Q_PAD_NANDF_CLE__GPIO_6_7);
 		imx_setup_pad(iomuxbase, MX6Q_PAD_NANDF_WP_B__GPIO_6_9);
-		imx_setup_pad(iomuxbase, MX6Q_PAD_NANDF_D2__GPIO_2_2);
 	} else if (cpu_type == IMX6_CPUTYPE_IMX6S ||
-			cpu_type == IMX6_CPUTYPE_IMX6DL) {
+		   cpu_type == IMX6_CPUTYPE_IMX6DL) {
 		imx_setup_pad(iomuxbase, MX6S_PAD_NANDF_CLE__GPIO_6_7);
 		imx_setup_pad(iomuxbase, MX6S_PAD_NANDF_WP_B__GPIO_6_9);
-		imx_setup_pad(iomuxbase, MX6S_PAD_NANDF_D2__GPIO_2_2);
 	};
 
-	imx6_gpio_direction_input(gpio6, 6);
+	imx6_gpio_direction_input(gpio6, 7);
 	imx6_gpio_direction_input(gpio6, 9);
-	imx6_gpio_direction_input(gpio2, 2);
 
-	ver = imx6_gpio_val(gpio2, 2);
 	id0 = imx6_gpio_val(gpio6, 7);
 	id1 = imx6_gpio_val(gpio6, 9);
 
 	if (cpu_type == IMX6_CPUTYPE_IMX6D ||
 			cpu_type == IMX6_CPUTYPE_IMX6Q) {
-		if (ver)
-			size = SZ_1G;
-		else if (id0 && id1)
+		if (id0 && id1)
 			size = SZ_2G;
 		else if (id0)
 			size = SZ_2G;
@@ -71,8 +61,6 @@ resource_size_t samx6i_get_size(void)
 			size = SZ_512M;
 	} else if (cpu_type == IMX6_CPUTYPE_IMX6S ||
 			cpu_type == IMX6_CPUTYPE_IMX6DL) {
-		if (ver)
-			size = SZ_512M;
 		if (id0 && id1)
 			size = SZ_2G;
 		else if (id0)
@@ -80,7 +68,7 @@ resource_size_t samx6i_get_size(void)
 		else if (id1)
 			size = SZ_512M;
 		else
-			size = SZ_128M;
+			size = SZ_256M;
 	}
 
 	return size;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2021-01-19 10:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 20:29 [PATCH 1/6] ARM: boards: kontron-samx6i: fix memory detection helper Marco Felsch
2021-01-18 20:29 ` [PATCH 2/6] ARM: boards: kontron-samx6i: simplify memory detection function Marco Felsch
2021-01-18 20:29 ` [PATCH 3/6] ARM: dts: imx6qdl-smarc-samx6i: remove iomuxc hog Marco Felsch
2021-01-18 20:29 ` [PATCH 4/6] ARM: dts: imx6qdl-samx6i: switch to SPDX license identifier Marco Felsch
2021-01-18 20:29 ` [PATCH 5/6] ARM: dts: imx6qdl-samx6i: use upstream device tree files Marco Felsch
2021-01-18 20:29 ` [PATCH 6/6] ARM: dts: imx6qdl-samx6i: cosmetic partition cleanup Marco Felsch
2021-01-19 10:01 ` [PATCH 1/6] ARM: boards: kontron-samx6i: fix memory detection helper Sascha Hauer

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