Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1286803ybp; Fri, 11 Oct 2019 11:49:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhB5P9DnkfvJQnmll2mTVvWmtrj+AYNZZ/foZNoBkofraCmA1eMRgmytoYl09vRUv0OKfN X-Received: by 2002:a17:906:5381:: with SMTP id g1mr15259699ejo.159.1570819755355; Fri, 11 Oct 2019 11:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570819755; cv=none; d=google.com; s=arc-20160816; b=GL0/ILaorYiPtwceLeT1PQRNUm3GAkf26Bbu+CsJcccFsWdNB4zzodTe9BNsZgKd1B m539Nsu5W9Treb9ok4nq8U9hgkuuRtOgnWbgg29ShS2YVEy/iwt4VOj20lVpGq39jIGF cMnP6XeWrfUWP3TKqJ0a3LroBLh1pW8m1YC+Z/j/fRLmV3nOS4vs5SW0dlJBIlD1oV2A tNXOT90ctBmMjbEiKewRlVMVNNFUHNqRc2UT90aiDk0lBXTP1F7mDshjMd/VHD1x0IxV 3i/XGXJm5S8KE54tIXtd7R08BJk0Nx9ndAf+w0at08M627LCRd/c0cCmBSpPMkG6f0TK 972g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UsdLto9Aerf3ZBv4pg6UqpmuHF1O7jFtLE9a4laOR9U=; b=mYlOWOUfcZAXq22n6pjBv+PUyzB4o2CXd3OwmNFrqyZnhBTAZ+yr9U7VO5flNIGM9l eL4YLpR8yQuLSyJQeBQsMcPdSi74nesWJwI2cNJP4AywDk4Ns6+Qj782wiYethY4UaRl ifb+vsi1Cfoa9s3KiHBFNdCn8R6DvKFu5j6vJUV1geJk8zi9bHc1OahFGntB+F9fqAnW MkDZsJWwSQ6ZAwbjyCy0zfcUK71cIiLn2EfFxlg2mPU8YveUQEqPYNFRZFriI519MygT faNN1H3t/wiS2pMDrPANoYw7BZ6AJl0fCtroV/nKC6W8aOSvvbBbo1vOOtIO7c2+GtWc TY2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g05iTO8b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si6107275edv.369.2019.10.11.11.48.52; Fri, 11 Oct 2019 11:49:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g05iTO8b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728924AbfJKSsg (ORCPT + 99 others); Fri, 11 Oct 2019 14:48:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:47498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728878AbfJKSsf (ORCPT ); Fri, 11 Oct 2019 14:48:35 -0400 Received: from ziggy.de (unknown [37.223.145.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0677D21D7D; Fri, 11 Oct 2019 18:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570819715; bh=OTgrNLS53g8Rccfn5K0Ut7tIZlmbMatndfizupjVyyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g05iTO8bqc9Hw/bPhfJPhqHd2S/Wm/rU7uVAmBZFK7XabPCoP46nZvxGqaQ78Pc+y 5WEMsFah3lJ+B40CYJYv56CgIRYNrrV/6OgUyGj2854IFl/WPJo9l4AfdwbaqluUH6 6cdx7SJ3NZcTCZpowHc531St/uRnbnjTZeogUH5M= From: matthias.bgg@kernel.org To: Florian Fainelli , "David S . Miller" Cc: Nicolas Saenz Julienne , Matthias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren , Matthias Brugger , Doug Berger , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v1 2/3] net: bcmgenet: use optional max DMA burst size property Date: Fri, 11 Oct 2019 20:48:20 +0200 Message-Id: <20191011184822.866-3-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191011184822.866-1-matthias.bgg@kernel.org> References: <20191011184822.866-1-matthias.bgg@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Brugger Depending on the HW, the maximal usable DMA burst size can vary. If not set accordingly a timeout in the transmit queue happens and no package can be sent. Read to optional max-burst-sz property, if not present, fallback to the standard value. Signed-off-by: Matthias Brugger --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++++-- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 12cb77ef1081..a7bb822a6d83 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2576,7 +2576,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) } /* Init rDma */ - bcmgenet_rdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE); + bcmgenet_rdma_writel(priv, priv->dma_max_burst_length, + DMA_SCB_BURST_SIZE); /* Initialize Rx queues */ ret = bcmgenet_init_rx_queues(priv->dev); @@ -2589,7 +2590,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) } /* Init tDma */ - bcmgenet_tdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE); + bcmgenet_tdma_writel(priv, priv->dma_max_burst_length, + DMA_SCB_BURST_SIZE); /* Initialize Tx queues */ bcmgenet_init_tx_queues(priv->dev); @@ -3522,6 +3524,13 @@ static int bcmgenet_probe(struct platform_device *pdev) clk_prepare_enable(priv->clk); + if (dn) { + of_property_read_u32(dn, "dma-burst-sz", + &priv->dma_max_burst_length); + } else { + priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH; + } + bcmgenet_set_hw_params(priv); /* Mii wait queue */ diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index 4a8fc03d82fd..897f356eb376 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h @@ -663,6 +663,7 @@ struct bcmgenet_priv { bool crc_fwd_en; unsigned int dma_rx_chk_bit; + unsigned int dma_max_burst_length; u32 msg_enable; -- 2.23.0