netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2013-10-09
@ 2013-10-09 21:11 Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 1/3] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX Marc Kleine-Budde
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-10-09 21:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

here are three fixes for the v3.12 release cycle. The first fixes a regression
in the flexcan driver which was introduced in a previous v3.12 patch. The
second one fixes the mx28 detection in the flexcan driver. The third one
targets the at91_can driver and fixes the driver data mapping for platform
devices.

regards, Marc
---

The following changes since commit 87b0a0b5c46aea63cdc5c5d788fe2c91406e3161:

  Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2013-10-09 14:04:00 -0400)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can.git fixes-for-3.12

for you to fetch changes up to 5abbeea553c8260ed4e2ac4aae962aff800b6c6d:

  can: at91-can: fix device to driver data mapping for platform devices (2013-10-09 23:04:31 +0200)

----------------------------------------------------------------
Marc Kleine-Budde (3):
      can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX
      can: flexcan: fix mx28 detection by rearanging OF match table
      can: at91-can: fix device to driver data mapping for platform devices

 drivers/net/can/at91_can.c |  4 ++--
 drivers/net/can/flexcan.c  | 14 ++++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX
  2013-10-09 21:11 pull-request: can 2013-10-09 Marc Kleine-Budde
@ 2013-10-09 21:11 ` Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 2/3] can: flexcan: fix mx28 detection by rearanging OF match table Marc Kleine-Budde
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-10-09 21:11 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable,
	Lothar Waßmann

In patch

    0d1862e can: flexcan: fix flexcan_chip_start() on imx6

the loop in flexcan_chip_start() that iterates over all mailboxes after the
soft reset of the CAN core was removed. This loop put all mailboxes (even the
ones marked as reserved 1...7) into EMPTY/INACTIVE mode. On mailboxes 8...63,
this aborts any pending TX messages.

After a cold boot there is random garbage in the mailboxes, which leads to
spontaneous transmit of CAN frames during first activation. Further if the
interface was disabled with a pending message (usually due to an error
condition on the CAN bus), this message is retransmitted after enabling the
interface again.

This patch fixes the regression by:
1) Limiting the maximum number of used mailboxes to 8, 0...7 are used by the RX
FIFO, 8 is used by TX.
2) Marking the TX mailbox as EMPTY/INACTIVE, so that any pending TX of that
mailbox is aborted.

Cc: linux-stable <stable@vger.kernel.org>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 3f21142..f028c5d 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -62,7 +62,7 @@
 #define FLEXCAN_MCR_BCC			BIT(16)
 #define FLEXCAN_MCR_LPRIO_EN		BIT(13)
 #define FLEXCAN_MCR_AEN			BIT(12)
-#define FLEXCAN_MCR_MAXMB(x)		((x) & 0xf)
+#define FLEXCAN_MCR_MAXMB(x)		((x) & 0x1f)
 #define FLEXCAN_MCR_IDAM_A		(0 << 8)
 #define FLEXCAN_MCR_IDAM_B		(1 << 8)
 #define FLEXCAN_MCR_IDAM_C		(2 << 8)
@@ -735,9 +735,11 @@ static int flexcan_chip_start(struct net_device *dev)
 	 *
 	 */
 	reg_mcr = flexcan_read(&regs->mcr);
+	reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
 	reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
 		FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
-		FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS;
+		FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS |
+		FLEXCAN_MCR_MAXMB(FLEXCAN_TX_BUF_ID);
 	netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
 	flexcan_write(reg_mcr, &regs->mcr);
 
@@ -771,6 +773,10 @@ static int flexcan_chip_start(struct net_device *dev)
 	netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
 	flexcan_write(reg_ctrl, &regs->ctrl);
 
+	/* Abort any pending TX, mark Mailbox as INACTIVE */
+	flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
+		      &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
+
 	/* acceptance mask/acceptance code (accept everything) */
 	flexcan_write(0x0, &regs->rxgmask);
 	flexcan_write(0x0, &regs->rx14mask);
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] can: flexcan: fix mx28 detection by rearanging OF match table
  2013-10-09 21:11 pull-request: can 2013-10-09 Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 1/3] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX Marc Kleine-Budde
@ 2013-10-09 21:11 ` Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 3/3] can: at91-can: fix device to driver data mapping for platform devices Marc Kleine-Budde
  2013-10-10  3:45 ` pull-request: can 2013-10-09 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-10-09 21:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable

The current implemetation of of_match_device() relies that the of_device_id
table in the driver is sorted from most specific to least specific compatible.

Without this patch the mx28 is detected as the less specific p1010. This leads
to a p1010 specific workaround is activated on the mx28, which is not needed.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index f028c5d..8f5ce74 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -985,9 +985,9 @@ static void unregister_flexcandev(struct net_device *dev)
 }
 
 static const struct of_device_id flexcan_of_match[] = {
-	{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
-	{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
 	{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
+	{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
+	{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, flexcan_of_match);
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] can: at91-can: fix device to driver data mapping for platform devices
  2013-10-09 21:11 pull-request: can 2013-10-09 Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 1/3] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX Marc Kleine-Budde
  2013-10-09 21:11 ` [PATCH 2/3] can: flexcan: fix mx28 detection by rearanging OF match table Marc Kleine-Budde
@ 2013-10-09 21:11 ` Marc Kleine-Budde
  2013-10-10  3:45 ` pull-request: can 2013-10-09 David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2013-10-09 21:11 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable,
	Ludovic Desroches

In commit:

    3078cde7 can: at91_can: add dt support

device tree support was added to the at91_can driver. In this commit the
mapping of device to driver data was mixed up. This results in the sam9x5
parameters being used for the sam9263 and the workaround for the broken mailbox
0 on the sam9263 not being activated.

This patch fixes the broken platform_device_id table.

Cc: linux-stable <stable@vger.kernel.org>
Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/at91_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 3b1ff61..693d8ff 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1405,10 +1405,10 @@ static int at91_can_remove(struct platform_device *pdev)
 
 static const struct platform_device_id at91_can_id_table[] = {
 	{
-		.name = "at91_can",
+		.name = "at91sam9x5_can",
 		.driver_data = (kernel_ulong_t)&at91_at91sam9x5_data,
 	}, {
-		.name = "at91sam9x5_can",
+		.name = "at91_can",
 		.driver_data = (kernel_ulong_t)&at91_at91sam9263_data,
 	}, {
 		/* sentinel */
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: pull-request: can 2013-10-09
  2013-10-09 21:11 pull-request: can 2013-10-09 Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2013-10-09 21:11 ` [PATCH 3/3] can: at91-can: fix device to driver data mapping for platform devices Marc Kleine-Budde
@ 2013-10-10  3:45 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-10-10  3:45 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed,  9 Oct 2013 23:11:55 +0200

> here are three fixes for the v3.12 release cycle. The first fixes a regression
> in the flexcan driver which was introduced in a previous v3.12 patch. The
> second one fixes the mx28 detection in the flexcan driver. The third one
> targets the at91_can driver and fixes the driver data mapping for platform
> devices.

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-10  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09 21:11 pull-request: can 2013-10-09 Marc Kleine-Budde
2013-10-09 21:11 ` [PATCH 1/3] can: flexcan: flexcan_chip_start: fix regression, mark one MB for TX and abort pending TX Marc Kleine-Budde
2013-10-09 21:11 ` [PATCH 2/3] can: flexcan: fix mx28 detection by rearanging OF match table Marc Kleine-Budde
2013-10-09 21:11 ` [PATCH 3/3] can: at91-can: fix device to driver data mapping for platform devices Marc Kleine-Budde
2013-10-10  3:45 ` pull-request: can 2013-10-09 David Miller

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).