From patchwork Fri Apr 16 23:38:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 422680 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6d12:0:0:0:0 with SMTP id m18csp845723ejr; Fri, 16 Apr 2021 16:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFz5qYEOn3av0CQtT8wvJ52a1iPoqEQPfMIp6U9+qecRmtw/wCBrlUxVMfw3eKJpvfb8Yb X-Received: by 2002:a17:906:5248:: with SMTP id y8mr10480064ejm.150.1618616348489; Fri, 16 Apr 2021 16:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618616348; cv=none; d=google.com; s=arc-20160816; b=EyZntt+ZaJDKm8VgEGWDzQU1t4XaZjmnqJiQYryaUfrDfZFKluETic75NDbpx6Rnff M2TYMFBZ0JdfW77FTXCKcAggNl9U/BvMBfG9W+/5um1JtFG00Y5dj3wlOgBO2ZKFbC4J I1Ne++sz8krddDu/2jxbyj7jlgWnVCapLHDcM0rQa3z46xQ2ufkYQN//X5hsdFeZtcUY srPMw+Y51qKdPYiqugNCBMSDB1fwglkK5E5CyEC3whqyRrWjbYvyjiLpXe4Bm/BwxxiN +P49QiqdbiZ7iO1GbzPDEqKWZOSiGvsXQ9b5IHL2VyHd3E0Mc0ywybocQkpE/n52DWIP csMw== 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=H710/IYshieaDk0UbdQcUaaaAK7rfhZLOh9TaLcdb9s=; b=LjoefnH1s7gETrNEMs4pOgoER2aiHTPpa3YQyAxCG3nQFNAMcuQ2tbn2sNyxx+cEf2 b3WM2NXvvx6sqhTW/RV0RvQ66uj4b08GE8TFveneL7q1C6Rs/BQlvzJ/TMF8u2Ieaiqv Y2luysZFDzHuC7kSMVjaNzv77a09j1H7KJ5lWJKl/h9x5KWflo1CLsBWqwqyxZwzJWUW IaYRn3rJpb9KfUk5rNIvK6qeaisTdvNA94EtN/sVZ8AuRA2it3g15dr5D4aFBa/2uMlO voAgjUO3z9lSA6lZHqPlX0K/8zV8xanHqUsFzzaDp/r0PnfxXsjOAGRgr1nVfrLCEowf BamA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BGUjmge/"; 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 hr29si3422435ejc.136.2021.04.16.16.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 16:39:08 -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="BGUjmge/"; 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 EBD2E82015; Sat, 17 Apr 2021 01:38:54 +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="BGUjmge/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2247E82046; Sat, 17 Apr 2021 01:38: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-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (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 A256D80EEF for ; Sat, 17 Apr 2021 01:38:32 +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-x1032.google.com with SMTP id b8-20020a17090a5508b029014d0fbe9b64so17213367pji.5 for ; Fri, 16 Apr 2021 16:38:32 -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=H710/IYshieaDk0UbdQcUaaaAK7rfhZLOh9TaLcdb9s=; b=BGUjmge/7NvtP2eep1wRU1GKxnCEb+JuMMybjx77f8pbaHdXgGN9yLUhXB3PqdqU4b 5QJPXeNSDo2IqBYTam2HWyrjmAoUl8owz+2r6p6t/OsZa0dfNJugdk991rAtollj1Qyv iAvMehPlbRHa1WKjIN212hxKayW4Mvi0Lm64M4vChshFPkxTCX+TcgDzDMJ2SzI0EYwy l+G74ndwZPwBLD5JYJEGieyY2CEi0snZn4KcmQpCHeI/iH1BsCRHSsYz6mIh2QlYP3aI jkP4aXIx/Ug91ExcUh4biOiKoOjEQs3YVDTmaDAPfXez8KGQ7udo+rpXVwtMtfrCTxyE Z7/g== 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=H710/IYshieaDk0UbdQcUaaaAK7rfhZLOh9TaLcdb9s=; b=IqlJaOqZDRTSnsGdu2oNreK7VhdpP1d+teq4mxEhBVO3wveS7jaBBO2AYnPbC3eHQS qwr9agBLoHGKPhDuBlvwInuZaX/vXhS96uT46IXPhlWcIGprywPhM32cdukTZ6uWA9RH qMDhdwO1jwF7g6Mk7sMVNd7/zz+Yw8DgCuFzwOdVhiwng+T3wWgboh9oW3TPjPw8WpFM L1mRYxgmyiFTea+QrZHs9NnaXQmdnV/0ASfvanwSCQjsMEdJLlNnsgw7gxFOq0kZ4F/F 63QP03DV5sfAfBSf+De8PtymPI6a54klFm/wF3n0Nq6ouAuI8qsCnS8fplKktLXNh/L6 s1fg== X-Gm-Message-State: AOAM531Blf3L3L4MDGzLOCDeJVmjNyjupNWOa7yGZmTigcLYmSh2P4j4 cJo2iKfU3tigbn0z1jhWggOnJw== X-Received: by 2002:a17:902:db11:b029:ec:3c25:d53a with SMTP id m17-20020a170902db11b02900ec3c25d53amr7148672plx.74.1618616311107; Fri, 16 Apr 2021 16:38:31 -0700 (PDT) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp. [210.141.244.193]) by smtp.gmail.com with ESMTPSA id x1sm5693387pfj.209.2021.04.16.16.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 16:38:30 -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 Subject: [PATCH v2 07/13] mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver Date: Sat, 17 Apr 2021 08:38:26 +0900 Message-Id: <161861630583.298230.7570622190142671460.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <161861622792.298230.15803163505976731363.stgit@localhost> References: <161861622792.298230.15803163505976731363.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 --- drivers/mmc/Kconfig | 10 ++++++ drivers/mmc/Makefile | 1 + drivers/mmc/f_sdh30.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ drivers/mmc/sdhci.c | 9 +++++ 4 files changed, 101 insertions(+) create mode 100644 drivers/mmc/f_sdh30.c diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f8ca52efb6..a9ae419e41 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -549,6 +549,16 @@ config MMC_SDHCI_IPROC If unsure, say N. +config F_SDH30_SDHCI + 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..b48a76ba94 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_F_SDH30_SDHCI) += f_sdh30.o diff --git a/drivers/mmc/f_sdh30.c b/drivers/mmc/f_sdh30.c new file mode 100644 index 0000000000..44c6521bfe --- /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_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_probe, + .priv_auto = sizeof(struct sdhci_host), + .plat_auto = sizeof(struct f_sdh30_plat), +}; diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index d9ab6a0a83..f038debc6c 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -708,6 +708,15 @@ static int sdhci_init(struct mmc *mmc) sdhci_set_power(host, fls(mmc->cfg->voltages) - 1); + if (IS_ENABLED(CONFIG_F_SDH30_SDHCI)) { + /* + * Reference to Part1 Physical Layer Simplified Specification + * Ver 3.01, 6.4.1 Power Up + * This delay must be at least 74 clock sizes, or 1 ms. + */ + udelay(1000); + } + if (host->ops && host->ops->get_cd) host->ops->get_cd(host);