u-boot-brain/drivers
Wolfgang Wallner 720f9e1fdb serial: ns16550: Move PCI access from ofdata_to_platdata() to probe()
Currently the ofdata_to_platdata() method calls dev_read_addr_pci(),
which potentially accesses the parent PCI bus. If this happens before
the parent PCI bus is probed the resulting address will be wrong.

This behavior was triggered by commit 82de42fa14 ("dm: core:
Allocate parent data separate from probing parent").

According to a comment in drivers/pci/pci-uclass.c [1] accessing
the PCI parent bus in ofdata_to_platdata() is not allowed, and the
access should be moved to the probe() function.

Move the call to dev_read_addr_pci() and the related handling of the
'addr' value from the ofdata_to_platdata() to its own function,
which is then called from the probe() method.

While moving the code, the comment /* try Processor Local Bus device
first */ was dropped. It was initially added with commit 3db886a5bf
("serial: ns16550: Support ns16550 compatible pci uart devices") and
later made obsolete with commit 33c215af4b ("dm: pci: Add a function
to read a PCI BAR").

[1] Comment in drivers/pci/pci-uclass.c:
"A common cause of this problem is that this function is called in the
ofdata_to_platdata() method of @dev. Accessing the PCI bus in that
method is not allowed, since it has not yet been probed. To fix this,
move that access to the probe() method of @dev instead."

Fixes: 82de42fa14 ("dm: core: Allocate parent data separate from probing parent")
Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # Tested on Intel Galileo
2020-03-05 18:25:10 +08:00
..
adc dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
ata Revert "ata: fsl_ahci: Add sata DM support for Freescale powerpc socs" 2020-02-25 10:16:05 +05:30
axi dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
bios_emulator bios_emulator: remove stray break 2019-08-09 22:24:02 +08:00
block dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
board drivers: board: Add get_fit_loadable() 2020-01-07 11:13:24 -05:00
bootcount bootcount: add a DM i2c eeprom backing store for bootcount 2020-01-10 10:25:13 -05:00
cache common: Move hang() to the same header as panic() 2020-01-24 23:06:49 +05:30
clk x86: remove dead code in intel_clk_get_rate() 2020-03-05 18:19:40 +08:00
core dm: core: Add a flag for power domain control on device removal 2020-03-02 19:47:38 -07:00
cpu Move strtomhz() to vsprintf.h 2019-12-02 18:23:09 -05:00
crypto crypto: make mod_exp_sw() static 2020-01-25 12:04:36 -05:00
ddr sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
demo SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dfu dm: core: Require users of devres to include the header 2020-02-05 19:33:46 -07:00
dma dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
fastboot fastboot: mt85xx: add command to flash/erase emmc hwpart 2020-01-25 12:04:36 -05:00
firmware dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
fpga dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
gpio sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
hwspinlock dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
i2c i2c: designware_i2c: Correct the selection of speed mode 2020-02-18 08:16:45 +01:00
input input: Move input.o to be built only in some cases 2019-11-19 17:43:04 -05:00
led dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
mailbox dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
memory SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
misc misc: k3_avs: Fix possible NULL pointer deference 2020-02-26 18:35:29 +05:30
mmc mmc: sdhci: fix missing cache invalidation after reading by DMA 2020-02-20 15:09:57 +08:00
mtd mtd: nand: Fix on-die ecc issues in arasan_nfc driver 2020-02-28 12:04:10 +01:00
net net: zynq: Free allocated buffers in case of error 2020-02-28 12:04:10 +01:00
nvme dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
pch x86: Allow removal of standard PCH drivers 2019-12-15 11:44:16 +08:00
pci dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
pci_endpoint pci_ep: Fix Coverity warning 2019-08-07 15:31:04 -04:00
phy dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
pinctrl pinctrl: stmfx: update the result type of dm_i2c_reg_read 2020-02-13 18:47:00 +01:00
power sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
pwm pwm: rk_pwm: Make PWM driver to support all Rockchip Socs 2019-12-06 00:06:23 +08:00
qe crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
ram ram: rockchip: Fix Kconfig dependency for RAM_ROCKCHIP_DEBUG 2020-02-13 10:10:50 -05:00
remoteproc dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
reset sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
rng stm32mp1: rng: remove superfluous assignment 2020-03-02 09:41:31 +01:00
rtc rtc: m41t62: add compatible for m41st87 2020-03-01 22:07:32 +01:00
scsi scsi: Add dma direction member to command structure 2019-10-23 20:47:12 -04:00
serial serial: ns16550: Move PCI access from ofdata_to_platdata() to probe() 2020-03-05 18:25:10 +08:00
smem dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
soc dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
sound dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
spi dm: core: Drop the inclusion of linux/compat.h in dm.h 2020-02-05 21:48:22 -07:00
spmi dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
sysreset dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
tee dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
thermal thermal: ti-bandgap: Fix adc value datatype 2020-01-20 10:10:28 +05:30
timer dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
tpm sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
ufs dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
usb gadget: f_thor: add missing line breaks for pr_err() 2020-03-01 21:58:54 +01:00
video video: meson: keep power domain up after booting 2020-03-02 19:47:38 -07:00
virtio dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
w1 dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
w1-eeprom dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
watchdog watchdog: Don't select CONFIG_WATCHDOG and CONFIG_HW_WATCHDOG at the same time 2020-02-28 10:53:55 -05:00
Kconfig dm: rng: Add random number generator(rng) uclass 2020-01-07 18:08:21 +01:00
Makefile Kconfig: Rename CONFIG_SPL_DMA_SUPPORT to CONFIG_SPL_DMA 2020-01-15 19:50:27 -05:00