示例#1
0
/*
 *  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;
}
示例#2
0
/*
 * 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;
}