内核使用3.14.28版本,要添加一个st16c554的扩展串口,设备树配置为如下:
uart8250_1{
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart8250_1>;
compatible = "ns16550a";
clock-frequency = <11059200>;
interrupt-parent = <&gpio1>;
interrupts = <10 2>;
gpio_int = <&gpio1 10 2>;
reg = <0x8000000 0x1000>;
//fifo-size = <10>;
//current-speed = <115200>;
reg-shift = <1>;
reg-io-width = <2>; //1:8位 2:16位
reg-offset = <16>; //16:0x10
no-loopback-test;
status = "okay";
};
make menuconfig下已经配置了8250_core与of_serial文件,现在发现serial8250_probe已经进入,但是没有配置的资源,for循环进不去。/dev下有ttyS0,应用程序运行出错:ttyS0: LSR safety check engaged!。
serial8250_probe如下:
static int serial8250_probe(struct platform_device *dev)
{
struct plat_serial8250_port *p = dev_get_platdata(&dev->dev);
struct uart_8250_port uart;
int ret, i, irqflag = 0;
memset(&uart, 0, sizeof(uart));
if (share_irqs)
irqflag = IRQF_SHARED;
for (i = 0; p && p->flags != 0; p++, i++) {
printk("iobase=0x%x\n",p->iobase);
uart.port.iobase = p->iobase;
uart.port.membase = p->membase;
uart.port.irq = p->irq;
uart.port.irqflags = p->irqflags;
uart.port.uartclk = p->uartclk;
uart.port.regshift = p->regshift;
uart.port.iotype = p->iotype;
uart.port.flags = p->flags;
uart.port.mapbase = p->mapbase;
uart.port.hub6 = p->hub6;
uart.port.private_data = p->private_data;
uart.port.type = p->type;
uart.port.serial_in = p->serial_in;
uart.port.serial_out = p->serial_out;
uart.port.handle_irq = p->handle_irq;
uart.port.handle_break = p->handle_break;
uart.port.set_termios = p->set_termios;
uart.port.pm = p->pm;
uart.port.dev = &dev->dev;
uart.port.irqflags |= irqflag;
ret = serial8250_register_8250_port(&uart);
if (ret < 0) {
dev_err(&dev->dev, "unable to register port at index %d "
"(IO%lx MEM%llx IRQ%d): %d\n", i,
p->iobase, (unsigned long long)p->mapbase,
p->irq, ret);
}
}
return 0;
}
|