From patchwork Mon Jun 10 01:12:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 802965 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp1735442wro; Sun, 9 Jun 2024 18:18:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWm7cf+2b9jGe5kTltYmViVe1Gv7AS0W8+1nLk9RT35YtVXxG5CXOmODW1IaWJKWVqFYPMFTAxyF/rjWUVHlKef X-Google-Smtp-Source: AGHT+IEv4j8FKKi78WMZshIy7fuKIzR+RjSHiiN8cz5Rah6MYfXHMbgV47iQK3m57TI6fUODX0wH X-Received: by 2002:a17:906:6a0a:b0:a6f:1d19:c0b1 with SMTP id a640c23a62f3a-a6f1d19c496mr132301866b.18.1717982300061; Sun, 09 Jun 2024 18:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717982300; cv=none; d=google.com; s=arc-20160816; b=D48Nm8szrG5GCa215ZU/jsFCq0YF+So7RzBIj5MAD8SpUJvHou77yGS1kThZD1AjO9 JFYfnS3daICaAaE/ZZ9yofLK7PxfzuPjkhPhNv7DBec9VKWg/8lwKsn5MqhMzI+mugdZ ZMLDLLuf38AYpCg9vL6YO0YL6H8sZu7g2HJszNmO5MxhK5czTXZT2Quo1um8VIi9de3W Ogb3nPOEmXq9fQXj+eoixhZI97jyjnjAX/UIW9+8eNmLQ4oO1cs+klzRi2OUDYG5Tg1e lOrThq75K6SDdz55pCUJSJZea0KLKlWofAw+QXpEy2sthfozQ6A8UsQsyuY0JvoPpR7W Aq8A== 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=2YlLT6dmvIZXH7j0HvrdXolO7Eyi/HU090a4rLJVlIU=; fh=LKFfG3gGVT3Fqi6D0NZ2EGCJTvSHrPO9SKgSDgRAKEA=; b=DWuRMAJaNzoZlmaVe+xsvK4lTVEvvDv88FHR9gxKN5MojraLMUNrdS4rN5Ou1FuB4M sj17xFYZmnszziv80W+gl/29t+hy+4yVMwc+/vJnCZ0mZ1LZBdQASUwuc1dl2gXPqXC5 3OVtlA3byIyDwfYusM7heA11XCOAMNpwiEF4j4VMvdC3ab/udQhz47jG94j+5MaDEV7i 9RddYldcfXWpPQpjcrZHEie3wMqB4L4pNK0swj53y93YbtHzsAEhszmOTrBWvnED5Son 5DDu7hm+XN2subBZktYgd4gw4YejNYl1KTpQ0KCG/NGcFC2JNLikY3xe77+0tnnH+aP6 Njdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kLPA4Wsv; 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 a640c23a62f3a-a6f1e0d07casi65882966b.211.2024.06.09.18.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 18:18:20 -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=kLPA4Wsv; 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 BB30588576; Mon, 10 Jun 2024 03:12: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="kLPA4Wsv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B12088551; Mon, 10 Jun 2024 03:12:55 +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-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) (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 BB87A88489 for ; Mon, 10 Jun 2024 03:12:52 +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-x332.google.com with SMTP id 46e09a7af769-6f8d0a1e500so2842130a34.3 for ; Sun, 09 Jun 2024 18:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717981971; x=1718586771; 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=2YlLT6dmvIZXH7j0HvrdXolO7Eyi/HU090a4rLJVlIU=; b=kLPA4WsvMcyM+MauS2w/y94R+xgRNmkRmwWQY2uP2u30Z0W1+0M2XKFmJm8ZC2d5he Pob8ye7J1Dm7DWjI7aqdACqM43xV0oFYA4353pJxb6x/QmKrstXvr//IBaOL6w+FFR4M 6TY0INs0i7Y6vDMtGWb8sRs5Usgi3xLHsJP7ihSjMtarie9jMQ/4yJZ88XLXHcX5oAya KRxmXGquk22UQhszM9HgCSnHWR5yUkkCNZJAKt/84CF3YKMmr7MfiXvIZsRGlMO59vaV BfqgM1QT4QNYv2STp7Cg2RcS4yqnZ4tEaBP3feMko5q77byP1KPmHeP2xyf0nf0jNGGC KGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717981971; x=1718586771; 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=2YlLT6dmvIZXH7j0HvrdXolO7Eyi/HU090a4rLJVlIU=; b=lAsvGqViGOQrtvff+EE3ndfvdHDgWCQLayQXcCwG7jnYnekdo+gqr3fqJ46UpMeww4 G0RRHgYoibr7xl9xQ1s7UCJhnlH+3L6qK6VvkoR1AI7zbAoPAsKypNkdwsK0SRHYPt+/ 54C/8G5ur7WrE6e3jb8Tv4pcWzy+GSSVJBaLRHEtmUJkycpzwubCVB0m46WOFgSIPvRe j3b5/HRJjhtiWZDQhn8T35N40NwJv8h1y5seHAcFQJqpVWVpbTyux1DesTA5A37/Ozy+ nseGXtX+S2L3Q3e96kQY2K2KerAOwfvLqUyYpgcFaSVa8FkzJM4gARhxeGWWoVsp/eRF TLPg== X-Forwarded-Encrypted: i=1; AJvYcCU/1jK4GUbm+YsUL7TjP30Q2Zer+fQMIp59laslNl5+jv7bT6v+suiZ5T2OWOU97VBzoxqKCk3rujtew6KM6qHoWs+Apw== X-Gm-Message-State: AOJu0YxLIfLjJmKW16+lgncJApi+zCYA6KPmK4zE/yfEohobw6w1lYNv ZCHhBnF3HMZdA5Q+1EXVPhSqxKj8jISnv6zzxm8zcuZnQ1xy/IvwfMUVEYPUIGQ= X-Received: by 2002:a9d:7403:0:b0:6f9:a404:b40e with SMTP id 46e09a7af769-6f9a404b599mr2625446a34.9.1717981971428; Sun, 09 Jun 2024 18:12:51 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba9769304bsm1476365eaf.6.2024.06.09.18.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 18:12:51 -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 34/40] mmc: exynos_dw_mmc: Pull all init code into probe function Date: Sun, 9 Jun 2024 20:12:20 -0500 Message-Id: <20240610011226.4050-35-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 There is no logical sense to split the initialization code between multiple functions. Pull both do_dwmci_init() and exynos_dwmci_core_init() into exynos_dwmmc_probe() to make the code more simple and obvious. No functional change. Signed-off-by: Sam Protsenko --- Changes in v2: - Replaced CONFIG_IS_ENABLED() with #ifdef drivers/mmc/exynos_dw_mmc.c | 86 +++++++++++++++---------------------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index 29241edf7915..41fb32c579ef 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -209,55 +209,6 @@ static void exynos_dwmci_board_init(struct dwmci_host *host) exynos_dwmci_clksel(host); } -static int exynos_dwmci_core_init(struct dwmci_host *host) -{ - unsigned long freq; - int err; - - if (host->bus_hz) - freq = host->bus_hz; - else - freq = DWMMC_MAX_FREQ; - - err = exynos_dwmmc_set_sclk(host, freq); - if (err) { - printf("DWMMC%d: failed to set clock rate on probe (%d); " - "continue anyway\n", host->dev_index, err); - } - - host->name = "EXYNOS DWMMC"; - host->board_init = exynos_dwmci_board_init; - host->caps = MMC_MODE_DDR_52MHz; - host->clksel = exynos_dwmci_clksel; - host->get_mmc_clk = exynos_dwmci_get_clk; - -#ifndef CONFIG_DM_MMC - /* Add the mmc channel to be registered with mmc core */ - if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { - printf("DWMMC%d registration failed\n", host->dev_index); - return -1; - } -#endif - - return 0; -} - -static int do_dwmci_init(struct dwmci_host *host) -{ -#ifdef CONFIG_CPU_V7A - int flag, err; - - flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; - err = exynos_pinmux_config(host->dev_id, flag); - if (err) { - printf("DWMMC%d not configure\n", host->dev_index); - return err; - } -#endif - - return exynos_dwmci_core_init(host); -} - #ifdef CONFIG_DM_MMC static int exynos_dwmmc_of_to_plat(struct udevice *dev) { @@ -345,6 +296,7 @@ static int exynos_dwmmc_probe(struct udevice *dev) struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct dwmci_exynos_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; + unsigned long freq; int err; #ifndef CONFIG_CPU_V7A @@ -353,9 +305,41 @@ static int exynos_dwmmc_probe(struct udevice *dev) return err; #endif - err = do_dwmci_init(host); - if (err) +#ifdef CONFIG_CPU_V7A + int flag; + + flag = host->buswidth == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; + err = exynos_pinmux_config(host->dev_id, flag); + if (err) { + printf("DWMMC%d not configure\n", host->dev_index); return err; + } +#endif + + if (host->bus_hz) + freq = host->bus_hz; + else + freq = DWMMC_MAX_FREQ; + + err = exynos_dwmmc_set_sclk(host, freq); + if (err) { + printf("DWMMC%d: failed to set clock rate on probe (%d); " + "continue anyway\n", host->dev_index, err); + } + + host->name = "EXYNOS DWMMC"; + host->board_init = exynos_dwmci_board_init; + host->caps = MMC_MODE_DDR_52MHz; + host->clksel = exynos_dwmci_clksel; + host->get_mmc_clk = exynos_dwmci_get_clk; + +#ifndef CONFIG_DM_MMC + /* Add the mmc channel to be registered with mmc core */ + if (add_dwmci(host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ)) { + printf("DWMMC%d registration failed\n", host->dev_index); + return -1; + } +#endif dwmci_setup_cfg(&plat->cfg, host, DWMMC_MAX_FREQ, DWMMC_MIN_FREQ); host->mmc = &plat->mmc;