Skip to content

Remove defines for SPI default speed and mode

Simon Goldschmidt u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 7 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 7 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode

Am 10.12.2018 um 21:17 schrieb Adam Ford:

Quoted 54 lines
Quoted 52 lines · Simon Goldschmidt

Am 10.12.2018 um 16:42 schrieb Adam Ford:

Quoted 13 lines
Quoted 11 lines · Patrick Delaunay

This patch-set finish (after the last Simmon comment) and depends on the previous serie named:
"Read default speed and mode values from DT"

http://patchwork.ozlabs.org/project/uboot/list/?series=76834

This patchset remove the unnecessary defines for SPI speed and mode when DM mode is used for SPI (CONFIG_DM_SPI_FLASH).

Quoted 7 lines
Quoted 5 lines

Build result is available for the serie in gihub and travis:
https://github.com/patrickdelaunay/u-boot/tree/topic/spi
https://travis-ci.org/patrickdelaunay/u-boot/branches

After applying both of your patches, the da850evm no longer boots from SPI flash.

I just did test this and it worked for me. Booting from QSPI on socfpga_socrates and loading something in U-Boot via sf probe/sf read, so:

Quoted 11 lines

U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600) Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

[repeat in perpetuity]

U-Boot SPL 2019.01-rc1-00754-g21fb8c41b1 (Dec 10 2018 - 09:02:28 -0600) Trying to boot from SPI
Warning: SPI speed fallback to 100 kHz

Quoted 8 lines

I then tried to apply the first patch, and it also fails booting.

I'll reply to the original series with a similar message. Looking at the comments, it looks like the code is assuming the DM_SPI_FLASH means DT when in reality, the da850evm's SPL is using platdata. I looked at the platdata structure and I didn't see entries for SPI mode or speed. However, I cannot prove this is the issue on the da850evm without diving into it a bit more.

Adam, from reading the da850-emv.dts and its '-u-boot.dtsi', it seems the fdtgrep indicators to keep the flash for the SPL dts are missing (compare to socfpga_cyclone5_socrates-u-boot.dtsi). In this case, the code does not find a flash node.

Quoted 8 lines
Quoted 1 line

The same would of course apply when using platdata.

I tried modifying the -u-boot.dtsi file to look like:

&flash {
      compatible = "m25p64", "spi-flash";
      u-boot,dm-pre-reloc;
};

That should be correct when using DTS. I have no idea about the platform data, sorry. That's a todo on my list to see if it gives me enough memory to enable FIT/signature support in my SPL, but I haven't got to compile it, yet, as cadence QSPI does not seem to support platdata, yet.

Quoted 3 lines

Unfortunately, I not get some build errors. Do you have any
suggestions? I know the dtsi didn't need the "u-boot,dm-pre-reloc;"
before this patch.

Well, that's only partly true. You need this information in SPL unless you go the hacky way of the define that Patrick wants to remove here. And the standard way to get this information into SPL is the devicetree.

I think Patrick did the right move to send this series so that we can drop the two defines and get the values from dts. Now platdata seems to be missing, so this must be solved.

Quoted 1 line

Might there be a platdata example I can follow?

As written above, I don't know of any. Even without build errors, I'm not sure it would work...

Regards,
Simon

Quoted 80 lines

The build errors as as follows:

make[2]: 'arch/arm/dts/da850-evm.dtb' is up to date.
CAT u-boot-dtb.bin
COPY u-boot.bin
MKIMAGE u-boot.img
MKIMAGE u-boot-dtb.img
DTOC C spl/dts/dt-platdata.c
DTOC H include/generated/dt-structs-gen.h
Traceback (most recent call last):
Traceback (most recent call last):

   File "./tools/dtoc/dtoc", line 109, in <module>
   File "./tools/dtoc/dtoc", line 109, in <module>
         options.output)

options.output)
File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 564,
in run_steps
File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 564,
in run_steps
plat.scan_reg_sizes()
plat.scan_reg_sizes()
File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 335,
in scan_reg_sizes
File "/home/aford/src/u-boot/tools/dtoc/dtb_platdata.py", line 335,
in scan_reg_sizes

         addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na)

addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.na)
File "/home/aford/src/u-boot/tools/dtoc/fdt_util.py", line 54, in
fdt_cells_to_cpu
File "/home/aford/src/u-boot/tools/dtoc/fdt_util.py", line 54, in
fdt_cells_to_cpu

         out = out << 32 | fdt32_to_cpu(val[1])

out = out << 32 | fdt32_to_cpu(val[1])
IndexErrorIndexError: : list index out of rangelist index out of range

scripts/Makefile.spl:287: recipe for target 'spl/dts/dt-platdata.c' failed make[1]: *** [spl/dts/dt-platdata.c] Error 1
make[1]: *** Waiting for unfinished jobs.... scripts/Makefile.spl:284: recipe for target 'include/generated/dt-structs-gen.h' failed
make[1]: *** [include/generated/dt-structs-gen.h] Error 1 Makefile:1591: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2

Quoted 32 lines

Regards,
Simon

Quoted 27 lines

adam

Quoted 25 lines

Patrick Delaunay (7):
spi: update management of default speed and mode
spi: add comment for spi_flash_probe_bus_cs function
da850evm: sf: Read default speed and mode values from DT
dfu: sf: Read default speed and mode values from DT
mips: mt76xx: gardena-smart-gateway: Read default speed and mode
values from DT
env: Read default speed and mode values from DT
spi: remove define for SPI default SPEED and MODE

   board/davinci/da8xxevm/da850evm.c          |  7 +++++++
   board/gardena/smart-gateway-mt7688/board.c | 24 ++++++++++++++++++++----
   cmd/sf.c                                   | 10 ++++++----
   common/spl/spl_spi.c                       | 11 ++++++-----
   common/splash_source.c                     | 11 ++++++-----
   drivers/dfu/dfu_sf.c                       | 10 ++++++++--
   env/Kconfig                                |  4 ++--
   env/sf.c                                   |  5 ++++-
   include/spi_flash.h                        | 18 ++++++++++++++++++
   9 files changed, 77 insertions(+), 23 deletions(-)

--
2.7.4