04adad86f6b4e454f009b3941263b1ead31c4fc9
[openwrt/staging/nbd.git] / package / kernel / qca-nss-dp / patches / 0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch
1 From cef7873a2d77df13ee702d902ed4e06b2248904b Mon Sep 17 00:00:00 2001
2 Message-Id: <cef7873a2d77df13ee702d902ed4e06b2248904b.1620066716.git.baruch@tkos.co.il>
3 In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
4 References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
5 From: Baruch Siach <baruch@tkos.co.il>
6 Date: Mon, 3 May 2021 20:17:22 +0300
7 Subject: [PATCH 2/3] nss_dp_main: make phy mode code compatible with newer
8 kernels
9
10 ---
11 include/nss_dp_dev.h | 4 ++--
12 nss_dp_main.c | 4 ++++
13 2 files changed, 6 insertions(+), 2 deletions(-)
14
15 --- a/include/nss_dp_dev.h
16 +++ b/include/nss_dp_dev.h
17 @@ -22,7 +22,7 @@
18 #include <linux/etherdevice.h>
19 #include <linux/netdevice.h>
20 #include <linux/platform_device.h>
21 -#include <linux/switch.h>
22 +#include <linux/phy.h>
23 #include <linux/version.h>
24
25 #include "nss_dp_api_if.h"
26 @@ -99,7 +99,7 @@ struct nss_dp_dev {
27 /* Phy related stuff */
28 struct phy_device *phydev; /* Phy device */
29 struct mii_bus *miibus; /* MII bus */
30 - uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */
31 + phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */
32 uint32_t phy_mdio_addr; /* Mdio address */
33 bool link_poll; /* Link polling enable? */
34 uint32_t forced_speed; /* Forced speed? */
35 --- a/nss_dp_main.c
36 +++ b/nss_dp_main.c
37 @@ -584,7 +584,11 @@ static int32_t nss_dp_of_get_pdata(struc
38 hal_pdata->netdev = netdev;
39 hal_pdata->macid = dp_priv->macid;
40
41 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
42 dp_priv->phy_mii_type = of_get_phy_mode(np);
43 +#else
44 + of_get_phy_mode(np, &dp_priv->phy_mii_type);
45 +#endif
46 dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
47 if (of_property_read_u32(np, "qcom,phy-mdio-addr",
48 &dp_priv->phy_mdio_addr) && dp_priv->link_poll) {