lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 10 May 2019 10:50:08 +0000
From:   Joakim Zhang <qiangqing.zhang@....com>
To:     "mkl@...gutronix.de" <mkl@...gutronix.de>,
        "linux-can@...r.kernel.org" <linux-can@...r.kernel.org>
CC:     dl-linux-imx <linux-imx@....com>,
        "wg@...ndegger.com" <wg@...ndegger.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Stefan-gabriel Mirea <stefan-gabriel.mirea@....com>,
        Aisheng Dong <aisheng.dong@....com>,
        Joakim Zhang <qiangqing.zhang@....com>
Subject: [PATCH V3 5/7] can: flexcan: add CANFD BRS support

From: Dong Aisheng <aisheng.dong@....com>

This patch intends to add CAN FD BitRate Switch(BRS) support in driver.

Signed-off-by: Joakim Zhang <qiangqing.zhang@....com>
Signed-off-by: Dong Aisheng <aisheng.dong@....com>

ChangeLog:
----------
V2->V3:
	*split from another patch
---
 drivers/net/can/flexcan.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index c45c92948195..ca7240d69042 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -687,8 +687,12 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de
 		ctrl |= FLEXCAN_MB_CNT_RTR;
 
 	if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
-		if (can_is_canfd_skb(skb))
+		if (can_is_canfd_skb(skb)) {
 			ctrl |= FLEXCAN_MB_CNT_EDL;
+
+			if (cf->flags & CANFD_BRS)
+				ctrl |= FLEXCAN_MB_CNT_BRS;
+		}
 	}
 
 	for (i = 0; i < cf->len; i += sizeof(u32)) {
@@ -909,6 +913,9 @@ static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, bool dr
 
 		if (reg_ctrl & FLEXCAN_MB_CNT_EDL) {
 			cf->len = can_dlc2len((reg_ctrl >> 16) & 0x0F);
+
+			if (reg_ctrl & FLEXCAN_MB_CNT_BRS)
+				cf->flags |= CANFD_BRS;
 		} else {
 			cf->len = get_can_dlc((reg_ctrl >> 16) & 0x0F);
 
-- 
2.17.1

Powered by blists - more mailing lists