From c4cb6830eaa910584a2abdd2198d07a2ad524a16 Mon Sep 17 00:00:00 2001 From: hmz007 Date: Mon, 28 Mar 2022 15:55:10 +0800 Subject: [PATCH] rockchip: motorcomm: implement generic .handle_interrupt() callback Signed-off-by: hmz007 Signed-off-by: Tianling Shen --- .../files/drivers/net/phy/motorcomm.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/target/linux/rockchip/files/drivers/net/phy/motorcomm.c b/target/linux/rockchip/files/drivers/net/phy/motorcomm.c index 04955bb6fa..cc5b4b0de9 100644 --- a/target/linux/rockchip/files/drivers/net/phy/motorcomm.c +++ b/target/linux/rockchip/files/drivers/net/phy/motorcomm.c @@ -19,6 +19,9 @@ * Automotive 100/10 hyper range Phys: yt8510 */ +#include +#include + #include #include #include @@ -309,14 +312,28 @@ static int yt8521_config_intr(struct phy_device *phydev) return phy_write(phydev, REG_INT_MASK, val); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) static int yt8521_ack_interrupt(struct phy_device *phydev) +#else +static irqreturn_t yt8521_ack_interrupt(struct phy_device *phydev) +#endif { int val; val = phy_read(phydev, REG_INT_STATUS); phydev_dbg(phydev, "intr status 0x04%x\n", val); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) return (val < 0) ? val : 0; +#else + if (val < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + phy_trigger_machine(phydev); + return IRQ_HANDLED; +#endif } static struct phy_driver ytphy_drvs[] = { @@ -365,7 +382,11 @@ static struct phy_driver ytphy_drvs[] = { .phy_id_mask = MOTORCOMM_PHY_ID_MASK, /* PHY_GBIT_FEATURES */ .config_init = yt8521_config_init, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) .ack_interrupt = yt8521_ack_interrupt, +#else + .handle_interrupt = yt8521_ack_interrupt, +#endif .config_intr = yt8521_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, @@ -376,7 +397,11 @@ static struct phy_driver ytphy_drvs[] = { .phy_id_mask = MOTORCOMM_PHY_ID_MASK, /* PHY_GBIT_FEATURES */ .config_init = yt8521_config_init, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) .ack_interrupt = yt8521_ack_interrupt, +#else + .handle_interrupt = yt8521_ack_interrupt, +#endif .config_intr = yt8521_config_intr, .suspend = genphy_suspend, .resume = genphy_resume,