Skip to contentSkip to conversation

fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

PATCH New Scott Wood 1 participant 1 message Sep 24, 2007

Subsystems (2)
lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 6/9 fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.

The existing OF glue code was crufty and broken. Rather than fix it, it will be removed, and the ethernet driver now talks to the device tree directly.

The old, non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner).

---
Resent, with linux/of_platform.h instead of asm/of_platform.h

 drivers/net/fs_enet/Kconfig        |    1 +
 drivers/net/fs_enet/fs_enet-main.c |  259 ++++++++++++++++++++++++++++++++---
 drivers/net/fs_enet/fs_enet.h      |   55 +-------
 drivers/net/fs_enet/mac-fcc.c      |   89 +++++++++----
 drivers/net/fs_enet/mac-fec.c      |   19 +++-
 drivers/net/fs_enet/mac-scc.c      |   53 +++++--
 drivers/net/fs_enet/mii-bitbang.c  |  269 +++++++++++++++++++++++++++---------
 drivers/net/fs_enet/mii-fec.c      |  143 +++++++++++++++++++-
 include/linux/fs_enet_pd.h         |    5 +
 9 files changed, 714 insertions(+), 179 deletions(-)
drivers/net/fs_enet/Kconfig +1 -0
index e27ee21..2765e49 100644
@@ -11,6 +11,7 @@ config FS_ENET_HAS_SCC
 config FS_ENET_HAS_FCC
 	bool "Chip has an FCC usable for ethernet"
 	depends on FS_ENET && CPM2
+	select MDIO_BITBANG
 	default y
 
 config FS_ENET_HAS_FEC
drivers/net/fs_enet/fs_enet-main.c +241 -18

307 lines not on this page · raw message

drivers/net/fs_enet/fs_enet.h +3 -52

85 lines not on this page · raw message

drivers/net/fs_enet/mac-fcc.c +65 -24

172 lines not on this page · raw message

drivers/net/fs_enet/mac-fec.c +18 -1
index 04b4f80..7477da0 100644
@@ -43,6 +43,10 @@
 #include <asm/commproc.h>
 #endif
 
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+#include <linux/of_device.h>
+#endif
+
 #include "fs_enet.h"
 #include "fec.h"
 
@@ -95,6 +99,19 @@ static int whack_reset(fec_t * fecp)
 
 static int do_pd_setup(struct fs_enet_private *fep)
 {
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+	struct of_device *ofdev = to_of_device(fep->dev);
+
+	fep->interrupt = of_irq_to_resource(ofdev->node, 0, NULL);
+	if (fep->interrupt == NO_IRQ)
+		return -EINVAL;
+
+	fep->fec.fecp = of_iomap(ofdev->node, 0);
+	if (!fep->fcc.fccp)
+		return -EINVAL;
+
+	return 0;
+#else
 	struct platform_device *pdev = to_platform_device(fep->dev); 
 	struct resource	*r;
 	
@@ -110,7 +127,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
 		return -EINVAL;
 
 	return 0;
-	
+#endif
 }
 
 #define FEC_NAPI_RX_EVENT_MSK	(FEC_ENET_RXF | FEC_ENET_RXB)
drivers/net/fs_enet/mac-scc.c +37 -16

95 lines not on this page · raw message

drivers/net/fs_enet/mii-bitbang.c +202 -67

328 lines not on this page · raw message

drivers/net/fs_enet/mii-fec.c +142 -1

170 lines not on this page · raw message

include/linux/fs_enet_pd.h +5 -0
index 815c6f9..9bc045b 100644
@@ -120,6 +120,7 @@ struct fs_platform_info {
 
 	u32 cp_page;		/* CPM page */
 	u32 cp_block;		/* CPM sblock */
+	u32 cp_command;		/* CPM page/sblock/mcn */
 
 	u32 clk_trx;		/* some stuff for pins & mux configuration*/
 	u32 clk_rx;
@@ -134,7 +135,11 @@ struct fs_platform_info {
 	u32 device_flags;
 
 	int phy_addr;		/* the phy address (-1 no phy) */
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+	char bus_id[16];
+#else
 	const char*	bus_id;
+#endif
 	int phy_irq;		/* the phy irq (if it exists)  */
 
 	const struct fs_mii_bus_info *bus_info;
Signature · 1 line
1.5.3.1