Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHi,
--- Quote Start --- I don't get it, why I need /dev/ttyS2 and S3? I have 3 uart in my system, but it only show 2. And I can't open (ttyS0 and ttyS1) in software. --- Quote End --- Please check that your UART names are well-defined in the file 'nios2-linux/linux-2.6/arch/nios2/kernel/config.c', and if not, please modify it. In default, those must be 'UART0. 'UART1', 'UART2' and 'UART3'.
/*
* Altera UART
*/
static struct altera_uart_platform_uart nios2_uart_platform = {# if defined(UART0_BASE) || defined(UART_BASE)
# ifdef UART0_BASE
{
.mapbase = UART0_BASE,
.irq = UART0_IRQ,
.uartclk = UART0_FREQ,
},
# else
{
.mapbase = UART_BASE,
.irq = UART_IRQ,
.uartclk = UART_FREQ,
},
# endif# endif# ifdef UART1_BASE
{
.mapbase = UART1_BASE,
.irq = UART1_IRQ,
.uartclk = UART1_FREQ,
},# endif# ifdef UART2_BASE
{
.mapbase = UART2_BASE,
.irq = UART2_IRQ,
.uartclk = UART2_FREQ,
},# endif# ifdef UART3_BASE
{
.mapbase = UART3_BASE,
.irq = UART3_IRQ,
.uartclk = UART3_FREQ,
},# endif
{},
};
And UART devices are probed in the function 'altera_uart_probe' of the file 'nios2-linux/linux-2.6/drivers/serial/altuart.c'.
static int __devinit altera_uart_probe(struct platform_device *pdev)
{
struct altera_uart_platform_uart *platp = pdev->dev.platform_data;
struct uart_port *port;
int i;
for (i = 0;
((i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS) && (platp.mapbase));
i++) {
port = &altera_uart_ports.port;
port->line = i;
port->type = PORT_ALTERA_UART;
port->mapbase = platp.mapbase;
port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
port->iotype = SERIAL_IO_MEM;
port->irq = platp.irq;
port->uartclk = platp.uartclk;
port->ops = &altera_uart_ops;
port->flags = ASYNC_BOOT_AUTOCONF;
uart_add_one_port(&altera_uart_driver, port);
}
return 0;
}
Please debug it by 'printk', if necessry. Anyway you must distinguish your UART devices by major and minor numbers, so you need /dev/ttyS2 and /dev/ttyS3 after your 4 UARTs are probed successfully. Kazu