Skip to contentSkip to conversation

Moorestown serial consoles

PATCH New Alan Cox 1 participant 3 messages Jun 16, 2010 TTY layer and serial drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

cover Moorestown serial consoles

This patch series adds support for the Max3110 used as the serial console on the Moorestown platform.

Although the max3100 driver can and does support the 3110 it's not capable of handling the needs of the Moorestown platform. At the same time this driver does things that we don't want in a generic 3110 driver.

So we end up with two. We've tried really hard but there isn't an obvious way to avoid this without producing one driver that is far harder to maintain than having two.

Earlyprintk support also exists for this device but is dependant on some bits that are not yet submitted so has been omitted for the initial submission.

Alan

---

Feng Tang (1):
mrst_max3110: add UART driver for Max3110 on Moorestown

jianwei.yang (1):
max3110 sanity check a register

 drivers/serial/Kconfig        |   17 +
 drivers/serial/Makefile       |    1 
 drivers/serial/mrst_max3110.c |  853 +++++++++++++++++++++++++++++++++++++++++
 drivers/serial/mrst_max3110.h |   59 +++
 4 files changed, 930 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/mrst_max3110.c
 create mode 100644 drivers/serial/mrst_max3110.h
author
#1 lore raw

PATCH 1/2 mrst_max3110: add UART driver for Max3110 on Moorestown

From: Feng Tang <[email protected]>

This driver enable the max3110 device, it can be used as a system console. the IRQ needs be enabled if user want a better performance. MRST max3110 works in 3.684MHz clock, which supports 230400 as its maximum rate.

---

 drivers/serial/Kconfig        |   17 +
 drivers/serial/Makefile       |    1 
 drivers/serial/mrst_max3110.c |  844 +++++++++++++++++++++++++++++++++++++++++
 drivers/serial/mrst_max3110.h |   59 +++
 4 files changed, 921 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/mrst_max3110.c
 create mode 100644 drivers/serial/mrst_max3110.h
drivers/serial/Kconfig +17 -0
index 8b23165..45ad290 100644
@@ -698,6 +698,23 @@ config SERIAL_SA1100_CONSOLE
 	  your boot loader (lilo or loadlin) about how to pass options to the
 	  kernel at boot time.)
 
+config SERIAL_MRST_MAX3110
+	tristate "SPI UART driver for Max3110"
+	depends on SPI_DW_PCI
+	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
+	help
+	  This is the UART protocol driver for the MAX3110 device on
+	  the Intel Moorestown platform. On other systems use the max3100
+	  driver.
+
+config MRST_MAX3110_IRQ
+	boolean "Enable GPIO IRQ for Max3110 over Moorestown"
+	default n
+	depends on SERIAL_MRST_MAX3110 && GPIO_LANGWELL
+	help
+	  This has to be enabled after Moorestown GPIO driver is loaded
+
 config SERIAL_BFIN
 	tristate "Blackfin serial port support"
 	depends on BLACKFIN
drivers/serial/Makefile +1 -0
index 208a855..a5edb49 100644
@@ -84,3 +84,4 @@ obj-$(CONFIG_SERIAL_TIMBERDALE)	+= timbuart.o
 obj-$(CONFIG_SERIAL_GRLIB_GAISLER_APBUART) += apbuart.o
 obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o
 obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
+obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
drivers/serial/mrst_max3110.c new file +844 -0

844 lines not on this page · raw message

drivers/serial/mrst_max3110.h new file +59 -0

59 lines not on this page · raw message

author
#2 lore raw

PATCH 2/2 max3110 sanity check a register

In reply to Alan Cox

From: jianwei.yang <[email protected]>

MAX3111 is the SPI/UART IC installed on the MRST SPI Port Card as a serial debug goal, and the SPI Port Card will be frequently mounted and unmounted from the main board by developers depending whether debug serial is required or not.

As the MAX3111 has no subvendor or product id registers available, the patch will try to access one register to decide if this IC is present or not.

---

 drivers/serial/mrst_max3110.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
drivers/serial/mrst_max3110.c +11 -2
index 273e7cb..f9c01ae 100644
@@ -721,7 +721,7 @@ static int serial_m3110_probe(struct spi_device *spi)
 	struct uart_max3110 *max;
 	int ret;
 	unsigned char *buffer;
-
+	u16 res;
 	max = kzalloc(sizeof(*max), GFP_KERNEL);
 	if (!max)
 		return -ENOMEM;
@@ -753,7 +753,16 @@ static int serial_m3110_probe(struct spi_device *spi)
 
 	max->cur_conf = 0;
 	atomic_set(&max->irq_pending, 0);
-
+	/* Check if reading configuration register returns something sane */
+
+	res = RC_TAG;
+	ret = max3110_write_then_read(max, (u8 *)&res, (u8 *)&res, 2, 0);
+	if (ret < 0 || res == 0 || res == 0xffff) {
+		printk(KERN_ERR "MAX3111 deemed not present (conf reg %04x)",
+									res);
+		ret = -ENODEV;
+		goto err_get_page;
+	}
 	buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
 	if (!buffer) {
 		ret = -ENOMEM;