diff options
author | Joachim Foerster <joachim.foerster@missinglinkelectronics.com> | 2011-10-17 05:24:44 (GMT) |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-10-26 19:27:37 (GMT) |
commit | b962ac794a26ff80269755c13c3e4fee65c3809e (patch) | |
tree | a4eee141d77981f255b5cf2c3a3fa5c8e85b34d9 | |
parent | 29095f1a5cfdbc2e40178f6fbf9267e0df11f6f5 (diff) | |
download | u-boot-b962ac794a26ff80269755c13c3e4fee65c3809e.tar.xz |
altera_tse: Add support for dedicated descriptor memory
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
-rw-r--r-- | board/altera/nios2-generic/nios2-generic.c | 10 | ||||
-rw-r--r-- | drivers/net/altera_tse.c | 19 | ||||
-rw-r--r-- | 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); |