From patchwork Fri Jun 26 02:06:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "s-tokumoto@fujitsu.com" X-Patchwork-Id: 1317304 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=fujitsu.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49tKyH6ZQCz9sQx for ; Fri, 26 Jun 2020 12:07:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 99665812FF; Fri, 26 Jun 2020 04:06:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id AD783813A9; Fri, 26 Jun 2020 04:06:56 +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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mgwkm02.jp.fujitsu.com (mgwkm02.jp.fujitsu.com [202.219.69.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE30F81009 for ; Fri, 26 Jun 2020 04:06:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=s-tokumoto@fujitsu.com Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm02.jp.fujitsu.com with smtp id 64f9_2fe4_ea341be6_ffe5_41e5_bc2d_b4a920677a92; Fri, 26 Jun 2020 11:06:36 +0900 Received: from durio.utsfd.cs.fujitsu.co.jp (durio.utsfd.cs.fujitsu.co.jp [10.24.20.112]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 5350AAC009A for ; Fri, 26 Jun 2020 11:06:35 +0900 (JST) Received: by durio.utsfd.cs.fujitsu.co.jp (Postfix, from userid 1002) id D16AC1FF1ED; Fri, 26 Jun 2020 11:06:34 +0900 (JST) From: Shunsuke Tokumoto To: peng.fan@nxp.com Cc: u-boot@lists.denx.de, Shunsuke Tokumoto , Yasushi Iida Subject: [PATCH] mmc: Parse new binding for eMMC fixed driver type Date: Fri, 26 Jun 2020 11:06:24 +0900 Message-Id: <20200626020624.31588-1-s-tokumoto@fujitsu.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Parse the new binding and store it in the mmc config struct after doing some sanity checks. The code is designed to support fixed mmc driver type if we ever need that. Signed-off-by: Shunsuke Tokumoto Signed-off-by: Yasushi Iida --- drivers/mmc/mmc-uclass.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/mmc.c | 8 ++++++++ include/mmc.h | 3 +++ 3 files changed, 41 insertions(+) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index c5b7872900..e67aae451f 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -162,6 +162,36 @@ int dm_mmc_deferred_probe(struct udevice *dev) if (ops->deferred_probe) return ops->deferred_probe(dev); + /* Check eMMC driver type selection */ + val = dev_read_u32_default(dev, "fixed-emmc-driver-type", 0); + if (val > 4) { + puts("\"fixed-emmc-driver-type\" is illegal. force to 0.\n"); + val = 0; + } + cfg->driver_type = val; + + val = dev_read_u32_default(dev, + "fixed-emmc-driver-type-hs200", + -ENOENT); + if (val != -ENOENT) { + if (val > 4) { + puts("\"fixed-emmc-driver-type-hs200\" is illegal.\n"); + val = 0; + } + } + cfg->driver_type_hs200 = val; + + val = dev_read_u32_default(dev, + "fixed-emmc-driver-type-hs400", + -ENOENT); + if (val != -ENOENT) { + if (val > 4) { + puts("\"fixed-emmc-driver-type-hs400\" is illegal.\n"); + val = 0; + } + } + cfg->driver_type_hs400 = val; + return 0; } diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 620bb93064..8241be9996 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -849,11 +849,19 @@ static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode, #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) case MMC_HS_200: speed_bits = EXT_CSD_TIMING_HS200; + if (mmc->cfg->driver_type_hs200 != -ENOENT) + speed_bits |= (mmc->cfg->driver_type_hs200 << 4); + else + speed_bits |= (mmc->cfg->driver_type << 4); break; #endif #if CONFIG_IS_ENABLED(MMC_HS400_SUPPORT) case MMC_HS_400: speed_bits = EXT_CSD_TIMING_HS400; + if (mmc->cfg->driver_type_hs400 != -ENOENT) + speed_bits |= (mmc->cfg->driver_type_hs400 << 4); + else + speed_bits |= (mmc->cfg->driver_type << 4); break; #endif #if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT) diff --git a/include/mmc.h b/include/mmc.h index 82562193cc..8d79ff5cbe 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -555,6 +555,9 @@ struct mmc_config { uint f_max; uint b_max; unsigned char part_type; + uint driver_type; + uint driver_type_hs200; + uint driver_type_hs400; }; struct sd_ssr {