netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Extend smc911x to support LAN921x chips - differences?
@ 2008-09-09 15:26 Steve.Glendinning
  2008-09-09 16:18 ` Guennadi Liakhovetski
  2008-09-09 20:08 ` Peter Korsgaard
  0 siblings, 2 replies; 17+ messages in thread
From: Steve.Glendinning @ 2008-09-09 15:26 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: netdev, Ian.Saturley

Hi Guennadi,

> I have to support the LAN9215 chip from SMSC under Linux. Of course, 
there 
> is the manufacturer provided smsc911x driver, that supports both chip 
> families, but I would prefer to extend the mainline smc911x driver to 
also 
> support 921x. I have both datasheets, they are freely downloadable from 
> SMSC site, and I have both drivers, but they are absolutely different. 
To 
> make my decision and the work easier - maybe someone knows from the top 
of 
> their head, what the relevant differences between the chips are?
> 
> The vendor driver does not really differentiate between the chips. It 
does 
> read the chip version, and sets the "generation" variable, but then that 

> variable is only used once to rule out the oldest chips, which anyway 
are 
> not supported by smc911x. So I tried the in-kernel driver with only 
added 
> chip IDs added, it can access registers, read and write the MAC-address, 

> interrupts are generated too, but so far I see nothing on the wire, and 
> the PHY reports "link down".

Did you have the in-tree driver succesfully working with LAN9115?

The only hardware difference between the two is that LAN921[5678] has an
Auto-MDIX PHY.  This adds a configuration bit in one of the 
vendor-specific
PHY registers to force the feature off, but it defaults to Auto-MDIX 
enabled.
All of the SCR and MAC registers (and the remaining PHY registers) are 
*identical*, so any working driver should just need the ID register
changing to recognise the newer part.

Early revisions of LAN911X had a hardware bug which is most commonly
experienced when joining/leaving multicast groups.  The smsc911x driver
contains a workaround for this, but the in-tree driver does not.  LAN921X
came after this was fixed in hardware, so this workaround is not 
necessary.

The vast majority of users i've worked with have ended up using the
out-of-tree smsc911x driver, as it "just works" on many platforms.
I'll be re-submitting another candidate when I've finished working on the
LAN9500 USB ethernet driver, but for now the latest submission:

http://marc.info/?l=linux-netdev&m=121240395122475&w=2

Regards,
--
Steve Glendinning
SMSC GmbH
m: +44 777 933 9124
e: steve.glendinning@smsc.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Extend smc911x to support LAN921x chips - differences?
  2008-09-09 15:26 Extend smc911x to support LAN921x chips - differences? Steve.Glendinning
@ 2008-09-09 16:18 ` Guennadi Liakhovetski
  2008-09-09 20:08 ` Peter Korsgaard
  1 sibling, 0 replies; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-09-09 16:18 UTC (permalink / raw)
  To: Steve.Glendinning; +Cc: netdev, Ian.Saturley

Hi Steve,

On Tue, 9 Sep 2008, Steve.Glendinning@smsc.com wrote:

> Did you have the in-tree driver succesfully working with LAN9115?

I haven't used smc911x for a while, but last time I used it (around 
2.6.21, I think), I think, it worked. Was a completely different hardware 
though.

> The only hardware difference between the two is that LAN921[5678] has an
> Auto-MDIX PHY.  This adds a configuration bit in one of the 
> vendor-specific
> PHY registers to force the feature off, but it defaults to Auto-MDIX 
> enabled.
> All of the SCR and MAC registers (and the remaining PHY registers) are 
> *identical*, so any working driver should just need the ID register
> changing to recognise the newer part.

It works now! Just chose a wrong bus-width.

> Early revisions of LAN911X had a hardware bug which is most commonly
> experienced when joining/leaving multicast groups.  The smsc911x driver
> contains a workaround for this, but the in-tree driver does not.  LAN921X
> came after this was fixed in hardware, so this workaround is not 
> necessary.
> 
> The vast majority of users i've worked with have ended up using the
> out-of-tree smsc911x driver, as it "just works" on many platforms.
> I'll be re-submitting another candidate when I've finished working on the
> LAN9500 USB ethernet driver, but for now the latest submission:
> 
> http://marc.info/?l=linux-netdev&m=121240395122475&w=2

Thanks, I was about to try yours, was the last attempt to use the stock 
driver, and, perhaps, unfortunately for you, it worked:-)

Thanks again
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Extend smc911x to support LAN921x chips - differences?
  2008-09-09 15:26 Extend smc911x to support LAN921x chips - differences? Steve.Glendinning
  2008-09-09 16:18 ` Guennadi Liakhovetski
@ 2008-09-09 20:08 ` Peter Korsgaard
  2008-10-10 23:33   ` [PATCH, RFC] Extend smc911x to support LAN921x chips Guennadi Liakhovetski
  1 sibling, 1 reply; 17+ messages in thread
From: Peter Korsgaard @ 2008-09-09 20:08 UTC (permalink / raw)
  To: Steve.Glendinning; +Cc: Guennadi Liakhovetski, netdev, Ian.Saturley

>>>>> "Steve" == Steve Glendinning <Steve.Glendinning@smsc.com> writes:

Hi,

 Steve> Did you have the in-tree driver succesfully working with LAN9115?

I've used the mainline driver without problems on various PPC boards
with LAN9117 devices..

 Steve> The vast majority of users i've worked with have ended up
 Steve> using the out-of-tree smsc911x driver, as it "just works" on
 Steve> many platforms.  I'll be re-submitting another candidate when
 Steve> I've finished working on the LAN9500 USB ethernet driver, but
 Steve> for now the latest submission:

I've said a few times already, but couldn't you fix the existing
driver instead of adding a completely new one?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-09-09 20:08 ` Peter Korsgaard
@ 2008-10-10 23:33   ` Guennadi Liakhovetski
  2008-10-11  7:22     ` Peter Korsgaard
  0 siblings, 1 reply; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-10 23:33 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Steve.Glendinning, netdev, Ian.Saturley

LAN921x controllers from SMSC register cmpatible with LAN911x chips, the 
driver only needs to recognise respective chip IDs. Patch also adds 
network support for the pcm037 board, using this chip.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

---

This is an RFC just to let everyone comment on it, it probably would also 
be better to split it into two patches - one only for drivers/net and one 
for arch/arm plus the Kconfig hunk. Based on 2.6.27, would be nice to get 
it into 2.6.28. The CC-list is kept from the previous discussion regarding 
this driver-extension.

diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index df8582a..cd3f3c2 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -22,6 +22,9 @@
 #include <linux/platform_device.h>
 #include <linux/mtd/physmap.h>
 #include <linux/memory.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <linux/smc911x.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -57,8 +60,37 @@ static struct imxuart_platform_data uart_pdata = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
 
+static struct resource smc911x_resources[] = {
+	[0] = {
+		.start		= CS1_BASE_ADDR + 0x300,
+		.end		= CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
+		.flags		= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start		= IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
+		.end		= IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct smc911x_platdata smc911x_info = {
+	.flags		= SMC911X_USE_32BIT,
+	.irq_flags	= IRQF_SHARED | IRQF_TRIGGER_LOW,
+};
+
+static struct platform_device pcm037_eth = {
+	.name		= "smc911x",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(smc911x_resources),
+	.resource	= smc911x_resources,
+	.dev		= {
+		.platform_data = &smc911x_info,
+	},
+};
+
 static struct platform_device *devices[] __initdata = {
 	&pcm037_flash,
+	&pcm037_eth,
 };
 
 /*
@@ -79,6 +111,11 @@ static void __init mxc_board_init(void)
 	mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
 
 	imx_init_uart(2, &uart_pdata);
+
+	/* SMSC9215 IRQ pin */
+	mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO));
+	if (!gpio_request(MX31_PIN_GPIO3_1, "pcm037-eth"))
+		gpio_direction_input(MX31_PIN_GPIO3_1);
 }
 
 /*
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 4a11296..c741627 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -960,7 +960,7 @@ config SMC911X
 	tristate "SMSC LAN911[5678] support"
 	select CRC32
 	select MII
-	depends on ARCH_PXA || SUPERH
+	depends on ARCH_PXA || ARCH_MX3 || SUPERH
 	help
 	  This is a driver for SMSC's LAN911x series of Ethernet chipsets
 	  including the new LAN9115, LAN9116, LAN9117, and LAN9118.
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index c587162..95b9bfa 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -685,8 +685,10 @@ static void smc911x_phy_detect(struct net_device *dev)
 	 * PHY#1 to PHY#31, and then PHY#0 last.
 	 */
 	switch(lp->version) {
-		case 0x115:
-		case 0x117:
+		case 0x0115:
+		case 0x0117:
+		case 0x115A:
+		case 0x117A:
 			cfg = SMC_GET_HW_CFG(lp);
 			if (cfg & HW_CFG_EXT_PHY_DET_) {
 				cfg &= ~HW_CFG_PHY_CLK_SEL_;
@@ -722,6 +724,9 @@ static void smc911x_phy_detect(struct net_device *dev)
 						break;
 					}
 				}
+				if (phyaddr < 32)
+					/* Found an external PHY */
+					break;
 			}
 		default:
 			/* Internal media only */
@@ -992,7 +997,7 @@ static void smc911x_phy_interrupt(struct net_device *dev)
 
 	smc911x_phy_check_media(dev, 0);
 	/* read to clear status bits */
-	SMC_GET_PHY_INT_SRC(lp, phyaddr,status);
+	SMC_GET_PHY_INT_SRC(lp, phyaddr, status);
 	DBG(SMC_DEBUG_MISC, "%s: PHY interrupt status 0x%04x\n",
 		dev->name, status & 0xffff);
 	DBG(SMC_DEBUG_MISC, "%s: AFC_CFG 0x%08x\n",
@@ -1030,7 +1035,6 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
 	/* set a timeout value, so I don't stay here forever */
 	timeout = 8;
 
-
 	do {
 		status = SMC_GET_INT(lp);
 
@@ -1169,12 +1173,10 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
 	/* restore mask state */
 	SMC_SET_INT_EN(lp, mask);
 
-	DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n",
-		dev->name, 8-timeout);
-
 	spin_unlock_irqrestore(&lp->lock, flags);
 
-	DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout);
+	DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n",
+		dev->name, 8-timeout);
 
 	return IRQ_HANDLED;
 }
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 2abfc28..d7a7ca3 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -666,10 +666,14 @@ smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr,
 #define LAN911X_INTERNAL_PHY_ID		(0x0007C000)
 
 /* Chip ID values */
-#define CHIP_9115	0x115
-#define CHIP_9116	0x116
-#define CHIP_9117	0x117
-#define CHIP_9118	0x118
+#define CHIP_9115	0x0115
+#define CHIP_9116	0x0116
+#define CHIP_9117	0x0117
+#define CHIP_9118	0x0118
+#define CHIP_9215	0x115A
+#define CHIP_9216	0x116A
+#define CHIP_9217	0x117A
+#define CHIP_9218	0x118A
 
 struct chip_id {
 	u16 id;
@@ -681,6 +685,10 @@ static const struct chip_id chip_ids[] =  {
 	{ CHIP_9116, "LAN9116" },
 	{ CHIP_9117, "LAN9117" },
 	{ CHIP_9118, "LAN9118" },
+	{ CHIP_9215, "LAN9215" },
+	{ CHIP_9216, "LAN9216" },
+	{ CHIP_9217, "LAN9217" },
+	{ CHIP_9218, "LAN9218" },
 	{ 0, NULL },
 };
 

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-10-10 23:33   ` [PATCH, RFC] Extend smc911x to support LAN921x chips Guennadi Liakhovetski
@ 2008-10-11  7:22     ` Peter Korsgaard
  2008-10-11  9:00       ` Guennadi Liakhovetski
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Korsgaard @ 2008-10-11  7:22 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Steve.Glendinning, netdev, Ian.Saturley

>>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:

Hi,

 Guennadi> LAN921x controllers from SMSC register cmpatible with
 Guennadi> LAN911x chips, the driver only needs to recognise
 Guennadi> respective chip IDs. Patch also adds network support for
 Guennadi> the pcm037 board, using this chip.

 Guennadi> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

 Guennadi> ---

 Guennadi> This is an RFC just to let everyone comment on it, it
 Guennadi> probably would also be better to split it into two patches
 Guennadi> - one only for drivers/net and one for arch/arm plus the
 Guennadi> Kconfig hunk. Based on 2.6.27, would be nice to get it into
 Guennadi> 2.6.28. The CC-list is kept from the previous discussion
 Guennadi> regarding this driver-extension.

It looks good, but you should definately split out the arm and cleanup
stuff from the new IDs.

 Guennadi> @@ -722,6 +724,9 @@ static void smc911x_phy_detect(struct net_device *dev)
 Guennadi>  						break;
 Guennadi>  					}
 Guennadi>  				}
 Guennadi> +				if (phyaddr < 32)
 Guennadi> +					/* Found an external PHY */
 Guennadi> +					break;

What's this for? Isn't that handled just above?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-10-11  7:22     ` Peter Korsgaard
@ 2008-10-11  9:00       ` Guennadi Liakhovetski
  2008-10-11 16:48         ` Peter Korsgaard
  0 siblings, 1 reply; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-11  9:00 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Steve.Glendinning, netdev, Ian.Saturley

On Sat, 11 Oct 2008, Peter Korsgaard wrote:

> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
> 
> It looks good, but you should definately split out the arm and cleanup
> stuff from the new IDs.

You mean remove the new IDs? Why?

>  Guennadi> @@ -722,6 +724,9 @@ static void smc911x_phy_detect(struct net_device *dev)
>  Guennadi>  						break;
>  Guennadi>  					}
>  Guennadi>  				}
>  Guennadi> +				if (phyaddr < 32)
>  Guennadi> +					/* Found an external PHY */
>  Guennadi> +					break;
> 
> What's this for? Isn't that handled just above?

I think, there's a bug in the code there. The break above terminates the 
loop, yes, but then it falls through in the switch statement to the 
default case and overwrites the just found PHY.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-10-11  9:00       ` Guennadi Liakhovetski
@ 2008-10-11 16:48         ` Peter Korsgaard
  2008-10-11 20:30           ` Guennadi Liakhovetski
                             ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Peter Korsgaard @ 2008-10-11 16:48 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Steve.Glendinning, netdev, Ian.Saturley

>>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:

Hi,

 Guennadi> On Sat, 11 Oct 2008, Peter Korsgaard wrote:
 >> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
 >> 
 >> It looks good, but you should definately split out the arm and cleanup
 >> stuff from the new IDs.

 Guennadi> You mean remove the new IDs? Why?

No, just have them in seperate patches - They are independent of each
other, so no need to put in the same patch.

 >> What's this for? Isn't that handled just above?

 Guennadi> I think, there's a bug in the code there. The break above
 Guennadi> terminates the loop, yes, but then it falls through in the
 Guennadi> switch statement to the default case and overwrites the
 Guennadi> just found PHY.

Ahh, the good old break-only-escapes-the-innermost-scope. That's a
good fix, but please send it seperately from the patch adding the new
IDs.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-10-11 16:48         ` Peter Korsgaard
@ 2008-10-11 20:30           ` Guennadi Liakhovetski
  2008-10-12  7:38             ` Peter Korsgaard
  2008-10-11 21:10           ` [PATCH] smc911x: Fix external PHY detection Guennadi Liakhovetski
  2008-10-11 21:13           ` [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC Guennadi Liakhovetski
  2 siblings, 1 reply; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-11 20:30 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Steve.Glendinning, netdev, Ian.Saturley

On Sat, 11 Oct 2008, Peter Korsgaard wrote:

> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
> 
> Hi,
> 
>  Guennadi> On Sat, 11 Oct 2008, Peter Korsgaard wrote:
>  >> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
>  >> 
>  >> It looks good, but you should definately split out the arm and cleanup
>  >> stuff from the new IDs.
> 
>  Guennadi> You mean remove the new IDs? Why?
> 
> No, just have them in seperate patches - They are independent of each
> other, so no need to put in the same patch.

No, they are not independent. smc91x.c is comparing the ID read from the 
hardware with the table, which someone strangely enough for me put in the 
header. So, even if one were to split them, you would have to make it a 
patch series and make the patch for .c depend on the one for .h adding 
IDs. So, no, these two belong into one patch.

>  >> What's this for? Isn't that handled just above?
> 
>  Guennadi> I think, there's a bug in the code there. The break above
>  Guennadi> terminates the loop, yes, but then it falls through in the
>  Guennadi> switch statement to the default case and overwrites the
>  Guennadi> just found PHY.
> 
> Ahh, the good old break-only-escapes-the-innermost-scope. That's a
> good fix, but please send it seperately from the patch adding the new
> IDs.

Ok... it is a simple enough fix, so, one could put them both in one patch 
and be done with them, just explaining both in the patch description, but 
ok, I can make it a separate patch too...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] smc911x: Fix external PHY detection
  2008-10-11 16:48         ` Peter Korsgaard
  2008-10-11 20:30           ` Guennadi Liakhovetski
@ 2008-10-11 21:10           ` Guennadi Liakhovetski
  2008-10-11 22:07             ` David Miller
  2008-10-12  7:43             ` Peter Korsgaard
  2008-10-11 21:13           ` [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC Guennadi Liakhovetski
  2 siblings, 2 replies; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-11 21:10 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Steve.Glendinning, netdev, Ian.Saturley

If an external PHY is found the driver falls through to the default
case in the switch and overwrites the PHY ID. Add the missing break.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
---
against 2.6.27

 drivers/net/smc911x.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index c587162..dbc51e9 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -722,6 +722,9 @@ static void smc911x_phy_detect(struct net_device *dev)
 						break;
 					}
 				}
+				if (phyaddr < 32)
+					/* Found an external PHY */
+					break;
 			}
 		default:
 			/* Internal media only */
-- 
1.5.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC
  2008-10-11 16:48         ` Peter Korsgaard
  2008-10-11 20:30           ` Guennadi Liakhovetski
  2008-10-11 21:10           ` [PATCH] smc911x: Fix external PHY detection Guennadi Liakhovetski
@ 2008-10-11 21:13           ` Guennadi Liakhovetski
  2008-10-11 22:08             ` David Miller
  2 siblings, 1 reply; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-11 21:13 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Steve.Glendinning, netdev, Ian.Saturley

LAN92{5,7,8} chips from SMSC are register compatible with LAN911{5,6,7,8}
controllers, and only add support for HP Auto-MDIX. LAN9218 doesn't have
an external MII interface. Also fixes a couple of minor style issues.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
---
against 2.6.27

 drivers/net/smc911x.c |   15 +++++++--------
 drivers/net/smc911x.h |   14 ++++++++++----
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dbc51e9..428b852 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -685,8 +685,10 @@ static void smc911x_phy_detect(struct net_device *dev)
 	 * PHY#1 to PHY#31, and then PHY#0 last.
 	 */
 	switch(lp->version) {
-		case 0x115:
-		case 0x117:
+		case CHIP_9115:
+		case CHIP_9117:
+		case CHIP_9215:
+		case CHIP_9217:
 			cfg = SMC_GET_HW_CFG(lp);
 			if (cfg & HW_CFG_EXT_PHY_DET_) {
 				cfg &= ~HW_CFG_PHY_CLK_SEL_;
@@ -995,7 +997,7 @@ static void smc911x_phy_interrupt(struct net_device *dev)
 
 	smc911x_phy_check_media(dev, 0);
 	/* read to clear status bits */
-	SMC_GET_PHY_INT_SRC(lp, phyaddr,status);
+	SMC_GET_PHY_INT_SRC(lp, phyaddr, status);
 	DBG(SMC_DEBUG_MISC, "%s: PHY interrupt status 0x%04x\n",
 		dev->name, status & 0xffff);
 	DBG(SMC_DEBUG_MISC, "%s: AFC_CFG 0x%08x\n",
@@ -1033,7 +1035,6 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
 	/* set a timeout value, so I don't stay here forever */
 	timeout = 8;
 
-
 	do {
 		status = SMC_GET_INT(lp);
 
@@ -1172,12 +1173,10 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
 	/* restore mask state */
 	SMC_SET_INT_EN(lp, mask);
 
-	DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n",
-		dev->name, 8-timeout);
-
 	spin_unlock_irqrestore(&lp->lock, flags);
 
-	DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout);
+	DBG(SMC_DEBUG_MISC, "%s: Interrupt done (%d loops)\n",
+		dev->name, 8-timeout);
 
 	return IRQ_HANDLED;
 }
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 2abfc28..bf6240f 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -666,10 +666,13 @@ smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr,
 #define LAN911X_INTERNAL_PHY_ID		(0x0007C000)
 
 /* Chip ID values */
-#define CHIP_9115	0x115
-#define CHIP_9116	0x116
-#define CHIP_9117	0x117
-#define CHIP_9118	0x118
+#define CHIP_9115	0x0115
+#define CHIP_9116	0x0116
+#define CHIP_9117	0x0117
+#define CHIP_9118	0x0118
+#define CHIP_9215	0x115A
+#define CHIP_9217	0x117A
+#define CHIP_9218	0x118A
 
 struct chip_id {
 	u16 id;
@@ -681,6 +684,9 @@ static const struct chip_id chip_ids[] =  {
 	{ CHIP_9116, "LAN9116" },
 	{ CHIP_9117, "LAN9117" },
 	{ CHIP_9118, "LAN9118" },
+	{ CHIP_9215, "LAN9215" },
+	{ CHIP_9217, "LAN9217" },
+	{ CHIP_9218, "LAN9218" },
 	{ 0, NULL },
 };
 
-- 
1.5.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] smc911x: Fix external PHY detection
  2008-10-11 21:10           ` [PATCH] smc911x: Fix external PHY detection Guennadi Liakhovetski
@ 2008-10-11 22:07             ` David Miller
  2008-10-12  7:43             ` Peter Korsgaard
  1 sibling, 0 replies; 17+ messages in thread
From: David Miller @ 2008-10-11 22:07 UTC (permalink / raw)
  To: lg; +Cc: jacmet, Steve.Glendinning, netdev, Ian.Saturley

From: Guennadi Liakhovetski <lg@denx.de>
Date: Sat, 11 Oct 2008 23:10:58 +0200 (CEST)

> If an external PHY is found the driver falls through to the default
> case in the switch and overwrites the PHY ID. Add the missing break.
> 
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

Applied, thanks.

> against 2.6.27

Luckily this still applied cleanly :)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC
  2008-10-11 21:13           ` [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC Guennadi Liakhovetski
@ 2008-10-11 22:08             ` David Miller
  2008-10-11 22:59               ` [PATCH v2] " Guennadi Liakhovetski
  0 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2008-10-11 22:08 UTC (permalink / raw)
  To: lg; +Cc: jacmet, Steve.Glendinning, netdev, Ian.Saturley

From: Guennadi Liakhovetski <lg@denx.de>
Date: Sat, 11 Oct 2008 23:13:30 +0200 (CEST)

> LAN92{5,7,8} chips from SMSC are register compatible with LAN911{5,6,7,8}
> controllers, and only add support for HP Auto-MDIX. LAN9218 doesn't have
> an external MII interface. Also fixes a couple of minor style issues.
> 
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

This patch mixes multiple changes, please split it up into multiple
patches.

Coding style changes in one changeset, debugging output adjustment
in another, and the new chipset support in yet another patch.

Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2] smc911x: Add support for LAN921{5,7,8} chips from SMSC
  2008-10-11 22:08             ` David Miller
@ 2008-10-11 22:59               ` Guennadi Liakhovetski
  2008-10-12  7:54                 ` Peter Korsgaard
  0 siblings, 1 reply; 17+ messages in thread
From: Guennadi Liakhovetski @ 2008-10-11 22:59 UTC (permalink / raw)
  To: David Miller; +Cc: jacmet, Steve.Glendinning, netdev, Ian.Saturley

LAN92{5,7,8} chips from SMSC are register compatible with LAN911{5,6,7,8}
controllers, and only add support for HP Auto-MDIX. LAN9218 doesn't have
an external MII interface.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
---
still against 2.6.27, this time without style and DBG() changes.

 drivers/net/smc911x.c |    6 ++++--
 drivers/net/smc911x.h |   14 ++++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dbc51e9..22a0d14 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -685,8 +685,10 @@ static void smc911x_phy_detect(struct net_device *dev)
 	 * PHY#1 to PHY#31, and then PHY#0 last.
 	 */
 	switch(lp->version) {
-		case 0x115:
-		case 0x117:
+		case CHIP_9115:
+		case CHIP_9117:
+		case CHIP_9215:
+		case CHIP_9217:
 			cfg = SMC_GET_HW_CFG(lp);
 			if (cfg & HW_CFG_EXT_PHY_DET_) {
 				cfg &= ~HW_CFG_PHY_CLK_SEL_;
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 2abfc28..bf6240f 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -666,10 +666,13 @@ smc_pxa_dma_outsl(struct smc911x_local *lp, u_long physaddr,
 #define LAN911X_INTERNAL_PHY_ID		(0x0007C000)
 
 /* Chip ID values */
-#define CHIP_9115	0x115
-#define CHIP_9116	0x116
-#define CHIP_9117	0x117
-#define CHIP_9118	0x118
+#define CHIP_9115	0x0115
+#define CHIP_9116	0x0116
+#define CHIP_9117	0x0117
+#define CHIP_9118	0x0118
+#define CHIP_9215	0x115A
+#define CHIP_9217	0x117A
+#define CHIP_9218	0x118A
 
 struct chip_id {
 	u16 id;
@@ -681,6 +684,9 @@ static const struct chip_id chip_ids[] =  {
 	{ CHIP_9116, "LAN9116" },
 	{ CHIP_9117, "LAN9117" },
 	{ CHIP_9118, "LAN9118" },
+	{ CHIP_9215, "LAN9215" },
+	{ CHIP_9217, "LAN9217" },
+	{ CHIP_9218, "LAN9218" },
 	{ 0, NULL },
 };
 
-- 
1.5.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH, RFC] Extend smc911x to support LAN921x chips
  2008-10-11 20:30           ` Guennadi Liakhovetski
@ 2008-10-12  7:38             ` Peter Korsgaard
  0 siblings, 0 replies; 17+ messages in thread
From: Peter Korsgaard @ 2008-10-12  7:38 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Steve.Glendinning, netdev, Ian.Saturley

>>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:

 Guennadi> On Sat, 11 Oct 2008, Peter Korsgaard wrote:
 >> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
 >> 
 >> Hi,
 >> 
 Guennadi> On Sat, 11 Oct 2008, Peter Korsgaard wrote:
 >> >> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
 >> >> 
 >> >> It looks good, but you should definately split out the arm and cleanup
 >> >> stuff from the new IDs.
 >> 
 Guennadi> You mean remove the new IDs? Why?
 >> 
 >> No, just have them in seperate patches - They are independent of each
 >> other, so no need to put in the same patch.

 Guennadi> No, they are not independent. smc91x.c is comparing the ID
 Guennadi> read from the hardware with the table, which someone
 Guennadi> strangely enough for me put in the header. So, even if one
 Guennadi> were to split them, you would have to make it a patch
 Guennadi> series and make the patch for .c depend on the one for .h
 Guennadi> adding IDs. So, no, these two belong into one patch.

I think we're talking past eachother. The changes in smc911x.c and
smc911x.h to support the new IDs should ofcourse be in the same patch,
but the other changes not - E.G. you end up with a patch series like:

- fix ext phy support
- cleanup debug print
- add 921x support
- pcm037 smc911x support

The first 3 goes to Jeff, and the last one to Russell.

 >> Ahh, the good old break-only-escapes-the-innermost-scope. That's a
 >> good fix, but please send it seperately from the patch adding the new
 >> IDs.

 Guennadi> Ok... it is a simple enough fix, so, one could put them
 Guennadi> both in one patch and be done with them, just explaining
 Guennadi> both in the patch description, but ok, I can make it a
 Guennadi> separate patch too...

I would prefer a seperate patch.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] smc911x: Fix external PHY detection
  2008-10-11 21:10           ` [PATCH] smc911x: Fix external PHY detection Guennadi Liakhovetski
  2008-10-11 22:07             ` David Miller
@ 2008-10-12  7:43             ` Peter Korsgaard
  1 sibling, 0 replies; 17+ messages in thread
From: Peter Korsgaard @ 2008-10-12  7:43 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Steve.Glendinning, netdev, Ian.Saturley

>>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:

 Guennadi> If an external PHY is found the driver falls through to the
 Guennadi> default case in the switch and overwrites the PHY ID. Add
 Guennadi> the missing break.

 Guennadi> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] smc911x: Add support for LAN921{5,7,8} chips from SMSC
  2008-10-11 22:59               ` [PATCH v2] " Guennadi Liakhovetski
@ 2008-10-12  7:54                 ` Peter Korsgaard
  2008-10-13  4:05                   ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Korsgaard @ 2008-10-12  7:54 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: David Miller, Steve.Glendinning, netdev, Ian.Saturley

>>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:

 Guennadi> LAN92{5,7,8} chips from SMSC are register compatible with
 Guennadi> LAN911{5,6,7,8} controllers, and only add support for HP
 Guennadi> Auto-MDIX. LAN9218 doesn't have an external MII interface.

 Guennadi> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] smc911x: Add support for LAN921{5,7,8} chips from SMSC
  2008-10-12  7:54                 ` Peter Korsgaard
@ 2008-10-13  4:05                   ` David Miller
  0 siblings, 0 replies; 17+ messages in thread
From: David Miller @ 2008-10-13  4:05 UTC (permalink / raw)
  To: jacmet; +Cc: lg, Steve.Glendinning, netdev, Ian.Saturley

From: Peter Korsgaard <jacmet@sunsite.dk>
Date: Sun, 12 Oct 2008 09:54:08 +0200

> >>>>> "Guennadi" == Guennadi Liakhovetski <lg@denx.de> writes:
> 
>  Guennadi> LAN92{5,7,8} chips from SMSC are register compatible with
>  Guennadi> LAN911{5,6,7,8} controllers, and only add support for HP
>  Guennadi> Auto-MDIX. LAN9218 doesn't have an external MII interface.
> 
>  Guennadi> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> 
> Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-10-13  4:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-09 15:26 Extend smc911x to support LAN921x chips - differences? Steve.Glendinning
2008-09-09 16:18 ` Guennadi Liakhovetski
2008-09-09 20:08 ` Peter Korsgaard
2008-10-10 23:33   ` [PATCH, RFC] Extend smc911x to support LAN921x chips Guennadi Liakhovetski
2008-10-11  7:22     ` Peter Korsgaard
2008-10-11  9:00       ` Guennadi Liakhovetski
2008-10-11 16:48         ` Peter Korsgaard
2008-10-11 20:30           ` Guennadi Liakhovetski
2008-10-12  7:38             ` Peter Korsgaard
2008-10-11 21:10           ` [PATCH] smc911x: Fix external PHY detection Guennadi Liakhovetski
2008-10-11 22:07             ` David Miller
2008-10-12  7:43             ` Peter Korsgaard
2008-10-11 21:13           ` [PATCH] smc911x: Add support for LAN921{5,7,8} chips from SMSC Guennadi Liakhovetski
2008-10-11 22:08             ` David Miller
2008-10-11 22:59               ` [PATCH v2] " Guennadi Liakhovetski
2008-10-12  7:54                 ` Peter Korsgaard
2008-10-13  4:05                   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).