Zephyr UARTNS550 Driver Support

This page gives an overview of the UARTNS550 Zephyr driver which is available as part of the zephyr-amd repo.

HW Features

  • AXI UART 16550 controller

Design Notes

  • NA

Implementation

  • NA

Features Supported

  • Polled Mode - UART Send/Receive

  • Interrupt Mode - UART Send/Receive

  • APIs supported and verified

    • uart_poll_in - Read a character from the device for input

    • uart_poll_out - Write a character to the device for output

    • uart_configure - Set UART configuration

    • uart_config_get - Get UART configuration

    • uart_fifo_fill - Fill FIFO with data

    • uart_fifo_read - Read data from FIFO

Missing Features

  • TBA

Known Issues

  • N/A

Limitations

  • N/A

Kernel Configuration

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_USE_RUNTIME_CONFIGURE=y

The following configurations are also supported (but not verified):

CONFIG_UART_ASYNC_API=y
CONFIG_UART_NS16550_LINE_CTRL=y
CONFIG_UART_NS16550_DRV_CMD=y
  • CONFIG_UART_ASYNC_API - Asynchronous Operations

  • CONFIG_UART_NS16550_LINE_CTRL - Manipulate line control for UART

  • CONFIG_UART_NS16550_DRV_CMD - Driver Specific commands

Device Tree

uartns550 node

uartns550: serial@a0090000 {
        reg-shift = <0x2>;
        clock-frequency = <0x5f5b9f5>;
        reg = <0xa0090000 0x10000>;
        interrupt-parent = <&gic>;
        compatible = "ns16550";
        interrupts = <GIC_SPI 0x5a IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
        current-speed = <115200>;
      status = "okay";
};

Driver Stack Size

  • uart_ns16550.c (interrupt) - 1.5 KB

  • uart_ns16550.c (polled) - 0.9 KB

Test Platform

  • zcu102 board

Test SoC Architecture

  • RPU - R5 core - Verified

  • APU - A53 core - Not tested

  • SMP - Switch - Not tested

Testing Sequence

  • Build zephyr application for R5 core

    • west build -p -b <board> <sample application path>

  • Run zephyr elf on board

Example Tests

Test Name

Example Source

Description

hello world

samples/hello_world/

Prints “Hello World” on uart console

uart_basic_api

tests/drivers/uart/uart_basic_api/

Performs Ztest which verifies basic uart driver APIs.

Expected Output

  • west build -p -b zcu102_r5 tests/drivers/uart/uart_basic_api/ -G’Unix Makefiles’

  • Log:

    • zcu102 R5 UARTNS550 log
      *** Booting Zephyr OS build 36940db938a8 ***
      Hello World! zcu102_r5/zcu102_r5_rpu
      
      *** Booting Zephyr OS build 36940db938a8 ***
      Running TESTSUITE uart_basic_api
      ===================================================================
      START - test_uart_config_get
       PASS - test_uart_config_get in 0.003 seconds
      ===================================================================
      u PASS - test_uart_configure in 0.001 seconds
      ===================================================================
      START - test_uart_fifo_fill
      This is a FIFO test.
       PASS - test_uart_fifo_fill in 0.502 seconds
      ===================================================================
      START - test_uart_fifo_read
      Please send characters to serial console
      this is good
       PASS - test_uart_fifo_read in 4.544 seconds
      ===================================================================
      START - test_uart_poll_in
      Please send characters to serial console
      very good
       PASS - test_uart_poll_in in 3.235 seconds
      ===================================================================
      START - test_uart_poll_out
      This is a POLL test.
       PASS - test_uart_poll_out in 0.002 seconds
      ===================================================================
      TESTSUITE uart_basic_api succeeded
      Running TESTSUITE uart_basic_api_pending
      ===================================================================
      START - test_uart_pending
      Please send characters to serial console
      
       PASS - test_uart_pending in 1.403 seconds
      ===================================================================
      TESTSUITE uart_basic_api_pending succeeded
      
      ------ TESTSUITE SUMMARY START ------
      
      SUITE PASS - 100.00% [uart_basic_api]: pass = 6, fail = 0, skip = 0, total = 6 duration = 8.287 seconds
       - PASS - [uart_basic_api.test_uart_config_get] duration = 0.003 seconds
       - PASS - [uart_basic_api.test_uart_configure] duration = 0.001 seconds
       - PASS - [uart_basic_api.test_uart_fifo_fill] duration = 0.502 seconds
       - PASS - [uart_basic_api.test_uart_fifo_read] duration = 4.544 seconds
       - PASS - [uart_basic_api.test_uart_poll_in] duration = 3.235 seconds
       - PASS - [uart_basic_api.test_uart_poll_out] duration = 0.002 seconds
      
      SUITE PASS - 100.00% [uart_basic_api_pending]: pass = 1, fail = 0, skip = 0, total = 1 duration = 1.403 seconds
       - PASS - [uart_basic_api_pending.test_uart_pending] duration = 1.403 seconds
      
      ------ TESTSUITE SUMMARY END ------
      
      ===================================================================
      PROJECT EXECUTION SUCCESSFUL
      
    • Download zephyr_zcu102_uartns550.log

Code Coverage

Performance Metric

  • N/A

Mainline Status

  • The preceding features are mainlined as of 01-Oct-2024

Driver Source Path

  • drivers/serial/uart_ns16550.c

Misra C Report

File

Required

Advisory

uart_ns16550.c

165

54

  • Detailed Breakup

misra-c rule
(zephyr guideline)

Severity

Actual File
Violations
Kernel Utility
Violations

Dir 4.6

Advisory

26

0

Dir 4.8

Advisory

0

10

Dir 4.9

Advisory

4

3

Rule 1.2

Advisory

0

6

Rule 2.1

Required

1

0

Rule 2.7

Advisory

2

0

Rule 5.7

Required

1

0

Rule 5.8

Required

1

0

Rule 5.9

Advisory

2

0

Rule 7.2

Required

1

0

Rule 10.1

Required

38

0

Rule 10.3

Required

16

4

Rule 10.4

Required

85

0

Rule 11.8

Required

0

1

Rule 11.9

Required

1

0

Rule 12.1

Advisory

1

0

Rule 14.3

Required

2

0

Rule 14.4

Required

3

0

Rule 16.1

Required

3

0

Rule 16.3

Required

3

0

Rule 17.7

Required

1

0

Rule 21.2

Required

0

4

Total violations

191

28