mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe
@ 2022-10-17 16:18 Marco Felsch
  2022-10-17 16:18 ` [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marco Felsch @ 2022-10-17 16:18 UTC (permalink / raw)
  To: barebox

Convert the driver to the board driver mechanism. While on it enable the
deep-probe support and add a comment about the ENET1_RGMII_EN bit
setting.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/boards/nxp-imx8mp-evk/board.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/nxp-imx8mp-evk/board.c b/arch/arm/boards/nxp-imx8mp-evk/board.c
index 8f1c247109..57c41aa8d8 100644
--- a/arch/arm/boards/nxp-imx8mp-evk/board.c
+++ b/arch/arm/boards/nxp-imx8mp-evk/board.c
@@ -6,6 +6,7 @@
 #include <asm/memory.h>
 #include <bootsource.h>
 #include <common.h>
+#include <deep-probe.h>
 #include <init.h>
 #include <linux/phy.h>
 #include <linux/sizes.h>
@@ -14,15 +15,12 @@
 #include <gpio.h>
 #include <envfs.h>
 
-static int nxp_imx8mp_evk_init(void)
+static int nxp_imx8mp_evk_probe(struct device_d *dev)
 {
 	int emmc_bbu_flag = 0;
 	int sd_bbu_flag = 0;
 	u32 val;
 
-	if (!of_machine_is_compatible("fsl,imx8mp-evk"))
-		return 0;
-
 	if (bootsource_get() == BOOTSOURCE_MMC) {
 		if (bootsource_get_instance() == 2) {
 			of_device_enable_path("/chosen/environment-emmc");
@@ -39,10 +37,23 @@ static int nxp_imx8mp_evk_init(void)
 	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", sd_bbu_flag);
 	imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
 
+	/* Enable RGMII TX clk output */
 	val = readl(MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
 	val |= MX8MP_IOMUXC_GPR1_ENET1_RGMII_EN;
 	writel(val, MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
 
 	return 0;
 }
-coredevice_initcall(nxp_imx8mp_evk_init);
+
+static const struct of_device_id nxp_imx8mp_evk_of_match[] = {
+	{ .compatible = "fsl,imx8mp-evk" },
+	{ /* Sentinel */ }
+};
+BAREBOX_DEEP_PROBE_ENABLE(nxp_imx8mp_evk_of_match);
+
+static struct driver_d nxp_imx8mp_evk_board_driver = {
+	.name = "board-nxp-imx8mp-evk",
+	.probe = nxp_imx8mp_evk_probe,
+	.of_compatible = nxp_imx8mp_evk_of_match,
+};
+coredevice_platform_driver(nxp_imx8mp_evk_board_driver);
-- 
2.30.2




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

* [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered
  2022-10-17 16:18 [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Marco Felsch
@ 2022-10-17 16:18 ` Marco Felsch
  2022-10-17 16:39   ` Ahmad Fatoum
  2022-10-17 16:18 ` [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define Marco Felsch
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Marco Felsch @ 2022-10-17 16:18 UTC (permalink / raw)
  To: barebox

With a very recent barebox version we get the following error message:

  imx8mq-usb-phy 382f0040.usb-phy@382f0040.of: error No such device: power domain attach failed

This is because of the lack of the power-domain driver. With the
assumption that the TF-A left this power-domain powered we can set this
flag to tell barebox that everything is okay.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/dts/imx8mp.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/imx8mp.dtsi b/arch/arm/dts/imx8mp.dtsi
index b251ebeada..7e46a71546 100644
--- a/arch/arm/dts/imx8mp.dtsi
+++ b/arch/arm/dts/imx8mp.dtsi
@@ -7,3 +7,7 @@
 		syscon = <&src>;
 	};
 };
+
+&hsio_blk_ctrl {
+	barebox,allow-dummy;
+};
-- 
2.30.2




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

* [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define
  2022-10-17 16:18 [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Marco Felsch
  2022-10-17 16:18 ` [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered Marco Felsch
@ 2022-10-17 16:18 ` Marco Felsch
  2022-10-17 16:39   ` Ahmad Fatoum
  2022-10-17 16:38 ` [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Ahmad Fatoum
  2022-10-18  9:04 ` Sascha Hauer
  3 siblings, 1 reply; 7+ messages in thread
From: Marco Felsch @ 2022-10-17 16:18 UTC (permalink / raw)
  To: barebox

Align the define with the name used by the usptream and downstream tf-a.

While on change the pr_info behaviour to only print the version if a0
contain something useful.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/mach-imx/imx8m.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 8b275bd6f6..9758525b54 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -18,8 +18,8 @@
 #include <linux/iopoll.h>
 #include <linux/arm-smccc.h>
 
-#define FSL_SIP_BUILDINFO			0xC2000003
-#define FSL_SIP_BUILDINFO_GET_COMMITHASH	0x00
+#define IMX_SIP_BUILDINFO			0xC2000003
+#define IMX_SIP_BUILDINFO_GET_COMMITHASH	0x00
 
 void imx8m_clock_set_target_val(int clock_id, u32 val)
 {
@@ -62,10 +62,12 @@ static int imx8m_init(const char *cputypestr)
 
 	if (IS_ENABLED(CONFIG_ARM_SMCCC) &&
 	    IS_ENABLED(CONFIG_FIRMWARE_IMX8MQ_ATF)) {
-		arm_smccc_smc(FSL_SIP_BUILDINFO,
-			      FSL_SIP_BUILDINFO_GET_COMMITHASH,
+		arm_smccc_smc(IMX_SIP_BUILDINFO,
+			      IMX_SIP_BUILDINFO_GET_COMMITHASH,
 			      0, 0, 0, 0, 0, 0, &res);
-		pr_info("i.MX ARM Trusted Firmware: %s\n", (char *)&res.a0);
+
+		if (res.a0 > 0)
+			pr_info("i.MX ARM Trusted Firmware: %s\n", (char *)&res.a0);
 	}
 
 	return 0;
-- 
2.30.2




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

* Re: [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe
  2022-10-17 16:18 [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Marco Felsch
  2022-10-17 16:18 ` [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered Marco Felsch
  2022-10-17 16:18 ` [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define Marco Felsch
@ 2022-10-17 16:38 ` Ahmad Fatoum
  2022-10-18  9:04 ` Sascha Hauer
  3 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2022-10-17 16:38 UTC (permalink / raw)
  To: Marco Felsch, barebox; +Cc: Hans Christian Lønstad

On 17.10.22 18:18, Marco Felsch wrote:
> Convert the driver to the board driver mechanism. While on it enable the
> deep-probe support and add a comment about the ENET1_RGMII_EN bit
> setting.

Cc += Hans, who reported the same issue on Github.

> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  arch/arm/boards/nxp-imx8mp-evk/board.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/boards/nxp-imx8mp-evk/board.c b/arch/arm/boards/nxp-imx8mp-evk/board.c
> index 8f1c247109..57c41aa8d8 100644
> --- a/arch/arm/boards/nxp-imx8mp-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mp-evk/board.c
> @@ -6,6 +6,7 @@
>  #include <asm/memory.h>
>  #include <bootsource.h>
>  #include <common.h>
> +#include <deep-probe.h>
>  #include <init.h>
>  #include <linux/phy.h>
>  #include <linux/sizes.h>
> @@ -14,15 +15,12 @@
>  #include <gpio.h>
>  #include <envfs.h>
>  
> -static int nxp_imx8mp_evk_init(void)
> +static int nxp_imx8mp_evk_probe(struct device_d *dev)
>  {
>  	int emmc_bbu_flag = 0;
>  	int sd_bbu_flag = 0;
>  	u32 val;
>  
> -	if (!of_machine_is_compatible("fsl,imx8mp-evk"))
> -		return 0;
> -
>  	if (bootsource_get() == BOOTSOURCE_MMC) {
>  		if (bootsource_get_instance() == 2) {
>  			of_device_enable_path("/chosen/environment-emmc");
> @@ -39,10 +37,23 @@ static int nxp_imx8mp_evk_init(void)
>  	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", sd_bbu_flag);
>  	imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
>  
> +	/* Enable RGMII TX clk output */
>  	val = readl(MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
>  	val |= MX8MP_IOMUXC_GPR1_ENET1_RGMII_EN;
>  	writel(val, MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
>  
>  	return 0;
>  }
> -coredevice_initcall(nxp_imx8mp_evk_init);
> +
> +static const struct of_device_id nxp_imx8mp_evk_of_match[] = {
> +	{ .compatible = "fsl,imx8mp-evk" },
> +	{ /* Sentinel */ }
> +};
> +BAREBOX_DEEP_PROBE_ENABLE(nxp_imx8mp_evk_of_match);
> +
> +static struct driver_d nxp_imx8mp_evk_board_driver = {
> +	.name = "board-nxp-imx8mp-evk",
> +	.probe = nxp_imx8mp_evk_probe,
> +	.of_compatible = nxp_imx8mp_evk_of_match,
> +};
> +coredevice_platform_driver(nxp_imx8mp_evk_board_driver);


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

* Re: [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered
  2022-10-17 16:18 ` [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered Marco Felsch
@ 2022-10-17 16:39   ` Ahmad Fatoum
  0 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2022-10-17 16:39 UTC (permalink / raw)
  To: Marco Felsch, barebox

On 17.10.22 18:18, Marco Felsch wrote:
> With a very recent barebox version we get the following error message:
> 
>   imx8mq-usb-phy 382f0040.usb-phy@382f0040.of: error No such device: power domain attach failed
> 
> This is because of the lack of the power-domain driver. With the
> assumption that the TF-A left this power-domain powered we can set this
> flag to tell barebox that everything is okay.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  arch/arm/dts/imx8mp.dtsi | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/dts/imx8mp.dtsi b/arch/arm/dts/imx8mp.dtsi
> index b251ebeada..7e46a71546 100644
> --- a/arch/arm/dts/imx8mp.dtsi
> +++ b/arch/arm/dts/imx8mp.dtsi
> @@ -7,3 +7,7 @@
>  		syscon = <&src>;
>  	};
>  };
> +
> +&hsio_blk_ctrl {
> +	barebox,allow-dummy;
> +};


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

* Re: [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define
  2022-10-17 16:18 ` [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define Marco Felsch
@ 2022-10-17 16:39   ` Ahmad Fatoum
  0 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2022-10-17 16:39 UTC (permalink / raw)
  To: Marco Felsch, barebox

On 17.10.22 18:18, Marco Felsch wrote:
> Align the define with the name used by the usptream and downstream tf-a.
> 
> While on change the pr_info behaviour to only print the version if a0
> contain something useful.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  arch/arm/mach-imx/imx8m.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
> index 8b275bd6f6..9758525b54 100644
> --- a/arch/arm/mach-imx/imx8m.c
> +++ b/arch/arm/mach-imx/imx8m.c
> @@ -18,8 +18,8 @@
>  #include <linux/iopoll.h>
>  #include <linux/arm-smccc.h>
>  
> -#define FSL_SIP_BUILDINFO			0xC2000003
> -#define FSL_SIP_BUILDINFO_GET_COMMITHASH	0x00
> +#define IMX_SIP_BUILDINFO			0xC2000003
> +#define IMX_SIP_BUILDINFO_GET_COMMITHASH	0x00
>  
>  void imx8m_clock_set_target_val(int clock_id, u32 val)
>  {
> @@ -62,10 +62,12 @@ static int imx8m_init(const char *cputypestr)
>  
>  	if (IS_ENABLED(CONFIG_ARM_SMCCC) &&
>  	    IS_ENABLED(CONFIG_FIRMWARE_IMX8MQ_ATF)) {
> -		arm_smccc_smc(FSL_SIP_BUILDINFO,
> -			      FSL_SIP_BUILDINFO_GET_COMMITHASH,
> +		arm_smccc_smc(IMX_SIP_BUILDINFO,
> +			      IMX_SIP_BUILDINFO_GET_COMMITHASH,
>  			      0, 0, 0, 0, 0, 0, &res);
> -		pr_info("i.MX ARM Trusted Firmware: %s\n", (char *)&res.a0);
> +
> +		if (res.a0 > 0)
> +			pr_info("i.MX ARM Trusted Firmware: %s\n", (char *)&res.a0);
>  	}
>  
>  	return 0;


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

* Re: [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe
  2022-10-17 16:18 [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Marco Felsch
                   ` (2 preceding siblings ...)
  2022-10-17 16:38 ` [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Ahmad Fatoum
@ 2022-10-18  9:04 ` Sascha Hauer
  3 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2022-10-18  9:04 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On Mon, Oct 17, 2022 at 06:18:16PM +0200, Marco Felsch wrote:
> Convert the driver to the board driver mechanism. While on it enable the
> deep-probe support and add a comment about the ENET1_RGMII_EN bit
> setting.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  arch/arm/boards/nxp-imx8mp-evk/board.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)

Applied, thanks

(contrary to what you said I applied it to master)

Sascha

> 
> diff --git a/arch/arm/boards/nxp-imx8mp-evk/board.c b/arch/arm/boards/nxp-imx8mp-evk/board.c
> index 8f1c247109..57c41aa8d8 100644
> --- a/arch/arm/boards/nxp-imx8mp-evk/board.c
> +++ b/arch/arm/boards/nxp-imx8mp-evk/board.c
> @@ -6,6 +6,7 @@
>  #include <asm/memory.h>
>  #include <bootsource.h>
>  #include <common.h>
> +#include <deep-probe.h>
>  #include <init.h>
>  #include <linux/phy.h>
>  #include <linux/sizes.h>
> @@ -14,15 +15,12 @@
>  #include <gpio.h>
>  #include <envfs.h>
>  
> -static int nxp_imx8mp_evk_init(void)
> +static int nxp_imx8mp_evk_probe(struct device_d *dev)
>  {
>  	int emmc_bbu_flag = 0;
>  	int sd_bbu_flag = 0;
>  	u32 val;
>  
> -	if (!of_machine_is_compatible("fsl,imx8mp-evk"))
> -		return 0;
> -
>  	if (bootsource_get() == BOOTSOURCE_MMC) {
>  		if (bootsource_get_instance() == 2) {
>  			of_device_enable_path("/chosen/environment-emmc");
> @@ -39,10 +37,23 @@ static int nxp_imx8mp_evk_init(void)
>  	imx8m_bbu_internal_mmc_register_handler("SD", "/dev/mmc1.barebox", sd_bbu_flag);
>  	imx8m_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2", emmc_bbu_flag);
>  
> +	/* Enable RGMII TX clk output */
>  	val = readl(MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
>  	val |= MX8MP_IOMUXC_GPR1_ENET1_RGMII_EN;
>  	writel(val, MX8MP_IOMUXC_GPR_BASE_ADDR + MX8MP_IOMUXC_GPR1);
>  
>  	return 0;
>  }
> -coredevice_initcall(nxp_imx8mp_evk_init);
> +
> +static const struct of_device_id nxp_imx8mp_evk_of_match[] = {
> +	{ .compatible = "fsl,imx8mp-evk" },
> +	{ /* Sentinel */ }
> +};
> +BAREBOX_DEEP_PROBE_ENABLE(nxp_imx8mp_evk_of_match);
> +
> +static struct driver_d nxp_imx8mp_evk_board_driver = {
> +	.name = "board-nxp-imx8mp-evk",
> +	.probe = nxp_imx8mp_evk_probe,
> +	.of_compatible = nxp_imx8mp_evk_of_match,
> +};
> +coredevice_platform_driver(nxp_imx8mp_evk_board_driver);
> -- 
> 2.30.2
> 
> 
> 

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

end of thread, other threads:[~2022-10-18  9:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 16:18 [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Marco Felsch
2022-10-17 16:18 ` [PATCH next 2/3] ARM: dts: i.MX8MP: assume hsio power domain to be powered Marco Felsch
2022-10-17 16:39   ` Ahmad Fatoum
2022-10-17 16:18 ` [PATCH next 3/3] ARM: i.MX8M: align SIP_BUILDINFO with the tf-a define Marco Felsch
2022-10-17 16:39   ` Ahmad Fatoum
2022-10-17 16:38 ` [PATCH next 1/3] ARM: i.MX8MP: EVK: convert to board driver and enable deep-probe Ahmad Fatoum
2022-10-18  9:04 ` Sascha Hauer

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