aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch
blob: 04adad86f6b4e454f009b3941263b1ead31c4fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From cef7873a2d77df13ee702d902ed4e06b2248904b Mon Sep 17 00:00:00 2001
Message-Id: <cef7873a2d77df13ee702d902ed4e06b2248904b.1620066716.git.baruch@tkos.co.il>
In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
From: Baruch Siach <baruch@tkos.co.il>
Date: Mon, 3 May 2021 20:17:22 +0300
Subject: [PATCH 2/3] nss_dp_main: make phy mode code compatible with newer
 kernels

---
 include/nss_dp_dev.h | 4 ++--
 nss_dp_main.c        | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -22,7 +22,7 @@
 #include <linux/etherdevice.h>
 #include <linux/netdevice.h>
 #include <linux/platform_device.h>
-#include <linux/switch.h>
+#include <linux/phy.h>
 #include <linux/version.h>
 
 #include "nss_dp_api_if.h"
@@ -99,7 +99,7 @@ struct nss_dp_dev {
 	/* Phy related stuff */
 	struct phy_device *phydev;	/* Phy device */
 	struct mii_bus *miibus;		/* MII bus */
-	uint32_t phy_mii_type;		/* RGMII/SGMII/QSGMII */
+	phy_interface_t phy_mii_type;	/* RGMII/SGMII/QSGMII */
 	uint32_t phy_mdio_addr;		/* Mdio address */
 	bool link_poll;			/* Link polling enable? */
 	uint32_t forced_speed;		/* Forced speed? */
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -584,7 +584,11 @@ static int32_t nss_dp_of_get_pdata(struc
 	hal_pdata->netdev = netdev;
 	hal_pdata->macid = dp_priv->macid;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
 	dp_priv->phy_mii_type = of_get_phy_mode(np);
+#else
+	of_get_phy_mode(np, &dp_priv->phy_mii_type);
+#endif
 	dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
 	if (of_property_read_u32(np, "qcom,phy-mdio-addr",
 		&dp_priv->phy_mdio_addr) && dp_priv->link_poll) {