linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices
@ 2021-09-29 14:14 Stephane Grosjean
  2021-09-29 14:14 ` [PATCH 2/2] can: peak_usb: exchange the order of information messages Stephane Grosjean
  2021-10-17 20:50 ` [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Stephane Grosjean @ 2021-09-29 14:14 UTC (permalink / raw)
  To: linux-can Mailing List; +Cc: Stephane Grosjean

Since for the PCAN-USB, the management of the transition to the
ERROR_WARNING or ERROR_PASSIVE state is done according to the error
counters, these must be requested unconditionally.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 837b3fecd71e..4c8993f69e6b 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -841,14 +841,14 @@ static int pcan_usb_start(struct peak_usb_device *dev)
 	pdev->bec.rxerr = 0;
 	pdev->bec.txerr = 0;
 
-	/* be notified on error counter changes (if requested by user) */
-	if (dev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) {
-		err = pcan_usb_set_err_frame(dev, PCAN_USB_BERR_MASK);
-		if (err)
-			netdev_warn(dev->netdev,
-				    "Asking for BERR reporting error %u\n",
-				    err);
-	}
+	/* always ask the device for BERR reporting, to be able to switch from
+	 * WARNING to PASSIVE state
+	 */
+	err = pcan_usb_set_err_frame(dev, PCAN_USB_BERR_MASK);
+	if (err)
+		netdev_warn(dev->netdev,
+			    "Asking for BERR reporting error %u\n",
+			    err);
 
 	/* if revision greater than 3, can put silent mode on/off */
 	if (dev->device_rev > 3) {
-- 
2.25.1


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

* [PATCH 2/2] can: peak_usb: exchange the order of information messages
  2021-09-29 14:14 [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Stephane Grosjean
@ 2021-09-29 14:14 ` Stephane Grosjean
  2021-10-17 20:50 ` [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Stephane Grosjean @ 2021-09-29 14:14 UTC (permalink / raw)
  To: linux-can Mailing List; +Cc: Stephane Grosjean

Proposes the possible update of the PCAN-USB firmware after indicating its
name and current version.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 4c8993f69e6b..403e10b56f0c 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -883,6 +883,11 @@ static int pcan_usb_init(struct peak_usb_device *dev)
 		return err;
 	}
 
+	dev_info(dev->netdev->dev.parent,
+		 "PEAK-System %s adapter hwrev %u serial %08X (%u channel)\n",
+		 pcan_usb.name, dev->device_rev, serial_number,
+		 pcan_usb.ctrl_count);
+
 	/* Since rev 4.1, PCAN-USB is able to make single-shot as well as
 	 * looped back frames.
 	 */
@@ -896,11 +901,6 @@ static int pcan_usb_init(struct peak_usb_device *dev)
 			 "Firmware update available. Please contact support@peak-system.com\n");
 	}
 
-	dev_info(dev->netdev->dev.parent,
-		 "PEAK-System %s adapter hwrev %u serial %08X (%u channel)\n",
-		 pcan_usb.name, dev->device_rev, serial_number,
-		 pcan_usb.ctrl_count);
-
 	return 0;
 }
 
-- 
2.25.1


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

* Re: [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices
  2021-09-29 14:14 [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Stephane Grosjean
  2021-09-29 14:14 ` [PATCH 2/2] can: peak_usb: exchange the order of information messages Stephane Grosjean
@ 2021-10-17 20:50 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-17 20:50 UTC (permalink / raw)
  To: Stephane Grosjean; +Cc: linux-can Mailing List

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

On 29.09.2021 16:14:20, Stephane Grosjean wrote:
> Since for the PCAN-USB, the management of the transition to the
> ERROR_WARNING or ERROR_PASSIVE state is done according to the error
> counters, these must be requested unconditionally.

If you switch on bus error reporting unconditionally, please remove
CAN_CTRLMODE_BERR_REPORTING from ctrlmode_supported.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-10-17 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 14:14 [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Stephane Grosjean
2021-09-29 14:14 ` [PATCH 2/2] can: peak_usb: exchange the order of information messages Stephane Grosjean
2021-10-17 20:50 ` [PATCH 1/2] can: peak_usb: always ask for BERR reporting for PCAN-USB devices Marc Kleine-Budde

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