Discussion:
[OpenWrt-Devel] [PATCH] [ramips] Add support for Belkin F5D8233-4 V4 wireless router
Chris Bajumpaa
2013-09-30 16:50:54 UTC
Permalink
From: <***@gmail.com>


This patch adds OpenWRT 12.09.1 support for the Belkin F5D8233-4 V4
wireless router.

Technical details for this router can be found at
http://www.belkin.com/us/support-product?rnId=332
and http://wikidevi.com/wiki/Belkin_F5D8233-4_v4

I've added the patch as an attachment to this message as well included
it inline.


Adds:
target/linux/ramips/rt288x/profiles/belkin-f5d8233_v4.mk
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8233-v4.c

Modifies:
target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
target/linux/ramips/base-files/etc/uci-defaults/network
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
target/linux/ramips/files/arch/mips/ralink/rt288x/Kconfig
target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
target/linux/ramips/image/Makefile
target/linux/ramips/rt288x/config-3.3



u-boot tftp flash procedure:

You need a serial console. There is an unpopulated 4-pin header on
the board.

Has this pinout:

1 - Square Pad - 3.3V
2 - TX
3 - RX
Chris Bajumpaa
2013-09-30 16:57:12 UTC
Permalink
Here is the actual patch... I included the wrong one in the previous
message... Sorry.

diff --git a/target/linux/ramips/base-files/etc/diag.sh
b/target/linux/ramips/base-files/etc/diag.sh
index 395ed6f..cdd7772 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -51,6 +51,9 @@ get_status_led() {
f5d8235-v2)
status_led="f5d8235v2:blue:router"
;;
+ f5d8233-v4)
+ status_led="f5d8233-v4:blue:power"
+ ;;
fonera20n)
status_led="fonera20n: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 bc4ea02..dde7aaa 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
@@ -97,6 +97,11 @@ case "$FIRMWARE" in
rt2x00_eeprom_extract "board-nvram" 64880 512
;;

+ f5d8233-v4)
+ rt2x00_eeprom_extract "factory" 64880 512
+ ;;
+
+
*)
rt2x00_eeprom_die "board $board is not supported yet"
;;
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network
b/target/linux/ramips/base-files/etc/uci-defaults/network
index cf9c0bb..7f49c3a 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/network
@@ -115,6 +115,13 @@ ramips_setup_interfaces()
ucidef_set_interface_lan "eth0"
;;

+ f5d8233-v4)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
+ ucidef_add_switch_vlan "switch0" "2" "4 5t"
+ ;;
+
*)
RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
if [ -n "${RT3X5X}" ]; then
diff --git a/target/linux/ramips/base-files/lib/ramips.sh
b/target/linux/ramips/base-files/lib/ramips.sh
index 25a1205..23cc2ab 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -107,6 +107,9 @@ ramips_board_name() {
*"ESR-9753")
name="esr-9753"
;;
+ *"F5D8233-4 v4")
+ name="f5d8233-v4"
+ ;;
*"F5D8235 v1")
name="f5d8235-v1"
;;
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 83d2e26..186febd 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
@@ -15,6 +15,7 @@ enum ramips_mach_type {
RAMIPS_MACH_GENERIC,
/* RT2880 based machines */
RAMIPS_MACH_F5D8235_V1, /* Belkin F5D8235 v1 */
+ RAMIPS_MACH_F5D8233_V4, /* Belkin F5D8233 v4 */
RAMIPS_MACH_RT_N15, /* Asus RT-N15 */
RAMIPS_MACH_V11ST_FE, /* Ralink V11ST-FE */
RAMIPS_MACH_WLI_TX4_AG300N, /* Buffalo WLI-TX4-AG300N */
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/Kconfig
b/target/linux/ramips/files/arch/mips/ralink/rt288x/Kconfig
index 31dcc81..3498737 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt288x/Kconfig
+++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/Kconfig
@@ -2,6 +2,10 @@ if RALINK_RT288X

menu "Ralink RT288x machine selection"

+config RT288X_MACH_F5D8233_V4
+ bool "Belkin F5D8233 V4 board support"
+ select RALINK_DEV_GPIO_LEDS
+
config RT288X_MACH_F5D8235_V1
bool "Belkin F5D8235 V1 board support"
select RALINK_DEV_GPIO_LEDS
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
b/target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
index 473f855..b783b49 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
+++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/Makefile
@@ -14,6 +14,7 @@ obj-y := irq.o setup.o rt288x.o devices.o clock.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o

obj-$(CONFIG_RT288X_MACH_F5D8235_V1) += mach-f5d8235-v1.o
+obj-$(CONFIG_RT288X_MACH_F5D8233_V4) += mach-f5d8233-v4.o
obj-$(CONFIG_RT288X_MACH_RT_N15) += mach-rt-n15.o
obj-$(CONFIG_RT288X_MACH_V11ST_FE) += mach-v11st-fe.o
obj-$(CONFIG_RT288X_MACH_WLI_TX4_AG300N) += mach-wli-tx4-ag300n.o
diff --git
a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8233-v4.c
b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8233-v4.c
new file mode 100644
index 0000000..731cf7e
--- /dev/null
+++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8233-v4.c
@@ -0,0 +1,267 @@
+/*
+ * Belkin F5D8233 V4 board support
+ *
+ * Copyright (C) 2013 Chris Bajumpaa <***@gmail.com>
+ *
+ * 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 <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/rt288x.h>
+#include <asm/mach-ralink/rt288x_regs.h>
+
+#include "devices.h"
+
+#include <linux/ethtool.h>
+
+#include <asm/mach-ralink/ramips_eth_platform.h>
+
+/*
+
+ from: /proc/led on factory firmware...
+ power:16:0
+ security:29:0
+ intercon:13:0
+ internoc:14:0
+ wlanerr:31:0
+ wlanlink:27:0
+ lanlink:20:0
+ lanerr:19:0
+ wanerr:17:0
+ wanlink:18:0
+ wpsled:28:0
+
+ Internet Connected (1<<13)
+ Power Led (1<<16)
+ etc...
+
+ GPIO2 Register dump - 0x300660 - All leds off
+ 00000060 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00
|................|
+ 00000070 ff ff ff f7 00 60 1f b8 00 00 00 00 00 00 00 00
|.....`..........|
+
+ GPIO0 WPS Button
+ 00000000 00 00 00 00 ff bf 40 00 00 00 00 00 00 00 00 00
|***@.........|
+ 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
+ 00000020 fe 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|.?..............|
+
+ GPIO0 RST Button
+ 00000000 00 00 00 00 ff bf 41 00 00 00 00 00 00 00 00 00
|......A.........|
+ 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
+ 00000020 7f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|.?..............|
+
+ GPIO No Buttons pressed
+ 00000000 00 00 00 00 ff bf 41 00 00 00 00 00 00 00 00 00
|......A.........|
+ 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
+ 00000020 ff 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|.?..............|
+
+ GPIO Register Dump procedure...
+
+ dd if=/dev/mem skip=$((0x0300600)) bs=1 count=512
+
+*/
+
+//Reset button
+#define F5D8233_GPIO_BUTTON_RESET 7
+
+//WPS Button
+#define F5D8233_GPIO_BUTTON_WPS 0
+
+//Poll and Debounce
+#define F5D8233_KEYS_POLL_INTERVAL 20
+#define F5D8233_KEYS_DEBOUNCE_INTERVAL (3 * F5D8233_KEYS_POLL_INTERVAL)
+
+//Internet connected - Blue
+#define F5D8233_GPIO_LED_INTERCON_BLUE 53
+
+//Internet not connected - Orange
+#define F5D8233_GPIO_LED_INERTNOC_ORANGE 54
+
+//Power - Blue
+#define F5D8233_GPIO_LED_POWER_BLUE 56
+
+//WAN Not connected - Orange
+#define F5D8233_GPIO_LED_WANERR_ORANGE 57
+
+//WAN Connected - Blue
+#define F5D8233_GPIO_LED_WANLINK_BLUE 58
+
+//LAN Not connected - Orange
+#define F5D8233_GPIO_LED_LANERR_ORANGE 59
+
+//LAN Not connected - Blue
+#define F5D8233_GPIO_LED_LANLINK_BLUE 60
+
+//WLAN Link - BLUE
+#define F5D8233_GPIO_LED_WLANLINK_BLUE 67
+
+//WPS Led - BLUE
+#define F5D8233_GPIO_LED_WPSLED_ORANGE 68
+
+//Security - BLUE
+#define F5D8233_GPIO_LED_SECURITY_BLUE 69
+
+//WLAN Not connected/Error
+#define F5D8233_GPIO_LED_WLANERR_ORANGE 71
+
+/*
+ F5D8233-4 V4 Leds
+*/
+
+static struct gpio_led f5d8233_leds_gpio[] __initdata = {
+ {
+ .name = "f5d8233-v4:blue:intercon",
+ .gpio = F5D8233_GPIO_LED_INTERCON_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:orange:internoc",
+ .gpio = F5D8233_GPIO_LED_INERTNOC_ORANGE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:blue:power",
+ .gpio = F5D8233_GPIO_LED_POWER_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:orange:wanerr",
+ .gpio = F5D8233_GPIO_LED_WANERR_ORANGE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:blue:wanlink",
+ .gpio = F5D8233_GPIO_LED_WANLINK_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:orange:lanerr",
+ .gpio = F5D8233_GPIO_LED_LANERR_ORANGE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:blue:lanlink",
+ .gpio = F5D8233_GPIO_LED_LANLINK_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:blue:wlanlink",
+ .gpio = F5D8233_GPIO_LED_WLANLINK_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:orange:wpsled",
+ .gpio = F5D8233_GPIO_LED_WPSLED_ORANGE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:blue:security",
+ .gpio = F5D8233_GPIO_LED_SECURITY_BLUE,
+ .active_low = 1,
+ },
+ {
+ .name = "f5d8233-v4:orange:wlanerr",
+ .gpio = F5D8233_GPIO_LED_WLANERR_ORANGE,
+ .active_low = 1,
+ },
+};
+
+
+/*
+ F5D8233-4 V4 Buttons
+*/
+
+static struct gpio_keys_button f5d8233_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = F5D8233_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = F5D8233_GPIO_BUTTON_RESET,
+ .active_low = 1,
+ }, {
+ .desc = "wps",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = F5D8233_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = F5D8233_GPIO_BUTTON_WPS,
+ .active_low = 1,
+ }
+};
+
+
+/*
+ F5D8233-4 V4 Board specific Init
+*/
+
+static void __init f5d8233_init(void)
+{
+
+ /*
+
+ Initialize GPIO
+
+ SYSC_REG_BASE + SYSC_REG_GPIO_MODE Register dump from Factory
firmware...
+
+ 00000060 87 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
+
+ dd if=/dev/mem skip=$((0x300060)) bs=1 count=1
+
+ */
+
+ rt288x_gpio_init(
+ RT2880_GPIO_MODE_PCI |
+ RT2880_GPIO_MODE_SPI |
+ RT2880_GPIO_MODE_I2C |
+ RT2880_GPIO_MODE_UART0
+ );
+
+ // Register LEDs
+ ramips_register_gpio_leds(
+ -1,
+ ARRAY_SIZE(f5d8233_leds_gpio),
+ f5d8233_leds_gpio
+ );
+
+ // Register Buttons
+ ramips_register_gpio_buttons(
+ -1,
+ F5D8233_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(f5d8233_gpio_buttons),
+ f5d8233_gpio_buttons
+ );
+
+ // Register Flash
+ rt288x_register_flash(0);
+
+ // Register WiFi
+ rt288x_register_wifi();
+
+ // Register WDT
+ rt288x_register_wdt();
+
+ /*
+ Ethernet does not work without this masked.
+ End up connected to the wrong PHY,
+ doesn't see the IP175C and swconfig fails...
+ */
+
+ rt288x_eth_data.phy_mask = BIT(0);
+
+ // Register Ethernet
+ rt288x_register_ethernet();
+
+}
+
+MIPS_MACHINE(
+ RAMIPS_MACH_F5D8233_V4,
+ "F5D8233_V4",
+ "Belkin F5D8233-4 v4",
+ f5d8233_init
+);
diff --git a/target/linux/ramips/image/Makefile
b/target/linux/ramips/image/Makefile
index 3c0024b..52f8cd8 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -254,6 +254,13 @@ define BuildFirmware/F5D8235
$(call BuildFirmware/Generic,$(1),$(2),$(call
mkcmdline,$(3),ttyS1,57600) $(call
mkmtd/phys,$(mtdlayout_f5d8235)),$(mtd_f5d8235_kernel_part_size),$(mtd_f5d8235_rootfs_part_size))
endef

+mtdlayout_f5d8233=128k(u-boot)ro,64k(factory)ro,64k(nvram),960k(kernel),2816k(rootfs),64k(sercomm)ro,***@0x40000(firmware)
+mtd_f5d8233_kernel_part_size=983040
+mtd_f5d8233_rootfs_part_size=2883584
+define BuildFirmware/F5D8233
+ $(call BuildFirmware/Generic,$(1),$(2),$(call
mkcmdline,$(3),ttyS1,57600) $(call
mkmtd/phys,$(mtdlayout_f5d8233)),$(mtd_f5d8233_kernel_part_size),$(mtd_f5d8233_rootfs_part_size))
+endef
+
define BuildFirmware/FONERA20N
$(call
BuildFirmware/GENERIC_8M,$(1),fonera20n,FONERA20N,ttyS1,57600,phys)
$(call BuildFirmware/Edimax,$(1),fonera20n,RSDK,NL1T,0x50000,0xc0000)
@@ -412,6 +419,10 @@ define Image/Build/Profile/F5D8235V1
$(call
Image/Build/Template/$(fs_squash)/$(1),F5D8235,f5d8235v1,F5D8235_V1)
endef

+define Image/Build/Profile/F5D8233V4
+ $(call
Image/Build/Template/$(fs_squash)/$(1),F5D8233,f5d8233v4,F5D8233_V4)
+endef
+
define Image/Build/Profile/RTN15
$(call
Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,rt-n15,RT-N15,ttyS1,57600,phys)
endef
@@ -427,6 +438,7 @@ endef
ifeq ($(CONFIG_RALINK_RT288X),y)
define Image/Build/Profile/Default
$(call Image/Build/Profile/F5D8235V1,$(1))
+ $(call Image/Build/Profile/F5D8233V4,$(1))
$(call Image/Build/Profile/RTN15,$(1))
$(call Image/Build/Profile/V11STFE,$(1))
$(call Image/Build/Profile/WLITX4AG300N,$(1))
@@ -677,3 +689,4 @@ define Image/Build
endef

$(eval $(call BuildImage))
+
diff --git a/target/linux/ramips/rt288x/config-3.3
b/target/linux/ramips/rt288x/config-3.3
index d472e64..d0bf44d 100644
--- a/target/linux/ramips/rt288x/config-3.3
+++ b/target/linux/ramips/rt288x/config-3.3
@@ -91,6 +91,7 @@ CONFIG_RALINK_RT288X=y
# CONFIG_RALINK_RT305X is not set
# CONFIG_RALINK_RT3883 is not set
CONFIG_RAMIPS_WDT=y
+CONFIG_RT288X_MACH_F5D8233_V4=y
CONFIG_RT288X_MACH_F5D8235_V1=y
CONFIG_RT288X_MACH_RT_N15=y
CONFIG_RT288X_MACH_V11ST_FE=y
diff --git a/target/linux/ramips/rt288x/profiles/belkin-f5d8233_v4.mk
b/target/linux/ramips/rt288x/profiles/belkin-f5d8233_v4.mk
new file mode 100644
index 0000000..13fedd8
--- /dev/null
+++ b/target/linux/ramips/rt288x/profiles/belkin-f5d8233_v4.mk
@@ -0,0 +1,21 @@
+#
+# Belkin F5D8233 V4 Profile
+#
+# Copyright (C) 2013 Chris Bajumpaa <***@gmail.com>
+#
+# 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.
+#
+
+define Profile/F5D8233V4
+ NAME:=Belkin F5D8233-4 V4
+ PACKAGES:=kmod-switch-ip17xx kmod-swconfig swconfig
+endef
+
+define Profile/F5D8233V4/Description
+ Package set for Belkin F5D8233-4 V4
+endef
+
+$(eval $(call Profile,F5D8233V4))
+

Loading...