Skip to contentSkip to conversation

PAL: Support of the fixed PHY

PATCH In review Vitaly Bordug 2 participants 5 messages Jun 20, 2006 – Jun 21, 2006

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 2/3 FS_ENET: use PAL for mii management

In reply to Vitaly Bordug

This patch should update the fs_enet infrastructure to utilize Phy Abstraction Layer subsystem. Inside there are generic driver rehaul, board-specific portion to respect driver changes (for 8272ads and 866ads).

---

 arch/ppc/platforms/mpc8272ads_setup.c |  154 ++++++----
 arch/ppc/platforms/mpc866ads_setup.c  |  192 ++++++------
 arch/ppc/platforms/mpc885ads_setup.c  |  179 ++++--------
 arch/ppc/syslib/mpc8xx_devices.c      |    8 +
 arch/ppc/syslib/mpc8xx_sys.c          |    6 
 arch/ppc/syslib/pq2_devices.c         |    5 
 arch/ppc/syslib/pq2_sys.c             |    3 
 drivers/net/fs_enet/Makefile          |    6 
 drivers/net/fs_enet/fec.h             |   42 +++
 drivers/net/fs_enet/fs_enet-main.c    |  207 ++++++++-----
 drivers/net/fs_enet/fs_enet-mii.c     |  507 ---------------------------------
 drivers/net/fs_enet/fs_enet.h         |   40 ++-
 drivers/net/fs_enet/mac-fcc.c         |   10 -
 drivers/net/fs_enet/mac-fec.c         |  132 +--------
 drivers/net/fs_enet/mac-scc.c         |    4 
 drivers/net/fs_enet/mii-bitbang.c     |  384 +++++++++++++++----------
 drivers/net/fs_enet/mii-fec.c         |  243 ++++++++++++++++
 drivers/net/fs_enet/mii-fixed.c       |   92 ------
 include/asm-ppc/mpc8260.h             |    1 
 include/asm-ppc/mpc8xx.h              |    1 
 include/linux/fs_enet_pd.h            |   50 +--
 21 files changed, 983 insertions(+), 1283 deletions(-)
arch/ppc/platforms/mpc8272ads_setup.c +85 -69
index abb7154..2a35fe2 100644
@@ -56,64 +56,51 @@ static struct fs_uart_platform_info mpc8
 	},
 };
 
-static struct fs_mii_bus_info mii_bus_info = {
-	.method                 = fsmii_bitbang,
-	.id                     = 0,
-	.i.bitbang = {
-		.mdio_port	= fsiop_portc,
-		.mdio_bit	= 18,
-		.mdc_port	= fsiop_portc,
-		.mdc_bit	= 19,
-		.delay		= 1,
-	},
-};
-
-static struct fs_platform_info mpc82xx_fcc1_pdata = {
-	.fs_no		= fsid_fcc1,
-	.cp_page	= CPM_CR_FCC1_PAGE,
-	.cp_block 	= CPM_CR_FCC1_SBLOCK,
-	.clk_trx 	= (PC_F1RXCLK | PC_F1TXCLK),
-	.clk_route	= CMX1_CLK_ROUTE,
-	.clk_mask	= CMX1_CLK_MASK,
-	.init_ioports 	= init_fcc1_ioports,
-
-	.phy_addr	= 0,
-#ifdef PHY_INTERRUPT
-	.phy_irq	= PHY_INTERRUPT,
-#else
-	.phy_irq	= -1;
-#endif
-	.mem_offset	= FCC1_MEM_OFFSET,
-	.bus_info	= &mii_bus_info,
-	.rx_ring	= 32,
-	.tx_ring	= 32,
-	.rx_copybreak	= 240,
-	.use_napi	= 0,
-	.napi_weight	= 17,
+static struct fs_mii_bb_platform_info m82xx_mii_bb_pdata = {
+	.mdio_dat.bit	= 18,
+	.mdio_dir.bit	= 18,
+	.mdc_dat.bit	= 19,
+	.delay		= 1,
 };
 
-static struct fs_platform_info mpc82xx_fcc2_pdata = {
-	.fs_no		= fsid_fcc2,
-	.cp_page	= CPM_CR_FCC2_PAGE,
-	.cp_block 	= CPM_CR_FCC2_SBLOCK,
-	.clk_trx 	= (PC_F2RXCLK | PC_F2TXCLK),
-	.clk_route	= CMX2_CLK_ROUTE,
-	.clk_mask	= CMX2_CLK_MASK,
-	.init_ioports	= init_fcc2_ioports,
-
-	.phy_addr	= 3,
-#ifdef PHY_INTERRUPT
-	.phy_irq	= PHY_INTERRUPT,
-#else
-	.phy_irq	= -1;
-#endif
-	.mem_offset	= FCC2_MEM_OFFSET,
-	.bus_info	= &mii_bus_info,
-	.rx_ring	= 32,
-	.tx_ring	= 32,
-	.rx_copybreak	= 240,
-	.use_napi	= 0,
-	.napi_weight	= 17,
+static struct fs_platform_info mpc82xx_enet_pdata[] = {
+	[fsid_fcc1] = {
+		.fs_no		= fsid_fcc1,
+		.cp_page	= CPM_CR_FCC1_PAGE,
+		.cp_block 	= CPM_CR_FCC1_SBLOCK,
+
+		.clk_trx 	= (PC_F1RXCLK | PC_F1TXCLK),
+		.clk_route	= CMX1_CLK_ROUTE,
+		.clk_mask	= CMX1_CLK_MASK,
+		.init_ioports 	= init_fcc1_ioports,
+
+		.mem_offset	= FCC1_MEM_OFFSET,
+
+		.rx_ring	= 32,
+		.tx_ring	= 32,
+		.rx_copybreak	= 240,
+		.use_napi	= 0,
+		.napi_weight	= 17,
+		.bus_id		= "0:00",
+	},
+	[fsid_fcc2] = {
+		.fs_no		= fsid_fcc2,
+		.cp_page	= CPM_CR_FCC2_PAGE,
+		.cp_block 	= CPM_CR_FCC2_SBLOCK,
+		.clk_trx 	= (PC_F2RXCLK | PC_F2TXCLK),
+		.clk_route	= CMX2_CLK_ROUTE,
+		.clk_mask	= CMX2_CLK_MASK,
+		.init_ioports	= init_fcc2_ioports,
+
+		.mem_offset	= FCC2_MEM_OFFSET,
+
+		.rx_ring	= 32,
+		.tx_ring	= 32,
+		.rx_copybreak	= 240,
+		.use_napi	= 0,
+		.napi_weight	= 17,
+		.bus_id		= "0:03",
+	},
 };
 
 static void init_fcc1_ioports(void)
@@ -209,20 +196,21 @@ static void __init mpc8272ads_fixup_enet
 	bd_t* bi = (void*)__res;
 	int fs_no = fsid_fcc1+pdev->id-1;
 
-	mpc82xx_fcc1_pdata.dpram_offset = mpc82xx_fcc2_pdata.dpram_offset = (u32)cpm2_immr->im_dprambase;
-	mpc82xx_fcc1_pdata.fcc_regs_c = mpc82xx_fcc2_pdata.fcc_regs_c = (u32)cpm2_immr->im_fcc_c;
-
-	switch(fs_no) {
-		case fsid_fcc1:
-			memcpy(&mpc82xx_fcc1_pdata.macaddr,bi->bi_enetaddr,6);
-			pdev->dev.platform_data = &mpc82xx_fcc1_pdata;
-		break;
-		case fsid_fcc2:
-			memcpy(&mpc82xx_fcc2_pdata.macaddr,bi->bi_enetaddr,6);
-			mpc82xx_fcc2_pdata.macaddr[5] ^= 1;
-			pdev->dev.platform_data = &mpc82xx_fcc2_pdata;
-		break;
+	if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) {
+		return;
 	}
+
+	mpc82xx_enet_pdata[fs_no].dpram_offset=
+			(u32)cpm2_immr->im_dprambase;
+	mpc82xx_enet_pdata[fs_no].fcc_regs_c =
+			(u32)cpm2_immr->im_fcc_c;
+	memcpy(&mpc82xx_enet_pdata[fs_no].macaddr,bi->bi_enetaddr,6);
+
+	/* prevent dup mac */
+	if(fs_no == fsid_fcc2)
+		mpc82xx_enet_pdata[fs_no].macaddr[5] ^= 1;
+
+	pdev->dev.platform_data = &mpc82xx_enet_pdata[fs_no];
 }
 
 static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev,
@@ -274,6 +262,29 @@ static void init_scc4_uart_ioports(void)
 	iounmap(immap);
 }
 
+static void __init mpc8272ads_fixup_mdio_pdata(struct platform_device *pdev,
+					      int idx)
+{
+	m82xx_mii_bb_pdata.irq[0] = PHY_INTERRUPT;
+	m82xx_mii_bb_pdata.irq[1] = -1;
+	m82xx_mii_bb_pdata.irq[2] = -1;
+	m82xx_mii_bb_pdata.irq[3] = PHY_INTERRUPT;
+	m82xx_mii_bb_pdata.irq[31] = -1;
+
+
+	m82xx_mii_bb_pdata.mdio_dat.offset =
+				(u32)&cpm2_immr->im_ioport.iop_pdatc;
+
+	m82xx_mii_bb_pdata.mdio_dir.offset =
+				(u32)&cpm2_immr->im_ioport.iop_pdirc;
+
+	m82xx_mii_bb_pdata.mdc_dat.offset =
+				(u32)&cpm2_immr->im_ioport.iop_pdatc;
+
+
+	pdev->dev.platform_data = &m82xx_mii_bb_pdata;
+}
+
 static int mpc8272ads_platform_notify(struct device *dev)
 {
 	static const struct platform_notify_dev_map dev_map[] = {
@@ -286,6 +297,10 @@ static int mpc8272ads_platform_notify(st
 			.rtn = mpc8272ads_fixup_uart_pdata,
 		},
 		{
+			.bus_id = "fsl-bb-mdio",
+			.rtn = mpc8272ads_fixup_mdio_pdata,
+		},
+		{
 			.bus_id = NULL
 		}
 	};
@@ -319,6 +334,7 @@ int __init mpc8272ads_init(void)
 	ppc_sys_device_enable(MPC82xx_CPM_SCC4);
 #endif
 
+	ppc_sys_device_enable(MPC82xx_MDIO_BB);
 
 	return 0;
 }
arch/ppc/platforms/mpc866ads_setup.c +96 -96

247 lines not on this page · raw message

arch/ppc/platforms/mpc885ads_setup.c +68 -111

280 lines not on this page · raw message

arch/ppc/syslib/mpc8xx_devices.c +8 -0
index 6f53638..cf5ab47 100644
@@ -218,6 +218,14 @@ struct platform_device ppc_sys_platform_
 			},
 		},
 	},
+
+        [MPC8xx_MDIO_FEC] = {
+                .name = "fsl-cpm-fec-mdio",
+                .id = 0,
+                .num_resources = 0,
+
+        },
+
 };
 
 static int __init mach_mpc8xx_fixup(struct platform_device *pdev)
arch/ppc/syslib/mpc8xx_sys.c +4 -2
index eee2132..18ba1d7 100644
@@ -22,7 +22,7 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		.ppc_sys_name	= "MPC86X",
 		.mask 		= 0xFFFFFFFF,
 		.value 		= 0x00000000,
-		.num_devices	= 7,
+		.num_devices	= 8,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC8xx_CPM_FEC1,
@@ -32,13 +32,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC8xx_CPM_SCC4,
 			MPC8xx_CPM_SMC1,
 			MPC8xx_CPM_SMC2,
+			MPC8xx_MDIO_FEC,
 		},
 	},
 	{
 		.ppc_sys_name	= "MPC885",
 		.mask 		= 0xFFFFFFFF,
 		.value 		= 0x00000000,
-		.num_devices	= 8,
+		.num_devices	= 9,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC8xx_CPM_FEC1,
@@ -49,6 +50,7 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 			MPC8xx_CPM_SCC4,
 			MPC8xx_CPM_SMC1,
 			MPC8xx_CPM_SMC2,
+			MPC8xx_MDIO_FEC,
 		},
 	},
 	{	/* default match */
arch/ppc/syslib/pq2_devices.c +5 -0
index 8692d00..fefbc21 100644
@@ -369,6 +369,11 @@ struct platform_device ppc_sys_platform_
 			},
 		},
 	},
+	[MPC82xx_MDIO_BB] = {
+		.name = "fsl-bb-mdio",
+		.id = 0,
+		.num_resources = 0,
+	},
 };
 
 static int __init mach_mpc82xx_fixup(struct platform_device *pdev)
arch/ppc/syslib/pq2_sys.c +2 -1
index fee8948..f52600c 100644
@@ -139,13 +139,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
 		.ppc_sys_name	= "8272",
 		.mask		= 0x0000ff00,
 		.value		= 0x00000c00,
-		.num_devices	= 12,
+		.num_devices	= 13,
 		.device_list = (enum ppc_sys_devices[])
 		{
 			MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1,
 			MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4,
 			MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI,
 			MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1,
+			MPC82xx_MDIO_BB,
 		},
 	},
 	/* below is a list of the 8280 family of processors */
drivers/net/fs_enet/Makefile +3 -3
index d6dd3f2..02d4dc1 100644
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_FS_ENET) += fs_enet.o
 
-obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o
-obj-$(CONFIG_8260) += mac-fcc.o
+obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o
+obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o
 
-fs_enet-objs := fs_enet-main.o fs_enet-mii.o mii-bitbang.o mii-fixed.o
+fs_enet-objs := fs_enet-main.o
drivers/net/fs_enet/fec.h new file +42 -0

42 lines not on this page · raw message

drivers/net/fs_enet/fs_enet-main.c +129 -78

312 lines not on this page · raw message

drivers/net/fs_enet/fs_enet-mii.c deleted +0 -507

507 lines not on this page · raw message

drivers/net/fs_enet/fs_enet.h +25 -15
index e7ec96c..95022c0 100644
@@ -5,6 +5,7 @@
 #include <linux/netdevice.h>
 #include <linux/types.h>
 #include <linux/list.h>
+#include <linux/phy.h>
 
 #include <linux/fs_enet_pd.h>
 
@@ -12,12 +13,30 @@
 
 #ifdef CONFIG_CPM1
 #include <asm/commproc.h>
+
+struct fec_info {
+        fec_t*  fecp;
+	u32     mii_speed;
+};
 #endif
 
 #ifdef CONFIG_CPM2
 #include <asm/cpm2.h>
 #endif
 
+/* This is used to operate with pins.
+  Note that the actual port size may
+    be different; cpm(s) handle it OK  */
+struct bb_info {
+	u8 mdio_dat_msk;
+	u8 mdio_dir_msk;
+	u8 *mdio_dir;
+	u8 *mdio_dat;
+	u8 mdc_msk;
+	u8 *mdc_dat;
+	int delay;
+};
+
 /* hw driver ops */
 struct fs_ops {
 	int (*setup_data)(struct net_device *dev);
@@ -25,6 +44,7 @@ struct fs_ops {
 	void (*free_bd)(struct net_device *dev);
 	void (*cleanup_data)(struct net_device *dev);
 	void (*set_multicast_list)(struct net_device *dev);
+	void (*adjust_link)(struct net_device *dev);
 	void (*restart)(struct net_device *dev);
 	void (*stop)(struct net_device *dev);
 	void (*pre_request_irq)(struct net_device *dev, int irq);
@@ -100,10 +120,6 @@ struct fs_enet_mii_bus {
 	};
 };
 
-int fs_mii_bitbang_init(struct fs_enet_mii_bus *bus);
-int fs_mii_fixed_init(struct fs_enet_mii_bus *bus);
-int fs_mii_fec_init(struct fs_enet_mii_bus *bus);
-
 struct fs_enet_private {
 	struct device *dev;	/* pointer back to the device (must be initialized first) */
 	spinlock_t lock;	/* during all ops except TX pckt processing */
@@ -130,7 +146,8 @@ struct fs_enet_private {
 	struct fs_enet_mii_bus *mii_bus;
 	int interrupt;
 
-	int duplex, speed;	/* current settings */
+	struct phy_device *phydev;
+	int oldduplex, oldspeed, oldlink;	/* current settings */
 
 	/* event masks */
 	u32 ev_napi_rx;		/* mask of NAPI rx events */
@@ -168,15 +185,9 @@ struct fs_enet_private {
 };
 
 /***************************************************************************/
-
-int fs_mii_read(struct net_device *dev, int phy_id, int location);
-void fs_mii_write(struct net_device *dev, int phy_id, int location, int value);
-
-void fs_mii_startup(struct net_device *dev);
-void fs_mii_shutdown(struct net_device *dev);
-void fs_mii_ack_int(struct net_device *dev);
-
-void fs_mii_link_status_change_check(struct net_device *dev, int init_media);
+int fs_enet_mdio_bb_init(void);
+int fs_mii_fixed_init(struct fs_enet_mii_bus *bus);
+int fs_enet_mdio_fec_init(void);
 
 void fs_init_bds(struct net_device *dev);
 void fs_cleanup_bds(struct net_device *dev);
@@ -194,7 +205,6 @@ int fs_enet_platform_init(void);
 void fs_enet_platform_cleanup(void);
 
 /***************************************************************************/
-
 /* buffer descriptor access macros */
 
 /* access macros */
drivers/net/fs_enet/mac-fcc.c +7 -3
index 95e2bb8..ce40cf9 100644
@@ -35,6 +35,7 @@
 #include <linux/bitops.h>
 #include <linux/fs.h>
 #include <linux/platform_device.h>
+#include <linux/phy.h>
 
 #include <asm/immap_cpm2.h>
 #include <asm/mpc8260.h>
@@ -395,7 +396,7 @@ static void restart(struct net_device *d
 
 	/* adjust to speed (for RMII mode) */
 	if (fpi->use_rmii) {
-		if (fep->speed == 100)
+		if (fep->phydev->speed == 100)
 			C8(fcccp, fcc_gfemr, 0x20);
 		else
 			S8(fcccp, fcc_gfemr, 0x20);
@@ -421,7 +422,7 @@ static void restart(struct net_device *d
 		S32(fccp, fcc_fpsmr, FCC_PSMR_RMII);
 
 	/* adjust to duplex mode */
-	if (fep->duplex)
+	if (fep->phydev->duplex)
 		S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB);
 	else
 		C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB);
@@ -487,7 +488,10 @@ static void rx_bd_done(struct net_device
 
 static void tx_kickstart(struct net_device *dev)
 {
-	/* nothing */
+	struct fs_enet_private *fep = netdev_priv(dev);
+	fcc_t *fccp = fep->fcc.fccp;
+
+	S32(fccp, fcc_ftodr, 0x80);
 }
 
 static u32 get_int_events(struct net_device *dev)
drivers/net/fs_enet/mac-fec.c +13 -119

189 lines not on this page · raw message

drivers/net/fs_enet/mac-scc.c +3 -1
index a772b28..d829120 100644
@@ -370,7 +370,7 @@ static void restart(struct net_device *d
 	W16(sccp, scc_psmr, SCC_PSMR_ENCRC | SCC_PSMR_NIB22);
 
 	/* Set full duplex mode if needed */
-	if (fep->duplex)
+	if (fep->phydev->duplex)
 		S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE);
 
 	S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
@@ -501,6 +501,8 @@ static void tx_restart(struct net_device
 	scc_cr_cmd(fep, CPM_CR_RESTART_TX);
 }
 
+
+
 /*************************************************************************/
 
 const struct fs_ops fs_scc_ops = {
drivers/net/fs_enet/mii-bitbang.c +227 -157

524 lines not on this page · raw message

drivers/net/fs_enet/mii-fec.c new file +243 -0

243 lines not on this page · raw message

drivers/net/fs_enet/mii-fixed.c deleted +0 -92

92 lines not on this page · raw message

include/asm-ppc/mpc8260.h +1 -0
index 6ba69a8..e4a897e 100644
@@ -83,6 +83,7 @@ enum ppc_sys_devices {
 	MPC82xx_CPM_SMC2,
 	MPC82xx_CPM_USB,
 	MPC82xx_SEC1,
+	MPC82xx_MDIO_BB,
 	NUM_PPC_SYS_DEVS,
 };
 
include/asm-ppc/mpc8xx.h +1 -0
index 3515a7f..8830dfe 100644
@@ -111,6 +111,7 @@ enum ppc_sys_devices {
 	MPC8xx_CPM_SMC1,
 	MPC8xx_CPM_SMC2,
 	MPC8xx_CPM_USB,
+	MPC8xx_MDIO_FEC,
 	NUM_PPC_SYS_DEVS,
 };
 
include/linux/fs_enet_pd.h +21 -29

67 lines not on this page · raw message

#4 lore raw

PATCH 3/3 FS_ENET: phydev pointer may be dereferenced without NULL check

In reply to Vitaly Bordug

When interface is down, phy is "disconnected" from the bus and phydev is NULL. But ethtool may try to get/set phy regs even at that time, which results in NULL pointer dereference and OOPS hereby.

---

 drivers/net/fs_enet/fs_enet-main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/fs_enet/fs_enet-main.c +4 -0
index 302ecaa..e475e22 100644
@@ -882,12 +882,16 @@ static void fs_get_regs(struct net_devic
 static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
+	if (!fep->phydev)
+		return -EINVAL;
 	return phy_ethtool_gset(fep->phydev, cmd);
 }
 
 static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
+	if (!fep->phydev)
+		return -EINVAL;
 	phy_ethtool_sset(fep->phydev, cmd);
 	return 0;
 }
#0 lore raw

PATCH 1/3 PAL: Support of the fixed PHY

This makes it possible for HW PHY-less boards to utilize PAL goodies. Generic routines to connect to fixed PHY are provided, as well as ability to specify software callback that fills up link, speed, etc. information into PHY descriptor (the latter feature not tested so far).

---

 drivers/net/phy/Kconfig      |   17 ++
 drivers/net/phy/fixed.c      |  385 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy_device.c |   51 +++---
 include/linux/phy.h          |    1 
 4 files changed, 433 insertions(+), 21 deletions(-)
drivers/net/phy/Kconfig +17 -0
index cda3e53..425be84 100644
@@ -51,5 +51,22 @@ config SMSC_PHY
 	---help---
 	  Currently supports the LAN83C185 PHY
 
+config FIXED_PHY
+	tristate "Drivers for PHY emulation on fixed speed/link"
+	depends on PHYLIB
+	---help---
+	  Adds the driver to PHY layer to cover the boards that do not have any PHY bound,
+	  but with the ability to manipulate with speed/link in software. The relavant MII
+	  speed/duplex parameters could be effectively handled in user-specified  fuction.
+	  Currently tested with mpc866ads.
+
+config FIXED_MII_10_FDX
+	bool "Emulation for 10M Fdx fixed PHY behavior"
+	depends on FIXED_PHY
+
+config FIXED_MII_100_FDX
+	bool "Emulation for 100M Fdx fixed PHY behavior"
+	depends on FIXED_PHY
+
 endmenu
 
drivers/net/phy/fixed.c new file +385 -0

385 lines not on this page · raw message

drivers/net/phy/phy_device.c +30 -21

63 lines not on this page · raw message

include/linux/phy.h +1 -0
index 331521a..9447a57 100644
@@ -378,6 +378,7 @@ int phy_mii_ioctl(struct phy_device *phy
 		struct mii_ioctl_data *mii_data, int cmd);
 int phy_start_interrupts(struct phy_device *phydev);
 void phy_print_status(struct phy_device *phydev);
+struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
 
 extern struct bus_type mdio_bus_type;
 #endif /* __PHY_H */
#2 lore raw

Re: [PATCH 2/3] FS_ENET: use PAL for mii management

In reply to Vitaly Bordug

Hi,

Quoted 22 lines · Vitaly Bordug

This patch should update the fs_enet infrastructure to utilize Phy Abstraction Layer subsystem. Inside there are generic driver rehaul, board-specific portion to respect driver changes (for 8272ads and 866ads).

---

 arch/ppc/platforms/mpc8272ads_setup.c |  154 ++++++----
 arch/ppc/platforms/mpc866ads_setup.c  |  192 ++++++------
 arch/ppc/platforms/mpc885ads_setup.c  |  179 ++++--------
 arch/ppc/syslib/mpc8xx_devices.c      |    8 +
 arch/ppc/syslib/mpc8xx_sys.c          |    6 
 arch/ppc/syslib/pq2_devices.c         |    5 
 arch/ppc/syslib/pq2_sys.c             |    3 
 drivers/net/fs_enet/Makefile          |    6 
 drivers/net/fs_enet/fec.h             |   42 +++
 drivers/net/fs_enet/fs_enet-main.c    |  207 ++++++++-----
 drivers/net/fs_enet/fs_enet-mii.c     |  507 ---------------------------------
 drivers/net/fs_enet/fs_enet.h         |   40 ++-
 drivers/net/fs_enet/mac-fcc.c         |   10 -
 drivers/net/fs_enet/mac-fec.c         |  132 +--------
Quoted 8 lines
 drivers/net/fs_enet/mac-scc.c         |    4 
 drivers/net/fs_enet/mii-bitbang.c     |  384 +++++++++++++++----------
 drivers/net/fs_enet/mii-fec.c         |  243 ++++++++++++++++
 drivers/net/fs_enet/mii-fixed.c       |   92 ------
 include/asm-ppc/mpc8260.h             |    1 
 include/asm-ppc/mpc8xx.h              |    1 
 include/linux/fs_enet_pd.h            |   50 +--
 21 files changed, 983 insertions(+), 1283 deletions(-)

[SNIPSNAP]

Quoted 21 lines
drivers/net/fs_enet/mii-bitbang.c +2 -0
index 24a5e2e..145bf4c 100644
@@ -34,6 +34,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
+#include <linux/platform_device.h>
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
@@ -41,6 +42,7 @@
 
 #include "fs_enet.h"
 
+
 #ifdef CONFIG_8xx
 static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int bit)
 {

drivers/net/fs_enet/mii-bitbang.c static int bitbang_prep_bit(u8 **dirp, u · line 112

Quoted 7 lines
drivers/net/fs_enet/mii-bitbang.c +2 -2
@@ -106,64 +108,25 @@ static int bitbang_prep_bit(u8 **dirp, u
 }
 #endif
 
-#ifdef CONFIG_8260
-static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int bit)
+static int bitbang_prep_bit(u8 **datp, u8 *mskp,
+		struct fs_mii_bit *mii_bit)

is it possible, that in case of CONFIG_8xx you'll have two times this bitbang_prep_bit() function?

Gerhard

Signature · 3 lines
Gerhard Jaeger <[email protected]>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de 
#3 lore raw

Re: [PATCH 2/3] FS_ENET: use PAL for mii management

На Wed, 21 Jun 2006 09:20:36 +0200
Gerhard Jaeger <[email protected]> записано:

Quoted 61 lines

Hi,

Quoted 26 lines · Vitaly Bordug

This patch should update the fs_enet infrastructure to utilize Phy Abstraction Layer subsystem. Inside there are generic driver rehaul, board-specific portion to respect driver changes (for 8272ads and 866ads).

---

 arch/ppc/platforms/mpc8272ads_setup.c |  154 ++++++----
 arch/ppc/platforms/mpc866ads_setup.c  |  192 ++++++------
 arch/ppc/platforms/mpc885ads_setup.c  |  179 ++++--------
 arch/ppc/syslib/mpc8xx_devices.c      |    8 +
 arch/ppc/syslib/mpc8xx_sys.c          |    6 
 arch/ppc/syslib/pq2_devices.c         |    5 
 arch/ppc/syslib/pq2_sys.c             |    3 
 drivers/net/fs_enet/Makefile          |    6 
 drivers/net/fs_enet/fec.h             |   42 +++
 drivers/net/fs_enet/fs_enet-main.c    |  207 ++++++++-----
 drivers/net/fs_enet/fs_enet-mii.c     |  507
---------------------------------
drivers/net/fs_enet/fs_enet.h         |   40 ++-
drivers/net/fs_enet/mac-fcc.c         |   10 -
drivers/net/fs_enet/mac-fec.c         |  132 +--------
drivers/net/fs_enet/mac-scc.c         |    4
drivers/net/fs_enet/mii-bitbang.c     |  384
Quoted 6 lines

+++++++++++++++---------- drivers/net/fs_enet/mii-fec.c |
243 ++++++++++++++++ drivers/net/fs_enet/mii-fixed.c | 92
------ include/asm-ppc/mpc8260.h | 1
include/asm-ppc/mpc8xx.h | 1
include/linux/fs_enet_pd.h | 50 +-- 21 files changed,
983 insertions(+), 1283 deletions(-)

[SNIPSNAP]

Quoted 24 lines
(quoted diff) +0 -0

b/drivers/net/fs_enet/mii-bitbang.c index 24a5e2e..145bf4c 100644

drivers/net/fs_enet/mii-bitbang.c +2 -0
@@ -34,6 +34,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
+#include <linux/platform_device.h>
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
@@ -41,6 +42,7 @@
 
 #include "fs_enet.h"
 
+
 #ifdef CONFIG_8xx
 static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int
 port, int bit) {
@@ -106,64 +108,25 @@ static int bitbang_prep_bit(u8 **dirp, u
 }
 #endif
 
Quoted 8 lines

drivers/net/fs_enet/mii-bitbang.c static int bitbang_prep_bit(u8 **dirp, u · line 112

Quoted 4 lines
drivers/net/fs_enet/mii-bitbang.c +1 -2
-#ifdef CONFIG_8260
-static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int
 port, int bit) +static int bitbang_prep_bit(u8 **datp, u8 *mskp,
+		struct fs_mii_bit *mii_bit)

is it possible, that in case of CONFIG_8xx you'll have two times this bitbang_prep_bit() function?

Hmm, yes, thanks for pointing that out. The problem is in other thing though - the bitbang stuff got unified so there should be no board-specific ifdefs like those.

This issue must have missed the cleanup, I'll fix and redo the patches.

--
Sincerely, Vitaly
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded