Skip to contentSkip to conversation

SiFive UART support

PATCH New Anup Patel 1 participant 3 messages Dec 15, 2018

Subsystems (2)
lore
Share & tools
lore

Anup Patel

author
#0 lore raw

v3 cover SiFive UART support

This patchset adds SiFive UART driver for SiFive UART found on SiFive boards.

The driver is tested on QEMU sifive_u machine. In fact, with this patchset same U-Boot binary boots on QEMU virt machine and QEMU sifive_u machine in both M-mode and S-mode.

The patches are based upon latest RISC-V UBoot tree
(git://git.denx.de/u-boot-riscv.git) at commit id 48cbf6246052de10d35b616b5efb2f783904a49d

Changes since v2:
- Added pending() callback implementation for tstc() console API to work correctly.

Changes since v1:
- Fixed copyright header in SiFive UART driver
- Imply SIFIVE_SERIAL for QEMU emulation instead of enabling it in defconfigs.

Anup Patel (2):
drivers: serial: Add SiFive UART driver
riscv: qemu: Imply SIFIVE_SERIAL for emulation

 board/emulation/qemu-riscv/Kconfig |   1 +
 drivers/serial/Kconfig             |  13 ++
 drivers/serial/Makefile            |   1 +
 drivers/serial/serial_sifive.c     | 215 +++++++++++++++++++++++++++++
 4 files changed, 230 insertions(+)
 create mode 100644 drivers/serial/serial_sifive.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v3 1/2 drivers: serial: Add SiFive UART driver

This patch adds SiFive UART driver. The driver is 100% DM driver and it determines input clock using clk framework.

---
 drivers/serial/Kconfig         |  13 ++
 drivers/serial/Makefile        |   1 +
 drivers/serial/serial_sifive.c | 215 +++++++++++++++++++++++++++++++++
 3 files changed, 229 insertions(+)
 create mode 100644 drivers/serial/serial_sifive.c
drivers/serial/Kconfig +13 -0
index 6252dd8c4b..b7ff2960ab 100644
@@ -343,6 +343,13 @@ config DEBUG_UART_SANDBOX
 	  start up driver model. The driver will be available until the real
 	  driver model serial is running.
 
+config DEBUG_UART_SIFIVE
+	bool "SiFive UART"
+	help
+	  Select this to enable a debug UART using the serial_sifive driver. You
+	  will need to provide parameters to make this work. The driver will
+	  be available until the real driver-model serial is running.
+
 config DEBUG_UART_STM32
 	bool "STMicroelectronics STM32"
 	depends on STM32_SERIAL
@@ -679,6 +686,12 @@ config PXA_SERIAL
 	  If you have a machine based on a Marvell XScale PXA2xx CPU you
 	  can enable its onboard serial ports by enabling this option.
 
+config SIFIVE_SERIAL
+	bool "SiFive UART support"
+	depends on DM_SERIAL
+	help
+	  This driver supports the SiFive UART. If unsure say N.
+
 config STI_ASC_SERIAL
 	bool "STMicroelectronics on-chip UART"
 	depends on DM_SERIAL && ARCH_STI
drivers/serial/Makefile +1 -0
index 2f8d065a4c..06ee30697d 100644
@@ -67,6 +67,7 @@ obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o
 obj-$(CONFIG_OWL_SERIAL) += serial_owl.o
 obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o
 obj-$(CONFIG_MTK_SERIAL) += serial_mtk.o
+obj-$(CONFIG_SIFIVE_SERIAL) += serial_sifive.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_TTY) += usbtty.o
drivers/serial/serial_sifive.c new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v3 2/2 riscv: qemu: Imply SIFIVE_SERIAL for emulation

In reply to Anup Patel

This patch enables SiFive UART driver for QEMU RISC-V emulation by implying SIFIVE_SERIAL on BOARD_SPECIFIC_OPTIONS.

---
 board/emulation/qemu-riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)
board/emulation/qemu-riscv/Kconfig +1 -0
index ed005e5678..0d865acf10 100644
@@ -33,5 +33,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply CMD_FAT
 	imply BOARD_LATE_INIT
 	imply OF_BOARD_SETUP
+	imply SIFIVE_SERIAL
 
 endif
Signature · 1 line
2.17.1