Download & read the i.MX8M's Reference Manual, chapter 16.2.
Ahem, not really all of it, just check the memory map / register definition for UTXD
and UTS
.
Next, we will enhance our character device to print the using IMX UART peripheral using a simple MMIO interface. Useful resources for mapping, reading & writing IO memory: https://www.kernel.org/doc/html/latest/driver-api/device-io.html (read the introduction + MMIO parts).
In principle, these are the steps you'll have to do:
myuart_put_char(unsigned char ch)
– sends the specified character over the UART.0x1000
);while()
busy loop, but call ''cpu_relax'' to temporarily lower power consumption (optional, but good practice); use readl() to read IO from registers;echo hello uart > /dev/<mychardevicename>
.