summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-12-06 22:39:43 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-12-06 22:39:43 +0000
commitaa9eec732f8e1cd30d7797036ff06896cbe0a942 (patch)
tree11c9a2ed896486bbf5b0cf1a41179accec1bee35 /target
parentdd2f7669138d4f8dd9753cade49659e6e1158240 (diff)
[adm8668] get rid of the specific UART driver and use AMBA PL010
Signed-off-by: Florian Fainelli <florian@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34548 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm8668/config-3.310
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/Kconfig2
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/Makefile4
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/clock.c56
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/platform.c43
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/serial.c638
-rw-r--r--target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/asm/sizes.h56
-rw-r--r--target/linux/adm8668/patches-3.3/001-adm8668_arch.patch12
-rw-r--r--target/linux/adm8668/patches-3.3/002-adm8668_uart.patch40
-rw-r--r--target/linux/adm8668/patches-3.3/200-amba_pl010_hacks.patch378
-rw-r--r--target/linux/adm8668/patches-3.3/201-amba_bus_hacks.patch13
-rw-r--r--target/linux/generic/patches-3.3/065-8139cp-fixes.patch20
-rw-r--r--target/linux/generic/patches-3.3/080-prot-release-cb.patch6
13 files changed, 566 insertions, 712 deletions
diff --git a/target/linux/adm8668/config-3.3 b/target/linux/adm8668/config-3.3
index efdab2e0a..217daec86 100644
--- a/target/linux/adm8668/config-3.3
+++ b/target/linux/adm8668/config-3.3
@@ -3,6 +3,8 @@ CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
CONFIG_ARCH_DISCARD_MEMBLOCK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_AMBA=y
+# CONFIG_ARM_SP805_WATCHDOG is not set
CONFIG_CEVT_R4K=y
CONFIG_CEVT_R4K_LIB=y
CONFIG_CMDLINE="console=ttyS0 earlyprintk"
@@ -69,8 +71,12 @@ CONFIG_PCI_DOMAINS=y
CONFIG_PERF_USE_VMALLOC=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_SCSI_DMA is not set
-CONFIG_SERIAL_ADM8668=y
-CONFIG_SERIAL_ADM8668_CONSOLE=y
+# CONFIG_SERIAL_8250 is not set
+CONFIG_SERIAL_AMBA_PL010=y
+CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
+CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
+CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
+# CONFIG_SERIAL_AMBA_PL011 is not set
CONFIG_SWAP_IO_SPACE=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_EARLY_PRINTK=y
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/Kconfig b/target/linux/adm8668/files/arch/mips/adm8668/Kconfig
new file mode 100644
index 000000000..2e7281ff0
--- /dev/null
+++ b/target/linux/adm8668/files/arch/mips/adm8668/Kconfig
@@ -0,0 +1,2 @@
+config ARM_AMBA
+ def_bool y
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/Makefile b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
index dbd3f12d1..ed4566619 100644
--- a/target/linux/adm8668/files/arch/mips/adm8668/Makefile
+++ b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
@@ -2,6 +2,6 @@
# something witty --neutronscott
#
-obj-y := irq.o pci.o prom.o platform.o serial.o proc.o \
- setup.o time.o early_printk.o \
+obj-y := irq.o pci.o prom.o platform.o proc.o \
+ setup.o time.o early_printk.o clock.o \
net_core.o net_intr.o
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/clock.c b/target/linux/adm8668/files/arch/mips/adm8668/clock.c
new file mode 100644
index 000000000..96d139e17
--- /dev/null
+++ b/target/linux/adm8668/files/arch/mips/adm8668/clock.c
@@ -0,0 +1,56 @@
+/*
+ * ADM8668 minimal clock support
+ *
+ * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
+ *
+ * Licensed under the terms of the GPLv2
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+
+#include <adm8668.h>
+
+struct clk {
+ unsigned long rate;
+};
+
+static struct clk uart_clk = {
+ .rate = ADM8668_UARTCLK_FREQ,
+};
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+ const char *name = dev_name(dev);
+
+ if (!strcmp(name, "apb:uart0"))
+ return &uart_clk;
+
+ return ERR_PTR(-ENOENT);
+}
+EXPORT_SYMBOL(clk_get);
+
+int clk_enable(struct clk *clk)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+ return clk->rate;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+void clk_put(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_put);
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/platform.c b/target/linux/adm8668/files/arch/mips/adm8668/platform.c
index 4c158dd74..5030565a2 100644
--- a/target/linux/adm8668/files/arch/mips/adm8668/platform.c
+++ b/target/linux/adm8668/files/arch/mips/adm8668/platform.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
+ * Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -13,6 +14,9 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/ioport.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/serial.h>
+
#include <asm/reboot.h>
#include <asm/time.h>
#include <asm/addrspace.h>
@@ -20,23 +24,31 @@
#include <asm/io.h>
#include <adm8668.h>
-static struct resource uart_resources[] = {
- {
+static void adm8668_uart_set_mctrl(struct amba_device *dev,
+ void __iomem *base,
+ unsigned int mcrtl)
+{
+}
+
+static struct amba_pl010_data adm8668_uart0_data = {
+ .set_mctrl = adm8668_uart_set_mctrl,
+};
+
+static struct amba_device adm8668_uart0_device = {
+ .dev = {
+ .init_name = "apb:uart0",
+ .platform_data = &adm8668_uart0_data,
+ },
+ .res = {
.start = ADM8668_UART0_BASE,
.end = ADM8668_UART0_BASE + 0xF,
.flags = IORESOURCE_MEM,
},
- {
- .start = INT_LVL_UART0,
- .flags = IORESOURCE_IRQ,
+ .irq = {
+ INT_LVL_UART0,
+ -1
},
-};
-
-static struct platform_device adm8668_uart_device = {
- .name = "adm8668_uart",
- .id = 0,
- .resource = uart_resources,
- .num_resources = ARRAY_SIZE(uart_resources),
+ .periphid = 0x0041010,
};
static struct resource eth0_resources[] = {
@@ -78,13 +90,18 @@ static struct platform_device adm8668_eth1_device = {
};
static struct platform_device *adm8668_devs[] = {
- &adm8668_uart_device,
&adm8668_eth0_device,
&adm8668_eth1_device,
};
int __devinit adm8668_devs_register(void)
{
+ int ret;
+
+ ret = amba_device_register(&adm8668_uart0_device, &iomem_resource);
+ if (ret)
+ panic("failed to register AMBA UART");
+
return platform_add_devices(adm8668_devs, ARRAY_SIZE(adm8668_devs));
}
arch_initcall(adm8668_devs_register);
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/serial.c b/target/linux/adm8668/files/arch/mips/adm8668/serial.c
deleted file mode 100644
index 7d684b810..000000000
--- a/target/linux/adm8668/files/arch/mips/adm8668/serial.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * ADM8668 serial driver, totally ripped the source from BCM63xx and changed
- * all the registers to fit our hardware, and removed all the features that
- * I didn't know because our GPL'd serial driver was way lame.
- *
- * Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
- * Derived directly from bcm63xx_uart
- * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- *
- */
-
-#if defined(CONFIG_SERIAL_ADM8668_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/console.h>
-#include <linux/clk.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/sysrq.h>
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-#include <adm8668.h>
-
-#define ADM8668_NR_UARTS 1
-
-static struct uart_port ports[ADM8668_NR_UARTS];
-
-/*
- * handy uart register accessor
- */
-static inline unsigned int adm_uart_readl(struct uart_port *port,
- unsigned int offset)
-{
- return (*(volatile unsigned int *)(port->membase + offset));
-}
-
-static inline void adm_uart_writel(struct uart_port *port,
- unsigned int value, unsigned int offset)
-{
- (*((volatile unsigned int *)(port->membase + offset))) = value;
-}
-
-/*
- * serial core request to check if uart tx fifo is empty
- */
-static unsigned int adm_uart_tx_empty(struct uart_port *port)
-{
- /* we always wait for completion, no buffer is made... */
- return 1;
-}
-
-/*
- * serial core request to set RTS and DTR pin state and loopback mode
- */
-static void adm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
-{
-}
-
-/*
- * serial core request to return RI, CTS, DCD and DSR pin state
- */
-static unsigned int adm_uart_get_mctrl(struct uart_port *port)
-{
- return 0;
-}
-
-/*
- * serial core request to disable tx ASAP (used for flow control)
- */
-static void adm_uart_stop_tx(struct uart_port *port)
-{
- unsigned int val;
-
- val = adm_uart_readl(port, UART_CR_REG);
- val &= ~(UART_TX_INT_EN);
- adm_uart_writel(port, val, UART_CR_REG);
-}
-
-/*
- * serial core request to (re)enable tx
- */
-static void adm_uart_start_tx(struct uart_port *port)
-{
- unsigned int val;
-
- val = adm_uart_readl(port, UART_CR_REG);
- val |= UART_TX_INT_EN;
- adm_uart_writel(port, val, UART_CR_REG);
-}
-
-/*
- * serial core request to stop rx, called before port shutdown
- */
-static void adm_uart_stop_rx(struct uart_port *port)
-{
- unsigned int val;
-
- val = adm_uart_readl(port, UART_CR_REG);
- val &= ~UART_RX_INT_EN;
- adm_uart_writel(port, val, UART_CR_REG);
-}
-
-/*
- * serial core request to enable modem status interrupt reporting
- */
-static void adm_uart_enable_ms(struct uart_port *port)
-{
-}
-
-/*
- * serial core request to start/stop emitting break char
- */
-static void adm_uart_break_ctl(struct uart_port *port, int ctl)
-{
-}
-
-/*
- * return port type in string format
- */
-static const char *adm_uart_type(struct uart_port *port)
-{
- return (port->type == PORT_ADM8668) ? "adm8668_uart" : NULL;
-}
-
-/*
- * read all chars in rx fifo and send them to core
- */
-static void adm_uart_do_rx(struct uart_port *port)
-{
- struct tty_struct *tty;
- unsigned int max_count;
-
- /* limit number of char read in interrupt, should not be
- * higher than fifo size anyway since we're much faster than
- * serial port */
- max_count = 32;
- tty = port->state->port.tty;
- do {
- unsigned int iestat, c, cstat;
- char flag;
-
- /* get overrun/fifo empty information from ier
- * register */
- iestat = adm_uart_readl(port, UART_FR_REG);
- if (iestat & UART_RX_FIFO_EMPTY)
- break;
-
- /* recieve status */
- cstat = adm_uart_readl(port, UART_RSR_REG);
- /* clear errors */
- adm_uart_writel(port, cstat, UART_RSR_REG);
-
- c = adm_uart_readl(port, UART_DR_REG);
- port->icount.rx++;
- flag = TTY_NORMAL;
-
- if (unlikely((cstat & UART_RX_STATUS_MASK))) {
- /* do stats first */
- if (cstat & UART_BREAK_ERR) {
- port->icount.brk++;
- if (uart_handle_break(port))
- continue;
- }
-
- if (cstat & UART_PARITY_ERR)
- port->icount.parity++;
- if (cstat & UART_FRAMING_ERR)
- port->icount.frame++;
- if (cstat & UART_OVERRUN_ERR) {
- port->icount.overrun++;
- tty_insert_flip_char(tty, 0, TTY_OVERRUN);
- }
-
- /* update flag wrt read_status_mask */
- cstat &= port->read_status_mask;
- if (cstat & UART_BREAK_ERR)
- flag = TTY_BREAK;
- if (cstat & UART_FRAMING_ERR)
- flag = TTY_FRAME;
- if (cstat & UART_PARITY_ERR)
- flag = TTY_PARITY;
- }
-
- if (uart_handle_sysrq_char(port, c))
- continue;
-
- /* fixthis */
- if ((cstat & port->ignore_status_mask) == 0)
- tty_insert_flip_char(tty, c, flag);
- } while (max_count--);
-
- tty_flip_buffer_push(tty);
-}
-
-/*
- * fill tx fifo with chars to send, stop when fifo is about to be full
- * or when all chars have been sent.
- */
-static void adm_uart_do_tx(struct uart_port *port)
-{
- struct circ_buf *xmit;
-
- if (port->x_char) {
- adm_uart_writel(port, port->x_char, UART_DR_REG);
- port->icount.tx++;
- port->x_char = 0;
- return;
- }
-
- if (uart_tx_stopped(port))
- adm_uart_stop_tx(port);
-
- xmit = &port->state->xmit;
-
- if (uart_circ_empty(xmit))
- goto txq_empty;
- do
- {
- while ((adm_uart_readl(port, UART_FR_REG) & UART_TX_FIFO_FULL) != 0)
- ;
- adm_uart_writel(port, xmit->buf[xmit->tail], UART_DR_REG);
- xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
- port->icount.tx++;
- if (uart_circ_empty(xmit))
- break;
- } while (1);
-
- if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
- uart_write_wakeup(port);
-
- if (uart_circ_empty(xmit))
- goto txq_empty;
-
- return;
-
-txq_empty:
- adm_uart_stop_tx(port);
-}
-
-/*
- * process uart interrupt
- */
-static irqreturn_t adm_uart_interrupt(int irq, void *dev_id)
-{
- struct uart_port *port;
- unsigned int irqstat;
-
- port = dev_id;
- spin_lock(&port->lock);
-
- irqstat = adm_uart_readl(port, UART_IIR_REG);
-
- if (irqstat & (UART_RX_INT|UART_RX_TIMEOUT_INT)) {
- adm_uart_do_rx(port);
- }
-
- if (irqstat & UART_TX_INT) {
- adm_uart_do_tx(port);
- }
- spin_unlock(&port->lock);
- return IRQ_HANDLED;
-}
-
-/*
- * enable rx & tx operation on uart
- */
-static void adm_uart_enable(struct uart_port *port)
-{
- unsigned int val;
-
- val = adm_uart_readl(port, UART_CR_REG);
- // BREAK_INT too
- val |= (UART_RX_INT_EN | UART_RX_TIMEOUT_INT_EN);
- adm_uart_writel(port, val, UART_CR_REG);
-}
-
-/*
- * disable rx & tx operation on uart
- */
-static void adm_uart_disable(struct uart_port *port)
-{
- unsigned int val;
-
- val = adm_uart_readl(port, UART_CR_REG);
- val &= ~(UART_TX_INT_EN | UART_RX_INT_EN | UART_RX_TIMEOUT_INT_EN);
- adm_uart_writel(port, val, UART_CR_REG);
-}
-
-/*
- * clear all unread data in rx fifo and unsent data in tx fifo
- */
-static void adm_uart_flush(struct uart_port *port)
-{
- /* read any pending char to make sure all irq status are
- * cleared */
- (void)adm_uart_readl(port, UART_DR_REG);
-}
-
-/*
- * serial core request to initialize uart and start rx operation
- */
-static int adm_uart_startup(struct uart_port *port)
-{
- int ret;
-
- /* clear any pending external input interrupt */
- (void)adm_uart_readl(port, UART_IIR_REG);
-
- /* register irq and enable rx interrupts */
- ret = request_irq(port->irq, adm_uart_interrupt, 0,
- adm_uart_type(port), port);
- if (ret)
- return ret;
-
- adm_uart_enable(port);
-
- return 0;
-}
-
-/*
- * serial core request to flush & disable uart
- */
-static void adm_uart_shutdown(struct uart_port *port)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&port->lock, flags);
-// adm_uart_writel(port, 0, UART_CR_REG);
- spin_unlock_irqrestore(&port->lock, flags);
-
- adm_uart_disable(port);
- adm_uart_flush(port);
- free_irq(port->irq, port);
-}
-
-/*
- * serial core request to change current uart setting
- */
-static void adm_uart_set_termios(struct uart_port *port,
- struct ktermios *new,
- struct ktermios *old)
-{
- port->ignore_status_mask = 0;
- uart_update_timeout(port, new->c_cflag, 115200);
-}
-
-/*
- * serial core request to claim uart iomem
- */
-static int adm_uart_request_port(struct uart_port *port)
-{
- unsigned int size = 0xf;
- if (!request_mem_region(port->mapbase, size, "adm8668")) {
- dev_err(port->dev, "Memory region busy\n");
- return -EBUSY;
- }
-
- port->membase = ioremap(port->mapbase, size);
- if (!port->membase) {
- dev_err(port->dev, "Unable to map registers\n");
- release_mem_region(port->mapbase, size);
- return -EBUSY;
- }
- return 0;
-}
-
-/*
- * serial core request to release uart iomem
- */
-static void adm_uart_release_port(struct uart_port *port)
-{
- release_mem_region(port->mapbase, 0xf);
- iounmap(port->membase);
-}
-
-/*
- * serial core request to do any port required autoconfiguration
- */
-static void adm_uart_config_port(struct uart_port *port, int flags)
-{
- if (flags & UART_CONFIG_TYPE) {
- if (adm_uart_request_port(port))
- return;
- port->type = PORT_ADM8668;
- }
-}
-
-/*
- * serial core request to check that port information in serinfo are
- * suitable
- */
-static int adm_uart_verify_port(struct uart_port *port,
- struct serial_struct *serinfo)
-{
- if (port->type != PORT_ADM8668)
- return -EINVAL;
- if (port->irq != serinfo->irq)
- return -EINVAL;
- if (port->iotype != serinfo->io_type)
- return -EINVAL;
- if (port->mapbase != (unsigned long)serinfo->iomem_base)
- return -EINVAL;
- return 0;
-}
-
-/* serial core callbacks */
-static struct uart_ops adm_uart_ops = {
- .tx_empty = adm_uart_tx_empty,
- .get_mctrl = adm_uart_get_mctrl,
- .set_mctrl = adm_uart_set_mctrl,
- .start_tx = adm_uart_start_tx,
- .stop_tx = adm_uart_stop_tx,
- .stop_rx = adm_uart_stop_rx,
- .enable_ms = adm_uart_enable_ms,
- .break_ctl = adm_uart_break_ctl,
- .startup = adm_uart_startup,
- .shutdown = adm_uart_shutdown,
- .set_termios = adm_uart_set_termios,
- .type = adm_uart_type,
- .release_port = adm_uart_release_port,
- .request_port = adm_uart_request_port,
- .config_port = adm_uart_config_port,
- .verify_port = adm_uart_verify_port,
-};
-
-#ifdef CONFIG_SERIAL_ADM8668_CONSOLE
-static inline void wait_for_xmitr(struct uart_port *port)
-{
- while ((adm_uart_readl(port, UART_FR_REG) & UART_TX_FIFO_FULL) != 0)
- ;
-}
-
-/*
- * output given char
- */
-static void adm_console_putchar(struct uart_port *port, int ch)
-{
- wait_for_xmitr(port);
- adm_uart_writel(port, ch, UART_DR_REG);
-}
-
-/*
- * console core request to output given string
- */
-static void adm_console_write(struct console *co, const char *s,
- unsigned int count)
-{
- struct uart_port *port;
- unsigned long flags;
- int locked;
-
- port = &ports[co->index];
-
- local_irq_save(flags);
- if (port->sysrq) {
- /* adm_uart_interrupt() already took the lock */
- locked = 0;
- } else if (oops_in_progress) {
- locked = spin_trylock(&port->lock);
- } else {
- spin_lock(&port->lock);
- locked = 1;
- }
-
- /* call helper to deal with \r\n */
- uart_console_write(port, s, count, adm_console_putchar);
-
- /* and wait for char to be transmitted */
- wait_for_xmitr(port);
-
- if (locked)
- spin_unlock(&port->lock);
- local_irq_restore(flags);
-}
-
-/*
- * console core request to setup given console, find matching uart
- * port and setup it.
- */
-static int adm_console_setup(struct console *co, char *options)
-{
- struct uart_port *port;
- int baud = 115200;
- int bits = 8;
- int parity = 'n';
- int flow = 'n';
-
- if (co->index < 0 || co->index >= ADM8668_NR_UARTS)
- return -EINVAL;
- port = &ports[co->index];
- if (!port->membase)
- return -ENODEV;
-
- if (options)
- uart_parse_options(options, &baud, &parity, &bits, &flow);
-
- return uart_set_options(port, co, baud, parity, bits, flow);
-}
-
-static struct uart_driver adm_uart_driver;
-
-static struct console adm8668_console = {
- .name = "ttyS",
- .write = adm_console_write,
- .device = uart_console_device,
- .setup = adm_console_setup,
- .flags = CON_PRINTBUFFER,
- .index = -1,
- .data = &adm_uart_driver,
-};
-
-static int __init adm8668_console_init(void)
-{
- register_console(&adm8668_console);
- return 0;
-}
-
-console_initcall(adm8668_console_init);
-
-#define ADM8668_CONSOLE (&adm8668_console)
-#else
-#define ADM8668_CONSOLE NULL
-#endif /* CONFIG_SERIAL_ADM8668_CONSOLE */
-
-static struct uart_driver adm_uart_driver = {
- .owner = THIS_MODULE,
- .driver_name = "adm8668_uart",
- .dev_name = "ttyS",
- .major = TTY_MAJOR,
- .minor = 64,
- .nr = 1,
- .cons = ADM8668_CONSOLE,
-};
-
-/*
- * platform driver probe/remove callback
- */
-static int __devinit adm_uart_probe(struct platform_device *pdev)
-{
- struct resource *res_mem, *res_irq;
- struct uart_port *port;
- int ret;
-
- if (pdev->id < 0 || pdev->id >= ADM8668_NR_UARTS)
- return -EINVAL;
-
- if (ports[pdev->id].membase)
- return -EBUSY;
-
- res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res_mem)
- return -ENODEV;
-
- res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res_irq)
- return -ENODEV;
-
- port = &ports[pdev->id];
- memset(port, 0, sizeof(*port));
- port->iotype = UPIO_MEM;
- port->mapbase = res_mem->start;
- port->irq = res_irq->start;
- port->ops = &adm_uart_ops;
- port->flags = UPF_BOOT_AUTOCONF;
- port->dev = &pdev->dev;
- port->fifosize = 8;
- port->uartclk = ADM8668_UARTCLK_FREQ;
-
- ret = uart_add_one_port(&adm_uart_driver, port);
- if (ret) {
- ports[pdev->id].membase = 0;
- return ret;
- }
- platform_set_drvdata(pdev, port);
- return 0;
-}
-
-static int __devexit adm_uart_remove(struct platform_device *pdev)
-{
- struct uart_port *port;
-
- port = platform_get_drvdata(pdev);
- uart_remove_one_port(&adm_uart_driver, port);
- platform_set_drvdata(pdev, NULL);
- /* mark port as free */
- ports[pdev->id].membase = 0;
- return 0;
-}
-
-/*
- * platform driver stuff
- */
-static struct platform_driver adm_uart_platform_driver = {
- .probe = adm_uart_probe,
- .remove = __devexit_p(adm_uart_remove),
- .driver = {
- .owner = THIS_MODULE,
- .name = "adm8668_uart",
- },
-};
-
-static int __init adm_uart_init(void)
-{
- int ret;
-
- ret = uart_register_driver(&adm_uart_driver);
- if (ret)
- return ret;
-
- ret = platform_driver_register(&adm_uart_platform_driver);
- if (ret)
- uart_unregister_driver(&adm_uart_driver);
-
- return ret;
-}
-
-static void __exit adm_uart_exit(void)
-{
- platform_driver_unregister(&adm_uart_platform_driver);
- uart_unregister_driver(&adm_uart_driver);
-}
-
-module_init(adm_uart_init);
-module_exit(adm_uart_exit);
-
-MODULE_AUTHOR("Scott Nicholas <neutronscott@scottn.us>");
-MODULE_DESCRIPTION("ADM8668 integrated uart driver");
-MODULE_LICENSE("GPL");
diff --git a/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/asm/sizes.h b/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/asm/sizes.h
new file mode 100644
index 000000000..503843db1
--- /dev/null
+++ b/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/asm/sizes.h
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/* DO NOT EDIT!! - this file automatically generated
+ * from .s file by awk -f s2h.awk
+ */
+/* Size definitions
+ * Copyright (C) ARM Limited 1998. All rights reserved.
+ */
+
+#ifndef __sizes_h
+#define __sizes_h 1
+
+/* handy sizes */
+#define SZ_16 0x00000010
+#define SZ_256 0x00000100
+#define SZ_512 0x00000200
+
+#define SZ_1K 0x00000400
+#define SZ_4K 0x00001000
+#define SZ_8K 0x00002000
+#define SZ_16K 0x00004000
+#define SZ_64K 0x00010000
+#define SZ_128K 0x00020000
+#define SZ_256K 0x00040000
+#define SZ_512K 0x00080000
+
+#define SZ_1M 0x00100000
+#define SZ_2M 0x00200000
+#define SZ_4M 0x00400000
+#define SZ_8M 0x00800000
+#define SZ_16M 0x01000000
+#define SZ_32M 0x02000000
+#define SZ_64M 0x04000000
+#define SZ_128M 0x08000000
+#define SZ_256M 0x10000000
+#define SZ_512M 0x20000000
+
+#define SZ_1G 0x40000000
+#define SZ_2G 0x80000000
+
+#endif
+
+/* END */
diff --git a/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch b/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
index 53a627ecc..541b0bff5 100644
--- a/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
+++ b/target/linux/adm8668/patches-3.3/001-adm8668_arch.patch
@@ -10,7 +10,7 @@
include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
-@@ -105,6 +105,27 @@ config BCM47XX
+@@ -105,6 +105,25 @@ config BCM47XX
help
Support for BCM47XX based boards
@@ -28,8 +28,6 @@
+ select SYS_SUPPORTS_32BIT_KERNEL
+ select DMA_NONCOHERENT
+ select SWAP_IO_SPACE
-+ select SERIAL_ADM8668
-+ select SERIAL_ADM8668_CONSOLE
+ select SYS_HAS_EARLY_PRINTK
+ help
+ ADM8668 board support by neutronscott
@@ -38,3 +36,11 @@
config BCM63XX
bool "Broadcom BCM63XX based boards"
select CEVT_R4K
+@@ -813,6 +833,7 @@ config NLM_XLP_BOARD
+
+ endchoice
+
++source "arch/mips/adm8668/Kconfig"
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+ source "arch/mips/bcm47xx/Kconfig"
diff --git a/target/linux/adm8668/patches-3.3/002-adm8668_uart.patch b/target/linux/adm8668/patches-3.3/002-adm8668_uart.patch
deleted file mode 100644
index ed55cbbaa..000000000
--- a/target/linux/adm8668/patches-3.3/002-adm8668_uart.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/drivers/tty/serial/Kconfig
-+++ b/drivers/tty/serial/Kconfig
-@@ -1192,6 +1192,25 @@ config SERIAL_BCM63XX_CONSOLE
- If you have enabled the serial port on the bcm63xx CPU
- you can make it the console by answering Y to this option.
-
-+config SERIAL_ADM8668
-+ tristate "ADM8668 serial port support"
-+ select SERIAL_CORE
-+ depends on ADM8668
-+ help
-+ If you have an adm8668 CPU, you can enable its onboard
-+ serial port by enabling this options.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called adm8668_uart.
-+
-+config SERIAL_ADM8668_CONSOLE
-+ bool "Console on adm8668 serial port"
-+ depends on SERIAL_ADM8668=y
-+ select SERIAL_CORE_CONSOLE
-+ help
-+ If you have enabled the serial port on the adm8668 CPU
-+ you can make it the console by answering Y to this option.
-+
- config SERIAL_GRLIB_GAISLER_APBUART
- tristate "GRLIB APBUART serial support"
- depends on OF && SPARC
---- a/include/linux/serial_core.h
-+++ b/include/linux/serial_core.h
-@@ -211,6 +211,9 @@
- #define PORT_AR933X 99
-
-
-+/* ADM8668 UART */
-+#define PORT_ADM8668 100
-+
- #ifdef __KERNEL__
-
- #include <linux/compiler.h>
diff --git a/target/linux/adm8668/patches-3.3/200-amba_pl010_hacks.patch b/target/linux/adm8668/patches-3.3/200-amba_pl010_hacks.patch
new file mode 100644
index 000000000..3c4ea35a1
--- /dev/null
+++ b/target/linux/adm8668/patches-3.3/200-amba_pl010_hacks.patch
@@ -0,0 +1,378 @@
+--- a/drivers/tty/serial/amba-pl010.c
++++ b/drivers/tty/serial/amba-pl010.c
+@@ -49,11 +49,10 @@
+
+ #include <asm/io.h>
+
+-#define UART_NR 8
+-
+ #define SERIAL_AMBA_MAJOR 204
+ #define SERIAL_AMBA_MINOR 16
+-#define SERIAL_AMBA_NR UART_NR
++#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
++#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
+
+ #define AMBA_ISR_PASS_LIMIT 256
+
+@@ -79,9 +78,9 @@ static void pl010_stop_tx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_start_tx(struct uart_port *port)
+@@ -89,9 +88,9 @@ static void pl010_start_tx(struct uart_p
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_TIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_stop_rx(struct uart_port *port)
+@@ -99,9 +98,9 @@ static void pl010_stop_rx(struct uart_po
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_enable_ms(struct uart_port *port)
+@@ -109,9 +108,9 @@ static void pl010_enable_ms(struct uart_
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+ unsigned int cr;
+
+- cr = readb(uap->port.membase + UART010_CR);
++ cr = __raw_readl(uap->port.membase + UART010_CR);
+ cr |= UART010_CR_MSIE;
+- writel(cr, uap->port.membase + UART010_CR);
++ __raw_writel(cr, uap->port.membase + UART010_CR);
+ }
+
+ static void pl010_rx_chars(struct uart_amba_port *uap)
+@@ -119,9 +118,9 @@ static void pl010_rx_chars(struct uart_a
+ struct tty_struct *tty = uap->port.state->port.tty;
+ unsigned int status, ch, flag, rsr, max_count = 256;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ while (UART_RX_DATA(status) && max_count--) {
+- ch = readb(uap->port.membase + UART01x_DR);
++ ch = __raw_readl(uap->port.membase + UART01x_DR);
+ flag = TTY_NORMAL;
+
+ uap->port.icount.rx++;
+@@ -130,9 +129,9 @@ static void pl010_rx_chars(struct uart_a
+ * Note that the error handling code is
+ * out of the main execution path
+ */
+- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
++ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
+ if (unlikely(rsr & UART01x_RSR_ANY)) {
+- writel(0, uap->port.membase + UART01x_ECR);
++ __raw_writel(0, uap->port.membase + UART01x_ECR);
+
+ if (rsr & UART01x_RSR_BE) {
+ rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
+@@ -162,7 +161,7 @@ static void pl010_rx_chars(struct uart_a
+ uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
+
+ ignore_char:
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ }
+ spin_unlock(&uap->port.lock);
+ tty_flip_buffer_push(tty);
+@@ -175,7 +174,7 @@ static void pl010_tx_chars(struct uart_a
+ int count;
+
+ if (uap->port.x_char) {
+- writel(uap->port.x_char, uap->port.membase + UART01x_DR);
++ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR);
+ uap->port.icount.tx++;
+ uap->port.x_char = 0;
+ return;
+@@ -187,7 +186,7 @@ static void pl010_tx_chars(struct uart_a
+
+ count = uap->port.fifosize >> 1;
+ do {
+- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
++ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ uap->port.icount.tx++;
+ if (uart_circ_empty(xmit))
+@@ -205,9 +204,9 @@ static void pl010_modem_status(struct ua
+ {
+ unsigned int status, delta;
+
+- writel(0, uap->port.membase + UART010_ICR);
++ __raw_writel(0, uap->port.membase + UART010_ICR);
+
+- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ delta = status ^ uap->old_status;
+ uap->old_status = status;
+@@ -235,7 +234,7 @@ static irqreturn_t pl010_int(int irq, vo
+
+ spin_lock(&uap->port.lock);
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ if (status) {
+ do {
+ if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
+@@ -248,7 +247,7 @@ static irqreturn_t pl010_int(int irq, vo
+ if (pass_counter-- == 0)
+ break;
+
+- status = readb(uap->port.membase + UART010_IIR);
++ status = __raw_readl(uap->port.membase + UART010_IIR);
+ } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
+ UART010_IIR_TIS));
+ handled = 1;
+@@ -262,7 +261,7 @@ static irqreturn_t pl010_int(int irq, vo
+ static unsigned int pl010_tx_empty(struct uart_port *port)
+ {
+ struct uart_amba_port *uap = (struct uart_amba_port *)port;
+- unsigned int status = readb(uap->port.membase + UART01x_FR);
++ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR);
+ return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
+ }
+
+@@ -272,7 +271,7 @@ static unsigned int pl010_get_mctrl(stru
+ unsigned int result = 0;
+ unsigned int status;
+
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ if (status & UART01x_FR_DCD)
+ result |= TIOCM_CAR;
+ if (status & UART01x_FR_DSR)
+@@ -298,12 +297,12 @@ static void pl010_break_ctl(struct uart_
+ unsigned int lcr_h;
+
+ spin_lock_irqsave(&uap->port.lock, flags);
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+ if (break_state == -1)
+ lcr_h |= UART01x_LCRH_BRK;
+ else
+ lcr_h &= ~UART01x_LCRH_BRK;
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+
+@@ -335,12 +334,12 @@ static int pl010_startup(struct uart_por
+ /*
+ * initialise the old status of the modem signals
+ */
+- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+
+ /*
+ * Finally, enable interrupts
+ */
+- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
++ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
+ uap->port.membase + UART010_CR);
+
+ return 0;
+@@ -365,10 +364,10 @@ static void pl010_shutdown(struct uart_p
+ /*
+ * disable all interrupts, disable the port
+ */
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* disable break condition and fifos */
+- writel(readb(uap->port.membase + UART010_LCRH) &
++ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) &
+ ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
+ uap->port.membase + UART010_LCRH);
+
+@@ -391,7 +390,7 @@ pl010_set_termios(struct uart_port *port
+ /*
+ * Ask the core to calculate the divisor for us.
+ */
+- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
++ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
+ quot = uart_get_divisor(port, baud);
+
+ switch (termios->c_cflag & CSIZE) {
+@@ -454,25 +453,25 @@ pl010_set_termios(struct uart_port *port
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
+
+ /* first, disable everything */
+- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
++ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
+
+ if (UART_ENABLE_MS(port, termios->c_cflag))
+ old_cr |= UART010_CR_MSIE;
+
+- writel(0, uap->port.membase + UART010_CR);
++ __raw_writel(0, uap->port.membase + UART010_CR);
+
+ /* Set baud rate */
+ quot -= 1;
+- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
+- writel(quot & 0xff, uap->port.membase + UART010_LCRL);
++ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
++ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL);
+
+ /*
+ * ----------v----------v----------v----------v-----
+ * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
+ * ----------^----------^----------^----------^-----
+ */
+- writel(lcr_h, uap->port.membase + UART010_LCRH);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ spin_unlock_irqrestore(&uap->port.lock, flags);
+ }
+@@ -554,7 +553,7 @@ static struct uart_ops amba_pl010_pops =
+ .verify_port = pl010_verify_port,
+ };
+
+-static struct uart_amba_port *amba_ports[UART_NR];
++static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
+
+ #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
+
+@@ -564,10 +563,10 @@ static void pl010_console_putchar(struct
+ unsigned int status;
+
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (!UART_TX_READY(status));
+- writel(ch, uap->port.membase + UART01x_DR);
++ __raw_writel(ch, uap->port.membase + UART01x_DR);
+ }
+
+ static void
+@@ -581,8 +580,8 @@ pl010_console_write(struct console *co,
+ /*
+ * First save the CR then disable the interrupts
+ */
+- old_cr = readb(uap->port.membase + UART010_CR);
+- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
++ old_cr = __raw_readl(uap->port.membase + UART010_CR);
++ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
+
+ uart_console_write(&uap->port, s, count, pl010_console_putchar);
+
+@@ -591,10 +590,10 @@ pl010_console_write(struct console *co,
+ * and restore the TCR
+ */
+ do {
+- status = readb(uap->port.membase + UART01x_FR);
++ status = __raw_readl(uap->port.membase + UART01x_FR);
+ barrier();
+ } while (status & UART01x_FR_BUSY);
+- writel(old_cr, uap->port.membase + UART010_CR);
++ __raw_writel(old_cr, uap->port.membase + UART010_CR);
+
+ clk_disable(uap->clk);
+ }
+@@ -603,9 +602,9 @@ static void __init
+ pl010_console_get_options(struct uart_amba_port *uap, int *baud,
+ int *parity, int *bits)
+ {
+- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
++ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
+ unsigned int lcr_h, quot;
+- lcr_h = readb(uap->port.membase + UART010_LCRH);
++ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
+
+ *parity = 'n';
+ if (lcr_h & UART01x_LCRH_PEN) {
+@@ -620,8 +619,8 @@ pl010_console_get_options(struct uart_am
+ else
+ *bits = 8;
+
+- quot = readb(uap->port.membase + UART010_LCRL) |
+- readb(uap->port.membase + UART010_LCRM) << 8;
++ quot = __raw_readl(uap->port.membase + UART010_LCRL) |
++ __raw_readl(uap->port.membase + UART010_LCRM) << 8;
+ *baud = uap->port.uartclk / (16 * (quot + 1));
+ }
+ }
+@@ -640,7 +639,7 @@ static int __init pl010_console_setup(st
+ * if so, search for the first available port that does have
+ * console support.
+ */
+- if (co->index >= UART_NR)
++ if (co->index >= SERIAL_AMBA_NR)
+ co->index = 0;
+ uap = amba_ports[co->index];
+ if (!uap)
+@@ -662,7 +661,7 @@ static int __init pl010_console_setup(st
+
+ static struct uart_driver amba_reg;
+ static struct console amba_console = {
+- .name = "ttyAM",
++ .name = SERIAL_AMBA_NAME,
+ .write = pl010_console_write,
+ .device = uart_console_device,
+ .setup = pl010_console_setup,
+@@ -678,11 +677,11 @@ static struct console amba_console = {
+
+ static struct uart_driver amba_reg = {
+ .owner = THIS_MODULE,
+- .driver_name = "ttyAM",
+- .dev_name = "ttyAM",
++ .driver_name = SERIAL_AMBA_NAME,
++ .dev_name = SERIAL_AMBA_NAME,
+ .major = SERIAL_AMBA_MAJOR,
+ .minor = SERIAL_AMBA_MINOR,
+- .nr = UART_NR,
++ .nr = SERIAL_AMBA_NR,
+ .cons = AMBA_CONSOLE,
+ };
+
+--- a/drivers/tty/serial/Kconfig
++++ b/drivers/tty/serial/Kconfig
+@@ -16,10 +16,25 @@ config SERIAL_AMBA_PL010
+ help
+ This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
+ an Integrator/AP or Integrator/PP2 platform, or if you have a
+- Cirrus Logic EP93xx CPU, say Y or M here.
++ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
+
+ If unsure, say N.
+
++config SERIAL_AMBA_PL010_NUMPORTS
++ int "Maximum number of AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "8"
++ ---help---
++ Set this to the number of serial ports you want the AMBA PL010 driver
++ to support.
++
++config SERIAL_AMBA_PL010_PORTNAME
++ string "Name of the AMBA PL010 serial ports"
++ depends on SERIAL_AMBA_PL010
++ default "ttyAM"
++ ---help---
++ ::: To be written :::
++
+ config SERIAL_AMBA_PL010_CONSOLE
+ bool "Support for console on AMBA serial port"
+ depends on SERIAL_AMBA_PL010=y
diff --git a/target/linux/adm8668/patches-3.3/201-amba_bus_hacks.patch b/target/linux/adm8668/patches-3.3/201-amba_bus_hacks.patch
new file mode 100644
index 000000000..2364d2a66
--- /dev/null
+++ b/target/linux/adm8668/patches-3.3/201-amba_bus_hacks.patch
@@ -0,0 +1,13 @@
+--- a/drivers/amba/bus.c
++++ b/drivers/amba/bus.c
+@@ -20,6 +20,10 @@
+ #include <asm/irq.h>
+ #include <asm/sizes.h>
+
++#ifndef NO_IRQ
++#define NO_IRQ (-1)
++#endif
++
+ #define to_amba_driver(d) container_of(d, struct amba_driver, drv)
+
+ static const struct amba_id *
diff --git a/target/linux/generic/patches-3.3/065-8139cp-fixes.patch b/target/linux/generic/patches-3.3/065-8139cp-fixes.patch
index 33ca1a128..77c903c06 100644
--- a/target/linux/generic/patches-3.3/065-8139cp-fixes.patch
+++ b/target/linux/generic/patches-3.3/065-8139cp-fixes.patch
@@ -66,11 +66,9 @@ Date: Sun Nov 25 15:52:09 2012 -0500
Signed-off-by: David S. Miller <davem@davemloft.net>
-diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
-index b01f83a..6cb96b4 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
-@@ -648,6 +648,7 @@ static void cp_tx (struct cp_private *cp)
+@@ -645,6 +645,7 @@ static void cp_tx (struct cp_private *cp
{
unsigned tx_head = cp->tx_head;
unsigned tx_tail = cp->tx_tail;
@@ -78,7 +76,7 @@ index b01f83a..6cb96b4 100644
while (tx_tail != tx_head) {
struct cp_desc *txd = cp->tx_ring + tx_tail;
-@@ -666,6 +667,9 @@ static void cp_tx (struct cp_private *cp)
+@@ -663,6 +664,9 @@ static void cp_tx (struct cp_private *cp
le32_to_cpu(txd->opts1) & 0xffff,
PCI_DMA_TODEVICE);
@@ -88,7 +86,7 @@ index b01f83a..6cb96b4 100644
if (status & LastFrag) {
if (status & (TxError | TxFIFOUnder)) {
netif_dbg(cp, tx_err, cp->dev,
-@@ -697,6 +701,7 @@ static void cp_tx (struct cp_private *cp)
+@@ -694,6 +698,7 @@ static void cp_tx (struct cp_private *cp
cp->tx_tail = tx_tail;
@@ -96,7 +94,7 @@ index b01f83a..6cb96b4 100644
if (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1))
netif_wake_queue(cp->dev);
}
-@@ -843,6 +848,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
+@@ -840,6 +845,8 @@ static netdev_tx_t cp_start_xmit (struct
wmb();
}
cp->tx_head = entry;
@@ -105,7 +103,7 @@ index b01f83a..6cb96b4 100644
netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n",
entry, skb->len);
if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
-@@ -937,6 +944,8 @@ static void cp_stop_hw (struct cp_private *cp)
+@@ -934,6 +941,8 @@ static void cp_stop_hw (struct cp_privat
cp->rx_tail = 0;
cp->tx_head = cp->tx_tail = 0;
@@ -114,7 +112,7 @@ index b01f83a..6cb96b4 100644
}
static void cp_reset_hw (struct cp_private *cp)
-@@ -957,8 +966,38 @@ static void cp_reset_hw (struct cp_private *cp)
+@@ -954,8 +963,38 @@ static void cp_reset_hw (struct cp_priva
static inline void cp_start_hw (struct cp_private *cp)
{
@@ -153,7 +151,7 @@ index b01f83a..6cb96b4 100644
}
static void cp_enable_irq(struct cp_private *cp)
-@@ -969,7 +1008,6 @@ static void cp_enable_irq(struct cp_private *cp)
+@@ -966,7 +1005,6 @@ static void cp_enable_irq(struct cp_priv
static void cp_init_hw (struct cp_private *cp)
{
struct net_device *dev = cp->dev;
@@ -161,7 +159,7 @@ index b01f83a..6cb96b4 100644
cp_reset_hw(cp);
-@@ -992,17 +1030,6 @@ static void cp_init_hw (struct cp_private *cp)
+@@ -989,17 +1027,6 @@ static void cp_init_hw (struct cp_privat
cpw8(Config5, cpr8(Config5) & PMEStatus);
@@ -179,7 +177,7 @@ index b01f83a..6cb96b4 100644
cpw16(MultiIntr, 0);
cpw8_f(Cfg9346, Cfg9346_Lock);
-@@ -1192,6 +1219,7 @@ static void cp_tx_timeout(struct net_device *dev)
+@@ -1188,6 +1215,7 @@ static void cp_tx_timeout(struct net_dev
cp_clean_rings(cp);
rc = cp_init_rings(cp);
cp_start_hw(cp);
diff --git a/target/linux/generic/patches-3.3/080-prot-release-cb.patch b/target/linux/generic/patches-3.3/080-prot-release-cb.patch
index 8af8a198f..56cda6b7e 100644
--- a/target/linux/generic/patches-3.3/080-prot-release-cb.patch
+++ b/target/linux/generic/patches-3.3/080-prot-release-cb.patch
@@ -3,8 +3,8 @@ TCP Small Queues) but we need it for pppoatm too.
--- a/include/net/sock.h
+++ b/include/net/sock.h
-@@ -858,6 +858,8 @@ struct proto {
- int (*backlog_rcv) (struct sock *sk,
+@@ -810,6 +810,8 @@ struct proto {
+ int (*backlog_rcv) (struct sock *sk,
struct sk_buff *skb);
+ void (*release_cb)(struct sock *sk);
@@ -14,7 +14,7 @@ TCP Small Queues) but we need it for pppoatm too.
void (*unhash)(struct sock *sk);
--- a/net/core/sock.c
+++ b/net/core/sock.c
-@@ -2159,6 +2159,10 @@ void release_sock(struct sock *sk)
+@@ -2138,6 +2138,10 @@ void release_sock(struct sock *sk)
spin_lock_bh(&sk->sk_lock.slock);
if (sk->sk_backlog.tail)
__release_sock(sk);