From patchwork Tue Jul 16 19:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramon Fried X-Patchwork-Id: 1132902 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="gk1aAsSQ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45p8y60Vp1z9sDB for ; Wed, 17 Jul 2019 05:06:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C028BC21EDE; Tue, 16 Jul 2019 19:04:56 +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 BBDEEC21E12; Tue, 16 Jul 2019 19:03:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6C8D5C21E68; Tue, 16 Jul 2019 19:03:40 +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 201A8C21E68 for ; Tue, 16 Jul 2019 19:03:29 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id c2so18914371wrm.8 for ; Tue, 16 Jul 2019 12:03:29 -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=gk1aAsSQpIBKgYl+Q4UHENTVJN6+Wl/pqx2EzWZONKGXiHgJsfxOjfteGNODCpzINT T6CS8tXW/pBy1FbcWIilGNRgmfv3ZHiSUigH8FauFUeottZ7W8Q1/1xc55AzjkqHIyE+ hKDhCOYg7EFq+sLMEnzmBnaKg2aymqiGKEKSATYoDqTFOPcc8pckhqM2fAtFf75bbJ6V tQ28uTUMRsZKFIfsGi572MDDOT3fmFB8D6uJYAcw01tkWXa/q/JyLHCEIXjCGe2tjKDo mKscjAnBsnbz2lUA4kGRNgAwUKziU6v/MUq/UMqY9soyZi8hoJ7xWv6HdIwGDdGOmWtZ /gvQ== 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=jj0vYnD0CUdnZNAB5wHTMWURx9mi8lzpoRUmxkZ+9GUoKW67F+elBLL+crrQVaqkof D9k3l53pxeYZhqa+6n9qpH1+L4XVGMTfYDl7kf2xcpfLOH8SENYkNrenVAC7WMW3veob ccQvEJHI4QLNLJm3uTiNpsYegvG8xWaoTqRV062mR5+RdKoH0vLRRUVOsYmk6Kfr+rBM w5LC1ChCwhhWe5jEh3L/IaEz0GKteh6+wWpz3f3xBK1K1XGOLrjptjThWF8qQdSeVOVS e0eSZ7gPUEjA6H5uREBRcC+bm7DuIenXxJcDjnEiV7GgyWARdPcP0dt1YLzfEHeT9YGQ iqCw== X-Gm-Message-State: APjAAAX/GNJEj+n6O4fO8ltYg+4thbcQJ61xyqrwz9n13yI+gqCE+7gL zd/TKELMkFMyuKymzf7iHSKdqdiiKZg= X-Google-Smtp-Source: APXvYqxpBou31S2M1UxoNhhUYY6vcnPFJvKtpVPnZjjpGx6Fa0iF3EFcg/gBm78TuvaR3mbsNhzHxQ== X-Received: by 2002:a05:6000:1043:: with SMTP id c3mr11299909wrx.236.1563303808686; Tue, 16 Jul 2019 12:03:28 -0700 (PDT) Received: from localhost.localdomain ([141.226.31.91]) by smtp.gmail.com with ESMTPSA id i66sm36508397wmi.11.2019.07.16.12.03.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 12:03:28 -0700 (PDT) From: Ramon Fried To: u-boot@lists.denx.de, joe.hershberger@ni.com Date: Tue, 16 Jul 2019 22:03:04 +0300 Message-Id: <20190716190305.20520-5-rfried.dev@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190716190305.20520-1-rfried.dev@gmail.com> References: <20190716190305.20520-1-rfried.dev@gmail.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 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" }, { } };