Skip to contentSkip to conversation

fsl_pq_mdio: Add Suport for etsec2.0 devices.

PATCH Superseded Sandeep Gopalpet 3 participants 9 messages Oct 27, 2009 – Oct 29, 2009

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/7 fsl_pq_mdio: Add Suport for etsec2.0 devices.

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

---
 drivers/net/fsl_pq_mdio.c |   59 ++++++++++++++++++++++++++++++++++++--------
 drivers/net/fsl_pq_mdio.h |   11 +++++++-
 2 files changed, 57 insertions(+), 13 deletions(-)
drivers/net/fsl_pq_mdio.c +48 -11
index d167090..6de7b24 100644
@@ -3,8 +3,9 @@
  * Provides Bus interface for MIIM regs
  *
  * Author: Andy Fleming <[email protected]>
+ * Modifier: Sandeep Gopalpet <[email protected]>
  *
- * Copyright (c) 2002-2004,2008 Freescale Semiconductor, Inc.
+ * Copyright 2002-2004, 2008-2009 Freescale Semiconductor, Inc.
  *
  * Based on gianfar_mii.c and ucc_geth_mii.c (Li Yang, Kim Phillips)
  *
@@ -189,19 +190,29 @@ static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)
 
 
 #if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
-static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs)
+static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np)
 {
 	struct gfar __iomem *enet_regs;
+	u32 __iomem *ioremap_tbipa;
+	u64 addr, size;
 
 	/*
 	 * This is mildly evil, but so is our hardware for doing this.
 	 * Also, we have to cast back to struct gfar because of
 	 * definition weirdness done in gianfar.h.
 	 */
-	enet_regs = (struct gfar __iomem *)
-		((char __iomem *)regs - offsetof(struct gfar, gfar_mii_regs));
-
-	return &enet_regs->tbipa;
+	if(of_device_is_compatible(np, "fsl,gianfar-mdio") ||
+		of_device_is_compatible(np, "fsl,gianfar-tbi") ||
+		of_device_is_compatible(np, "gianfar")) {
+		enet_regs = (struct gfar __iomem *)regs;
+		return &enet_regs->tbipa;
+	} else if (of_device_is_compatible(np, "fsl,etsec2-mdio") ||
+			of_device_is_compatible(np, "fsl,etsec2-tbi")) {
+		addr = of_translate_address(np, of_get_address(np, 1, &size, NULL));
+		ioremap_tbipa = ioremap(addr, size);
+		return ioremap_tbipa;
+	} else
+		return NULL;
 }
 #endif
 
@@ -250,11 +261,11 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 {
 	struct device_node *np = ofdev->node;
 	struct device_node *tbi;
-	struct fsl_pq_mdio __iomem *regs;
+	struct fsl_pq_mdio __iomem *regs = NULL;
 	u32 __iomem *tbipa;
 	struct mii_bus *new_bus;
 	int tbiaddr = -1;
-	u64 addr, size;
+	u64 addr = 0, size = 0, ioremap_miimcfg = 0;
 	int err = 0;
 
 	new_bus = mdiobus_alloc();
@@ -268,8 +279,22 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 	fsl_pq_mdio_bus_name(new_bus->id, np);
 
 	/* Set the PHY base address */
-	addr = of_translate_address(np, of_get_address(np, 0, &size, NULL));
-	regs = ioremap(addr, size);
+	if (of_device_is_compatible(np,"fsl,gianfar-mdio") ||
+		of_device_is_compatible(np, "fsl,gianfar-tbi") ||
+		of_device_is_compatible(np, "fsl,ucc-mdio") ||
+		of_device_is_compatible(np,"ucc_geth_phy" )) {
+		addr = of_translate_address(np, of_get_address(np, 0, &size, NULL));
+		ioremap_miimcfg =  container_of(addr, struct fsl_pq_mdio, miimcfg);
+		regs = ioremap(ioremap_miimcfg, size +
+				offsetof(struct fsl_pq_mdio, miimcfg));
+	} else if (of_device_is_compatible(np,"fsl,etsec2-mdio") ||
+			of_device_is_compatible(np, "fsl,etsec2-tbi")) {
+		addr = of_translate_address(np, of_get_address(np, 0, &size, NULL));
+		regs = ioremap(addr, size);
+	} else {
+		err = -EINVAL;
+		goto err_free_bus;
+	}
 
 	if (NULL == regs) {
 		err = -ENOMEM;
@@ -290,9 +315,15 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
 
 	if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
 			of_device_is_compatible(np, "fsl,gianfar-tbi") ||
+			of_device_is_compatible(np, "fsl,etsec2-mdio") ||
+			of_device_is_compatible(np, "fsl,etsec2-tbi") ||
 			of_device_is_compatible(np, "gianfar")) {
 #if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
-		tbipa = get_gfar_tbipa(regs);
+		tbipa = get_gfar_tbipa(regs, np);
+		if (!tbipa) {
+			err = -EINVAL;
+			goto err_free_irqs;
+		}
 #else
 		err = -ENODEV;
 		goto err_free_irqs;
@@ -405,6 +436,12 @@ static struct of_device_id fsl_pq_mdio_match[] = {
 	{
 		.compatible = "fsl,gianfar-mdio",
 	},
+	{
+		.compatible = "fsl,etsec2-tbi",
+	},
+	{
+		.compatible = "fsl,etsec2-mdio",
+	},
 	{},
 };
 
drivers/net/fsl_pq_mdio.h +9 -2
index 36dad52..1f7d865 100644
@@ -3,8 +3,9 @@
  * Driver for the MDIO bus controller on Freescale PowerQUICC processors
  *
  * Author: Andy Fleming
+ * Modifier: Sandeep Gopalpet
  *
- * Copyright (c) 2002-2004,2008 Freescale Semiconductor, Inc.
+ * Copyright 2002-2004, 2008-2009 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -23,6 +24,12 @@
 #define MII_READ_COMMAND       0x00000001
 
 struct fsl_pq_mdio {
+	u8 res1[16];
+	u32 ieventm;	/* MDIO Interrupt event register (for etsec2)*/
+	u32 imaskm;	/* MDIO Interrupt mask register (for etsec2)*/
+	u8 res2[4];
+	u32 emapm;	/* MDIO Event mapping register (for etsec2)*/
+	u8 res3[1280];
 	u32 miimcfg;		/* MII management configuration reg */
 	u32 miimcom;		/* MII management command reg */
 	u32 miimadd;		/* MII management address reg */
@@ -31,9 +38,9 @@ struct fsl_pq_mdio {
 	u32 miimind;		/* MII management indication reg */
 	u8 reserved[28];	/* Space holder */
 	u32 utbipar;		/* TBI phy address reg (only on UCC) */
+	u8 res4[2728];
 } __attribute__ ((packed));
 
-
 int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
 int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
Signature · 1 line
1.5.2.2
maintainer
#1 lore raw

From: Sandeep Gopalpet <[email protected]>
Date: Tue, 27 Oct 2009 22:25:18 +0530

Quoted 6 lines

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

This is the third time you've submitted this patch, and for the third time it DOES NOT apply to net-next-2.6 at all when I try to apply this gianfar patch series.

You must be patching against another tree that has some changes that conflict with this one.

Sort this out before submitting this again.

If you submit once more this same series, and it doesn't apply properly to net-next-2.6, I will flat our ignore your submissions for a week or so.

You are wasting that much of my time by doing this over and over.

Get your act together.

#2 lore raw
Quoted 17 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Wednesday, October 28, 2009 3:13 PM
To: Kumar Gopalpet-B05799
Cc: [email protected]
Subject: Re: [PATCH v2 4/7] fsl_pq_mdio: Add Suport for etsec2.0 devices.

From: Sandeep Gopalpet <[email protected]>
Date: Tue, 27 Oct 2009 22:25:18 +0530

Quoted 4 lines

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

Quoted 9 lines
Quoted 1 line

This is the third time you've submitted this patch, and for the third time it DOES NOT apply to net-next-2.6 at all when I try to apply this gianfar patch series.

You must be patching against another tree that has some changes that conflict with this one.

I had rebased and tested on the master branch of the following tree
http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git

(The git protocol clone was not working, hence we used http) If this is not the right tree, kindly correct me.
I could not find any other net-next-2.6 tree/branch on kernel.org.

I have updated the tree again, (though there is no change) the last commit on the tree being :

commit b37b62fea1d1bf68ca51818f8eb1035188efd030

Author: Ben Hutchings <[email protected]>
Date:   Fri Oct 23 08:33:42 2009 +0000

sfc: Rename 'xfp' file and functions to reflect reality

The 'XFP' driver is really a driver for the QT2022C2 and QT2025C
PHYs,
covering both more and less than XFP. Rename its functions and constants to reflect reality and to reduce namespace pollution when sfc is a built-in driver.

Also, I have merged it with the latest linux-next tree (It is already updated with the net-next-2.6.git)

Quoted 1 line

Sort this out before submitting this again.

I am working on it.

Quoted 7 lines

If you submit once more this same series, and it doesn't apply properly to net-next-2.6, I will flat our ignore your submissions for a week or so.

You are wasting that much of my time by doing this over and over.

I apologize for that.

Quoted 3 lines

Get your act together.

#3 lore raw
In reply to David Miller
Quoted 28 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Wednesday, October 28, 2009 3:13 PM
To: Kumar Gopalpet-B05799
Cc: [email protected]
Subject: Re: [PATCH v2 4/7] fsl_pq_mdio: Add Suport for etsec2.0 devices.

From: Sandeep Gopalpet <[email protected]>
Date: Tue, 27 Oct 2009 22:25:18 +0530

Quoted 5 lines

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

This is the third time you've submitted this patch, and for the third time it DOES NOT apply to net-next-2.6 at all when I try to apply this gianfar patch series.

You must be patching against another tree that has some changes that conflict with this one.

Sort this out before submitting this again.

Quoted 9 lines

If you submit once more this same series, and it doesn't apply properly to net-next-2.6, I will flat our ignore your submissions for a week or so.

You are wasting that much of my time by doing this over and over.

Get your act together.

Hi All,

I couldn't find the following commit on the net-next-2.6 tree:

commit e72701acbe0b35e52d3f04d442837c06b4e64f1c

Author: Anton Vorontsov <[email protected]>
Date:   Wed Oct 14 14:54:52 2009 -0700

net: Fix OF platform drivers coldplug/hotplug when compiled as
modules

Some OF platform drivers are missing module device tables, so they
won't
load automatically on boot. This patch fixes the issue by adding
proper
MODULE_DEVICE_TABLE() macros to the drivers.

The same commit is present on the linux-next tree

I cloned the 2 trees from the following links:
linux-next from:

http://www.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git/

And net-next-2.6 from:

http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git

The absence of the above mentioned commit in the net-next-2.6 tree is causing
some issues with patches getting applied.

Can you let me know if the net-next-2.6 tree that I am cloning is the proper one ?

I based all my patches on net-next-2.6 tree cloned from the above link. But some how when David tries to apply
my patches they fail. I took a diff at the linux-next and net-next-2.6 and the said commit is missing.

-Thanks
Sandeep

maintainer
#4 lore raw

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Thu, 29 Oct 2009 15:02:44 +0530

Quoted 2 lines

The absence of the above mentioned commit in the net-next-2.6 tree is causing some issues with patches getting applied.

You should never use linux-next as you base for working against other people's trees.

Instead, clone net-next-2.6 and work purely against that when sending me patches.

#5 lore raw
Quoted 14 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Thursday, October 29, 2009 3:16 PM
To: Kumar Gopalpet-B05799
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 4/7] fsl_pq_mdio: Add Suport for etsec2.0 devices.

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Thu, 29 Oct 2009 15:02:44 +0530

Quoted 1 line

The absence of the above mentioned commit in the

Quoted 8 lines

net-next-2.6 tree is

Quoted 1 line

causing some issues with patches getting applied.

You should never use linux-next as you base for working against other people's trees.

Instead, clone net-next-2.6 and work purely against that when sending me patches.

This is the tree I generated the patches against initially. The initial set of patches were generated against this tree:
(http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git)

Can you please confirm that the above tree is correct.

After you reported the failure,
I merged against the linux-next tree, therein I too got a similar failure.
The reason being the commit from Anton present in linux-next and absent on net-next.

The patches sent by me applies cleanly to the above mentioned net-next-2.6 tree.

--

Thanks
Sandeep

maintainer
#6 lore raw

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Thu, 29 Oct 2009 15:41:22 +0530

Quoted 5 lines

This is the tree I generated the patches against initially. The initial set of patches were generated against this tree:
(http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git)

Can you please confirm that the above tree is correct.

Yes.

Quoted 2 lines

The patches sent by me applies cleanly to the above mentioned net-next-2.6 tree.

It may have applied cleanly when you sent them, but by the time I applied them it didn't.

Resend a fresh patch set against a fresh net-next-2.6 checkout and let's see what happens :-)

#7 lore raw
Quoted 16 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Thursday, October 29, 2009 3:46 PM
To: Kumar Gopalpet-B05799
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 4/7] fsl_pq_mdio: Add Support for etsec2.0 devices.

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Thu, 29 Oct 2009 15:41:22 +0530

Quoted 3 lines

This is the tree I generated the patches against initially. The initial set of patches were generated against this tree:

Quoted 6 lines

(http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git

Quoted 3 lines

)

Can you please confirm that the above tree is correct.

Yes.

Thank you. I cloned this tree again about 2 hours ago (and updated it 5 mins ago as well).
git describe:
v2.6.32-rc3-464-gb37b62f

The last commit is: b37b62fea1d1bf68ca51818f8eb1035188efd030

Quoted 6 lines
Quoted 3 lines

The patches sent by me applies cleanly to the above mentioned net-next-2.6 tree.

It may have applied cleanly when you sent them, but by the time I applied them it didn't.

The PATCH v2 series applied cleanly to the above clone.

Quoted 3 lines

Resend a fresh patch set against a fresh net-next-2.6 checkout and let's see what happens :-)

Ok. But there is NO change to the patch set.

--

Thanks
Sandeep

maintainer
#8 lore raw

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Thu, 29 Oct 2009 16:03:30 +0530

Quoted 1 line

The PATCH v2 series applied cleanly to the above clone.

It absolutely does NOT!

And I just tried it again to verify this, and you can try it yourself:

	http://vger.kernel.org/~davem/bundle-640.mbox
davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff bundle-640.mbox 
Applying: gianfar: Add per queue structure support
Applying: gianfar: Introduce logical group support.
Applying: gianfar: Add Multiple Queue Support
Applying: fsl_pq_mdio: Add Suport for etsec2.0 devices.
error: patch failed: drivers/net/fsl_pq_mdio.c:405
error: drivers/net/fsl_pq_mdio.c: patch does not apply
Patch failed at 0004 fsl_pq_mdio: Add Suport for etsec2.0 devices.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
davem@sunset:~/src/GIT/net-next-2.6$ 

So stop telling me it applies cleanly.

Because I've tried to do it multiple times and it absolutely does not.