P1010RDB: uart1 support in linux kernel

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P1010RDB: uart1 support in linux kernel

Jump to solution
3,841 Views
nobelsharanyanj
Contributor III

Hi,

Currently, I am enabling two uart 0 and uart 1 in my custom board as we are in need of it.

Since uart 0 and uart 1 work independently.

But when I tried to use "/dev/ttyS1" I am getting the error

can't tcsetattr for /dev/ttyS1: Input/output error

On further analysis, the device pointer is showing NULL. which means the device is not register properly.

uart 0(ttyS0) got initialized - serial8250_probe

uart 1(ttyS1) didn't initialized properly - serial8250_probe - as device pointer is NULL

How to enable both uart 0 and uart1 in linux?

0 Kudos
1 Solution
2,307 Views
scottwood
NXP Employee
NXP Employee

Try adding "fsl_p1010mux:tdm_can=can" to the U-Boot hwconfig environment variable -- the muxing defaults to TDM which has a side-effect of disabling UART1.  For your custom board you'll need the equivalent board logic to set up the muxing.

View solution in original post

14 Replies
2,307 Views
Pavel
NXP Employee
NXP Employee

The P1010 hardware provides using the p1010rdb UART1 and TDM simultaneously.

This variable is U-boot software constraint.

If UART1 (TX/and RX) and TDM should be used, the u-boot p1010rdb.c file should be changed.


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,307 Views
nobelsharanyanj
Contributor III

Hi Pavel,

I created a function which does same as when we set the hwconfig.

The function is added to init_sequence in board_r.c and its getting called after system reboot.

Now after reboot, I am still facing the same issues as before if I didn't set the hwconfig.

Now my question is, whether hwconfig is mandatory to be passed as a environmental variable to kernel? is there any thing i need to handle it in kernel?

Regards

Nobel

0 Kudos
2,307 Views
nobelsharanyanj
Contributor III

Hi,

In board/freescale/p1010rdb/p1010rdb.c,

          -----> ft_board_setup() --> fdt_disable_uart1() which set the uart1 status disable in device tree.

This is how it pass the information whether it need to enable or disable to kernel.

0 Kudos
2,307 Views
nobelsharanyanj
Contributor III

useful information:

If uart1_sin(Rx, input) is left open then the line remain ground/floating. during this condition when we tried sending value to ttyS1 the system get hangs as receiver line remain low which in turn trigger interrupt to duart controller and it display.

serial8250: too much work for irq42

If you try printing the interrupt status it will display "receiver line status".

then you required a weak pull up over the RX line. in order to make sure if application try to send or receive data if its being connected or not.

0 Kudos
2,307 Views
scottwood
NXP Employee
NXP Employee

hwconfig does not get passed to the kernel.

2,307 Views
nobelsharanyanj
Contributor III

Hi Scott,

In our custom board we are using uart_1, currently the pins(UART1_SIN & UART1_SOUT) are left open in our custom board.

on probing, UART1_SOUT remain high and where us UART1_SIN remain low. i.e, receiver line is low more than start bit.

Which causes

sh-4.3# stty 9600 -F /dev/ttyS1

serial8250: too much work for irq42 - 0x6 lsr[0x10]

serial8250: too much work for irq42 - 0x6 lsr[0x10]

serial8250: too much work for irq42 - 0x6 lsr[0x10]

serial8250: too much work for irq42 - 0x6 lsr[0x10]

where I have edited the printk in drivers/tty/serial/8250/8250_core.c to display interrupt status(0x6) and line status register(0x10).

do I need to enable uart1 in "GUTS_DEVDISR1"?

Regards

Nobel

0 Kudos
2,308 Views
scottwood
NXP Employee
NXP Employee

Try adding "fsl_p1010mux:tdm_can=can" to the U-Boot hwconfig environment variable -- the muxing defaults to TDM which has a side-effect of disabling UART1.  For your custom board you'll need the equivalent board logic to set up the muxing.

2,307 Views
nobelsharanyanj
Contributor III

Hi Scott,

Yes, now it is showing up in reference board.

Screenshot from 2016-03-11 15_24_38.png

Above image is the schematic of the reference board - P1010RDB-PB.

I am curious to know, When I am using GPIO_6 i did pin muxing to support GPIO_6 as the pin by default it is SPI_MOSI.

where us in this case, I am trying to use UART_SIN_1 and UART_SOUT_1 without hardware flow control (RTS and CTS).

By default the pin should be UART_SIN_1 and UART_SOUT_1, why there is a need of pin muxing here.

Regards

Nobel

0 Kudos
2,307 Views
Pavel
NXP Employee
NXP Employee

I have the same result on the P1010rdb board:

root@p1010rdb:~# setserial -g /dev/ttyS*

/dev/ttyS0, UART: 16550A, Port: 0x0000, IRQ: 42

/dev/ttyS1, UART: unknown, Port: 0x0000, IRQ: 0

I will check the P1010rdb SDK setting.


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,307 Views
nobelsharanyanj
Contributor III

scottwoodPavel

Hi,

let me know the impact and percentage of changes required to resolve uart1 issues?

Regards

Nobel

0 Kudos
2,307 Views
Pavel
NXP Employee
NXP Employee

Check UART ports on your board using the following commands:

dmesg | grep tty

and

setserial -g /dev/ttyS*

stty 9600 -F /dev/ttyS1

stty -F /dev/ttyS1

echo "HELLO" > /dev/ttyS1

Test serial ports on your board using the following page:

http://www.armadeus.com/wiki/index.php?title=Serial_ports_usage_on_Linux


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,307 Views
nobelsharanyanj
Contributor III

Hi Pavel,

When I typed setserial -g /dev/ttyS*

it shows irq number and port for ttyS0, where as it shows "UNKNOWN" for ttyS1.

When I tried "microcom -s 9600 /dev/ttyS1". It shows

tcsetattr input/output error.

The reason is platform data stored in device pointer is showing NULL for the platform device ttyS1.

For above command to work ttyS1 need to be properly initilaize that mean "serial8250_probe" need to be called without an error.

In "serial8250_probe", NULL pointer error is checked inside the loop condition. where us it need to be checked initially and return proper error value if it not present.

How to define platform data for the uart1 in devicetree?, Getting the same error in reference board too.

Regards

Nobel

0 Kudos
2,307 Views
Pavel
NXP Employee
NXP Employee

Check .dts file for your board. See attachment. Both serial ports should be configured in your dts file.

Is there problem for using both serial ports under u-boot?


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,307 Views
nobelsharanyanj
Contributor III

scottwood Pavel

Hi Pavel,

Did you had a chance to look into the reference board?

right now we are creating a POC for a multi Millionaire company(Can't reveal the Name right now).

UART issues is really stopping as, we checked the same in reference board (P1010RDB-PB).

But the issues looks similar to our custom board.

FYI, We are using 1.8 SDK?

Please cross verify in your reference board and reply it back.

I want both uart 0 (Command line interface) as well uart 1(attached to a external peripheral).

Let me know, if there is any work around need to take care to handle the issues.

Regards

Nobel

0 Kudos