Skip to contentSkip to conversation

ftgmac100: support of gigabit eth ftgmac100

PATCH Superseded Macpaul Lin 2 participants 2 messages Dec 15, 2010 – Dec 18, 2010 Network drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ftgmac100: support of gigabit eth ftgmac100

Add Faraday's ftgmac100 (gigabit ethernet)
MAC controller's driver.

---
Changes for v2:
- Coding Style cleanup
- Makefile Order sorted
- Volatile statement eliminated
- Error handling added
- Autonegotiation timeout value rechecked
- Link speed detection code is reduced
- Logic of autonegotiation and Link speed update reorganized
- Redundent registers offset table cleared
- The explaination of sub configuration of this driver has moved into README

 README                  |   12 +
 drivers/net/Makefile    |    1 +
 drivers/net/ftgmac100.c |  576 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ftgmac100.h |  255 +++++++++++++++++++++
 include/netdev.h        |    1 +
 5 files changed, 845 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/ftgmac100.c
 create mode 100644 drivers/net/ftgmac100.h
README +12 -0
index 68f5fb0..d7a23cd 100644
@@ -861,6 +861,18 @@ The following options need to be configured:
 			Define this to use i/o functions instead of macros
 			(some hardware wont work with macros)
 
+		CONFIG_FTGMAC100
+		Support for Faraday's FTGMAC100 Gigabit SoC Ethernet
+
+			CONFIG_FTGMAC100_EGIGA
+			Define this to use GE link update with gigabit PHY.
+			Define this if FTGMAC100 is connected to gigabit PHY.
+			If your system has 10/100 PHY only, it might not occur
+			wrong behavior. Because PHY usually return timeout or
+			useless data when polling gigabit status and gigabit
+			control registers. This behavior won't affect the
+			correctnessof 10/100 link speed update.
+
 		CONFIG_SMC911X
 		Support for SMSC's LAN911x and LAN921x chips
 
drivers/net/Makefile +1 -0
index b605eea..fd9d0b4 100644
@@ -47,6 +47,7 @@ COBJS-$(CONFIG_EP93XX) += ep93xx_eth.o
 COBJS-$(CONFIG_ETHOC) += ethoc.o
 COBJS-$(CONFIG_FEC_MXC) += fec_mxc.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
+COBJS-$(CONFIG_FTGMAC100) += ftgmac100.o
 COBJS-$(CONFIG_FTMAC100) += ftmac100.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
drivers/net/ftgmac100.c new file +576 -0

576 lines not on this page · raw message

drivers/net/ftgmac100.h new file +255 -0

255 lines not on this page · raw message

include/netdev.h +1 -0
index 7f66419..1a542e8 100644
@@ -61,6 +61,7 @@ int ethoc_initialize(u8 dev_num, int base_addr);
 int eth_3com_initialize (bd_t * bis);
 int fec_initialize (bd_t *bis);
 int fecmxc_initialize (bd_t *bis);
+int ftgmac100_initialize(bd_t *bits);
 int ftmac100_initialize(bd_t *bits);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH v2 1/1 ftgmac100: support of gigabit eth ftgmac100

Dear Macpaul Lin,

Quoted 4 lines · In message <[email protected]> you wrote:

Add Faraday's ftgmac100 (gigabit ethernet)
MAC controller's driver.

...

Quoted 2 lines
drivers/net/ftgmac100.c new file +0 -0

...

drivers/net/ftgmac100.c line 52

Quoted 3 lines
drivers/net/ftgmac100.c new file +3 -0
+};
+
+

Only one blank line, please.

Quoted 3 lines

+/******************************************************************************
+ * struct mii_bus functions
+ *****************************************************************************/

Incorrect multi-line comment style. Please fix globally.

drivers/net/ftgmac100.c line 138

Quoted 10 lines
drivers/net/ftgmac100.c new file +10 -0
+int ftgmac100_phy_read(struct eth_device *dev, int addr,
+		int reg, u16 *value)
+{
+	*value = ftgmac100_mdiobus_read(dev , addr, reg);
+
+	if (*value == -1)
+		return -1;
+	else
+		return 0;
+}

Drop the else and unindent the return 0;

drivers/net/ftgmac100.c line 147

Quoted 8 lines
drivers/net/ftgmac100.c new file +8 -0
+int  ftgmac100_phy_write(struct eth_device *dev, int addr,
+		int reg, u16 value)
+{
+	if (ftgmac100_mdiobus_write(dev, addr, reg, value) == -1)
+		return -1;
+	else
+		return 0;
+}

Ditto. Please fix globally.

drivers/net/ftgmac100.c line 158

Quoted 2 lines
drivers/net/ftgmac100.c new file +2 -0
+	ftgmac100_phy_write(dev, priv->phy_addr,
+		MII_ADVERTISE, adv);

Make this a single line, please. [Same globally where applicable]

drivers/net/ftgmac100.c line 233

Quoted 4 lines
drivers/net/ftgmac100.c new file +4 -0
+	if (!(status & BMSR_LSTATUS)) {
+		printf("%s: link down\n", dev->name);
+		return 0;
+	} else {

Remove else and unindent the rest.

drivers/net/ftgmac100.c line 305

Quoted 8 lines
drivers/net/ftgmac100.c new file +8 -0
+#ifdef CONFIG_FTGMAC100_EGIGA
+	if (stat_ge & LPA_1000FULL)
+		/* set gmac for 1000BaseTX and Full Duplex */
+		maccr |= FTGMAC100_MACCR_GIGA_MODE | FTGMAC100_MACCR_FULLDUP;
+
+	if (stat_ge & LPA_1000HALF)
+		/* set gmac for 1000BaseTX and Half Duplex */
+		maccr |= FTGMAC100_MACCR_GIGA_MODE;

Braces needed for multi-line statements. Please fix globally.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I had the rare misfortune of being one of the first people to try and
implement a PL/1 compiler.                             -- T. Cheatham