aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/files
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2021-02-17 02:04:46 +0100
committerDavid Bauer <mail@david-bauer.net>2021-02-20 01:26:04 +0100
commit3832403771f3319f2c95a9a084e0c3d46b7ee929 (patch)
tree8127a9b639fe84a214da3715ba6f0e41722fbcce /target/linux/ath79/files
parent5bd6d9377d625f6445caf75bee2ecb16fd45971d (diff)
downloadupstream-3832403771f3319f2c95a9a084e0c3d46b7ee929.tar.gz
upstream-3832403771f3319f2c95a9a084e0c3d46b7ee929.tar.bz2
upstream-3832403771f3319f2c95a9a084e0c3d46b7ee929.zip
ath79: ag71xx: make kernel 5.10 compatible
Add the necessary kernel version ifdef switches in order to support the kernel version 5.10. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target/linux/ath79/files')
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h4
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c25
2 files changed, 28 insertions, 1 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index fde9db3745..5ff9439f0d 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -178,7 +178,11 @@ struct ag71xx {
struct phy_device *phy_dev;
void *phy_priv;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
+ phy_interface_t phy_if_mode;
+#else
int phy_if_mode;
+#endif
unsigned int link;
unsigned int speed;
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 07d9992ca7..2767ad7642 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -936,7 +936,11 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update)
* The wr, rr functions cannot be used since this hidden register
* is outside of the normal ag71xx register block.
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
+ void __iomem *dam = ioremap(0xb90001bc, 0x4);
+#else
void __iomem *dam = ioremap_nocache(0xb90001bc, 0x4);
+#endif
if (dam) {
__raw_writel(__raw_readl(dam) & ~BIT(27), dam);
(void)__raw_readl(dam);
@@ -1193,7 +1197,11 @@ static void ag71xx_oom_timer_handler(struct timer_list *t)
napi_schedule(&ag->napi);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
+static void ag71xx_tx_timeout(struct net_device *dev, unsigned int txqueue)
+#else
static void ag71xx_tx_timeout(struct net_device *dev)
+#endif
{
struct ag71xx *ag = netdev_priv(dev);
@@ -1579,15 +1587,25 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->pllregmap = NULL;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
+ ag->mac_base = devm_ioremap(&pdev->dev, res->start,
+ res->end - res->start + 1);
+#else
ag->mac_base = devm_ioremap_nocache(&pdev->dev, res->start,
res->end - res->start + 1);
+#endif
if (!ag->mac_base)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res) {
- ag->mii_base = devm_ioremap_nocache(&pdev->dev, res->start,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
+ ag->mii_base = devm_ioremap(&pdev->dev, res->start,
res->end - res->start + 1);
+#else
+ ag->mii_base = devm_ioremap_nocache(&pdev->dev, res->start,
+ res->end - res->start + 1);
+#endif
if (!ag->mii_base)
return -ENOMEM;
}
@@ -1667,7 +1685,12 @@ static int ag71xx_probe(struct platform_device *pdev)
memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
+ of_get_phy_mode(np, &ag->phy_if_mode);
+#else
ag->phy_if_mode = of_get_phy_mode(np);
+#endif
+
if (ag->phy_if_mode < 0) {
dev_err(&pdev->dev, "missing phy-mode property in DT\n");
return ag->phy_if_mode;