Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/cubie Fetch the ethernet address from u-boot...



details:   https://anonhg.NetBSD.org/src/rev/3216379ca7b1
branches:  trunk
changeset: 328841:3216379ca7b1
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Apr 20 10:06:08 2014 +0000

description:
Fetch the ethernet address from u-boot boardinfo and provide it as mac-address
property for ethernet controllers.

diffstat:

 sys/arch/evbarm/cubie/cubie_machdep.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (71 lines):

diff -r a918d1e01c33 -r 3216379ca7b1 sys/arch/evbarm/cubie/cubie_machdep.c
--- a/sys/arch/evbarm/cubie/cubie_machdep.c     Sun Apr 20 04:12:54 2014 +0000
+++ b/sys/arch/evbarm/cubie/cubie_machdep.c     Sun Apr 20 10:06:08 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cubie_machdep.c,v 1.17 2014/04/18 06:53:13 matt Exp $ */
+/*     $NetBSD: cubie_machdep.c,v 1.18 2014/04/20 10:06:08 martin Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.17 2014/04/18 06:53:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.18 2014/04/20 10:06:08 martin Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -185,11 +185,13 @@
 #include <dev/i2c/ddcreg.h>
 
 #include <dev/usb/ukbdvar.h>
+#include <net/if_ether.h>
 
 BootConfig bootconfig;         /* Boot config storage */
 static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL;
 char *boot_file = NULL;
+static uint8_t uboot_enaddr[ETHER_ADDR_LEN];
 
 bool cubietruck_p;
 /*
@@ -329,6 +331,8 @@
        printf("\nNetBSD/evbarm (cubie) booting ...\n");
 #endif
 
+       const uint8_t *uboot_bootinfo = (void*)uboot_args[0];
+
 #ifdef BOOT_ARGS
        char mi_bootargs[] = BOOT_ARGS;
        parse_mi_bootargs(mi_bootargs);
@@ -403,8 +407,16 @@
                             (uboot_args[3] + KERNEL_BASE_VOFFSET);
                        strlcpy(bootargs, args, sizeof(bootargs));
                }
+               if (uboot_args[0]
+                  && uboot_args[0] - AWIN_SDRAM_PBASE < ram_size) {
+                       uboot_bootinfo =
+                           (void*)(uboot_args[0] + KERNEL_BASE_VOFFSET);
+               }
        }
 
+       /* copy u-boot bootinfo ethernet address */
+       memcpy(uboot_enaddr, uboot_bootinfo + 0x250, sizeof(uboot_enaddr));
+
        boot_args = bootargs;
        parse_mi_bootargs(boot_args);
 
@@ -602,6 +614,12 @@
                prop_dictionary_set_uint32(dict, "nc-i", 0x003fc03f);
                return;
        }
+       if (device_is_a(self, "awge") || device_is_a(self, "awe")) {
+               prop_data_t blob =
+                   prop_data_create_data(uboot_enaddr, ETHER_ADDR_LEN);
+               prop_dictionary_set(dict, "mac-address", blob);
+               prop_object_release(blob);
+       }
 
        if (device_is_a(self, "ehci")) {
                return;



Home | Main Index | Thread Index | Old Index