From patchwork Mon Jun 10 01:11:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 802935 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp1734222wro; Sun, 9 Jun 2024 18:13:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKt2Zm1iK3NtvJpfeIC/39Qd3/LY+La7i8ZEF0kocr/YgLfXwOFNoJPl5kHsTJCTKZ4s5yO1QIa+rjDf6YkyAV X-Google-Smtp-Source: AGHT+IGxSEoKMQZvfPe7R+/EYs0lFPLlKk2AS1yx+LN/waaN2MUaGvk9tO3Egqpngl8Nk7wqWGn1 X-Received: by 2002:a17:906:c8c1:b0:a6d:fbed:7953 with SMTP id a640c23a62f3a-a6dfbed7a3cmr542906166b.27.1717981999665; Sun, 09 Jun 2024 18:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717981999; cv=none; d=google.com; s=arc-20160816; b=ZgUOeqCODTjQEENRD7+ZYh/znnHJOUUELiqrfgeN6soyQLMquS8PDa3SykxU5tivWp ix5YZTUnd2BlC/zjzeK+tGWhJ49A8juLW91b7jzfwPiDzXA8ukYR8qjoIPegbdK40SW+ lOsA1iGkkqRbHtLEV8wVCxvCEn+lhMAylBGCru+LmpY7MIPYGhTy1SI4H5X+BTk5FN2H qFRiNHuEfZJZVCjPnjoXi1S4d+UdR8hmoqNU4UdjNZsMmcD8YE7wzqqkziZM+xmTSavW lCz9ZBnp8cULMm/5KnL8VfJGYZV6g3JZVbqaxyQ8OCBfQolJ6zcGHavz2xqqgFhw4lap 0YmA== 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=8viY7SbYuROR2eM2ZSnRIvO0crt+QSUsF5mzdu0K1oo=; fh=FEcGjA7/Fi7Z/3T4cmQmfK7OiKynqrgjZDEXqOQT9ag=; b=CQufaTmmQSRkuttqyvu/GzsaA9kC2kTH+YMEwjcF8KvXohThDUTvKBwoCCS8gXrKla 9NnAHQAgvgHWXp75lvfQ33fPDN6yXl/aZUUoXPmd223475NMQlSFliidTTq8JvAieE0k 6hSuqS80SIvIYvJuMd6EGXrDb0S8hnDTK7Gs55XsiiJMSrm69AN9l2D0zflRPUVtHear oiQ6yJMunwkqmQ1B2mnkzZE5bF1zP27gbFYmx9sIpDs+CSg5ER/mMzfVoXLHUKw4wzHB DE+tOFZHlxmkvzREUmop2B2u+FBg7A3rrIKC+VDHzeY3rn93NvDCoCnw4kcuiwvA8k1k U9Xw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XumNLUb7; 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-a6ef71e428dsi233863666b.62.2024.06.09.18.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 18:13:19 -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=XumNLUb7; 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 99C9E8846F; Mon, 10 Jun 2024 03:12:37 +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="XumNLUb7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E131B8845B; Mon, 10 Jun 2024 03:12:33 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 B2C7087D46 for ; Mon, 10 Jun 2024 03:12:31 +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-oi1-x22c.google.com with SMTP id 5614622812f47-3c9cc681ee4so2115978b6e.0 for ; Sun, 09 Jun 2024 18:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717981950; x=1718586750; 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=8viY7SbYuROR2eM2ZSnRIvO0crt+QSUsF5mzdu0K1oo=; b=XumNLUb7KPoebMuP2hnlCh0iNihS8Htj99OScH7Ox7oUwp2IGAuKcT1l0CEjreOZRG h0GyrtkjShlUSGs3JACf7dfWnuz5uE+qLJpWqNxlaciLgH/kOOR3FoJ0TfheSp1slYrD Fh7ioLOLizmx8SYNrAvQYX7Eb9jEpInAdZYNXVawoDIfId8lpWttE1xxusFks/2tIVeF RTmxYnsFS73SYz67nRi06VztJ95Qo1JxDRIznmQz0vfZjz7GCLY+r8N2Qy/KEv0QSrSn w4WQEu/fGRJRiQSLpP5Wp65hls687tDS3as9K+Df0a1dnPl5hawA2zIda4ihZtqKIw5n WI+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717981950; x=1718586750; 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=8viY7SbYuROR2eM2ZSnRIvO0crt+QSUsF5mzdu0K1oo=; b=SvYQsLjSCF+VcG/+3/3VdNEtwWv/1Ug0ngqbcGXaIB5ag10pmqV2KHzn0KFhIvQsf8 x5m+WwAkzdfxscpzlnBKCdFtHG8nxXmEvm3ZheVgoB1OX37Yr5ew2amkqBDX4By0fHsZ abJMz4CoTS1LE8rAGYE4m14lWVNOxafu7QnFDzobaSwhvuowJExyBAxzA+coV0bHunc3 vQNT9aHEK7YkQeaHsgxihrda2q+DPhkhz6YC3iLpziOS4aW5E9YoffuI3eOLG0ch7/sf noNNxOaasQhGRHqbWmPUl2zOafrr379K4F08qViWws5qsEKCbcdFlNr01wTVuPLt9rv4 jYtg== X-Forwarded-Encrypted: i=1; AJvYcCVVi13b7XDAQ4UeqMDDapuZlyTN6dpQmQRU9OtW5RdfW1zhpDyFTTjbfTWk2OUxZGtvEX9Y2q/RRiZ7yFcPqfoSGapGjg== X-Gm-Message-State: AOJu0YwUP1mbkoPzPxeaQUz5R5yzEtiJRTJyBjOZ1vrM3YTSfBp9kQB2 dr127vwMhp5GMjumdhQUPEWNwMoFQyj/tCRnfo8CwH8v28quAQL4E+OPBYCtsSM= X-Received: by 2002:a05:6808:2390:b0:3d2:2577:89a2 with SMTP id 5614622812f47-3d225778b03mr3426260b6e.2.1717981950421; Sun, 09 Jun 2024 18:12:30 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3d20b66cae2sm1441631b6e.4.2024.06.09.18.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 18:12:30 -0700 (PDT) From: Sam Protsenko To: Tom Rini , Minkyu Kang , Peng Fan , Jaehoon Chung , Simon Glass Cc: 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 v2 05/40] mmc: dw_mmc: Extract FIFO init into a separate routine Date: Sun, 9 Jun 2024 20:11:51 -0500 Message-Id: <20240610011226.4050-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240610011226.4050-1-semen.protsenko@linaro.org> References: <20240610011226.4050-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 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);