SPI NOR stops working if I put Env in MMC

Mauro Condarelli mc5686 at mclink.it
Sat Jan 4 02:19:37 CET 2020


Hi,
I'm facing a strange problem that took quite a while to analyze.

I'm porting U-Boot to a new board and thus some problem is expected.
I am also trying to configure U-Boot in a useful (for my purposes) way.

I decided to switch Environment storage from SPI NOR to SD card (in a
file in FAT partition.

Before switch I had both SPI NOR (MTD) and MMC working.

> U-Boot 2020.01-rc5-00074-g57fe7de5a3-dirty (Jan 04 2020 - 01:38:21 +0100)
>
> CPU:   MT7628 Rev 1.2 - Boot from XTAL (3-Byte SPI Addr)
> Model: VoCore2
> DRAM:  128 MiB
> MMC:   mmc at 10130000: 0
> Loading Environment from SPI Flash... SF: Detected gd25q128 with page
> size 256 Bytes, erase size 4 KiB, total 16 MiB
> OK
> In:    uart2 at e00
> Out:   uart2 at e00
> Err:   uart2 at e00
> Model: VoCore2
> => mtd list
> List of MTD devices:
> * nor0
>   - type: NOR flash
>   - block size: 0x1000 bytes
>   - min I/O: 0x1 bytes
>   - 0x000000000000-0x000001000000 : "nor0"
>       - 0x000000000000-0x000000050000 : "u-boot"
>       - 0x000000050000-0x000000300000 : "kernel"
>       - 0x000000300000-0x000000ffe000 : "squash"
>       - 0x000000ffe000-0x000000fff000 : "env"
>       - 0x000000fff000-0x000001000000 : "factory"
> => mmc part
>
> Partition Map for MMC device 0  --   Partition Type: DOS
>
> Part    Start Sector    Num Sectors    UUID        Type
>   1    2048          262144        f31c8249-01    0c
>   2    264192        4194304       f31c8249-02    83
>   3    4458496       327680        f31c8249-03    83
>   4    4786176       10737664      f31c8249-04    05 Extd
>   5    4788224       2097152       f31c8249-05    83
>   6    6887424       2097152       f31c8249-06    83
> =>

I made a minimal change in configuration:

> mcon at cinderella:/tmp/u-boot$ git diff
> diff --git a/configs/vocore_vocore2_defconfig
> b/configs/vocore_vocore2_defconfig
> index ad1b580431..ece98beea0 100644
> --- a/configs/vocore_vocore2_defconfig
> +++ b/configs/vocore_vocore2_defconfig
> @@ -1,8 +1,6 @@
>  CONFIG_MIPS=y
>  CONFIG_SYS_TEXT_BASE=0x80010000
>  CONFIG_ENV_SIZE=0x00001000
> -CONFIG_ENV_OFFSET=0x00FFE000
> -CONFIG_ENV_SECT_SIZE=0x00001000
>  CONFIG_ARCH_MTMIPS=y
>  CONFIG_BOARD_VOCORE2=y
>  CONFIG_MIPS_BOOT_FDT=y
> @@ -37,8 +35,9 @@ CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
>  CONFIG_MTDPARTS_DEFAULT="spi0.0:320k(u-boot),2752k(kernel),13304k(filesystem),4k(env),-(factory)"
>  # CONFIG_ISO_PARTITION is not set
>  CONFIG_DEFAULT_DEVICE_TREE="vocore_vocore2"
> -CONFIG_ENV_IS_IN_SPI_FLASH=y
> -CONFIG_ENV_ADDR=0x00FFE000
> +CONFIG_ENV_IS_IN_FAT=y
> +CONFIG_ENV_FAT_INTERFACE="mmc"
> +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>  # CONFIG_NET is not set
>  # CONFIG_DM_DEVICE_REMOVE is not set
>  CONFIG_BLK=y
> mcon at cinderella:/tmp/u-boot$

... but it seems very destructive for spi:
> U-Boot 2020.01-rc5-00074-g0cac9383d7-dirty (Jan 04 2020 - 01:55:34 +0100)
>
> CPU:   MT7628 Rev 1.2 - Boot from XTAL (3-Byte SPI Addr)
> Model: VoCore2
> DRAM:  128 MiB
> MMC:   mmc at 10130000: 0
> Loading Environment from FAT... OK
> In:    uart2 at e00
> Out:   uart2 at e00
> Err:   uart2 at e00
> Model: VoCore2
> => mmc part
>
> Partition Map for MMC device 0  --   Partition Type: DOS
>
> Part    Start Sector    Num Sectors    UUID        Type
>   1    2048          262144        f31c8249-01    0c
>   2    264192        4194304       f31c8249-02    83
>   3    4458496       327680        f31c8249-03    83
>   4    4786176       10737664      f31c8249-04    05 Extd
>   5    4788224       2097152       f31c8249-05    83
>   6    6887424       2097152       f31c8249-06    83
> => mtd list
> Could not find a valid device for spi0.0
> List of MTD devices:
> No MTD device found
> =>
I assume some initialization is not done, but I would like some help to
debug this as I did *not* change anything in SPI (aside from setting it
in .dts).
OTOH I had to change a bit MMC handling, but that shouldn't be relevant,
or is it?
I attach my complete patch against a fairly recent commit (it was "master"
a few hours ago). The patch is to the working ENV_IS_IN_SPI_FLASH version.
Changes for "not working" with ENV_IS_IN_FAT are above.

Please advise.
Thanks in Advance
Mauro



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Port-to-VoCore2-board.patch
Type: text/x-patch
Size: 14487 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200104/2a457d98/attachment.bin>


More information about the U-Boot mailing list