From patchwork Thu Aug 8 03:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 817669 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp674772wrt; Wed, 7 Aug 2024 20:15:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfI1i+fcs0i8YDZLe+OY70jbmMQOevVLk2lHZM7Z9wpjVI1e+PTHOlwFV7yR80zusS7s7/fWoeCCEaucBNDJCd X-Google-Smtp-Source: AGHT+IGh295S4FH2LI37xFrg8szqQOo5opHfvcIWtPzdSuVTN4DAOGXyCnTtqsdg5LEJ10LhpaED X-Received: by 2002:a05:6512:15a0:b0:52c:c5c4:43d4 with SMTP id 2adb3069b0e04-530e588be65mr362492e87.53.1723086952059; Wed, 07 Aug 2024 20:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723086952; cv=none; d=google.com; s=arc-20160816; b=p4wAJUFzj2OotBv6FtdtGmneYw0ZDmOisN4db7q0ONC8zPq0PZUjm2kbizIxMDre8Q 3gvQcEPxgBPBhLBR/FZS/omvZVVTMFtA2BXU1CZBlhy/1KQBczGEzvksMIZfBYNxx+1L aE1vdS4BCH1QPMYoAZEliMM1AmvTMGwq3jIECH7TBHuJ4cKxQ43bZ5wWRjWCLfW5B3Jo qWJpLa7vRnw+YkezT30Q2Ze6SiF142GjrU3hrUT4eoyf0hpFjVwQgYTs1Avb5FDWn73B 2me+eCCaXO60lCZg8k0kmjroeVjTl2HWPjpO8FJ/Oaoda2F0c0RbA9abZj99seMxhiPQ 3ZiA== 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=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; fh=MkQlSBdhP8274AUugMtShokXmqYAT6bL0FUEn7PksF0=; b=rH+PLHOeWsCyXPL42LedYGU4o77hcjHz7HPpE2GbB3e6vOp3a9+nER0VpoZ9auLSJX Cor7xsjXYD9MtMxlFISIh0v0mD4s0dMIudlSj2wfGIB1HTEvVnTs4dvKwD4BroPVCRiQ dybxNJTmlejjs/Et7psGQQXd1swi0K7xgsA8o0fijlTxJMAL9r/Bs4qDGnQKRSQPO3C4 h6+KoioIj+uMm2E7/shEJoRa7y9MnXp1PLoyaznibfinV166dkCmcE6fHV6yWNU7OOMM 7Rttmf5DIZWvtJ07+bn/Lj59p8I0LcaHwHdKRnC8sS5bIcMWFLtnyUzTOBAP3dSDhKJP HsIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBC9gp2t; 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; dara=neutral header.i=@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 a640c23a62f3a-a7dc9d6921dsi719695766b.423.2024.08.07.20.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:15:52 -0700 (PDT) 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=QBC9gp2t; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B767088A83; Thu, 8 Aug 2024 05:14:58 +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="QBC9gp2t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BF8788641; Thu, 8 Aug 2024 05:14:54 +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-xc36.google.com (mail-oo1-xc36.google.com [IPv6:2607:f8b0:4864:20::c36]) (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 9955A88641 for ; Thu, 8 Aug 2024 05:14:51 +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-xc36.google.com with SMTP id 006d021491bc7-5c6661bca43so326329eaf.0 for ; Wed, 07 Aug 2024 20:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723086888; x=1723691688; 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=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; b=QBC9gp2t6bba8xUEeUvLAeLYKUzoT8B7whRHXTkUi3OXJAX8izhyTRIY6fXA8ZDZOV 1uorl78+wDQNCts1aZEqKM1UsUsGJTTN5KPslUNzvv85AShIKIFmAeuhsxMW2a95FzZl mDCp8zLmq2nG4ZFO0KYGl0pzbaAKENkc53Dl8cEq8uzj8VECxnd0vRzmxksoYw21O4aI m9hplIT7EJ18B84bVkPkUJ26ZxG1w+NkpT+QvIwHAk55j0/pJ7mlapsQU1SIeeS6Y1n3 WV/wOBhm4Wb89dmUWNqX5sSvsipgDgjWL/oUQS4KdRms0E2K8SLEGgRjHAKumRtl8vUW g7OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723086888; x=1723691688; 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=FRCqD5v1ORpY/kJffGm3A2945sYGmKt5zChbimK5q7M=; b=XVBbDotl/RIRC5471aNQtJVGXKbA1OA1ZDuurFaj58G1uej+cqTmJ9vpqpf1um1tl8 nn45Aw3kn1wLpb6046x5KGZnmWnw7eezBIrbhfZlkPza7Lz1ZwRmh12G9+QWDnwELjhq n1SKST+W/kwT+/XQ9MWpQPooMewb8DX/td6IaTOwNIlszkW6RqXw521OMQNEoF84/QZv bugPb3GWpuwD3fyD3alspm4lFuWXOp/wQL4vn+AGjgvhhhMZ2GD9lZrzlWXkc4/05jBZ SOf6fbqUfb7c54RUvMWW9nFzANiJZSJ2y5+ajVnDVmMAYqSzeJndDhO8EVJSikgU/8Nx 52CA== X-Forwarded-Encrypted: i=1; AJvYcCXAo1zw8OL+VTydj/Y/dwelsvC6PMvTW23i+PGJeN6mfF/KnONuIhrKHWg2r+/5vlgSvhXv4LG0/T+6U7+eM53lmy9xQA== X-Gm-Message-State: AOJu0YxV8PwFVlRcvDDEOTvDc0N101M83FKqslCW+L7ofGingsKDzOi0 aiqAYtdmTR9akqmskPSCij0L1hE5Aev9uaWgqsZjykNP34hKJ6jzdjCoJ43S1ZE= X-Received: by 2002:a05:6820:2782:b0:5d5:c3a9:4010 with SMTP id 006d021491bc7-5d855bd447fmr667311eaf.5.1723086888184; Wed, 07 Aug 2024 20:14:48 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5d7478b084csm3481820eaf.0.2024.08.07.20.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 20:14:47 -0700 (PDT) From: Sam Protsenko To: Minkyu Kang , Minkyu Kang , Jaehoon Chung Cc: Tom Rini , Henrik Grimler , Peng Fan , 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 v5 04/38] mmc: dw_mmc: Extract FIFO init into a separate routine Date: Wed, 7 Aug 2024 22:14:10 -0500 Message-Id: <20240808031444.9619-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240808031444.9619-1-semen.protsenko@linaro.org> References: <20240808031444.9619-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 v5: - (none) Changes in v4: - (none) 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 395b699b0a0a..4a9e57165fbb 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -538,6 +538,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; @@ -562,16 +576,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);