From patchwork Mon May 10 06:32:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 433037 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2565031jao; Sun, 9 May 2021 23:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjXgzVTBgR7nOPdEKiexQjebQc2X+LRDfkEvFsRXD/wT1PtNdiLgFXan9SL00saVI627sJ X-Received: by 2002:aa7:de99:: with SMTP id j25mr6394574edv.91.1620628345632; Sun, 09 May 2021 23:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620628345; cv=none; d=google.com; s=arc-20160816; b=Hp3sk28ahlqgfk7kvlR73VlgNxjSDNZuOBD76IRqXUg9RFCwPyMO9fzD68zBnMBSrA JHJ9Z0EqJcIWcFdgmRd4WmanH0iig4cUskyWnYtsMDsTG59CkzbvD+8VfSGiJFKCYy6N JgSmXDD48wHXGwtt7IrEGFebi6PjlC67adSIyVq0+eS7agJPvvnF4Iz5MfnN2aLypgkm tM2T5e9NPg5Invrbg+D3RjGEzvWf3tPzNUBATI38QitmO9qze+1lLW0sov4TiVfMn+Pp TSLnHiLpksb2DGl+JoapXktJHslN4/KpdFpSwARRUw8NbXFWoIcwnIsOQwYrAl0f7KNo ooXQ== 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=npvXnpPiP367k1OhBMtAMtri6Gp/DHUlQp4+fs3A9Tk=; b=X2MFNe+/TQj+35FKZlAlNoj1uhqbpbSkZdsNGy6Gce6lSwYEsSaOmLxBc2qVRV4PWk IibkqFsScSb6Zkd1OfNuxijbfODw6/SuxbV3ryEOEmRX7rqRYxtVAhpZFFkaxS+m1dae uU7/1yt3jEvFi8Ic66u/LitCauWfxkf3k185NM5xYPTaUcTvpdb2KZMb2pI0eHFQbMaO Gn/NpQPQ+J/rYcdCa9LlQmSz5QThoz1yFcmSgot5d1b3oWPdgh69cNcyJJ3adYD795ha OHk1Q+yiUEyPvRZenyxj0CgCmtsNvL/2LiT50RTKX9ofTmEw7VKm36vYwfYkYqBSeAm/ iKfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rnCbXnwD; 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 y8si9928882edq.378.2021.05.09.23.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 23:32:25 -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=rnCbXnwD; 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 5F78F82ED4; Mon, 10 May 2021 08:32:19 +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="rnCbXnwD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5BFE782ED4; Mon, 10 May 2021 08:32:18 +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 2048682B71 for ; Mon, 10 May 2021 08:32: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=masami.hiramatsu@linaro.org Received: by mail-pg1-x52c.google.com with SMTP id j12so6502522pgh.7 for ; Sun, 09 May 2021 23:32:15 -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=npvXnpPiP367k1OhBMtAMtri6Gp/DHUlQp4+fs3A9Tk=; b=rnCbXnwDmvorqS3fqStcrI2RN33gEph7nQeZBLXnpjf9lN2jaxMohFWmipXe3Bhv5V oN4N6/APxaSq9OJemz6HCcmDWCFJVNXJumXDKbEMtwHP4ms2juZN8qNO26q3MoTgwcn1 DFi7ke97pVqOUfwYRP749Yz3NKVWhEju+e6Yp5k9tue+Ek8pfETEj2o9DenLd/R/rxo1 EdmW3xfUux+2HRvhAyB4OJAEnG1bF5gzt1OmxTgcux4hbBr+RG4G4HuUxP93mt4VF6EY N7Zb+27DATlVfHGMm1NXHl+brY2cIL2N9bS5BrIAjy61NUPTUrSPbQ0hH2ShT1vwsqRj MCkg== 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=npvXnpPiP367k1OhBMtAMtri6Gp/DHUlQp4+fs3A9Tk=; b=FZUsXMd19j9dULrNbQBaDUA1ACIKZ39GLfjYwhoUF8q9s1u1m8ydEg8F2tVGQORdeX VuRcYJsYvMKAl9mJdGH/8TPsgB6HdcUawZ35FYdHVrARUg9YGm+BL17Tux8xZEkAjStw uWgoxYB0SD7rsL0cAaUvvwgmIohMdbqdqyOm8saMhBiEJevpjsTDMe4S6+dYCW7f4BPM 2KWgSCWvyVGtkw3Ryb0Xf7SQ2Ah0bhKILwe8V1ycCmtSMg0MIy4XBKsHs2r0d52N52cK rb1HfivoThY43yyrUffndkJwWyAec1Zw6mwMz3Cod2XHjLj82TR6HQuazUUG6fgsn+m+ UZhQ== X-Gm-Message-State: AOAM532Yd/1NWFD+Q3Io6YTMJFN591MYwMsSLBHRPgstMf/zfcFYXbnD 3xbK+czrXNGGkpG7x9BXwofUWQ== X-Received: by 2002:a65:640f:: with SMTP id a15mr10795517pgv.251.1620628333680; Sun, 09 May 2021 23:32:13 -0700 (PDT) Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp. [210.141.244.193]) by smtp.gmail.com with ESMTPSA id 187sm10308993pff.139.2021.05.09.23.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 23:32:13 -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 v3 07/14] mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver Date: Mon, 10 May 2021 15:32:08 +0900 Message-Id: <162062832864.501222.1041145417453522338.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162062825393.501222.13616174511857694530.stgit@localhost> References: <162062825393.501222.13616174511857694530.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 --- 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 Reviewed-by: Jaehoon Chung diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f4ad1db45d..026b6f7d24 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -559,6 +559,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), +};