summaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120-2.6/files/arch/mips/adm5120
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-07-25 14:47:16 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-07-25 14:47:16 +0000
commit87f5e12cd0a27c33cc970186de623b4eb667b564 (patch)
tree60387dcbdec956f0ec85945fb87fa90a13563d51 /target/linux/adm5120-2.6/files/arch/mips/adm5120
parent10b2579edba1bc5ab66fbd5b2315cab874ed202b (diff)
[adm5120] uses AMBA PL010 driver for the serial ports from now
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8159 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120-2.6/files/arch/mips/adm5120')
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig4
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile8
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c5
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c76
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c45
5 files changed, 135 insertions, 3 deletions
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig
index 584b2daef..1e2270d46 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Kconfig
@@ -9,4 +9,8 @@ config PCI_ADM5120
endmenu
+config ARM_AMBA
+ bool
+ default y
+
endif
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile
index fd588a4e3..bb0a7c8b0 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/Makefile
@@ -3,11 +3,13 @@
#
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 += clock.o
+obj-y += gpio.o
obj-y += platform.o
+obj-y += reset.o
+obj-y += time.o
+
obj-y += trxsplit.o
EXTRA_AFLAGS := $(CFLAGS)
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c
index a4643837c..17b88c001 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c
@@ -33,6 +33,7 @@
#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>
@@ -87,6 +88,10 @@ static int __init adm5120_board_setup(void)
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);
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
index 000000000..b1b213ded
--- /dev/null
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c
@@ -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);
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c
index d0fa1f0bc..723f27fe7 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c
@@ -38,6 +38,9 @@
#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
@@ -128,3 +131,45 @@ struct platform_device adm5120_nand_device = {
.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)
+{
+}