From patchwork Tue Jul 16 19:04:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramon Fried X-Patchwork-Id: 1132904 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="K/tg/CZW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45p9051c9jz9sDB for ; Wed, 17 Jul 2019 05:08:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D34FCC21E31; Tue, 16 Jul 2019 19:05:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 11F11C21D72; Tue, 16 Jul 2019 19:05:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A8EE2C21E96; Tue, 16 Jul 2019 19:05:07 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id 1D782C21E47 for ; Tue, 16 Jul 2019 19:05:03 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id z1so22075153wru.13 for ; Tue, 16 Jul 2019 12:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GI1mZrjoQgkRAPzMcq8ewxALaake8bCxZigo3PJY9pU=; b=K/tg/CZWRc+5zMmwuiwT6hqrtccizPaIuhzgpAwSniSAvd9Jn5YR8Nw5kPySRLlGEu dnLLqv5djieOWVDUhqJ9WI5IvSlGs6iG2X79onxj8FBDPebuJ6vzWY1O3WZSAZBhJhYB RDJdRPZ0M9A2zfmD7tcGEzdEEzE+mItHzb1q5pilJK/SwpyjWpCwkIFypZThxdD/3cQK utUckA820sOEuDR+YksVNds39bD9u78maPq7Z0bbuOB3oVfh0Vr2fitNC+0MybQymbIu EbpKc4L3Ke9EG5ljDWZVxCCxbAAeWWkLShxDbwKwN/F18G2pfhJhO2O0F4Xmv8gQ5wS+ VbLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GI1mZrjoQgkRAPzMcq8ewxALaake8bCxZigo3PJY9pU=; b=Wlw/cLdB5vB8Kfq4yA4sTk/WrYW8sM7Zxf0OnrzrZpm7zuK190pug6oXhJtsUgK8T0 u5o0P1HYK/mznBB3Z5HvgN+JWNptPk8ypB+uzbcDjlEe3sioloJB5V/0sDqJvPhfdHv1 RV53biPoI4utGp0guR82siVei6BEsbeHo3A1RS3dAOaPPPfv5+gspit8rXhp/f4rpl1k VPbWSl4a3Ks6x7W/Wbi6TRDUEE6h2mLtnaR5i+zTqPjv7dSc6QFlKqgohZ3GuunvCIBi w6jnTtJPsl2LE51ZiU6Q9OG4Jcard4s0JsURtpVgO1VP8Jld45Q4u1OcXvN5mDnILqBz N6HQ== X-Gm-Message-State: APjAAAVG5nVOABOnB+sJjkKAAY8vbpT4bkswqgnPSXf0AY5L7I5yO6qh tLxkEpJ8wVIS+l2TdtRd9C6FXgeD8oE= X-Google-Smtp-Source: APXvYqw6Rwfk5pT5VrNWo7ojWroxskVNivSw6RTZO23kjawAApjxJRtzzex/RYf2XQDxNmYEqYwaBQ== X-Received: by 2002:a5d:4e02:: with SMTP id p2mr10610850wrt.182.1563303902662; Tue, 16 Jul 2019 12:05:02 -0700 (PDT) Received: from localhost.localdomain ([141.226.31.91]) by smtp.gmail.com with ESMTPSA id t1sm30608347wra.74.2019.07.16.12.05.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 12:05:02 -0700 (PDT) From: Ramon Fried To: u-boot@lists.denx.de, joe.hershberger@ni.com Date: Tue, 16 Jul 2019 22:04:35 +0300 Message-Id: <20190716190436.21251-5-rfried.dev@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190716190436.21251-2-rfried.dev@gmail.com> References: <20190716190436.21251-2-rfried.dev@gmail.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v2 5/6] net: macb: add dma_burst_length config X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" GEM support higher DMA burst writes/reads than the default (4). add configuration structure with dma burst length so it could be applied later to DMA configuration. Signed-off-by: Ramon Fried Reviewed-by: Anup Patel Tested-by: Anup Patel Acked-by: Joe Hershberger --- v2: nothing. drivers/net/macb.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index cf76270ad8..dc6aa6deda 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -82,6 +82,7 @@ struct macb_dma_desc { struct macb_device { void *regs; + unsigned int dma_burst_length; unsigned int rx_tail; unsigned int tx_head; @@ -118,6 +119,11 @@ struct macb_device { phy_interface_t phy_interface; #endif }; + +struct macb_config { + unsigned int dma_burst_length; +}; + #ifndef CONFIG_DM_ETH #define to_macb(_nd) container_of(_nd, struct macb_device, netdev) #endif @@ -1135,8 +1141,13 @@ static int macb_enable_clk(struct udevice *dev) } #endif +static const struct macb_config default_gem_config = { + .dma_burst_length = 16, +}; + static int macb_eth_probe(struct udevice *dev) { + const struct macb_config *macb_config; struct eth_pdata *pdata = dev_get_platdata(dev); struct macb_device *macb = dev_get_priv(dev); const char *phy_mode; @@ -1153,6 +1164,11 @@ static int macb_eth_probe(struct udevice *dev) macb->regs = (void *)pdata->iobase; + macb_config = (struct macb_config *)dev_get_driver_data(dev); + if (!macb_config) + macb_config = &default_gem_config; + + macb->dma_burst_length = macb_config->dma_burst_length; #ifdef CONFIG_CLK ret = macb_enable_clk(dev); if (ret) @@ -1213,12 +1229,16 @@ static int macb_eth_ofdata_to_platdata(struct udevice *dev) return macb_late_eth_ofdata_to_platdata(dev); } +static const struct macb_config sama5d4_config = { + .dma_burst_length = 4, +}; + static const struct udevice_id macb_eth_ids[] = { { .compatible = "cdns,macb" }, { .compatible = "cdns,at91sam9260-macb" }, { .compatible = "atmel,sama5d2-gem" }, { .compatible = "atmel,sama5d3-gem" }, - { .compatible = "atmel,sama5d4-gem" }, + { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config }, { .compatible = "cdns,zynq-gem" }, { } };