Bug 253494 - the uart driver does not recognize HSUARTs on a FitPC Fitlet2 computer
Summary: the uart driver does not recognize HSUARTs on a FitPC Fitlet2 computer
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.2-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-14 05:42 UTC by Tommy Johnson
Modified: 2021-07-10 19:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tommy Johnson 2021-02-14 05:42:36 UTC
Overview:

A Fitlet2 computer has an onboard serial port which is a PCI attached HSUART.  The uart driver does not recognize the port, no /dev/cua* is created.  

To Reproduce:

Attempt to use a serial port on a fitlet2 computer, or perhaps more generally, a Celeron N3350/Pentium N4200/Atom E3900.  Note that there is no /dev/cua* for the serial port.

The hardware appears in pciconf as:

none2@pci0:0:24:2:      class=0x118000 card=0x72708086 chip=0x5ac08086 rev=0x0b hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller'
    class      = dasp

I cargo-culted the fix in PR 207910, and added the PCI id to the list in src/sys/dev/uart/uart_bus_pci.c.

Adding the following at line 168:

{ 0x8086, 0x5abc, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#0", 0x10,
        24 * DEFAULT_RCLK, 2 },
{ 0x8086, 0x5abe, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#1", 0x10,
        24 * DEFAULT_RCLK, 2 },
{ 0x8086, 0x5ac0, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#2", 0x10,
        24 * DEFAULT_RCLK, 2 },
{ 0x8086, 0x5aee, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#3", 0x10,
        24 * DEFAULT_RCLK, 2 },

I can only verify that HSUART#2 works correctly, since the Fitlet hardware has only a single exposed RS-232 port (tested by connecting TX to RX, and observing the echo using kermit.).  There is a second physical port on an internal connector which is more difficult to get to.
Comment 1 Tommy Johnson 2021-02-20 14:47:09 UTC
The baud rate is incorrectly configured by the settings.  To get the correct baud rate, the "24 *" needs to be deleted, the correct lines in the file are:

{ 0x8086, 0x5abc, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#0", 0x10,    
         DEFAULT_RCLK , 2 },
{ 0x8086, 0x5abe, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#1", 0x10,    
         DEFAULT_RCLK, 2 },
{ 0x8086, 0x5ac0, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#2", 0x10,    
         DEFAULT_RCLK, 2 },
{ 0x8086, 0x5aee, 0xffff, 0, "Celeron N3350/Pentium N4200/Atom E3900 Series HSUART#3", 0x10,    
         DEFAULT_RCLK, 2 },
Comment 2 Jose Luis Duran 2021-07-10 19:43:43 UTC
(In reply to Tommy Johnson from comment #1)

See:

https://github.com/freebsd/freebsd-src/commit/8f1562430fbb83f6cedff6450e1aa1b593e3d7e7

As for getting the memory-mapped serial console to work, add:

    hw.uart.console="mm:0xfea10000,rs:2"

To your /boot/loader.conf.

Further information here: https://bsdimp.blogspot.com/2018/07/how-to-get-memory-mapped-serial-console.html
Comment 3 Jose Luis Duran 2021-07-10 19:48:00 UTC
(In reply to Tommy Johnson from comment #1)

I'll try that change.