aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/serial/uart8250.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-06lib: utils/serial: Ensure proper allocation of PMP entries for uart8250Yu Chien Peter Lin1-2/+1
The added memory region should start from the base address. Otherwise, the range will be shifted by reg_offset and not able to merge consecutive NAPOT regions in the root domain, resulting in wasted PMP entries. Fixes: e8bc1621 ("lib: utils/serial: Add shared regions for serial drivers") Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-09-24lib: utils/serial: Add shared regions for serial driversMayuresh Chitale1-1/+6
The serial driver regions used by OpenSBI should be marked as a shared read-write regions between M-mode and SU-mode as those are accessed by earlycon and the corresponding tty serial drivers running in 'S' mode. When the smepmp extension is enabled, PMP entries for these shared regions will get programmed. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2022-07-30lib: utils/serial: Ensure baudrate is non-zero before usingAndrew Jones1-2/+5
RISC-V doesn't generate exceptions on divide-by-zero, but the result, all bits set, is not likely what people expect either. In all cases where we divide by baudrate there's a chance it's zero (when the DT it came from is "bad"). To avoid difficult to debug situations, leave baudrate dependent registers alone when baudrate is zero, as, also in all cases, it appears we can skip initialization of those registers and still [hopefully] have a functioning UART. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-04-17lib: utils/serial: support 'reg-offset' propertyZong Li1-2/+2
reg-offset property is used for offset to apply to the mapbase from the start of the registers in 8250 UART. In Linux kernel, it has been handled in 8250 UART driver. dt-bindings: <linux>/Documentation/devicetree/bindings/serial/8250.yaml Signed-off-by: Zong Li <zong.li@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-02-04lib: utils/serial: Round UART8250 baud rate divisor to nearest integerJakub Luzny1-1/+1
Previously, it was rounded down and that gives suboptimal results when non-standard clock sources or baud rates are used. Signed-off-by: Jakub Luzny <jakub.luzny@codasip.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-01-21lib: fix pointer of type 'void *' used in arithmeticJukka Laitinen1-2/+2
Using "void *" in arithmetic causes errors with strict compiler settings: "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]" Avoid these by calculating on "char *" where 1-byte data size is assumed. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae> Reviewed-by: Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2021-04-28lib: sbi: Simplify console platform operationsAnup Patel1-2/+11
Instead of having console_putc() and console_getc() callbacks in platform operations, it will be much simpler for console driver to directly register these operations as device to the sbi_console implementation. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Xiang W <wxjstz@126.com>
2020-05-01lib: utils/serial: Skip baudrate config if input frequency is zeroAnup Patel1-4/+8
We should skip baudrate config for UART8250 and SiFive UART when input frequency is zero. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
2020-03-10lib: serial: Fix coding style issuesBin Meng1-10/+10
This fixes various coding style issues found in the serial codes. No functional changes. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-06-19platform: Move platform common to lib/utils.Atish Patra1-0/+121
Currently, platform/common contains platform/non-platform specific common minimal drivers and libraries. This is helpful is all platforms are built within opensbi framework. Move them to lib/utils so that any external platform code also can reuse the minimalistic drivers or other common libraries. This patch doesn't introduce any functional changes. Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Anup Patel <anup.patel@wdc.com>