ppc fixes for drivers/char/serial.c
PATCH 1/1 ppc fixes for drivers/char/serial.c
Hi Alan,
can you may include the attached patch in one of the next pre19 patches? It adds the possibility to work with pcmcia modem cards on PowerBooks, this patch was in for a longer time in the ppc tree of Paul M. and Ben Herrenschmidt.
Ben told me to send it to you with his ack.
Thanks in advance,
Andreas
drivers/char/serial.c +26 -9
@@ -150,6 +150,12 @@#include <asm/bitops.h> #include <asm/serial.h> +#ifdef CONFIG_MAC_SERIAL +#define SERIAL_DEV_OFFSET 4 +#else +#define SERIAL_DEV_OFFSET 0 +#endif +#ifdef SERIAL_INLINE #define _INLINE_ inline#endif
@@ -3130,7 +3136,7 @@ serial_driver.driver_name ="serial" ; serial_driver.name ="ttyS" ; serial_driver.major =TTY_MAJOR ; - serial_driver.minor_start =64 ; + serial_driver.minor_start =64 +SERIAL_DEV_OFFSET ; serial_driver.num =NR_PORTS ; serial_driver.type =TTY_DRIVER_TYPE_SERIAL ; serial_driver.subtype =SERIAL_TYPE_NORMAL ;
@@ -3194,11 +3200,22 @@ state->icount.frame = state->icount.parity =0 ; state->icount.overrun = state->icount.brk =0 ; state->irq =irq_cannonicalize (state->irq); -if (check_region (state->port,8 )) -continue ; -if (state->flags &ASYNC_BOOT_AUTOCONF ) -autoconfig (state); +#ifdef CONFIG_PPC +/* PowerMacs don't have legacy serial ports on IOs and would machine check */ +if (_machine != _MACH_Pmac) { +#endif + if (check_region(state->port,8)) +continue ; +if (state->flags &ASYNC_BOOT_AUTOCONF ) +autoconfig (state); +#ifdef CONFIG_PPC + } +#endif } +#ifdef CONFIG_PPC +if (_machine == _MACH_Pmac) +return 0 ; +#endif /* * Detect the IRQ only once every port is initialised, * because some 16450 do not reset to 0 the MCR register.
@@ -3268,22 +3285,22 @@ state->irq =detect_uart_irq (state);printk (KERN_INFO "tty%02d at 0x%04x (irq = %d) is a %s\n" , - state->line, state->port, state->irq, + state->line +SERIAL_DEV_OFFSET , state->port, state->irq, uart_config[state->type].name); -return state->line; +return state->line +SERIAL_DEV_OFFSET ; }void unregister_serial (int line) {unsigned long flags; -struct serial_state *state = &rs_table[line]; +struct serial_state *state = &rs_table[line +SERIAL_DEV_OFFSET ];save_flags (flags);cli ();if (state->info && state->info->tty)tty_hangup (state->info->tty); state->type =PORT_UNKNOWN ; -printk (KERN_INFO "tty%02d unloaded\n" , state->line); +printk (KERN_INFO "tty%02d unloaded\n" , state->line +SERIAL_DEV_OFFSET );restore_flags (flags); }