Skip to contentSkip to conversation

fsl_pq_mdio: Add Suport for etsec2.0 devices.

PATCH Superseded Sandeep Gopalpet 3 participants 6 messages Oct 29, 2009 – Oct 30, 2009

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

From: Sandeep Gopalpet <[email protected]>

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

---
*. Rebased to the net-next-2.6 tree as of 20091028 cloned from

    http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
 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.6.5
maintainer
#1 lore raw

From: Sandeep Gopalpet <[email protected]>
Date: Thu, 29 Oct 2009 19:53:49 +0530

Quoted 11 lines

From: Sandeep Gopalpet <[email protected]>

This patch adds mdio support for etsec2.0 devices.

Modified the fsl_pq_mdio structure to include the new mdio members.

---
*. Rebased to the net-next-2.6 tree as of 20091028 cloned from

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

It does not apply, again.

And again, here is the bundle I tried to apply using "git am --signoff":

	http://vger.kernel.org/~davem/bundle-641.mbox

--------------------

davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff bundle-641.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".
--------------------

Did you try the bundle I posted yesterday which failed? This one is identical, you didn't change anything.

This is getting rediculious.

Try again, and when you do take the patches from patchwork at:

http://patchwork.ozlabs.org/project/netdev/list/

and you try to apply them to net-next-2.6 using git (_not_ 'patch', 'patch' is way too lenient about fuzz and line offsets) so that you can see what's happening.

I'm completely ignoring your patch postings until you sort this out.

You cannot have line offsets or fuzz when you send patches that are to be applied by GIT, and that is the problem with patch #4:

davem@sunset:~/src/GIT/net-next-2.6$ patch -p1 <diff
patching file drivers/net/fsl_pq_mdio.c
Hunk #6 succeeded at 436 with fuzz 1.
patching file drivers/net/fsl_pq_mdio.h

GIT does not allow line fuzz, you must make absolutely pristine patches, and therefore if you are testing your submission with just 'patch' that absolutely will not work.

Thanks.

#2 lore raw
Quoted 9 lines

Did you try the bundle I posted yesterday which failed? This one is identical, you didn't change anything.

This is getting rediculious.

Try again, and when you do take the patches from patchwork at:

Quoted 7 lines

http://patchwork.ozlabs.org/project/netdev/list/

and you try to apply them to net-next-2.6 using git (_not_ 'patch', 'patch' is way too lenient about fuzz and line offsets) so that you can see what's happening.

I'm completely ignoring your patch postings until you sort this out.

1. The patch failure is due to the absence of following commit in 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.

2. The git clone DOES NOT show the changes affected by the above patch
3. If we take a log of the affected file(fsl_pq_mdio.c), then it DOES show the commit/changes
(Gitweb:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=histo
ry;f=drivers/net/fsl_pq_mdio.c;h=6ac4648669728421b934d32646ffbb626128387 6;hb=HEAD)
4. If we take the log of the tree, the same commit is NOT visible. (Gitweb:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=log)
5. If we take a Snapshot of the tree, the changes to the file are present. (in the tarball)

To sum up, the Clone and Tree log DOES NOT show the changes. The Snapshot and file log DOES show it.

We have tried it on multiple machine/tree clones here. Is there some problem with the Git tree itself?

Quoted 11 lines

You cannot have line offsets or fuzz when you send patches that are to be applied by GIT, and that is the problem with patch #4:

davem@sunset:~/src/GIT/net-next-2.6$ patch -p1 <diff patching 
file drivers/net/fsl_pq_mdio.c Hunk #6 succeeded at 436 with fuzz 1.
patching file drivers/net/fsl_pq_mdio.h

GIT does not allow line fuzz, you must make absolutely pristine patches, and therefore if you are testing your submission with just 'patch' that absolutely will not work.

No we are using git-am.
We did try this on multiple clones of the net-next-2.6 tree.

Quoted 7 lines

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--

Thanks
Sandeep

maintainer
#3 lore raw

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Fri, 30 Oct 2009 12:52:29 +0530

Quoted 7 lines

1. The patch failure is due to the absence of following commit in net-next-2.6 tree.

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

It is in the net-next-2.6 tree, something is wrong with your clone.

davem@sunset:~/src/GIT/net-next-2.6$ git describe e72701acbe0b35e52d3f04d442837c06b4e64f1c
v2.6.31-9041-ge72701a
davem@sunset:~/src/GIT/net-next-2.6$ 
#4 lore raw
Quoted 14 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Friday, October 30, 2009 1:29 PM
To: Kumar Gopalpet-B05799
Cc: [email protected]; Fleming Andy-AFLEMING
Subject: Re: [PATCH v3 4/7] fsl_pq_mdio: Add Suport for etsec2.0 devices.

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Fri, 30 Oct 2009 12:52:29 +0530

Quoted 1 line
Quoted 8 lines
Quoted 6 lines

1. The patch failure is due to the absence of following commit in net-next-2.6 tree.

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

It is in the net-next-2.6 tree, something is wrong with your clone.

We were referring to the logs shown on the gitweb.
The tree log does not show this commit.
(search for this commit id failed)
http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fdavem%2Fnet-next-2.6.git
&a=search&h=29906f6a427d2004a515ebbcdc7b28bae8f6c19c&st=commit&s=e72701a cbe0b35e52d3f04d442837c06b4e64f1c

Whereas, the log for the file does show the commit.
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=histo
ry;f=drivers/net/fsl_pq_mdio.c;h=6ac4648669728421b934d32646ffbb626128387 6;hb=HEAD

Why is there such a mismatch on the tree itself?

Quoted 5 lines
davem@sunset:~/src/GIT/net-next-2.6$ git describe 
e72701acbe0b35e52d3f04d442837c06b4e64f1c
v2.6.31-9041-ge72701a
davem@sunset:~/src/GIT/net-next-2.6$ 

Even we get this on our clone.
However, the changes to the file itself are absent.

Shall we generate the patch series against the snapshot (which contains the changes)?

--

Thanks
Sandeep

maintainer
#5 lore raw

From: "Kumar Gopalpet-B05799" <[email protected]>
Date: Fri, 30 Oct 2009 14:12:22 +0530

Quoted 7 lines

We were referring to the logs shown on the gitweb.
The tree log does not show this commit.
(search for this commit id failed)
http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fdavem%2Fnet-next-2.6.git
&a=search&h=29906f6a427d2004a515ebbcdc7b28bae8f6c19c&st=commit&s=e72701a cbe0b35e52d3f04d442837c06b4e64f1c

Quoted 6 lines

Whereas, the log for the file does show the commit.
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=histo
ry;f=drivers/net/fsl_pq_mdio.c;h=6ac4648669728421b934d32646ffbb626128387 6;hb=HEAD

Why is there such a mismatch on the tree itself?

If you are using HTTP for accessing my GIT tree(s) that's your problem.

I do not update the web based GIT information when I push into my tree(s), only the GIT and SSH protocols are reliable ways to clone and access my tree(s).