diff options
Diffstat (limited to 'target')
10 files changed, 189 insertions, 1 deletions
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index c41105397..1a5747f2f 100755 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -42,6 +42,9 @@ get_status_led() { mofi3500-3gn) status_led="mofi3500-3gn:green:status" ;; + nw718) + status_led="nw718:amber:cpu" + ;; pwh2004) status_led="pwh2004:green:power" ;; diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index ee20b54ef..405e7c42e 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -46,6 +46,7 @@ case "$FIRMWARE" in hw550-3g | \ mofi3500-3gn | \ pwh2004 | \ + nw718 | \ rt-n15 | \ v22rw-2x2 | \ wcr150gn | \ diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index d081b8be6..33ce13cb5 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -31,6 +31,9 @@ ramips_board_name() { *"MoFi Network MOFI3500-3GN") name="mofi3500-3gn" ;; + *"NW718") + name="nw718" + ;; *"PWH2004") name="pwh2004" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index e7511e849..dda4a6757 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -14,7 +14,7 @@ platform_check_image() { [ "$ARGC" -gt 1 ] && return 1 case "$board" in - dir-300-b1 | dir-600-b1 | dir-600-b2 | fonera20n | rt-g32-b1 | v22rw-2x2 | whr-g300n | hw550-3g | mofi3500-3gn) + dir-300-b1 | dir-600-b1 | dir-600-b2 | fonera20n | nw718 | rt-g32-b1 | v22rw-2x2 | whr-g300n | hw550-3g | mofi3500-3gn) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 diff --git a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h index 3f410716d..8571f7a28 100644 --- a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h +++ b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h @@ -22,6 +22,7 @@ enum ramips_mach_type { RAMIPS_MACH_DIR_600_B1, /* D-Link DIR-600 B1 */ RAMIPS_MACH_DIR_600_B2, /* D-Link DIR-600 B2 */ RAMIPS_MACH_RT_G32_B1, /* Asus RT-G32 B1 */ + RAMIPS_MACH_NW718, /* Netcore NW718 */ /* RT3052 based machines */ RAMIPS_MACH_F5D8235_V2, /* Belkin F5D8235 v2 */ diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig index a12693ce1..c24670e03 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig @@ -43,6 +43,12 @@ config RT305X_MACH_MOFI3500_3GN select RALINK_DEV_GPIO_BUTTONS select RALINK_DEV_GPIO_LEDS +config RT305X_MACH_NW718 + bool "Netcore NW718" + default y + select RALINK_DEV_GPIO_BUTTONS + select RALINK_DEV_GPIO_LEDS + config RT305X_MACH_PWH2004 bool "Prolink PWH2004 / Abocom WR5205 support (32M RAM, 8M flash)" default y diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile index 5460a148b..2b1c59ea2 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_RT305X_MACH_F5D8235_V2) += mach-f5d8235-v2.o obj-$(CONFIG_RT305X_MACH_FONERA20N) += mach-fonera20n.o obj-$(CONFIG_RT305X_MACH_HW550_3G) += mach-hw550-3g.o obj-$(CONFIG_RT305X_MACH_MOFI3500_3GN) += mach-mofi3500-3gn.o +obj-$(CONFIG_RT305X_MACH_NW718) += mach-nw718.o obj-$(CONFIG_RT305X_MACH_PWH2004) += mach-pwh2004.o obj-$(CONFIG_RT305X_MACH_RT_G32_REVB) += mach-rt-g32-revb.o obj-$(CONFIG_RT305X_MACH_V22RW_2X2) += mach-v22rw-2x2.o diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c new file mode 100644 index 000000000..09f6dc485 --- /dev/null +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c @@ -0,0 +1,143 @@ +/* + * Netcore NW718 board support + * + * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> + * + * 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 <linux/init.h> +#include <linux/platform_device.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/spi/spi.h> +#include <linux/spi/flash.h> + +#include <asm/mach-ralink/machine.h> +#include <asm/mach-ralink/dev-gpio-buttons.h> +#include <asm/mach-ralink/dev-gpio-leds.h> +#include <asm/mach-ralink/rt305x.h> +#include <asm/mach-ralink/rt305x_regs.h> + +#include "devices.h" + +#define NW718_GPIO_LED_USB 8 +#define NW718_GPIO_LED_CPU 13 +#define NW718_GPIO_LED_WPS 14 + +#define NW718_GPIO_BUTTON_WPS 0 +#define NW718_GPIO_BUTTON_RESET 10 + +#define NW718_GPIO_SPI_CS0 3 +#define NW718_GPIO_SPI_SCK 4 +#define NW718_GPIO_SPI_MOSI 5 +#define NW718_GPIO_SPI_MISO 6 + +#define NW718_BUTTONS_POLL_INTERVAL 20 + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition nw718_partitions[] = { + { + .name = "u-boot", + .offset = 0, + .size = 0x030000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "config", + .offset = 0x030000, + .size = 0x020000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "factory", + .offset = 0x050000, + .size = 0x010000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "kernel", + .offset = 0x060000, + .size = 0x090000, + }, { + .name = "rootfs", + .offset = 0x150000, + .size = 0x2b0000, + }, { + .name = "firmware", + .offset = 0x060000, + .size = 0x3a0000, + } +}; +#define nw718_nr_parts ARRAY_SIZE(nw718_partitions) +#else +#define nw718_nr_parts 0 +#define nw718_partitions NULL +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct flash_platform_data nw718_flash_data = { + .nr_parts = nw718_nr_parts, + .parts = nw718_partitions, +}; + +static struct gpio_led nw718_leds_gpio[] __initdata = { + { + .name = "nw718:amber:cpu", + .gpio = NW718_GPIO_LED_CPU, + .active_low = 1, + }, { + .name = "nw718:amber:usb", + .gpio = NW718_GPIO_LED_USB, + .active_low = 1, + }, { + .name = "nw718:amber:wps", + .gpio = NW718_GPIO_LED_WPS, + .active_low = 1, + } +}; + +static struct gpio_button nw718_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .threshold = 3, + .gpio = NW718_GPIO_BUTTON_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .threshold = 3, + .gpio = NW718_GPIO_BUTTON_WPS, + .active_low = 1, + } +}; + +static struct spi_board_info nw718_spi_info[] = { + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + .platform_data = &nw718_flash_data, + .controller_data = (void *) NW718_GPIO_SPI_CS0, + } +}; + +static void __init nw718_init(void) +{ + rt305x_gpio_init(RT305X_GPIO_MODE_I2C | + RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); + + rt305x_register_ethernet(); + ramips_register_gpio_leds(-1, ARRAY_SIZE(nw718_leds_gpio), + nw718_leds_gpio); + ramips_register_gpio_buttons(-1, NW718_BUTTONS_POLL_INTERVAL, + ARRAY_SIZE(nw718_gpio_buttons), + nw718_gpio_buttons); + rt305x_register_wifi(); + rt305x_register_wdt(); + rt305x_register_spi(nw718_spi_info, ARRAY_SIZE(nw718_spi_info)); +} + +MIPS_MACHINE(RAMIPS_MACH_WHR_G300N, "NW718", "Netcore NW718", nw718_init); diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 22eaaa088..69543990f 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -89,6 +89,24 @@ define BuildFirmware/Buffalo fi; fi endef +define BuildFirmware/NW718 + $(call PatchKernelLzma,$(2),$(3) $($(4))) + mkimage -A mips -O linux -T kernel -C lzma $(call kernel_entry) \ + -n "ARA1B4NCRNW718;1" \ + -d "$(KDIR)/vmlinux-$(2).bin.lzma" \ + "$(KDIR)/vmlinux-$(2).uImage" + if [ `stat -c%s "$(KDIR)/vmlinux-$(2).uImage"` -gt $(5) ]; then \ + echo "Warning: $(KDIR)/vmlinux-$(2).uImage is too big"; \ + else if [ `stat -c%s $(KDIR)/root.$(1)` -gt $(6) ]; then \ + echo "Warning: $(KDIR)/root.$(1) is too big"; \ + else \ + ( \ + dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(5) conv=sync; \ + dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ + ) > $(call imgname,$(1),$(2))-factory.bin; \ + fi; fi +endef + mtdlayout_4M=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,832k(kernel),2944k(rootfs),3776k@0x50000(firmware) define Image/Build/Template/GENERIC_4M $(call BuildFirmware/Generic,$(1),$(2),board=$(3),mtdlayout_4M,851968,3014656) @@ -109,6 +127,12 @@ define Image/Build/Template/DIR300B1 -o $(call imgname,$(1),$(2))-factory.bin endef +mtdlayout_nw718=mtdparts=spi0.0:192k(u-boot)ro,128k(config)ro,64k(factory)ro,832k(kernel),2880k(rootfs),3712k@0x60000(firmware) +define Image/Build/Template/NW718 + $(call BuildFirmware/Generic,$(1),$(2),board=$(3),mtdlayout_nw718,851968,2949120) + $(call BuildFirmware/NW718,$(1),$(2),board=$(3),mtdlayout_nw718,851968,2949120) +endef + define Image/Build/Profile/DIR300B1 $(call Image/Build/Template/DIR300B1,$(1),dir-300-b1,DIR-300-B1,wrgn23_dlwbr_dir300b) $(call Image/Build/Template/DIR300B1,$(1),dir-600-b1,DIR-600-B1,wrgn23_dlwbr_dir600b) @@ -130,6 +154,10 @@ define Image/Build/Profile/FONERA20N $(call Image/Build/Template/GENERIC_8M,$(1),fonera20n,FONERA20N) endef +define Image/Build/Profile/NW718 + $(call Image/Build/Template/NW718,$(1),nw718,NW718) +endef + define Image/Build/Profile/PWH2004 $(call Image/Build/Template/GENERIC_8M,$(1),pwh2004,PWH2004) endef @@ -189,6 +217,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/RTG32B1,$(1)) $(call Image/Build/Profile/FONERA20N,$(1)) $(call Image/Build/Profile/V22RW2X2,$(1)) + $(call Image/Build/Profile/NW718,$(1)) $(call Image/Build/Profile/PWH2004,$(1)) $(call Image/Build/Profile/WHRG300N,$(1)) $(call Image/Build/Profile/WCR150GN,$(1)) diff --git a/target/linux/ramips/rt305x/config-2.6.39 b/target/linux/ramips/rt305x/config-2.6.39 index 562b8f153..bd8887bfa 100644 --- a/target/linux/ramips/rt305x/config-2.6.39 +++ b/target/linux/ramips/rt305x/config-2.6.39 @@ -96,6 +96,7 @@ CONFIG_RT305X_MACH_F5D8235_V2=y CONFIG_RT305X_MACH_FONERA20N=y CONFIG_RT305X_MACH_HW550_3G=y CONFIG_RT305X_MACH_MOFI3500_3GN=y +CONFIG_RT305X_MACH_NW718=y CONFIG_RT305X_MACH_PWH2004=y CONFIG_RT305X_MACH_RT_G32_REVB=y CONFIG_RT305X_MACH_V22RW_2X2=y |