From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Damien Riegel <damien.riegel@savoirfairelinux.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-can@vger.kernel.org, devicetree@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Wolfgang Grandegger <wg@grandegger.com>,
kernel@savoirfairelinux.com
Subject: Re: [PATCH 2/2] can: sja1000: of: add compatibility with Technologic Systems version
Date: Fri, 18 Dec 2015 22:05:01 +0100 [thread overview]
Message-ID: <567474FD.8060002@pengutronix.de> (raw)
In-Reply-To: <20151218210231.GA6116@localhost>
[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]
On 12/18/2015 10:02 PM, Damien Riegel wrote:
> 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.
Yes, but for a device spinlock you probably have to remove "const" from
the priv pointer.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2015-12-18 21:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 20:17 [PATCH 1/2] can: sja1000: add documentation for Technologic Systems version Damien Riegel
2015-12-18 20:17 ` [PATCH 2/2] can: sja1000: of: add compatibility with " Damien Riegel
2015-12-18 20:41 ` Marc Kleine-Budde
2015-12-18 21:02 ` Damien Riegel
2015-12-18 21:05 ` Marc Kleine-Budde [this message]
2015-12-20 3:37 ` [PATCH 1/2] can: sja1000: add documentation for " Rob Herring
2015-12-21 15:09 ` Damien Riegel
2015-12-22 18:28 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=567474FD.8060002@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=damien.riegel@savoirfairelinux.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kernel@savoirfairelinux.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).