OpenWrt Forum Archive

Topic: [solved] Huawei HG532

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Thanks to hnyman and routednbooted for the patch...

I have a working build-root and sucessfully build latest trunk firmware for my boxes wzr hpg300nh,tplink 3420 and 701nd..i have huawei hg532b lying in my cabinet and wonder if openwrt support this device..then i found this link https://forum.openwrt.org/viewtopic.php?id=37964..he forgot to upload or share his firmware,,and i want to build trunk firmware for this device..
he post this patch but how can i add this patch to my build-root

Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig    (revision 32650)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig    (working copy)
@@ -154,6 +154,11 @@
     select RALINK_DEV_GPIO_BUTTONS
     select RALINK_DEV_GPIO_LEDS
 
+config RT305X_MACH_HG532
+    bool "Huawei Echolife HG532 B1.01"
+    select RALINK_DEV_GPIO_BUTTONS
+    select RALINK_DEV_GPIO_LEDS
+
 endmenu
 
 endif
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile    (revision 32650)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile    (working copy)
@@ -42,3 +42,4 @@
 obj-$(CONFIG_RT305X_MACH_WL351)        += mach-wl351.o
 obj-$(CONFIG_RT305X_MACH_WR6202)    += mach-wr6202.o
 obj-$(CONFIG_RT305X_MACH_XDX_RN502J)    += mach-xdx-rn502j.o
+obj-$(CONFIG_RT305X_MACH_HG532)    += mach-hg532.o
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c    (revision 0)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hg532.c    (revision 0)
@@ -0,0 +1,107 @@
+/*
+ *  Hauwei EcholifeHG532 board support
+ *  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/rt305x.h>
+#include <asm/mach-ralink/rt305x_regs.h>
+
+#include "devices.h"
+
+#define HG532_GPIO_LED_POWER_GREEN    8
+#define HG532_GPIO_LED_POWER_RED    11
+#define HG532_GPIO_LED_INTERNET_GREEN    14
+#define HG532_GPIO_LED_INTERNET_RED    13
+#define HG532_GPIO_LED_USB        9
+
+#define HG532_GPIO_BUTTON_WPS    0
+#define HG532_GPIO_BUTTON_WLAN    10
+#define HG532_GPIO_BUTTON_RESET     4
+
+#define HG532_KEYS_POLL_INTERVAL    20
+#define HG532_KEYS_DEBOUNCE_INTERVAL (3 * HG532_KEYS_POLL_INTERVAL)
+
+static struct gpio_led hg532_leds_gpio[] __initdata = {
+    {
+        .name        = "hg532:power:green",
+        .gpio        = HG532_GPIO_LED_POWER_GREEN,
+        .active_low    = 1,
+    }, {
+        .name        = "hg532:power:red",
+        .gpio        = HG532_GPIO_LED_POWER_RED,
+        .active_low    = 1,
+    }, {
+        .name        = "hg532:internet:green",
+        .gpio        = HG532_GPIO_LED_INTERNET_GREEN,
+        .active_low    = 1,
+    }, {
+        .name        = "hg532:internet:red",
+        .gpio        = HG532_GPIO_LED_INTERNET_RED,
+        .active_low    = 1,
+    }, {
+        .name        = "hg532:usb",
+        .gpio        = HG532_GPIO_LED_USB,
+        .active_low    = 1,
+    }
+};
+
+static struct gpio_keys_button hg532_gpio_buttons[] __initdata = {
+    {
+        .desc        = "wps",
+        .type        = EV_KEY,
+        .code        = BTN_1,
+        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+        .gpio        = HG532_GPIO_BUTTON_WPS,
+        .active_low    = 1,
+    }, {
+        .desc        = "wlan",
+        .type        = EV_KEY,
+        .code        = KEY_WLAN,
+        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+        .gpio        = HG532_GPIO_BUTTON_WLAN,
+        .active_low    = 1,
+    }, {
+        .desc        = "reset",
+        .type        = EV_KEY,
+        .code        = BTN_2,
+        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
+        .gpio        = HG532_GPIO_RESET,
+        .active_low    = 1,
+    }
+
+};
+#define HG532_GPIO_MODE \
+    ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
+     RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI)
+//RT305X_GPIO_MODE_GPIO | RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI | RT305X_GPIO_MODE_UART1 | RT305X_GPIO_MODE_MDIO
+
+static void __init hg532_init(void)
+{
+    rt305x_gpio_init(HG532_GPIO_MODE);
+
+    rt305x_register_flash(0);
+
+    ramips_register_gpio_leds(-1, ARRAY_SIZE(hg532_leds_gpio),
+                  hg532_leds_gpio);
+
+    ramips_register_gpio_buttons(-1, HG532_KEYS_POLL_INTERVAL,
+                     ARRAY_SIZE(hg532_gpio_buttons),
+                     hg532_gpio_buttons);
+
+    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
+    rt305x_register_ethernet();
+    rt305x_register_wifi();
+    rt305x_register_wdt();
+    rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_HG532, "HG532", "Hauwei Echolife HG532",
+         hg532_init); 
Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
===================================================================
--- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h    (revision 32650)
+++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h    (working copy)
@@ -57,6 +57,7 @@
     RAMIPS_MACH_WR6202,        /* Accton WR6202 */
     RAMIPS_MACH_XDXRN502J,          /* unknown XDX-RN502J */
     RAMIPS_MACH_UR_336UN,        /* UPVEL ROUTER */
+    RAMIPS_MACH_HG532,        /* Huawei Echolife HG532 */
 
     /* RT3662 based machines */
     RAMIPS_MACH_RT_N56U,        /* Asus RT-N56U */
Index: target/linux/ramips/image/Makefile
===================================================================
--- target/linux/ramips/image/Makefile    (revision 32650)
+++ target/linux/ramips/image/Makefile    (working copy)
@@ -442,6 +442,10 @@
     $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,xdxrn502j,XDXRN502J,ttyS1,57600,phys)
 endef
 
+define Image/Build/Profile/HG532
+    $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,hg532,HG532,ttyS1,57600,phys)
+endef
+
 ifeq ($(CONFIG_RALINK_RT305X),y)
 define Image/Build/Profile/Default
     $(call Image/Build/Profile/ALL0256N,$(1))
@@ -474,6 +478,7 @@
     $(call Image/Build/Profile/WR5123GN,$(1))
     $(call Image/Build/Profile/WR6202,$(1))
     $(call Image/Build/Profile/XDXRN502J,$(1))
+    $(call Image/Build/Profile/HG532,$(1))
 endef
 endif
 
Index: target/linux/ramips/rt305x/config-3.3
===================================================================
--- target/linux/ramips/rt305x/config-3.3    (revision 32650)
+++ target/linux/ramips/rt305x/config-3.3    (working copy)
@@ -21,6 +21,7 @@
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CSRC_R4K=y
 CONFIG_CSRC_R4K_LIB=y
+CONFIG_DEBUG_GPIO=y
 CONFIG_DECOMPRESS_LZMA=y
 CONFIG_DMA_NONCOHERENT=y
 # CONFIG_DWC_OTG is not set
@@ -60,7 +61,8 @@
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_IRQ_CPU=y
 CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_M25PXX_USE_FAST_READ=y
+# CONFIG_ISDN is not set
+CONFIG_LEDS_GPIO=y
 CONFIG_MDIO_BOARDINFO=y
 # CONFIG_MII is not set
 CONFIG_MIPS=y
@@ -70,13 +72,21 @@
 CONFIG_MIPS_RALINK=y
 # CONFIG_MTD_CFI_INTELEXT is not set
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_M25P80=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NET_RAMIPS=y
 # CONFIG_NET_RAMIPS_DEBUG is not set
 # CONFIG_NET_RAMIPS_DEBUG_FS is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CHELSIO is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PHYLIB=y
@@ -86,7 +96,7 @@
 # CONFIG_RALINK_RT288X is not set
 CONFIG_RALINK_RT305X=y
 # CONFIG_RALINK_RT3883 is not set
-CONFIG_RAMIPS_WDT=y
+CONFIG_REALTEK_PHY=y
 CONFIG_RT305X_MACH_ALL0256N=y
 CONFIG_RT305X_MACH_ARGUS_ATP52B=y
 CONFIG_RT305X_MACH_BC2=y
@@ -95,6 +105,7 @@
 CONFIG_RT305X_MACH_F5D8235_V2=y
 CONFIG_RT305X_MACH_FONERA20N=y
 CONFIG_RT305X_MACH_FREESTATION5=y
+CONFIG_RT305X_MACH_HG532=y
 CONFIG_RT305X_MACH_HW550_3G=y
 CONFIG_RT305X_MACH_MOFI3500_3GN=y
 CONFIG_RT305X_MACH_NBG_419N=y
@@ -124,9 +135,8 @@
 # CONFIG_SLAB is not set
 CONFIG_SLUB=y
 CONFIG_SOC_RT305X=y
-CONFIG_SPI=y
-CONFIG_SPI_MASTER=y
-CONFIG_SPI_RAMIPS=y
+# CONFIG_STAGING is not set
+CONFIG_SWCONFIG=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_SYS_HAS_CPU_MIPS32_R2=y
 CONFIG_SYS_HAS_EARLY_PRINTK=y
@@ -137,5 +147,7 @@
 # CONFIG_USB_ARCH_HAS_OHCI is not set
 # CONFIG_USB_ARCH_HAS_XHCI is not set
 CONFIG_USB_SUPPORT=y
+# CONFIG_WATCHDOG is not set
+# CONFIG_WLAN is not set
 CONFIG_XZ_DEC=y
 CONFIG_ZONE_DMA_FLAG=0
Index: target/linux/ramips/base-files/lib/ramips.sh
===================================================================
--- target/linux/ramips/base-files/lib/ramips.sh    (revision 32650)
+++ target/linux/ramips/base-files/lib/ramips.sh    (working copy)
@@ -164,6 +164,9 @@
     *"XDX RN502J")
         name="xdxrn502j"
         ;;
+    *"HG532")
+        name="hg532"
+        ;;
     *)
         name="generic"
         ;;
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ramips/base-files/lib/upgrade/platform.sh    (revision 32650)
+++ target/linux/ramips/base-files/lib/upgrade/platform.sh    (working copy)
@@ -43,7 +43,8 @@
     wli-tx4-ag300n | \
     whr-g300n |\
     ur-336un |\
-    wr512-3gn)
+    wr512-3gn|\
+    hg532)
         [ "$magic" != "2705" ] && {
             echo "Invalid image type."
             return 1
Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
===================================================================
--- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac    (revision 32650)
+++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac    (working copy)
@@ -14,7 +14,8 @@
     nw718 |\
     psr-680w |\
     rt-n56u |\
-    sl-r7205)
+    sl-r7205|\
+    hg532)
         mac=$(ramips_get_mac_binary factory 4)
         mac=$(maccalc or "$mac" "02:00:00:00:00:00")
         ifconfig eth0 hw ether $mac 2>/dev/null
Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
===================================================================
--- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom    (revision 32650)
+++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom    (working copy)
@@ -84,6 +84,9 @@
     wl341v3)
         rt2x00_eeprom_extract "board-nvram" 64880 272
         ;;
+    hg532)    
+        rt2x00_eeprom_extract "firmware" 0 272
+        ;;
 
     *)
         rt2x00_eeprom_die "board $board is not supported yet"
Index: target/linux/ramips/base-files/etc/uci-defaults/network
===================================================================
--- target/linux/ramips/base-files/etc/uci-defaults/network    (revision 32650)
+++ target/linux/ramips/base-files/etc/uci-defaults/network    (working copy)
@@ -27,7 +27,8 @@
     psr-680w | \
     sl-r7205 | \
     w502u | \
-    wr6202)
+    wr6202 |\
+    hg532)
         ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
         ;;
 
@@ -97,7 +98,8 @@
     psr-680w | \
     rt-n15 | \
     sl-r7205 | \
-    wl-351)
+    wl-351 |\
+    hg532)
         lan_mac=$(ramips_get_mac_binary factory 4)
         wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
         ;;

(Last edited by jefbuan on 3 Nov 2012, 13:11)

got it..

patch -pO -i hg532.diff

Hope someone could help me..i cant build my firmware after applying the patch manually..(edit file using vim edtior and inserting those lines)..
here's my error log

make[5]: Entering directory `/home/jb/openwrt/trunk/build_dir/linux-ramips_rt305x/linux-3.3.8'
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      init/main.o
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/do_mounts_initrd.o
  LD      init/mounts.o
  CC      init/initramfs.o
  CC      init/calibrate.o
  LD      init/built-in.o
  HOSTCC  usr/gen_init_cpio
  GEN     usr/initramfs_data.cpio
  AS      usr/initramfs_data.o
  LD      usr/built-in.o
  CC      arch/mips/ralink/common/prom.o
  CC      arch/mips/ralink/common/setup.o
  CC      arch/mips/ralink/common/intc.o
  CC      arch/mips/ralink/common/gpio.o
  CC      arch/mips/ralink/common/dev-gpio-buttons.o
  CC      arch/mips/ralink/common/dev-gpio-leds.o
  LD      arch/mips/ralink/common/built-in.o
  CC      arch/mips/ralink/rt305x/irq.o
  CC      arch/mips/ralink/rt305x/setup.o
  CC      arch/mips/ralink/rt305x/devices.o
  CC      arch/mips/ralink/rt305x/rt305x.o
  CC      arch/mips/ralink/rt305x/clock.o
  CC      arch/mips/ralink/rt305x/early_printk.o
  CC      arch/mips/ralink/rt305x/mach-3g-6200n.o
  CC      arch/mips/ralink/rt305x/mach-argus-atp52b.o
  CC      arch/mips/ralink/rt305x/mach-bc2.o
  CC      arch/mips/ralink/rt305x/mach-all0256n.o
  CC      arch/mips/ralink/rt305x/mach-all5002.o
  CC      arch/mips/ralink/rt305x/mach-carambola.o
  CC      arch/mips/ralink/rt305x/mach-dir-300-revb.o
  CC      arch/mips/ralink/rt305x/mach-dir-615-h1.o
  CC      arch/mips/ralink/rt305x/mach-dap-1350.o
  CC      arch/mips/ralink/rt305x/mach-esr-9753.o
  CC      arch/mips/ralink/rt305x/mach-f5d8235-v2.o
  CC      arch/mips/ralink/rt305x/mach-fonera20n.o
  CC      arch/mips/ralink/rt305x/mach-freestation5.o
  CC      arch/mips/ralink/rt305x/mach-hw550-3g.o
  CC      arch/mips/ralink/rt305x/mach-mofi3500-3gn.o
  CC      arch/mips/ralink/rt305x/mach-nbg-419n.o
  CC      arch/mips/ralink/rt305x/mach-nw718.o
  CC      arch/mips/ralink/rt305x/mach-omni-emb.o
  CC      arch/mips/ralink/rt305x/mach-psr-680w.o
  CC      arch/mips/ralink/rt305x/mach-pwh2004.o
  CC      arch/mips/ralink/rt305x/mach-rt-g32-revb.o
  CC      arch/mips/ralink/rt305x/mach-rt-n10-plus.o
  CC      arch/mips/ralink/rt305x/mach-sl-r7205.o
  CC      arch/mips/ralink/rt305x/mach-v22rw-2x2.o
  CC      arch/mips/ralink/rt305x/mach-w306r-v20.o
  CC      arch/mips/ralink/rt305x/mach-w502u.o
  CC      arch/mips/ralink/rt305x/mach-wcr150gn.o
  CC      arch/mips/ralink/rt305x/mach-whr-g300n.o
  CC      arch/mips/ralink/rt305x/mach-wr512-3gn.o
  CC      arch/mips/ralink/rt305x/mach-ur-336un.o
  CC      arch/mips/ralink/rt305x/mach-wl-330n.o
  CC      arch/mips/ralink/rt305x/mach-wl-330n3g.o
  CC      arch/mips/ralink/rt305x/mach-wl341v3.o
  CC      arch/mips/ralink/rt305x/mach-wl351.o
  CC      arch/mips/ralink/rt305x/mach-wr6202.o
  CC      arch/mips/ralink/rt305x/mach-xdx-rn502j.o
  CC      arch/mips/ralink/rt305x/mach-hg532.o
arch/mips/ralink/rt305x/mach-hg532.c:76:24: error: 'HG532_GPIO_RESET' undeclared here (not in a function)
make[6]: *** [arch/mips/ralink/rt305x/mach-hg532.o] Error 1
make[5]: *** [arch/mips/ralink/rt305x] Error 2
make[5]: Leaving directory `/home/jb/openwrt/trunk/build_dir/linux-ramips_rt305x/linux-3.3.8'
make[4]: *** [/home/jb/openwrt/trunk/build_dir/linux-ramips_rt305x/linux-3.3.8/.image] Error 2
make[4]: Leaving directory `/home/jb/openwrt/trunk/target/linux/ramips'
make[3]: *** [install] Error 2
make[3]: Leaving directory `/home/jb/openwrt/trunk/target/linux'
make[2]: *** [target/linux/install] Error 2
make[2]: Leaving directory `/home/jb/openwrt/trunk'
make[1]: *** [/home/jb/openwrt/trunk/staging_dir/target-mipsel_r2_uClibc-0.9.33.2/stamp/.target_install] Error 2
make[1]: Leaving directory `/home/jb/openwrt/trunk'
make: *** [world] Error 2

here's /mach-hg532.c file

/*
 *  Hauwei EcholifeHG532 board support
 *  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/rt305x.h>
#include <asm/mach-ralink/rt305x_regs.h>

#include "devices.h"

#define HG532_GPIO_LED_POWER_GREEN    8
#define HG532_GPIO_LED_POWER_RED    11
#define HG532_GPIO_LED_INTERNET_GREEN    14
#define HG532_GPIO_LED_INTERNET_RED    13
#define HG532_GPIO_LED_USB        9

#define HG532_GPIO_BUTTON_WPS    0
#define HG532_GPIO_BUTTON_WLAN    10
#define HG532_GPIO_BUTTON_RESET     4

#define HG532_KEYS_POLL_INTERVAL    20
#define HG532_KEYS_DEBOUNCE_INTERVAL (3 * HG532_KEYS_POLL_INTERVAL)

static struct gpio_led hg532_leds_gpio[] __initdata = {
    {
        .name        = "hg532:power:green",
        .gpio        = HG532_GPIO_LED_POWER_GREEN,
        .active_low    = 1,
    }, {
        .name        = "hg532:power:red",
        .gpio        = HG532_GPIO_LED_POWER_RED,
        .active_low    = 1,
    }, {
        .name        = "hg532:internet:green",
        .gpio        = HG532_GPIO_LED_INTERNET_GREEN,
        .active_low    = 1,
    }, {
        .name        = "hg532:internet:red",
        .gpio        = HG532_GPIO_LED_INTERNET_RED,
        .active_low    = 1,
    }, {
        .name        = "hg532:usb",
        .gpio        = HG532_GPIO_LED_USB,
        .active_low    = 1,
    }
};

static struct gpio_keys_button hg532_gpio_buttons[] __initdata = {
    {
        .desc        = "wps",
        .type        = EV_KEY,
        .code        = BTN_1,
        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = HG532_GPIO_BUTTON_WPS,
        .active_low    = 1,
    }, {
        .desc        = "wlan",
        .type        = EV_KEY,
        .code        = KEY_WLAN,
        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = HG532_GPIO_BUTTON_WLAN,
        .active_low    = 1,
    }, {
        .desc        = "reset",
        .type        = EV_KEY,
        .code        = BTN_2,
        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = HG532_GPIO_RESET,
        .active_low    = 1,
    }

};
#define HG532_GPIO_MODE \
    ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
     RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI)
//RT305X_GPIO_MODE_GPIO | RT305X_GPIO_MODE_I2C | RT305X_GPIO_MODE_SPI | RT305X_GPIO_MODE_UART1 | RT305X_GPIO_MODE_MDIO

static void __init hg532_init(void)
{
    rt305x_gpio_init(HG532_GPIO_MODE);

    rt305x_register_flash(0);

    ramips_register_gpio_leds(-1, ARRAY_SIZE(hg532_leds_gpio),
                  hg532_leds_gpio);

    ramips_register_gpio_buttons(-1, HG532_KEYS_POLL_INTERVAL,
                     ARRAY_SIZE(hg532_gpio_buttons),
                     hg532_gpio_buttons);

    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
    rt305x_register_ethernet();
    rt305x_register_wifi();
    rt305x_register_wdt();
    rt305x_register_usb();
}

MIPS_MACHINE(RAMIPS_MACH_HG532, "HG532", "Hauwei Echolife HG532",
         hg532_init); 

To me it looks like the patch has a mismatch between definition and later usage. _BUTTON_ is part of the defined name, but is missing from the later use code.  HG532_GPIO_BUTTON_RESET vs. HG532_GPIO_RESET.

jefbuan wrote:

...
#define HG532_GPIO_BUTTON_WPS    0
#define HG532_GPIO_BUTTON_WLAN    10
#define HG532_GPIO_BUTTON_RESET     4
...

        .desc        = "wlan",
        .type        = EV_KEY,
        .code        = KEY_WLAN,
        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = HG532_GPIO_BUTTON_WLAN,
        .active_low    = 1,
    }, {
        .desc        = "reset",
        .type        = EV_KEY,
        .code        = BTN_2,
        .debounce_interval = HG532_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = HG532_GPIO_RESET,
        .active_low    = 1,
    }

thanks i saw it and i add _button_..il try to recompile..

thanks hnyman for helping me out..compiled succesfully...

(Last edited by jefbuan on 3 Nov 2012, 13:09)

Thank You!!!

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.

## Booting image at bf020000 ...
   Image Name:   Linux Kernel Image
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    3449898 Bytes =  3.3 MB
   Load Address: 80000000
   Entry Point:  80314000
   Verifying Checksum ... OK
  IH_COMP_LZMA Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80314000) ...
## Giving linux memsize in MB, 16

Starting kernel ...

Im trying to load my compiled firmware and connected via serial,,i cant get to pass uboot tftp mode..even if i press 2 several times.it just boot its original firmware.any settings on putty?my serial setting 57600,8N1 .any idea??

(Last edited by jefbuan on 6 Nov 2012, 14:29)

The discussion might have continued from here.