lede/package/qca/qca-ssdk/patches/0004-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch
2022-09-12 13:48:20 +08:00

73 lines
2.4 KiB
Diff

From b6190ca46287d01a895c7cc14de30410c09ff1b8 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 12 May 2021 17:15:46 +0200
Subject: [PATCH] SSDK: platform: use of_mdio_find_bus() to get MDIO bus
Kernel has a generic of_mdio_find_bus() which can get the appropriate
MDIO bus based on the DT node.
So, drop the getting MDIO from platform data, which no longer works
in 5.4 and later and use of_mdio_find_bus().
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
src/init/ssdk_plat.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
--- a/src/init/ssdk_plat.c
+++ b/src/init/ssdk_plat.c
--- ssdk_plat.c.orig 2022-07-21 14:17:55.010803700 +0300
+++ ssdk_plat.c 2022-07-21 14:30:42.884803700 +0300
@@ -734,7 +734,6 @@ static int miibus_get(a_uint32_t dev_id)
struct device_node *mdio_node = NULL;
struct device_node *switch_node = NULL;
struct platform_device *mdio_plat = NULL;
- struct qca_mdio_data *mdio_data = NULL;
struct qca_phy_priv *priv;
hsl_reg_mode reg_mode = HSL_REG_LOCAL_BUS;
priv = qca_phy_priv_global[dev_id];
@@ -769,13 +768,8 @@ static int miibus_get(a_uint32_t dev_id)
if(reg_mode == HSL_REG_LOCAL_BUS)
{
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
- if (!mdio_data) {
- SSDK_ERROR("cannot get mdio_data reference from device data\n");
- return 1;
- }
- priv->miibus = mdio_data->mii_bus;
- }
+ priv->miibus = of_mdio_find_bus(mdio_node);
+ }
else
priv->miibus = dev_get_drvdata(&mdio_plat->dev);
@@ -813,7 +807,6 @@ static int miibus_get(a_uint32_t dev_id)
#else
static int miibus_get(a_uint32_t dev_id)
{
- struct ag71xx_mdio *am;
struct qca_phy_priv *priv = qca_phy_priv_global[dev_id];
#if defined(CONFIG_OF) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0))
struct device_node *mdio_node = NULL;
@@ -829,17 +822,12 @@ static int miibus_get(a_uint32_t dev_id)
SSDK_ERROR("cannot find platform device from mdio node\n");
return 1;
}
- am = dev_get_drvdata(&mdio_plat->dev);
- if (!am) {
- SSDK_ERROR("cannot get mdio_data reference from device data\n");
- return 1;
- }
- priv->miibus = am->mii_bus;
-
+ priv->miibus = of_mdio_find_bus(mdio_node);
switch_chip_id_adjuest(dev_id);
#else
struct device *miidev;
- char busid[MII_BUS_ID_SIZE];
+ struct ag71xx_mdio *am;
+ char busid[MII_BUS_ID_SIZE];
snprintf(busid, MII_BUS_ID_SIZE, "%s.%d",
PLATFORM_MDIO_BUS_NAME, PLATFORM_MDIO_BUS_NUM);