From patchwork Fri Jun 4 09:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 454009 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp258340jae; Fri, 4 Jun 2021 02:44:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSOVw1YxFga3XQDbSqgtZ/u1gGiIJpBevSXcif2jN0z2Vt7ghLepYzjnFMxXuuALA1c/qK X-Received: by 2002:a05:6402:35c4:: with SMTP id z4mr3735022edc.362.1622799879657; Fri, 04 Jun 2021 02:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622799879; cv=none; d=google.com; s=arc-20160816; b=MOpSKUNQ0QjjGvr9XGsknpFpskiM7YeP4UJQKW6WjQ6FM8viHSdkslHzFHHlCzPQPZ 6AFqUPcDQv3MaX2QAB6Bz6QC8ftOqfqki/6tgiyYKAmshB92Fjn5T1j6QbSjca99YW+q fcEitq6VC/mRCVQmarwWIUAV9NpcuAdtMLOAhNWI1LLXuqCVcjQUeWnVK/D23mL5GXPD C6Zwv+n6gAo6NHo1Ex33Xe5cvIVfH0CHR3SpEwmo3EkOo8xsFXdSOwcAJkuVc2CGwsAM ysTh1bFzt3QoVlzZaqgGy4yMxB1Ps06o1CQgD0CVquz7tWd16jnQp5stZnQUl+aZcw2h n8KQ== 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:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=lHxfHoQGjtiKm8WE77dQ8jpIayoeCmH3ocAIqsJvRZQ=; b=uF/w4piX3KZ8fyiIfLE9vduLJeDWnC/EEpikhkrH4CB+G2x2k5g7dMDpDDVrvTa0Iz WEXQISRbUMLlxSbFY651XsO4h9URqI/obmSHz0w/+j+ysfPS36Ao7vvVKIlc1+bFEklH jdgJ7Uc4lpcG0cNhHn3JOm/1m+kumvR5tIFAlxxI0GHnJwYxEgp66PDNP7O+qVNDfwYK x8wHCcmjUjMikw6wVxDkeuzfbR4pi85iyU0p+avgvgVnrPf6R0/xP8YT+k8Mbt1l3Qp0 +GiN+gqeJS+XkyGfvZDpZumqWlMSjmRstTwliKUMthms/+FbLkr4QbzSsRyr8vVo8hS3 JvVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bCXxJF4J; 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 pj12si4156344ejb.371.2021.06.04.02.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 02:44:39 -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=bCXxJF4J; 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 8771582CA0; Fri, 4 Jun 2021 11:44:29 +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="bCXxJF4J"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 002C282CA0; Fri, 4 Jun 2021 11:44:27 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 0393F82CC1 for ; Fri, 4 Jun 2021 11:44:23 +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=masami.hiramatsu@linaro.org Received: by mail-pj1-x1029.google.com with SMTP id m13-20020a17090b068db02901656cc93a75so7118644pjz.3 for ; Fri, 04 Jun 2021 02:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=lHxfHoQGjtiKm8WE77dQ8jpIayoeCmH3ocAIqsJvRZQ=; b=bCXxJF4Jret8eMYxebdAf+a88ur2d+5zhi80akIzfg1zHT3GRtpSb3chQtwXUrJ2cj D3g9Py/8/tfuSHX5XtfI1y1KDu6somuf5WIZt609uxYg7pdpwcBMjmvybgZ7IJqYuxTd NV81Xf2WfI1pn4e/O0ZaZGnjMo4lAPux1M32g275s5G7y6qOuibKunP7dPcXSsm4vbEU kyLMuCktAx+kN+Si9P9iSGHc8bjCswHeVCvEjVsynVg2Ckuyp8GCLW834f/8F4mM4vxN +tfX5YVZuugEFKL7Qtgnr7vUumopt4IS5uz9l4eDc7T+svry+39dXZrarAUU9DrHNI1z BzSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=lHxfHoQGjtiKm8WE77dQ8jpIayoeCmH3ocAIqsJvRZQ=; b=SLaRl7gV4TkBvDAV/uhW9QjpfmrM1RbXvKkFoVG+HLtM3u0Af+Nks3YLOLseyLUE52 OyzQV+PCQr2U1qJru3aIsDYbNDXqbIQlKZGAh2PmIWjO8VNWMlWi8NYHdZiCzZnWyAI8 PilY2FHDcygqQMWIhDLmeMP4b+M3w65FjjWu4dtGn0M1SwaIhBjMkjyVICma8b7rDx0c o3VnLbV0jg6Uy5ONB8j0by//U7JTvM3Tm3ZOEsLKW1GhZ8dAjlP3UtW9IE5+1WXD1Ltr EjY+vs5mVBbNem67KrlR/OTF9BW0Lt2FjPPw1cRTOTZgV5K0lm+KEJF5RtZ+aT17Wx5z lgbw== X-Gm-Message-State: AOAM530PbOKfzIHWsj46YFoEmBDvRji63R8z3dvLR2WrlSArByDOCOlf tpY7fbmmrecx0oHLuJ9sm/Jg+w== X-Received: by 2002:a17:902:b707:b029:108:f49b:8236 with SMTP id d7-20020a170902b707b0290108f49b8236mr3433061pls.80.1622799861602; Fri, 04 Jun 2021 02:44:21 -0700 (PDT) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp. [210.141.244.193]) by smtp.gmail.com with ESMTPSA id d5sm1395730pfd.115.2021.06.04.02.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 02:44:21 -0700 (PDT) From: Masami Hiramatsu To: Peng Fan , Simon Glass , Tom Rini , Heinrich Schuchardt , Alexander Graf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Sughosh Ganu Cc: Masami Hiramatsu , Jassi Brar , Ilias Apalodimas , Masahisa Kojima , Takahiro Akashi , Tim Harvey , Bin Meng , u-boot@lists.denx.de, Jaehoon Chung Subject: [PATCH v5 06/13] mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver Date: Fri, 4 Jun 2021 18:44:16 +0900 Message-Id: <162279985649.518877.1315435693673002642.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162279979193.518877.11119025270138617301.stgit@localhost> References: <162279979193.518877.11119025270138617301.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean From: Jassi Brar Signed-off-by: Jassi Brar Signed-off-by: Masami Hiramatsu Reviewed-by: Jaehoon Chung --- Changes in v4: - Add Jaehoon's reviewed-by. Changes in v3: - Rename config name to MMC_SDHCI_F_SDH30. - Remove unneeded wait in drivers/mmc/sdhci.c. - Rename probe function to f_sdh30_sdhci_probe. --- drivers/mmc/Kconfig | 10 ++++++ drivers/mmc/Makefile | 1 + drivers/mmc/f_sdh30.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/mmc/f_sdh30.c diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 8901456967..1c5aecfa5c 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -561,6 +561,16 @@ config MMC_SDHCI_IPROC If unsure, say N. +config MMC_SDHCI_F_SDH30 + bool "SDHCI support for Fujitsu Semiconductor F_SDH30" + depends on BLK && DM_MMC + depends on MMC_SDHCI + help + This selects the Secure Digital Host Controller Interface (SDHCI) + Needed by some Fujitsu SoC for MMC / SD / SDIO support. + If you have a controller with this interface, say Y or M here. + If unsure, say N. + config MMC_SDHCI_KONA bool "SDHCI support on Broadcom KONA platform" depends on MMC_SDHCI diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 89d6af3db3..f5fd59093e 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -76,3 +76,4 @@ obj-$(CONFIG_MMC_UNIPHIER) += tmio-common.o uniphier-sd.o obj-$(CONFIG_RENESAS_SDHI) += tmio-common.o renesas-sdhi.o obj-$(CONFIG_MMC_BCM2835) += bcm2835_sdhost.o obj-$(CONFIG_MMC_MTK) += mtk-sd.o +obj-$(CONFIG_MMC_SDHCI_F_SDH30) += f_sdh30.o diff --git a/drivers/mmc/f_sdh30.c b/drivers/mmc/f_sdh30.c new file mode 100644 index 0000000000..3a85d9e348 --- /dev/null +++ b/drivers/mmc/f_sdh30.c @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Socionext F_SDH30 eMMC driver + * Copyright 2021 Linaro Ltd. + * Copyright 2021 Socionext, Inc. + */ + +#include +#include +#include +#include +#include + +struct f_sdh30_plat { + struct mmc_config cfg; + struct mmc mmc; +}; + +DECLARE_GLOBAL_DATA_PTR; + +static int f_sdh30_sdhci_probe(struct udevice *dev) +{ + struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); + struct f_sdh30_plat *plat = dev_get_plat(dev); + struct sdhci_host *host = dev_get_priv(dev); + int ret; + + ret = mmc_of_parse(dev, &plat->cfg); + if (ret) + return ret; + + host->mmc = &plat->mmc; + host->mmc->dev = dev; + host->mmc->priv = host; + + ret = sdhci_setup_cfg(&plat->cfg, host, 200000000, 400000); + if (ret) + return ret; + + upriv->mmc = host->mmc; + + mmc_set_clock(host->mmc, host->mmc->cfg->f_min, MMC_CLK_ENABLE); + + return sdhci_probe(dev); +} + +static int f_sdh30_of_to_plat(struct udevice *dev) +{ + struct sdhci_host *host = dev_get_priv(dev); + + host->name = strdup(dev->name); + host->ioaddr = dev_read_addr_ptr(dev); + host->bus_width = dev_read_u32_default(dev, "bus-width", 4); + host->index = dev_read_u32_default(dev, "index", 0); + + return 0; +} + +static int f_sdh30_bind(struct udevice *dev) +{ + struct f_sdh30_plat *plat = dev_get_plat(dev); + + return sdhci_bind(dev, &plat->mmc, &plat->cfg); +} + +static const struct udevice_id f_sdh30_mmc_ids[] = { + { .compatible = "fujitsu,mb86s70-sdhci-3.0" }, + { } +}; + +U_BOOT_DRIVER(f_sdh30_drv) = { + .name = "f_sdh30_sdhci", + .id = UCLASS_MMC, + .of_match = f_sdh30_mmc_ids, + .of_to_plat = f_sdh30_of_to_plat, + .ops = &sdhci_ops, + .bind = f_sdh30_bind, + .probe = f_sdh30_sdhci_probe, + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct f_sdh30_plat), +};