[PATCH RFC 4/9] serial: serial_meson: add minimal non-DM driver
Ferass El Hafidi
funderscore at postmarketos.org
Wed Sep 10 22:14:32 CEST 2025
On Wed Sep 10, 2025 at 7:53 PM UTC, Heinrich Schuchardt wrote:
> <...>
>> +static int meson_serial_getc(void)
>> +{
>> + struct meson_uart *const uart = (struct meson_uart *)CONFIG_VAL(DEBUG_UART_BASE);
>> + uint32_t status = readl(&uart->status);
>> +
>> + if (status & AML_UART_RX_EMPTY)
>> + return -EAGAIN;
>> +
>> + if (status & AML_UART_ERR) {
>> + u32 val = readl(&uart->control);
>> +
>> + /* Clear error */
>> + val |= AML_UART_CLR_ERR;
>> + writel(val, &uart->control);
>> + val &= ~AML_UART_CLR_ERR;
>> + writel(val, &uart->control);
>> +
>> + /* Remove spurious byte from fifo */
>> + readl(&uart->rfifo);
>> + return -EIO;
>> + }
>> +
>> + return readl(&uart->rfifo) & 0xff;
>> +}
>> +
>> +static int meson_serial_tstc(void)
>> +{
>> + struct meson_uart *const uart = (struct meson_uart *)CONFIG_VAL(DEBUG_UART_BASE);
>
> CONFIG_SPL_DEBUG_UART_BASE only exists for CONFIG_DEBUG_UART=y and
> CONFIG_SPL=y. Shall all configurations depend on CONFIG_DEBUG_UART=y?
>
> Creating this dependency does not look right to me.
>
All Amlogic defconfigs have CONFIG_DEBUG_UART enabled, but I can remove
the dependency on CONFIG_DEBUG_UART_BASE if you think it doesn't look
right.
> Best regards
>
> Heinrich
>
Thanks.
More information about the U-Boot
mailing list