mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-30 08:03:32 +08:00
spi: Fix manual relocation calling more times
When two instances of AXI QSPI with flash are added and tested simultaneously the spi driver operations are relocated twice. As a result code is accessing addresses outside of RAM when relocated second time which is causing a crash. Tested on Microblaze. Similar change was done in past by: commitf238b3f0fb
("watchdog: dm: Support manual relocation for watchdogs") commit2588f2ddfd
("dm: sf: Add support for all targets which requires MANUAL_RELOC") commit1b4c2aa25b
("gpio: dm: Support manual relocation for gpio") Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
parent
312f2c5b14
commit
4d9b1afa41
@ -170,21 +170,25 @@ static int spi_post_probe(struct udevice *bus)
|
||||
#endif
|
||||
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
|
||||
struct dm_spi_ops *ops = spi_get_ops(bus);
|
||||
static int reloc_done;
|
||||
|
||||
if (ops->claim_bus)
|
||||
ops->claim_bus += gd->reloc_off;
|
||||
if (ops->release_bus)
|
||||
ops->release_bus += gd->reloc_off;
|
||||
if (ops->set_wordlen)
|
||||
ops->set_wordlen += gd->reloc_off;
|
||||
if (ops->xfer)
|
||||
ops->xfer += gd->reloc_off;
|
||||
if (ops->set_speed)
|
||||
ops->set_speed += gd->reloc_off;
|
||||
if (ops->set_mode)
|
||||
ops->set_mode += gd->reloc_off;
|
||||
if (ops->cs_info)
|
||||
ops->cs_info += gd->reloc_off;
|
||||
if (!reloc_done) {
|
||||
if (ops->claim_bus)
|
||||
ops->claim_bus += gd->reloc_off;
|
||||
if (ops->release_bus)
|
||||
ops->release_bus += gd->reloc_off;
|
||||
if (ops->set_wordlen)
|
||||
ops->set_wordlen += gd->reloc_off;
|
||||
if (ops->xfer)
|
||||
ops->xfer += gd->reloc_off;
|
||||
if (ops->set_speed)
|
||||
ops->set_speed += gd->reloc_off;
|
||||
if (ops->set_mode)
|
||||
ops->set_mode += gd->reloc_off;
|
||||
if (ops->cs_info)
|
||||
ops->cs_info += gd->reloc_off;
|
||||
reloc_done++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user