u-boot/drivers
Vladimir Oltean f27bc8afd5 net: phy: fixed: Be compatible with live OF tree
On systems that use CONFIG_OF_LIVE, the "ofnode" type is defined
as const struct device_node *np, while on the flat DT systems it
is defined as a long of_offset into gd->fdt_blob.

It is desirable that the fixed PHY driver uses the higher-level
ofnode abstraction instead of parsing gd->fdt_blob directly,
because that enables it to work on live OF systems.

The fixed PHY driver has used a nasty hack since its introduction in
commit db40c1aa1c ("drivers/net/phy: add fixed-phy /
fixed-link support"),
which is to pass the long gd->fdt_blob offset inside int phydev->addr
(a value that normally holds the MDIO bus address at which the PHY
responds). Even ignoring the fact that the types were already
mismatched leading to a potential truncation (flat OF offset was
supposed to be a long and not an int), we really cannot extend this
hack any longer, because there's no way an int will hold the other
representation of ofnode, the struct device_node *np.

So we unfortunately need to do the right thing, which is to use the
framework introduced by Grygorii Strashko in
commit eef0b8a930 ("net: phy: add ofnode node to struct phy_device").
This will populate phydev->node for the fixed PHY.

Note that phydev->node will not be valid in the probe function, since
that is called synchronously from phy_device_create and we really have
no way of passing the ofnode directly through the phy_device_create API.
So we do what other drivers do too: we move the OF parsing logic from
the .probe to the .config method of the PHY driver. The new function
will be called at phy_config() time.

I do believe I've converted all the possible call paths for creating
a PHY with PHY_FIXED_ID, so there is really no reason to maintain
compatibility with the old logic of retrieving a flat OF tree offset
from phydev->addr. We just pass 0 to phydev->addr now.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210216224804.3355044-2-olteanv@gmail.com>
[bmeng: keep fixedphy_probe(); update mdio-uclass.c to handle fixed phy]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-04-15 14:22:17 +05:30
..
adc adc: meson-saradc: add support for getting reference voltage value 2021-02-18 11:37:26 +01:00
ata drivers: ata: Remove mvsata_ide driver 2021-04-10 07:59:30 -04:00
axi dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bios_emulator common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
block sandbox: Provide a way to bind fixed/removeable devices 2021-03-27 15:04:31 +13:00
bootcount common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
bus bus: ti-sysc: change in a normal driver 2021-03-22 19:23:27 +13:00
button button: adc: fix treshold typo 2021-03-08 10:32:34 +01:00
cache common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
clk clk: mpfs_clk: Enable DM_FLAG_PRE_RELOC flag 2021-04-08 15:37:30 +08:00
core of: extra: Introduce ofnode_phy_is_fixed_link() API 2021-04-15 14:22:17 +05:30
cpu common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
crypto crypto: fsl: refactor for 32 bit version CAAM support on ARM64 2021-04-08 20:29:53 +02:00
ddr ppc: Remove Cyrus_P5020 and P5040 boards 2021-04-10 08:05:07 -04:00
demo common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
dfu dfu: dfu_sf: avoid double free of SPI device 2021-03-25 20:15:30 +01:00
dma dma: bcm6348: incorrect buffer allocation 2021-01-18 15:23:06 -05:00
fastboot fastboot: Fix possible buffer overrun 2021-04-12 17:44:55 -04:00
firmware scmi: translate the resource only when livetree is not activated 2021-04-12 17:45:40 -04:00
fpga arm: socfpga: Move Stratix10 and Agilex to use TARGET_SOCFPGA_SOC64 2021-03-08 10:59:10 +08:00
gpio gpio: Drop dm_gpio_set_dir() 2021-04-12 17:45:40 -04:00
hwspinlock common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
i2c gpio: i2c-gpio: Drop use of dm_gpio_set_dir() 2021-04-12 17:45:40 -04:00
input common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
led dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
mailbox common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
memory memory: stm32-fmc2: migrate trace to dev and log macro 2021-01-13 09:52:58 +01:00
misc qemu: add MMIO driver for QFW 2021-04-12 17:45:40 -04:00
mmc arm: Remove s32v234evb board 2021-04-10 08:01:00 -04:00
mtd mtd: Update fail_addr when erase fails due to bad blocks 2021-04-12 17:17:11 -04:00
mux dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
net net: phy: fixed: Be compatible with live OF tree 2021-04-15 14:22:17 +05:30
nvme nvme: Elaborate on cache maintenance operation in get/set_features 2021-03-19 10:36:55 -04:00
pch dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
pci pci: Mark 64bit Memory BARs as such 2021-04-12 17:17:11 -04:00
pci_endpoint common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
phy Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
pinctrl pinctrl: Return -ENOSYS when system call is not available 2021-04-06 16:33:19 +12:00
power firmware: scmi: voltage regulator 2021-04-12 17:17:11 -04:00
pwm pwm: Add a driver for Chrome OS EC PWM 2021-04-10 16:08:39 +02:00
qe ppc: Remove TARGET_T1040QDS references 2021-04-10 08:04:42 -04:00
ram Add rt-thread art-pi board support based on STM32H750 SoC 2021-04-09 13:10:59 -04:00
remoteproc Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
reset riscv: sifive: Rename fu540 board to unleashed 2021-04-08 15:37:29 +08:00
rng rng: iproc_rng200: Enable support for RPi4 armv7 2021-03-02 13:53:48 +01:00
rtc rtc: add support for rv3028 rtc 2021-04-12 17:44:55 -04:00
scsi dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial arm: Remove apf27 board 2021-04-10 07:59:35 -04:00
smem Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
soc dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
sound tegra: i2c: Drop LOG_DEBUG 2021-03-27 13:59:36 +13:00
spi Xilinx changes for v2021.07 2021-03-31 09:47:30 -04:00
spmi common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
sysinfo dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
sysreset Prepare v2021.04-rc4 2021-03-15 12:15:38 -04:00
tee tee: optee: Change printing during optee_probe 2021-04-12 17:44:55 -04:00
thermal thermal: imx_tmu: enable monitoring and default alert/critical 2021-03-01 10:21:36 +01:00
timer timer: sifive_clint: Support the official clint DT bindings 2021-04-08 15:37:29 +08:00
tpm tpm: Correct warning on 32-bit build 2021-03-13 13:14:52 -05:00
ufs dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
usb lib: string: Implement strlcat 2021-04-12 17:44:55 -04:00
video video: Fix line padding calculation for 16 and 24 BPP bitmaps 2021-04-10 17:09:59 +02:00
virtio virtio: Fix VirtIO BLK driver dependency 2021-03-05 10:25:43 +05:30
w1 w1: mxc: fix build 2021-01-23 11:30:31 +01:00
w1-eeprom dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
watchdog watchdog: Add booke watchdog driver 2021-04-15 14:22:17 +05:30
xen common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
Kconfig board: Rename uclass to sysinfo 2020-11-06 10:18:20 +08:00
Makefile cpu: Rename SPL_CPU_SUPPORT to SPL_CPU 2021-03-27 15:04:31 +13:00