Hi, On Mon, Aug 14, 2017 at 09:42:24PM +0100, Ian Jamison wrote: > Hi, > > On 14/08/17 19:38, Clemens Gruber wrote: (snip) > > About the underlying problem (b) why it only occurs on SMP systems: > > I think Ian's theory is correct: > > DMA is started, then the PIO is done until the xmit buffer is empty and > > immediately after that, DMA is stopped. > > On SMP systems, where the DMA TX thread can run on another core, it is > > already too late. > > > > Regarding problem (a) why it only hurts RS-485: One possibility could be > > the timing difference / additional delay due to for example toggling the > > transmit-enable GPIO via mctrl_gpio_set. > > Meaning that with RS-232 on SMP systems DMA is also stopped just early > > enough to not bork the circular xmit buffer. > > > > If this is true then the imx driver did not really use TX DMA in > > practice before. > > > > Thoughts? > > > > I'll try to trace this next week to verify these hypotheses. > > > This sounds plausible to me. I guess you could try adding a GPIO wiggle > in non-RS485 mode (or even a usleep) to see if it makes the problem > more noticeable. Just a heads-up from my side: I was so far unsuccessful in reproducing the error on RS-232 interfaces, even when adding large mdelays of 50ms at all places where we would call imx_port_rts_(in)active in the RS-485 case. > > I had broken my build for a while there, but am now testing 4.13-rc5 > with RS485 mode and DMA enabled and it seems OK since my v1 patch > is included now. I also tried removing my change to the while loop and > adding a return before it (if dma_is_txing), as Uwe suggested, and that > also seems to work fine. My tests are not very exhaustive though. I > can post that as a patch if you like, or I can test your v2 if you prefer. Yes, please post it. I also tested that variant, Uwe suggested, successfully. It's probably still a good idea to continue the search for the root cause and explanation why this does not occur with RS-232. Next step is to trace the functions when doing RS-232 vs. RS-485. Time for ftrace.. *To be continued* ;-) Regards, Clemens -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html