From patchwork Mon Jul 22 17:57:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 813747 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1985281wro; Mon, 22 Jul 2024 10:58:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUoBl4cuB0dxneCrzs9LIsZ43oNpRlAFLMBXaK3//bGZGU+pym2OmocZk3KtZDBkNWveQZqHgbEvA8KWIfEBOKM X-Google-Smtp-Source: AGHT+IGYwotiacEed2b+vUdAzkyeCwstfc4MhzgRSi7XCuqmm6ile8TQ+UmHRPymRfXPI+1bi9Xg X-Received: by 2002:a17:907:94c9:b0:a77:cd3c:e9b4 with SMTP id a640c23a62f3a-a7a87c827a0mr47498966b.24.1721671108300; Mon, 22 Jul 2024 10:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721671108; cv=none; d=google.com; s=arc-20160816; b=fbN8jq1tga1831X3BEmtwL2UGyAQMS0ammRgXBgisLDRc/LV/rXCuV0Og90Q1U2F3i K18IUrrWQWO+QgtTJaMZFD2fsmcIQgo/hdttXR5M9mcU18xfDRYmvuURG6XMcL4nVosh 1tCeDxvWLr3TtPbA+4SGcjwqzzgTF7aUxXRYxSlsIoKP5vYYkSs4HxyiGPqtMBZ4SrCx zyLdl86uBFHvhG0P0UPMP4bZUGGT2W2rhCZPie7/3HolkZCh2Ds8igHo+mmbkHdGpMWF Ou80NeF+U3ib65vFtLQ0wQDbwVcPt/FANaYhD8bTWrfNZAiNGnBW5fK82S+EFvLRX4kG ii0A== 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=/szNzAHh4ooOhxwkHsXehb7GdYF2Vg4+vJOe1XuY3No=; fh=0h4nz7OaoGDIEMJdQWrzXR3Y8HVoPTSOy7Ty5MvPLxE=; b=zLgVrAy1ynwlHTi5Fo5ixwnA74F94MTo7nTDZNndXoTm+vYhXzaQvQmPmhyJSYGvje S/Vz8br81rAU6w/BsCnZHGa5rExLy9im2fMH8AFcG+W9jckujKy68h4YT4wjk+dxgiT1 FKyF7iNeVogxmMPg06TrpQJnjjJ4MDAZv0oOE3Gm+sf+BAIT4Km01DMAlvNgk9Uv6p7r GZ+Xlqs+Or3FdS6iVX+j9MeLLz4ha+Z8VRJmjT97iQO04IcDGjeaWGFQwA6cWGkKNBUb UGYJVYtoeoAqvW+En/Px8IVIqdP+Sxq3tM/mLDtLVM0W3XUe0Yi6R07a6mVTcAHX5MCq 9AuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z2FOb3rE; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a7a3c7894easi415136766b.80.2024.07.22.10.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 10:58:28 -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=Z2FOb3rE; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DD06688403; Mon, 22 Jul 2024 19:57:49 +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="Z2FOb3rE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AEB578841D; Mon, 22 Jul 2024 19:57:47 +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-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) (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 83CD987E30 for ; Mon, 22 Jul 2024 19:57:45 +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-oo1-xc31.google.com with SMTP id 006d021491bc7-5d569bee00aso1210151eaf.1 for ; Mon, 22 Jul 2024 10:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721671064; x=1722275864; 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=/szNzAHh4ooOhxwkHsXehb7GdYF2Vg4+vJOe1XuY3No=; b=Z2FOb3rE2lFEeOrOWdiw07jaOy0qIJ3iE0351D/JtDpkatcZ5FRGui0+t4y9Yo+VP/ 3AX9WkJy2RgZ8NIg3RrzpQaphKXa6oOZQ2BpLOXOcx7CxqlAO/nXySeTNy6JHSNMhQbM b25GVAy5epv9mFlVCeo5x4XvWTo9GStnUyg8oMuIqn9fVAT812wSCbhuiLEkn38Kpi37 X5W+O8kb2Nj87WX+MF7VSR0a3jlR1aWCkFDq8if/FJN2cEedNdx8xL3oezew8AIQqrt7 twGartUkScWIPcGKghHJ0Ts9Qivq7K0INiOUQZrzN+G0xahkEG8sh4qcWh2FMu8VPMvT po7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721671064; x=1722275864; 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=/szNzAHh4ooOhxwkHsXehb7GdYF2Vg4+vJOe1XuY3No=; b=ea4YPsHqNpoL0KpLafa+o1RhnXgPX/zXgwvBIIjT4KAB2ZIRKU33cchwnO6l8KdDMV g2Db1QsWQW6TQDXkwNtn1YChJ93fpHhx5Dez8MPvyfHm429V37JvgnNLn+zc7VksnOHS p01z8dQCPBVgK2tqhSi7yJPT++QPUVoU+L2aGa+bu5jfADeFbimpKyuPSM9+ruZNDeGP /bO8ZTfRdrn3hLyi6D24Fda5unKebc3slCBDRgIVZyAyb98fskDSB/VQ0G7C5kcROzmJ xPMt9kc5V0gtH+ahUaVyBkmXBQvTOru7EfoxOfOJFKu2WGRO7d7Nt7csWBI4J52j0wci 7MVQ== X-Forwarded-Encrypted: i=1; AJvYcCVd8RAnHxTJ/AjUIKqDv+//d3dRlL4sQbS0XRkKjgRTiW3iLP6Qnph6ObqRcb9HEIWSEloGNs2LnY49RFZOWBoBTBD4bQ== X-Gm-Message-State: AOJu0YxKL++USkD5xmtYCXxeiMJOdEYEPiSGeR59Oj9p1McDgZ7uAj88 pLa7ttf2lS8txX1oQ+d2TdsG+nk/NBjiDjK8n1P2+lBKuWviEf8qRIZggTJHJ/o= X-Received: by 2002:a05:6820:210c:b0:5c7:b679:4503 with SMTP id 006d021491bc7-5d564cfc023mr10902978eaf.0.1721671064336; Mon, 22 Jul 2024 10:57:44 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d55d4eb2e7sm1325847eaf.46.2024.07.22.10.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 10:57:43 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang Cc: Tom Rini , Peng Fan , Jaehoon Chung , Simon Glass , Quentin Schulz , 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 v3 04/38] mmc: dw_mmc: Extract FIFO init into a separate routine Date: Mon, 22 Jul 2024 12:57:06 -0500 Message-Id: <20240722175740.6985-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240722175740.6985-1-semen.protsenko@linaro.org> References: <20240722175740.6985-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 --- Changes in v3: - (none) Changes in v2: - Added R-b tag from Quentin 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);