Here is my HOWTO for UART1 (DM365EVM & DVSDK4.02 & LINUX 2.6.32).
Note (DM365EVM rev.E): Three wires are soldered:
* TP49 (near Altera) = UART1_TX (instead of PWM1)
* RN3(5,6) = UART1_RX (instead of SPI4_SDO)
* C86(gnd) = GND
1. Patch some files in Linux:
1.1. arch/arm/mach-davinci/include/mach/serial.h
Set two UARTS for DM365 and set correct UART1 addr.
#include <mach/hardware.h>
#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
#ifdef CONFIG_ARCH_DAVINCI_DM365
#define DAVINCI_MAX_NR_UARTS 2
#define DAVINCI_UART1_BASE (IO_PHYS + 0x106000)
#else
#define DAVINCI_MAX_NR_UARTS 3
#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800)
#endif
...
1.2.arch/arm/mach-davinci/include/mach/dm365.h
Add new function prototype 'dm365_init_uart1_instead_spi'...
void __init dm365_init_rtc(void);
void __init dm365_init_uart1_instead_spi(void);
void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
...
1.3.arch/arm/mach-davinci/dm365.c
Add'dm365_init_uart1_instead_spi' realisation.
void __init dm365_init_uart1_instead_spi(void) {
static void __iomem *SystemRegisters; //access to system registers via memory remap
u32 regval; //Register value
SystemRegisters=ioremap(DAVINCI_SYSTEM_MODULE_BASE,SECTION_SIZE);
if(!SystemRegisters) {
release_mem_region(DAVINCI_SYSTEM_MODULE_BASE,SECTION_SIZE);
pr_err("ERROR: can't map DAVINCI_SYSTEM_MODULE_BASE\n");
return;
}
regval= __raw_readl(SystemRegisters+0x0C); //Read PINMUX3
regval=regval | 0x60000000;
__raw_writel(regval,SystemRegisters+0x0C); //GIO25=UART1_TXD
regval= __raw_readl(SystemRegisters+0x10); //Read PINMUX4
regval=regval | 0x0000C000;
__raw_writel(regval,SystemRegisters+0x10); //GIO34=UART1_RXD
printk("UART1 enabled instead of SPI!\n");
}
1.4.arch/arm/mach-davinci/board-dm365-evm.c
Make some changes in 'dm365_evm_init'.
Move 'davinci_serial_init(&uart_config)' to the end of'dm365_evm_init'
function. And add some code before 'davinci_serial_init'.
Here is old:
static __init void dm365_evm_init(void)
{
evm_init_i2c();
davinci_serial_init(&uart_config); //Move this line to the end of func
...
Here is new (end of 'dm365_evm_init'):
...
#ifdef CONFIG_DAVINCI_DM365_UART1RXGIO34_UART1TXGIO25
dm365_init_uart1_instead_spi();
#endif
davinci_serial_init(&uart_config); //NEW POSITION!
}
//END OF 'dm365_evm_init'1.5.
arch/arm/mach-davinci/Kconfig
Add menuconfig for UART1 support.
Before THIS SECTIONconfig DAVINCI_MUX
bool "DAVINCI multiplexing support"
depends on ARCH_DAVINCI
Add THIS SECTIONconfig DAVINCI_DM365_UART1RXGIO34_UART1TXGIO25
bool "Enable UART1_RXD on GIO34 and UART1_TXD on GIO25"
depends on ARCH_DAVINCI_DM365
help
GIO34/SPI4_SIMO/SPI4_SOMI/UART1_RXD
GIO25/'SPI0_SCS[0]/PWM1/UART1_TXD
Say Y here to select UART1_RXD and UART1_TXD on theese pins.
See 'arch/arm/mach-davinci/dm365.c' for details.
2. Linux configWhen configure Linux set
, select
CONFIG_DAVINCI_DM365_UART1RXGIO34_UART1TXGIO25=y
in config file.
If using menuconfig.. goto "System Type", "TI DaVinci Implementations""Enable UART1_RXD on GIO34 and UART_TXD on GIO25".
3. Rebuild Linux
4. Reboot board and test some message.# dmesg | grep UART
UART1 enabled instead of SPI!
5. Configure via ssty# stty -F /dev/ttyS1 115200
Test current ssty.
# stty -F /dev/ttyS1
speed 115200 baud;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-brkint -imaxbel
NOTE: It's not saved. 'stty' setup must be in your starting script!
6. TEST.
Open HOST TERMINAL (minicom or picocom) which is connected to board ttyS1 port.
Try this from board:# cat > hello.txt << "EOF"
HOST TERMINAL (minicom or picocom)
> Hello
> World!
> EOF
# cat hello.txt > /dev/ttyS1must print:
Hello
World!
----
GOOD LUCK!!!