mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 0f5ff06adcb20916acaf55976975a8b8844e785a Mon Sep 17 00:00:00 2001
 | 
						|
From: Frank Wunderlich <frank-w@public-files.de>
 | 
						|
Date: Sat, 8 Dec 2018 20:59:40 +0100
 | 
						|
Subject: [PATCH 25/77] net: dsa: mt7530 add linking to mdio
 | 
						|
 | 
						|
switch (7530) needs to to be linked to mdio-bus
 | 
						|
 | 
						|
based on
 | 
						|
https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0045-net-dsa-mediatek-turn-into-platform-driver.patch
 | 
						|
 | 
						|
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
 | 
						|
---
 | 
						|
 drivers/net/dsa/mt7530.c | 10 ++++++++--
 | 
						|
 1 file changed, 8 insertions(+), 2 deletions(-)
 | 
						|
 | 
						|
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
 | 
						|
index 9690a9b59fce..8f95e22a33f6 100644
 | 
						|
--- a/drivers/net/dsa/mt7530.c
 | 
						|
+++ b/drivers/net/dsa/mt7530.c
 | 
						|
@@ -1349,7 +1349,7 @@ static int
 | 
						|
 mt7530_probe(struct mdio_device *mdiodev)
 | 
						|
 {
 | 
						|
 	struct mt7530_priv *priv;
 | 
						|
-	struct device_node *dn;
 | 
						|
+	struct device_node *dn, *mdio;
 | 
						|
 
 | 
						|
 	dn = mdiodev->dev.of_node;
 | 
						|
 
 | 
						|
@@ -1396,8 +1396,14 @@ mt7530_probe(struct mdio_device *mdiodev)
 | 
						|
 			return PTR_ERR(priv->reset);
 | 
						|
 		}
 | 
						|
 	}
 | 
						|
+	mdio = of_get_parent(dn);
 | 
						|
+	if (!mdio)
 | 
						|
+		return -EINVAL;
 | 
						|
+
 | 
						|
+	priv->bus = of_mdio_find_bus(mdio);
 | 
						|
+	if (!priv->bus)
 | 
						|
+		return -EPROBE_DEFER;
 | 
						|
 
 | 
						|
-	priv->bus = mdiodev->bus;
 | 
						|
 	priv->dev = &mdiodev->dev;
 | 
						|
 	priv->ds->priv = priv;
 | 
						|
 	priv->ds->ops = &mt7530_switch_ops;
 | 
						|
-- 
 | 
						|
2.19.1
 | 
						|
 |