aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-11-20 23:10:20 +0100
committerSungbo Eo <mans0n@gorani.run>2022-05-01 13:40:13 +0900
commit7c692f685bcb73530620f0250d7d2197475a0277 (patch)
tree0037f1e4cc8b572869137657634e9cec37b9f051 /target/linux/ipq40xx
parent7a72fcc1c5800de2d966ccb773c1022103aadbcf (diff)
downloadupstream-7c692f685bcb73530620f0250d7d2197475a0277.tar.gz
upstream-7c692f685bcb73530620f0250d7d2197475a0277.tar.bz2
upstream-7c692f685bcb73530620f0250d7d2197475a0277.zip
ipq40xx: refresh ess driver and phy with new api
Kernel 5.15 have some new api for ethtool and phy. Add ifdef to fix compilation error. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by: Robert Marko <robert.marko@sartura.hr>
Diffstat (limited to 'target/linux/ipq40xx')
-rw-r--r--target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c12
-rw-r--r--target/linux/ipq40xx/files/drivers/net/phy/qca807x.c36
2 files changed, 48 insertions, 0 deletions
diff --git a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c
index f84cd5aa62..65706cfae1 100644
--- a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c
+++ b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma_ethtool.c
@@ -244,8 +244,14 @@ static int edma_set_settings(struct net_device *netdev,
/* edma_get_coalesce
* get interrupt mitigation
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
+static int edma_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
+#else
static int edma_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec)
+#endif
{
u32 reg_val;
@@ -266,8 +272,14 @@ static int edma_get_coalesce(struct net_device *netdev,
/* edma_set_coalesce
* set interrupt mitigation
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
+static int edma_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
+#else
static int edma_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *ec)
+#endif
{
if (ec->tx_coalesce_usecs)
edma_change_tx_coalesce(ec->tx_coalesce_usecs);
diff --git a/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c b/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c
index 16d7a80455..8d523548e5 100644
--- a/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c
+++ b/target/linux/ipq40xx/files/drivers/net/phy/qca807x.c
@@ -610,6 +610,7 @@ static int qca807x_config_intr(struct phy_device *phydev)
return ret;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
static int qca807x_ack_intr(struct phy_device *phydev)
{
int ret;
@@ -618,6 +619,33 @@ static int qca807x_ack_intr(struct phy_device *phydev)
return (ret < 0) ? ret : 0;
}
+#else
+static irqreturn_t qca807x_handle_interrupt(struct phy_device *phydev)
+{
+ int irq_status, int_enabled;
+
+ irq_status = phy_read(phydev, QCA807X_INTR_STATUS);
+ if (irq_status < 0) {
+ phy_error(phydev);
+ return IRQ_NONE;
+ }
+
+ /* Read the current enabled interrupts */
+ int_enabled = phy_read(phydev, QCA807X_INTR_ENABLE);
+ if (int_enabled < 0) {
+ phy_error(phydev);
+ return IRQ_NONE;
+ }
+
+ /* See if this was one of our enabled interrupts */
+ if (!(irq_status & int_enabled))
+ return IRQ_NONE;
+
+ phy_trigger_machine(phydev);
+
+ return IRQ_HANDLED;
+}
+#endif
static int qca807x_led_config(struct phy_device *phydev)
{
@@ -779,7 +807,11 @@ static struct phy_driver qca807x_drivers[] = {
.config_init = qca807x_config,
.read_status = qca807x_read_status,
.config_intr = qca807x_config_intr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
.ack_interrupt = qca807x_ack_intr,
+#else
+ .handle_interrupt = qca807x_handle_interrupt,
+#endif
.soft_reset = genphy_soft_reset,
.get_tunable = qca807x_get_tunable,
.set_tunable = qca807x_set_tunable,
@@ -799,7 +831,11 @@ static struct phy_driver qca807x_drivers[] = {
.config_init = qca807x_config,
.read_status = qca807x_read_status,
.config_intr = qca807x_config_intr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
.ack_interrupt = qca807x_ack_intr,
+#else
+ .handle_interrupt = qca807x_handle_interrupt,
+#endif
.soft_reset = genphy_soft_reset,
.get_tunable = qca807x_get_tunable,
.set_tunable = qca807x_set_tunable,