static int __devinit apbuart_probe(struct of_device *op, const struct of_device_id *match) { struct console co; int node; int freq_khz; int baud_rates[UART_NR]; unsigned long clk; struct device_node *dp = op->node; int v = 0, d = 0; unsigned int addr; struct uart_leon_port *port; struct amba_prom_registers *regs; int irq, line, *irqs; int *vendor = of_get_property(dp, "vendor", NULL); int *device = of_get_property(dp, "device", NULL); regs = of_get_property(dp, "reg", NULL); irqs = of_get_property(dp, "interrupts", NULL); if (vendor) v = *vendor; if (device) d = *device; if (LEON3_GpTimer_Regs == 0 || irqs == 0 || regs == 0 || !(v == VENDOR_GAISLER && d == GAISLER_APBUART)) { return -ENODEV; } addr = regs->phys_addr ; irq = *irqs; port = kzalloc(sizeof(struct uart_leon_port), GFP_KERNEL); if (unlikely(!port)) return -ENOMEM; node = prom_getchild(prom_root_node); freq_khz = prom_getint(node, "clock-frequency"); clk = ((unsigned long)(((LEON3_BYPASS_LOAD_PA(&LEON3_GpTimer_Regs->scalar_reload)) + 1))); port->port.membase = (void *)addr; port->port.mapbase = addr; port->port.irq = irq; port->port.iotype = SERIAL_IO_MEM; port->port.uartclk = clk * 1000 * 1000; port->port.fifosize = 1; port->port.ops = &leon_pops; port->port.flags = ASYNC_BOOT_AUTOCONF; port->port.line = line = leon_line_nr++; port->port.uartclk = freq_khz * 1000; uart_add_one_port(&leon_reg, port); uart_set_options(port, &co, line >= UART_NR ? 9600 : baud_rates[line], 'n', 8, 'n'); port->port.fifosize = apbuart_scan_fifo_size(port, line); apbuart_flush_fifo(port); printk("---------------- Match %d: 0x%x@%d : %s ----------------\n",line,addr, irq,dp->path_component_name); return 0; }
static int apbuart_probe(struct platform_device *op) { int i; struct uart_port *port = NULL; for (i = 0; i < grlib_apbuart_port_nr; i++) { if (op->dev.of_node == grlib_apbuart_nodes[i]) break; } port = &grlib_apbuart_ports[i]; port->dev = &op->dev; port->irq = op->archdata.irqs[0]; uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); apbuart_flush_fifo((struct uart_port *) port); printk(KERN_INFO "grlib-apbuart at 0x%llx, irq %d\n", (unsigned long long) port->mapbase, port->irq); return 0; }
static int __devinit apbuart_probe(struct platform_device *op, const struct of_device_id *match) { int i = -1; struct uart_port *port = NULL; i = 0; for (i = 0; i < grlib_apbuart_port_nr; i++) { if (op->dev.of_node == grlib_apbuart_nodes[i]) break; } port = &grlib_apbuart_ports[i]; port->dev = &op->dev; uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); apbuart_flush_fifo((struct uart_port *) port); printk(KERN_INFO "grlib-apbuart at 0x%llx, irq %d\n", (unsigned long long) port->mapbase, port->irq); return 0; }