/* 68328serial.c: Serial port driver for 68328 microcontroller
*
* Copyright (C) 1995 David S. Miller <davem@caip.rutgers.edu>
* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
* Copyright (C) 1998, 1999 D. Jeff Dionne <jeff@uclinux.org>
* Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
* Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com>
* Copyright (C) 2002 Greg Ungerer <gerg@snapgear.com>
*
* VZ Support/Fixes Evan Stawnyczy <e@lineo.ca>
* Multiple UART support Daniel Potts <danielp@cse.unsw.edu.au>
* Power management support Daniel Potts <danielp@cse.unsw.edu.au>
* VZ Second Serial Port enable Phil Wilshire
* 2.4/2.5 port David McCullough
*/
#include <asm/dbg.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/major.h>
#include <linux/string.h>
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/console.h>
#include <linux/reboot.h>
#include <linux/keyboard.h>
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/gfp.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
/* (es) */
/* note: perhaps we can murge these files, so that you can just
* define 1 of them, and they can sort that out for themselves
*/
#if defined(CONFIG_M68EZ328)
#include <asm/MC68EZ328.h>
#else
#if defined(CONFIG_M68VZ328)
#include <asm/MC68VZ328.h>
#else
#include <asm/MC68328.h>
#endif /* CONFIG_M68VZ328 */
#endif /* CONFIG_M68EZ328 */
#include "68328serial.h"
/* Turn off usage of real serial interrupt code, to "support" Copilot */
#ifdef CONFIG_XCOPILOT_BUGS
#undef USE_INTS
#else
#define USE_INTS
#endif
static struct m68k_serial m68k_soft[NR_PORTS];
static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS;
/* multiple ports are contiguous in memory */
m68328_uart *uart_addr = (m68328_uart *)USTCNT_ADDR;
struct tty_struct m68k_ttys;
struct m68k_serial *m68k_consinfo = 0;
#define M68K_CLOCK (16667000) /* FIXME: 16MHz is likely wrong */
struct tty_driver *serial_driver;
/* number of characters left in xmit buffer before we ask for more */
#define WAKEUP_CHARS 256
/* Debugging... DEBUG_INTR is bad to use when one of the zs
* lines is your console ;(
*/
#undef SERIAL_DEBUG_INTR
#undef SERIAL_DEBUG_OPEN
#undef SERIAL_DEBUG_FLOW
#define RS_ISR_PASS_LIMIT 256
static void change_speed(struct m68k_serial *info);
/*
* Setup for console. Argument comes from the boot command line.
*/
/* note: this is messy, but it works, again, perhaps defined somewhere else?*/
#ifdef CONFIG_M68VZ328
#define CONSOLE_BAUD_RATE 19200
#define DEFAULT_CBAUD B19200
#endif
#ifndef CONSOLE_BAUD_RATE
#define CONSOLE_BAUD_RATE 9600
#define DEFAULT_CBAUD B9600
#endif
static int