From patchwork Wed Feb 1 13:58:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 649169 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp303784pva; Wed, 1 Feb 2023 06:05:54 -0800 (PST) X-Google-Smtp-Source: AK7set/SdWANI+u7v7fIDV2sOpViJV6/uYOapMWd2OSzlQjFe9jqbXdoGjGBZHYQVVFY+JHicoW0 X-Received: by 2002:aca:3e45:0:b0:368:8745:70a8 with SMTP id l66-20020aca3e45000000b00368874570a8mr1003251oia.50.1675260353827; Wed, 01 Feb 2023 06:05:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675260353; cv=none; d=google.com; s=arc-20160816; b=L6YwiKSp0g/xt2fBVM1jq4tnJ8dfOV5lI9B9chqyYRqqOyEw9rjUBPsZHaS04SvrjW idmGmiK3J217Vr2D0yL6gvDxwiMst3nLVHMOw+3wt2um9sYGTYrfdwXjJtZsh+gYKWPi AbpnqUfS+WVppvvcNZsKhY6Db+KwBt9FaYHr9o8zZeIpWLR2hNY0hCPDcSZ0TtI7DGuz SnXkiTuWFGnz6IgA3u9lQvJR8YLjx1iHoacutAwL1BOYRG2rMQvs57MlGh7gofHbBJLa 7xUtaa2opu7tgsHq3dFyCdNqAzUrYB137nd90TUKKxdeVM/s0l45Nc1+GZ3976kmdKq0 24fQ== 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=a5BPBQatVyI0W9swepfee7f2xOwBC+TBgrz+N62IjCUtSNs+CmcvA55m3P0WiUpXdf 7InnJwuWv5pPU0C/h+suultugoHpxzP12W180EiPbSBBX0H7x3BS+EcEUM+E2OI4q3My xlO/74n1nlO1vsRJlOknEcrj8yO0jk5ufs+iqzE/hyvHONjKXnz+usJlhqakGHDoLpjC JmUcRy3XzAkSFRKPi3bWVmddJxxhZZEaitxuWdMglfQ/uMxivbrMZYmYt4cCIbBjkIQ5 APSgIarRu15oiODu9n8k/+hehJpU1AG2prywjOVYYv9IXG40M7B2q4CSVh4g4kp+Az+r ESQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xTwKq2xs; 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 v23-20020acaac17000000b003787ab9820fsi5315203oie.265.2023.02.01.06.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 06:05:53 -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=xTwKq2xs; 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 2F2E185CBA; Wed, 1 Feb 2023 15:04:51 +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="xTwKq2xs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 427FB85C94; Wed, 1 Feb 2023 15:01:24 +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=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 24E8C85C7E for ; Wed, 1 Feb 2023 14:59:49 +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-pl1-x629.google.com with SMTP id m13so6617206plx.13 for ; Wed, 01 Feb 2023 05:59:48 -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=xTwKq2xs7aqzNWaTEbCWY8N44jtrgJoEnIR5FfCOIj1OGdCJZ+8QAICR3V7UZro4lY 30TdEHmVPVmmsxBHdK2Xn9Ss6I5FBSch4a01370mec0kn6F5VFAYq4iPoTu+bLnoBqto xTXwmkcY99giXKGE3GWJFgCUjsHtDai4nQolIwxfsrj5wBkBbli7savOfejlUAD7YGsh 97yo7uLuq8aTrzhwnBNDKDZRVeIotOB5fyGfbh9fngYYCYPB9HvoFbwBfe1nITQD7gJe ko0L26rdmmz+deBTERFtRjyBpGcoGXXGBZydi2dSD/OzOXmOgYQNCIXVmebednD+BNIM kKIA== 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=h2DWoheEsw5w4efoleu4eW0Xr5pSYDYg616zPwEbQJ98cASErOsr7LerjepJeYSevW GhE4X295nmLc3euxOeBccYKKLWIuejxH4N6BVJj+rUfJ2VKITJd8dUAixTbKfJ1tfVNv 9XOXbebSaMLjHxZGMIzwLIvd739In16aTo5oF4h5dsNGuQxerLDbdFt5/xC6pIWSDeVa b1msdfJC0nE7zItUBEl5N19NG09b9NlybXYmV37baaPfd734Itjy35/8KDE9TPhCu20v I4Budq8j9zE89dACmInjOuE00jO++53NlCrFuyhRwEr1rw9Oz9FuyzO4kfc/CadXi6B3 B/Kg== X-Gm-Message-State: AO0yUKUaKAkJjvbNhy6lVKegqgU+v5G9dr/bk7Ql4S+29guLsoiTEXM9 kvcCNWG0rxMXOQ6qZavAm7hffRmc3UnNM1Wd X-Received: by 2002:a17:902:d4ce:b0:198:9bf8:298c with SMTP id o14-20020a170902d4ce00b001989bf8298cmr3617202plg.65.1675259983955; Wed, 01 Feb 2023 05:59:43 -0800 (PST) Received: from sumit-X1.. ([223.178.209.222]) by smtp.gmail.com with ESMTPSA id i8-20020a17090332c800b001899c2a0ae0sm3636759plr.40.2023.02.01.05.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 05:59:43 -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 v2 07/14] net: dwc_eth_qos: Allow platform to override tx/rx_fifo_sz Date: Wed, 1 Feb 2023 19:28:54 +0530 Message-Id: <20230201135901.482671-8-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230201135901.482671-1-sumit.garg@linaro.org> References: <20230201135901.482671-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);