mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-02-27 18:01:45 +00:00
Altera provides a JTAG UART core that provides virtual UART over JTAG and can coexist with their virtual JTAG. [1] This core has already been supported by Linux and the programming interface has always been stable. Add support for it to OpenSBI to ease JTAG prototype bringing up. The driver follows the device tree binding in mainline Linux. [2] [1] https://docs.altera.com/r/docs/683130/25.3/embedded-peripherals-ip-user-guide/jtag-uart-core [2] https://github.com/torvalds/linux/blob/v6.19-rc1/Documentation/devicetree/bindings/serial/altr%2Cjuart-1.0.yaml Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260104065506.70182-1-zhengxingda@iscas.ac.cn Signed-off-by: Anup Patel <anup@brainfault.org>
41 lines
927 B
C
41 lines
927 B
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2025 ISCAS
|
|
*
|
|
* Authors:
|
|
* Icenowy Zheng <zhengxingda@iscas.ac.cn>
|
|
*/
|
|
|
|
#include <sbi/sbi_error.h>
|
|
#include <sbi_utils/fdt/fdt_helper.h>
|
|
#include <sbi_utils/serial/fdt_serial.h>
|
|
#include <sbi_utils/serial/altr-juart.h>
|
|
|
|
static int serial_altr_juart_init(const void *fdt, int nodeoff,
|
|
const struct fdt_match *match)
|
|
{
|
|
uint64_t reg_addr, reg_size;
|
|
int rc;
|
|
|
|
if (nodeoff < 0 || !fdt)
|
|
return SBI_ENODEV;
|
|
|
|
rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size);
|
|
/* Two 32-bit registers */
|
|
if (rc < 0 || !reg_addr || !reg_size || reg_size < 0x8)
|
|
return SBI_ENODEV;
|
|
|
|
return altr_juart_init(reg_addr);
|
|
}
|
|
|
|
static const struct fdt_match serial_altr_juart_match[] = {
|
|
{ .compatible = "altr,juart-1.0" },
|
|
{ },
|
|
};
|
|
|
|
const struct fdt_driver fdt_serial_altr_juart = {
|
|
.match_table = serial_altr_juart_match,
|
|
.init = serial_altr_juart_init,
|
|
};
|