From patchwork Wed May 19 05:45:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 442363 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp985076jac; Tue, 18 May 2021 22:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzadZMV7LcF5QbxxBo9UM1H40XMWAjJ61eAtUVRIV2bPwSuL5Br1c0UC765WkvLjMJcXmTm X-Received: by 2002:a05:6402:30a2:: with SMTP id df2mr11711599edb.176.1621403152299; Tue, 18 May 2021 22:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621403152; cv=none; d=google.com; s=arc-20160816; b=jeVswdwrIX5sX7xu9iJICJDmihf4i83RDgIdP1AfoReVZ+MX0NFj4uZQYVaFHzmEYk 1BiWw/agcX2m9S0jVbYMIxil5ehpwWSLRZQfaVwLAwQCIj/QnX6Yv8rlRZTbcW7g7XZm RBZsfkjEeOd1ge1ARFi6/16j5F5N6/53w3tdWnu2z6A861J9eies855FyFG2lpnkQVlx GnGOSBbQfhYqdjSL2I7A+pE3p/IzhaFIlVhUfd5VAu3JuQRy9vKCRPWFFdYIwrA2AANu 7K03GFP7y/5kjhF7bX34wi8xY24n6T9uGjnnT36aD2ZjKthtMpLJsZyplhofWKKeJcO4 ITMw== 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=XC3rvAn3emzsP10KBHy7rvNk2nUHrwacWKd4IpkBxvKszyrlSD/CgNVDfVCJNs+ljH SJOiEkshbGySw5f4PBshgFE3rC0qdCjD+S8KFP/487hpnKStLujG1qyKXcb5OXQkY6P/ e5jctvGNI8hllKo/U+yhe++BSbtcjo7Ai+Q/Tm2C18zYJ6CjXJuTwN1RXrcaVYQ6lQ/j PkWKpc+ppkGzF71Otdud9p2G9jXgYGqMrVt4Tbdz67Bd2ZK5cG244LnXOzAlJlmgPiQM VvXCB/TN5hLSKJgG+1/AZHxxHkTotJIa+fN4jv57VqXtgUmXK+ie0PaeKu8YXJyp8yI2 m1pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ohpZ75q1; 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 y8si1306561edd.181.2021.05.18.22.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 22:45:52 -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=ohpZ75q1; 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 7C1F982CEB; Wed, 19 May 2021 07:45:39 +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="ohpZ75q1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5D0282CEB; Wed, 19 May 2021 07:45:38 +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-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (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 5F0A182D0F for ; Wed, 19 May 2021 07:45:34 +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-pg1-x52c.google.com with SMTP id m124so8644790pgm.13 for ; Tue, 18 May 2021 22:45:34 -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=ohpZ75q1xAMGBCyURQ9Ua09hquHEEmGpNu09iLTeqpYZtdBZW55jUgH4pSlLpjC5lP U8kZH2M7/cSquKBFWzZgCAHis7ERTRnPX5hOWM2M6fNUqWFXO2/vzmqNFUQRRC9zb3M5 FQhVsq71QtRixZd71lIyTSUndaEHEirUEAprAT/7EWa3pjpTG9uT2YfKmdkZqIXDoK+i bQeALjuQ2xxiJVgkAWYdExdp3SRvnZv5C3utBeWWF2NucCOyWPtdfoot40nJMre8/OeI fJpcratEC+RGP5ZtYODb8kNzrphMTbwRiQBcXZjH/UU5ZqP0/PHik0LPzqPGALqgf+Lh vmmA== 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=rGyWkCrlt4Sr1PnNufwhbZso/ieLpkuVth+cKLcZ+WYoe2q8SNfMoli3Y0S4yK/sVC pQ3gALL53VSeOyh4Yim8RHM7qag8vyS6rtY9FBJM9n0fAFTeGwtao79odsnx9LGArBkW D5NSZ0VzBSVHyQBr+CJlf+aC/HfZrsYpA2smr9nW/x/owxWpa4KfmiVMs91CPGaNoVNe vJrGBAbrqP77CvU7Eh6GpA9K6joontlDXzbnn6zb9iT+7b+aZnXO+OaFJECRvpMxED4T ERrPexkkylMNdu3powu1zZBxiTOI4tl0wBQ/PdY9PmK6k8sVf1cg1L0mrhI3XGcVIOUy kIfQ== X-Gm-Message-State: AOAM532KhyYX67lFyfyIU7QG4z4czP3d+tzS5uZydXA2UhljMg+lRRcK Pa/1A0bctE0xcxsDeRlJ6ID81w== X-Received: by 2002:a63:34c5:: with SMTP id b188mr9016112pga.329.1621403132982; Tue, 18 May 2021 22:45:32 -0700 (PDT) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp. [210.141.244.193]) by smtp.gmail.com with ESMTPSA id l10sm13278257pfc.125.2021.05.18.22.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 22:45:32 -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 v4 06/14] mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver Date: Wed, 19 May 2021 14:45:27 +0900 Message-Id: <162140312731.47256.8338760359221463314.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162140306116.47256.6799058439792039400.stgit@localhost> References: <162140306116.47256.6799058439792039400.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), +};