U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm
@ 2024-08-01 12:54 Lukasz Majewski
  2024-08-01 12:54 ` [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk Lukasz Majewski
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-08-01 12:54 UTC (permalink / raw)
  To: Teresa Remmet, u-boot
  Cc: Tom Rini, Benjamin Hahn, Cem Tenruh, Martyn Welch, Simon Glass,
	Lukasz Majewski

This command allows easy update on SD card (hence the update_mmc_part=1)
of the flash.bin generated during u-boot build.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 include/configs/phycore_imx8mm.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/configs/phycore_imx8mm.h b/include/configs/phycore_imx8mm.h
index ce6dc87c69..fdeb11933f 100644
--- a/include/configs/phycore_imx8mm.h
+++ b/include/configs/phycore_imx8mm.h
@@ -29,6 +29,17 @@
 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
 	"mmcpart=1\0" \
 	"mmcroot=2\0" \
+	"update_mmc_part=1\0" \
+	"update_offset=0x42\0" \
+	"update_filename=flash.bin\0" \
+	"hostname=/tftpboot/lukma/\0" \
+	"update_bootimg="						\
+		"mmc dev ${mmcdev} ; "		\
+		"if dhcp ${hostname}/${update_filename} ; then "	\
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "				\
+		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ; "	\
+		"fi\0" \
 	"mmcautodetect=yes\0" \
 	"mmcargs=setenv bootargs console=${console} " \
 		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw\0" \
-- 
2.39.2


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

* [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk
  2024-08-01 12:54 [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Lukasz Majewski
@ 2024-08-01 12:54 ` Lukasz Majewski
  2024-08-01 14:31   ` Fabio Estevam
  2024-08-01 13:13 ` [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Fabio Estevam
  2024-08-02  8:50 ` Benjamin Hahn
  2 siblings, 1 reply; 8+ messages in thread
From: Lukasz Majewski @ 2024-08-01 12:54 UTC (permalink / raw)
  To: Teresa Remmet, u-boot
  Cc: Tom Rini, Benjamin Hahn, Cem Tenruh, Martyn Welch, Simon Glass,
	Lukasz Majewski

This change adds support for PCIe connected nvme disk - phyBOARD-Polis
base board.

One needs to call following commands in u-boot:
> pci enum
> nvme scan
> nvme info

And then ones to access proper file system (like fat[ls|load|write],
ext4[ls|load|write]).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 configs/phycore-imx8mm_defconfig | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig
index 22d419024f..e6854aa571 100644
--- a/configs/phycore-imx8mm_defconfig
+++ b/configs/phycore-imx8mm_defconfig
@@ -12,6 +12,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-phyboard-polis-rdk"
 CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_TARGET_PHYCORE_IMX8MM=y
+CONFIG_DM_RESET=y
 CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
@@ -23,6 +24,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x3E0000
 CONFIG_SYS_LOAD_ADDR=0x40480000
+CONFIG_PCI=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
@@ -32,6 +34,7 @@ CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; the
 CONFIG_DEFAULT_FDT_FILE="oftree"
 CONFIG_SYS_CBSIZE=2048
 CONFIG_SYS_PBSIZE=2074
+CONFIG_CYCLIC_MAX_CPU_TIME_US=1000
 CONFIG_BOARD_LATE_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_SYS_MALLOC=y
@@ -59,6 +62,7 @@ CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
 CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
@@ -110,10 +114,15 @@ CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_GIGE=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_NVME_PCI=y
+CONFIG_PCIE_DW_IMX=y
+CONFIG_PHY=y
+CONFIG_PHY_IMX8M_PCIE=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
-CONFIG_DM_REGULATOR=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_IMX8M_POWER_DOMAIN=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_SERIAL=y
-- 
2.39.2


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

* Re: [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm
  2024-08-01 12:54 [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Lukasz Majewski
  2024-08-01 12:54 ` [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk Lukasz Majewski
@ 2024-08-01 13:13 ` Fabio Estevam
  2024-08-01 21:16   ` Tom Rini
  2024-08-02  8:50 ` Benjamin Hahn
  2 siblings, 1 reply; 8+ messages in thread
From: Fabio Estevam @ 2024-08-01 13:13 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Teresa Remmet, u-boot, Tom Rini, Benjamin Hahn, Cem Tenruh,
	Martyn Welch, Simon Glass

Hi Lukasz,

On Thu, Aug 1, 2024 at 9:54 AM Lukasz Majewski <lukma@denx.de> wrote:

>         "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
>         "mmcpart=1\0" \
>         "mmcroot=2\0" \
> +       "update_mmc_part=1\0" \
> +       "update_offset=0x42\0" \
> +       "update_filename=flash.bin\0" \
> +       "hostname=/tftpboot/lukma/\0" \

I don't think all the users will like to use this tftpboot path :-)

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

* Re: [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk
  2024-08-01 12:54 ` [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk Lukasz Majewski
@ 2024-08-01 14:31   ` Fabio Estevam
  2024-08-01 14:42     ` Lukasz Majewski
  0 siblings, 1 reply; 8+ messages in thread
From: Fabio Estevam @ 2024-08-01 14:31 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Teresa Remmet, u-boot, Tom Rini, Benjamin Hahn, Cem Tenruh,
	Martyn Welch, Simon Glass

Hi Lukasz,

On Thu, Aug 1, 2024 at 9:54 AM Lukasz Majewski <lukma@denx.de> wrote:

> +CONFIG_CYCLIC_MAX_CPU_TIME_US=1000

Please explain why this option was added.

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

* Re: [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk
  2024-08-01 14:31   ` Fabio Estevam
@ 2024-08-01 14:42     ` Lukasz Majewski
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-08-01 14:42 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Teresa Remmet, u-boot, Tom Rini, Benjamin Hahn, Cem Tenruh,
	Martyn Welch, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

Hi Fabio,

> Hi Lukasz,
> 
> On Thu, Aug 1, 2024 at 9:54 AM Lukasz Majewski <lukma@denx.de> wrote:
> 
> > +CONFIG_CYCLIC_MAX_CPU_TIME_US=1000  
> 
> Please explain why this option was added.

It must have been slipped in...

Default value is 5000 for this SoM.

IMHO it would be safe to remove it (and use default value) - I will
prepare v2 without it. Thanks for spotting it.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm
  2024-08-01 13:13 ` [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Fabio Estevam
@ 2024-08-01 21:16   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2024-08-01 21:16 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Lukasz Majewski, Teresa Remmet, u-boot, Benjamin Hahn, Cem Tenruh,
	Martyn Welch, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

On Thu, Aug 01, 2024 at 10:13:13AM -0300, Fabio Estevam wrote:
> Hi Lukasz,
> 
> On Thu, Aug 1, 2024 at 9:54 AM Lukasz Majewski <lukma@denx.de> wrote:
> 
> >         "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
> >         "mmcpart=1\0" \
> >         "mmcroot=2\0" \
> > +       "update_mmc_part=1\0" \
> > +       "update_offset=0x42\0" \
> > +       "update_filename=flash.bin\0" \
> > +       "hostname=/tftpboot/lukma/\0" \
> 
> I don't think all the users will like to use this tftpboot path :-)

And while we're touching these boards, can we get them migrated to plain
text environment please?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm
  2024-08-01 12:54 [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Lukasz Majewski
  2024-08-01 12:54 ` [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk Lukasz Majewski
  2024-08-01 13:13 ` [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Fabio Estevam
@ 2024-08-02  8:50 ` Benjamin Hahn
  2024-08-02 10:31   ` Lukasz Majewski
  2 siblings, 1 reply; 8+ messages in thread
From: Benjamin Hahn @ 2024-08-02  8:50 UTC (permalink / raw)
  To: Lukasz Majewski, Teresa Remmet, u-boot@lists.denx.de
  Cc: Tom Rini, Cem Tenruh, Martyn Welch, Simon Glass

Hi Lukasz,

On 01.08.24 14:54, Lukasz Majewski wrote:
> This command allows easy update on SD card (hence the update_mmc_part=1)
> of the flash.bin generated during u-boot build.
>
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> ---
>   include/configs/phycore_imx8mm.h | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/include/configs/phycore_imx8mm.h b/include/configs/phycore_imx8mm.h
> index ce6dc87c69..fdeb11933f 100644
> --- a/include/configs/phycore_imx8mm.h
> +++ b/include/configs/phycore_imx8mm.h
> @@ -29,6 +29,17 @@
>   	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
>   	"mmcpart=1\0" \
>   	"mmcroot=2\0" \
> +	"update_mmc_part=1\0" \

You define the update_mmc_part variable here, but do not use it 
anywhere. You use the mmcdev variable later which is good, because the 
function then works not only for SD-Card, but also for eMMC.

In the commit description you say it is for updating SD-Card, which 
would be mmc dev 1, but the name of the variable would indicate that is 
is for a partition.
As I understand it you want to update just the U-Boot, which is not 
inside any partition, so you would not need this variable.

> +	"update_offset=0x42\0" \
> +	"update_filename=flash.bin\0" \
> +	"hostname=/tftpboot/lukma/\0" \
We adivse to use /srv/tftp  as tftp dir in our BSP documentation. But I 
don't think you need that variable at all, because the dhcp command 
should find the tftp dir automatically.
> +	"update_bootimg="						\
> +		"mmc dev ${mmcdev} ; "		\
> +		"if dhcp ${hostname}/${update_filename} ; then "	\

Does this work? For me it does not. As far as I know the syntax of this command is "dhcp <loadaddr> <filename>".
So I would expect this to be:
dhcp ${loadaddr} ${update_filename}

> +		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
> +		"setexpr fw_sz ${fw_sz} + 1 ; "				\
Why do you add one here? Is this important for something? For me it 
works also without the one.
It is also described in our BSP documentation without adding one. See:
https://phytec.github.io/doc-bsp-yocto/bsp/imx8/imx8mp/mainline-head.html#flash-emmc-u-boot-image-via-network-from-running-u-boot 

(This is for our imx8mp mainline release but is the same for imx8mm with 
another offset).

Benjamin
> +		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ; "	\
> +		"fi\0" \
>   	"mmcautodetect=yes\0" \
>   	"mmcargs=setenv bootargs console=${console} " \
>   		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw\0" \



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

* Re: [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm
  2024-08-02  8:50 ` Benjamin Hahn
@ 2024-08-02 10:31   ` Lukasz Majewski
  0 siblings, 0 replies; 8+ messages in thread
From: Lukasz Majewski @ 2024-08-02 10:31 UTC (permalink / raw)
  To: Benjamin Hahn
  Cc: Teresa Remmet, u-boot@lists.denx.de, Tom Rini, Cem Tenruh,
	Martyn Welch, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 3654 bytes --]

Hi Benjamin,

> Hi Lukasz,
> 
> On 01.08.24 14:54, Lukasz Majewski wrote:
> > This command allows easy update on SD card (hence the
> > update_mmc_part=1) of the flash.bin generated during u-boot build.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> >   include/configs/phycore_imx8mm.h | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/include/configs/phycore_imx8mm.h
> > b/include/configs/phycore_imx8mm.h index ce6dc87c69..fdeb11933f
> > 100644 --- a/include/configs/phycore_imx8mm.h
> > +++ b/include/configs/phycore_imx8mm.h
> > @@ -29,6 +29,17 @@
> >   	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
> >   	"mmcpart=1\0" \
> >   	"mmcroot=2\0" \
> > +	"update_mmc_part=1\0" \  
> 
> You define the update_mmc_part variable here, but do not use it 
> anywhere. You use the mmcdev variable later which is good, because
> the function then works not only for SD-Card, but also for eMMC.
> 
> In the commit description you say it is for updating SD-Card, which 
> would be mmc dev 1, but the name of the variable would indicate that
> is is for a partition.
> As I understand it you want to update just the U-Boot, which is not 
> inside any partition, so you would not need this variable.

Yes, for updating u-boot it is not required. I will remove it.

> 
> > +	"update_offset=0x42\0" \
> > +	"update_filename=flash.bin\0" \
> > +	"hostname=/tftpboot/lukma/\0" \  
> We adivse to use /srv/tftp  as tftp dir in our BSP documentation. But
> I don't think you need that variable at all, because the dhcp command 
> should find the tftp dir automatically.

I can follow your documentation adn add /srv/tftp

> > +	"update_bootimg="
> > 	\
> > +		"mmc dev ${mmcdev} ; "		\
> > +		"if dhcp ${hostname}/${update_filename} ; then
> > "	\  
> 
> Does this work? For me it does not. As far as I know the syntax of
> this command is "dhcp <loadaddr> <filename>". So I would expect this
> to be: dhcp ${loadaddr} ${update_filename}
> 

When you don't provide the <loadaddr> the one from ${loadaddr} is used
by default.

However, yes - the latter - i.e. one with ${loadaddr} is more readable
and shall be used.

> > +		"setexpr fw_sz ${filesize} / 0x200 ; "	/*
> > SD block size */ \
> > +		"setexpr fw_sz ${fw_sz} + 1 ; "
> > 		\  
> Why do you add one here? Is this important for something?

Yes, it is. The / division is only giving you the value without
reminder. As the filesize can be not aligned to 0x200 you wouldn't
flash the whole binary.

> For me it 
> works also without the one.

Sometimes it works, sometimes not - it depends if you crop the relevant
part.

> It is also described in our BSP documentation without adding one. See:
> https://phytec.github.io/doc-bsp-yocto/bsp/imx8/imx8mp/mainline-head.html#flash-emmc-u-boot-image-via-network-from-running-u-boot 
> 

If you are 100% sure that all the time the size of the binary is
aligned to 0x200, then you can omit the 1 as well.

> (This is for our imx8mp mainline release but is the same for imx8mm
> with another offset).
> 
> Benjamin
> > +		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ;
> > "	\
> > +		"fi\0" \
> >   	"mmcautodetect=yes\0" \
> >   	"mmcargs=setenv bootargs console=${console} " \
> >   		"root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait
> > rw\0" \  
> 
> 


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2024-08-02 10:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-01 12:54 [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Lukasz Majewski
2024-08-01 12:54 ` [PATCH 2/2] config: Adjust Phytec imx8mm module config to support NVME disk Lukasz Majewski
2024-08-01 14:31   ` Fabio Estevam
2024-08-01 14:42     ` Lukasz Majewski
2024-08-01 13:13 ` [PATCH 1/2] config: Add 'update_bootimg' command to update flash.bin on Phytec's imx8mm Fabio Estevam
2024-08-01 21:16   ` Tom Rini
2024-08-02  8:50 ` Benjamin Hahn
2024-08-02 10:31   ` Lukasz Majewski

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