static int __init cpm_uart_init(void) { int ret, i; printk(KERN_INFO "Serial: CPM driver $Revision: 0.01 $\n"); #ifndef CONFIG_SERIAL_CPM_CONSOLE ret = cpm_uart_init_portdesc(); if (ret) return ret; #endif cpm_reg.nr = cpm_uart_nr; ret = uart_register_driver(&cpm_reg); if (ret) return ret; for (i = 0; i < cpm_uart_nr; i++) { int con = cpm_uart_port_map[i]; cpm_uart_ports[con].port.line = i; cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); } return ret; }
/* * Returns: * 0 on success, 1 on failure. */ static int kgdb_init(void) { struct uart_port *port; struct uart_cpm_port *pinfo; int use_bootmem = 0; /* use dma by default */ if(!cpm_uart_nr) { use_bootmem = 1; cpm_uart_init_portdesc(); } port = (struct uart_port *)&cpm_uart_ports[KGDB_PINFO_INDEX]; pinfo = (struct uart_cpm_port *)port; if (cpm_uart_early_setup(KGDB_PINFO_INDEX, use_bootmem)) return 1; termios_set_options(KGDB_PINFO_INDEX, KGDB_BAUD,'n',8,'n'); if (IS_SMC(pinfo)) pinfo->smcp->smc_smcm |= SMCM_TX; else pinfo->sccp->scc_sccm |= UART_SCCM_TX; return 0; }
static int __init cpm_uart_init(void) { int ret, i; printk(KERN_INFO "Serial: CPM driver $Revision: 1.1.1.1 $\n"); #ifndef CONFIG_SERIAL_CPM_CONSOLE ret = cpm_uart_init_portdesc(); if (ret) return ret; #endif cpm_reg.nr = cpm_uart_nr; ret = uart_register_driver(&cpm_reg); if (ret) return ret; for (i = 0; i < cpm_uart_nr; i++) { int con = cpm_uart_port_map[i]; cpm_uart_ports[con].port.line = i; cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); /* <8272-2.6><SGT><26-Jun-05> */ /* Do not initialise scc if configured as console as it is done during console initialisation */ if(i != cpm_uart_ports[con].port.cons->index) cpm_uart_init_scc(&cpm_uart_ports[con].port); } return ret; }
static int cpm_uart_init(void) { int ret; int i; struct device *dev; printk(KERN_INFO "Serial: CPM driver $Revision: 0.02 $\n"); /* lookup the bus for uart devices */ dev = bus_find_device(&platform_bus_type, NULL, 0, match_is_uart); /* There are devices on the bus - all should be OK */ if (dev) { cpm_uart_count(); cpm_reg.nr = cpm_uart_nr; if (!(ret = uart_register_driver(&cpm_reg))) { if ((ret = driver_register(&cpm_smc_uart_driver))) { uart_unregister_driver(&cpm_reg); return ret; } if ((ret = driver_register(&cpm_scc_uart_driver))) { driver_unregister(&cpm_scc_uart_driver); uart_unregister_driver(&cpm_reg); } } } else { /* No capable platform devices found - falling back to legacy mode */ pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n"); pr_info( "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n"); /* Don't run this again, if the console driver did it already */ if (cpm_uart_nr == 0) cpm_uart_init_portdesc(); cpm_reg.nr = cpm_uart_nr; ret = uart_register_driver(&cpm_reg); if (ret) return ret; for (i = 0; i < cpm_uart_nr; i++) { int con = cpm_uart_port_map[i]; #ifdef CONFIG_KGDB_CPM_UART /* We are not interested in ports yet utilized by kgdb */ if(con == KGDB_PINFO_INDEX) continue; #endif cpm_uart_ports[con].port.line = i; cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; if (cpm_uart_ports[con].set_lineif) cpm_uart_ports[con].set_lineif(&cpm_uart_ports[con]); uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); } } return ret; }
int __init cpm_uart_console_init(void) { int ret = cpm_uart_init_portdesc(); if (!ret) register_console(&cpm_scc_uart_console); return ret; }
/* * Setup console. Be careful is called early ! */ static int __init cpm_uart_console_setup(struct console *co, char *options) { struct uart_port *port; struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index]; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; struct platform_device* pdev = early_uart_get_pdev(co->index); int line = pinfo - cpm_uart_ports; #ifdef CONFIG_KGDB_CPM_UART /* We are not interested in ports yet utilized by kgdb */ if(co->index == KGDB_PINFO_INDEX) return 0; #endif if (!pdev) { pr_info("cpm_uart: console: compat mode\n"); /* compatibility - will be cleaned up */ cpm_uart_init_portdesc(); } port = (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; pinfo = (struct uart_cpm_port *)port; pinfo->flags |= FLAG_CONSOLE; if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { if ((baud = uart_baudrate()) == -1) baud = 9600; } ret = cpm_uart_early_setup(cpm_uart_port_map[co->index], 1); if(ret) return ret; uart_set_options(port, co, baud, parity, bits, flow); cpm_line_cr_cmd(line, CPM_CR_RESTART_TX); return 0; }
static int __init cpm_uart_console_setup(struct console *co, char *options) { struct uart_port *port; struct uart_cpm_port *pinfo; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; struct fs_uart_platform_info *pdata; struct platform_device* pdev = early_uart_get_pdev(co->index); if (!pdev) { pr_info("cpm_uart: console: compat mode\n"); /* compatibility - will be cleaned up */ cpm_uart_init_portdesc(); } port = (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; pinfo = (struct uart_cpm_port *)port; if (!pdev) { if (pinfo->set_lineif) pinfo->set_lineif(pinfo); } else { pdata = pdev->dev.platform_data; if (pdata) if (pdata->init_ioports) pdata->init_ioports(pdata); cpm_uart_drv_get_platform_data(pdev, 1); } pinfo->flags |= FLAG_CONSOLE; if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { if ((baud = uart_baudrate()) == -1) baud = 9600; } if (IS_SMC(pinfo)) { pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); } else { pinfo->sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX); pinfo->sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); } ret = cpm_uart_allocbuf(pinfo, 1); if (ret) return ret; cpm_uart_initbd(pinfo); if (IS_SMC(pinfo)) cpm_uart_init_smc(pinfo); else cpm_uart_init_scc(pinfo); uart_set_options(port, co, baud, parity, bits, flow); return 0; }