[kernel] r12344 - in dists/sid/linux-2.6/debian: . patches/features/arm patches/series

Martin Michlmayr tbm at alioth.debian.org
Sat Oct 18 08:13:28 UTC 2008


Author: tbm
Date: Sat Oct 18 08:13:25 2008
New Revision: 12344

Log:
DNS-323: read MAC address from flash (Matthew Palmer).


Added:
   dists/sid/linux-2.6/debian/patches/features/arm/dns323_mac_addr_read.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/9

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	(original)
+++ dists/sid/linux-2.6/debian/changelog	Sat Oct 18 08:13:25 2008
@@ -94,6 +94,7 @@
   [ Martin Michlmayr ]
   * [arm/ixp4xx] Enable USB_ATM and USB_SPEEDTOUCH (closes: #502182).
   * [arm/iop32x, arm/orion5x] Likewise.
+  * DNS-323: read MAC address from flash (Matthew Palmer).
 
   [ dann frazier ]
   * Restrict access to the DRM_I915_HWS_ADDR ioctl (CVE-2008-3831)

Added: dists/sid/linux-2.6/debian/patches/features/arm/dns323_mac_addr_read.patch
==============================================================================
--- (empty file)
+++ dists/sid/linux-2.6/debian/patches/features/arm/dns323_mac_addr_read.patch	Sat Oct 18 08:13:25 2008
@@ -0,0 +1,111 @@
+Matthew Palmer <mpalmer at hezmatt.org>
+Subject: DNS-323: read MAC address from flash
+
+--- a/arch/arm/mach-orion5x/dns323-setup.c	2008-10-17 21:56:01.000000000 +1100
++++ b/arch/arm/mach-orion5x/dns323-setup.c	2008-10-17 23:04:16.000000000 +1100
+@@ -76,15 +76,6 @@
+ subsys_initcall(dns323_pci_init);
+ 
+ /****************************************************************************
+- * Ethernet
+- */
+-
+-static struct mv643xx_eth_platform_data dns323_eth_data = {
+-	.phy_addr = 8,
+-	.force_phy_addr = 1,
+-};
+-
+-/****************************************************************************
+  * 8MiB NOR flash (Spansion S29GL064M90TFIR4)
+  *
+  * Layout as used by D-Link:
+@@ -143,6 +134,79 @@
+ };
+ 
+ /****************************************************************************
++ * Ethernet
++ */
++
++static struct mv643xx_eth_platform_data dns323_eth_data = {
++	.phy_addr = 8,
++	.force_phy_addr = 1,
++};
++
++/* parse_hex_*() taken from ts209-setup.c; should a common copy of these
++ * functions be kept somewhere?
++ */
++static int __init parse_hex_nibble(char n)
++{
++	if (n >= '0' && n <= '9')
++		return n - '0';
++
++	if (n >= 'A' && n <= 'F')
++		return n - 'A' + 10;
++
++	if (n >= 'a' && n <= 'f')
++		return n - 'a' + 10;
++
++	return -1;
++}
++
++static int __init parse_hex_byte(const char *b)
++{
++	int hi;
++	int lo;
++
++	hi = parse_hex_nibble(b[0]);
++	lo = parse_hex_nibble(b[1]);
++
++	if (hi < 0 || lo < 0)
++		return -1;
++
++	return (hi << 4) | lo;
++}
++
++static int __init dns323_read_mac_addr(void)
++{
++	u_int8_t addr[6] = { 0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF };
++	int i;
++	char *mac_page;
++	
++	/* MAC address is stored as a regular ol' string in /dev/mtdblock4
++	 * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80).
++	 */
++	mac_page = ioremap(DNS323_NOR_BOOT_BASE + 0x7d0000 + 196480, 1024);
++	
++	for (i = 0; i < 6; i++)	{
++		int byte;
++		
++		byte = parse_hex_byte(mac_page + (i * 3));
++		if (byte < 0) {
++			iounmap(mac_page);
++			return -1;
++		}
++		
++		addr[i] = byte;
++	}
++	
++	iounmap(mac_page);
++	printk("DNS323: Found ethernet MAC address: ");
++	for (i = 0; i < 6; i++)
++		printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
++	
++	memcpy(dns323_eth_data.mac_addr, addr, 6);
++	
++	return 0;
++}
++
++/****************************************************************************
+  * GPIO LEDs (simple - doesn't use hardware blinking support)
+  */
+ 
+@@ -305,6 +369,9 @@
+ 	i2c_register_board_info(0, dns323_i2c_devices,
+ 				ARRAY_SIZE(dns323_i2c_devices));
+ 
++	if (dns323_read_mac_addr() < 0)
++		printk("ERROR: Failed to read MAC address\n");
++		
+ 	orion5x_eth_init(&dns323_eth_data);
+ }
+ 

Modified: dists/sid/linux-2.6/debian/patches/series/9
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/9	(original)
+++ dists/sid/linux-2.6/debian/patches/series/9	Sat Oct 18 08:13:25 2008
@@ -8,3 +8,4 @@
 + bugfix/x86/nonpnp-rtc-device-1.patch
 + bugfix/x86/i915-restrict-DRM_I915_HWS_ADDR.patch
 + bugfix/all/dont-allow-splice-to-files-opened-with-O_APPEND.patch
++ features/arm/dns323_mac_addr_read.patch



More information about the Kernel-svn-changes mailing list