On Thu, Feb 8, 2024 at 3:36 AM, Peter Maydell <peter.mayd...@linaro.org> wrote:
> This implementation will send the transmitted characters > to the QEMU chardev and also loop them back into the UART > when loopback is enabled. Similarly if we receive a character > from the real input we will put it into the FIFO still, so > the FIFO will get both looped-back and real input together. > I think we only have one other UART where loopback is implemented, > and that is hw/char/serial.c. In that device we make loopback not > send transmitted characters out when in loopback mode, because > the 16550 datasheet explicitly says that's how its loopback > mode works. The PL011 datasheet is unfortunately silent on > this question. Do you have a real hardware PL011 that you > can check to see whether when it is in loopback mode > transmitted data is also sent to the output port as well > as looped back? Similarly for input: we should check whether > the UART continues to accept real input or if the real input > is completely disconnected while in loopback mode. Hi Peter, Here is what I found using hardware I have access to. When loopback is enabled: 1. Receive is disconnected from the real input and only accepts transmit from loopback. 2. Transmitted characters is sent to both physical output and loopback to receive. #2 is also collaborated by commit message for https://github.com/torvalds/linux/commit/734745ca However, the same message also suggested that #2 may not be the case in other implementations of pl011. I will work on v2 to address you other comments as well, with a property for customizing whether transmit will send to both in loopback mode. Regards, Tong Ho