From 315fb2270ee2813321c78f33ec4ad60ad7ec44a4 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 25 May 2009 18:36:49 +0000 Subject: [ar71xx] add preliminary support for the WRT160NL git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16068 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig | 4 ++ .../linux/ar71xx/files/arch/mips/ar71xx/Makefile | 1 + .../ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c | 83 ++++++++++++++++++++++ target/linux/ar71xx/files/arch/mips/ar71xx/prom.c | 3 + .../arch/mips/include/asm/mach-ar71xx/ar71xx.h | 1 + 5 files changed, 92 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c (limited to 'target/linux/ar71xx/files') diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index d5bffdc9b..0682e015a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -35,6 +35,10 @@ config AR71XX_MACH_WP543 select MYLOADER default y +config AR71XX_MACH_WRT160NL + bool "Linksys WRT160NL board support" + default y + config AR71XX_MACH_WRT400N bool "Linksys WRT400N board support" default y diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index a70cc2b24..720fddfdb 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -24,4 +24,5 @@ obj-$(CONFIG_AR71XX_MACH_TL_WR941ND) += mach-tl-wr941nd.o obj-$(CONFIG_AR71XX_MACH_UBNT) += mach-ubnt.o obj-$(CONFIG_AR71XX_MACH_WNR2000) += mach-wnr2000.o obj-$(CONFIG_AR71XX_MACH_WP543) += mach-wp543.o +obj-$(CONFIG_AR71XX_MACH_WRT160NL) += mach-wrt160nl.o obj-$(CONFIG_AR71XX_MACH_WRT400N) += mach-wrt400n.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c new file mode 100644 index 000000000..06cd05aa2 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c @@ -0,0 +1,83 @@ +/* + * Linksys WRT160NL board support + * + * Copyright (C) 2009 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include "devices.h" + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition wrt160nl_partitions[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x040000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "kernel", + .offset = 0x040000, + .size = 0x0e0000, + } , { + .name = "filesytem", + .offset = 0x120000, + .size = 0x6c0000, + } , { + .name = "nvram", + .offset = 0x7e0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "ART", + .offset = 0x7f0000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "firmware", + .offset = 0x040000, + .size = 0x7a0000, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data wrt160nl_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS + .parts = wrt160nl_partitions, + .nr_parts = ARRAY_SIZE(wrt160nl_partitions), +#endif +}; + +static struct spi_board_info wrt160nl_spi_info[] = { + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + .platform_data = &wrt160nl_flash_data, + } +}; + +static void __init wrt160nl_setup(void) +{ + /* TODO: ethernet, LEDs, buttons */ + + ar71xx_add_device_spi(NULL, wrt160nl_spi_info, + ARRAY_SIZE(wrt160nl_spi_info)); + + ar71xx_add_device_usb(); + ar91xx_add_device_wmac(); +} + +MIPS_MACHINE(AR71XX_MACH_WRT160NL, "Linksys WRT160NL", wrt160nl_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c index 9117e3063..bfc38c010 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/prom.c @@ -77,6 +77,9 @@ static struct board_rec boards[] __initdata = { }, { .name = "WNR2000", .mach_type = AR71XX_MACH_WNR2000, + }, { + .name = "WRT160NL", + .mach_type = AR71XX_MACH_WRT160NL, }, { .name = "WRT400N", .mach_type = AR71XX_MACH_WRT400N, diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h index 9bf08433c..86272789b 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h @@ -132,6 +132,7 @@ extern unsigned long ar71xx_mach_type; #define AR71XX_MACH_AP81 18 /* Atheros AP81 */ #define AR71XX_MACH_WRT400N 19 /* Linksys WRT400N */ #define AR71XX_MACH_PB44 20 /* Atheros PB44 */ +#define AR71XX_MACH_WRT160NL 21 /* Linksys WRT160NL */ /* * PLL block -- cgit v1.2.3