From: Ramon Fried <rfried.dev@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] net: macb: apply sane DMA configuration
Date: Tue, 11 Jun 2019 18:19:30 +0300 [thread overview]
Message-ID: <20190611151930.15852-6-rfried.dev@gmail.com> (raw)
In-Reply-To: <20190611151930.15852-1-rfried.dev@gmail.com>
DMA configuration was heavily dependent on the HW
defaults, add function to properly set the required
fields, including the new dma_burst_length.
Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
---
drivers/net/macb.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index fb42172520..c072f99d8f 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -47,6 +47,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define MACB_RX_BUFFER_SIZE 4096
#define MACB_RX_RING_SIZE (MACB_RX_BUFFER_SIZE / 128)
+#define RX_BUFFER_MULTIPLE 64
#define MACB_TX_RING_SIZE 16
#define MACB_TX_TIMEOUT 1000
#define MACB_AUTONEG_TIMEOUT 5000000
@@ -695,6 +696,31 @@ static int gmac_init_multi_queues(struct macb_device *macb)
return 0;
}
+static void gmac_configure_dma(struct macb_device *macb)
+{
+ u32 buffer_size;
+ u32 dmacfg;
+
+ buffer_size = 128 / RX_BUFFER_MULTIPLE;
+ dmacfg = gem_readl(macb, DMACFG) & ~GEM_BF(RXBS, -1L);
+ dmacfg |= GEM_BF(RXBS, buffer_size);
+
+ if (macb->dma_burst_length)
+ dmacfg = GEM_BFINS(FBLDO, macb->dma_burst_length, dmacfg);
+
+ dmacfg |= GEM_BIT(TXPBMS) | GEM_BF(RXBMS, -1L);
+ dmacfg &= ~GEM_BIT(ENDIA_PKT);
+
+#ifdef CONFIG_SYS_LITTLE_ENDIAN
+ dmacfg &= ~GEM_BIT(ENDIA_DESC);
+#else
+ dmacfg |= GEM_BIT(ENDIA_DESC); /* CPU in big endian */
+#endif
+
+ dmacfg &= ~GEM_BIT(ADDR64);
+ gem_writel(macb, DMACFG, dmacfg);
+}
+
#ifdef CONFIG_DM_ETH
static int _macb_init(struct udevice *dev, const char *name)
#else
@@ -748,6 +774,8 @@ static int _macb_init(struct macb_device *macb, const char *name)
macb_writel(macb, TBQP, macb->tx_ring_dma);
if (macb_is_gem(macb)) {
+ /* Initialize DMA properties */
+ gmac_configure_dma(macb);
/* Check the multi queue and initialize the queue for tx */
gmac_init_multi_queues(macb);
--
2.21.0
next prev parent reply other threads:[~2019-06-11 15:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 15:19 [U-Boot] [PATCH 1/6] net: macb: sync header definitions as taken from Linux Ramon Fried
2019-06-11 15:19 ` [U-Boot] [PATCH 2/6] net: macb: add support for faster clk rates Ramon Fried
2019-07-03 3:35 ` Anup Patel
2019-07-08 23:09 ` Joe Hershberger
2019-06-11 15:19 ` [U-Boot] [PATCH 3/6] net: macb: use bit access macro from header file Ramon Fried
2019-07-03 3:35 ` Anup Patel
2019-07-08 23:11 ` Joe Hershberger
2019-06-11 15:19 ` [U-Boot] [PATCH 4/6] net: macb: add support for SGMII phy interface Ramon Fried
2019-07-03 3:35 ` Anup Patel
2019-07-08 23:12 ` Joe Hershberger
2019-06-11 15:19 ` [U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config Ramon Fried
2019-07-03 3:35 ` Anup Patel
2019-07-08 23:23 ` Joe Hershberger
2019-06-11 15:19 ` Ramon Fried [this message]
2019-07-03 3:36 ` [U-Boot] [PATCH 6/6] net: macb: apply sane DMA configuration Anup Patel
2019-07-08 23:26 ` Joe Hershberger
2019-07-03 3:35 ` [U-Boot] [PATCH 1/6] net: macb: sync header definitions as taken from Linux Anup Patel
2019-07-08 23:08 ` Joe Hershberger
2019-07-15 18:31 ` Joe Hershberger
2019-07-15 20:19 ` Ramon Fried
2019-07-15 20:25 ` Ramon Fried
2019-07-15 20:48 ` Joe Hershberger
2019-07-16 5:02 ` Ramon Fried
2019-07-16 18:42 ` Joe Hershberger
2019-07-16 18:54 ` Ramon Fried
-- strict thread matches above, loose matches on Subject: below --
2019-07-16 19:03 [U-Boot] [PATCH v2 " Ramon Fried
2019-07-16 19:03 ` [U-Boot] [PATCH 6/6] net: macb: apply sane DMA configuration Ramon Fried
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190611151930.15852-6-rfried.dev@gmail.com \
--to=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.