On Sat, May 23, 2009 at 7:26 PM, Paul Fertser <[email protected]> wrote: > This makes Qi consistent with current SHR boot script. It assigns MAC > specified on the identity partition to device and the next address to > host.
Paul, I sent a fixed patch. I think this is what you meant. If not please let us know. I applied the suggestions Werner made. Thanks.
From: Paul Fertser <[email protected]> Date: Thu, 28 May 2009 20:01:20 -0300 Subject: [PATCH][GTA02] Use different MACs for the host and for the device ends of usb link This makes Qi consistent with current SHR boot script. It assigns the MAC specified on the identity partition to the device and the next address to the host, ie: from "g_ether.dev_addr=00:1F:11:01:58:67" generate "g_ether.host_addr=00:1F:11:01:58:68". Signed-off-by: Paul Fertser <[email protected]> diff --git a/src/cpu/s3c2442/gta02.c b/src/cpu/s3c2442/gta02.c index e9bc0a3..1a31274 100644 --- a/src/cpu/s3c2442/gta02.c +++ b/src/cpu/s3c2442/gta02.c @@ -558,6 +558,22 @@ void post_serial_init_gta02(void) puts("BATTERY CONDITION LOW\n"); } +/* + * Increment a hexadecimal digit represented by a char and + * return 1 if an overflow occured. + */ +static char inc_hexchar(char * p) +{ + if (*p == '9') + *p = 'A'; + else if (*p != 'F') + (*p)++; + else { + *p = '0'; + return 1; + } + return 0; +} /* * create and append device-specific Linux kernel commandline @@ -569,6 +585,7 @@ void post_serial_init_gta02(void) char * append_device_specific_cmdline_gta02(char * cmdline) { int n = 0; + int i; int len; static char mac[64]; struct kernel_source const * real_kernel = this_kernel; @@ -632,10 +649,17 @@ char * append_device_specific_cmdline_gta02(char * cmdline) mac[len] = '\0'; - cmdline += strlen(strcpy(cmdline, " g_ether.host_addr=")); + cmdline += strlen(strcpy(cmdline, " g_ether.dev_addr=")); cmdline += strlen(strcpy(cmdline, &mac[2])); - cmdline += strlen(strcpy(cmdline, " g_ether.dev_addr=")); + for (i = 0; i != 10; i++) { + if ((i % 3) == 2) + continue; + if (!inc_hexchar(mac + 18 - i)) + break; /* Carry not needed. */ + } + + cmdline += strlen(strcpy(cmdline, " g_ether.host_addr=")); cmdline += strlen(strcpy(cmdline, &mac[2])); *cmdline++ = ' ' ; bail:
