mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M
@ 2020-12-04 17:40 Ahmad Fatoum
  2020-12-04 17:40 ` [PATCH 2/2] ARM: i.MX8M: bbu: rename imx8mq_bbu_* functions to imx8m_bbu_* Ahmad Fatoum
  2020-12-07  9:42 ` [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2020-12-04 17:40 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Like many GPIO controllers of times past, the i.MX8M is also compatible
with the i.MX31 GPIO controller. Add GPIO helpers for low-level code to
use.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-imx/include/mach/imx-gpio.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-imx/include/mach/imx-gpio.h b/arch/arm/mach-imx/include/mach/imx-gpio.h
index 891c33a3f411..0cfd16f4fa43 100644
--- a/arch/arm/mach-imx/include/mach/imx-gpio.h
+++ b/arch/arm/mach-imx/include/mach/imx-gpio.h
@@ -50,6 +50,7 @@ static inline void imx31_gpio_direction_output(void *base, int gpio, int value)
 #define imx51_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
 #define imx53_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
 #define imx6_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
+#define imx8m_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
 
 static inline void imx1_gpio_direction_input(void *base, int gpio, int value)
 {
@@ -69,6 +70,7 @@ static inline void imx31_gpio_direction_input(void *base, int gpio)
 #define imx51_gpio_direction_input(base, gpio, value) imx31_gpio_direction_input(base, gpio)
 #define imx53_gpio_direction_input(base, gpio, value) imx31_gpio_direction_input(base, gpio)
 #define imx6_gpio_direction_input(base, gpio) imx31_gpio_direction_input(base, gpio)
+#define imx8m_gpio_direction_input(base, gpio) imx31_gpio_direction_input(base, gpio)
 
 #define imx1_gpio_val(base, gpio) readl(base + 0x1c) & (1 << gpio) ? 1 : 0
 #define imx21_gpio_val(base, gpio) imx1_gpio_val(base, gpio)
@@ -80,5 +82,6 @@ static inline void imx31_gpio_direction_input(void *base, int gpio)
 #define imx51_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
 #define imx53_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
 #define imx6_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
+#define imx8m_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
 
 #endif /* __MACH_IMX_GPIO_H */
-- 
2.29.2


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

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

* [PATCH 2/2] ARM: i.MX8M: bbu: rename imx8mq_bbu_* functions to imx8m_bbu_*
  2020-12-04 17:40 [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Ahmad Fatoum
@ 2020-12-04 17:40 ` Ahmad Fatoum
  2020-12-07  9:42 ` [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2020-12-04 17:40 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

imx_bbu_internal_mmcboot_register_handler already supports the i.MX8MQ,
i.MX8MP and i.MX8MM, but the latter two do not have helpers with their
SoC as prefix. As it seems like that it will be possible to extend
imx_bbu_internal_mmcboot_register_handler for upcoming SoCs in the
i.MX8M family as well, rename the function to start with imx8m_.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mm-evk/board.c    |  6 ++----
 arch/arm/boards/nxp-imx8mp-evk/board.c    |  6 ++----
 arch/arm/boards/nxp-imx8mq-evk/board.c    |  6 ++----
 arch/arm/boards/phytec-som-imx8mq/board.c |  6 ++----
 arch/arm/boards/zii-imx8mq-dev/board.c    |  6 +++---
 arch/arm/mach-imx/imx-bbu-internal.c      |  6 +++---
 arch/arm/mach-imx/include/mach/bbu.h      | 18 +++++++++---------
 7 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mm-evk/board.c b/arch/arm/boards/nxp-imx8mm-evk/board.c
index 4350abd15793..2603a2ab0730 100644
--- a/arch/arm/boards/nxp-imx8mm-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mm-evk/board.c
@@ -53,10 +53,8 @@ static int nxp_imx8mm_evk_init(void)
 		emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
 	}
 
-	imx8mq_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox",
-						 emmc_sd_flag);
-	imx8mq_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2",
-						     emmc_bbu_flag);
+	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", emmc_sd_flag);
+	imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
 
 	phy_register_fixup_for_uid(PHY_ID_AR8031, AR_PHY_ID_MASK,
 				   ar8031_phy_fixup);
diff --git a/arch/arm/boards/nxp-imx8mp-evk/board.c b/arch/arm/boards/nxp-imx8mp-evk/board.c
index d75eb1c6971e..f64f466810c8 100644
--- a/arch/arm/boards/nxp-imx8mp-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mp-evk/board.c
@@ -36,10 +36,8 @@ static int nxp_imx8mp_evk_init(void)
 		emmc_bbu_flag = BBU_HANDLER_FLAG_DEFAULT;
 	}
 
-	imx8mq_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox",
-						 emmc_sd_flag);
-	imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc2",
-						     emmc_bbu_flag);
+	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", emmc_sd_flag);
+	imx8m_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
 
 	val = readl(MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
 	val |= MX8MP_IOMUXC_GPR1_ENET1_RGMII_EN;
diff --git a/arch/arm/boards/nxp-imx8mq-evk/board.c b/arch/arm/boards/nxp-imx8mq-evk/board.c
index 19e640397cc0..c28107cb1751 100644
--- a/arch/arm/boards/nxp-imx8mq-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mq-evk/board.c
@@ -40,12 +40,10 @@ static int nxp_imx8mq_evk_init(void)
 	barebox_set_hostname("imx8mq-evk");
 
 	flags = bootsource_get_instance() == 0 ? BBU_HANDLER_FLAG_DEFAULT : 0;
-	imx8mq_bbu_internal_mmc_register_handler("eMMC",
-						 "/dev/mmc0.barebox", flags);
+	imx8m_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0.barebox", flags);
 
 	flags = bootsource_get_instance() == 1 ? BBU_HANDLER_FLAG_DEFAULT : 0;
-	imx8mq_bbu_internal_mmc_register_handler("SD",
-						 "/dev/mmc1.barebox", flags);
+	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", flags);
 
 	if (bootsource_get_instance() == 0)
 		of_device_enable_path("/chosen/environment-emmc");
diff --git a/arch/arm/boards/phytec-som-imx8mq/board.c b/arch/arm/boards/phytec-som-imx8mq/board.c
index 7df53a7cfb26..6d331281e6a2 100644
--- a/arch/arm/boards/phytec-som-imx8mq/board.c
+++ b/arch/arm/boards/phytec-som-imx8mq/board.c
@@ -73,10 +73,8 @@ static int physom_imx8mq_devices_init(void)
 		break;
 	}
 
-	imx8mq_bbu_internal_mmc_register_handler("eMMC",
-						 "/dev/mmc0.barebox", flag_emmc);
-	imx8mq_bbu_internal_mmc_register_handler("SD",
-						 "/dev/mmc1.barebox", flag_sd);
+	imx8m_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0.barebox", flag_emmc);
+	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", flag_sd);
 
 
 	return 0;
diff --git a/arch/arm/boards/zii-imx8mq-dev/board.c b/arch/arm/boards/zii-imx8mq-dev/board.c
index cfe879c20162..4ad09663ac1c 100644
--- a/arch/arm/boards/zii-imx8mq-dev/board.c
+++ b/arch/arm/boards/zii-imx8mq-dev/board.c
@@ -31,9 +31,9 @@ static int zii_imx8mq_dev_init(void)
 	if (of_machine_is_compatible("zii,imx8mq-ultra-rmb3"))
 		barebox_set_hostname("rmb3");
 
-	imx8mq_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc0",
-						     BBU_HANDLER_FLAG_DEFAULT);
-	imx8mq_bbu_internal_mmc_register_handler("SD", "/dev/mmc1", 0);
+	imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc0",
+						    BBU_HANDLER_FLAG_DEFAULT);
+	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1", 0);
 
 	if (bootsource_get_instance() == 0)
 		of_device_enable_path("/chosen/environment-emmc");
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 1b3cb70da811..c6d427a46c9e 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -593,9 +593,9 @@ int vf610_bbu_internal_mmc_register_handler(const char *name,
 	__alias(imx6_bbu_internal_mmc_register_handler);
 
 /*
- * Register an i.MX8MQ internal boot update handler for MMC/SD
+ * Register an i.MX8M* internal boot update handler for MMC/SD
  */
-int imx8mq_bbu_internal_mmc_register_handler(const char *name,
+int imx8m_bbu_internal_mmc_register_handler(const char *name,
 					     const char *devicefile,
 					     unsigned long flags)
 	__alias(imx6_bbu_internal_mmc_register_handler);
@@ -643,7 +643,7 @@ int imx7_bbu_internal_mmcboot_register_handler(const char *name,
 						unsigned long flags)
 	__alias(imx_bbu_internal_mmcboot_register_handler);
 
-int imx8mq_bbu_internal_mmcboot_register_handler(const char *name,
+int imx8m_bbu_internal_mmcboot_register_handler(const char *name,
 						 const char *devicefile,
 						 unsigned long flags)
 	__alias(imx_bbu_internal_mmcboot_register_handler);
diff --git a/arch/arm/mach-imx/include/mach/bbu.h b/arch/arm/mach-imx/include/mach/bbu.h
index 10638a7fc7a0..f2e326f475cd 100644
--- a/arch/arm/mach-imx/include/mach/bbu.h
+++ b/arch/arm/mach-imx/include/mach/bbu.h
@@ -74,10 +74,10 @@ int vf610_bbu_internal_spi_i2c_register_handler(const char *name, const char *de
 int imx7_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
 					       unsigned long flags);
 
-int imx8mq_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
-					     unsigned long flags);
-int imx8mq_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
-						 unsigned long flags);
+int imx8m_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+					    unsigned long flags);
+int imx8m_bbu_internal_mmcboot_register_handler(const char *name, const char *devicefile,
+						unsigned long flags);
 
 int imx_bbu_external_nor_register_handler(const char *name, const char *devicefile,
 		unsigned long flags);
@@ -161,15 +161,15 @@ static inline int vf610_bbu_internal_mmc_register_handler(const char *name, cons
 	return -ENOSYS;
 }
 
-static inline int imx8mq_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
-							   unsigned long flags)
+static inline int imx8m_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
+							  unsigned long flags)
 {
 	return -ENOSYS;
 }
 
-static inline int imx8mq_bbu_internal_mmcboot_register_handler(const char *name,
-							       const char *devicefile,
-							       unsigned long flags)
+static inline int imx8m_bbu_internal_mmcboot_register_handler(const char *name,
+							      const char *devicefile,
+							      unsigned long flags)
 {
 	return -ENOSYS;
 }
-- 
2.29.2


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

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

* Re: [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M
  2020-12-04 17:40 [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Ahmad Fatoum
  2020-12-04 17:40 ` [PATCH 2/2] ARM: i.MX8M: bbu: rename imx8mq_bbu_* functions to imx8m_bbu_* Ahmad Fatoum
@ 2020-12-07  9:42 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2020-12-07  9:42 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, Dec 04, 2020 at 06:40:44PM +0100, Ahmad Fatoum wrote:
> Like many GPIO controllers of times past, the i.MX8M is also compatible
> with the i.MX31 GPIO controller. Add GPIO helpers for low-level code to
> use.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/mach-imx/include/mach/imx-gpio.h | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-imx/include/mach/imx-gpio.h b/arch/arm/mach-imx/include/mach/imx-gpio.h
> index 891c33a3f411..0cfd16f4fa43 100644
> --- a/arch/arm/mach-imx/include/mach/imx-gpio.h
> +++ b/arch/arm/mach-imx/include/mach/imx-gpio.h
> @@ -50,6 +50,7 @@ static inline void imx31_gpio_direction_output(void *base, int gpio, int value)
>  #define imx51_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
>  #define imx53_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
>  #define imx6_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
> +#define imx8m_gpio_direction_output(base, gpio, value) imx31_gpio_direction_output(base, gpio,value)
>  
>  static inline void imx1_gpio_direction_input(void *base, int gpio, int value)
>  {
> @@ -69,6 +70,7 @@ static inline void imx31_gpio_direction_input(void *base, int gpio)
>  #define imx51_gpio_direction_input(base, gpio, value) imx31_gpio_direction_input(base, gpio)
>  #define imx53_gpio_direction_input(base, gpio, value) imx31_gpio_direction_input(base, gpio)
>  #define imx6_gpio_direction_input(base, gpio) imx31_gpio_direction_input(base, gpio)
> +#define imx8m_gpio_direction_input(base, gpio) imx31_gpio_direction_input(base, gpio)
>  
>  #define imx1_gpio_val(base, gpio) readl(base + 0x1c) & (1 << gpio) ? 1 : 0
>  #define imx21_gpio_val(base, gpio) imx1_gpio_val(base, gpio)
> @@ -80,5 +82,6 @@ static inline void imx31_gpio_direction_input(void *base, int gpio)
>  #define imx51_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
>  #define imx53_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
>  #define imx6_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
> +#define imx8m_gpio_val(base, gpio) imx31_gpio_val(base, gpio)
>  
>  #endif /* __MACH_IMX_GPIO_H */
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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 |

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

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

end of thread, other threads:[~2020-12-07  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 17:40 [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Ahmad Fatoum
2020-12-04 17:40 ` [PATCH 2/2] ARM: i.MX8M: bbu: rename imx8mq_bbu_* functions to imx8m_bbu_* Ahmad Fatoum
2020-12-07  9:42 ` [PATCH 1/2] ARM: i.MX: add low level gpio helpers for i.MX8M Sascha Hauer

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