Skip to contentSkip to conversation

altera_tse: Several small, but relevant fixes/feature

PATCH New Joachim Foerster 4 participants 21 messages Oct 17, 2011 – Oct 26, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

cover altera_tse: Several small, but relevant fixes/feature

This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board.
The new feature is the support for dedicated descriptor memory.

Joachim Foerster (5):
altera_tse: Clear SGDMA's RUN bit in async case, too.
altera_tse: Fix SGDMA reset triggering.
altera_tse: Add support for dedicated descriptor memory.
altera_tse: m88e1111s: Honor device flags regarding PHY interface
mode.
altera_tse: Fix return of eth_device's recv() callback.

 board/altera/nios2-generic/nios2-generic.c |   10 +++++-
 drivers/net/altera_tse.c                   |   45 ++++++++++++++++++++++-----
 include/netdev.h                           |    3 +-
 3 files changed, 47 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/5 altera_tse: Clear SGDMA's RUN bit in async case, too.

---
 drivers/net/altera_tse.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/altera_tse.c +6 -0
index 54a944b..c7f8ba9 100644
@@ -199,6 +199,12 @@ static int alt_sgdma_do_async_transfer(volatile struct alt_sgdma_registers *dev,
 		debug("Timeout waiting sgdma in do async!\n");
 
 	/*
+	 * Clear the RUN bit in the control register. This is needed
+	 * restart the SGDMA engine later on.
+	 */
+	dev->control = 0;
+
+	/*
 	 * Clear any (previous) status register information
 	 * that might occlude our error checking later.
 	 */
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/5 altera_tse: Fix SGDMA reset triggering.

In reply to Joachim Foerster

The SW_RESET needs to be set!

---
 drivers/net/altera_tse.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/altera_tse.c +4 -4
index c7f8ba9..8bc600a 100644
@@ -357,8 +357,8 @@ static void tse_eth_reset(struct eth_device *dev)
 
 	if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
 		debug("Timeout waiting for rx sgdma!\n");
-		rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
-		rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 	}
 
 	counter = 0;
@@ -370,8 +370,8 @@ static void tse_eth_reset(struct eth_device *dev)
 
 	if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
 		debug("Timeout waiting for tx sgdma!\n");
-		tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
-		tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 	}
 	/* reset the mac */
 	mac_dev->command_config.bits.transmit_enable = 1;
Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/5 altera_tse: Add support for dedicated descriptor memory.

In reply to Joachim Foerster
---
 board/altera/nios2-generic/nios2-generic.c |   10 +++++++++-
 drivers/net/altera_tse.c                   |   19 ++++++++++++++++---
 include/netdev.h                           |    3 ++-
 3 files changed, 27 insertions(+), 5 deletions(-)
board/altera/nios2-generic/nios2-generic.c +9 -1
index 220a4c4..49ef80d 100644
@@ -74,7 +74,15 @@ int board_eth_init(bd_t *bis)
 	rc += altera_tse_initialize(0,
 				    CONFIG_SYS_ALTERA_TSE_MAC_BASE,
 				    CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
-				    CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE);
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
+#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
+	(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
+#else
+				    0,
+				    0);
+#endif
 #endif
 #ifdef CONFIG_ETHOC
 	rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
drivers/net/altera_tse.c +16 -3
index 8bc600a..f20f7d0 100644
@@ -882,7 +882,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
 
 /* TSE init code */
 int altera_tse_initialize(u8 dev_num, int mac_base,
-			  int sgdma_rx_base, int sgdma_tx_base)
+			  int sgdma_rx_base, int sgdma_tx_base,
+			  u32 sgdma_desc_base, u32 sgdma_desc_size)
 {
 	struct altera_tse_priv *priv;
 	struct eth_device *dev;
@@ -903,8 +904,20 @@ int altera_tse_initialize(u8 dev_num, int mac_base,
 		free(dev);
 		return 0;
 	}
-	tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
-				     &dma_handle);
+	if (sgdma_desc_size) {
+		if (sgdma_desc_size < (sizeof(*tx_desc) * (3 + PKTBUFSRX))) {
+			printf("ALTERA_TSE-%hu: "
+			       "descriptor memory is too small\n", dev_num);
+			free(priv);
+			free(dev);
+			return 0;
+		}
+		tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base;
+	} else {
+		tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
+					     &dma_handle);
+	}
+
 	rx_desc = tx_desc + 2;
 	debug("tx desc: address = 0x%x\n", (unsigned int)tx_desc);
 	debug("rx desc: address = 0x%x\n", (unsigned int)rx_desc);
include/netdev.h +2 -1
index 669f60b..361df5c 100644
@@ -42,7 +42,8 @@ int cpu_eth_init(bd_t *bis);
 
 /* Driver initialization prototypes */
 int altera_tse_initialize(u8 dev_num, int mac_base,
-			  int sgdma_rx_base, int sgdma_tx_base);
+			  int sgdma_rx_base, int sgdma_tx_base,
+			  u32 sgdma_desc_base, u32 sgdma_desc_size);
 int at91emac_register(bd_t *bis, unsigned long iobase);
 int au1x00_enet_initialize(bd_t*);
 int ax88180_initialize(bd_t *bis);
Signature · 1 line
1.7.6
#4 lore raw

PATCH 4/5 altera_tse: m88e1111s: Honor device flags regarding PHY interface mode.

In reply to Joachim Foerster

Note: This is kind of guess work. The current code is preserved for all RGMII related modes. It is different for flags=0 (GMII) and flags=5 (SGMII). The last case, SGMII, is successfully tested on Altera's Terasic DE4.

---
 drivers/net/altera_tse.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/altera_tse.c +8 -2
index f20f7d0..04e19cb 100644
@@ -583,7 +583,11 @@ static uint mii_m88e1111s_setmode_sr(uint mii_reg, struct altera_tse_priv *priv)
 {
 	uint mii_data = tse_mdio_read(priv, mii_reg);
 	mii_data &= 0xfff0;
-	mii_data |= 0xb;
+	if ((priv->flags >= 1) && (priv->flags <= 4)) {
+		mii_data |= 0xb;
+	} else if (priv->flags == 5) {
+		mii_data |= 0x4;
+	}
 	return mii_data;
 }
 
@@ -591,7 +595,9 @@ static uint mii_m88e1111s_setmode_cr(uint mii_reg, struct altera_tse_priv *priv)
 {
 	uint mii_data = tse_mdio_read(priv, mii_reg);
 	mii_data &= ~0x82;
-	mii_data |= 0x82;
+	if ((priv->flags >= 1) && (priv->flags <= 4)) {
+		mii_data |= 0x82;
+	}
 	return mii_data;
 }
 
Signature · 1 line
1.7.6
#5 lore raw

PATCH 5/5 altera_tse: Fix return of eth_device's recv() callback.

In reply to Joachim Foerster
---
 drivers/net/altera_tse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/altera_tse.c +2 -0
index 04e19cb..c4ff8c7 100644
@@ -323,6 +323,8 @@ static int tse_eth_rx(struct eth_device *dev)
 
 		/* setup the sgdma */
 		alt_sgdma_do_async_transfer(priv->sgdma_rx, &rx_desc[0]);
+
+		return packet_length;
 	}
 
 	return -1;
Signature · 1 line
1.7.6
#6 lore raw

cover altera_tse: Several small, but relevant fixes/feature

In reply to Joachim Foerster

Hi all,

Did anybody get a chance to review those 5 small patches? I would like to get some feedback and work on it, if needed - to get them upstream.

Quoted 17 lines · Joachim Foerster

This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board.
The new feature is the support for dedicated descriptor memory.

Joachim Foerster (5):
altera_tse: Clear SGDMA's RUN bit in async case, too.
altera_tse: Fix SGDMA reset triggering.
altera_tse: Add support for dedicated descriptor memory.
altera_tse: m88e1111s: Honor device flags regarding PHY interface
mode.
altera_tse: Fix return of eth_device's recv() callback.

  board/altera/nios2-generic/nios2-generic.c |   10 +++++-
  drivers/net/altera_tse.c                   |   45 ++++++++++++++++++++++-----
  include/netdev.h                           |    3 +-
  3 files changed, 47 insertions(+), 11 deletions(-)
Signature · 7 lines
Joachim Foerster

Missing Link Electronics
http://www.missinglinkelectronics.com
Office EU: +49 (731) 141-149-0
Office US: +1  (408) 457-0700
email: joachim.foerster at missinglinkelectronics.com
#7 lore raw

cover altera_tse: Several small, but relevant fixes/feature

Dear Joachim,

Please be patient.

Regards,
--Scott

Quoted 25 lines · Joachim Foerster

Hi all,

Did anybody get a chance to review those 5 small patches? I would like to get some feedback and work on it, if needed - to get them upstream.

Quoted 18 lines · Joachim Foerster

This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board.
The new feature is the support for dedicated descriptor memory.

Joachim Foerster (5):
altera_tse: Clear SGDMA's RUN bit in async case, too.
altera_tse: Fix SGDMA reset triggering.
altera_tse: Add support for dedicated descriptor memory.
altera_tse: m88e1111s: Honor device flags regarding PHY interface
mode.
altera_tse: Fix return of eth_device's recv() callback.

  board/altera/nios2-generic/nios2-generic.c |   10 +++++-
  drivers/net/altera_tse.c                   |   45 
++++++++++++++++++++++-----
  include/netdev.h                           |    3 +-
  3 files changed, 47 insertions(+), 11 deletions(-)
#8 lore raw

cover altera_tse: Several small, but relevant fixes/feature

In reply to Joachim Foerster
Quoted 5 lines · Joachim Foerster

Hi all,

Did anybody get a chance to review those 5 small patches? I would like to get some feedback and work on it, if needed - to get them upstream.

Hi Joachim,

I forwarded your patches to Dalon Westergreen of Altera on Oct 20, who is the author of this driver. I asked Dalon to help to review your patches.

I run checkpatch.pl and there are minors warnings. You may fix them after we get feedback from Dalon.

WARNING: braces {} are not necessary for any arm of this statement #55: FILE: drivers/net/altera_tse.c:586:
+ if ((priv->flags >= 1) && (priv->flags <= 4)) {
[...]
+ } else if (priv->flags == 5) {
[...]

WARNING: braces {} are not necessary for single statement blocks #68: FILE: drivers/net/altera_tse.c:598:
+ if ((priv->flags >= 1) && (priv->flags <= 4)) {
+ mii_data |= 0x82;
+ }

I am going to test your patches on 3C120 and NEEK boards. And will let you know my results.

Best regards,
Thomas

#9 lore raw

cover altera_tse: Several small, but relevant fixes/feature

Hi Thomas,

Quoted 2 lines · Thomas Chou

I forwarded your patches to Dalon Westergreen of Altera on Oct 20, who is the author of this driver. I asked Dalon to help to review your patches.

Thanks.

May I suggest, that Dalon adds his email address to the legal header? I just saw "Altera" there - no mail address, when I submitted the patchset. So I included only you, Thomas.

Quoted 2 lines

I run checkpatch.pl and there are minors warnings. You may fix them after we get feedback from Dalon.

I just did it immediately, so they are out of the way ;-), see new PATCH set - including other really, really minor stuff.

Quoted 2 lines

I am going to test your patches on 3C120 and NEEK boards. And will let you know my results.

Ok, thanks.

Signature · 7 lines
Joachim Foerster

Missing Link Electronics
http://www.missinglinkelectronics.com
Office EU: +49 (731) 141-149-0
Office US: +1  (408) 457-0700
email: joachim.foerster at missinglinkelectronics.com
#10 lore raw

v2 cover altera_tse: Several small, but relevant fixes/feature

In reply to Thomas Chou

This patch series comprises small, but relevant fixes, regarding the driver for Altera's TSE ip core. They are needed to make it run on a Terasic DE4 board.
The new feature is the support for dedicated descriptor memory.

Joachim Foerster (5):
altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync
case
altera_tse: Fix SGDMA reset triggering
altera_tse: Add support for dedicated descriptor memory
altera_tse: m88e1111s: Honor device flags regarding PHY interface
mode
altera_tse: Fix return of eth_device's recv() callback

Changes for v2:
- Fix checkpatch.pl warnings about brace around single-if-statements, PATCH 4/5
- Fix typo in added comment in code, PATCH 1/5

- Really minor commit message style fixes:
- Remove periods from end of summary lines
- Improve commit messages in PATCH 2/5 and 5/5

 board/altera/nios2-generic/nios2-generic.c |   10 +++++-
 drivers/net/altera_tse.c                   |   45 ++++++++++++++++++++++-----
 include/netdev.h                           |    3 +-
 3 files changed, 47 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.6
#11 lore raw

PATCH v2 1/5 altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case

---
Changes for v2:
- Remove period from end of summary line
- Fix typo in added comment in code

 drivers/net/altera_tse.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/altera_tse.c +6 -0
index 54a944b..47d0047 100644
@@ -199,6 +199,12 @@ static int alt_sgdma_do_async_transfer(volatile struct alt_sgdma_registers *dev,
 		debug("Timeout waiting sgdma in do async!\n");
 
 	/*
+	 * Clear the RUN bit in the control register. This is needed
+	 * to restart the SGDMA engine later on.
+	 */
+	dev->control = 0;
+
+	/*
 	 * Clear any (previous) status register information
 	 * that might occlude our error checking later.
 	 */
Signature · 1 line
1.7.6
#12 lore raw

PATCH v2 1/5 altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case

Dear Joachim Foerster,

Quoted 8 lines · In message <1319618398-1878-2-git-send-email-joachim.foerster@missinglinkelectr…

---
Changes for v2:
- Remove period from end of summary line
- Fix typo in added comment in code

 drivers/net/altera_tse.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
COBOL is for morons.                                 -- E.W. Dijkstra
#13 lore raw

PATCH v2 2/5 altera_tse: Fix SGDMA reset triggering

In reply to Joachim Foerster

The SW_RESET needs to be set instead of being masked out!

---
Changes for v2:
- Remove period from end of summary line
- Be more specific in commit message

 drivers/net/altera_tse.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/altera_tse.c +4 -4
index 47d0047..47b5761 100644
@@ -357,8 +357,8 @@ static void tse_eth_reset(struct eth_device *dev)
 
 	if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
 		debug("Timeout waiting for rx sgdma!\n");
-		rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
-		rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 	}
 
 	counter = 0;
@@ -370,8 +370,8 @@ static void tse_eth_reset(struct eth_device *dev)
 
 	if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
 		debug("Timeout waiting for tx sgdma!\n");
-		tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
-		tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
+		tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 	}
 	/* reset the mac */
 	mac_dev->command_config.bits.transmit_enable = 1;
Signature · 1 line
1.7.6
#14 lore raw

PATCH v2 2/5 altera_tse: Fix SGDMA reset triggering

Dear Joachim Foerster,

Quoted 10 lines · In message <1319618398-1878-3-git-send-email-joachim.foerster@missinglinkelectr…

The SW_RESET needs to be set instead of being masked out!

---
Changes for v2:
- Remove period from end of summary line
- Be more specific in commit message

 drivers/net/altera_tse.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 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
Its always easier short term to pee in the pond
than install a toilet - it's just not a good long term plan.
          - Alan Cox in <[email protected]>
#15 lore raw

PATCH v2 3/5 altera_tse: Add support for dedicated descriptor memory

In reply to Joachim Foerster

---
Changes for v2:
- Remove period from end of summary line

 board/altera/nios2-generic/nios2-generic.c |   10 +++++++++-
 drivers/net/altera_tse.c                   |   19 ++++++++++++++++---
 include/netdev.h                           |    3 ++-
 3 files changed, 27 insertions(+), 5 deletions(-)
board/altera/nios2-generic/nios2-generic.c +9 -1
index 220a4c4..49ef80d 100644
@@ -74,7 +74,15 @@ int board_eth_init(bd_t *bis)
 	rc += altera_tse_initialize(0,
 				    CONFIG_SYS_ALTERA_TSE_MAC_BASE,
 				    CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
-				    CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE);
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
+#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
+	(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
+				    CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
+#else
+				    0,
+				    0);
+#endif
 #endif
 #ifdef CONFIG_ETHOC
 	rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
drivers/net/altera_tse.c +16 -3
index 47b5761..afd8e31 100644
@@ -882,7 +882,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)
 
 /* TSE init code */
 int altera_tse_initialize(u8 dev_num, int mac_base,
-			  int sgdma_rx_base, int sgdma_tx_base)
+			  int sgdma_rx_base, int sgdma_tx_base,
+			  u32 sgdma_desc_base, u32 sgdma_desc_size)
 {
 	struct altera_tse_priv *priv;
 	struct eth_device *dev;
@@ -903,8 +904,20 @@ int altera_tse_initialize(u8 dev_num, int mac_base,
 		free(dev);
 		return 0;
 	}
-	tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
-				     &dma_handle);
+	if (sgdma_desc_size) {
+		if (sgdma_desc_size < (sizeof(*tx_desc) * (3 + PKTBUFSRX))) {
+			printf("ALTERA_TSE-%hu: "
+			       "descriptor memory is too small\n", dev_num);
+			free(priv);
+			free(dev);
+			return 0;
+		}
+		tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base;
+	} else {
+		tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
+					     &dma_handle);
+	}
+
 	rx_desc = tx_desc + 2;
 	debug("tx desc: address = 0x%x\n", (unsigned int)tx_desc);
 	debug("rx desc: address = 0x%x\n", (unsigned int)rx_desc);
include/netdev.h +2 -1
index 54b52a5..04d9f75 100644
@@ -42,7 +42,8 @@ int cpu_eth_init(bd_t *bis);
 
 /* Driver initialization prototypes */
 int altera_tse_initialize(u8 dev_num, int mac_base,
-			  int sgdma_rx_base, int sgdma_tx_base);
+			  int sgdma_rx_base, int sgdma_tx_base,
+			  u32 sgdma_desc_base, u32 sgdma_desc_size);
 int at91emac_register(bd_t *bis, unsigned long iobase);
 int au1x00_enet_initialize(bd_t*);
 int ax88180_initialize(bd_t *bis);
Signature · 1 line
1.7.6
#16 lore raw

PATCH v2 3/5 altera_tse: Add support for dedicated descriptor memory

Dear Joachim Foerster,

Quoted 9 lines · In message <1319618398-1878-4-git-send-email-joachim.foerster@missinglinkelectr…

---
Changes for v2:
- Remove period from end of summary line

 board/altera/nios2-generic/nios2-generic.c |   10 +++++++++-
 drivers/net/altera_tse.c                   |   19 ++++++++++++++++---
 include/netdev.h                           |    3 ++-
 3 files changed, 27 insertions(+), 5 deletions(-)

Applied, thanks.

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
Clothes make the man. Naked people have little  or  no  influence  on
society.                                                 - Mark Twain
#17 lore raw

PATCH v2 4/5 altera_tse: m88e1111s: Honor device flags regarding PHY interface mode

In reply to Joachim Foerster

Note: This is kind of guess work. The current code is preserved for all RGMII related modes. It is different for flags=0 (GMII) and flags=5 (SGMII). The last case, SGMII, is successfully tested on Altera's Terasic DE4.

---
Changes for v2:
- Remove period from end of summary line
- Fix checkpatch.pl warnings about brace around single-if-statements

 drivers/net/altera_tse.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/altera_tse.c +8 -2
index afd8e31..8b18ad0 100644
@@ -583,7 +583,11 @@ static uint mii_m88e1111s_setmode_sr(uint mii_reg, struct altera_tse_priv *priv)
 {
 	uint mii_data = tse_mdio_read(priv, mii_reg);
 	mii_data &= 0xfff0;
-	mii_data |= 0xb;
+	if ((priv->flags >= 1) && (priv->flags <= 4))
+		mii_data |= 0xb;
+	else if (priv->flags == 5)
+		mii_data |= 0x4;
+
 	return mii_data;
 }
 
@@ -591,7 +595,9 @@ static uint mii_m88e1111s_setmode_cr(uint mii_reg, struct altera_tse_priv *priv)
 {
 	uint mii_data = tse_mdio_read(priv, mii_reg);
 	mii_data &= ~0x82;
-	mii_data |= 0x82;
+	if ((priv->flags >= 1) && (priv->flags <= 4))
+		mii_data |= 0x82;
+
 	return mii_data;
 }
 
Signature · 1 line
1.7.6
#18 lore raw

PATCH v2 4/5 altera_tse: m88e1111s: Honor device flags regarding PHY interface mode

Dear Joachim Foerster,

Quoted 5 lines · In message <1319618398-1878-5-git-send-email-joachim.foerster@missinglinkelectr…

Note: This is kind of guess work. The current code is preserved for all RGMII related modes. It is different for flags=0 (GMII) and flags=5 (SGMII). The last case, SGMII, is successfully tested on Altera's Terasic DE4.

Quoted 8 lines

---
Changes for v2:
- Remove period from end of summary line
- Fix checkpatch.pl warnings about brace around single-if-statements

 drivers/net/altera_tse.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Applied, thanks.

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
There are some things worth dying for.
	-- Kirk, "Errand of Mercy", stardate 3201.7
#19 lore raw

PATCH v2 5/5 altera_tse: Fix return of eth_device's recv() callback

In reply to Joachim Foerster

It seems to be good practice to return the number of received bytes in the eth_device's recv() callback, here: tse_eth_rx().

---
Changes for v2:
- Remove period from end of summary line
- Be more precise why/add reason to commit message

 drivers/net/altera_tse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/altera_tse.c +2 -0
index 8b18ad0..5b00717 100644
@@ -323,6 +323,8 @@ static int tse_eth_rx(struct eth_device *dev)
 
 		/* setup the sgdma */
 		alt_sgdma_do_async_transfer(priv->sgdma_rx, &rx_desc[0]);
+
+		return packet_length;
 	}
 
 	return -1;
Signature · 1 line
1.7.6
#20 lore raw

PATCH v2 5/5 altera_tse: Fix return of eth_device's recv() callback

Dear Joachim Foerster,

Quoted 11 lines · In message <1319618398-1878-6-git-send-email-joachim.foerster@missinglinkelectr…

It seems to be good practice to return the number of received bytes in the eth_device's recv() callback, here: tse_eth_rx().

---
Changes for v2:
- Remove period from end of summary line
- Be more precise why/add reason to commit message

 drivers/net/altera_tse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 8 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
There is a theory which states that if ever anyone discovers  exactly
what  the  Universe is for and why it is here, it will instantly dis-
appear and be replaced by something even more  bizarre  and  inexpli-
cable.  There  is  another  theory which states that this has already
happened.    -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"