[Armadeus-commitlog] armadeus branch, master, updated. armadeus-7.0-224-ge10e2d19a
Brought to you by:
sszy
|
From: Sébastien S. <ss...@us...> - 2021-01-22 08:25:01
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via e10e2d19a158bb5e9b4970a01bd09c9dd698c94c (commit)
from 118116206eab319d3468ed78a1cf9c259e8ba343 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e10e2d19a158bb5e9b4970a01bd09c9dd698c94c
Author: Sébastien Szymanski <seb...@ar...>
Date: Fri Jan 22 09:24:46 2021 +0100
[PATCH] 5.4.imx_legacy: add patches for tcan
-----------------------------------------------------------------------
Summary of changes:
...rm64-dts-imx8mm-opos8mmdev-fixes-for-tcan.patch | 61 ++++++++++++++
...9-can-m_can-add-support-for-one-shot-mode.patch | 86 ++++++++++++++++++++
...dd-support-for-handling-arbitration-error.patch | 93 ++++++++++++++++++++++
3 files changed, 240 insertions(+)
create mode 100644 patches/linux/5.4.imx_legacy/0538-arm64-dts-imx8mm-opos8mmdev-fixes-for-tcan.patch
create mode 100644 patches/linux/5.4.imx_legacy/0539-can-m_can-add-support-for-one-shot-mode.patch
create mode 100644 patches/linux/5.4.imx_legacy/0540-can-m_can-add-support-for-handling-arbitration-error.patch
diff --git a/patches/linux/5.4.imx_legacy/0538-arm64-dts-imx8mm-opos8mmdev-fixes-for-tcan.patch b/patches/linux/5.4.imx_legacy/0538-arm64-dts-imx8mm-opos8mmdev-fixes-for-tcan.patch
new file mode 100644
index 000000000..c992aa061
--- /dev/null
+++ b/patches/linux/5.4.imx_legacy/0538-arm64-dts-imx8mm-opos8mmdev-fixes-for-tcan.patch
@@ -0,0 +1,61 @@
+From 4d06b018be04ce8cd0782508de328f3a4dac9edc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Szymanski?=
+ <seb...@ar...>
+Date: Fri, 22 Jan 2021 08:59:45 +0100
+Subject: [PATCH 538/540] arm64: dts: imx8mm-opos8mmdev: fixes for tcan
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* Use controller's chip select
+* fix M_RAM configuration
+* add can-transceiver node
+* use IRQ_TYPE_LEVEL_LOW instead of GPIO_ACTIVE_LOW
+
+Signed-off-by: Sébastien Szymanski <seb...@ar...>
+---
+ arch/arm64/boot/dts/freescale/imx8mm-opos8mmdev.dts | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-opos8mmdev.dts b/arch/arm64/boot/dts/freescale/imx8mm-opos8mmdev.dts
+index 309a582b124c..979032820561 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-opos8mmdev.dts
++++ b/arch/arm64/boot/dts/freescale/imx8mm-opos8mmdev.dts
+@@ -155,7 +155,7 @@
+ &ecspi2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_ecspi2>;
+- cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
++ cs-gpios = <0>;
+ status = "okay";
+
+ can@0 {
+@@ -164,10 +164,14 @@
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_can>;
+ spi-max-frequency = <18000000>;
+- bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>;
++ bosch,mram-cfg = <0x0 0 0 24 0 0 4 4>;
+ interrupt-parent = <&gpio1>;
+- interrupts = <9 GPIO_ACTIVE_LOW>;
++ interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+ reset-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
++
++ can-transceiver {
++ max-bitrate = <8000000>;
++ };
+ };
+ };
+
+@@ -362,7 +366,7 @@
+ MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x10
+ MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x90
+ MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x90
+- MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x90
++ MX8MM_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x90
+ >;
+ };
+
+--
+2.26.2
+
diff --git a/patches/linux/5.4.imx_legacy/0539-can-m_can-add-support-for-one-shot-mode.patch b/patches/linux/5.4.imx_legacy/0539-can-m_can-add-support-for-one-shot-mode.patch
new file mode 100644
index 000000000..f114aea70
--- /dev/null
+++ b/patches/linux/5.4.imx_legacy/0539-can-m_can-add-support-for-one-shot-mode.patch
@@ -0,0 +1,86 @@
+From 07a67778417799981f5c8f102b94d9f35ed8b581 Mon Sep 17 00:00:00 2001
+From: Pankaj Sharma <pan...@sa...>
+Date: Mon, 21 Oct 2019 17:34:40 +0530
+Subject: [PATCH 539/540] can: m_can: add support for one shot mode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+According to the CAN Specification (see ISO 11898-1:2015, 8.3.4
+Recovery Management), the M_CAN provides means for automatic
+retransmission of frames that have lost arbitration or that
+have been disturbed by errors during transmission. By default
+automatic retransmission is enabled.
+
+The Bosch MCAN controller has support for disabling automatic
+retransmission.
+
+To support time-triggered communication as described in ISO
+11898-1:2015, chapter 9.2, the automatic retransmission may be
+disabled via CCCR.DAR.
+
+CAN_CTRLMODE_ONE_SHOT is used for disabling automatic retransmission.
+
+Signed-off-by: Pankaj Sharma <pan...@sa...>
+Signed-off-by: Sriram Dash <sri...@sa...>
+Signed-off-by: Marc Kleine-Budde <mk...@pe...>
+(cherry picked from commit fb7d6a81c220178851badef9dd6eeba88264320a)
+Signed-off-by: Sébastien Szymanski <seb...@ar...>
+---
+ drivers/net/can/m_can/m_can.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
+index 562c8317e3aa..75e7490c4299 100644
+--- a/drivers/net/can/m_can/m_can.c
++++ b/drivers/net/can/m_can/m_can.c
+@@ -123,6 +123,7 @@ enum m_can_reg {
+ #define CCCR_CME_CANFD_BRS 0x2
+ #define CCCR_TXP BIT(14)
+ #define CCCR_TEST BIT(7)
++#define CCCR_DAR BIT(6)
+ #define CCCR_MON BIT(5)
+ #define CCCR_CSR BIT(4)
+ #define CCCR_CSA BIT(3)
+@@ -1135,7 +1136,7 @@ static void m_can_chip_config(struct net_device *dev)
+ if (cdev->version == 30) {
+ /* Version 3.0.x */
+
+- cccr &= ~(CCCR_TEST | CCCR_MON |
++ cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_DAR |
+ (CCCR_CMR_MASK << CCCR_CMR_SHIFT) |
+ (CCCR_CME_MASK << CCCR_CME_SHIFT));
+
+@@ -1145,7 +1146,7 @@ static void m_can_chip_config(struct net_device *dev)
+ } else {
+ /* Version 3.1.x or 3.2.x */
+ cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
+- CCCR_NISO);
++ CCCR_NISO | CCCR_DAR);
+
+ /* Only 3.2.x has NISO Bit implemented */
+ if (cdev->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
+@@ -1165,6 +1166,10 @@ static void m_can_chip_config(struct net_device *dev)
+ if (cdev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
+ cccr |= CCCR_MON;
+
++ /* Disable Auto Retransmission (all versions) */
++ if (cdev->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
++ cccr |= CCCR_DAR;
++
+ /* Write config */
+ m_can_write(cdev, M_CAN_CCCR, cccr);
+ m_can_write(cdev, M_CAN_TEST, test);
+@@ -1310,7 +1315,8 @@ static int m_can_dev_setup(struct m_can_classdev *m_can_dev)
+ m_can_dev->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
+ CAN_CTRLMODE_LISTENONLY |
+ CAN_CTRLMODE_BERR_REPORTING |
+- CAN_CTRLMODE_FD;
++ CAN_CTRLMODE_FD |
++ CAN_CTRLMODE_ONE_SHOT;
+
+ /* Set properties depending on M_CAN version */
+ switch (m_can_dev->version) {
+--
+2.26.2
+
diff --git a/patches/linux/5.4.imx_legacy/0540-can-m_can-add-support-for-handling-arbitration-error.patch b/patches/linux/5.4.imx_legacy/0540-can-m_can-add-support-for-handling-arbitration-error.patch
new file mode 100644
index 000000000..d5f14561f
--- /dev/null
+++ b/patches/linux/5.4.imx_legacy/0540-can-m_can-add-support-for-handling-arbitration-error.patch
@@ -0,0 +1,93 @@
+From a1294304a7f1c326166ebfe3ad9165604430a40c Mon Sep 17 00:00:00 2001
+From: Pankaj Sharma <pan...@sa...>
+Date: Wed, 30 Oct 2019 17:08:59 +0530
+Subject: [PATCH 540/540] can: m_can: add support for handling arbitration
+ error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The Bosch MCAN hardware (3.1.0 and above) supports interrupt flag to
+detect Protocol error in arbitration phase.
+
+Transmit error statistics is currently not updated from the MCAN driver.
+Protocol error in arbitration phase is a TX error and the network
+statistics should be updated accordingly.
+
+The member "tx_error" of "struct net_device_stats" should be incremented
+as arbitration is a transmit protocol error. Also "arbitration_lost" of
+"struct can_device_stats" should be incremented to report arbitration
+lost.
+
+Signed-off-by: Pankaj Sharma <pan...@sa...>
+Signed-off-by: Sriram Dash <sri...@sa...>
+Signed-off-by: Marc Kleine-Budde <mk...@pe...>
+(cherry picked from commit 6b43a2650806ca59e9ac2554cfd1cf23ed491879)
+Signed-off-by: Sébastien Szymanski <seb...@ar...>
+---
+ drivers/net/can/m_can/m_can.c | 42 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
+index 75e7490c4299..02c5795b7393 100644
+--- a/drivers/net/can/m_can/m_can.c
++++ b/drivers/net/can/m_can/m_can.c
+@@ -778,6 +778,43 @@ static inline bool is_lec_err(u32 psr)
+ return psr && (psr != LEC_UNUSED);
+ }
+
++static inline bool m_can_is_protocol_err(u32 irqstatus)
++{
++ return irqstatus & IR_ERR_LEC_31X;
++}
++
++static int m_can_handle_protocol_error(struct net_device *dev, u32 irqstatus)
++{
++ struct net_device_stats *stats = &dev->stats;
++ struct m_can_classdev *cdev = netdev_priv(dev);
++ struct can_frame *cf;
++ struct sk_buff *skb;
++
++ /* propagate the error condition to the CAN stack */
++ skb = alloc_can_err_skb(dev, &cf);
++
++ /* update tx error stats since there is protocol error */
++ stats->tx_errors++;
++
++ /* update arbitration lost status */
++ if (cdev->version >= 31 && (irqstatus & IR_PEA)) {
++ netdev_dbg(dev, "Protocol error in Arbitration fail\n");
++ cdev->can.can_stats.arbitration_lost++;
++ if (skb) {
++ cf->can_id |= CAN_ERR_LOSTARB;
++ cf->data[0] |= CAN_ERR_LOSTARB_UNSPEC;
++ }
++ }
++
++ if (unlikely(!skb)) {
++ netdev_dbg(dev, "allocation of skb failed\n");
++ return 0;
++ }
++ netif_receive_skb(skb);
++
++ return 1;
++}
++
+ static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
+ u32 psr)
+ {
+@@ -792,6 +829,11 @@ static int m_can_handle_bus_errors(struct net_device *dev, u32 irqstatus,
+ is_lec_err(psr))
+ work_done += m_can_handle_lec_err(dev, psr & LEC_UNUSED);
+
++ /* handle protocol errors in arbitration phase */
++ if ((cdev->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) &&
++ m_can_is_protocol_err(irqstatus))
++ work_done += m_can_handle_protocol_error(dev, irqstatus);
++
+ /* other unproccessed error interrupts */
+ m_can_handle_other_err(dev, irqstatus);
+
+--
+2.26.2
+
hooks/post-receive
--
armadeus
|