diff mbox series

Revert "spi: spi-uclass: Add support to manually relocate spi memory ops"

Message ID 20210722152529.1407976-1-pbrobinson@gmail.com
State Rejected
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series Revert "spi: spi-uclass: Add support to manually relocate spi memory ops" | expand

Commit Message

Peter Robinson July 22, 2021, 3:25 p.m. UTC
This reverts commit 346df7d4fa62afc578d820b3a18815eec765074f.

This patch broke booting Rockchip systems from U-Boot residing on SPI
flash, for at least the Pinebook Pro and Rockpro64, and also confirmed
with the not yet upstream Helios64.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Pratyush Yadav <p.yadav@ti.com>
---
 drivers/spi/spi-uclass.c | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Michal Simek July 22, 2021, 4:04 p.m. UTC | #1
On 7/22/21 5:25 PM, Peter Robinson wrote:
> This reverts commit 346df7d4fa62afc578d820b3a18815eec765074f.
> 
> This patch broke booting Rockchip systems from U-Boot residing on SPI
> flash, for at least the Pinebook Pro and Rockpro64, and also confirmed
> with the not yet upstream Helios64.
> 
> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Pratyush Yadav <p.yadav@ti.com>
> ---
>  drivers/spi/spi-uclass.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
> index d867b27806..ec7f4652b3 100644
> --- a/drivers/spi/spi-uclass.c
> +++ b/drivers/spi/spi-uclass.c
> @@ -11,7 +11,6 @@
>  #include <log.h>
>  #include <malloc.h>
>  #include <spi.h>
> -#include <spi-mem.h>
>  #include <dm/device_compat.h>
>  #include <asm/global_data.h>
>  #include <dm/device-internal.h>
> @@ -200,16 +199,6 @@ static int spi_post_probe(struct udevice *bus)
>  			ops->set_mode += gd->reloc_off;
>  		if (ops->cs_info)
>  			ops->cs_info += gd->reloc_off;
> -		if (ops->mem_ops) {
> -			struct spi_controller_mem_ops *mem_ops =
> -				(struct spi_controller_mem_ops *)ops->mem_ops;
> -			if (mem_ops->adjust_op_size)
> -				mem_ops->adjust_op_size += gd->reloc_off;
> -			if (mem_ops->supports_op)
> -				mem_ops->supports_op += gd->reloc_off;
> -			if (mem_ops->exec_op)
> -				mem_ops->exec_op += gd->reloc_off;
> -		}
>  		reloc_done++;
>  	}
>  #endif
> 

This is protected by CONFIG_NEEDS_MANUAL_RELOC which is only enable for
m68k and microblaze. I expect rockchip is arm and you should never have
this code in your binary. That's why please double check it.

Thanks,
Michal
Tom Rini July 22, 2021, 5:30 p.m. UTC | #2
On Thu, Jul 22, 2021 at 06:04:40PM +0200, Michal Simek wrote:
> 
> 
> On 7/22/21 5:25 PM, Peter Robinson wrote:
> > This reverts commit 346df7d4fa62afc578d820b3a18815eec765074f.
> > 
> > This patch broke booting Rockchip systems from U-Boot residing on SPI
> > flash, for at least the Pinebook Pro and Rockpro64, and also confirmed
> > with the not yet upstream Helios64.
> > 
> > Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> > Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> > Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> > Cc: Michal Simek <michal.simek@xilinx.com>
> > Cc: Pratyush Yadav <p.yadav@ti.com>
> > ---
> >  drivers/spi/spi-uclass.c | 11 -----------
> >  1 file changed, 11 deletions(-)
> > 
> > diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
> > index d867b27806..ec7f4652b3 100644
> > --- a/drivers/spi/spi-uclass.c
> > +++ b/drivers/spi/spi-uclass.c
> > @@ -11,7 +11,6 @@
> >  #include <log.h>
> >  #include <malloc.h>
> >  #include <spi.h>
> > -#include <spi-mem.h>
> >  #include <dm/device_compat.h>
> >  #include <asm/global_data.h>
> >  #include <dm/device-internal.h>
> > @@ -200,16 +199,6 @@ static int spi_post_probe(struct udevice *bus)
> >  			ops->set_mode += gd->reloc_off;
> >  		if (ops->cs_info)
> >  			ops->cs_info += gd->reloc_off;
> > -		if (ops->mem_ops) {
> > -			struct spi_controller_mem_ops *mem_ops =
> > -				(struct spi_controller_mem_ops *)ops->mem_ops;
> > -			if (mem_ops->adjust_op_size)
> > -				mem_ops->adjust_op_size += gd->reloc_off;
> > -			if (mem_ops->supports_op)
> > -				mem_ops->supports_op += gd->reloc_off;
> > -			if (mem_ops->exec_op)
> > -				mem_ops->exec_op += gd->reloc_off;
> > -		}
> >  		reloc_done++;
> >  	}
> >  #endif
> > 
> 
> This is protected by CONFIG_NEEDS_MANUAL_RELOC which is only enable for
> m68k and microblaze. I expect rockchip is arm and you should never have
> this code in your binary. That's why please double check it.

Yes, this really doesn't make sense.  Try also just removing spi-mem.h
from the file and see if that causes things to work again.  If so, time
to dig in to that header file to figure out what could be going wrong.
Dennis Gilmore July 24, 2021, 2:46 a.m. UTC | #3
removing the header is not sufficient to have the boards booting from SPI.

U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
Trying to boot from SPI

At this point u-boot hangs, with the patch reverted I get the following
U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
Trying to boot from SPI


U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)

SoC: Rockchip rk3399
Reset cause: RST
Model: Kobol Helios64
Revision: 0.0 - Unknown
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from SPIFlash... SF: Detected w25q128 with page
size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Kobol Helios64
Revision: UNKNOWN
Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
busNo ethernet found.

starting USB...
Bus usb@fe900000: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe900000 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
** No partition table - mmc 0 **
Couldn't find partition mmc 0:1
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Scanning disk mmc@fe320000.blk...
Scanning disk mmc@fe330000.blk...
** Unrecognized filesystem type **
Found 5 disks
dw_dm_mdio_init: mdio node is missing, registering legacy mdio
busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
busLoading Boot0000 'Fedora' failed
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootaa64.efi

On Thu, Jul 22, 2021 at 12:30 PM Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Jul 22, 2021 at 06:04:40PM +0200, Michal Simek wrote:
> >
> >
> > On 7/22/21 5:25 PM, Peter Robinson wrote:
> > > This reverts commit 346df7d4fa62afc578d820b3a18815eec765074f.
> > >
> > > This patch broke booting Rockchip systems from U-Boot residing on SPI
> > > flash, for at least the Pinebook Pro and Rockpro64, and also confirmed
> > > with the not yet upstream Helios64.
> > >
> > > Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> > > Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> > > Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> > > Cc: Michal Simek <michal.simek@xilinx.com>
> > > Cc: Pratyush Yadav <p.yadav@ti.com>
> > > ---
> > >  drivers/spi/spi-uclass.c | 11 -----------
> > >  1 file changed, 11 deletions(-)
> > >
> > > diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
> > > index d867b27806..ec7f4652b3 100644
> > > --- a/drivers/spi/spi-uclass.c
> > > +++ b/drivers/spi/spi-uclass.c
> > > @@ -11,7 +11,6 @@
> > >  #include <log.h>
> > >  #include <malloc.h>
> > >  #include <spi.h>
> > > -#include <spi-mem.h>
> > >  #include <dm/device_compat.h>
> > >  #include <asm/global_data.h>
> > >  #include <dm/device-internal.h>
> > > @@ -200,16 +199,6 @@ static int spi_post_probe(struct udevice *bus)
> > >                     ops->set_mode += gd->reloc_off;
> > >             if (ops->cs_info)
> > >                     ops->cs_info += gd->reloc_off;
> > > -           if (ops->mem_ops) {
> > > -                   struct spi_controller_mem_ops *mem_ops =
> > > -                           (struct spi_controller_mem_ops *)ops->mem_ops;
> > > -                   if (mem_ops->adjust_op_size)
> > > -                           mem_ops->adjust_op_size += gd->reloc_off;
> > > -                   if (mem_ops->supports_op)
> > > -                           mem_ops->supports_op += gd->reloc_off;
> > > -                   if (mem_ops->exec_op)
> > > -                           mem_ops->exec_op += gd->reloc_off;
> > > -           }
> > >             reloc_done++;
> > >     }
> > >  #endif
> > >
> >
> > This is protected by CONFIG_NEEDS_MANUAL_RELOC which is only enable for
> > m68k and microblaze. I expect rockchip is arm and you should never have
> > this code in your binary. That's why please double check it.
>
> Yes, this really doesn't make sense.  Try also just removing spi-mem.h
> from the file and see if that causes things to work again.  If so, time
> to dig in to that header file to figure out what could be going wrong.
>
> --
> Tom
Tom Rini July 24, 2021, 3:25 a.m. UTC | #4
On Fri, Jul 23, 2021 at 09:46:44PM -0500, Dennis Gilmore wrote:

> removing the header is not sufficient to have the boards booting from SPI.
> 
> U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
> Channel 0: LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> Channel 1: LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> 256B stride
> lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> Trying to boot from BOOTROM
> Returning to boot ROM...
> 
> U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
> Trying to boot from SPI
> 
> At this point u-boot hangs, with the patch reverted I get the following
> U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
> Channel 0: LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> Channel 1: LPDDR4, 50MHz
> BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> 256B stride
> lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> Trying to boot from BOOTROM
> Returning to boot ROM...
> 
> U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> Trying to boot from SPI
> 
> 
> U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> 
> SoC: Rockchip rk3399
> Reset cause: RST
> Model: Kobol Helios64
> Revision: 0.0 - Unknown
> DRAM:  3.9 GiB
> PMIC:  RK808
> MMC:   mmc@fe320000: 1, mmc@fe330000: 0
> Loading Environment from SPIFlash... SF: Detected w25q128 with page
> size 256 Bytes, erase size 4 KiB, total 16 MiB
> *** Warning - bad CRC, using default environment
> 
> In:    serial@ff1a0000
> Out:   serial@ff1a0000
> Err:   serial@ff1a0000
> Model: Kobol Helios64
> Revision: UNKNOWN
> Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> busNo ethernet found.
> 
> starting USB...
> Bus usb@fe900000: usb maximum-speed not found
> Register 2000140 NbrPorts 2
> Starting the controller
> USB XHCI 1.10
> scanning bus usb@fe900000 for devices... 2 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> switch to partitions #0, OK
> mmc0(part 0) is current device
> ** No partition table - mmc 0 **
> Couldn't find partition mmc 0:1
> switch to partitions #0, OK
> mmc1 is current device
> Scanning mmc 1:1...
> Scanning disk mmc@fe320000.blk...
> Scanning disk mmc@fe330000.blk...
> ** Unrecognized filesystem type **
> Found 5 disks
> dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
> busLoading Boot0000 'Fedora' failed
> EFI boot manager: Cannot load any image
> Found EFI removable media binary efi/boot/bootaa64.efi

Is LTO on, on these platforms?  That code in question really should not
be enabled, at all.  Like, if you toss an #error in that section of
code, it should still build.  It does, right?
Dennis Gilmore July 24, 2021, 3:49 a.m. UTC | #5
On Fri, Jul 23, 2021 at 10:25 PM Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, Jul 23, 2021 at 09:46:44PM -0500, Dennis Gilmore wrote:
>
> > removing the header is not sufficient to have the boards booting from SPI.
> >
> > U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
> > Channel 0: LPDDR4, 50MHz
> > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > Channel 1: LPDDR4, 50MHz
> > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > 256B stride
> > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > Trying to boot from BOOTROM
> > Returning to boot ROM...
> >
> > U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
> > Trying to boot from SPI
> >
> > At this point u-boot hangs, with the patch reverted I get the following
> > U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
> > Channel 0: LPDDR4, 50MHz
> > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > Channel 1: LPDDR4, 50MHz
> > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > 256B stride
> > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > Trying to boot from BOOTROM
> > Returning to boot ROM...
> >
> > U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > Trying to boot from SPI
> >
> >
> > U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> >
> > SoC: Rockchip rk3399
> > Reset cause: RST
> > Model: Kobol Helios64
> > Revision: 0.0 - Unknown
> > DRAM:  3.9 GiB
> > PMIC:  RK808
> > MMC:   mmc@fe320000: 1, mmc@fe330000: 0
> > Loading Environment from SPIFlash... SF: Detected w25q128 with page
> > size 256 Bytes, erase size 4 KiB, total 16 MiB
> > *** Warning - bad CRC, using default environment
> >
> > In:    serial@ff1a0000
> > Out:   serial@ff1a0000
> > Err:   serial@ff1a0000
> > Model: Kobol Helios64
> > Revision: UNKNOWN
> > Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > busNo ethernet found.
> >
> > starting USB...
> > Bus usb@fe900000: usb maximum-speed not found
> > Register 2000140 NbrPorts 2
> > Starting the controller
> > USB XHCI 1.10
> > scanning bus usb@fe900000 for devices... 2 USB Device(s) found
> >        scanning usb for storage devices... 0 Storage Device(s) found
> > Hit any key to stop autoboot:  0
> > switch to partitions #0, OK
> > mmc0(part 0) is current device
> > ** No partition table - mmc 0 **
> > Couldn't find partition mmc 0:1
> > switch to partitions #0, OK
> > mmc1 is current device
> > Scanning mmc 1:1...
> > Scanning disk mmc@fe320000.blk...
> > Scanning disk mmc@fe330000.blk...
> > ** Unrecognized filesystem type **
> > Found 5 disks
> > dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > busLoading Boot0000 'Fedora' failed
> > EFI boot manager: Cannot load any image
> > Found EFI removable media binary efi/boot/bootaa64.efi
>
> Is LTO on, on these platforms?  That code in question really should not
> be enabled, at all.  Like, if you toss an #error in that section of
> code, it should still build.  It does, right?

It does still build if I put a #error in the middle of it

$ grep LTO .config
CONFIG_ARCH_SUPPORTS_LTO=y
# CONFIG_LTO is not set


LTO is not on


> --
> Tom
Tom Rini July 24, 2021, 4:03 p.m. UTC | #6
On Fri, Jul 23, 2021 at 10:49:39PM -0500, Dennis Gilmore wrote:
> On Fri, Jul 23, 2021 at 10:25 PM Tom Rini <trini@konsulko.com> wrote:
> >
> > On Fri, Jul 23, 2021 at 09:46:44PM -0500, Dennis Gilmore wrote:
> >
> > > removing the header is not sufficient to have the boards booting from SPI.
> > >
> > > U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
> > > Channel 0: LPDDR4, 50MHz
> > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > Channel 1: LPDDR4, 50MHz
> > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > 256B stride
> > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > Trying to boot from BOOTROM
> > > Returning to boot ROM...
> > >
> > > U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
> > > Trying to boot from SPI
> > >
> > > At this point u-boot hangs, with the patch reverted I get the following
> > > U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
> > > Channel 0: LPDDR4, 50MHz
> > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > Channel 1: LPDDR4, 50MHz
> > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > 256B stride
> > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > Trying to boot from BOOTROM
> > > Returning to boot ROM...
> > >
> > > U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > > Trying to boot from SPI
> > >
> > >
> > > U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > >
> > > SoC: Rockchip rk3399
> > > Reset cause: RST
> > > Model: Kobol Helios64
> > > Revision: 0.0 - Unknown
> > > DRAM:  3.9 GiB
> > > PMIC:  RK808
> > > MMC:   mmc@fe320000: 1, mmc@fe330000: 0
> > > Loading Environment from SPIFlash... SF: Detected w25q128 with page
> > > size 256 Bytes, erase size 4 KiB, total 16 MiB
> > > *** Warning - bad CRC, using default environment
> > >
> > > In:    serial@ff1a0000
> > > Out:   serial@ff1a0000
> > > Err:   serial@ff1a0000
> > > Model: Kobol Helios64
> > > Revision: UNKNOWN
> > > Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > busNo ethernet found.
> > >
> > > starting USB...
> > > Bus usb@fe900000: usb maximum-speed not found
> > > Register 2000140 NbrPorts 2
> > > Starting the controller
> > > USB XHCI 1.10
> > > scanning bus usb@fe900000 for devices... 2 USB Device(s) found
> > >        scanning usb for storage devices... 0 Storage Device(s) found
> > > Hit any key to stop autoboot:  0
> > > switch to partitions #0, OK
> > > mmc0(part 0) is current device
> > > ** No partition table - mmc 0 **
> > > Couldn't find partition mmc 0:1
> > > switch to partitions #0, OK
> > > mmc1 is current device
> > > Scanning mmc 1:1...
> > > Scanning disk mmc@fe320000.blk...
> > > Scanning disk mmc@fe330000.blk...
> > > ** Unrecognized filesystem type **
> > > Found 5 disks
> > > dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > busLoading Boot0000 'Fedora' failed
> > > EFI boot manager: Cannot load any image
> > > Found EFI removable media binary efi/boot/bootaa64.efi
> >
> > Is LTO on, on these platforms?  That code in question really should not
> > be enabled, at all.  Like, if you toss an #error in that section of
> > code, it should still build.  It does, right?
> 
> It does still build if I put a #error in the middle of it
> 
> $ grep LTO .config
> CONFIG_ARCH_SUPPORTS_LTO=y
> # CONFIG_LTO is not set
> 
> 
> LTO is not on

OK, so progress.  What toolchain are you using here?  And can you easily
re-test with one of the kernel.org ones, or if using one already 9.2.0
(or 11.1.0) ?
Dennis Gilmore July 24, 2021, 7:46 p.m. UTC | #7
On Sat, Jul 24, 2021 at 11:03 AM Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, Jul 23, 2021 at 10:49:39PM -0500, Dennis Gilmore wrote:
> > On Fri, Jul 23, 2021 at 10:25 PM Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Fri, Jul 23, 2021 at 09:46:44PM -0500, Dennis Gilmore wrote:
> > >
> > > > removing the header is not sufficient to have the boards booting from SPI.
> > > >
> > > > U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
> > > > Channel 0: LPDDR4, 50MHz
> > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > Channel 1: LPDDR4, 50MHz
> > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > 256B stride
> > > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > > Trying to boot from BOOTROM
> > > > Returning to boot ROM...
> > > >
> > > > U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
> > > > Trying to boot from SPI
> > > >
> > > > At this point u-boot hangs, with the patch reverted I get the following
> > > > U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
> > > > Channel 0: LPDDR4, 50MHz
> > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > Channel 1: LPDDR4, 50MHz
> > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > 256B stride
> > > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > > Trying to boot from BOOTROM
> > > > Returning to boot ROM...
> > > >
> > > > U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > > > Trying to boot from SPI
> > > >
> > > >
> > > > U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > > >
> > > > SoC: Rockchip rk3399
> > > > Reset cause: RST
> > > > Model: Kobol Helios64
> > > > Revision: 0.0 - Unknown
> > > > DRAM:  3.9 GiB
> > > > PMIC:  RK808
> > > > MMC:   mmc@fe320000: 1, mmc@fe330000: 0
> > > > Loading Environment from SPIFlash... SF: Detected w25q128 with page
> > > > size 256 Bytes, erase size 4 KiB, total 16 MiB
> > > > *** Warning - bad CRC, using default environment
> > > >
> > > > In:    serial@ff1a0000
> > > > Out:   serial@ff1a0000
> > > > Err:   serial@ff1a0000
> > > > Model: Kobol Helios64
> > > > Revision: UNKNOWN
> > > > Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > busNo ethernet found.
> > > >
> > > > starting USB...
> > > > Bus usb@fe900000: usb maximum-speed not found
> > > > Register 2000140 NbrPorts 2
> > > > Starting the controller
> > > > USB XHCI 1.10
> > > > scanning bus usb@fe900000 for devices... 2 USB Device(s) found
> > > >        scanning usb for storage devices... 0 Storage Device(s) found
> > > > Hit any key to stop autoboot:  0
> > > > switch to partitions #0, OK
> > > > mmc0(part 0) is current device
> > > > ** No partition table - mmc 0 **
> > > > Couldn't find partition mmc 0:1
> > > > switch to partitions #0, OK
> > > > mmc1 is current device
> > > > Scanning mmc 1:1...
> > > > Scanning disk mmc@fe320000.blk...
> > > > Scanning disk mmc@fe330000.blk...
> > > > ** Unrecognized filesystem type **
> > > > Found 5 disks
> > > > dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > busLoading Boot0000 'Fedora' failed
> > > > EFI boot manager: Cannot load any image
> > > > Found EFI removable media binary efi/boot/bootaa64.efi
> > >
> > > Is LTO on, on these platforms?  That code in question really should not
> > > be enabled, at all.  Like, if you toss an #error in that section of
> > > code, it should still build.  It does, right?
> >
> > It does still build if I put a #error in the middle of it
> >
> > $ grep LTO .config
> > CONFIG_ARCH_SUPPORTS_LTO=y
> > # CONFIG_LTO is not set
> >
> >
> > LTO is not on
>
> OK, so progress.  What toolchain are you using here?  And can you easily
> re-test with one of the kernel.org ones, or if using one already 9.2.0
> (or 11.1.0) ?


I have been using gcc 10.2.1, I will test with 11.1.1

Dennis

> --
> Tom
Tom Rini Aug. 2, 2021, 9:31 p.m. UTC | #8
On Sat, Jul 24, 2021 at 02:46:27PM -0500, Dennis Gilmore wrote:
> On Sat, Jul 24, 2021 at 11:03 AM Tom Rini <trini@konsulko.com> wrote:
> >
> > On Fri, Jul 23, 2021 at 10:49:39PM -0500, Dennis Gilmore wrote:
> > > On Fri, Jul 23, 2021 at 10:25 PM Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > On Fri, Jul 23, 2021 at 09:46:44PM -0500, Dennis Gilmore wrote:
> > > >
> > > > > removing the header is not sufficient to have the boards booting from SPI.
> > > > >
> > > > > U-Boot TPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57)
> > > > > Channel 0: LPDDR4, 50MHz
> > > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > > Channel 1: LPDDR4, 50MHz
> > > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > > 256B stride
> > > > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > > > Trying to boot from BOOTROM
> > > > > Returning to boot ROM...
> > > > >
> > > > > U-Boot SPL 2021.07-00768-g49373a3334-dirty (Jul 23 2021 - 20:42:57 -0500)
> > > > > Trying to boot from SPI
> > > > >
> > > > > At this point u-boot hangs, with the patch reverted I get the following
> > > > > U-Boot TPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51)
> > > > > Channel 0: LPDDR4, 50MHz
> > > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > > Channel 1: LPDDR4, 50MHz
> > > > > BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
> > > > > 256B stride
> > > > > lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> > > > > lpddr4_set_rate: change freq to 800000000 mhz 1, 0
> > > > > Trying to boot from BOOTROM
> > > > > Returning to boot ROM...
> > > > >
> > > > > U-Boot SPL 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > > > > Trying to boot from SPI
> > > > >
> > > > >
> > > > > U-Boot 2021.07-00769-g4af8bd872c-dirty (Jul 23 2021 - 21:20:51 -0500)
> > > > >
> > > > > SoC: Rockchip rk3399
> > > > > Reset cause: RST
> > > > > Model: Kobol Helios64
> > > > > Revision: 0.0 - Unknown
> > > > > DRAM:  3.9 GiB
> > > > > PMIC:  RK808
> > > > > MMC:   mmc@fe320000: 1, mmc@fe330000: 0
> > > > > Loading Environment from SPIFlash... SF: Detected w25q128 with page
> > > > > size 256 Bytes, erase size 4 KiB, total 16 MiB
> > > > > *** Warning - bad CRC, using default environment
> > > > >
> > > > > In:    serial@ff1a0000
> > > > > Out:   serial@ff1a0000
> > > > > Err:   serial@ff1a0000
> > > > > Model: Kobol Helios64
> > > > > Revision: UNKNOWN
> > > > > Net:   dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > > busNo ethernet found.
> > > > >
> > > > > starting USB...
> > > > > Bus usb@fe900000: usb maximum-speed not found
> > > > > Register 2000140 NbrPorts 2
> > > > > Starting the controller
> > > > > USB XHCI 1.10
> > > > > scanning bus usb@fe900000 for devices... 2 USB Device(s) found
> > > > >        scanning usb for storage devices... 0 Storage Device(s) found
> > > > > Hit any key to stop autoboot:  0
> > > > > switch to partitions #0, OK
> > > > > mmc0(part 0) is current device
> > > > > ** No partition table - mmc 0 **
> > > > > Couldn't find partition mmc 0:1
> > > > > switch to partitions #0, OK
> > > > > mmc1 is current device
> > > > > Scanning mmc 1:1...
> > > > > Scanning disk mmc@fe320000.blk...
> > > > > Scanning disk mmc@fe330000.blk...
> > > > > ** Unrecognized filesystem type **
> > > > > Found 5 disks
> > > > > dw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > > busdw_dm_mdio_init: mdio node is missing, registering legacy mdio
> > > > > busLoading Boot0000 'Fedora' failed
> > > > > EFI boot manager: Cannot load any image
> > > > > Found EFI removable media binary efi/boot/bootaa64.efi
> > > >
> > > > Is LTO on, on these platforms?  That code in question really should not
> > > > be enabled, at all.  Like, if you toss an #error in that section of
> > > > code, it should still build.  It does, right?
> > >
> > > It does still build if I put a #error in the middle of it
> > >
> > > $ grep LTO .config
> > > CONFIG_ARCH_SUPPORTS_LTO=y
> > > # CONFIG_LTO is not set
> > >
> > >
> > > LTO is not on
> >
> > OK, so progress.  What toolchain are you using here?  And can you easily
> > re-test with one of the kernel.org ones, or if using one already 9.2.0
> > (or 11.1.0) ?
> 
> 
> I have been using gcc 10.2.1, I will test with 11.1.1

Did you have a chance to further investigate this?
diff mbox series

Patch

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index d867b27806..ec7f4652b3 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -11,7 +11,6 @@ 
 #include <log.h>
 #include <malloc.h>
 #include <spi.h>
-#include <spi-mem.h>
 #include <dm/device_compat.h>
 #include <asm/global_data.h>
 #include <dm/device-internal.h>
@@ -200,16 +199,6 @@  static int spi_post_probe(struct udevice *bus)
 			ops->set_mode += gd->reloc_off;
 		if (ops->cs_info)
 			ops->cs_info += gd->reloc_off;
-		if (ops->mem_ops) {
-			struct spi_controller_mem_ops *mem_ops =
-				(struct spi_controller_mem_ops *)ops->mem_ops;
-			if (mem_ops->adjust_op_size)
-				mem_ops->adjust_op_size += gd->reloc_off;
-			if (mem_ops->supports_op)
-				mem_ops->supports_op += gd->reloc_off;
-			if (mem_ops->exec_op)
-				mem_ops->exec_op += gd->reloc_off;
-		}
 		reloc_done++;
 	}
 #endif