On 2020-09-21 08:57, Chuanhong Guo wrote: > reg accesses on integrated ar8229 sometimes fails. As a result, phy read > got incorrect port status and wan link goes down and up mysteriously. > After comparing ar8216 with the old driver, these local_irq_save/restore > calls are the only meaningful differences I could find and it does fix > the issue. > The same changes were added in svn r26856 by Gabor Juhos: > ar71xx: ag71xx: make switch register access atomic > > As I can't find the underlying problem either, this hack is broght > back to fix the unstable link issue. > This hack is only suitable for ath79 mdio and may easily break the > driver on other platform. Limit it to ath79-only as a target patch. > > Fixes: FS#2216 > Fixes: FS#3226 > Signed-off-by: Chuanhong Guo <[email protected]> > --- > .../930-ar8216-make-reg-access-atomic.patch | 61 +++++++++++++++++++ > 1 file changed, 61 insertions(+) > create mode 100644 > target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch > > diff --git > a/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch > b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch > new file mode 100644 > index 0000000000..42f3305195 > --- /dev/null > +++ b/target/linux/ath79/patches-5.4/930-ar8216-make-reg-access-atomic.patch > @@ -0,0 +1,61 @@ > +From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00 2001 > +From: Chuanhong Guo <[email protected]> > +Date: Sun, 20 Sep 2020 01:00:45 +0800 > +Subject: [PATCH] ath79: ar8216: make switch register access atomic > + > +due to some unknown reason these register accesses sometimes fail > +on the integrated switch without this patch. > + > +THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER PLATFORMS! > +The mdio bus on ath79 works in polling mode and doesn't rely on > +any interrupt. This patch breaks the driver on any mdio master > +with interrupts used. > + > +--- > +--- a/drivers/net/phy/ar8216.c > ++++ b/drivers/net/phy/ar8216.c > +@@ -253,12 +253,14 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p > + u32 > + ar8xxx_read(struct ar8xxx_priv *priv, int reg) > + { > ++ unsigned long flags; > + struct mii_bus *bus = priv->mii_bus; > + u16 r1, r2, page; > + u32 val; > + > + split_addr((u32) reg, &r1, &r2, &page); > + > ++ local_irq_save(flags); > + mutex_lock(&bus->mdio_lock); Taking a mutex in an irq-disabled section is basically asking for a deadlock. What router is this issue reproduced on? What else is running at the time this happens?
- Felix _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
