1 From aaac91b5e8756dce1c0242d58074a0b5d4607b57 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Fri, 24 Dec 2021 20:02:32 +0100
4 Subject: [PATCH 04/14] qca8081: convert to 5.11 IRQ model
6 Kernel 5.11 introduced new IRQ handling model for PHY-s,
7 so provide those if 5.11 or later is used.
9 Signed-off-by: Robert Marko <robimarko@gmail.com>
11 src/hsl/phy/qca808x.c | 46 +++++++++++++++++++++++++++++++++++++++++++
12 1 file changed, 46 insertions(+)
14 --- a/src/hsl/phy/qca808x.c
15 +++ b/src/hsl/phy/qca808x.c
16 @@ -247,6 +247,7 @@ static int qca808x_config_intr(struct ph
20 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
21 static int qca808x_ack_interrupt(struct phy_device *phydev)
24 @@ -266,6 +267,47 @@ static int qca808x_ack_interrupt(struct
26 return (err < 0) ? err : 0;
30 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0))
31 +static irqreturn_t qca808x_handle_interrupt(struct phy_device *phydev)
33 + a_uint16_t irq_status, int_enabled;
34 + a_uint32_t dev_id = 0, phy_id = 0;
35 + qca808x_priv *priv = phydev->priv;
36 + const struct qca808x_phy_info *pdata = priv->phy_info;
42 + dev_id = pdata->dev_id;
43 + phy_id = pdata->phy_addr;
45 + irq_status = qca808x_phy_reg_read(dev_id, phy_id,
46 + QCA808X_PHY_INTR_STATUS);
47 + if (irq_status < 0) {
52 + /* Read the current enabled interrupts */
53 + int_enabled = qca808x_phy_reg_read(dev_id, phy_id,
54 + QCA808X_PHY_INTR_MASK);
55 + if (int_enabled < 0) {
60 + /* See if this was one of our enabled interrupts */
61 + if (!(irq_status & int_enabled))
64 + phy_trigger_machine(phydev);
70 /* switch linux negtiation capability to fal avariable */
71 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
72 @@ -638,7 +680,11 @@ struct phy_driver qca808x_phy_driver = {
73 .config_intr = qca808x_config_intr,
74 .config_aneg = qca808x_config_aneg,
75 .aneg_done = qca808x_aneg_done,
76 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
77 .ack_interrupt = qca808x_ack_interrupt,
79 + .handle_interrupt = qca808x_handle_interrupt,
81 .read_status = qca808x_read_status,
82 .suspend = qca808x_suspend,
83 .resume = qca808x_resume,