linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: kvaser_pciefd: Always disable bus load reporting
@ 2021-03-09  9:17 Jimmy Assarsson
  2021-03-09  9:17 ` [PATCH] can: kvaser_usb: Add support for USBcan Pro 4xHS Jimmy Assarsson
  2021-03-09 10:19 ` [PATCH] can: kvaser_pciefd: Always disable bus load reporting Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Jimmy Assarsson @ 2021-03-09  9:17 UTC (permalink / raw)
  To: linux-can; +Cc: Jimmy Assarsson, Jimmy Assarsson

From: Jimmy Assarsson <extja@kvaser.com>

Under certain circumstances, when switching from Kvaser's linuxcan driver
(kvpciefd) to the SocketCAN driver (kvaser_pciefd), the bus load reporting
is not disabled.
This is flooding the kernel log with prints like:
[3485.574677] kvaser_pciefd 0000:02:00.0: Received unexpected packet type 0x00000009

Always put the controller in the expected state, instead of assuming that
bus load reporting is inactive.

Note: If bus load reporting is enabled when the driver is loaded, you will
      still get a number of bus load packages (and printouts), before it is
      disabled.

Fixes: 26ad340e582d ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices")
Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
---
 drivers/net/can/kvaser_pciefd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
index 37e05010ca91..74d9899fc904 100644
--- a/drivers/net/can/kvaser_pciefd.c
+++ b/drivers/net/can/kvaser_pciefd.c
@@ -57,6 +57,7 @@ MODULE_DESCRIPTION("CAN driver for Kvaser CAN/PCIe devices");
 #define KVASER_PCIEFD_KCAN_STAT_REG 0x418
 #define KVASER_PCIEFD_KCAN_MODE_REG 0x41c
 #define KVASER_PCIEFD_KCAN_BTRN_REG 0x420
+#define KVASER_PCIEFD_KCAN_BUS_LOAD_REG 0x424
 #define KVASER_PCIEFD_KCAN_BTRD_REG 0x428
 #define KVASER_PCIEFD_KCAN_PWM_REG 0x430
 /* Loopback control register */
@@ -949,6 +950,9 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie)
 		timer_setup(&can->bec_poll_timer, kvaser_pciefd_bec_poll_timer,
 			    0);
 
+		/* Disable Bus load reporting */
+		iowrite32(0, can->reg_base + KVASER_PCIEFD_KCAN_BUS_LOAD_REG);
+
 		tx_npackets = ioread32(can->reg_base +
 				       KVASER_PCIEFD_KCAN_TX_NPACKETS_REG);
 		if (((tx_npackets >> KVASER_PCIEFD_KCAN_TX_NPACKETS_MAX_SHIFT) &
-- 
2.30.0


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

* [PATCH] can: kvaser_usb: Add support for USBcan Pro 4xHS
  2021-03-09  9:17 [PATCH] can: kvaser_pciefd: Always disable bus load reporting Jimmy Assarsson
@ 2021-03-09  9:17 ` Jimmy Assarsson
  2021-03-09 10:19 ` [PATCH] can: kvaser_pciefd: Always disable bus load reporting Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Jimmy Assarsson @ 2021-03-09  9:17 UTC (permalink / raw)
  To: linux-can; +Cc: Jimmy Assarsson, Jimmy Assarsson

From: Jimmy Assarsson <extja@kvaser.com>

Add support for Kvaser USBcan Pro 4xHS.

Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
---
 drivers/net/can/usb/Kconfig                      | 1 +
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig
index c1e5d5b570b6..538f4d9adb91 100644
--- a/drivers/net/can/usb/Kconfig
+++ b/drivers/net/can/usb/Kconfig
@@ -73,6 +73,7 @@ config CAN_KVASER_USB
 	    - Kvaser Memorator Pro 5xHS
 	    - Kvaser USBcan Light 4xHS
 	    - Kvaser USBcan Pro 2xHS v2
+	    - Kvaser USBcan Pro 4xHS
 	    - Kvaser USBcan Pro 5xHS
 	    - Kvaser U100
 	    - Kvaser U100P
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
index 2b7efd296758..4e97da8434ab 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
@@ -86,8 +86,9 @@
 #define USB_U100_PRODUCT_ID			273
 #define USB_U100P_PRODUCT_ID			274
 #define USB_U100S_PRODUCT_ID			275
+#define USB_USBCAN_PRO_4HS_PRODUCT_ID		276
 #define USB_HYDRA_PRODUCT_ID_END \
-	USB_U100S_PRODUCT_ID
+	USB_USBCAN_PRO_4HS_PRODUCT_ID
 
 static inline bool kvaser_is_leaf(const struct usb_device_id *id)
 {
@@ -193,6 +194,7 @@ static const struct usb_device_id kvaser_usb_table[] = {
 	{ USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) },
 	{ USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) },
 	{ USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) },
+	{ USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_4HS_PRODUCT_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, kvaser_usb_table);
-- 
2.30.0


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

* Re: [PATCH] can: kvaser_pciefd: Always disable bus load reporting
  2021-03-09  9:17 [PATCH] can: kvaser_pciefd: Always disable bus load reporting Jimmy Assarsson
  2021-03-09  9:17 ` [PATCH] can: kvaser_usb: Add support for USBcan Pro 4xHS Jimmy Assarsson
@ 2021-03-09 10:19 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-03-09 10:19 UTC (permalink / raw)
  To: Jimmy Assarsson, linux-can; +Cc: Jimmy Assarsson


[-- Attachment #1.1: Type: text/plain, Size: 1360 bytes --]

On 3/9/21 10:17 AM, Jimmy Assarsson wrote:
> From: Jimmy Assarsson <extja@kvaser.com>
> 
> Under certain circumstances, when switching from Kvaser's linuxcan driver
> (kvpciefd) to the SocketCAN driver (kvaser_pciefd), the bus load reporting
> is not disabled.
> This is flooding the kernel log with prints like:
> [3485.574677] kvaser_pciefd 0000:02:00.0: Received unexpected packet type 0x00000009
> 
> Always put the controller in the expected state, instead of assuming that
> bus load reporting is inactive.
> 
> Note: If bus load reporting is enabled when the driver is loaded, you will
>       still get a number of bus load packages (and printouts), before it is
>       disabled.
> 
> Fixes: 26ad340e582d ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices")
> Signed-off-by: Jimmy Assarsson <extja@kvaser.com>

You are sending these patches from your gmail address, which is not in the list
of S-o-b.

Please add an a S-o-b from the email address you're sending from for the next
patches.

Applied both to linux-can/testing.

regards,
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: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  9:17 [PATCH] can: kvaser_pciefd: Always disable bus load reporting Jimmy Assarsson
2021-03-09  9:17 ` [PATCH] can: kvaser_usb: Add support for USBcan Pro 4xHS Jimmy Assarsson
2021-03-09 10:19 ` [PATCH] can: kvaser_pciefd: Always disable bus load reporting 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).