summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2010-03-04 22:51:13 +0000
committerPhil Blundell <philb@gnu.org>2010-03-04 22:51:13 +0000
commitfdf8185913576006aa3c69bd132fb247d0a869bf (patch)
tree69fc8d4b276b6ac9ad8198478e8feea6cf9d9693 /recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch
parent1ae7c5f36d8a6a94053ba4d7919fb7daf9ff2ae1 (diff)
parent78c7106f99efcbabc9ccc00343c87a900644cda3 (diff)
Merge branch 'org.openembedded.dev' of new.openembedded.org:openembedded into org.openembedded.dev
Diffstat (limited to 'recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch')
-rw-r--r--recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch213
1 files changed, 213 insertions, 0 deletions
diff --git a/recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch b/recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch
new file mode 100644
index 0000000000..97bdf7b33e
--- /dev/null
+++ b/recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch
@@ -0,0 +1,213 @@
+From 2ccfb6a663fefa068b57f974379b543c19921791 Mon Sep 17 00:00:00 2001
+From: Matthieu Crapet <mcrapet@gmail.com>
+Date: Sun, 4 Jan 2009 14:33:36 +0100
+Subject: [PATCH] TS72xx TS-SER1 support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Štetiar <ynezz@true.cz>
+---
+ drivers/serial/8250_ts_ser1.c | 148 +++++++++++++++++++++++++++++++++++++++++
+ drivers/serial/Kconfig | 17 +++++
+ drivers/serial/Makefile | 1 +
+ 3 files changed, 166 insertions(+), 0 deletions(-)
+ create mode 100644 drivers/serial/8250_ts_ser1.c
+
+diff --git a/drivers/serial/8250_ts_ser1.c b/drivers/serial/8250_ts_ser1.c
+new file mode 100644
+index 0000000..054a8e2
+--- /dev/null
++++ b/drivers/serial/8250_ts_ser1.c
+@@ -0,0 +1,148 @@
++/*
++ * linux/drivers/serial/8250_ts_ser1.c
++ * Technologic Systems TS-SER1 support.
++ *
++ * (c) Copyright 2006-2008 Matthieu Crapet <mcrapet@gmail.com>
++ * Data taken from include/asm-i386/serial.h
++ *
++ * 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.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * Pin Number:
++ * 1 DCD
++ * 2 Receive data
++ * 3 Trasmit data
++ * 4 DTR
++ * 5 Signal Ground
++ * 6 DSR
++ * 7 RTS
++ * 8 CTS
++ * 9 RI
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/serial_8250.h>
++#include <linux/irq.h>
++#include <mach/hardware.h>
++#include <mach/gpio.h>
++
++
++#define TS72XX_SER1_IO_PHYS_BASE (TS72XX_PC104_8BIT_IO_PHYS_BASE)
++#define TS72XX_SER1_IO_SIZE (TS72XX_PC104_8BIT_IO_SIZE)
++
++#define TS_SER1_PORT_COM3 0x3E8
++#define TS_SER1_PORT_COM4 0x2E8
++#define TS_SER1_PORT_COM5 0x3A8
++
++/* Value to write in 16550A scratch register */
++#define MARKER_BYTE 0xAA /* or 0x55 */
++
++#define PORT(_base,_irq) \
++ { \
++ .iobase = _base, \
++ .membase = (void __iomem *)0, \
++ .irq = _irq, \
++ .uartclk = 1843200, \
++ .iotype = UPIO_PORT, \
++ .flags = UPF_BOOT_AUTOCONF, \
++ }
++// Note: IRQ can be shared (see CONFIG_SERIAL_8250_SHARE_IRQ)
++
++
++static struct plat_serial8250_port ts72xx_ser1_data_com3[] = {
++ PORT(TS_SER1_PORT_COM3, 0),
++ { },
++};
++
++static struct plat_serial8250_port ts72xx_ser1_data_com4[] = {
++ PORT(TS_SER1_PORT_COM4, 0),
++ { },
++};
++
++static struct plat_serial8250_port ts72xx_ser1_data_com5[] = {
++ PORT(TS_SER1_PORT_COM5, 0),
++ { },
++};
++
++static struct platform_device ts72xx_ser1_device = {
++ .name = "serial8250",
++ .id = 0,
++ .dev = {
++ .platform_data = ts72xx_ser1_data_com3,
++ },
++};
++
++static void __iomem *iomem;
++
++
++static int __init ts_ser1_init(void)
++{
++ static struct plat_serial8250_port *comX = NULL;
++ int n = 0; // COM number as printed on TS-SER1 pcb
++
++ iomem = ioremap(TS72XX_SER1_IO_PHYS_BASE, TS72XX_SER1_IO_SIZE);
++
++ if (iomem != NULL) {
++ __raw_writeb(MARKER_BYTE, iomem + TS_SER1_PORT_COM3 + 7);
++ if (__raw_readb(iomem + TS_SER1_PORT_COM3 + 7) == MARKER_BYTE) {
++ comX = ts72xx_ser1_data_com3;
++ n = 3;
++ } else {
++ __raw_writeb(MARKER_BYTE, iomem + TS_SER1_PORT_COM4 + 7);
++ if (__raw_readb(iomem + TS_SER1_PORT_COM4 + 7) == MARKER_BYTE) {
++ comX = ts72xx_ser1_data_com4;
++ n = 4;
++ } else {
++ __raw_writeb(MARKER_BYTE, iomem + TS_SER1_PORT_COM5 + 7);
++ if (__raw_readb(iomem + TS_SER1_PORT_COM5 + 7) == MARKER_BYTE) {
++ comX = ts72xx_ser1_data_com5;
++ n = 5;
++ }
++ }
++ }
++
++ if (comX) {
++ #if CONFIG_SERIAL_8250_TS_SER1_IRQ == 5
++ gpio_direction_input(EP93XX_GPIO_LINE_F(3));
++ comX->irq = gpio_to_irq(EP93XX_GPIO_LINE_F(3)); // 83
++ set_irq_type(comX->irq, IRQ_TYPE_EDGE_RISING);
++ #elif CONFIG_SERIAL_8250_TS_SER1_IRQ == 6
++ comX->irq = IRQ_EP93XX_EXT1;
++ #elif CONFIG_SERIAL_8250_TS_SER1_IRQ == 7
++ comX->irq = IRQ_EP93XX_EXT3;
++ #else
++ comX->irq = IRQ_EP93XX_EXT3;
++ #endif
++
++ comX->iobase += (unsigned long)iomem; // virtual address
++ }
++
++ ts72xx_ser1_device.id = n;
++ ts72xx_ser1_device.dev.platform_data = comX;
++ }
++
++ return ((comX == NULL) ? -ENODEV :
++ platform_device_register(&ts72xx_ser1_device));
++}
++
++static void __exit ts_ser1_exit(void)
++{
++ iounmap(iomem);
++ platform_device_unregister(&ts72xx_ser1_device);
++}
++
++module_init(ts_ser1_init);
++module_exit(ts_ser1_exit);
++
++MODULE_AUTHOR("Matthieu Crapet <mcrapet@gmail.com>");
++MODULE_DESCRIPTION("8250 serial probe module for TS-SER1 (TS-72xx)");
++MODULE_LICENSE("GPL");
++MODULE_VERSION("0.3");
+diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
+index 77cb342..945daff 100644
+--- a/drivers/serial/Kconfig
++++ b/drivers/serial/Kconfig
+@@ -276,6 +276,23 @@ config SERIAL_8250_RM9K
+ port hardware found on MIPS RM9122 and similar processors.
+ If unsure, say N.
+
++config SERIAL_8250_TS_SER1
++ tristate "Support TS-SER1 (for TS-72XX SBC)"
++ depends on SERIAL_8250 != n && MACH_TS72XX
++ help
++ Say Y here if you have a TS-SER1 PC/104 peripheral.
++ COM number will be configured automaticaly.
++
++ To compile this driver as a module, choose M here: the module
++ will be called 8250_ts_ser1.
++
++config SERIAL_8250_TS_SER1_IRQ
++ int "Selected IRQ (5, 6 or 7)"
++ depends on SERIAL_8250_TS_SER1
++ default "5"
++ help
++ Enter jumper IRQ configuration
++
+ comment "Non-8250 serial port support"
+
+ config SERIAL_AMBA_PL010
+diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
+index 7e7383e..b4bd691 100644
+--- a/drivers/serial/Makefile
++++ b/drivers/serial/Makefile
+@@ -18,6 +18,7 @@ obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o
+ obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) += 8250_exar_st16c554.o
+ obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o
+ obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o
++obj-$(CONFIG_SERIAL_8250_TS_SER1) += 8250_ts_ser1.o
+ obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o
+ obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o
+ obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
+--
+1.6.0.4
+