[PATCH] [GTA02] Use different MACs for the host and for the device ends of usb link

Paul Fertser fercerpav at gmail.com
Sun May 24 00:26:05 CEST 2009


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.
---
 src/cpu/s3c2442/gta02.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/cpu/s3c2442/gta02.c b/src/cpu/s3c2442/gta02.c
index e9bc0a3..ae62158 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 char,
+ * return 1 if overflow occured
+ */
+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
@@ -632,10 +648,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="));
+	if (inc_hexchar(&mac[18]))
+		if (inc_hexchar(&mac[17]))
+			if (inc_hexchar(&mac[15]))
+				if (inc_hexchar(&mac[14]))
+					if (inc_hexchar(&mac[12]))
+						inc_hexchar(&mac[11]);
+
+	cmdline += strlen(strcpy(cmdline, " g_ether.host_addr="));
 	cmdline += strlen(strcpy(cmdline, &mac[2]));
 	*cmdline++ = ' ' ;
 bail:
-- 
1.6.0.6




More information about the openmoko-kernel mailing list