I am using a Toradex Apalis iMX6Q module with 4.1.39 kernel based on NXP's downstream kernel release. After a suspend operation, the module does not wake up from suspend on a CAN frame reception.
The driver does seem to implement the self wakeup mechanism to wake from suspend on CAN frame receive however it does not seem to work at the moment. As per the TRM, the flexcan peripheral has a stop-mode which supports a waking up the processor if the following configuration is done:
“In the Self Wake mechanism, if the SLF_WAK bit in MCR Register was set at the time FlexCAN entered Stop Mode, then upon detection of a recessive to dominant transition on the CAN bus, FlexCAN sets the WAK_INT bit in the ESR Register and, if enabled by the WAK_MSK bit in MCR, generates a Wake Up interrupt to the ARM. Upon receiving the interrupt, the ARM should resume the clocks and remove the Stop Mode request manually”
Looking at the flexcan driver it seems that both SLF_WAK bit as well as WAK_INT bits are set during initialization in probe(). So from the code the device should wake up on interrupt. Also as per the TRM
“To enter stop mode, the CPU should manually assert a global Stop Mode request (see the CAN1_STOP_REQ and CAN2_STOP_REQ bit in the register IOMUXC_GPR4)and check the acknowledgement asserted by the FlexCAN (see the CAN1_STOP_ACK and CAN2_STOP_ACK in the register IOMUXC_GPR4) . The CPU must only consider the FlexCAN in Stop Mode when both request and acknowledgement conditions are satisfied”
However it does not seem to check the ACK at all in flexcan_enter_stop_mode so the implementation seems incorrect or incomplete. Is there a known fix available?