On Sun, Dec 21, 2025 at 12:28:49AM +0800, Kuan-Wei Chiu wrote:
> Hi Yao,
>
> On Fri, Dec 19, 2025 at 03:14:03AM +0000, Yao Zi wrote:
> > On Thu, Dec 18, 2025 at 06:52:50PM +0000, Kuan-Wei Chiu wrote:
> > > Add support for the Google Goldfish TTY serial device. This virtual
> > > device is commonly used in QEMU virtual machines (such as the m68k
> > > virt machine) and Android emulators.
> > >
> > > The driver implements basic console output and input polling using the
> > > Goldfish MMIO interface.
> > >
> > > Signed-off-by: Kuan-Wei Chiu <[email protected]>
> > > ---
> > > MAINTAINERS | 6 ++
> > > drivers/serial/Kconfig | 8 +++
> > > drivers/serial/Makefile | 1 +
> > > drivers/serial/serial_goldfish.c | 112 +++++++++++++++++++++++++++++++
> > > include/goldfish_tty.h | 18 +++++
> > > 5 files changed, 145 insertions(+)
> > > create mode 100644 drivers/serial/serial_goldfish.c
> > > create mode 100644 include/goldfish_tty.h
...
> For reference, here is the planned update for v2:
>
> struct goldfish_tty_priv {
> void __iomem *base;
> u8 rx_buf;
> };
>
> static int goldfish_serial_getc(struct udevice *dev)
> {
> struct goldfish_tty_priv *priv = dev_get_priv(dev);
> unsigned long base = (unsigned long)priv->base;
> unsigned long paddr;
> u32 count;
>
> count = __raw_readl((void *)(base + GOLDFISH_TTY_BYTES_READY));
> if (count == 0)
> return -EAGAIN;
>
> paddr = virt_to_phys((void *)&priv->rx_buf);
>
> __raw_writel(0, (void *)(base + GOLDFISH_TTY_DATA_PTR_HIGH));
> __raw_writel(paddr, (void *)(base + GOLDFISH_TTY_DATA_PTR));
> __raw_writel(1, (void *)(base + GOLDFISH_TTY_DATA_LEN));
>
> __raw_writel(CMD_READ_BUFFER, (void *)(base + GOLDFISH_TTY_CMD));
>
> return priv->rx_buf;
> }
Thanks for the explanation, this version looks fine to me.
> Regards,
> Kuan-Wei
Regards,
Yao Zi
> > > +}
> >
> > Best regards,
> > Yao Zi
> >
> > [1]: https://lore.kernel.org/u-boot/20251212142859.GQ303283@bill-the-cat