From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Pankaj Sharma <pankj.sharma@samsung.com>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: wg@grandegger.com, davem@davemloft.net,
eugen.hristev@microchip.com, ludovic.desroches@microchip.com,
pankaj.dubey@samsung.com, rcsekar@samsung.com,
Sriram Dash <sriram.dash@samsung.com>
Subject: Re: [PATCH v3] can: m_can: add support for one shot mode
Date: Wed, 6 Nov 2019 11:34:26 +0100 [thread overview]
Message-ID: <38ade7ff-0e0c-afe9-a927-17317f0f27b9@pengutronix.de> (raw)
In-Reply-To: <1571659480-29109-1-git-send-email-pankj.sharma@samsung.com>
[-- Attachment #1.1: Type: text/plain, Size: 3433 bytes --]
On 10/21/19 2:04 PM, Pankaj Sharma wrote:
> 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 <pankj.sharma@samsung.com>
> Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
> ---
>
> changes in v3:
> - resolving build errors for net-next branch
>
> changes in v2:
> - rebase to net-next
>
> 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) {
What happens if you have called netif_stop_queue() and the controller
was not able to send a single frame?
What happens to the echo_skb, if the controller was not able to send a
frame?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-11-06 10:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191021120513epcas5p2fd23f5dbdff6a0e6aa3b0726b30e4b60@epcas5p2.samsung.com>
2019-10-21 12:04 ` [PATCH v3] can: m_can: add support for one shot mode Pankaj Sharma
2019-10-25 9:43 ` pankj.sharma
2019-10-25 9:43 ` pankj.sharma
2019-11-06 6:03 ` pankj.sharma
2019-11-06 6:03 ` pankj.sharma
2019-11-06 10:34 ` Marc Kleine-Budde [this message]
2019-11-15 5:20 ` pankj.sharma
2019-11-15 5:20 ` pankj.sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38ade7ff-0e0c-afe9-a927-17317f0f27b9@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=eugen.hristev@microchip.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=netdev@vger.kernel.org \
--cc=pankaj.dubey@samsung.com \
--cc=pankj.sharma@samsung.com \
--cc=rcsekar@samsung.com \
--cc=sriram.dash@samsung.com \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.