/* * Blackfin On-Chip Serial Driver * * Copyright 2006-2008 Analog Devices Inc. * * Enter bugs at http://blackfin.uclinux.org/ * * Licensed under the GPL-2 or later. */#if defined(CONFIG_SERIAL_BFIN_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)#define SUPPORT_SYSRQ#endif#include<linux/module.h>#include<linux/ioport.h>#include<linux/init.h>#include<linux/console.h>#include<linux/sysrq.h>#include<linux/platform_device.h>#include<linux/tty.h>#include<linux/tty_flip.h>#include<linux/serial_core.h>#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)#include<linux/kgdb.h>#include<asm/irq_regs.h>#endif#include<asm/gpio.h>#include<mach/bfin_serial_5xx.h>#ifdef CONFIG_SERIAL_BFIN_DMA#include<linux/dma-mapping.h>#include<asm/io.h>#include<asm/irq.h>#include<asm/cacheflush.h>#endif/* UART name and device definitions */#define BFIN_SERIAL_NAME "ttyBF"#define BFIN_SERIAL_MAJOR 204#define BFIN_SERIAL_MINOR 64staticstructbfin_serial_portbfin_serial_ports[BFIN_UART_NR_PORTS];staticintnr_active_ports=ARRAY_SIZE(bfin_serial_resource);#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)# ifndef CONFIG_SERIAL_BFIN_PIO# error KGDB only support UART in PIO mode.# endifstaticintkgdboc_port_line;staticintkgdboc_break_enabled;#endif/* * Setup for console. Argument comes from the menuconfig */#define DMA_RX_XCOUNT 512#define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT)#define DMA_RX_FLUSH_JIFFIES (HZ / 50)#ifdef CONFIG_SERIAL_BFIN_DMAstaticvoidbfin_serial_dma_tx_chars(structbfin_serial_port*uart);#elsestaticvoidbfin_serial_tx_chars(structbfin_serial_port*uart);#endifstaticvoidbfin_serial_reset_irda(structuart_port*port);#if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \ defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)staticunsignedintbfin_serial_get_mctrl(structuart_port*port){