[LEDE-DEV] Ethernet link up/down mt7688 board not detected by hotplug

Baptiste Clenet bapclenet at gmail.com
Tue Jul 19 06:35:05 PDT 2016


Hi,

I added two scripts in hotplug /etc/htoplug.d/net and /iface to check
when the interface eth0 is up or down or even link up/down.
Each time I plug the cable, Kernel driver says:
[ 1376.480000] rt305x-esw 10110000.esw: link changed 0x01
and unplug:
[ 1373.490000] rt305x-esw 10110000.esw: link changed 0x00

Nevertheless, it seems that no ACTION is raised on hotplug so I can't
detect if eth0 is link up or down.
Thing is, I would like, every time I unplug the ethernet cable, that the
interface is set down.

The ethernet driver for this part is the irq handler:
static irqreturn_t esw_interrupt(int irq, void *_esw)
{
struct rt305x_esw *esw = (struct rt305x_esw *) _esw;
u32 status;

status = esw_r32(esw, RT305X_ESW_REG_ISR);
if (status & RT305X_ESW_PORT_ST_CHG) {
u32 link = esw_r32(esw, RT305X_ESW_REG_POA);
link >>= RT305X_ESW_POA_LINK_SHIFT;
link &= RT305X_ESW_POA_LINK_MASK;
dev_info(esw->dev, "link changed 0x%02X\n", link);
}
esw_w32(esw, status, RT305X_ESW_REG_ISR);

return IRQ_HANDLED;
}

It does not seem to send a SIGNAL to kernel for a LINK UP/DOWN. Is
that normal and how can I detect that ethernet is plug/unplug?

Cheers,

-- 
Baptiste



More information about the Lede-dev mailing list