[PATCH u-boot-mvebu 1/2] arm: mvebu: turris_omnia: force 40 MHz speed on SPI NOR

Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main U-Boot from SPI NOR at 1 MHz instead of 40 MHz.
This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option to spi_flash_probe(), and with the above commit spi_flash_probe() starts prefering this parameter instead of the one specified in device-tree.
The proper solution here would probably be to fix the SF subsystem to prefer the frequency specified in the device-tree, if it is present, but I am not sure what else will be affected on other boards with such a change. So until then we need a more simple fix.
Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the correct value there for Turris Omnia. Also put the correct value to CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.
Signed-off-by: Marek Behún marek.behun@nic.cz Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Marek Vasut marex@denx.de Cc: Jagan Teki jagan@amarulasolutions.com Cc: Patrick Delaunay patrick.delaunay@foss.st.com Cc: Pali Rohár pali@kernel.org --- configs/turris_omnia_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 57ab384f63..ec2294699f 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_FS_UUID=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_ENV_OVERWRITE=y CONFIG_USE_ENV_SPI_MAX_HZ=y -CONFIG_ENV_SPI_MAX_HZ=50000000 +CONFIG_ENV_SPI_MAX_HZ=40000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_PCI=y @@ -67,6 +67,8 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SF_DEFAULT_MODE=0x0 +CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y

Now that the MTD subsystem properly supports OF partitions of a SPI NOR, we can enable the MTD command and start using it instead of the deprecated sf command.
Signed-off-by: Marek Behún marek.behun@nic.cz Cc: Stefan Roese sr@denx.de Cc: Pali Rohár pali@kernel.org --- configs/turris_mox_defconfig | 3 +++ configs/turris_omnia_defconfig | 4 ++++ 2 files changed, 7 insertions(+)
diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index 2c6f4938db..34127dc3e6 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_CLK=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -60,12 +61,14 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_XENON=y CONFIG_MTD=y +CONFIG_DM_MTD=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index ec2294699f..f860cf5e7d 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -41,6 +41,7 @@ CONFIG_CMD_LZMADEC=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_SATA=y CONFIG_CMD_SPI=y @@ -65,8 +66,11 @@ CONFIG_AHCI_MVEBU=y CONFIG_DM_PCA953X=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y +CONFIG_MTD=y +CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_MTD=y CONFIG_SF_DEFAULT_MODE=0x0 CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_PHY_MARVELL=y

On 09.07.21 16:56, Marek Behún wrote:
Now that the MTD subsystem properly supports OF partitions of a SPI NOR, we can enable the MTD command and start using it instead of the deprecated sf command.
Signed-off-by: Marek Behún marek.behun@nic.cz Cc: Stefan Roese sr@denx.de Cc: Pali Rohár pali@kernel.org
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan
configs/turris_mox_defconfig | 3 +++ configs/turris_omnia_defconfig | 4 ++++ 2 files changed, 7 insertions(+)
diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index 2c6f4938db..34127dc3e6 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_CLK=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -60,12 +61,14 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_XENON=y CONFIG_MTD=y +CONFIG_DM_MTD=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index ec2294699f..f860cf5e7d 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -41,6 +41,7 @@ CONFIG_CMD_LZMADEC=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_SATA=y CONFIG_CMD_SPI=y @@ -65,8 +66,11 @@ CONFIG_AHCI_MVEBU=y CONFIG_DM_PCA953X=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y +CONFIG_MTD=y +CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_MTD=y CONFIG_SF_DEFAULT_MODE=0x0 CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_PHY_MARVELL=y
Viele Grüße, Stefan

On Fri, 9 Jul 2021 16:56:13 +0200 Marek Behún marek.behun@nic.cz wrote:
Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main U-Boot from SPI NOR at 1 MHz instead of 40 MHz.
This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option to spi_flash_probe(), and with the above commit spi_flash_probe() starts prefering this parameter instead of the one specified in device-tree.
The proper solution here would probably be to fix the SF subsystem to prefer the frequency specified in the device-tree, if it is present, but I am not sure what else will be affected on other boards with such a change. So until then we need a more simple fix.
Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the correct value there for Turris Omnia. Also put the correct value to CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.
BTW this change is currently needed even if the other series (making use of BootROM code to load main U-Boot instead of SPL doing it) is accepted: commit e2e95e5e2542 also changed the behavior of the sf read / sf update command - it is slower since it operates at 1 MHz now instead of 40 MHz as specified in the device-tree.
Marek

On Fri, Jul 09, 2021 at 05:00:09PM +0200, Marek Behún wrote:
On Fri, 9 Jul 2021 16:56:13 +0200 Marek Behún marek.behun@nic.cz wrote:
Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main U-Boot from SPI NOR at 1 MHz instead of 40 MHz.
This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option to spi_flash_probe(), and with the above commit spi_flash_probe() starts prefering this parameter instead of the one specified in device-tree.
The proper solution here would probably be to fix the SF subsystem to prefer the frequency specified in the device-tree, if it is present, but I am not sure what else will be affected on other boards with such a change. So until then we need a more simple fix.
Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the correct value there for Turris Omnia. Also put the correct value to CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.
BTW this change is currently needed even if the other series (making use of BootROM code to load main U-Boot instead of SPL doing it) is accepted: commit e2e95e5e2542 also changed the behavior of the sf read / sf update command - it is slower since it operates at 1 MHz now instead of 40 MHz as specified in the device-tree.
Ugh. This is the second bit of unexpected fall-out from that change. Since it's the start now of the merge window, no point in reverting the change now. Sorry about that!

On 09.07.21 16:56, Marek Behún wrote:
Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main U-Boot from SPI NOR at 1 MHz instead of 40 MHz.
This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option to spi_flash_probe(), and with the above commit spi_flash_probe() starts prefering this parameter instead of the one specified in device-tree.
The proper solution here would probably be to fix the SF subsystem to prefer the frequency specified in the device-tree, if it is present, but I am not sure what else will be affected on other boards with such a change. So until then we need a more simple fix.
Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the correct value there for Turris Omnia. Also put the correct value to CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.
Signed-off-by: Marek Behún marek.behun@nic.cz Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Marek Vasut marex@denx.de Cc: Jagan Teki jagan@amarulasolutions.com Cc: Patrick Delaunay patrick.delaunay@foss.st.com Cc: Pali Rohár pali@kernel.org
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan
configs/turris_omnia_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 57ab384f63..ec2294699f 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_FS_UUID=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_ENV_OVERWRITE=y CONFIG_USE_ENV_SPI_MAX_HZ=y -CONFIG_ENV_SPI_MAX_HZ=50000000 +CONFIG_ENV_SPI_MAX_HZ=40000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_PCI=y @@ -67,6 +67,8 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SF_DEFAULT_MODE=0x0 +CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y
Viele Grüße, Stefan

On 09.07.21 16:56, Marek Behún wrote:
Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main U-Boot from SPI NOR at 1 MHz instead of 40 MHz.
This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option to spi_flash_probe(), and with the above commit spi_flash_probe() starts prefering this parameter instead of the one specified in device-tree.
The proper solution here would probably be to fix the SF subsystem to prefer the frequency specified in the device-tree, if it is present, but I am not sure what else will be affected on other boards with such a change. So until then we need a more simple fix.
Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the correct value there for Turris Omnia. Also put the correct value to CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.
Signed-off-by: Marek Behún marek.behun@nic.cz Cc: Stefan Roese sr@denx.de Cc: Tom Rini trini@konsulko.com Cc: Marek Vasut marex@denx.de Cc: Jagan Teki jagan@amarulasolutions.com Cc: Patrick Delaunay patrick.delaunay@foss.st.com Cc: Pali Rohár pali@kernel.org
All patches:
Applied to u-boot-marvell/master
Thanks, Stefan
configs/turris_omnia_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 57ab384f63..ec2294699f 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -56,7 +56,7 @@ CONFIG_CMD_FS_UUID=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_ENV_OVERWRITE=y CONFIG_USE_ENV_SPI_MAX_HZ=y -CONFIG_ENV_SPI_MAX_HZ=50000000 +CONFIG_ENV_SPI_MAX_HZ=40000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_PCI=y @@ -67,6 +67,8 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SF_DEFAULT_MODE=0x0 +CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y
Viele Grüße, Stefan
participants (3)
-
Marek Behún
-
Stefan Roese
-
Tom Rini