u-boot/drivers/phy
Eugen Hristev 3cc537842f phy: rockchip: inno-usb2: fix phy reg=0 case
The support for #address-cells=2 has a loophole: if the reg is actually 0,
but the #address-cells is actually 1, like in such case below:

syscon {
	#address-cells = <1>;

	phy {
		reg = <0 0x10>;
	};
};

then the second u32 of the 'reg' is the size, not the address.

The code should check for the parent's #address-cells value, and not
assume that if the first u32 is 0, then the #address-cells is 2, and the
reg property is something like
	reg = <0 0xff00 0x10>;

Fixed this by looking for the #address-cells value and retrieving the
reg address only if this is ==2.
To avoid breaking anything I also kept the check `if reg==0` as some DT's
may have a wrong #address-cells as parent and even if this commit is
correct, it might break the existing wrong device-trees.

Fixes: d538efb9ad ("phy: rockchip: inno-usb2: Add support #address_cells = 2")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-06-29 18:31:48 +08:00
..
allwinner drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
cadence phy: cadence: Sierra: Move the link operations from serdes phy to link device 2022-03-14 12:44:51 -04:00
marvell drivers: use devfdt_get_addr_index_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
qcom drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
renesas phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8 2023-04-16 16:18:29 +02:00
rockchip phy: rockchip: inno-usb2: fix phy reg=0 case 2023-06-29 18:31:48 +08:00
socionext phy: socionext: Add UniPhier USB3 PHY driver 2023-02-22 19:40:11 +01:00
ti phy: ti: j721e-wiz: Add support to enable LN23 Type-C swap 2023-03-29 13:30:29 -04:00
bcm6318-usbh-phy.c phy: bcm63xx: Don't check clk_free 2022-03-30 13:02:55 -04:00
bcm6348-usbh-phy.c phy: bcm63xx: Don't check clk_free 2022-03-30 13:02:55 -04:00
bcm6358-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bcm6368-usbh-phy.c phy: bcm63xx: Don't check clk_free 2022-03-30 13:02:55 -04:00
Kconfig phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8 2023-04-16 16:18:29 +02:00
keystone-usb-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
Makefile phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8 2023-04-16 16:18:29 +02:00
meson-axg-mipi-dphy.c phy: meson-axg-mipi: Rename "priv_auto_alloc_size" to "priv_auto" 2021-07-27 10:32:09 +02:00
meson-axg-mipi-pcie-analog.c phy: meson-axg-mipi: Access parent ofnode through dev_ofnode() 2021-07-27 10:32:09 +02:00
meson-g12a-usb2.c phy: remove phy-supply related code 2023-05-17 17:36:18 +08:00
meson-g12a-usb3-pcie.c phy: meson-g12a-usb3-pcie: add support for PCIe ops 2021-04-19 16:59:33 +02:00
meson-gxbb-usb2.c phy: remove phy-supply related code 2023-05-17 17:36:18 +08:00
meson-gxl-usb2.c phy: remove phy-supply related code 2023-05-17 17:36:18 +08:00
mt76x8-usb-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
mt7620-usb-phy.c phy: add USB PHY driver for MediaTek MT7620 SoC 2021-01-24 21:39:26 +01:00
nop-phy.c phy: nop-phy: Fix phy reset if no reset-gpio defined 2022-03-01 00:21:11 +01:00
omap-usb2-phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
phy-ab8500-usb.c Correct SPL uses of USB_MUSB_HOST 2023-02-10 07:41:40 -05:00
phy-bcm-sr-pcie.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
phy-core-mipi-dphy.c phy: dphy: Add configuration helpers 2021-02-10 10:00:51 +01:00
phy-da8xx-usb.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
phy-imx8mq-usb.c phy: phy-imx8mq-usb: Add support for i.MX8MP USB PHY 2022-04-12 17:33:56 +02:00
phy-mtk-tphy.c phy: phy-mtk-tphy: add support mt8195 2023-03-02 22:43:43 +01:00
phy-npcm-usb.c phy: nuvoton: add NPCM7xx phy control driver 2022-07-06 14:30:51 -04:00
phy-rcar-gen2.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-rcar-gen3.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-stm32-usbphyc.c drivers: fix debug string with fdt_addr_t input 2023-05-06 17:28:18 +08:00
phy-ti-am654.c arm: mach-k3: Remove empty sys_proto.h include 2023-04-24 13:18:48 -04:00
phy-uclass.c phy: Keep balance of counts when ops is missing 2023-05-17 17:36:18 +08:00
phy-zynqmp.c phy: zynqmp: Increase timeout value to 10ms 2022-05-18 13:17:54 +02:00
sandbox-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
sti_usb_phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ti-pipe3-phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00