From patchwork Wed May 22 23:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 798183 Delivered-To: patch@linaro.org Received: by 2002:ab3:6414:0:b0:267:d849:ee76 with SMTP id j20csp917464lte; Wed, 22 May 2024 16:32:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWoxNbcJohLYg8XtW4dwnYtYbJ2Lz8RiUzO8bgKujBfcAcSEmSGtPlbE6NfR/uNBxO39LeNXBCllmwSiPmpkD1X X-Google-Smtp-Source: AGHT+IFUDzQZGWCW0Sw2OR6hGJFdNZuOnWHComdYVopc73NmXtVIWvNT+y9kolLBsz0jxNXuZbyX X-Received: by 2002:a05:6512:6f:b0:51d:5e78:17fa with SMTP id 2adb3069b0e04-526bd6936camr2140800e87.4.1716420758071; Wed, 22 May 2024 16:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716420758; cv=none; d=google.com; s=arc-20160816; b=CzMNhJKPKhPQVFcWvWNrqZMfsAomzY7sZMkhbZjCoOXQfPso9tkETTg+aZqZ4cv5XT I3VXyCEz8dmD3+3C92iBABQCViFGiCeAc7aQwBnlBtkcslc6YwPycRg8D43P2g78PI+b PHaoXD6SOn9kJBTQEmsDRycGPjgT2Askk20sFOkr7tGKn+nD6qMVc0PZ44528VeXFRUK V97cHvAYqB/Cwyjd24zediFyMu1lB3oFvTxXQI6ZDZyZ8mgwlVnEz7MxT48RNFudSJSf X1yN/PzIGDRs82N6unYhZVxc4ElmtWqbAn1uyfiwUpWlrEfVHjFjhs0OlszoO065CBoy 8SJA== 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=9EVRv8bS0w3wESTaeA0XmRalvVP88dkRy96H1dAbcuI=; fh=EGEYzlzGFx7VUF1RD2dqTpOOWCK0rzPqyaWANP1Llj8=; b=tFC2OLEJtBbj+KoOJePBTiiLbdX/BXN8SUDNxprUMfzbDggoYyOvQOuILvusB1LSSX U95x/HEUX5othg97DD1Q0mrlZxa3pIuoNGGx2hzsKUu5rPqIOnqmyJdvdds4tX4H6535 RnmkHTfpNOHzRUQFCyK9ADmT2PQn22ncqC6OMCuwYBl+8HvQD9CXth0VJ29os5QZFPGU 4mO11IHFJAD7e0aOQ47AhpCbYkInLgxQzlOjhc5PQ/om7dREWaD0TRWEhn8IOXbHlCEB +sneV7Wb2yNC+5YWS7fHpcXUrgRrrC9fjk04+XjcO7YeRQKl4sC45IOSo6y22YFbz9SC 454A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ewdw/MOF"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17be6989si1536199866b.714.2024.05.22.16.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 16:32:38 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ewdw/MOF"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 0901E8851C; Thu, 23 May 2024 01:31:47 +0200 (CEST) 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="Ewdw/MOF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B393884EF; Thu, 23 May 2024 01:31:43 +0200 (CEST) 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=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (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 4603C88453 for ; Thu, 23 May 2024 01:31:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6f1242f1dcdso3260608a34.3 for ; Wed, 22 May 2024 16:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716420700; x=1717025500; darn=lists.denx.de; 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=9EVRv8bS0w3wESTaeA0XmRalvVP88dkRy96H1dAbcuI=; b=Ewdw/MOF4AhP8cOIoO6R77nfPq0CiuXCwVLJj9SQoW1tfO887AD4GduAiIF5QORV0H lL3XqvUOB1x/Ktfst6cvOH3KfnRZnxR7zgqD7qs5ynFR9onU27EbPBZC7Tz6A51dCeH+ T4mMYxHwCZhg2Y9PvYU0LYgNXy/BMg5okyzlJM1W2wezzR/U0AgMiUGL4Ne8VQDYvJ7n 6WgMR3I6lenVCWpXY7QLuqRNuYZSFWB5A4rjB9yLcUGaoh9+SJ6JUqBYFsnRqFRXdDzv nKEkDij6HHU+/lnCzKP7jMMunLds1pK6jLej1CaZZSpjijs1tiPQZovVC5BBWqlR6sN2 KSYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716420700; x=1717025500; 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=9EVRv8bS0w3wESTaeA0XmRalvVP88dkRy96H1dAbcuI=; b=WyNi0YOBNncMVKqFMSNlNSADtIKEGhPWJMjyT91LpAGeFAHkAHBtFSaH9XXSNJjIwv l+wgsz5cN5AFlCXx/Lpx/4ja22NbZLYNQEjEG+Y2GCjxrhRKVk+/0JsFxjMmXq1GU8zs IWSDtwESuQ1hMfA0HKyG2GpaS9kMMgY/bMvfpUJEqyw5l7W8soEWD8D+Ow9fG1SQyydD wi0O0mNTEf4PLVpXx0hFanmY0ZHJzGyTGRkdfAl19xiM51QRlebB1ezHnU6unECcXGNC DkvpZEffWsPZ65v9/3xaRq6Xtq43cY93MQrp+gpGwecTMFsb1LrraMEYOBNuhIeYKNJF E+Fw== X-Forwarded-Encrypted: i=1; AJvYcCVri1B4/zBiUiEkGZPIbSAmM0iHlQP2JL9s0Kkd5WQ6DUBzpMQpnn+P6qyOI6JIxBh64jm7aaLv17J1OYhuDg8ZSE9Evg== X-Gm-Message-State: AOJu0YwBl6MmeU7URDkHDpaKWhBqKbi0Xv5rEzPoZMq+bNAAYBFflQZX N4lb14U1kjHXJigwmf9qlzgvhTJn36/b6PEUTaZsp/w1A3RZbP19I0grzWgb/Ho= X-Received: by 2002:a9d:7845:0:b0:6f0:cf72:5d7c with SMTP id 46e09a7af769-6f669afca6emr3481564a34.24.1716420699894; Wed, 22 May 2024 16:31:39 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f0e49e317bsm5038356a34.57.2024.05.22.16.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 16:31:39 -0700 (PDT) From: Sam Protsenko To: Tom Rini , Minkyu Kang , Peng Fan , Jaehoon Chung , Simon Glass Cc: Philipp Tomsich , Kever Yang , Eugeniy Paltsev , Peter Robinson , Jonas Karlman , Yang Xiwen , Ferass El Hafidi , Sean Anderson , u-boot@lists.denx.de, uboot-snps-arc@synopsys.com Subject: [PATCH 05/42] mmc: dw_mmc: Extract FIFO init into a separate routine Date: Wed, 22 May 2024 18:30:58 -0500 Message-Id: <20240522233135.26835-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240522233135.26835-1-semen.protsenko@linaro.org> References: <20240522233135.26835-1-semen.protsenko@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.8 at phobos.denx.de X-Virus-Status: Clean Move FIFO threshold initialization into a separate function to make dwmci_init() more readable. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Quentin Schulz --- drivers/mmc/dw_mmc.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index a82f6a96db39..cbfb8d3b8683 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -540,6 +540,20 @@ static int dwmci_set_ios(struct mmc *mmc) return 0; } +static void dwmci_init_fifo(struct dwmci_host *host) +{ + if (!host->fifoth_val) { + u32 fifo_size; + + fifo_size = dwmci_readl(host, DWMCI_FIFOTH); + fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; + host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) | + TX_WMARK(fifo_size / 2); + } + + dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); +} + static int dwmci_init(struct mmc *mmc) { struct dwmci_host *host = mmc->priv; @@ -564,16 +578,7 @@ static int dwmci_init(struct mmc *mmc) dwmci_writel(host, DWMCI_IDINTEN, 0); dwmci_writel(host, DWMCI_BMOD, 1); - - if (!host->fifoth_val) { - uint32_t fifo_size; - - fifo_size = dwmci_readl(host, DWMCI_FIFOTH); - fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1; - host->fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size / 2 - 1) | - TX_WMARK(fifo_size / 2); - } - dwmci_writel(host, DWMCI_FIFOTH, host->fifoth_val); + dwmci_init_fifo(host); dwmci_writel(host, DWMCI_CLKENA, 0); dwmci_writel(host, DWMCI_CLKSRC, 0);