> -----Original Message----- > From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > Sent: 2019年12月4日 16:45 > To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; sean@xxxxxxxxxx; > linux-can@xxxxxxxxxxxxxxx > Cc: dl-linux-imx <linux-imx@xxxxxxx>; netdev@xxxxxxxxxxxxxxx > Subject: Re: [PATCH V2 2/4] can: flexcan: try to exit stop mode during probe > stage > > On 12/4/19 3:22 AM, Joakim Zhang wrote: > > > >> -----Original Message----- > >> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > >> Sent: 2019年12月4日 2:15 > >> To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; sean@xxxxxxxxxx; > >> linux-can@xxxxxxxxxxxxxxx > >> Cc: dl-linux-imx <linux-imx@xxxxxxx>; netdev@xxxxxxxxxxxxxxx > >> Subject: Re: [PATCH V2 2/4] can: flexcan: try to exit stop mode > >> during probe stage > >> > >> On 11/27/19 6:56 AM, Joakim Zhang wrote: > >>> CAN controller could be stucked in stop mode once it enters stop > >>> mode > >> ^^^^^^^ stuck > >>> when suspend, and then it fails to exit stop mode when resume. > >> > >> How can this happen? > > > > I am also confused how can this happen, as I asked Sean, only CAN > > enter stop mode when suspend, then system hang, > How do you recover the system when suspended? RTC wakeup or TTY wakeup. > > it could let CAN > > stuck in stop mode. However, Sean said this indeed happen at his side, > > @sean@xxxxxxxxxx, could you explain how this happen in details? > That would be good. > > >>> Only code reset can get CAN out of stop mode, > >> > >> What is "code reset"? > > > > As I know, "code reset" is to press the POWER KEY from the board. At > > my side, reboot command from OS also can get CAN out of stop mode. > Do you mean "cold reset", also known as Power-On-Reset, POR or power > cycle? Should be Power-On-Reset. > What does pressing the POWER KEY do? A power cycle of the system or > toggling the reset line of the imx? I think it toggles the reset line of imx. I am so sorry that I am not familiar with system reset :(. > We need to describe in detail, as not everyone has the same board as you, and > these boards might not even have a power key :) Yes. > > Below is experiment I did: > > Firstly, do a hacking to let CAN stuck into stop mode, then: > > You mean you put the CAN into stop mode without keeping track in the CAN > driver that the CAN-IP is in stop mode, e.g. by hacking the driver. Yes, you can add flexcan_enter_stop_mode() at the last of driver probe. After probe, CAN has been stuck in stop mode. Or you can enable CAN wakeup, then comment out flexcan_exit_stop_mode() in flexcan_resume(), do suspend then wakeup system, CAN has been stuck in stop mode. > Then you try several methods to recover: > > > (1) press power on/off key, get CAN out of stop mode; > > (2) reboot command from console, get CAN out of stop mode; > > (3) unbind/bind driver, cannot get CAN out of stop mode; > > (4) remod/insmod module, cannot get CAN out of stop mode; > > (2) resets the complete imx, including the CAN-IP core, (1) probably, too. Yes, since stop mode enter/exit request at a chip level, need reset completely, such as a "code reset", would get CAN out stop mode. "Soft reset" cannot get CAN out of stop mode. > (3) and (4) fail to recover the CAN core, as the IP core is still powered off by > some upstream component. So the question why this happens in the first place > is IMHO as important as trying to wake up the core. I think if we discover this > situation (CAN Core is in stop-mode in probe) we should print a warning > message, but try to recover. We really need figure out why CAN could be stuck in stop mode. As I know, enter stop mode in flexcan_suspend(), and then exit stop mode in flexcan_resume(), it could be impossible. Hope Sean can explain it in details, then we can discuss how to fix it more reasonable. Thanks Marc. Best Regards, Joakim Zhang > >>> so add stop mode remove request during probe stage for other > >>> methods(soft reset from chip level, unbind/bind driver, etc) to let > >> ^^^ please add a space > >>> CAN active again. > >> > >> Can you rephrase the sentence after "so add stop mode remove request > >> during probe stage". I'm not completely sure what you want to tell. > > > > Sure. > > tnx, > 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 |