public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [rockchip] broken SPI on RockPro64 and other RK3399 targets
@ 2020-11-05 15:55 Marcin Juszkiewicz
  2020-11-05 16:49 ` Alper Nebi Yasak
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Juszkiewicz @ 2020-11-05 15:55 UTC (permalink / raw)
  To: u-boot

I wanted to update U-Boot on my RockPro64 board from some random build 
of 2020.07-rc with out of tree patches to official one. Built, flashed 
and then got this:

Loading Environment from SPI Flash... Invalid bus 0 (err=-19)
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

According to Peter Robinson it happens also on other RK3399 boards.

As I had a bit of time I started bisecting and found reason:

16:43 (7s) hrw at puchatek:u-boot$ git bisect good
c4cea2bbf995764f325a907061c22ecd6768cf7b is the first bad commit
commit c4cea2bbf995764f325a907061c22ecd6768cf7b
Author: Simon Glass <sjg@chromium.org>
Date:   Sun Jul 19 13:55:58 2020 -0600

     rockchip: Enable building a SPI ROM image on bob

     Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot
     produces a ROM for bob.

     Signed-off-by: Simon Glass <sjg@chromium.org>

  arch/arm/dts/rk3399-gru-u-boot.dtsi   |  4 ++++
  arch/arm/dts/rk3399-gru.dtsi          |  2 +-
  arch/arm/dts/rk3399-u-boot.dtsi       | 27 +++++++++++++++++++++++++++
  arch/arm/mach-rockchip/rk3399/Kconfig |  2 ++
  4 files changed, 34 insertions(+), 1 deletion(-)

Then I checked out HEAD of master branch, reverted that patch and SPI 
flash got detected properly.

Not looked yet on how it should be fixed.

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

* [rockchip] broken SPI on RockPro64 and other RK3399 targets
  2020-11-05 15:55 [rockchip] broken SPI on RockPro64 and other RK3399 targets Marcin Juszkiewicz
@ 2020-11-05 16:49 ` Alper Nebi Yasak
  2020-11-05 17:04   ` Marcin Juszkiewicz
  0 siblings, 1 reply; 5+ messages in thread
From: Alper Nebi Yasak @ 2020-11-05 16:49 UTC (permalink / raw)
  To: u-boot

On 05/11/2020 18:55, Marcin Juszkiewicz wrote:
> I wanted to update U-Boot on my RockPro64 board from some random build 
> of 2020.07-rc with out of tree patches to official one. Built, flashed 
> and then got this:
> 
> Loading Environment from SPI Flash... Invalid bus 0 (err=-19)
> *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> According to Peter Robinson it happens also on other RK3399 boards.

FYI: SPI flash commands work for me on rk3399-gru-kevin after just
adding the JEDEC ID things for its chip (with CONFIG_SF_DEFAULT_BUS=1)
but I haven't tried loading environment from it yet (doing weird
out-of-tree things to run U-Boot anyway).

> As I had a bit of time I started bisecting and found reason:
> 
> 16:43 (7s) hrw at puchatek:u-boot$ git bisect good
> c4cea2bbf995764f325a907061c22ecd6768cf7b is the first bad commit
> commit c4cea2bbf995764f325a907061c22ecd6768cf7b
> Author: Simon Glass <sjg@chromium.org>
> Date:   Sun Jul 19 13:55:58 2020 -0600
> 
>      rockchip: Enable building a SPI ROM image on bob
> 
>      Add a simple binman config and enable CONFIG_HAS_ROM so that U-Boot
>      produces a ROM for bob.
> 
>      Signed-off-by: Simon Glass <sjg@chromium.org>
> 
>   arch/arm/dts/rk3399-gru-u-boot.dtsi   |  4 ++++
>   arch/arm/dts/rk3399-gru.dtsi          |  2 +-
>   arch/arm/dts/rk3399-u-boot.dtsi       | 27 +++++++++++++++++++++++++++
>   arch/arm/mach-rockchip/rk3399/Kconfig |  2 ++
>   4 files changed, 34 insertions(+), 1 deletion(-)
> 
> Then I checked out HEAD of master branch, reverted that patch and SPI 
> flash got detected properly.
> 
> Not looked yet on how it should be fixed.

I suspect this change in that commit (rk3399-u-boot.dtsi):

>  / {
>         aliases {
>                 mmc0 = &sdhci;
>                 mmc1 = &sdmmc;
>                 pci0 = &pcie0;
> +               spi1 = &spi1;
>         };

Can you test adding spi0 = &spi0; above that in the list?

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

* [rockchip] broken SPI on RockPro64 and other RK3399 targets
  2020-11-05 16:49 ` Alper Nebi Yasak
@ 2020-11-05 17:04   ` Marcin Juszkiewicz
  2020-11-05 19:50     ` Alper Nebi Yasak
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Juszkiewicz @ 2020-11-05 17:04 UTC (permalink / raw)
  To: u-boot

W dniu 05.11.2020 o?17:49, Alper Nebi Yasak pisze:

> I suspect this change in that commit (rk3399-u-boot.dtsi):
> 
>>   / {
>>          aliases {
>>                  mmc0 = &sdhci;
>>                  mmc1 = &sdmmc;
>>                  pci0 = &pcie0;
>> +               spi1 = &spi1;
>>          };
> 
> Can you test adding spi0 = &spi0; above that in the list?

Helps ;D

=> sf probe
SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 
16 MiB

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

* [rockchip] broken SPI on RockPro64 and other RK3399 targets
  2020-11-05 17:04   ` Marcin Juszkiewicz
@ 2020-11-05 19:50     ` Alper Nebi Yasak
  2020-11-10 19:45       ` Simon South
  0 siblings, 1 reply; 5+ messages in thread
From: Alper Nebi Yasak @ 2020-11-05 19:50 UTC (permalink / raw)
  To: u-boot

On 05/11/2020 20:04, Marcin Juszkiewicz wrote:
> W dniu 05.11.2020 o?17:49, Alper Nebi Yasak pisze:
> 
>> I suspect this change in that commit (rk3399-u-boot.dtsi):
>>
>>>   / {
>>>          aliases {
>>>                  mmc0 = &sdhci;
>>>                  mmc1 = &sdmmc;
>>>                  pci0 = &pcie0;
>>> +               spi1 = &spi1;
>>>          };
>>
>> Can you test adding spi0 = &spi0; above that in the list?
> 
> Helps ;D
> 
> => sf probe
> SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 
> 16 MiB
> 

I looked around a bit more and saw rk3399-<board>-u-boot.dtsi files
(including rockpro64) defining a "spi0 = &spi1;" alias, so I guess what
I suggested would be overridden by that and is actually a no-op?

Maybe two aliases pointing to the same bus is what's really causing the
problem?

Something else you can test:
- Remove the aliases block from rk3399-rockpro64-u-boot.dtsi
- Add "spi[0-5] = &spi[0-5];" aliases to rk3399-u-boot.dtsi
- Add CONFIG_SF_DEFAULT_BUS=1 to configs/rockpro64-rk3399_defconfig

I guess that's the proper solution if it works.

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

* [rockchip] broken SPI on RockPro64 and other RK3399 targets
  2020-11-05 19:50     ` Alper Nebi Yasak
@ 2020-11-10 19:45       ` Simon South
  0 siblings, 0 replies; 5+ messages in thread
From: Simon South @ 2020-11-10 19:45 UTC (permalink / raw)
  To: u-boot

Alper Nebi Yasak <alpernebiyasak@gmail.com> writes:
> Something else you can test:
> - Remove the aliases block from rk3399-rockpro64-u-boot.dtsi
> - Add "spi[0-5] = &spi[0-5];" aliases to rk3399-u-boot.dtsi
> - Add CONFIG_SF_DEFAULT_BUS=1 to configs/rockpro64-rk3399_defconfig

This fixed for me the same issue on my Pinebook Pro, turning

  Loading Environment from SPIFlash... Invalid bus 0 (err=-19)
  *** Warning - spi_flash_probe_bus_cs() failed, using default environment

into

  Loading Environment from SPIFlash... SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB

Patch attached, for clarity.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rockchip-Pinebook-Pro-Fix-SPI-flash.patch
Type: text/x-patch
Size: 1755 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201110/2f61e17d/attachment.bin>
-------------- next part --------------

-- 
Simon South
simon at simonsouth.net

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

end of thread, other threads:[~2020-11-10 19:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-05 15:55 [rockchip] broken SPI on RockPro64 and other RK3399 targets Marcin Juszkiewicz
2020-11-05 16:49 ` Alper Nebi Yasak
2020-11-05 17:04   ` Marcin Juszkiewicz
2020-11-05 19:50     ` Alper Nebi Yasak
2020-11-10 19:45       ` Simon South

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