can: flexcan: flexcan_chip_start(): enable loopback mode in flexcan
Self reception disable bit needs to be cleared for loopback mode to work in flexcan. Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Родитель
de3578c198
Коммит
7ad0f53a39
|
@ -995,7 +995,6 @@ static int flexcan_chip_start(struct net_device *dev)
|
|||
* halt now
|
||||
* only supervisor access
|
||||
* enable warning int
|
||||
* disable local echo
|
||||
* enable individual RX masking
|
||||
* choose format C
|
||||
* set max mailbox number
|
||||
|
@ -1003,8 +1002,8 @@ static int flexcan_chip_start(struct net_device *dev)
|
|||
reg_mcr = priv->read(®s->mcr);
|
||||
reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
|
||||
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV |
|
||||
FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SRX_DIS | FLEXCAN_MCR_IRMQ |
|
||||
FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(FLEXCAN_TX_MB);
|
||||
FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_IRMQ | FLEXCAN_MCR_IDAM_C |
|
||||
FLEXCAN_MCR_MAXMB(FLEXCAN_TX_MB);
|
||||
|
||||
/* MCR
|
||||
*
|
||||
|
@ -1017,6 +1016,23 @@ static int flexcan_chip_start(struct net_device *dev)
|
|||
else
|
||||
reg_mcr |= FLEXCAN_MCR_FEN;
|
||||
|
||||
/* MCR
|
||||
*
|
||||
* NOTE: In loopback mode, the CAN_MCR[SRXDIS] cannot be
|
||||
* asserted because this will impede the self reception
|
||||
* of a transmitted message. This is not documented in
|
||||
* earlier versions of flexcan block guide.
|
||||
*
|
||||
* Self Reception:
|
||||
* - enable Self Reception for loopback mode
|
||||
* (by clearing "Self Reception Disable" bit)
|
||||
* - disable for normal operation
|
||||
*/
|
||||
if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
|
||||
reg_mcr &= ~FLEXCAN_MCR_SRX_DIS;
|
||||
else
|
||||
reg_mcr |= FLEXCAN_MCR_SRX_DIS;
|
||||
|
||||
netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
|
||||
priv->write(reg_mcr, ®s->mcr);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче