⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uclinux-20040408-armsys.patch

📁 uClinux-20040408对应s3c44b0x的补丁
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+		baud = simple_strtoul(options, NULL, 10);+		while (*s >= '0' && *s <= '9')+			s++;+		if (*s)+			parity = *s++;+		if (*s)+			bits = *s - '0';+	}++	/*+	 *    Now construct a cflag setting.+	 */+	switch (baud) {+	case 1200:+		cflag |= B1200;+		break;+	case 2400:+		cflag |= B2400;+		break;+	case 4800:+		cflag |= B4800;+		break;+	case 9600:+		cflag |= B9600;+		break;+	case 19200:+		cflag |= B19200;+		break;+	case 38400:+		cflag |= B38400;+		break;+	case 57600:+		cflag |= B57600;+		break;+	case 115200:+		cflag |= B115200;+		break;+	default:+		cflag |= B9600;+		break;+	}+	switch (bits) {+	case 7:+		cflag |= CS7;+		break;+	default:+		cflag |= CS8;+		break;+	}+	switch (parity) {+	case 'o':+	case 'O':+		cflag |= PARODD;+		break;+	case 'e':+	case 'E':+		cflag |= PARENB;+		break;+	}+	co->cflag = cflag;+	rs285_set_cflag(cflag);+	rs285_console_write(NULL, "\e[2J\e[Hboot ", 12);+	if (options)+		rs285_console_write(NULL, options, strlen(options));+	else+		rs285_console_write(NULL, "no options", 10);+	rs285_console_write(NULL, "\n", 1);++	return 0;+}++#ifdef CONFIG_SERIAL_21285_OLD+static struct console rs285_old_cons =+{+	SERIAL_21285_OLD_NAME,+	rs285_console_write,+	NULL,+	rs285_console_device,+	rs285_console_wait_key,+	NULL,+	rs285_console_setup,+	CON_PRINTBUFFER,+	-1,+	0,+	NULL+};+#endif++static struct console rs285_cons =+{+	name:		SERIAL_21285_NAME,+	write:		rs285_console_write,+	device:		rs285_console_device,+	wait_key:	rs285_console_wait_key,+	setup:		rs285_console_setup,+	flags:		CON_PRINTBUFFER,+	index:		-1,+};++void __init rs285_console_init(void)+{+#ifdef CONFIG_SERIAL_21285_OLD+	if (!machine_is_ebsa285() && !machine_is_netwinder())+		register_console(&rs285_old_cons);+#endif+	register_console(&rs285_cons);+}++#endif /* CONFIG_SERIAL_21285_CONSOLE */++EXPORT_NO_SYMBOLS;++MODULE_LICENSE("GPL");+MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver");diff -urN uClinux-dist/linux-2.4.x/drivers/serial/serial_8250.c linux-2.4.x/drivers/serial/serial_8250.c--- uClinux-dist/linux-2.4.x/drivers/serial/serial_8250.c	1970-01-01 08:00:00.000000000 +0800+++ linux-2.4.x/drivers/serial/serial_8250.c	2004-03-25 23:16:48.000000000 +0800@@ -0,0 +1,1956 @@+/*+ *  linux/drivers/char/serial_8250.c+ *+ *  Driver for 8250/16550-type serial ports+ *+ *  Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.+ *+ *  Copyright (C) 2001 Russell King.+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License as published by+ * the Free Software Foundation; either version 2 of the License, or+ * (at your option) any later version.+ *+ *  $Id: serial_8250.c,v 1.14.2.6 2002/02/04 17:51:22 rmk Exp $+ *+ * A note about mapbase / membase+ *+ *  mapbase is the physical address of the IO port.  Currently, we don't+ *  support this very well, and it may well be dropped from this driver+ *  in future.  As such, mapbase should be NULL.+ *+ *  membase is an 'ioremapped' cookie.  This is compatible with the old+ *  serial.c driver, and is currently the preferred form.+ */+#include <linux/config.h>+#include <linux/module.h>+#include <linux/errno.h>+#include <linux/sched.h>+#include <linux/tty.h>+#include <linux/tty_flip.h>+#include <linux/major.h>+#include <linux/ptrace.h>+#include <linux/ioport.h>+#include <linux/init.h>+#include <linux/serial.h>+#include <linux/console.h>+#include <linux/sysrq.h>+#include <linux/serial_reg.h>+#include <linux/serialP.h>+#include <linux/delay.h>+#include <linux/serial_core.h>+#include <linux/kmod.h>++#include <asm/system.h>+#include <asm/io.h>+#include <asm/irq.h>+#include <asm/uaccess.h>+#include <asm/bitops.h>++#include "serial_8250.h"++/*+ * This converts from our new CONFIG_ symbols to the symbols+ * that asm/serial.h expects.  You _NEED_ to comment out the+ * linux/config.h include contained inside asm/serial.h for+ * this to work.+ */+#undef CONFIG_SERIAL_MANY_PORTS+#undef CONFIG_SERIAL_DETECT_IRQ+#undef CONFIG_SERIAL_MULTIPORT+#undef CONFIG_HUB6++#ifdef CONFIG_SERIAL_8250_MANY_PORTS+#define CONFIG_SERIAL_MANY_PORTS 1+#endif+#ifdef CONFIG_SERIAL_8250_DETECT_IRQ+#define CONFIG_SERIAL_DETECT_IRQ 1+#endif+#ifdef CONFIG_SERIAL_8250_MULTIPORT+#define CONFIG_SERIAL_MULTIPORT 1+#endif+#ifdef CONFIG_SERIAL_8250_HUB6+#define CONFIG_HUB6 1+#endif++#include <asm/serial.h>++static struct old_serial_port old_serial_port[] = {+	SERIAL_PORT_DFNS /* defined in asm/serial.h */+};++#define UART_NR	ARRAY_SIZE(old_serial_port)++static struct tty_driver normal, callout;+static struct tty_struct *serial8250_table[UART_NR];+static struct termios *serial8250_termios[UART_NR], *serial8250_termios_locked[UART_NR];+#ifdef CONFIG_SERIAL_8250_CONSOLE+static struct console serial8250_console;+static unsigned int lsr_break_flag;+#endif+static struct uart_info *IRQ_ports[NR_IRQS];++#if defined(CONFIG_SERIAL_RSA) && defined(MODULE)++#define PORT_RSA_MAX 4+static int probe_rsa[PORT_RSA_MAX];+static int force_rsa[PORT_RSA_MAX];++MODULE_PARM(probe_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");+MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");+MODULE_PARM(force_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");+MODULE_PARM_DESC(force_rsa, "Force I/O ports for RSA");+#endif /* CONFIG_SERIAL_RSA  */++#define port_acr	unused[0]	/* 8bit */+#define port_ier	unused[1]	/* 8bit */+#define port_rev	unused[2]	/* 8bit */+#define port_lcr	unused[3]	/* 8bit */++/*+ * Here we define the default xmit fifo size used for each type of UART.+ */+static const struct serial_uart_config uart_config[PORT_MAX_8250+1] = {+	{ "unknown",	1,	0 },+	{ "8250",	1,	0 },+	{ "16450",	1,	0 },+	{ "16550",	1,	0 },+	{ "16550A",	16,	UART_CLEAR_FIFO | UART_USE_FIFO },+	{ "Cirrus",	1, 	0 },+	{ "ST16650",	1,	UART_CLEAR_FIFO | UART_STARTECH },+	{ "ST16650V2",	32,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },+	{ "TI16750",	64,	UART_CLEAR_FIFO | UART_USE_FIFO },+	{ "Startech",	1,	0 },+	{ "16C950/954",	128,	UART_CLEAR_FIFO | UART_USE_FIFO },+	{ "ST16654",	64,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },+	{ "XR16850",	128,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },+	{ "RSA",	2048,	UART_CLEAR_FIFO | UART_USE_FIFO }+};++static _INLINE_ unsigned int serial_in(struct uart_port *port, int offset)+{+	offset <<= port->regshift;++	switch (port->iotype) {+#ifdef CONFIG_SERIAL_8250_HUB6+	case SERIAL_IO_HUB6:+		outb(port->hub6 - 1 + offset, port->iobase);+		return inb(port->iobase + 1);+#endif++	case SERIAL_IO_MEM:+		return readb((unsigned long)port->membase + offset);++	default:+		return inb(port->iobase + offset);+	}+}++static _INLINE_ void+serial_out(struct uart_port *port, int offset, int value)+{+	offset <<= port->regshift;++	switch (port->iotype) {+#ifdef CONFIG_SERIAL_8250_HUB6+	case SERIAL_IO_HUB6:+		outb(port->hub6 - 1 + offset, port->iobase);+		outb(value, port->iobase + 1);+		break;+#endif++	case SERIAL_IO_MEM:+		writeb(value, (unsigned long)port->membase + offset);+		break;++	default:+		outb(value, port->iobase + offset);+	}+}++/*+ * We used to support using pause I/O for certain machines.  We+ * haven't supported this for a while, but just in case it's badly+ * needed for certain old 386 machines, I've left these #define's+ * in....+ */+#define serial_inp(port, offset)		serial_in(port, offset)+#define serial_outp(port, offset, value)	serial_out(port, offset, value)+++/*+ * For the 16C950+ */+static void serial_icr_write(struct uart_port *port, int offset, int  value)+{+	serial_out(port, UART_SCR, offset);+	serial_out(port, UART_ICR, value);+}++static unsigned int serial_icr_read(struct uart_port *port, int offset)+{+	unsigned int value;++	serial_icr_write(port, UART_ACR, port->port_acr | UART_ACR_ICRRD);+	serial_out(port, UART_SCR, offset);+	value = serial_in(port, UART_ICR);+	serial_icr_write(port, UART_ACR, port->port_acr);++	return value;+}++#ifdef CONFIG_SERIAL_RSA+/* Attempts to turn on the RSA FIFO.  Returns zero on failure */+static int enable_rsa(struct uart_port *port)+{+	unsigned char mode;+	int result;+	unsigned long flags;++	save_flags(flags); cli();+	mode = serial_inp(port, UART_RSA_MSR);+	result = mode & UART_RSA_MSR_FIFO;++	if (!result) {+		serial_outp(port, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);+		mode = serial_inp(port, UART_RSA_MSR);+		result = mode & UART_RSA_MSR_FIFO;+	}++	restore_flags(flags);+	return result;+}++/* Attempts to turn off the RSA FIFO.  Returns zero on failure */+static int disable_rsa(struct uart_port *port)+{+	unsigned char mode;+	int result;+	unsigned long flags;++	save_flags(flags); cli();+	mode = serial_inp(port, UART_RSA_MSR);+	result = !(mode & UART_RSA_MSR_FIFO);++	if (!result) {+		serial_outp(port, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO);+		mode = serial_inp(port, UART_RSA_MSR);+		result = !(mode & UART_RSA_MSR_FIFO);+	}++	restore_flags(flags);+	return result;+}+#endif /* CONFIG_SERIAL_RSA */++/*+ * This is a quickie test to see how big the FIFO is.+ * It doesn't work at all the time, more's the pity.+ */+static int size_fifo(struct uart_port *port)+{+	unsigned char old_fcr, old_mcr, old_dll, old_dlm;+	int count;++	old_fcr = serial_inp(port, UART_FCR);+	old_mcr = serial_inp(port, UART_MCR);+	serial_outp(port, UART_FCR, UART_FCR_ENABLE_FIFO |+		    UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);+	serial_outp(port, UART_MCR, UART_MCR_LOOP);+	serial_outp(port, UART_LCR, UART_LCR_DLAB);+	old_dll = serial_inp(port, UART_DLL);+	old_dlm = serial_inp(port, UART_DLM);+	serial_outp(port, UART_DLL, 0x01);+	serial_outp(port, UART_DLM, 0x00);+	serial_outp(port, UART_LCR, 0x03);+	for (count = 0; count < 256; count++)+		serial_outp(port, UART_TX, count);+	mdelay(20);+	for (count = 0; (serial_inp(port, UART_LSR) & UART_LSR_DR) &&+	     (count < 256); count++)+		serial_inp(port, UART_RX);+	serial_outp(port, UART_FCR, old_fcr);+	serial_outp(port, UART_MCR, old_mcr);+	serial_outp(port, UART_LCR, UART_LCR_DLAB);+	serial_outp(port, UART_DLL, old_dll);+	serial_outp(port, UART_DLM, old_dlm);++	return count;+}++/*+ * This is a helper routine to autodetect StarTech/Exar/Oxsemi UART's.+ * When this function is called we know it is at least a StarTech+ * 16650 V2, but it might be one of several StarTech UARTs, or one of+ * its clones.  (We treat the broken original StarTech 16650 V1 as a+ * 16550, and why not?  Startech doesn't seem to even acknowledge its+ * existence.)+ * + * What evil have men's minds wrought...+ */+static void+autoconfig_startech_uarts(struct uart_port *port)+{+	unsigned char scratch, scratch2, scratch3, scratch4;++	/*+	 * First we check to see if it's an Oxford Semiconductor UART.+	 *+	 * If we have to do this here because some non-National+	 * Semiconductor clone chips lock up if you try writing to the+	 * LSR register (which serial_icr_read does)+	 */+	if (port->type == PORT_16550A) {+		/*+		 * EFR [4] must be set else this test fails+		 *+		 * This shouldn't be necessary, but Mike Hudson+		 * (Exoray@isys.ca) claims that it's needed for 952+		 * dual UART's (which are not recommended for new designs).+		 */+		port->port_acr = 0;+		serial_out(port, UART_LCR, 0xBF);+		serial_out(port, UART_EFR, 0x10);+		serial_out(port, UART_LCR, 0x00);+		/* Check for Oxford Semiconductor 16C950 */+		scratch = serial_icr_read(port, UART_ID1);+		scratch2 = serial_icr_read(port, UART_ID2);+		scratch3 = serial_icr_read(port, UART_ID3);+		+		if (scratch == 0x16 && scratch2 == 0xC9 &&+		    (scratch3 == 0x50 || scratch3 == 0x52 ||+		     scratch3 == 0x54)) {+			port->type = PORT_16C950;+			port->port_rev = serial_icr_read(port, UART_REV) |+				(scratch3 << 8);+			return;+		}+	}+	+	/*+	 * We check for a XR16C850 by setting DLL and DLM to 0, and then+	 * reading

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -