diff mbox

[1/2,v1] davinci: support disabling modem status interrupts on SOC UARTS

Message ID 1294230392-29564-1-git-send-email-michael.williamson@criticallink.com (mailing list archive)
State Superseded
Headers show

Commit Message

Michael Williamson Jan. 5, 2011, 12:26 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 8051110..8f7f5e5 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -49,6 +49,8 @@ 
 struct davinci_uart_config {
 	/* Bit field of UARTs present; bit 0 --> UART1 */
 	unsigned int enabled_uarts;
+	/* Bit field of modem status interrupt disables; bit 0 -> UART1 */
+	unsigned int disable_msi;
 };
 
 extern int davinci_serial_init(struct davinci_uart_config *);
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 1875740..83d44c0 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -31,6 +31,22 @@ 
 #include <mach/serial.h>
 #include <mach/cputype.h>
 
+static void davinci_serial_out_nomsi(struct uart_port *p, int offset, int value)
+{
+	int lcr, lcr_off;
+
+	if (offset == UART_IER) {
+		lcr_off = UART_LCR << p->regshift;
+		lcr = readb(p->membase + lcr_off);
+		/* don't override DLM setting, or probing operations */
+		if (!(lcr & UART_LCR_DLAB) && p->type != PORT_UNKNOWN)
+			value &= ~UART_IER_MSI;
+	}
+
+	offset <<= p->regshift;
+	writeb(value, p->membase + offset);
+}
+
 static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
 					   int offset)
 {
@@ -109,6 +125,9 @@  int __init davinci_serial_init(struct davinci_uart_config *info)
 
 		if (p->membase && p->type != PORT_AR7)
 			davinci_serial_reset(p);
+
+		if (info->disable_msi & (1 << i))
+			p->serial_out = davinci_serial_out_nomsi;
 	}
 
 	return platform_device_register(soc_info->serial_dev);