From 04fa26bab06d9335f15a5d529c4bba25cd507a34 Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Sat, 8 Dec 2018 16:12:12 +0100 Subject: net: phy: mdio-gpio: Add platform_data support for phy_mask It is sometimes necessary to instantiate a bit-banging MDIO bus as a platform device, without the aid of device tree. When device tree is being used, the bus is not scanned for devices, only those devices which are in device tree are probed. Without device tree, by default, all addresses on the bus are scanned. This may then find a device which is not a PHY, e.g. a switch. And the switch may have registers containing values which look like a PHY. So during the scan, a PHY device is wrongly created. After the bus has been registered, a search is made for mdio_board_info structures which indicates devices on the bus, and the driver which should be used for them. This is typically used to instantiate Ethernet switches from platform drivers. However, if the scanning of the bus has created a PHY device at the same location as indicated into the board info for a switch, the switch device is not created, since the address is already busy. This can be avoided by setting the phy_mask of the mdio bus. This mask prevents addresses on the bus being scanned. v2 Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- include/linux/platform_data/mdio-gpio.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 include/linux/platform_data/mdio-gpio.h (limited to 'include/linux/platform_data') diff --git a/include/linux/platform_data/mdio-gpio.h b/include/linux/platform_data/mdio-gpio.h new file mode 100644 index 000000000000..a5d5ff5e174c --- /dev/null +++ b/include/linux/platform_data/mdio-gpio.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * MDIO-GPIO bus platform data structure + */ + +#ifndef __LINUX_MDIO_GPIO_PDATA_H +#define __LINUX_MDIO_GPIO_PDATA_H + +struct mdio_gpio_platform_data { + u32 phy_mask; +}; + +#endif /* __LINUX_MDIO_GPIO_PDATA_H */ -- cgit v1.2.3 From dc9d38cec71c508963b8f41c9d6d9cfd7e4ee393 Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Sat, 8 Dec 2018 16:12:13 +0100 Subject: net: phy: mdio-gpio: Add phy_ignore_ta_mask to platform data The Marvell 6390 Ethernet switch family does not perform MDIO turnaround correctly. Many hardware MDIO bus masters don't care about this, but the bitbangging implementation in Linux does by default. Add phy_ignore_ta_mask to the platform data so that the bitbangging code can be told which devices are known to get TA wrong. v2 Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller --- include/linux/platform_data/mdio-gpio.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/platform_data') diff --git a/include/linux/platform_data/mdio-gpio.h b/include/linux/platform_data/mdio-gpio.h index a5d5ff5e174c..13874fa6e767 100644 --- a/include/linux/platform_data/mdio-gpio.h +++ b/include/linux/platform_data/mdio-gpio.h @@ -8,6 +8,7 @@ struct mdio_gpio_platform_data { u32 phy_mask; + u32 phy_ignore_ta_mask; }; #endif /* __LINUX_MDIO_GPIO_PDATA_H */ -- cgit v1.2.3