From: Mirza Krak <mirza.krak@hostmobility.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
linux-can@vger.kernel.org,
Rickard Gustafsson <rickard.gustafsson@hostmobility.com>
Subject: Re: Dual SJA1000 can controllers on SMP system.
Date: Mon, 17 Jun 2013 15:46:19 +0200 [thread overview]
Message-ID: <51BF132B.3020705@hostmobility.com> (raw)
In-Reply-To: <51BEB849.3020409@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]
My modifications to sja1000_platform.c are attached as a patch.
Wolfgang: Using spinlock_irqsave() and spinlock_irqrestore() was also my
initial idea on the io functions but I tried this without it solving the
problem. I could try this again to be sure.
Med Vänliga Hälsningar / Best Regards
Mirza
*******************************************************************
Mirza Krak
Host Mobility AB
mirza.krak@hostmobility.com
Anders Personsgatan 12, 416 64 Göteborg
Sweden
www.hostmobility.com <http://www.hostmobility.com>
Direct: +46 31 31 32 704
Phone: +46 31 31 32 700
Fax: +46 31 80 67 51
Mobile: +46 730 28 06 22
*******************************************************************
On 06/17/2013 09:18 AM, Marc Kleine-Budde wrote:
> On 06/17/2013 08:10 AM, Mirza Krak wrote:
>> Aah off course. The low-level device driver is sja1000_platform.c. The
>> functions I am using are sp_read_reg8 and sp_write_reg8 which I have
>> slightly modified. Since I don't use multiplexed bus functionality I
>> write the address first.
>>
>> static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg)
>> {
>> iowrite8(reg, priv->reg_base);
> ^^^^^^^^
>> return ioread8(priv->reg_base + 0x20);
>> }
>>
>> static void sp_write_reg8(const struct sja1000_priv *priv, int reg, u8 val)
>> {
>> iowrite8(reg, priv->reg_base);
> ^^^^^^^^
>> iowrite8(val, (priv->reg_base + 0x20));
>> }
>
> Can you post a proper patch, so that we can see what you have changed?
>
> You probably have a nice race condition here. The two iowrites have to
> be atomic.
>
> Marc
>
[-- Attachment #2: sja1000_platform.patch --]
[-- Type: text/x-patch, Size: 646 bytes --]
Index: sja1000_platform.c
===================================================================
--- sja1000_platform.c (revision 160)
+++ sja1000_platform.c (working copy)
@@ -38,12 +38,14 @@
static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg)
{
- return ioread8(priv->reg_base + reg);
+ iowrite8(reg, priv->reg_base);
+ return ioread8(priv->reg_base + 0x20);
}
static void sp_write_reg8(const struct sja1000_priv *priv, int reg, u8 val)
{
- iowrite8(val, priv->reg_base + reg);
+ iowrite8(reg, priv->reg_base);
+ iowrite8(val, (priv->reg_base + 0x20));
}
static u8 sp_read_reg16(const struct sja1000_priv *priv, int reg)
next prev parent reply other threads:[~2013-06-17 13:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-16 11:20 Dual SJA1000 can controllers on SMP system mirza
2013-06-16 12:39 ` Wolfgang Grandegger
2013-06-17 6:10 ` Mirza Krak
2013-06-17 7:18 ` Marc Kleine-Budde
2013-06-17 13:46 ` Mirza Krak [this message]
2013-06-17 14:12 ` Marc Kleine-Budde
2013-06-17 18:49 ` Mirza Krak
2013-06-17 19:34 ` Wolfgang Grandegger
-- strict thread matches above, loose matches on Subject: below --
2013-06-13 12:47 Mirza Krak
2013-06-16 9:20 ` Wolfgang Grandegger
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=51BF132B.3020705@hostmobility.com \
--to=mirza.krak@hostmobility.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=rickard.gustafsson@hostmobility.com \
--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).