AnsweredAssumed Answered

imx uart address in Linux

Question asked by Adam Rudziński on Sep 5, 2018
Latest reply on Sep 7, 2018 by Adam Rudziński

Hi,

 

I'm trying to use i.MX6UL with Linux 4.12.4 in a device with RS485 bus handled by serial port UART5. I have a problem that no matter what I try to do, if I leave control to the SERIAL_IMX driver, the RTS signal, which is used as driver enable, gets high on boot and stays like that forever. The correct behaviour would be that this signal stays low on boot and goes high only for transmission.

 

I've added a number of printk's to drivers/tty/serial/imx.c to track when the driver tries to change the state of the signal, and also what values it tries to write to UCR2 register, and eventually - where does it expect the register to be located.

The observation is, that the struct uart_port type variable describing the port has rs485.flags = 0x3, which looks correct. Also, driver calls functions intended for setting or clearing the signal correctly, and it produces correct value of UCR2, equal to 0x4027 or 0x5027, for setting and clearing the signal, respectively.

 

But, what I don't understand and I am unable to find any relation to the hardware, is that the driver thinks the serial port is located at address 0xe0964000, while the true physical address of the UART5 peripheral is 0x021f4000. Is this a virtual address of the peripheral? Do peripherals have a virtual address at all? To me it would make no sense.

 

Please, could someone explain to me why this reported address is correct, if it is, or otherwise help me track where does this come from? I didn't find the place where uart_port.membase gets assigned its value.

 

Best regards,
Adam

Outcomes