From patchwork Mon Jul 22 17:57:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 813774 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1987390wro; Mon, 22 Jul 2024 11:03:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUStpzBlurByLkqHuGg+h9Bip5AAVfNWOc7hzxZCDI9r1DB6YsxPda/ks/epYI44Kp5idRVEfhQVUkVPgR1CuE X-Google-Smtp-Source: AGHT+IGVxpoIJLV7zaUhd5+nWSZFUqliNbKKgBbRXs01Fcoaf/eZBe1iRFagPVFN/lYUx4zkxLhI X-Received: by 2002:a05:6512:3045:b0:52e:fada:eff3 with SMTP id 2adb3069b0e04-52efb52404fmr5415302e87.11.1721671398532; Mon, 22 Jul 2024 11:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721671398; cv=none; d=google.com; s=arc-20160816; b=vZcAoVcjT+sAPNr6LgDFr6t+bU9F0AT8uvc92ccz2SDR69QeYmnVy1URv4fcEvcz07 eru+W/SHZ+8UcYnkxrDUsaF5ylacSoX0h/A51cQwn7gUQ3ztd9985i9noWFi8aHCZOof vnT8TYUhhMrBEyxjeQrjdpAr8ttMMQryjfpt0GoWd468DXmRmF+5jcKxvjngMbtcJOa/ baYXdBw71a8VhCXenOyqjbIESuVU89T8UJjEbt7Hl2q9KvoKQIE0qaX130pGkDpN6rDt e3r7FbhvkU6qDP8Y5lXrR2WrFZtlZvhZ1M5mHLNPyEe9RKj2uVMs3LKhLnwSwpe2cyQR hEdw== 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=uxAqhYxXUfKOKyL9wAYDi0rYpojxZimic7j/BRNYfIw=; fh=mWBoOWlu0rl/MJU+8VKdwmHbKhedyBNXFpglxYqgqJk=; b=CLP5aT6BKyXffpYbA1W5DsUaV4FbE/HRgSQ640ySdnZki2z6JxeUd8hqyX6oFBuScL YDhY6cS9nK1Ngvxv+s6LyZt4F5MahRvUd2UTsjUMByseqMTUEoOl2LF2+GLAEen1AHmO mGJb/46WC5Jy0xSpyawEsX+29lTkVhccj1CjhGVHPVPiM2nxgKOPrAyJ0sQIOBpnjAAq PlNqOmf47XEWYw0TSuHe78u4Yj1jRW2cAIgTIOfhxjzID/uRRRJyrY5x6DZyf81/ViZ+ /m+W5qhBOKTf1cMJu4e6ztq6mwv8V5CMLQX2i9Z2zDLtEEHsm1ofa8yZoBEDYKZ7CBEu 4onQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C6wV+ZRa; 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-a7a3c94f8f9si405602966b.700.2024.07.22.11.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 11:03:18 -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=C6wV+ZRa; 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 A0C8288777; Mon, 22 Jul 2024 19:58:15 +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="C6wV+ZRa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6514088754; Mon, 22 Jul 2024 19:58:08 +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-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (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 3B69687919 for ; Mon, 22 Jul 2024 19:58:06 +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-x22d.google.com with SMTP id 5614622812f47-3d9da46ca13so2549465b6e.2 for ; Mon, 22 Jul 2024 10:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721671085; x=1722275885; 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=uxAqhYxXUfKOKyL9wAYDi0rYpojxZimic7j/BRNYfIw=; b=C6wV+ZRa+Qfo595CjxtNwEuDUgym0blBuefYCiC+l0gpUk9nHA1htO9RCs2yPctwVU zr+Ll/5UJp4KmkJ7IzYcoMkhYWytskyHoMU6h48ezQayJefhj1k2e1xfjYJXytKxd7br fqgcdaR3jeD1HArvER7kjRSVMz4YVuF7YhusKb6IKLWW7KL8Vcvn1jJt1L+2FgLdHjN8 K80aoH3/RwWcld8j5PEBokVVj0jWx3E8gOloiiBl2rSbp36g9or16KG5mWZcUx7TPQp5 SJE1WDM1aaXZLY3MFcn/NdiGki7Us5q7Z76Tr95PlHM9++fSzxr1w6gKY+0LHwzllPlD /3mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721671085; x=1722275885; 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=uxAqhYxXUfKOKyL9wAYDi0rYpojxZimic7j/BRNYfIw=; b=eJoG67JpZY/oMDiRf/20rdS7r2NoxIwprU/bGRzidQpWl3FKfkxmphqtWfbI/qv3CA rzHZ66G+KdDufo6+26HMg2rqpIHxRw9aj0wl7ymwnE2YKPDwymCMCcWcJCFObOzj1Cxw S1Glbo6jxcmUcyyjW0x3PWEjzKcuAfFy9txB7iVKXhHt/5gXrvhN0u3aI0JLqyoCGMNw pryfa5zpv4oC4qb5Epd7PbMOojIIkSnqkJwPyLX8xUBHv7STligxasnemUsZyb6Onq6o AN3F36EyxRSyrKRFdkAI/KlECBCJyCgzuerX8Ax+MR2WT1WQZnZKMW/F/aDi3Pn/MyJ0 x6yg== X-Forwarded-Encrypted: i=1; AJvYcCV17KhVfON0twwTsG8E+wur1OHxdGoTBJdozh1gB+8Lg2UCfPX7EDIyB1NJdjITf2YF0/x+HSNcvCBgPjKNr5m9+l8ngw== X-Gm-Message-State: AOJu0YwlVh9qqAFDWRkzsIRvx9kGcaW0Ce+JLMOuJIjvG/N+lSPuPk1E pwlLnybzGSFPYPkVw+XWf6zwyxvFrEFReZYkSym7t3t0DabAG5bq5UFyeqhrwxs= X-Received: by 2002:a05:6808:1523:b0:3d9:28e5:5865 with SMTP id 5614622812f47-3dafd0e9993mr620865b6e.21.1721671084987; Mon, 22 Jul 2024 10:58:04 -0700 (PDT) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3dae096bce5sm1621675b6e.7.2024.07.22.10.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jul 2024 10:58:04 -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 32/38] mmc: exynos_dw_mmc: Pull all init code into probe function Date: Mon, 22 Jul 2024 12:57:34 -0500 Message-Id: <20240722175740.6985-33-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 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 v3: - (none) 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;