All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] New PHY for ppc405_phy.c
@ 2001-11-29 16:05 Kent Borg
  2001-11-29 16:41 ` Tom Rini
  2001-11-29 17:28 ` Armin Kuster
  0 siblings, 2 replies; 4+ messages in thread
From: Kent Borg @ 2001-11-29 16:05 UTC (permalink / raw)
  To: linuxppc-embedded


I hope I am sending this to the right place, someone please correct me
if I am doing this wrong...


Our 405 board has a different PHY from those supported in the current
sources, the following patch makes our PHY work.  If it looks
sensible, please apply.


Thanks,

-kb



--- linuxppc_2_4_devel/drivers/net/ppc405_phy.c	Thu Nov 29 10:34:53 2001
+++ linux-penguinppc4/drivers/net/ppc405_phy.c	Thu Nov 29 10:48:07 2001
@@ -579,6 +579,75 @@
 	},
 };

+/* ------------------------------------------------------------------------- */
+/* The Lucent Technologies LU3X31FT */
+
+/* register definitions */
+
+#define MII_LU3X31FT_PHYCTRLSTS 0x17    /* PHY Control/Status Register */
+#define MII_LU3X31FT_IER        0x1D    /* PHY interrupt enable Register */
+#define MII_LU3X31FT_ISR        0x1E    /* PHY interrupt status Register */
+
+static void mii_parse_lu3x31ft_pcr(uint mii_reg, struct net_device *dev)
+{
+	struct fec_enet_private *fep = dev->priv;
+	volatile uint *s = &(fep->phy_status);
+
+	*s &= ~(PHY_STAT_SPMASK);
+
+	switch((mii_reg >> 8) & 3) {
+		case 0:
+			*s |= PHY_STAT_10HDX;
+			break;
+		case 1:
+			*s |= PHY_STAT_10FDX;
+			break;
+		case 2:
+			*s |= PHY_STAT_100HDX;
+			break;
+		case 3:
+			*s |= PHY_STAT_100FDX;
+			break;
+	}
+}
+
+static phy_info_t phy_info_lu3x31ft = {
+	0x90307421,
+	"LU3X31FT",
+	0,
+	(const phy_cmd_t []) {	/* config */
+
+		/* parse cr and anar to get some info */
+
+		{ mk_mii_read(MII_REG_CR), mii_parse_cr },
+		{ mk_mii_read(MII_REG_ANAR), mii_parse_anar },
+		{ mk_mii_end, }
+	},
+	(const phy_cmd_t []) {	/* startup - enable interrupts */
+		{ mk_mii_write(MII_LU3X31FT_IER, 0x0000), NULL },
+		{ mk_mii_write(MII_REG_CR, PHY_BMCR_RST_NEG), NULL }, /* autonegotiate */
+		{ mk_mii_end, }
+	},
+	( const phy_cmd_t []) { /* ack_int */
+
+		/* we need to read ISR, SR and ANER to acknowledge */
+
+		{ mk_mii_read(MII_LU3X31FT_ISR), NULL },
+		{ mk_mii_read(MII_REG_SR), mii_parse_sr },
+		{ mk_mii_read(MII_REG_ANAR), mii_parse_anar },
+
+		/* read pcr to get info */
+
+		{ mk_mii_read(MII_LU3X31FT_PHYCTRLSTS), mii_parse_lu3x31ft_pcr },
+		{ mk_mii_end, }
+	},
+	( const phy_cmd_t []) {	/* shutdown - disable interrupts */
+		{ mk_mii_write(MII_LU3X31FT_IER, 0xff80), NULL },
+		{ mk_mii_end, }
+	},
+};
+
+

 /* ------------------------------------------------------------------------- */
 /* The AMD Am79C875*/
@@ -659,6 +728,7 @@
 	&phy_info_lxt971a,
 	&phy_info_cs8952,
 	&phy_info_dp83846A,
+	&phy_info_lu3x31ft,
 	&phy_info_Am79C875,
 	NULL
 };

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-12-03 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-29 16:05 [PATCH] New PHY for ppc405_phy.c Kent Borg
2001-11-29 16:41 ` Tom Rini
2001-11-29 17:28 ` Armin Kuster
2001-12-03 17:00   ` Debugging message through FDC37C672-COM of MBX860?? Okehee Goh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.