* [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
@ 2011-10-17 15:24 Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too Joachim Foerster
` (5 more replies)
0 siblings, 6 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
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(-)
--
1.7.6
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too.
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
@ 2011-10-17 15:24 ` Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 2/5] altera_tse: Fix SGDMA reset triggering Joachim Foerster
` (4 subsequent siblings)
5 siblings, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
drivers/net/altera_tse.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 54a944b..c7f8ba9 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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.
*/
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 2/5] altera_tse: Fix SGDMA reset triggering.
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too Joachim Foerster
@ 2011-10-17 15:24 ` Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 3/5] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
` (3 subsequent siblings)
5 siblings, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
The SW_RESET needs to be set!
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
drivers/net/altera_tse.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index c7f8ba9..8bc600a 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 3/5] altera_tse: Add support for dedicated descriptor memory.
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 2/5] altera_tse: Fix SGDMA reset triggering Joachim Foerster
@ 2011-10-17 15:24 ` Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 4/5] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
` (2 subsequent siblings)
5 siblings, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 220a4c4..49ef80d 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -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);
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 8bc600a..f20f7d0 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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);
diff --git a/include/netdev.h b/include/netdev.h
index 669f60b..361df5c 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -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);
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 4/5] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode.
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
` (2 preceding siblings ...)
2011-10-17 15:24 ` [U-Boot] [PATCH 3/5] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
@ 2011-10-17 15:24 ` Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 5/5] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
2011-10-25 8:21 ` [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
5 siblings, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
drivers/net/altera_tse.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index f20f7d0..04e19cb 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
}
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 5/5] altera_tse: Fix return of eth_device's recv() callback.
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
` (3 preceding siblings ...)
2011-10-17 15:24 ` [U-Boot] [PATCH 4/5] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
@ 2011-10-17 15:24 ` Joachim Foerster
2011-10-25 8:21 ` [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
5 siblings, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-17 15:24 UTC (permalink / raw)
To: u-boot
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
drivers/net/altera_tse.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 04e19cb..c4ff8c7 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
` (4 preceding siblings ...)
2011-10-17 15:24 ` [U-Boot] [PATCH 5/5] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
@ 2011-10-25 8:21 ` Joachim Foerster
2011-10-25 12:24 ` Scott McNutt
2011-10-26 2:07 ` Thomas Chou
5 siblings, 2 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-25 8:21 UTC (permalink / raw)
To: u-boot
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.
On 10/17/2011 05:24 PM, Joachim Foerster wrote:
> 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(-)
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
2011-10-25 8:21 ` [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
@ 2011-10-25 12:24 ` Scott McNutt
2011-10-26 2:07 ` Thomas Chou
1 sibling, 0 replies; 21+ messages in thread
From: Scott McNutt @ 2011-10-25 12:24 UTC (permalink / raw)
To: u-boot
Dear Joachim,
Please be patient.
Regards,
--Scott
Joachim Foerster wrote:
> 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.
>
> On 10/17/2011 05:24 PM, Joachim Foerster wrote:
>> 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(-)
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
2011-10-25 8:21 ` [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
2011-10-25 12:24 ` Scott McNutt
@ 2011-10-26 2:07 ` Thomas Chou
2011-10-26 8:39 ` Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
1 sibling, 2 replies; 21+ messages in thread
From: Thomas Chou @ 2011-10-26 2:07 UTC (permalink / raw)
To: u-boot
On 10/25/2011 04:21 PM, Joachim Foerster wrote:
> 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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature
2011-10-26 2:07 ` Thomas Chou
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
1 sibling, 0 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
Hi Thomas,
On 10/26/2011 04:07 AM, Thomas Chou wrote:
> 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.
> 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.
> I am going to test your patches on 3C120 and NEEK boards. And will let
> you know my results.
Ok, thanks.
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 0/5 v2] altera_tse: Several small, but relevant fixes/feature
2011-10-26 2:07 ` Thomas Chou
2011-10-26 8:39 ` Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case Joachim Foerster
` (4 more replies)
1 sibling, 5 replies; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
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(-)
--
1.7.6
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 19:26 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering Joachim Foerster
` (3 subsequent siblings)
4 siblings, 1 reply; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 54a944b..47d0047 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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.
*/
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 19:27 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
` (2 subsequent siblings)
4 siblings, 1 reply; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
The SW_RESET needs to be set instead of being masked out!
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 47d0047..47b5761 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 19:28 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
4 siblings, 1 reply; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 220a4c4..49ef80d 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -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);
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 47b5761..afd8e31 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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);
diff --git a/include/netdev.h b/include/netdev.h
index 54b52a5..04d9f75 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -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);
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
` (2 preceding siblings ...)
2011-10-26 8:39 ` [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 19:28 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
4 siblings, 1 reply; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index afd8e31..8b18ad0 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
}
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
` (3 preceding siblings ...)
2011-10-26 8:39 ` [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
@ 2011-10-26 8:39 ` Joachim Foerster
2011-10-26 19:29 ` Wolfgang Denk
4 siblings, 1 reply; 21+ messages in thread
From: Joachim Foerster @ 2011-10-26 8:39 UTC (permalink / raw)
To: u-boot
It seems to be good practice to return the number of received bytes in the
eth_device's recv() callback, here: tse_eth_rx().
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
---
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(-)
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 8b18ad0..5b00717 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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;
--
1.7.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case
2011-10-26 8:39 ` [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case Joachim Foerster
@ 2011-10-26 19:26 ` Wolfgang Denk
0 siblings, 0 replies; 21+ messages in thread
From: Wolfgang Denk @ 2011-10-26 19:26 UTC (permalink / raw)
To: u-boot
Dear Joachim Foerster,
In message <1319618398-1878-2-git-send-email-joachim.foerster@missinglinkelectronics.com> you wrote:
> Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
> ---
> 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
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering
2011-10-26 8:39 ` [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering Joachim Foerster
@ 2011-10-26 19:27 ` Wolfgang Denk
0 siblings, 0 replies; 21+ messages in thread
From: Wolfgang Denk @ 2011-10-26 19:27 UTC (permalink / raw)
To: u-boot
Dear Joachim Foerster,
In message <1319618398-1878-3-git-send-email-joachim.foerster@missinglinkelectronics.com> you wrote:
> The SW_RESET needs to be set instead of being masked out!
>
> Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
> ---
> 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
--
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 <20100101145701.6432e7b7@lxorguk.ukuu.org.uk>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory
2011-10-26 8:39 ` [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
@ 2011-10-26 19:28 ` Wolfgang Denk
0 siblings, 0 replies; 21+ messages in thread
From: Wolfgang Denk @ 2011-10-26 19:28 UTC (permalink / raw)
To: u-boot
Dear Joachim Foerster,
In message <1319618398-1878-4-git-send-email-joachim.foerster@missinglinkelectronics.com> you wrote:
> Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
> ---
> 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
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode
2011-10-26 8:39 ` [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
@ 2011-10-26 19:28 ` Wolfgang Denk
0 siblings, 0 replies; 21+ messages in thread
From: Wolfgang Denk @ 2011-10-26 19:28 UTC (permalink / raw)
To: u-boot
Dear Joachim Foerster,
In message <1319618398-1878-5-git-send-email-joachim.foerster@missinglinkelectronics.com> you wrote:
> 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.
>
> Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
> ---
> 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
--
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback
2011-10-26 8:39 ` [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
@ 2011-10-26 19:29 ` Wolfgang Denk
0 siblings, 0 replies; 21+ messages in thread
From: Wolfgang Denk @ 2011-10-26 19:29 UTC (permalink / raw)
To: u-boot
Dear Joachim Foerster,
In message <1319618398-1878-6-git-send-email-joachim.foerster@missinglinkelectronics.com> you wrote:
> It seems to be good practice to return the number of received bytes in the
> eth_device's recv() callback, here: tse_eth_rx().
>
> Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
> ---
> 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
--
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"
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2011-10-26 19:29 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 15:24 [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 1/5] altera_tse: Clear SGDMA's RUN bit in async case, too Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 2/5] altera_tse: Fix SGDMA reset triggering Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 3/5] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 4/5] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
2011-10-17 15:24 ` [U-Boot] [PATCH 5/5] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
2011-10-25 8:21 ` [U-Boot] [PATCH 0/5] altera_tse: Several small, but relevant fixes/feature Joachim Foerster
2011-10-25 12:24 ` Scott McNutt
2011-10-26 2:07 ` Thomas Chou
2011-10-26 8:39 ` Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 0/5 v2] " Joachim Foerster
2011-10-26 8:39 ` [U-Boot] [PATCH 1/5 v2] altera_tse: Clear SGDMA's RUN bit in async transfer, like in sync case Joachim Foerster
2011-10-26 19:26 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 2/5 v2] altera_tse: Fix SGDMA reset triggering Joachim Foerster
2011-10-26 19:27 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 3/5 v2] altera_tse: Add support for dedicated descriptor memory Joachim Foerster
2011-10-26 19:28 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 4/5 v2] altera_tse: m88e1111s: Honor device flags regarding PHY interface mode Joachim Foerster
2011-10-26 19:28 ` Wolfgang Denk
2011-10-26 8:39 ` [U-Boot] [PATCH 5/5 v2] altera_tse: Fix return of eth_device's recv() callback Joachim Foerster
2011-10-26 19:29 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox