From patchwork Fri Jan 20 07:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 644611 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp638102pvb; Thu, 19 Jan 2023 23:19:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvEcCff+w1m+IUtyIcASg8nmug06RBYScvC4xQzJwKvLjS76dDumKZsfAKgcvYP0FqykBFJ X-Received: by 2002:a9d:6f05:0:b0:684:a657:3a44 with SMTP id n5-20020a9d6f05000000b00684a6573a44mr7235985otq.16.1674199163601; Thu, 19 Jan 2023 23:19:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674199163; cv=none; d=google.com; s=arc-20160816; b=D3F9+qhtRfTFKI6roBnwU5eGnSwfD5/DuKg12u9+NnoCOTMIdCEmtxkmZhLf8sqB6a wxUOuli8YKdO5J3H8te8i973qQcfh1okRg22wfAzMln6WyWF8+Sk12PwE+Mug8ARmG7c k0mFfveIR/8AwZMJdx3od055BwE+IIMb018oSUtFHpG+w6MT9Cb1y64CPmBYD8tkbWjs mQe/l9xnBxqmPFAjty7qBf08QXI0TpTojz10CJ0zjQcVjuonVDvSkW9t3lUmGcS1bJVW VWtrC6dMBAKfbKGzrL9XsJdOK2IzFn/Llf0FD0YG4o0AZzZeZ+Bldqhsib6tDzZqohTJ DCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EykesWwKz9OUTCa4KBwIKHRquT8YbapR9SO1jwz0yT0=; b=qlZgy+LwUOjkQKQ/Mh1jXVkALv1cuQOQrlqeM8cU85BGatFpF0GXSWgypZgqBnTQ3G NM4NGCX6ufMtnnJB8FL/ZUCrWSflGh/d9QTQ6LXAgpITp+eRBj2SnU7m6WCeX4B9FLPx Ls6nl9vsx0hCab1/SAViI9Uu2EfwrhAuELCOh8sTH3+4qpCcNU0Vs2zK+L+Vwsvi3UJa jCxVbtEGk0GEGLR4+IZ4Lj1ClW0OSRtocv8+Qd0MgHl3v5KbUzv+EQOyx8W96JGQVaGO rjdZ92piq0y2a5jTrZMVeCikx9hFtTkr7WlPfcYbfBazcK/15pL8E7w8wLifHR/f3U+H mrAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QQ44tiow; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id d13-20020a056830004d00b00684c22c83cdsi22556196otp.170.2023.01.19.23.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 23:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QQ44tiow; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7F3CC856B2; Fri, 20 Jan 2023 08:18:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QQ44tiow"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6376A856B2; Fri, 20 Jan 2023 08:18:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12770856B5 for ; Fri, 20 Jan 2023 08:18:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sumit.garg@linaro.org Received: by mail-pg1-x536.google.com with SMTP id 7so3466930pga.1 for ; Thu, 19 Jan 2023 23:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EykesWwKz9OUTCa4KBwIKHRquT8YbapR9SO1jwz0yT0=; b=QQ44tiow8Lql46RYjfjFFlvESPDODVwXSHXxh7H+IropRegBy/YXQ2TnRGagIM4jQC d8NGRFnUApdTQtbmDkoyDCnyEsZwsk6C4zrNDX7+hQuy7pBdYiXAl9R9m+7Uv8hhaG4/ WQiSMTtforWajpQDPKQdAdAw8RYG8sslQEYfQle7j4pdh5aoN5AN9iFkb/uQNUsx13vO k1YHpjh96Uq8Hqk28tQlL7sZAVHDFqeD+oeOqyeb4+7HRxZ46whEdyZ4Y9TRAJ4MJiAk O/T1n0fauLPFrIz15sDLLEHERT+sNSRVRniYrQ7dBkDRaiyGYcKJ0QGf2I7VFGTDjjAK 0nIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EykesWwKz9OUTCa4KBwIKHRquT8YbapR9SO1jwz0yT0=; b=JH766g848qafDYlnRJNVxPbsodrPBfA8qv2Who9427SH7kf25PoXvh2N0MLHZX8O+F fPASGldEddM3iObTT09kDf7DBMsKAThiK2b/i8Q5cZh9O+Acpn93GR4aQzeGp1lKW8v9 AgXC31QC61fsz1NbfAcJLwxIKoo7s+yoqsZLcmp4tHQmnW94G0j7qaPFi73y5wXL38cl MvhmeUJb6UN/53XVXSiTCD+TjMxigsWAEX7ayLdn+/UC7eoBocsj3Pmn0PbXl7oOqZjv z1vQVw3+hGmJ42lNB0b6oZpgbo+oDYDWdOUHMULrVlQlhkjiRYzCbgeI7F+xoeStc8IT n93g== X-Gm-Message-State: AFqh2kpUDe6sCe8I5QHzMXLLSbDgq98Ts9MRO+NvuLlPZWprr6BKnkcj IpcUEHLpXblxO0qoo2iDlqhaMMXryxVRwFdF X-Received: by 2002:a62:1910:0:b0:58d:c1ca:9360 with SMTP id 16-20020a621910000000b0058dc1ca9360mr14742778pfz.17.1674199085185; Thu, 19 Jan 2023 23:18:05 -0800 (PST) Received: from sumit-X1.. ([223.178.212.120]) by smtp.gmail.com with ESMTPSA id x15-20020aa7956f000000b0058bacd6c4e8sm9797586pfq.207.2023.01.19.23.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 23:18:04 -0800 (PST) From: Sumit Garg To: u-boot@lists.denx.de Cc: rfried.dev@gmail.com, hs@denx.de, joe.hershberger@ni.com, stephan@gerhold.net, mworsfold@impinj.com, lgillham@impinj.com, jbrennan@impinj.com, nicolas.dechesne@linaro.org, vinod.koul@linaro.org, daniel.thompson@linaro.org, Sumit Garg Subject: [PATCH 07/14] net: dwc_eth_qos: Allow platform to override tx/rx_fifo_sz Date: Fri, 20 Jan 2023 12:47:12 +0530 Message-Id: <20230120071719.623661-8-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120071719.623661-1-sumit.garg@linaro.org> References: <20230120071719.623661-1-sumit.garg@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The GMAC controller on QCS404 SoC (support added by upcoming patch) fails to work with maximum tx/rx_fifo_sz supported by the hardware (16K). So allow platforms to override FIFO size using corresponding DT node properties. Signed-off-by: Sumit Garg Reviewed-by: Ramon Fried --- drivers/net/dwc_eth_qos.c | 19 +++++++++++++------ drivers/net/dwc_eth_qos.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 753a912607..65b8556be2 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -852,12 +852,19 @@ static int eqos_start(struct udevice *dev) rx_fifo_sz = (val >> EQOS_MAC_HW_FEATURE1_RXFIFOSIZE_SHIFT) & EQOS_MAC_HW_FEATURE1_RXFIFOSIZE_MASK; - /* - * r/tx_fifo_sz is encoded as log2(n / 128). Undo that by shifting. - * r/tqs is encoded as (n / 256) - 1. - */ - tqs = (128 << tx_fifo_sz) / 256 - 1; - rqs = (128 << rx_fifo_sz) / 256 - 1; + /* r/tx_fifo_sz is encoded as log2(n / 128). Undo that by shifting */ + tx_fifo_sz = 128 << tx_fifo_sz; + rx_fifo_sz = 128 << rx_fifo_sz; + + /* Allow platform to override TX/RX fifo size */ + if (eqos->tx_fifo_sz) + tx_fifo_sz = eqos->tx_fifo_sz; + if (eqos->rx_fifo_sz) + rx_fifo_sz = eqos->rx_fifo_sz; + + /* r/tqs is encoded as (n / 256) - 1 */ + tqs = tx_fifo_sz / 256 - 1; + rqs = rx_fifo_sz / 256 - 1; clrsetbits_le32(&eqos->mtl_regs->txq0_operation_mode, EQOS_MTL_TXQ0_OPERATION_MODE_TQS_MASK << diff --git a/drivers/net/dwc_eth_qos.h b/drivers/net/dwc_eth_qos.h index 8fccd6f057..466a792de7 100644 --- a/drivers/net/dwc_eth_qos.h +++ b/drivers/net/dwc_eth_qos.h @@ -276,6 +276,7 @@ struct eqos_priv { bool started; bool reg_access_ok; bool clk_ck_enabled; + unsigned int tx_fifo_sz, rx_fifo_sz; }; void eqos_inval_desc_generic(void *desc);