Re: [PATCH v4 2/2] can: spi: hi311x: Add Holt HI-311x CAN driver
From: Akshay Bhat
Date: Mon Mar 20 2017 - 15:06:47 EST
Hi Wolfgang,
On 03/20/2017 12:46 PM, Wolfgang Grandegger wrote:
..snip..
>>
>> The top 3 bits of HI3110_READ_ERR (BUSOFF, TXERRP, RXERRP) are valid
>> even if HI3110_INT_BUSERR is not set.
>
> I'm confused! If you disable BUSERR interrupts, you do not get the
> status bits any longer, you said. But the manual says: "Bits 4:0 in the
> ERR register can be read to determine the source of the error.", which
> excludes the above bits... but obviously the controller does it that way.
>
I agree this feature could use better documentation.
Based on testing:
If BUSERRIE bit in INTE is clear,
On cable disconnect: No interrupts related to bus errors are generated.
So status change messages do not go out.
If BUSERRIE bit in INTE is set,
On cable disconnect: Interrupts are generated due to ACKERR. The
interrupt routine reads the BUSOFF/TXERRP/RXERRP bits of ERR register
and reports the state. If CAN_CTRLMODE_BERR_REPORTING is set, then
protocol errors are also reported by the interrupt.
On cable re-connect: Interrupts are generated due to TXCPLT. The
interrupt routine reads the BUSOFF/TXERRP/RXERRP bits of ERR register
and reports the state.
Let me know if this helps clear things up :)