From f6e6a733f57061a62ff52711e19100a30824b555 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 25 May 2009 18:36:49 +0000 Subject: [PATCH] add preliminary support for the WRT160NL SVN-Revision: 16068 --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + target/linux/ar71xx/config-2.6.28 | 1 + target/linux/ar71xx/config-2.6.30 | 1 + .../ar71xx/files/arch/mips/ar71xx/Kconfig | 4 + .../ar71xx/files/arch/mips/ar71xx/Makefile | 1 + .../files/arch/mips/ar71xx/mach-wrt160nl.c | 83 +++++++++++++++++++ .../ar71xx/files/arch/mips/ar71xx/prom.c | 3 + .../mips/include/asm/mach-ar71xx/ar71xx.h | 1 + target/linux/ar71xx/profiles/linksys.mk | 10 +++ 9 files changed, 107 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index ba69e7d5ca..c7a6063422 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -55,6 +55,9 @@ ar71xx_board_name() { *WNR2000) name="wnr2000" ;; + *WRT160NL) + name="wrt160nl" + ;; *WRT400N) name="wrt400n" ;; diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28 index 06e738110c..f272070026 100644 --- a/target/linux/ar71xx/config-2.6.28 +++ b/target/linux/ar71xx/config-2.6.28 @@ -20,6 +20,7 @@ CONFIG_AR71XX_MACH_TL_WR941ND=y CONFIG_AR71XX_MACH_UBNT=y CONFIG_AR71XX_MACH_WNR2000=y CONFIG_AR71XX_MACH_WP543=y +CONFIG_AR71XX_MACH_WRT160NL=y CONFIG_AR71XX_MACH_WRT400N=y CONFIG_AR71XX_WDT=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30 index 464a45d9ee..9ee6f72696 100644 --- a/target/linux/ar71xx/config-2.6.30 +++ b/target/linux/ar71xx/config-2.6.30 @@ -19,6 +19,7 @@ CONFIG_AR71XX_MACH_TL_WR941ND=y CONFIG_AR71XX_MACH_UBNT=y CONFIG_AR71XX_MACH_WNR2000=y CONFIG_AR71XX_MACH_WP543=y +CONFIG_AR71XX_MACH_WRT160NL=y CONFIG_AR71XX_MACH_WRT400N=y CONFIG_AR71XX_WDT=y # CONFIG_ARCH_HAS_ILOG2_U32 is not set diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index d5bffdc9b4..0682e015a3 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 a70cc2b24b..720fddfdbe 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 0000000000..06cd05aa2f --- /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 9117e30636..bfc38c010f 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 9bf08433c3..86272789bd 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 diff --git a/target/linux/ar71xx/profiles/linksys.mk b/target/linux/ar71xx/profiles/linksys.mk index 8c7f30e535..8926374628 100644 --- a/target/linux/ar71xx/profiles/linksys.mk +++ b/target/linux/ar71xx/profiles/linksys.mk @@ -5,6 +5,15 @@ # See /LICENSE for more information. # +define Profile/WRT160NL + NAME:=Linksys WRT160NL + PACKAGES:=kmod-ath9k hostapd-mini kmod-usb2 +endef + +define Profile/WRT160NL/Description + Package set optimized for the Linksys WRT160NL. +endef + define Profile/WRT400N NAME:=Linksys WRT400N PACKAGES:=kmod-ath9k hostapd-mini @@ -14,4 +23,5 @@ define Profile/WRT400N/Description Package set optimized for the Linksys WRT400N. endef +$(eval $(call Profile,WRT160NL)) $(eval $(call Profile,WRT400N)) -- 2.25.1