{"id":816912,"url":"http://patchwork.ozlabs.org/api/patches/816912/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-5-git-send-email-jjhiblot@ti.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1506004213-22620-5-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-21T14:29:51","name":"[U-Boot,v2,04/26] mmc: make ext_csd part of struct mmc","commit_ref":"dfda9d88e5062620952956f7ed8e2a31ceffa6e6","pull_url":null,"state":"accepted","archived":false,"hash":"c2bc2de3efc319e6735228a7f07622e081f3b98a","submitter":{"id":70508,"url":"http://patchwork.ozlabs.org/api/people/70508/?format=json","name":"Jean-Jacques Hiblot","email":"jjhiblot@ti.com"},"delegate":{"id":12423,"url":"http://patchwork.ozlabs.org/api/users/12423/?format=json","username":"Jaehoon","first_name":"Jaehoon","last_name":"Chung","email":"jh80.chung@samsung.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1506004213-22620-5-git-send-email-jjhiblot@ti.com/mbox/","series":[{"id":4400,"url":"http://patchwork.ozlabs.org/api/series/4400/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=4400","date":"2017-09-21T14:29:47","name":"mmc: Add support for HS200 and UHS modes","version":2,"mbox":"http://patchwork.ozlabs.org/series/4400/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816912/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816912/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"VEVmiCg9\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyfVG0lYpz9t3C\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 00:43:02 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid B8E44C2202E; Thu, 21 Sep 2017 14:35:45 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 61597C2201C;\n\tThu, 21 Sep 2017 14:32:46 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9A32EC2203A; Thu, 21 Sep 2017 14:31:42 +0000 (UTC)","from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16])\n\tby lists.denx.de (Postfix) with ESMTPS id 4407CC21DE8\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 14:31:35 +0000 (UTC)","from dlelxv90.itg.ti.com ([172.17.2.17])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LEUW6d032420; \n\tThu, 21 Sep 2017 09:30:32 -0500","from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31])\n\tby dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEURtZ019560; \n\tThu, 21 Sep 2017 09:30:27 -0500","from DLEE106.ent.ti.com (157.170.170.36) by DLEE101.ent.ti.com\n\t(157.170.170.31) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tThu, 21 Sep 2017 09:30:28 -0500","from dflp33.itg.ti.com (10.64.6.16) by DLEE106.ent.ti.com\n\t(157.170.170.36) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Thu, 21 Sep 2017 09:30:27 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LEUQi3000696;\n\tThu, 21 Sep 2017 09:30:26 -0500"],"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,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1506004233;\n\tbh=uAGW7fWcXAWrq2QMuAKXva78IhLFjZr11jkC0KA8v4Y=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=VEVmiCg9g7ym6kfrNqteSzCYZxgCcsaLTVNk8o8yFkNQ5kdQ+9OYM+O1YeLOyObmA\n\tMcHrRL4u83PT2X/6KdBmJeS39cWPyeHSOkuhj8fxnV6N8Gnq0HrF3xwnSmg06djAmc\n\taUvrnivu3OiRzF5jhY/nFh7VtOOew8mPUjj9rR4k=","From":"Jean-Jacques Hiblot <jjhiblot@ti.com>","To":"<jh80.chung@samsung.com>, <trini@konsulko.com>, <kishon@ti.com>,\n\t<sjg@chromium.org>","Date":"Thu, 21 Sep 2017 16:29:51 +0200","Message-ID":"<1506004213-22620-5-git-send-email-jjhiblot@ti.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1506004213-22620-1-git-send-email-jjhiblot@ti.com>","References":"<1506004213-22620-1-git-send-email-jjhiblot@ti.com>","MIME-Version":"1.0","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","Cc":"u-boot@lists.denx.de","Subject":"[U-Boot] [PATCH v2 04/26] mmc: make ext_csd part of struct mmc","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"The ext csd is used for comparison many times. Keep a reference content\nof the ext csd in the struct mmc to avoid reading multiple times\n\nSigned-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n drivers/mmc/mmc.c | 22 +++++++++++++++++-----\n include/mmc.h     |  1 +\n 2 files changed, 18 insertions(+), 5 deletions(-)","diff":"diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c\nindex 7c100a4..cfdfd8d 100644\n--- a/drivers/mmc/mmc.c\n+++ b/drivers/mmc/mmc.c\n@@ -1146,9 +1146,10 @@ static int sd_select_bus_freq_width(struct mmc *mmc)\n \treturn 0;\n }\n \n-static int mmc_select_bus_freq_width(struct mmc *mmc, const u8 *ext_csd)\n+static int mmc_select_bus_freq_width(struct mmc *mmc)\n {\n \tALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);\n+\tconst u8 *ext_csd = mmc->ext_csd;\n \t/* An array of possible bus widths in order of preference */\n \tstatic const unsigned int ext_csd_bits[] = {\n \t\tEXT_CSD_DDR_BUS_WIDTH_8,\n@@ -1184,6 +1185,11 @@ static int mmc_select_bus_freq_width(struct mmc *mmc, const u8 *ext_csd)\n \tif (mmc->version < MMC_VERSION_4)\n \t\treturn 0;\n \n+\tif (!mmc->ext_csd) {\n+\t\tdebug(\"No ext_csd found!\\n\"); /* this should enver happen */\n+\t\treturn -ENOTSUPP;\n+\t}\n+\n \tfor (idx = 0; idx < ARRAY_SIZE(ext_csd_bits); idx++) {\n \t\tunsigned int extw = ext_csd_bits[idx];\n \t\tunsigned int caps = ext_to_hostcaps[extw];\n@@ -1249,16 +1255,23 @@ static int mmc_select_bus_freq_width(struct mmc *mmc, const u8 *ext_csd)\n \treturn err;\n }\n \n-static int mmc_startup_v4(struct mmc *mmc, u8 *ext_csd)\n+static int mmc_startup_v4(struct mmc *mmc)\n {\n \tint err, i;\n \tu64 capacity;\n \tbool has_parts = false;\n \tbool part_completed;\n+\tu8 *ext_csd;\n \n \tif (IS_SD(mmc) || (mmc->version < MMC_VERSION_4))\n \t\treturn 0;\n \n+\text_csd = malloc_cache_aligned(MMC_MAX_BLOCK_LEN);\n+\tif (!ext_csd)\n+\t\treturn -ENOMEM;\n+\n+\tmmc->ext_csd = ext_csd;\n+\n \t/* check  ext_csd version and capacity */\n \terr = mmc_send_ext_csd(mmc, ext_csd);\n \tif (err)\n@@ -1418,7 +1431,6 @@ static int mmc_startup(struct mmc *mmc)\n \tuint mult, freq;\n \tu64 cmult, csize;\n \tstruct mmc_cmd cmd;\n-\tALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);\n \tstruct blk_desc *bdesc;\n \n #ifdef CONFIG_MMC_SPI_CRC_ON\n@@ -1567,7 +1579,7 @@ static int mmc_startup(struct mmc *mmc)\n \tmmc->erase_grp_size = 1;\n \tmmc->part_config = MMCPART_NOAVAILABLE;\n \n-\terr = mmc_startup_v4(mmc, ext_csd);\n+\terr = mmc_startup_v4(mmc);\n \tif (err)\n \t\treturn err;\n \n@@ -1578,7 +1590,7 @@ static int mmc_startup(struct mmc *mmc)\n \tif (IS_SD(mmc))\n \t\terr = sd_select_bus_freq_width(mmc);\n \telse\n-\t\terr = mmc_select_bus_freq_width(mmc, ext_csd);\n+\t\terr = mmc_select_bus_freq_width(mmc);\n \n \tif (err)\n \t\treturn err;\ndiff --git a/include/mmc.h b/include/mmc.h\nindex 188dc74..7d2b363 100644\n--- a/include/mmc.h\n+++ b/include/mmc.h\n@@ -462,6 +462,7 @@ struct mmc {\n \tstruct udevice *vqmmc_supply;\t/* IO voltage regulator (Vccq)*/\n #endif\n #endif\n+\tu8 *ext_csd;\n };\n \n struct mmc_hwpart_conf {\n","prefixes":["U-Boot","v2","04/26"]}