This patch adds support for the Omnima MiniEMBWiFi Ralink RT3050F based board.

The patch relies on the recently committed changes to the OpenWrt ramips
support to obtain the mac address from the factory partition using
preinit/06_set_iface_mac i.e. use OpenWrt revision 29471 or more recent
with this patch.

Signed-off-by: Ivan Ignjatic<ivan at omnima.co.uk  
<http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel>>

---

Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (revision 29508) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (working copy)
@@ -76,6 +76,12 @@
     select RALINK_DEV_GPIO_BUTTONS
     select RALINK_DEV_GPIO_LEDS

+config RT305X_MACH_OMNI_EMB
+        bool "Omnima MiniEMBWiFi"
+        default y
+        select RALINK_DEV_GPIO_BUTTONS
+        select RALINK_DEV_GPIO_LEDS
+
 endmenu

 endif
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c (revision 0) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c (revision 0)
@@ -0,0 +1,111 @@
+/*
+ *  Omnima MiniEMBWiFi board support
+ *
+ *  Copyright (C) 2011 Johnathan Boyce <[email protected]>
+ *
+ *  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/mtd/physmap.h>
+#include <linux/gpio.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 OMNI_EMB_GPIO_BUTTON_RESET    12 /* active low */
+
+#define OMNI_EMB_BUTTONS_POLL_INTERVAL    20
+
+#define OMNI_EMB_GPIO_LED_STATUS    9
+#define OMNI_EMB_GPIO_LED_WLAN        14
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition emb_partitions[] = {
+    {
+        .name    = "uboot",
+        .offset    = 0,
+        .size    = 0x030000,
+    }, {
+        .name    = "uboot-config",
+        .offset    = 0x030000,
+        .size    = 0x040000,
+        .mask_flags = MTD_WRITEABLE,
+    }, {
+        .name    = "factory",
+        .offset    = 0x040000,
+        .size    = 0x050000,
+        .mask_flags = MTD_WRITEABLE,
+    }, {
+        .name    = "linux",
+        .offset    = 0x050000,
+        .size    = 0x100000,
+    }, {
+        .name    = "rootfs",
+        .offset    = 0x150000,
+        .size    = 0x6B0000,
+    }
+};
+#endif /* CONFIG_MTD_PARTITIONS */
+
+static struct physmap_flash_data omni_emb_flash_data = {
+#ifdef CONFIG_MTD_PARTITIONS
+    .nr_parts    = ARRAY_SIZE(emb_partitions),
+    .parts        = emb_partitions,
+#endif
+};
+
+static struct gpio_led omni_emb_leds_gpio[] __initdata = {
+    {
+        .name           = "emb:green:status",
+        .gpio           = OMNI_EMB_GPIO_LED_STATUS,
+        .active_low     = 1,
+    }, {
+        .name           = "emb:green:wlan",
+        .gpio           = OMNI_EMB_GPIO_LED_WLAN,
+        .active_low     = 1,
+    }
+};
+
+static struct gpio_button omni_emb_gpio_buttons[] __initdata = {
+    {
+        .desc           = "reset",
+        .type           = EV_KEY,
+        .code           = KEY_RESTART,
+        .threshold      = 3,
+        .gpio           = OMNI_EMB_GPIO_BUTTON_RESET,
+        .active_low     = 1,
+    }
+};
+
+static void __init omni_emb_init(void)
+{
+    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
+
+ rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
+
+    ramips_register_gpio_leds(-1, ARRAY_SIZE(omni_emb_leds_gpio),
+                omni_emb_leds_gpio);
+    ramips_register_gpio_buttons(-1, OMNI_EMB_BUTTONS_POLL_INTERVAL,
+                ARRAY_SIZE(omni_emb_gpio_buttons),
+                omni_emb_gpio_buttons);
+
+    rt305x_register_flash(0, &omni_emb_flash_data);
+    rt305x_register_ethernet();
+    rt305x_register_wifi();
+    rt305x_register_wdt();
+    rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_OMNI_EMB, "OMNI-EMB", "Omnima MiniEMBWiFi",
+         omni_emb_init);
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (revision 29508) +++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (working copy)
@@ -26,4 +26,4 @@
 obj-$(CONFIG_RT305X_MACH_WCR150GN)    += mach-wcr150gn.o
 obj-$(CONFIG_RT305X_MACH_WHR_G300N)    += mach-whr-g300n.o
 obj-$(CONFIG_RT305X_MACH_WR512_3GN)    += mach-wr512-3gn.o
-
+obj-$(CONFIG_RT305X_MACH_OMNI_EMB)        += mach-omni-emb.o
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 29508) +++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (working copy)
@@ -37,4 +37,5 @@
     RAMIPS_MACH_WCR150GN,        /* Sparklan WCR-150GN */
     RAMIPS_MACH_WHR_G300N,        /* Buffalo WHR-G300N */
     RAMIPS_MACH_WR512_3GN,        /* SH-WR512NU/WS-WR512N1-like 3GN*/
+    RAMIPS_MACH_OMNI_EMB,             /* Omnima MiniEMBWiFi */
 };
Index: target/linux/ramips/image/Makefile
===================================================================
--- target/linux/ramips/image/Makefile    (revision 29508)
+++ target/linux/ramips/image/Makefile    (working copy)
@@ -181,6 +181,10 @@
     $(call Image/Build/Template/GENERIC_4M,$(1),v22rw-2x2,V22RW-2X2)
 endef

+define Image/Build/Profile/OMNIEMB
+        $(call Image/Build/Template/OMNIEMB,$(1),omni-emb,OMNI-EMB)
+endef
+
 
mtdlayout_whrg300n=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,960k(kernel),2752k(rootfs),64k(user)ro,3712k@0x50000(firmware)
 define Image/Build/Profile/WHRG300N
     $(call Image/Build/Template/GENERIC_4M,$(1),whr-g300n,WHR-G300N)
@@ -237,6 +241,11 @@
$(call BuildFirmware/Generic,$(1),wr512-3gn-8M,board="WR512-3GN",mtdlayout_wr5123gn8m,851968,7208960)
 endef

+console_OMNIEMB=ttyS1,57600
+mtdlayout_ONMIEMB=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,1024k(kernel),6848k(rootfs),7872k@0x50000(firmware)
+define Image/Build/Template/OMNIEMB
+ $(call BuildFirmware/Generic,$(1),$(2),board=$(3) console=$(console_OMNIEMB),mtdlayout_OMNIEMB,1048576,7012352)
+endef

 ifeq ($(CONFIG_RALINK_RT305X),y)
 define Image/Build/Profile/Default
@@ -255,6 +264,7 @@
     $(call Image/Build/Profile/HW5503G,$(1))
     $(call Image/Build/Profile/MOFI35003GN,$(1))
     $(call Image/Build/Profile/WR5123GN,$(1))
+    $(call Image/Build/Profile/OMNIEMB,$(1))
 endef
 endif

Index: target/linux/ramips/rt305x/config-2.6.39
===================================================================
--- target/linux/ramips/rt305x/config-2.6.39    (revision 29508)
+++ target/linux/ramips/rt305x/config-2.6.39    (working copy)
@@ -106,6 +106,7 @@
 CONFIG_RT305X_MACH_WCR150GN=y
 CONFIG_RT305X_MACH_WHR_G300N=y
 CONFIG_RT305X_MACH_WR512_3GN=y
+CONFIG_RT305X_MACH_OMNI_EMB=y
 # CONFIG_SCSI_DMA is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_RT288X=y
Index: target/linux/ramips/base-files/lib/ramips.sh
===================================================================
--- target/linux/ramips/base-files/lib/ramips.sh    (revision 29508)
+++ target/linux/ramips/base-files/lib/ramips.sh    (working copy)
@@ -104,6 +104,9 @@
     *"WR512-3GN-like router")
         name="wr512-3gn"
         ;;
+    *"Omnima MiniEMBWiFi")
+        name="omni-emb"
+        ;;
     *)
         name="generic"
         ;;
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ramips/base-files/lib/upgrade/platform.sh (revision 29508)
+++ target/linux/ramips/base-files/lib/upgrade/platform.sh    (working copy)
@@ -26,7 +26,8 @@
     rt-g32-b1 | \
     rt-n15 | \
     v22rw-2x2 | \
-    whr-g300n)
+    whr-g300n | \
+    omni-emb)
         [ "$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 29508) +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
@@ -20,7 +20,8 @@
                 ifconfig eth0 hw ether $mac 2>/dev/null
                 ;;
     hw550-3g |\
-    nbg-419n)
+    nbg-419n |\
+    omni-emb)
         mac=$(ramips_get_mac_binary factory 40)
         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 29508) +++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (working copy)
@@ -57,7 +57,8 @@
     v22rw-2x2 | \
     wcr-150gn | \
     whr-g300n | \
-    wr512-3gn)
+    wr512-3gn | \
+    omni-emb)
         rt2x00_eeprom_extract "factory" 0 272
         ;;


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to