From patchwork Mon Nov 27 09:59:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 841561 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="h6nr+tPr"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ylj7F68lsz9s9Y for ; Mon, 27 Nov 2017 21:03:53 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 808F3C21E0F; Mon, 27 Nov 2017 10:01:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 81628C21DEF; Mon, 27 Nov 2017 10:00:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16FE2C21DE8; Mon, 27 Nov 2017 09:59:29 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id 1D952C21DE4 for ; Mon, 27 Nov 2017 09:59:28 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAR9xQfZ030642; Mon, 27 Nov 2017 03:59:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511776766; bh=Uq/FRCSGHjvE4zzRM2ZQeBYs3WMpEB9rkciczDDD7VQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=h6nr+tPr0QlKKtf8zH7LdRK658tp8GLUvQL9U+XpNYi7kxCJUqGMobfFC2uBIEJoq yZQBwS6A3RnVZSNsCcGBcub/NdlBwRLTiZ/Lak11joQt2QNzy/JRcoNukYbHHSlf5b qZBZd2oyO2QDQVeFBFirq6KLGjOFX5/NigQVmgYg= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xQaK007255; Mon, 27 Nov 2017 03:59:26 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Mon, 27 Nov 2017 03:59:26 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Mon, 27 Nov 2017 03:59:26 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xPgL019603; Mon, 27 Nov 2017 03:59:25 -0600 From: Jean-Jacques Hiblot To: , , , , , Date: Mon, 27 Nov 2017 10:59:03 +0100 Message-ID: <1511776746-2957-2-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> References: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH v2 1/4] dm: mmc: update mmc_of_parse() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" * convert to livetree API * don't fail because of an invalid bus-width, instead default to 1-bit. * recognize 1.2v DDR and 1.2v HS200 flags Signed-off-by: Jean-Jacques Hiblot --- changes since v1: * convert to livetree * squashed all change to mmc_of_parse into this single commit * Add a descriptive comment fo mmc_of_parse in the header drivers/mmc/mmc-uclass.c | 37 ++++++++++++++++++++++--------------- include/mmc.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index e30cde7..f117923 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "mmc_private.h" @@ -120,11 +121,12 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode) return dm_mmc_execute_tuning(mmc->dev, opcode); } -int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg) +int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) { int val; + ofnode ref = dev_ofnode(dev); - val = fdtdec_get_int(fdt, node, "bus-width", 1); + val = ofnode_read_u32_default(ref, "bus-width", 1); switch (val) { case 0x8: @@ -137,30 +139,35 @@ int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg) cfg->host_caps |= MMC_MODE_1BIT; break; default: - printf("error: %s invalid bus-width property %d\n", - fdt_get_name(fdt, node, NULL), val); - return -ENOENT; + debug("warning: %s invalid bus-width property. using 1-bit\n", + ofnode_get_name(ref)); + cfg->host_caps |= MMC_MODE_1BIT; + break; } - cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000); + cfg->f_max = ofnode_read_u32_default(ref, "max-frequency", 52000000); - if (fdtdec_get_bool(fdt, node, "cap-sd-highspeed")) + if (ofnode_read_bool(ref, "cap-sd-highspeed")) cfg->host_caps |= MMC_CAP(SD_HS); - if (fdtdec_get_bool(fdt, node, "cap-mmc-highspeed")) + if (ofnode_read_bool(ref, "cap-mmc-highspeed")) cfg->host_caps |= MMC_CAP(MMC_HS); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr12")) + if (ofnode_read_bool(ref, "sd-uhs-sdr12")) cfg->host_caps |= MMC_CAP(UHS_SDR12); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr25")) + if (ofnode_read_bool(ref, "sd-uhs-sdr25")) cfg->host_caps |= MMC_CAP(UHS_SDR25); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr50")) + if (ofnode_read_bool(ref, "sd-uhs-sdr50")) cfg->host_caps |= MMC_CAP(UHS_SDR50); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr104")) + if (ofnode_read_bool(ref, "sd-uhs-sdr104")) cfg->host_caps |= MMC_CAP(UHS_SDR104); - if (fdtdec_get_bool(fdt, node, "sd-uhs-ddr50")) + if (ofnode_read_bool(ref, "sd-uhs-ddr50")) cfg->host_caps |= MMC_CAP(UHS_DDR50); - if (fdtdec_get_bool(fdt, node, "mmc-ddr-1_8v")) + if (ofnode_read_bool(ref, "mmc-ddr-1_8v")) cfg->host_caps |= MMC_CAP(MMC_DDR_52); - if (fdtdec_get_bool(fdt, node, "mmc-hs200-1_8v")) + if (ofnode_read_bool(ref, "mmc-ddr-1_2v")) + cfg->host_caps |= MMC_CAP(MMC_DDR_52); + if (ofnode_read_bool(ref, "mmc-hs200-1_8v")) + cfg->host_caps |= MMC_CAP(MMC_HS_200); + if (ofnode_read_bool(ref, "mmc-hs200-1_2v")) cfg->host_caps |= MMC_CAP(MMC_HS_200); return 0; diff --git a/include/mmc.h b/include/mmc.h index 6230a32..e3f777f 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -651,7 +651,16 @@ int mmc_unbind(struct udevice *dev); int mmc_initialize(bd_t *bis); int mmc_init(struct mmc *mmc); int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error); -int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg); + +/** + * mmc_of_parse() - Parse the device tree to get the capabilities of the host + * + * @dev: MMC device + * @cfg: MMC configuration + * @return 0 if OK, -ve on error + */ +int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg); + int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size); /** From patchwork Mon Nov 27 09:59:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 841560 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="CkOcnpcP"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ylj6c1vmjz9s9Y for ; Mon, 27 Nov 2017 21:03:20 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id EDF8AC21DA2; Mon, 27 Nov 2017 10:01:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 121BEC21DB2; Mon, 27 Nov 2017 10:00:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40F75C21DC4; Mon, 27 Nov 2017 09:59:30 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id E3883C21DE4 for ; Mon, 27 Nov 2017 09:59:29 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAR9xRqT014560; Mon, 27 Nov 2017 03:59:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511776767; bh=wM4nUHchybR+KnhEi5Wsr9bXveBku3TpdaATMH1ofZU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CkOcnpcP/YuGGGFOQ0PhdYUl6Uq1htxRA1jKnsZ7S7pJH377aZiBs9ofJcMypJ9U9 WJOeIFW2wGDGje3/O6DXIrBzIqkLyAjLzmFEl0zyWKNW3jxSrg7KhjAnaJs9CfuFLu AzT9VvG9beVRN8nRRl+O7HtKxsWIpjbtwfYYMFf8= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xRQC007312; Mon, 27 Nov 2017 03:59:27 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Mon, 27 Nov 2017 03:59:27 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Mon, 27 Nov 2017 03:59:27 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xQNZ001938; Mon, 27 Nov 2017 03:59:27 -0600 From: Jean-Jacques Hiblot To: , , , , , Date: Mon, 27 Nov 2017 10:59:04 +0100 Message-ID: <1511776746-2957-3-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> References: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH v2 2/4] mmc: dump card and host capabilities if debug is enabled X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" This is a useful information while debugging the initialization process or performance issues. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Lukasz Majewski --- no change since v1 drivers/mmc/mmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index a5a521e..a30b6a2 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1502,6 +1502,10 @@ void mmc_dump_capabilities(const char *text, uint caps) printf("%s, ", mmc_mode_name(mode)); printf("\b\b]\n"); } +#else +void mmc_dump_capabilities(const char *text, uint caps) +{ +} #endif struct mode_width_tuning { @@ -1582,6 +1586,8 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) bool uhs_en = (mmc->ocr & OCR_S18R) ? true : false; uint caps; + mmc_dump_capabilities("sd card", card_caps); + mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); /* Restrict card's capabilities by what the host can do */ caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT); @@ -1764,6 +1770,9 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) const struct mode_width_tuning *mwt; const struct ext_csd_bus_width *ecbw; + mmc_dump_capabilities("mmc", card_caps); + mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); + /* Restrict card's capabilities by what the host can do */ card_caps &= (mmc->host_caps | MMC_MODE_1BIT); From patchwork Mon Nov 27 09:59:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 841557 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="XSFw/mho"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ylj3L004Nz9s9Y for ; Mon, 27 Nov 2017 21:00:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A5007C21D79; Mon, 27 Nov 2017 10:00:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EFA29C21DB2; Mon, 27 Nov 2017 10:00:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1DB2BC21D79; Mon, 27 Nov 2017 09:59:31 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id CC86AC21DF7 for ; Mon, 27 Nov 2017 09:59:30 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAR9xTAU030646; Mon, 27 Nov 2017 03:59:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511776769; bh=P2Ivc2FM4WDKLW6ANoUU9cvK+ft7YYLftxnDpGRcn1s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XSFw/mhovvgTRBnLmYffkWl5ajALkP9ASqfeY2U3bD8lQLhpkmfCvDu+5oZqk2tUA lxzzUThpCL393wHslUtfX6o2QNj7h1piQ0nXV00clSwVxahVhTQCQbe+A2FeyzWxvf kZVxUkFwfIv4AU05ojfnZbWvuVXF+kRoFopvMhNM= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xSG7007342; Mon, 27 Nov 2017 03:59:28 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Mon, 27 Nov 2017 03:59:28 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Mon, 27 Nov 2017 03:59:28 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xR7O031547; Mon, 27 Nov 2017 03:59:28 -0600 From: Jean-Jacques Hiblot To: , , , , , Date: Mon, 27 Nov 2017 10:59:05 +0100 Message-ID: <1511776746-2957-4-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> References: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH v2 3/4] mmc: Fixed a problem with old sd or mmc that do not support High speed X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" As the legacy modes were not added to the list of supported modes, old cards that do not support other modes could not be used. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass --- no change since v1 drivers/mmc/mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index a30b6a2..67f21ff 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -818,7 +818,7 @@ static int mmc_get_capabilities(struct mmc *mmc) u8 *ext_csd = mmc->ext_csd; char cardtype; - mmc->card_caps = MMC_MODE_1BIT; + mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(MMC_LEGACY); if (mmc_host_is_spi(mmc)) return 0; @@ -1171,7 +1171,7 @@ static int sd_get_capabilities(struct mmc *mmc) int timeout; u32 sd3_bus_mode; - mmc->card_caps = MMC_MODE_1BIT; + mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(SD_LEGACY); if (mmc_host_is_spi(mmc)) return 0; From patchwork Mon Nov 27 09:59:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 841559 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="wIIs0fdq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ylj5w69fwz9s9Y for ; Mon, 27 Nov 2017 21:02:44 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 94561C21DA1; Mon, 27 Nov 2017 10:00:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id AC5B0C21D76; Mon, 27 Nov 2017 10:00:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9D86DC21D95; Mon, 27 Nov 2017 09:59:32 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id 0F7C6C21DB2 for ; Mon, 27 Nov 2017 09:59:31 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAR9xUaZ014568; Mon, 27 Nov 2017 03:59:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511776770; bh=kFVx+aQ2zSYXsfReN1gVzXX3ZquwgPys5T7nRWJU9gQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wIIs0fdqNVYgtb70Zc3lsfGZmlsJFlKTBt6SeCNePOZfFQm6KkXP5UrCEBF4vBfgB ZanHJUy/wrTstVwN+3msYcI8e7Z70ldsGBFo81KbGFX3Y3jhnovxGGIcT/55LP3GQh hLYiLtQg4NHQ9G5LdLJCRoqdsnQBg89Kw/tAb2s0= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xUoc016050; Mon, 27 Nov 2017 03:59:30 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Mon, 27 Nov 2017 03:59:29 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Mon, 27 Nov 2017 03:59:29 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAR9xTeb001978; Mon, 27 Nov 2017 03:59:29 -0600 From: Jean-Jacques Hiblot To: , , , , , Date: Mon, 27 Nov 2017 10:59:06 +0100 Message-ID: <1511776746-2957-5-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> References: <1511776746-2957-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH v2 4/4] mmc: all hosts support 1-bit bus width and legacy timings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Make sure that those basic capabilities are advertised by the host. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass --- no change since v1 drivers/mmc/mmc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 67f21ff..ec1dc49 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1587,10 +1587,10 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) uint caps; mmc_dump_capabilities("sd card", card_caps); - mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); + mmc_dump_capabilities("host", mmc->host_caps); /* Restrict card's capabilities by what the host can do */ - caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT); + caps = card_caps & mmc->host_caps; if (!uhs_en) caps &= ~UHS_CAPS; @@ -1771,10 +1771,10 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) const struct ext_csd_bus_width *ecbw; mmc_dump_capabilities("mmc", card_caps); - mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); + mmc_dump_capabilities("host", mmc->host_caps); /* Restrict card's capabilities by what the host can do */ - card_caps &= (mmc->host_caps | MMC_MODE_1BIT); + card_caps &= mmc->host_caps; /* Only version 4 of MMC supports wider bus widths */ if (mmc->version < MMC_VERSION_4) @@ -2389,7 +2389,12 @@ int mmc_start_init(struct mmc *mmc) bool uhs_en = supports_uhs(mmc->cfg->host_caps); int err; - mmc->host_caps = mmc->cfg->host_caps; + /* + * all hosts are capable of 1 bit bus-width and able to use the legacy + * timings. + */ + mmc->host_caps = mmc->cfg->host_caps | MMC_CAP(SD_LEGACY) | + MMC_CAP(MMC_LEGACY) | MMC_MODE_1BIT; /* we pretend there's no card when init is NULL */ no_card = mmc_getcd(mmc) == 0;