Patchwork Add basic support for smsc9311 in smsc911x Driver

login
register
mail settings
Submitter Fernando
Date Feb. 15, 2011, 2:57 p.m.
Message ID <20110215125708.79245312@SyspacSw04>
Download mbox | patch
Permalink /patch/83261/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Fernando - Feb. 15, 2011, 2:57 p.m.
The smsc9311 chip is an switch chip with 3 ports that have almost the same
register structure of the LAN9115. There are some differences in IRQ regs,
but that doesn't seem to be a problem right now.

This patch was tested on a Torpedo (OMAP35x) based board and is based on
v2.6.38-rc4.

Fernando

From e987729802dd3980041fd7e48e68f3a9f53424bd Mon Sep 17 00:00:00 2001
From: Fernando Governatore <fernando@syspac.com.br>
Date: Tue, 15 Feb 2011 12:10:22 -0200
Subject: [PATCH] Add basic support for smsc9311 in smsc911x Driver

  The smsc9311 chip is an switch chip with three ports.
Here is assumed that only the first one is connected to
the host.

  Makes the driver aware of the chip revision id.

  If no external phy is being used, mask out all the PHY
IDs that are not present by default.

  The default switch configuration is not changed.
---
 drivers/net/smc911x.h  |    2 ++
 drivers/net/smsc911x.c |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
David Miller - Feb. 22, 2011, 5:37 p.m.
From: Fernando <fernando@syspac.com.br>
Date: Tue, 15 Feb 2011 12:57:08 -0200

> 
> The smsc9311 chip is an switch chip with 3 ports that have almost the same
> register structure of the LAN9115. There are some differences in IRQ regs,
> but that doesn't seem to be a problem right now.
> 
> This patch was tested on a Torpedo (OMAP35x) based board and is based on
> v2.6.38-rc4.

Please submit your patch properly as per the directions in
Documentation/SubmittingPatches, in particular you forgot to
provide a proper Signed-off-by: line in your commit message.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 3269292..5e336d2 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -687,6 +687,7 @@  smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr,
 #define CHIP_9215	0x115A
 #define CHIP_9217	0x117A
 #define CHIP_9218	0x118A
+#define CHIP_9311	0x9311
 
 struct chip_id {
 	u16 id;
@@ -702,6 +703,7 @@  static const struct chip_id chip_ids[] =  {
 	{ CHIP_9215, "LAN9215" },
 	{ CHIP_9217, "LAN9217" },
 	{ CHIP_9218, "LAN9218" },
+	{ CHIP_9311, "LAN9311" },
 	{ 0, NULL },
 };
 
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 64bfdae..483fdbd 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -856,6 +856,7 @@  static int __devinit smsc911x_mii_init(struct platform_device *pdev,
 	case 0x01150000:
 	case 0x117A0000:
 	case 0x115A0000:
+	case 0x93110000:
 		/* External PHY supported, try to autodetect */
 		smsc911x_phy_initialise_external(pdata);
 		break;
@@ -867,8 +868,15 @@  static int __devinit smsc911x_mii_init(struct platform_device *pdev,
 	}
 
 	if (!pdata->using_extphy) {
-		/* Mask all PHYs except ID 1 (internal) */
-		pdata->mii_bus->phy_mask = ~(1 << 1);
+		/* Mask all PHYs except internal IDs */
+		switch(pdata->idrev & 0xFFFF0000){
+		case 0x93110000:
+			pdata->mii_bus->phy_mask = ~(1 << 0) & ~(1 << 1) & ~(1 << 2);
+			break;
+		default:
+			pdata->mii_bus->phy_mask = ~(1 << 1);
+			break;
+		}
 	}
 
 	if (mdiobus_register(pdata->mii_bus)) {
@@ -1870,7 +1878,8 @@  static int __devinit smsc911x_init(struct net_device *dev)
 	case 0x92110000:
 	case 0x92200000:
 	case 0x92210000:
-		/* LAN9210/LAN9211/LAN9220/LAN9221 */
+	case 0x93110000:
+		/* LAN9210/LAN9211/LAN9220/LAN9221/LAN9311 */
 		pdata->generation = 4;
 		break;