Date: Wed, 27 Jun 2001 17:55:06 -0700 From: Frank Rowand Reply-To: frowand@mvista.com Subject: Paulus, Trini: here's how to dynamically register serial port You guys were discussing how to get rid of all the #ifdef ... includes for the serial ports, and wondering how to dynamically register ports. The interface the serial driver provides for this is early_serial_setup(). Here's an example of using it (this example uses the SERIAL_PORT_DFNS from ppc4xx_serial.h just because it was already defined there): { #include int k; struct serial_struct req; struct serial_state tmp_rs_table[RS_TABLE_SIZE] = { SERIAL_PORT_DFNS /* Defined in ppc4xx_serial.h */ }; for (k = 0; k < RS_TABLE_SIZE; k++) { if (tmp_rs_table[k].iomem_base != 0) { req.baud_base = tmp_rs_table[k].baud_base; req.port = tmp_rs_table[k].port; req.port_high = 0; req.irq = tmp_rs_table[k].irq; req.flags = tmp_rs_table[k].flags; req.close_delay = tmp_rs_table[k].close_delay; req.io_type = tmp_rs_table[k].io_type; req.hub6 = tmp_rs_table[k].hub6; req.iomem_base = ioremap((int)tmp_rs_table[k].iomem_base, PAGE_SIZE); req.iomem_reg_shift = tmp_rs_table[k].iomem_reg_shift; req.type = tmp_rs_table[k].type; req.xmit_fifo_size = tmp_rs_table[k].xmit_fifo_size; req.custom_divisor = tmp_rs_table[k].custom_divisor; req.closing_wait = tmp_rs_table[k].closing_wait; early_serial_setup(&req); } } } -Frank -- Frank Rowand MontaVista Software, Inc