diff options
| author | Bo Gan <ganboing@gmail.com> | 2025-12-18 02:42:42 -0800 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2025-12-21 21:02:44 +0530 |
| commit | fbff3a7e0784a5bd42e87656e6d50cea94dfcff5 (patch) | |
| tree | 55791bc2f43476d556f6fe143ae385a9b528c794 /include | |
| parent | e5797e0688c187168ed9632b955cbe68da97f7f7 (diff) | |
| download | opensbi-fbff3a7e0784a5bd42e87656e6d50cea94dfcff5.zip opensbi-fbff3a7e0784a5bd42e87656e6d50cea94dfcff5.tar.gz opensbi-fbff3a7e0784a5bd42e87656e6d50cea94dfcff5.tar.bz2 | |
lib: utils/serial: Support multiple UART8250 devices
Previously we assume only 1 UART8250 instance can be used. Now we support
multiple instances by introducing counterpart functions to putc/getc/init
which take an extra *dev parameter, and name them as uart8250_device_xyz()
The original functions without the *dev parameter will operate on the
default instance exactly the same as before, so no changes on the caller
is required.
Note: uart8250_device_init only does device initialization without the
console registration logic.
Signed-off-by: Bo Gan <ganboing@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20251218104243.562667-7-ganboing@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi_utils/serial/uart8250.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/sbi_utils/serial/uart8250.h b/include/sbi_utils/serial/uart8250.h index 70cd291..78c0e61 100644 --- a/include/sbi_utils/serial/uart8250.h +++ b/include/sbi_utils/serial/uart8250.h @@ -14,6 +14,22 @@ #define UART_CAP_UUE BIT(0) /* Check UUE capability for XScale PXA UARTs */ +struct uart8250_device { + volatile char *base; + u32 in_freq; + u32 baudrate; + u32 reg_width; + u32 reg_shift; +}; + +int uart8250_device_getc(struct uart8250_device *dev); + +void uart8250_device_putc(struct uart8250_device *dev, char ch); + +void uart8250_device_init(struct uart8250_device *dev, unsigned long base, + u32 in_freq, u32 baudrate, u32 reg_shift, + u32 reg_width, u32 reg_offset, u32 caps); + int uart8250_init(unsigned long base, u32 in_freq, u32 baudrate, u32 reg_shift, u32 reg_width, u32 reg_offset, u32 caps); |
