[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZG4MIrvASGLwkVhV@shell.armlinux.org.uk>
Date: Wed, 24 May 2023 14:07:46 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>
Cc: Jiawen Wu <jiawenwu@...stnetic.com>, netdev@...r.kernel.org,
jarkko.nikula@...ux.intel.com, andriy.shevchenko@...ux.intel.com,
mika.westerberg@...ux.intel.com, jsd@...ihalf.com,
Jose.Abreu@...opsys.com, hkallweit1@...il.com,
linux-i2c@...r.kernel.org, linux-gpio@...r.kernel.org,
mengyuanlou@...-swift.com
Subject: Re: [PATCH net-next v9 6/9] net: txgbe: Support GPIO to SFP socket
On Wed, May 24, 2023 at 02:51:25PM +0200, Andrew Lunn wrote:
> > +static void txgbe_toggle_trigger(struct gpio_chip *gc, unsigned int offset)
> > +{
> > + struct wx *wx = gpiochip_get_data(gc);
> > + u32 pol, val;
> > +
> > + pol = rd32(wx, WX_GPIO_POLARITY);
> > + val = rd32(wx, WX_GPIO_EXT);
> > +
> > + if (val & BIT(offset))
> > + pol &= ~BIT(offset);
> > + else
> > + pol |= BIT(offset);
> > +
> > + wr32(wx, WX_GPIO_POLARITY, pol);
> > +}
>
> So you look at the current state of the GPIO and set the polarity to
> trigger an interrupt when it changes.
>
> This is not race free. And if it does race, at best you loose an
> interrupt. The worst is your hardware locks up because that interrupt
> was missed and it cannot continue until some action is taken.
>
> Is there any other GPIO driver doing this?
>
> I think you would be better indicating you don't support
> IRQ_TYPE_EDGE_BOTH.
... which will make the whole point of having interrupt support for this
driver moot, and the SFP code will then poll the GPIOs which will
probably more reliably detect changes.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists