forked from mirror/openwrt
realtek: rtl930x: Fetch link status for all ports in switch IRQ
Link status needs to be read twice, and a single register value is enough for determining link status for all the ports It is not necessary to go through each potential port separately and later actually identify for which ports the interrupt actually was. The helper for_each_set_bit() directly iterate through all set bits. While at it, rename the function to a proper naming scheme. Signed-off-by: Harshal Gohel <hg@simonwunderlich.de> Co-developed-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de> Link: https://github.com/openwrt/openwrt/pull/19578 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
9ccfca3303
commit
445af8c038
3 changed files with 14 additions and 17 deletions
|
|
@ -1614,7 +1614,7 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev)
|
|||
IRQF_SHARED, "rtl839x-link-state", priv->ds);
|
||||
break;
|
||||
case RTL9300_FAMILY_ID:
|
||||
err = request_irq(priv->link_state_irq, rtl930x_switch_irq,
|
||||
err = request_irq(priv->link_state_irq, rtldsa_930x_switch_irq,
|
||||
IRQF_SHARED, "rtl930x-link-state", priv->ds);
|
||||
break;
|
||||
case RTL9310_FAMILY_ID:
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void rtl839x_print_matrix(void);
|
|||
|
||||
/* RTL930x-specific */
|
||||
u32 rtl930x_hash(struct rtl838x_switch_priv *priv, u64 seed);
|
||||
irqreturn_t rtl930x_switch_irq(int irq, void *dev_id);
|
||||
irqreturn_t rtldsa_930x_switch_irq(int irq, void *dev_id);
|
||||
irqreturn_t rtl839x_switch_irq(int irq, void *dev_id);
|
||||
void rtl930x_vlan_profile_dump(int index);
|
||||
int rtl9300_sds_power(int mac, int val);
|
||||
|
|
|
|||
|
|
@ -698,28 +698,25 @@ void rtl9300_dump_debug(void)
|
|||
);
|
||||
}
|
||||
|
||||
irqreturn_t rtl930x_switch_irq(int irq, void *dev_id)
|
||||
irqreturn_t rtldsa_930x_switch_irq(int irq, void *dev_id)
|
||||
{
|
||||
struct dsa_switch *ds = dev_id;
|
||||
u32 ports = sw_r32(RTL930X_ISR_PORT_LINK_STS_CHG);
|
||||
struct rtl838x_switch_priv *priv = ds->priv;
|
||||
unsigned long ports = sw_r32(RTL930X_ISR_PORT_LINK_STS_CHG);
|
||||
unsigned int i;
|
||||
u32 link;
|
||||
|
||||
/* Clear status */
|
||||
sw_w32(ports, RTL930X_ISR_PORT_LINK_STS_CHG);
|
||||
|
||||
for (int i = 0; i < 28; i++) {
|
||||
if (ports & BIT(i)) {
|
||||
/* Read the register twice because of issues with latency at least
|
||||
* with the external RTL8226 PHY on the XGS1210
|
||||
*/
|
||||
link = sw_r32(RTL930X_MAC_LINK_STS);
|
||||
link = sw_r32(RTL930X_MAC_LINK_STS);
|
||||
if (link & BIT(i))
|
||||
dsa_port_phylink_mac_change(ds, i, true);
|
||||
else
|
||||
dsa_port_phylink_mac_change(ds, i, false);
|
||||
}
|
||||
}
|
||||
/* Read the register twice because of issues with latency at least
|
||||
* with the external RTL8226 PHY on the XGS1210
|
||||
*/
|
||||
link = sw_r32(RTL930X_MAC_LINK_STS);
|
||||
link = sw_r32(RTL930X_MAC_LINK_STS);
|
||||
|
||||
for_each_set_bit(i, &ports, priv->cpu_port)
|
||||
dsa_port_phylink_mac_change(ds, i, link & BIT(i));
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue