Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21216 Discussions

UART 16550 compatible Linux device

Shoval
New Contributor I
3,485 Views

Hello all,

In my Quartus project I connected a UART 16550 compatible soft IP, and it is visible in the .sopcinfo generated.

Later I build a .dtsi and a .dtb files using yocto angsrom, in the .dtsi file the IP is visible.

Then I compile the entire Linux build, and I would expect a new tty device to appear under /dev, or a new device to appear under /sys/class/tty, however there is no new device added to those directories.

the strange thing is that I can see the device under /proc/device-tree which means (according to my understanding) that it is accessible in the device tree, but for some reason does not generate the device itself.

The environment we are using is Quartus 18.1.

I would love if anyone had encountered such issue and have any insight over this subject.

Labels (1)
0 Kudos
11 Replies
aikeu
Employee
3,440 Views

Hi Shoval,


You will required to manually add the device tree node in the device tree pointing the the address IP which you have created in your project.

Can use the reference on how the HPS UART0 is being included.


Thanks.

Regards,

Aik Eu


0 Kudos
Shoval
New Contributor I
3,395 Views

Hello Aik.

Thank you for replying.

From my (humble) understanding, when generating the .dtsi file from the .sopcinfo file, the node is added automatically.

I can also see it in the device tree in the .dtsi and in the geneated Linux /proc/device-tree.

So to me it seems like it was added to the device tree in the right address.

 

Do I need to overwrite it somehow? 

I'm adding here the files, I would really appreciate if you could take a look and tell me what have I missed here.

 

 

0 Kudos
aikeu
Employee
3,372 Views

Hi Shoval,


You will need to add it in the device tree accordingly. By default it is only referring to the HPS UART0 and UART1.


Thanks.

Regards,

Aik Eu


0 Kudos
Shoval
New Contributor I
3,353 Views

Hello Aik,

If I understand correctly the 16550 compatible soft IP is not the same as the synopsys-16550 compatible that is used in the HPS UART 0/1.

 

The HPS UART node : 

##########################

hps_0_uart0: serial@0xffc02000 {
compatible = "snps,dw-apb-uart-18.1", "snps,dw-apb-uart";
reg = <0xffc02000 0x00000100>;
interrupt-parent = <&hps_0_arm_gic_0>;
interrupts = <0 162 4>;
clocks = <&l4_sp_clk>;
reg-io-width = <4>; /* embeddedsw.dts.params.reg-io-width type NUMBER */
reg-shift = <2>; /* embeddedsw.dts.params.reg-shift type NUMBER */
status = "okay"; /* embeddedsw.dts.params.status type STRING */
}; //end serial@0xffc02000 (hps_0_uart0)

##########################

 

The soft core 16550 UART IP node : 

##########################

a_16550_uart_0: serial@0x000000000 {
compatible = "altr,altera_16550_uart-18.1", "altr,16550-FIFO128", "ns16550a";
reg = <0x00000000 0x00000000 0x00000200>;
interrupt-parent = <&hps_0_arm_gic_0>;
interrupts = <0 40 4>;
clock-frequency = <100000000>; /* embeddedsw.dts.params.clock-frequency type NUMBER */
fifo-size = <128>; /* embeddedsw.dts.params.fifo-size type NUMBER */
reg-io-width = <4>; /* embeddedsw.dts.params.reg-io-width type NUMBER */
reg-shift = <2>; /* embeddedsw.dts.params.reg-shift type NUMBER */
}; //end serial@0x000000000 (a_16550_uart_0)

##########################

 

the UART soft core IP is added under the hps_0_bridges: bridge@0xc0000000, and have an appropriate device driver (drivers/tty/serial/8250) in the yocto kernel-source directory.

 

The Linux does compile, and the node is visible via /proc/device-tree/sopc@0/bridge@0xc0000000/serial@0x0000000, no errors are visible on Linux boot, but I cant find the device.

0 Kudos
aikeu
Employee
3,339 Views

Hi Shoval,


I missed out the part which referring to the 16550 ip when browsing through the nodes.

May I know the exact address which the 16550 soft ip is pointing in the qsys design?

From the below, I am seeing the address is directly pointing to 0x00000000 :


a_16550_uart_0: serial@0x000000000


Thanks.

Regards,

Aik Eu


0 Kudos
Shoval
New Contributor I
3,330 Views

Hi,

The address of the IP is 0xc0000000, its base address is 0xc0000000 under "hps_0_bridges" with an addresss offset of 0x00000000.

 

as you can see from the .dtsi file below:

########

hps_0_bridges: bridge@0xc0000000 {
compatible = "altr,bridge-18.1", "simple-bus";
reg = <0xc0000000 0x20000000>,
<0xff200000 0x00200000>;
reg-names = "axi_h2f", "axi_h2f_lw";
#address-cells = <2>;
#size-cells = <1>;
ranges = <0x00000000 0x00000000 0xc0000000 0x00000200>,
<0x00000001 0x00020000 0xff220000 0x00000008>,
<0x00000001 0x00020010 0xff220010 0x00000008>;
 
a_16550_uart_0: serial@0x000000000 {
compatible = "altr,altera_16550_uart-18.1", "altr,16550-FIFO128", "ns16550a";
reg = <0x00000000 0x00000000 0x00000200>;
interrupt-parent = <&hps_0_arm_gic_0>;
interrupts = <0 40 4>;
clock-frequency = <100000000>; /* embeddedsw.dts.params.clock-frequency type NUMBER */
fifo-size = <128>; /* embeddedsw.dts.params.fifo-size type NUMBER */
reg-io-width = <4>; /* embeddedsw.dts.params.reg-io-width type NUMBER */
reg-shift = <2>; /* embeddedsw.dts.params.reg-shift type NUMBER */
}; //end serial@0x000000000 (a_16550_uart_0)

######

 

 

Attached is the .dtsi file, under line 99 is the hps_0_bridge node instance and under line 110 is the 16550 UART node instance.

(suffix changed to .txt for upload purposes)

 

0 Kudos
aikeu
Employee
3,316 Views

Hi Shoval,


May I know you are using which Soc device?

If offset is 0x00000000 and connected to 0xC0000000 it should be:

a_16550_uart_0: serial@0xC00000000


Thanks.

Regards,

Aik Eu


0 Kudos
Shoval
New Contributor I
3,289 Views

Hello Aik,

I'm currently using the Cyclone V Soc evaluation board, #PN: DK-DEV-5CSXC6N.

 

I modified to: 

a_16550_uart_0: serial@0xC00000000

As advised, I don't think it did much.

The device address  has changed to 0xc0000000 under /proc/device-tree/ :

             currently :   /proc/device-tree/sopc@0/bridge@0xc0000000/serial@0xc00000000/

             instead of:  /proc/device-tree/sopc@0/bridge@0xc0000000/serial@0x000000000/

So Linux compiled properly.

 

However, no new device under /dev.

 

0 Kudos
aikeu
Employee
3,256 Views

Hi Shoval,


Can check in Uboot or Linux user space by accessing the address of the connected UART IP?

Example like "md" cmd in Uboot or "devmem" cmd in Linux pointing to the specific connected addresss of UART IP in your design. Should be able to observe some of the IP defaut reset values if the IP is presence in the working system.


Any failure indication in the booting logs when the system trying to probe the driver to the particular address of the UART IP?


Another thing is does the below enabled in the linux config file?

CONFIG_SERIAL_8250=y 

CONFIG_SERIAL_8250_CONSOLE=y 

CONFIG_SERIAL_OF_PLATFORM=y


Thanks.

Regards,

Aik Eu


0 Kudos
Shoval
New Contributor I
3,219 Views

Hi Aik,

 

Reading the registers of the addresses of the IP is as expected (address 0xc0000014 for example read 0x60 like the manual).

No failure indication in the booting logs.

However, CONFIG_SERIAL_OF_PLATFORM is not set, so that might be wrong.

 

Unfortunately I will have to close this issue for now.

Thank you for your support.

0 Kudos
aikeu
Employee
3,172 Views

Hi Shoval,


I will close the thread on my side. Do consider to open a new thread if got further question.

p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


Thanks.

Regards,

Aik Eu


0 Kudos
Reply