From: Alexander Stein <alexander.stein@systec-electronic.com>
To: Michael Pellegrini <mikep86@gmail.com>
Cc: linux-can@vger.kernel.org, Wolfgang Grandegger <wg@grandegger.com>
Subject: Re: pch_can: Data transmission stops after dropped packet
Date: Thu, 06 Dec 2012 18:05:31 +0100 [thread overview]
Message-ID: <2331999.ZYFOYXdjyx@ws-stein> (raw)
In-Reply-To: <50C0B05F.7020606@grandegger.com>
Hi Michael,
On Thursday 06 December 2012 15:49:03, Wolfgang Grandegger wrote:
> > Details of the soak test:
> >
> > There are two systems involved in the test: the PCH-System and an External Node.
> > The External Node transmits data at a high rate, bringing bus utilization to
> > ~35%.
> > The PCH-System also transmits data, in bursts of 10 messages every 5 ms.
> > Combined, the two systems utilize ~90% of bus bandwidth.
> > The PCH-System is constantly checking that it is receiving data from the
> > External Node at the expected rate and in the expected order.
So you do a lot of transmit and reception of CAN frames?
> On another thread Alexander is reporting problems with the same driver
> when he runs a I2C application concurrently. Are you able to stress the
> system in a similar way?
Could you please test with the following patch? Do you see error messages from this patch?
Thanks!
Alexander
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index d63aaa3..da9bbc0 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -1186,6 +1186,7 @@ struct net_device *alloc_c_can_dev(void)
CAN_CTRLMODE_BERR_REPORTING;
spin_lock_init(&priv->lock);
+ spin_lock_init(&priv->testlock);
return dev;
}
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 3487d5e..2b58b75 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -173,6 +173,7 @@ struct c_can_priv {
unsigned int instance;
void (*init) (const struct c_can_priv *priv, bool enable);
spinlock_t lock; /* to protect tx and rx message objects */
+ spinlock_t testlock; /* to protect tx and rx message objects */
};
struct net_device *alloc_c_can_dev(void);
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index 2516ea9..0ac4d43 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -74,13 +74,37 @@ static void c_can_pci_write_reg_aligned_to_32bit(struct c_can_priv *priv,
static u16 c_can_pci_read_reg_32bit(struct c_can_priv *priv,
enum reg index)
{
- return (u16)ioread32(priv->base + 2 * priv->regs[index]);
+ unsigned long flags;
+ u16 reg;
+
+ spin_lock_irqsave(&priv->testlock, flags);
+ reg = (u16)ioread32(priv->base + 2 * priv->regs[index]);
+ spin_unlock_irqrestore(&priv->testlock, flags);
+
+ return reg;
}
static void c_can_pci_write_reg_32bit(struct c_can_priv *priv,
enum reg index, u16 val)
{
- iowrite32((u32)val, priv->base + 2 * priv->regs[index]);
+ u16 reg;
+ unsigned long flags;
+ int retries;
+
+ retries = 0;
+
+ spin_lock_irqsave(&priv->testlock, flags);
+
+ do
+ {
+ iowrite32((u32)val, priv->base + 2 * priv->regs[index]);
+ reg = (u16)ioread32(priv->base + 2 * priv->regs[index]);
+ if (reg != val)
+ {
+ netdev_err(priv->dev, "write 0x%x to offset 0x%x failed. got: 0x%x\n", val, 2 * priv->regs[index], reg);
+ }
+ } while ((reg != val) && (retries++ < 20));
+ spin_unlock_irqrestore(&priv->testlock, flags);
}
static void c_can_pci_reset_pch(const struct c_can_priv *priv, bool enable)
next prev parent reply other threads:[~2012-12-06 17:05 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 15:39 pch_can: Data transmission stops after dropped packet Michael Pellegrini
2012-11-14 21:40 ` Michael Pellegrini
2012-11-15 7:18 ` Oliver Hartkopp
2012-11-15 13:13 ` Wolfgang Grandegger
2012-11-15 16:23 ` Michael Pellegrini
2012-11-15 21:19 ` Wolfgang Grandegger
2012-11-15 21:34 ` Michael Pellegrini
2012-11-15 21:51 ` Wolfgang Grandegger
2012-11-18 22:22 ` Wolfgang Grandegger
2012-11-19 15:10 ` Michael Pellegrini
2012-11-19 15:26 ` Wolfgang Grandegger
2012-11-19 16:20 ` Michael Pellegrini
2012-11-19 16:31 ` Wolfgang Grandegger
2012-11-19 17:39 ` Michael Pellegrini
2012-11-19 19:22 ` Wolfgang Grandegger
2012-11-19 20:19 ` Michael Pellegrini
2012-11-19 21:46 ` Wolfgang Grandegger
2012-11-20 14:25 ` Michael Pellegrini
2012-11-20 16:12 ` Wolfgang Grandegger
2012-11-20 19:12 ` Michael Pellegrini
2012-11-20 21:05 ` Wolfgang Grandegger
2012-11-21 10:24 ` Wolfgang Grandegger
[not found] ` <loom.20121121T160744-278@post.gmane.or g>
2012-11-21 15:15 ` Michael Pellegrini
[not found] ` <loom.20121121T160744-278@post.gmane.or g>
2012-11-21 15:25 ` Michael Pellegrini
2012-11-21 15:32 ` Marc Kleine-Budde
2012-11-21 16:11 ` Michael Pellegrini
2012-11-21 15:41 ` Michael Pellegrini
2012-11-21 15:56 ` Wolfgang Grandegger
2012-11-21 16:09 ` Michael Pellegrini
2012-11-21 16:41 ` Wolfgang Grandegger
2012-11-21 16:58 ` Casper Mogensen
2012-11-21 19:48 ` Wolfgang Grandegger
2012-11-21 17:43 ` Michael Pellegrini
2012-11-21 19:55 ` Wolfgang Grandegger
2012-11-21 21:00 ` Michael Pellegrini
2012-11-23 14:27 ` Michael Pellegrini
2012-11-23 14:45 ` Wolfgang Grandegger
2012-11-23 14:47 ` Wolfgang Grandegger
2012-11-23 15:14 ` Michael Pellegrini
2012-11-23 15:04 ` Michael Pellegrini
2012-11-23 17:00 ` Wolfgang Grandegger
2012-11-23 17:18 ` Wolfgang Grandegger
2012-11-23 17:52 ` Michael Pellegrini
2012-11-25 16:17 ` Wolfgang Grandegger
2012-11-26 14:54 ` Michael Pellegrini
2012-11-26 15:30 ` Wolfgang Grandegger
2012-11-26 17:30 ` Michael Pellegrini
2012-11-26 18:13 ` Wolfgang Grandegger
2012-11-29 12:15 ` Wolfgang Grandegger
2012-11-29 14:15 ` Michael Pellegrini
2012-12-06 14:20 ` Michael Pellegrini
2012-12-06 14:23 ` Marc Kleine-Budde
2012-12-06 14:41 ` Wolfgang Grandegger
2012-12-06 14:42 ` Marc Kleine-Budde
2012-12-06 14:42 ` Michael Pellegrini
2012-12-06 14:49 ` Wolfgang Grandegger
2012-12-06 17:05 ` Alexander Stein [this message]
2012-12-06 22:02 ` Wolfgang Grandegger
2012-12-06 23:24 ` Marc Kleine-Budde
2012-12-10 8:21 ` Alexander Stein
2012-12-11 20:24 ` Wolfgang Grandegger
2012-12-13 14:04 ` Alexander Stein
2012-12-11 14:46 ` Michael Pellegrini
2012-12-11 20:21 ` Wolfgang Grandegger
2012-12-12 13:35 ` Alexander Stein
2012-12-06 22:11 ` Michael Pellegrini
2012-12-06 23:23 ` Michael Pellegrini
2012-11-24 7:16 ` Wolfgang Grandegger
2012-11-26 3:33 ` Bhupesh SHARMA
2012-11-21 14:52 ` Michael Pellegrini
2012-11-21 15:02 ` Wolfgang Grandegger
2012-11-15 16:32 ` Casper Mogensen
2012-11-15 21:16 ` Wolfgang Grandegger
2012-11-16 19:39 ` Wolfgang Grandegger
2012-11-15 16:12 ` Michael Pellegrini
2012-11-20 18:59 ` Wolfgang Grandegger
2012-11-15 12:35 ` Steffen Rose
2012-11-15 18:26 ` Michael Pellegrini
2012-11-16 8:24 ` Steffen Rose
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=2331999.ZYFOYXdjyx@ws-stein \
--to=alexander.stein@systec-electronic.com \
--cc=linux-can@vger.kernel.org \
--cc=mikep86@gmail.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