From a5b17a0b82329c69a9bece00fdd5c41b831b57e7 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 17 Jul 2012 11:35:34 -0400 Subject: [PATCH 110/123] 507-MIPS-ath79-prom-add-myloader-support Import of the above patch from openwrt trunk, as of this commit: ---------- commit c1d79f64eed0a7ac36b5b9bca52275b397bec424 Author: nbd Date: Mon Jul 16 16:26:51 2012 +0000 uboot-ar71xx: fix compile on recent mac os x versions git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32750 3c298f89-4303-0410-b956-a3cf2f4a3e73 ---------- Path to patch in the repo is: target/linux/ar71xx/patches-3.3 Repo is: git://nbd.name/openwrt.git Signed-off-by: Paul Gortmaker --- arch/mips/ath79/prom.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/mips/ath79/prom.c b/arch/mips/ath79/prom.c index 2bc1801..f455159 100644 --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c @@ -16,6 +16,7 @@ #include #include +#include #include "common.h" @@ -69,6 +70,37 @@ static const char * __init ath79_prom_find_env(char **envp, const char *name) return ret; } +static int __init ath79_prom_init_myloader(void) +{ + struct myloader_info *mylo; + char mac_buf[32]; + unsigned char *mac; + + mylo = myloader_get_info(); + if (!mylo) + return 0; + + switch (mylo->did) { + case DEVID_COMPEX_WP543: + ath79_prom_append_cmdline("board", "WP543"); + break; + case DEVID_COMPEX_WPE72: + ath79_prom_append_cmdline("board", "WPE72"); + break; + default: + pr_warn("prom: unknown device id: %x\n", mylo->did); + return 0; + } + + mac = mylo->macs[0]; + snprintf(mac_buf, sizeof(mac_buf), "%02x:%02x:%02x:%02x:%02x:%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + + ath79_prom_append_cmdline("ethaddr", mac_buf); + + return 1; +} + static __init void ath79_prom_init_cmdline(int argc, char **argv) { int i; @@ -88,6 +120,9 @@ void __init prom_init(void) const char *env; char **envp; + if (ath79_prom_init_myloader()) + return; + ath79_prom_init_cmdline(fw_arg0, (char **)fw_arg1); envp = (char **)fw_arg2; -- 1.7.9.7