Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1295157
| From | Damien Riegel <damien.riegel@savoirfairelinux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version |
| Date | 2015-12-18 22:10 +0100 |
| Message-ID | <qHarM-2rz-27@gated-at.bofh.it> (permalink) |
| References | <qH9Fn-1R3-1@gated-at.bofh.it> <qH9Fn-1R3-3@gated-at.bofh.it> <qHa8p-23k-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Dec 18, 2015 at 09:41:47PM +0100, Marc Kleine-Budde wrote:
> On 12/18/2015 09:17 PM, Damien Riegel wrote:
> > Technologic Systems provides an IP compatible with the SJA1000,
> > instantiated in an FPGA. Because of some bus widths issue, access to
> > registers is made through a "window" that works like this:
> >
> > base + 0x0: address to read/write
> > base + 0x2: 8-bit register value
> >
> > This commit adds a new compatible device, "technologic,sja1000", with
> > read and write functions using the window mechanism.
> >
> > Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
> > ---
> > drivers/net/can/sja1000/sja1000_platform.c | 30 ++++++++++++++++++++++++++++--
> > 1 file changed, 28 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
> > index 0552ed4..6cbf251 100644
> > --- a/drivers/net/can/sja1000/sja1000_platform.c
> > +++ b/drivers/net/can/sja1000/sja1000_platform.c
> > @@ -70,6 +70,18 @@ static void sp_write_reg32(const struct sja1000_priv *priv, int reg, u8 val)
> > iowrite8(val, priv->reg_base + reg * 4);
> > }
> >
> > +static u8 ts4800_read_reg16(const struct sja1000_priv *priv, int reg)
> > +{
> > + sp_write_reg16(priv, 0, reg);
> > + return sp_read_reg16(priv, 2);
>
> This is racy, please add a spinlock.
>
> > +}
> > +
> > +static void ts4800_write_reg16(const struct sja1000_priv *priv, int reg, u8 val)
> > +{
> > + sp_write_reg16(priv, 0, reg);
> > + sp_write_reg16(priv, 2, val);
>
> This is racy, too.
>
> Have a look at https://marc.info/?l=linux-can&m=137149497403825&w=2
Thank you for the link. In my situation, I don't think there is a race
issue at the bus level, so a per-device spinlock should be enough. Would
that be an acceptable patch? It would look a lot like the patch you
suggested in the thread you linked, just rebased on current version.
Thanks,
Damien
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] can: sja1000: add documentation for Technologic Systems version Damien Riegel <damien.riegel@savoirfairelinux.com> - 2015-12-18 21:20 +0100
[PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version Damien Riegel <damien.riegel@savoirfairelinux.com> - 2015-12-18 21:20 +0100
Re: [PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version Marc Kleine-Budde <mkl@pengutronix.de> - 2015-12-18 21:50 +0100
Re: [PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version Marc Kleine-Budde <mkl@pengutronix.de> - 2015-12-18 22:10 +0100
Re: [PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version Damien Riegel <damien.riegel@savoirfairelinux.com> - 2015-12-18 22:10 +0100
Re: [PATCH 1/2] can: sja1000: add documentation for Technologic Systems version Rob Herring <robh@kernel.org> - 2015-12-20 04:40 +0100
Re: [PATCH 1/2] can: sja1000: add documentation for Technologic Systems version Damien Riegel <damien.riegel@savoirfairelinux.com> - 2015-12-21 16:20 +0100
Re: [PATCH 1/2] can: sja1000: add documentation for Technologic Systems version Rob Herring <robh@kernel.org> - 2015-12-22 19:30 +0100
csiph-web