Re: [PATCH 2/2] arm: mvebu: clearfog: Add defconfig for SPI booting

Josua Mayer
2023-02-25T10:51:39Z

Hi Pali, Martin,

Am 25.02.23 um 10:48 schrieb Martin Rowe:
> On Sat, 25 Feb 2023 at 07:41, Pali Rohár<pali@kernel.org> wrote:
>> On Saturday 25 February 2023 11:42:20 Martin Rowe wrote:
>>> This new clearfog_spi_defconfig file is copy of existing
>>> clearfog_defconfig file and changed to instruct build system to
>>> generate final kwbimage for SPI booting and to store the
>>> environment in SPI as well.
>>>
>>> Signed-off-by: Martin Rowe<martin.p.rowe@gmail.com>
>>> ---
>>> .../{clearfog_sata_defconfig => clearfog_spi_defconfig} | 7 ++++++-
>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>> copy configs/{clearfog_sata_defconfig => clearfog_spi_defconfig} (93%)
>>>
>>> diff --git a/configs/clearfog_sata_defconfig b/configs/clearfog_spi_defconfig
>>> similarity index 93%
>>> copy from configs/clearfog_sata_defconfig
>>> copy to configs/clearfog_spi_defconfig
>>> index 84f900bf50..31b1e9fce8 100644
>>> --- a/configs/clearfog_sata_defconfig
>>> +++ b/configs/clearfog_spi_defconfig
>>> @@ -3,20 +3,24 @@ CONFIG_ARCH_CPU_INIT=y
>>> CONFIG_SYS_THUMB_BUILD=y
>>> CONFIG_ARCH_MVEBU=y
>>> CONFIG_TEXT_BASE=0x00800000
>>> +CONFIG_SPL_GPIO=y
>>> CONFIG_SPL_LIBCOMMON_SUPPORT=y
>>> CONFIG_SPL_LIBGENERIC_SUPPORT=y
>>> CONFIG_NR_DRAM_BANKS=2
>>> CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
>>> CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff0000
>>> CONFIG_TARGET_CLEARFOG=y
>>> -CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA=y
>>> +CONFIG_ENV_SECT_SIZE=0x10000
>>> CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog"
>>> CONFIG_SPL_TEXT_BASE=0x40000030
>>> +CONFIG_SPL_MMC=y
>>> CONFIG_SPL_SERIAL=y
>>> CONFIG_SPL_STACK=0x4002c000
>>> CONFIG_SPL=y
>>> CONFIG_DEBUG_UART_BASE=0xf1012000
>>> CONFIG_DEBUG_UART_CLOCK=250000000
>>> +CONFIG_SPL_LIBDISK_SUPPORT=y
>>> +# CONFIG_SPL_SPI is not set
>> Any reason to disable it?
> It's the same as MMC and SATA defconfigs this way, it just needs to be
> explicit here because of something SPI related that we've enabled.
> SPL_DM_SPI is enabled in all of the configs, so I'm guessing that it
> is providing driver support because everything seems to work without
> SPL_SPI.
>
> I re-tested with and without the config and it doesn't seem to change
> anything. With it enabled the file is 588K instead of 580K without it,
> but that's not really an issue with 4M of flash storage available.

While I haven't tested this patchset - I have tested SPI booting with
v2022.01 after applying lots of patches.
I found that the magic value reported by bootrom when booting from SPI
will be 0x34 on clearfog.
The current sources only handle 0x32, hence having or not having SPL_SPI
will always lead to returning to the bootrom.

Please consider pulling in this patch:
https://github.com/SolidRun/u-boot/commit/f4f8a69740a8415c05359e01e51650f445cda03d
I can send it separately if you like.

which I have tested by adding these config options:

|CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI=y # CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
is not set # CONFIG_SPL_MMC is not set CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI=y CONFIG_SPL_SPI_FLASH_TINY=y CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x0 # CONFIG_ENV_IS_IN_MMC is not set
CONFIG_ENV_IS_IN_SPI_FLASH=y # CONFIG_ENV_SECT_SIZE_AUTO is not set #
CONFIG_USE_ENV_SPI_BUS is not set # CONFIG_USE_ENV_SPI_CS is not set #
CONFIG_USE_ENV_SPI_MAX_HZ is not set # CONFIG_USE_ENV_SPI_MODE is not
set # CONFIG_ENV_SPI_EARLY is not set CONFIG_ENV_ADDR=0x0|

>>> CONFIG_SYS_LOAD_ADDR=0x800000
>>> CONFIG_DEBUG_UART=y
>>> CONFIG_AHCI=y
>>> @@ -59,6 +63,7 @@ CONFIG_SYS_I2C_MVTWSI=y
>>> CONFIG_I2C_EEPROM=y
>>> CONFIG_SPL_I2C_EEPROM=y
>>> CONFIG_MMC_BROKEN_CD=y
>>> +CONFIG_SPL_DM_MMC=y
>>> CONFIG_SUPPORT_EMMC_BOOT=y
>>> CONFIG_MMC_SDHCI=y
>>> CONFIG_MMC_SDHCI_SDMA=y
>>> --
>>> 2.39.2
>>>