[adm5120] uses AMBA PL010 driver for the serial ports from now
authorGabor Juhos <juhosg@openwrt.org>
Wed, 25 Jul 2007 14:47:16 +0000 (14:47 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Wed, 25 Jul 2007 14:47:16 +0000 (14:47 +0000)
SVN-Revision: 8159

target/linux/adm5120-2.6/config/default
target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig
target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile
target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c
target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c [new file with mode: 0644]
target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c
target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_platform.h
target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/asm/sizes.h [new file with mode: 0644]
target/linux/adm5120-2.6/patches-2.6.22/200-amba-pl010-hacks.patch [new file with mode: 0644]
target/linux/adm5120-2.6/patches-2.6.22/201-amba-bus-hacks.patch [new file with mode: 0644]
target/linux/adm5120eb-2.6/config/default

index 276b2d42fd47aff648778c93f4d5c25a91ba2775..c21fc4b1148a7cf7ee5af2cdcd70f4ac56037f81 100644 (file)
@@ -1,10 +1,10 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 # CONFIG_64BIT_PHYS_ADDR is not set
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 # CONFIG_64BIT_PHYS_ADDR is not set
-CONFIG_ADM5120_NR_UARTS=2
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARM_AMBA=y
 # CONFIG_ATM_DRIVERS is not set
 CONFIG_BASE_SMALL=0
 CONFIG_BAYCOM_SER_FDX=m
 # CONFIG_ATM_DRIVERS is not set
 CONFIG_BASE_SMALL=0
 CONFIG_BAYCOM_SER_FDX=m
@@ -207,8 +207,14 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SERIAL_8250 is not set
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_ADM5120=y
+# CONFIG_SERIAL_ADM5120 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_SERIO=y
 CONFIG_SERIO=y
+# CONFIG_SERIO_AMBAKMI is not set
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_PCIPS2 is not set
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_PCIPS2 is not set
index 584b2daef092f5e5aa743c5f71b40ab0c0181880..1e2270d46195df2a4505cc6ef9e940a4f2d2d0eb 100644 (file)
@@ -9,4 +9,8 @@ config PCI_ADM5120
 
 endmenu
 
 
 endmenu
 
+config ARM_AMBA
+       bool
+       default y
+
 endif
 endif
index fd588a4e3cf9b6de814f4e237905ea6c4bcef80d..bb0a7c8b061b8342d2782a59259f8ae3e8cce245 100644 (file)
@@ -3,11 +3,13 @@
 #
 
 obj-y  := setup.o prom.o irq.o memory.o adm5120_info.o
 #
 
 obj-y  := setup.o prom.o irq.o memory.o adm5120_info.o
-obj-y  += gpio.o
-obj-y  += time.o
-obj-y  += reset.o
 obj-y  += board.o
 obj-y  += board.o
+obj-y  += clock.o
+obj-y  += gpio.o
 obj-y  += platform.o
 obj-y  += platform.o
+obj-y  += reset.o
+obj-y  += time.o
+
 obj-y  += trxsplit.o
 
 EXTRA_AFLAGS := $(CFLAGS)
 obj-y  += trxsplit.o
 
 EXTRA_AFLAGS := $(CFLAGS)
index a4643837c3e929d07bb18b162ef1dd014962290c..17b88c00110f64114f6029eb20a8790a5aa3bb1b 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <asm/mach-adm5120/adm5120_info.h>
 #include <asm/mach-adm5120/adm5120_defs.h>
 
 #include <asm/mach-adm5120/adm5120_info.h>
 #include <asm/mach-adm5120/adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_irq.h>
 #include <asm/mach-adm5120/adm5120_board.h>
 #include <asm/mach-adm5120/adm5120_platform.h>
 
 #include <asm/mach-adm5120/adm5120_board.h>
 #include <asm/mach-adm5120/adm5120_platform.h>
 
@@ -87,6 +88,10 @@ static int __init adm5120_board_setup(void)
        if (board->board_setup)
                board->board_setup();
 
        if (board->board_setup)
                board->board_setup();
 
+       /* register UARTs */
+       amba_device_register(&adm5120_uart0_device, &iomem_resource);
+       amba_device_register(&adm5120_uart1_device, &iomem_resource);
+
        /* register PCI controller */
        if (adm5120_package_bga())
                platform_device_register(&adm5120_pci_device);
        /* register PCI controller */
        if (adm5120_package_bga())
                platform_device_register(&adm5120_pci_device);
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c
new file mode 100644 (file)
index 0000000..b1b213d
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ *  $Id$
+ *
+ *  ADM5120 minimal CLK API implementation
+ *
+ *  Copyright (C) 2007 OpenWrt.org
+ *  Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
+ *
+ *  This file was based on the CLK API implementation in:
+ *     arch/mips/tx4938/toshiba_rbtx4938/setup.c
+ *     Copyright (C) 2000-2001 Toshiba Corporation
+ *     2003-2005 (c) MontaVista Software, Inc.
+ *
+ *  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., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+
+#include <asm/mach-adm5120/adm5120_defs.h>
+
+struct clk {
+       unsigned long rate;
+};
+
+static struct clk uart_clk = {
+       .rate = ADM5120_UART_CLOCK
+};
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+       if (!strcmp(id, "UARTCLK"))
+               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);
index d0fa1f0bc8ecb161a35cdf0d4c7a19cf55364e59..723f27fe703f4293f5feeb3734e6ead4e4480ad5 100644 (file)
@@ -38,6 +38,9 @@
 #include <asm/mach-adm5120/adm5120_switch.h>
 #include <asm/mach-adm5120/adm5120_platform.h>
 
 #include <asm/mach-adm5120/adm5120_switch.h>
 #include <asm/mach-adm5120/adm5120_platform.h>
 
+static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
+               unsigned int mctrl);
+
 #if 1
 /*
  * TODO:remove global adm5120_eth* variables when the switch driver will be
 #if 1
 /*
  * TODO:remove global adm5120_eth* variables when the switch driver will be
@@ -128,3 +131,45 @@ struct platform_device adm5120_nand_device = {
        .num_resources  = ARRAY_SIZE(adm5120_nand_resource),
        .resource       = adm5120_nand_resource,
 };
        .num_resources  = ARRAY_SIZE(adm5120_nand_resource),
        .resource       = adm5120_nand_resource,
 };
+
+/* built-in UARTs */
+struct amba_pl010_data adm5120_uart0_data = {
+       .set_mctrl = adm5120_uart_set_mctrl
+};
+
+struct amba_device adm5120_uart0_device = {
+       .dev            = {
+               .bus_id = "APB:UART0",
+               .platform_data = &adm5120_uart0_data,
+       },
+       .res            = {
+               .start  = ADM5120_UART0_BASE,
+               .end    = ADM5120_UART0_BASE + ADM5120_UART_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       .irq            = { ADM5120_IRQ_UART0, -1 },
+       .periphid       = 0x0041010,
+};
+
+struct amba_pl010_data adm5120_uart1_data = {
+       .set_mctrl = adm5120_uart_set_mctrl
+};
+
+struct amba_device adm5120_uart1_device = {
+       .dev            = {
+               .bus_id = "APB:UART1",
+               .platform_data = &adm5120_uart1_data,
+       },
+       .res            = {
+               .start  = ADM5120_UART1_BASE,
+               .end    = ADM5120_UART1_BASE + ADM5120_UART_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       .irq            = { ADM5120_IRQ_UART1, -1 },
+       .periphid       = 0x0041010,
+};
+
+static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
+               unsigned int mctrl)
+{
+}
index e63611912a8397968a0da916d49b0e4e1f03e5ff..764dc789d7571f0b2ceb224c3d98861269b8266e 100644 (file)
 #ifndef _ADM5120_PLATFORM_H_
 #define _ADM5120_PLATFORM_H_
 
 #ifndef _ADM5120_PLATFORM_H_
 #define _ADM5120_PLATFORM_H_
 
+#include <linux/device.h>
+#include <linux/platform_device.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
 
+#include <linux/amba/bus.h>
+#include <linux/amba/serial.h>
+
 struct adm5120_flash_platform_data {
        void                    (*set_vpp)(struct map_info *, int);
        void                    (*switch_bank)(unsigned);
 struct adm5120_flash_platform_data {
        void                    (*set_vpp)(struct map_info *, int);
        void                    (*switch_bank)(unsigned);
@@ -63,6 +69,8 @@ extern struct adm5120_flash_platform_data adm5120_flash1_data;
 extern struct adm5120_nand_platform_data adm5120_nand_data;
 extern struct adm5120_pci_platform_data adm5120_pci_data;
 extern struct adm5120_switch_platform_data adm5120_switch_data;
 extern struct adm5120_nand_platform_data adm5120_nand_data;
 extern struct adm5120_pci_platform_data adm5120_pci_data;
 extern struct adm5120_switch_platform_data adm5120_switch_data;
+extern struct amba_pl010_data adm5120_uart0_data;
+extern struct amba_pl010_data adm5120_uart1_data;
 
 extern struct platform_device adm5120_flash0_device;
 extern struct platform_device adm5120_flash1_device;
 
 extern struct platform_device adm5120_flash0_device;
 extern struct platform_device adm5120_flash1_device;
@@ -70,5 +78,8 @@ extern struct platform_device adm5120_nand_device;
 extern struct platform_device adm5120_usbc_device;
 extern struct platform_device adm5120_pci_device;
 extern struct platform_device adm5120_switch_device;
 extern struct platform_device adm5120_usbc_device;
 extern struct platform_device adm5120_pci_device;
 extern struct platform_device adm5120_switch_device;
+extern struct amba_device adm5120_uart0_device;
+extern struct amba_device adm5120_uart1_device;
+
 
 #endif /* _ADM5120_PLATFORM_H_ */
 
 #endif /* _ADM5120_PLATFORM_H_ */
diff --git a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/asm/sizes.h b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/asm/sizes.h
new file mode 100644 (file)
index 0000000..503843d
--- /dev/null
@@ -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/adm5120-2.6/patches-2.6.22/200-amba-pl010-hacks.patch b/target/linux/adm5120-2.6/patches-2.6.22/200-amba-pl010-hacks.patch
new file mode 100644 (file)
index 0000000..840d5a4
--- /dev/null
@@ -0,0 +1,297 @@
+Index: linux/drivers/serial/amba-pl010.c
+===================================================================
+--- linux.orig/drivers/serial/amba-pl010.c
++++ linux/drivers/serial/amba-pl010.c
+@@ -52,11 +52,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
+@@ -82,7 +81,7 @@ 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 = readl(uap->port.membase + UART010_CR);
+       cr &= ~UART010_CR_TIE;
+       writel(cr, uap->port.membase + UART010_CR);
+ }
+@@ -92,7 +91,7 @@ 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 = readl(uap->port.membase + UART010_CR);
+       cr |= UART010_CR_TIE;
+       writel(cr, uap->port.membase + UART010_CR);
+ }
+@@ -102,7 +101,7 @@ 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 = readl(uap->port.membase + UART010_CR);
+       cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
+       writel(cr, uap->port.membase + UART010_CR);
+ }
+@@ -112,7 +111,7 @@ 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 = readl(uap->port.membase + UART010_CR);
+       cr |= UART010_CR_MSIE;
+       writel(cr, uap->port.membase + UART010_CR);
+ }
+@@ -122,9 +121,9 @@ static void pl010_rx_chars(struct uart_a
+       struct tty_struct *tty = uap->port.info->tty;
+       unsigned int status, ch, flag, rsr, max_count = 256;
+-      status = readb(uap->port.membase + UART01x_FR);
++      status = readl(uap->port.membase + UART01x_FR);
+       while (UART_RX_DATA(status) && max_count--) {
+-              ch = readb(uap->port.membase + UART01x_DR);
++              ch = readl(uap->port.membase + UART01x_DR);
+               flag = TTY_NORMAL;
+               uap->port.icount.rx++;
+@@ -133,7 +132,7 @@ 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 = readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
+               if (unlikely(rsr & UART01x_RSR_ANY)) {
+                       writel(0, uap->port.membase + UART01x_ECR);
+@@ -165,7 +164,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 = readl(uap->port.membase + UART01x_FR);
+       }
+       spin_unlock(&uap->port.lock);
+       tty_flip_buffer_push(tty);
+@@ -210,7 +209,7 @@ static void pl010_modem_status(struct ua
+       writel(0, uap->port.membase + UART010_ICR);
+-      status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
++      status = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+       delta = status ^ uap->old_status;
+       uap->old_status = status;
+@@ -238,7 +237,7 @@ static irqreturn_t pl010_int(int irq, vo
+       spin_lock(&uap->port.lock);
+-      status = readb(uap->port.membase + UART010_IIR);
++      status = readl(uap->port.membase + UART010_IIR);
+       if (status) {
+               do {
+                       if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
+@@ -251,7 +250,7 @@ static irqreturn_t pl010_int(int irq, vo
+                       if (pass_counter-- == 0)
+                               break;
+-                      status = readb(uap->port.membase + UART010_IIR);
++                      status = readl(uap->port.membase + UART010_IIR);
+               } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
+                                  UART010_IIR_TIS));
+               handled = 1;
+@@ -265,7 +264,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 = readl(uap->port.membase + UART01x_FR);
+       return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
+ }
+@@ -275,7 +274,7 @@ static unsigned int pl010_get_mctrl(stru
+       unsigned int result = 0;
+       unsigned int status;
+-      status = readb(uap->port.membase + UART01x_FR);
++      status = readl(uap->port.membase + UART01x_FR);
+       if (status & UART01x_FR_DCD)
+               result |= TIOCM_CAR;
+       if (status & UART01x_FR_DSR)
+@@ -301,7 +300,7 @@ 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 = readl(uap->port.membase + UART010_LCRH);
+       if (break_state == -1)
+               lcr_h |= UART01x_LCRH_BRK;
+       else
+@@ -334,7 +333,7 @@ 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 = readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
+       /*
+        * Finally, enable interrupts
+@@ -365,7 +364,7 @@ static void pl010_shutdown(struct uart_p
+       writel(0, uap->port.membase + UART010_CR);
+       /* disable break condition and fifos */
+-      writel(readb(uap->port.membase + UART010_LCRH) &
++      writel(readl(uap->port.membase + UART010_LCRH) &
+               ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
+              uap->port.membase + UART010_LCRH);
+@@ -387,7 +386,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) {
+@@ -450,7 +449,7 @@ 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 = readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
+       if (UART_ENABLE_MS(port, termios->c_cflag))
+               old_cr |= UART010_CR_MSIE;
+@@ -540,7 +539,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
+@@ -550,7 +549,7 @@ static void pl010_console_putchar(struct
+       unsigned int status;
+       do {
+-              status = readb(uap->port.membase + UART01x_FR);
++              status = readl(uap->port.membase + UART01x_FR);
+               barrier();
+       } while (!UART_TX_READY(status));
+       writel(ch, uap->port.membase + UART01x_DR);
+@@ -567,7 +566,7 @@ pl010_console_write(struct console *co, 
+       /*
+        *      First save the CR then disable the interrupts
+        */
+-      old_cr = readb(uap->port.membase + UART010_CR);
++      old_cr = readl(uap->port.membase + UART010_CR);
+       writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
+       uart_console_write(&uap->port, s, count, pl010_console_putchar);
+@@ -577,7 +576,7 @@ pl010_console_write(struct console *co, 
+        *      and restore the TCR
+        */
+       do {
+-              status = readb(uap->port.membase + UART01x_FR);
++              status = readl(uap->port.membase + UART01x_FR);
+               barrier();
+       } while (status & UART01x_FR_BUSY);
+       writel(old_cr, uap->port.membase + UART010_CR);
+@@ -589,9 +588,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 (readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
+               unsigned int lcr_h, quot;
+-              lcr_h = readb(uap->port.membase + UART010_LCRH);
++              lcr_h = readl(uap->port.membase + UART010_LCRH);
+               *parity = 'n';
+               if (lcr_h & UART01x_LCRH_PEN) {
+@@ -606,8 +605,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 = readl(uap->port.membase + UART010_LCRL) |
++                     readl(uap->port.membase + UART010_LCRM) << 8;
+               *baud = uap->port.uartclk / (16 * (quot + 1));
+       }
+ }
+@@ -625,7 +624,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)
+@@ -643,7 +642,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,
+@@ -659,11 +658,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,
+ };
+Index: linux/drivers/serial/Kconfig
+===================================================================
+--- linux.orig/drivers/serial/Kconfig
++++ linux/drivers/serial/Kconfig
+@@ -293,10 +293,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/adm5120-2.6/patches-2.6.22/201-amba-bus-hacks.patch b/target/linux/adm5120-2.6/patches-2.6.22/201-amba-bus-hacks.patch
new file mode 100644 (file)
index 0000000..3b92f25
--- /dev/null
@@ -0,0 +1,15 @@
+Index: linux/drivers/amba/bus.c
+===================================================================
+--- linux.orig/drivers/amba/bus.c
++++ linux/drivers/amba/bus.c
+@@ -17,6 +17,10 @@
+ #include <asm/io.h>
+ #include <asm/sizes.h>
++#ifndef NO_IRQ
++#define NO_IRQ                (-1)
++#endif
++
+ #define to_amba_device(d)     container_of(d, struct amba_device, dev)
+ #define to_amba_driver(d)     container_of(d, struct amba_driver, drv)
index e86e881a925e935c420e965bc31824371a6fb2c0..f6985a5fc9b68c8c3971e4647487cffb62a7595e 100644 (file)
@@ -1,10 +1,10 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 # CONFIG_64BIT_PHYS_ADDR is not set
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 # CONFIG_64BIT_PHYS_ADDR is not set
-CONFIG_ADM5120_NR_UARTS=2
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARM_AMBA=y
 # CONFIG_ATM_DRIVERS is not set
 CONFIG_BASE_SMALL=0
 CONFIG_BAYCOM_SER_FDX=m
 # CONFIG_ATM_DRIVERS is not set
 CONFIG_BASE_SMALL=0
 CONFIG_BAYCOM_SER_FDX=m
@@ -200,8 +200,14 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SERIAL_8250 is not set
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_ADM5120=y
+# CONFIG_SERIAL_ADM5120 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_SERIO=y
 CONFIG_SERIO=y
+# CONFIG_SERIO_AMBAKMI is not set
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_PCIPS2 is not set
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_LIBPS2 is not set
 # CONFIG_SERIO_PCIPS2 is not set