Re: [PATCH v2] can: mcp251xfd: Add support for internal loopback mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/1/20 6:40 AM, Manivannan Sadhasivam wrote:
> MCP251xFD supports internal loopback mode which can be used to verify
> CAN functionality in the absence of a real CAN device.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> ---

Even CAN-FD + Listen Only works!

Applied to can-next/testing
> 
> Changes in v2:
> 
> * Sorted ctrl modes as per the value
> 
>  drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 3297eb7ecc9c..d9ef4cbcb8cd 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> @@ -932,6 +932,8 @@ static u8 mcp251xfd_get_normal_mode(const struct mcp251xfd_priv *priv)
>  		mode = MCP251XFD_REG_CON_MODE_LISTENONLY;
>  	else if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
>  		mode = MCP251XFD_REG_CON_MODE_MIXED;
> +	else if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
> +		mode = MCP251XFD_REG_CON_MODE_INT_LOOPBACK;

I've moved the CAN_CTRLMODE_LOOPBACK to the front of this.

>  	else
>  		mode = MCP251XFD_REG_CON_MODE_CAN2_0;
>  
> @@ -2799,9 +2801,9 @@ static int mcp251xfd_probe(struct spi_device *spi)
>  	priv->can.do_get_berr_counter = mcp251xfd_get_berr_counter;
>  	priv->can.bittiming_const = &mcp251xfd_bittiming_const;
>  	priv->can.data_bittiming_const = &mcp251xfd_data_bittiming_const;
> -	priv->can.ctrlmode_supported = CAN_CTRLMODE_LISTENONLY |
> -		CAN_CTRLMODE_BERR_REPORTING | CAN_CTRLMODE_FD |
> -		CAN_CTRLMODE_FD_NON_ISO;
> +	priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
> +		CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_BERR_REPORTING |
> +		CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO;
>  	priv->ndev = ndev;
>  	priv->spi = spi;
>  	priv->rx_int = rx_int;
> 

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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux