can: m_can: Implement workaround for errata i2278 and i2279
Subsystems (4)
PATCH 1/1 can: m_can: Implement workaround for errata i2278 and i2279
Message transmit order is not guaranteed when dedicated TX buffers configured with the same Message ID are submitted simultaneously via TXBAR write. This is described in J7 errata i2278 and i2279.
As a workaround, introduce m_can_tx_peripheral_submit() to submit buffers one at a time using ffs() to find the next pending buffer. The TX complete interrupt(IR_TC) triggers submission of the next buffer, ensuring strict FIFO ordering.
---
drivers/net/can/m_can/m_can.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/can/m_can/m_can.c +17 -2
@@ -1225,6 +1225,17 @@ static void m_can_coalescing_update(struct m_can_classdev *cdev, u32 ir) HRTIMER_MODE_REL); } +static void m_can_tx_peripheral_submit (struct m_can_classdev *cdev) +{ +int ffs_idx; + + ffs_idx =ffs (cdev->tx_peripheral_submit); +if (ffs_idx >0 ) { +m_can_write (cdev,M_CAN_TXBAR , ffs_idx -1 ); + cdev->tx_peripheral_submit &= cdev->tx_peripheral_submit -1 ; + } +} +/* This interrupt handler is called either from the interrupt thread or a * hrtimer. This has implications like cancelling a timer won't be possible * blocking.
@@ -1290,6 +1301,11 @@ static int m_can_interrupt_handler(struct m_can_classdev *cdev)m_can_finish_tx (cdev,1 , frame_len); } }else { +if (cdev->is_peripheral && (ir &IR_TC )) { +if (cdev->tx_peripheral_submit >0 ) +m_can_tx_peripheral_submit (cdev); + } +if (ir & (IR_TEFN |IR_TEFW )) {/* New TX FIFO Element arrived */ ret =m_can_echo_tx_event (dev);
@@ -1956,8 +1972,7 @@ static void m_can_tx_submit(struct m_can_classdev *cdev)if (!cdev->is_peripheral)return ; -m_can_write (cdev,M_CAN_TXBAR , cdev->tx_peripheral_submit); - cdev->tx_peripheral_submit =0 ; +m_can_tx_peripheral_submit (cdev); }static void m_can_tx_work_queue (struct work_struct *ws)
Signature · 1 line
2.34.1
Marc Kleine-Budde
maintainerQuoted 10 lines · Anurag Dutta
Message transmit order is not guaranteed when dedicated TX buffers configured with the same Message ID are submitted simultaneously via TXBAR write. This is described in J7 errata i2278 and i2279.
As a workaround, introduce
m_can_tx_peripheral_submit()to submit buffers one at a time usingffs()to find the next pending buffer. The TX completeinterrupt(IR_TC)triggers submission of the next buffer, ensuring strict FIFO ordering.
This errata is for the "J721S2/TDA4VE/TDA4AL/TDA4VL/AM68A Processor Silicon Revision 1.0". The code path you modify is only active for the is_peripheral case.
is_peripheral is only set for the tcan4x5x SPI CAN controller, and not set for memory mapped M_CAN cores as found on the above mentioned TI processor:
| $ git grep peripheral\ = drivers/net/can/m_can | drivers/net/can/m_can/m_can_platform.c:149: mcan_class->is_peripheral = false; | drivers/net/can/m_can/tcan4x5x-core.c:460: mcan_class->is_peripheral = true;
The latest Bosch m_can documentation doesn't mention this problem, neither the TCAN4550 docs. Can this be an integration problem of the SoC on TI's side?
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Quoted 20 lines · Marc Kleine-Budde
Quoted 10 lines · Anurag Dutta
Message transmit order is not guaranteed when dedicated TX buffers configured with the same Message ID are submitted simultaneously via TXBAR write. This is described in J7 errata i2278 and i2279.
As a workaround, introduce
m_can_tx_peripheral_submit()to submit buffers one at a time usingffs()to find the next pending buffer. The TX completeinterrupt(IR_TC)triggers submission of the next buffer, ensuring strict FIFO ordering.This errata is for the "J721S2/TDA4VE/TDA4AL/TDA4VL/AM68A Processor Silicon Revision 1.0". The code path you modify is only active for the
is_peripheralcase.
is_peripheralis only set for the tcan4x5x SPI CAN controller, and not set for memory mappedM_CANcores as found on the above mentioned TI processor:
Quoted 8 lines
| $ git grep peripheral\ = drivers/net/can/m_can | drivers/net/can/m_can/m_can_platform.c:149: mcan_class->is_peripheral = false; | drivers/net/can/m_can/tcan4x5x-core.c:460: mcan_class->is_peripheral = true;The latest Bosch
m_candocumentation doesn't mention this problem, neither the TCAN4550 docs. Can this be an integration problem of the SoC on TI's side?
Hi Marc,
Sorry for delay
this is similar to Errata 22 from Bosch
Message order inversion when transmitting from dedicated Tx Buffers configured with same Message ID.
page-29, release doc REL20210625
Thanks
Udit
Quoted 3 lines
regards,
Marc
Marc Kleine-Budde
maintainerQuoted 8 lines · Udit
Quoted 3 lines
The latest Bosch
m_candocumentation doesn't mention this problem, neither the TCAN4550 docs. Can this be an integration problem of the SoC on TI's side?this is similar to Errata 22 from Bosch
Message order inversion when transmitting from dedicated Tx Buffers configured with same Message ID.
page-29, release doc REL20210625
Can you give me a link to the Bosch Errata sheet? Do you know if TI's tcan4x5x is affected by the erratum?
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Hi Marc,
Quoted 11 lines · Marc Kleine-Budde
Quoted 8 lines · Udit
Quoted 3 lines
The latest Bosch
m_candocumentation doesn't mention this problem, neither the TCAN4550 docs. Can this be an integration problem of the SoC on TI's side?this is similar to Errata 22 from Bosch
Message order inversion when transmitting from dedicated Tx Buffers configured with same Message ID.
page-29, release doc REL20210625Can you give me a link to the Bosch Errata sheet?
I believe the Bosch errata document is subject to selective disclosure. However, the most relevant public documentation I can provide is the Bosch user manual [0], which states: 'The Tx FIFO enables transmission of messages with the same Message ID from different Tx Buffers in the order these messages have been written to the Tx FIFO.'
For our public disclosure, we have the TI SoC errata [1].
Regardless, I believe a v2 is necessary.
What would you suggest as the best path forward:
Apply this errata to the TI SoC where public disclosure is already available?
Or
apply it to the MCAN IP used within that SoC?"
[0]
https://www.bosch-semiconductors.com/media/ip_modules/pdf_2/m_can/mcan_users_manual_v331.pdf
[1] https://www.ti.com/lit/pdf/sprz530
Do you know if TI's
Quoted 1 line
tcan4x5x is affected by the erratum?
I am checking internally within TI.
Quoted 4 lines
regards,
Marc
Marc Kleine-Budde
maintainerQuoted 1 line · Udit
I believe the Bosch errata document is subject to selective disclosure.
Sigh. The VDHL code of the m_can core leaked, but they still keep the errata closed :/
Quoted 7 lines
However, the most relevant public documentation I can provide is the Bosch user manual [0], which states: 'The Tx FIFO enables transmission of messages with the same Message ID from different Tx Buffers in the order these messages have been written to the Tx FIFO.'
For our public disclosure, we have the TI SoC errata [1].
Quoted 7 lines
Regardless, I believe a v2 is necessary.
What would you suggest as the best path forward:Apply this errata to the TI SoC where public disclosure is already available?
Or
apply it to the MCAN IP used within that SoC?"
The original patch [1] Anurag Dutta modified code paths that are only active for the peripheral case, i.e. the tcan4x5x SPI/CAN chip. The code path for the referenced TI SoC stays unchanged.
[1] https://lore.kernel.org/all/[email protected]/
Quoted 4 lines
Do you know if TI's
Quoted 1 line
tcan4x5x is affected by the erratum?
I am checking internally within TI.
Thanks,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Quoted 21 lines · Marc Kleine-Budde
Quoted 1 line · Udit
I believe the Bosch errata document is subject to selective disclosure.
Sigh. The VDHL code of the
m_cancore leaked, but they still keep the errata closed :/Quoted 7 lines
However, the most relevant public documentation I can provide is the Bosch user manual [0], which states: 'The Tx FIFO enables transmission of messages with the same Message ID from different Tx Buffers in the order these messages have been written to the Tx FIFO.'
For our public disclosure, we have the TI SoC errata [1].
Quoted 7 lines
Regardless, I believe a v2 is necessary.
What would you suggest as the best path forward:Apply this errata to the TI SoC where public disclosure is already available?
Or
apply it to the MCAN IP used within that SoC?"
Quoted 6 lines
The original patch [1] Anurag Dutta modified code paths that are only active for the peripheral case, i.e. the tcan4x5x SPI/CAN chip. The code path for the referenced TI SoC stays unchanged.
Hi Mark,
For given SOCs we are using m_can_platform platform driver. Since this patch changes TX handling only for the TCAN chip, please drop it from your queue.
We'll resubmit v2 if needed.
Regards
Udit
Quoted 8 lines
Quoted 4 lines
Do you know if TI's
Quoted 1 line
tcan4x5x is affected by the erratum?
I am checking internally within TI.
Thanks,
Marc