From 445230cf7878d949ae35c931ae1cb4222d2a95c0 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Wed, 25 Jul 2007 14:47:16 +0000 Subject: uses AMBA PL010 driver for the serial ports from now SVN-Revision: 8159 --- .../adm5120-2.6/files/arch/mips/adm5120/Kconfig | 4 ++ .../adm5120-2.6/files/arch/mips/adm5120/Makefile | 8 ++- .../adm5120-2.6/files/arch/mips/adm5120/board.c | 5 ++ .../adm5120-2.6/files/arch/mips/adm5120/clock.c | 76 ++++++++++++++++++++++ .../adm5120-2.6/files/arch/mips/adm5120/platform.c | 45 +++++++++++++ .../asm-mips/mach-adm5120/adm5120_platform.h | 11 ++++ .../include/asm-mips/mach-adm5120/asm/sizes.h | 56 ++++++++++++++++ 7 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 target/linux/adm5120-2.6/files/arch/mips/adm5120/clock.c create mode 100644 target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/asm/sizes.h (limited to 'target/linux/adm5120-2.6/files') 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 584b2daef0..1e2270d461 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 fd588a4e3c..bb0a7c8b06 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 a4643837c3..17b88c0011 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 #include +#include #include #include @@ -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 0000000000..b1b213ded5 --- /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 + * + * 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 +#include +#include +#include +#include + +#include + +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 d0fa1f0bc8..723f27fe70 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 #include +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) +{ +} diff --git a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_platform.h b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_platform.h index e63611912a..764dc789d7 100644 --- a/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_platform.h +++ b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/adm5120_platform.h @@ -25,10 +25,16 @@ #ifndef _ADM5120_PLATFORM_H_ #define _ADM5120_PLATFORM_H_ +#include +#include + #include #include #include +#include +#include + 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 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; @@ -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 amba_device adm5120_uart0_device; +extern struct amba_device adm5120_uart1_device; + #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 index 0000000000..503843db15 --- /dev/null +++ b/target/linux/adm5120-2.6/files/include/asm-mips/mach-adm5120/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 */ -- cgit v1.2.3