summaryrefslogtreecommitdiffstats
path: root/target/linux/pxa/patches-3.3/004-smsc911x_verdex_pro_support.patch
blob: d2f1c1ae2cf0bf236270c3019036d2c74d2ca9c1 (plain)
1
2
3
4
5
6
7
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699;
From 7645a459feb02f7aae4c3a5724b7800495d1b659 Mon Sep 17 00:00:00 2001
From: Bobby Powers <bobbypowers@gmail.com>
Date: Wed, 28 Oct 2009 22:41:31 -0400
Subject: [PATCH] [ARM] smsc911x: Verdex Pro support

Basically Joseph Kortje's patch, cleaned up to apply to Linus's
tree.  Some of the smsc911x.c had been applied already

Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
---
 drivers/net/smsc911x.c   |   50 +++++++++++++++++++++++++++++++++++++--------
 drivers/net/smsc911x.h   |    2 +-
 include/linux/smsc911x.h |   11 ++++++++++
 3 files changed, 53 insertions(+), 10 deletions(-)

--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1485,7 +1485,7 @@ static int smsc911x_open(struct net_devi
 		SMSC_WARN(pdata, ifup,
 			  "Timed out waiting for EEPROM busy bit to clear");
 
-	smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
+ 	smsc911x_reg_write(pdata, GPIO_CFG, GPIO_CFG_LED1_EN_ | GPIO_CFG_LED2_EN_ | (1 << 20));
 
 	/* The soft reset above cleared the device's MAC address,
 	 * restore it from local copy (set in probe) */
@@ -1497,8 +1497,8 @@ static int smsc911x_open(struct net_devi
 	smsc911x_reg_write(pdata, INT_EN, 0);
 	smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
 
-	/* Set interrupt deassertion to 100uS */
-	intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
+ 	/* Set interrupt deassertion to 22*10uS */
+ 	intcfg = ((22 << 24) | INT_CFG_IRQ_EN_);
 
 	if (pdata->config.irq_polarity) {
 		SMSC_TRACE(pdata, ifup, "irq polarity: active high");
@@ -1524,7 +1524,7 @@ static int smsc911x_open(struct net_devi
 	temp |= INT_EN_SW_INT_EN_;
 	smsc911x_reg_write(pdata, INT_EN, temp);
 
-	timeout = 1000;
+	timeout = 2000;
 	while (timeout--) {
 		if (pdata->software_irq_signal)
 			break;
@@ -2332,6 +2332,38 @@ static inline int smsc911x_probe_config_
 }
 #endif /* CONFIG_OF */
 
+static inline unsigned int is_gumstix_oui(u8 *addr)
+{
+	return (addr[0] == 0x00 && addr[1] == 0x15 && addr[2] == 0xC9);
+}
+
+/**
+ * gen_serial_ether_addr - Generate software assigned Ethernet address
+ * based on the system_serial number
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Generate an Ethernet address (MAC) that is not multicast
+ * and has the local assigned bit set, keyed on the system_serial
+ */
+static inline void gen_serial_ether_addr(u8 *addr)
+{
+	static u8 ether_serial_digit = 0;
+	addr [0] = system_serial_high >> 8;
+	addr [1] = system_serial_high;
+	addr [2] = system_serial_low >> 24;
+	addr [3] = system_serial_low >> 16;
+	addr [4] = system_serial_low >> 8;
+	addr [5] = (system_serial_low & 0xc0) |	/* top bits are from system serial */
+		(1 << 4) |			/* 2 bits identify interface type 1=ether, 2=usb, 3&4 undef */
+		((ether_serial_digit++) & 0x0f);	/* 15 possible interfaces of each type */
+
+	if(!is_gumstix_oui(addr))
+	{
+		addr [0] &= 0xfe;		/* clear multicast bit */
+		addr [0] |= 0x02;		/* set local assignment bit (IEEE802) */
+	}
+}
+
 static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -2481,11 +2513,11 @@ static int __devinit smsc911x_drv_probe(
 			SMSC_TRACE(pdata, probe,
 				   "Mac Address is read from LAN911x EEPROM");
 		} else {
-			/* eeprom values are invalid, generate random MAC */
-			random_ether_addr(dev->dev_addr);
+			/* eeprom values are invalid, generate MAC from serial number */
+			gen_serial_ether_addr(dev->dev_addr);
 			smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
 			SMSC_TRACE(pdata, probe,
-				   "MAC Address is set to random_ether_addr");
+				"MAC Address is derived from system serial number");
 		}
 	}