From patchwork Thu Sep 21 15:22:12 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: 113286 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2170675qgf; Thu, 21 Sep 2017 08:37:44 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBzZjjGzhv84JFTqYUygju5Yuj8im78uwbIUcCnF0folEih4GkBadLidLrjpZuJE66DjBn3 X-Received: by 10.80.163.248 with SMTP id t53mr1619595edb.160.1506008264606; Thu, 21 Sep 2017 08:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506008264; cv=none; d=google.com; s=arc-20160816; b=Rh4egMYZ8b7KNRCheTCJV8vidL3TtZQ0GsGZXzyYs1mSuiU8AcRT1ZK5v9/NuNv9AH FyZACLq/2e6xt7RZ5k9uYSy2+H1NFjDwoyHH06xMQvb89o8AkUgsp0KrMZ7PXx5nlTV/ lDcbOqBNMZgdT6t96PKpmm19c4zsa2pgKCIks1lcAwkjbtF+ifIiDpbxQIVzirpQpizf cv6cSp7IrjCp7Vu0rJhsrY6OXX2J1bg9kdy8wMXAda9SgTQoeYMlWO9ZXUUUy1T84Smy yfVvxK1fkJvoRkydX2RMLwKYLWgyrczCsNeBx9AgT/YMRsUiLDnb3EWye3b+5uIBk1eh xZZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=4nnE567/DzLDdUhTewykEJZz2JKibE9YxXHDuvmUrRY=; b=fBcqRbvCfWIZnHSvapXbv66bnU73ENjz+5G/z+MHIT4lY/HsbaDTFSti8xFyNk4X4W GtwaBr3pRTJvDO/YwNN28c6EiKzfWfNgER4oebGEcBjSRDO0H+eUqtfUFZkN/9IPVc+o 29CViTt6RSnBCIYevcmc0z4O6z8jfyxD5oNhG6kyQ7AdJlh7LZe+EVXKqQjvPSl81jv6 qU0GUjHBzg7EQCyeWhXcyY2iYlj/mj0Bz6pq2cRtAUjpSHeX6LlVmARrXR/r+0LgAYH9 OaOejH4qTzb54o1qAnFv2dysSEkvGCCw3LW32NRSNiFEcROOXk5Guqx/vRkhS72dGiRH M58Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=qvbSVrPQ; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id n17si1495966eda.165.2017.09.21.08.37.44; Thu, 21 Sep 2017 08:37:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=qvbSVrPQ; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 3261EC220D0; Thu, 21 Sep 2017 15:29:53 +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 B5760C220A7; Thu, 21 Sep 2017 15:29:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4D8B2C220B2; Thu, 21 Sep 2017 15:24:03 +0000 (UTC) Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by lists.denx.de (Postfix) with ESMTPS id 6A6E6C2209A for ; Thu, 21 Sep 2017 15:23:58 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8LFMuJp009145; Thu, 21 Sep 2017 10:22:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1506007376; bh=HW6K30WwGce274dn/NrhbWe1bpu3ys9vi+h7e446rOI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qvbSVrPQdf9BAoy7Jj2KaZILTQCJ/SMGmYA7JJqZFDBhhGW+Rcby8+8ZFmlUBJNbZ Opi/N7Fe8EnaRKPKL6Lq7yrl6JTEUa4Iu42534QipFojRC8wWH5mfx92jofZ67kq0a jpLOxTsxQnNeaB+xwfu/aBd8u0UUiYXPyX53rutQ= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8LFMpvd000341; Thu, 21 Sep 2017 10:22:51 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) 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; Thu, 21 Sep 2017 10:22:51 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Thu, 21 Sep 2017 10:22:50 -0500 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 v8LFMoZY001081; Thu, 21 Sep 2017 10:22:50 -0500 From: Jean-Jacques Hiblot To: , , , , Date: Thu, 21 Sep 2017 17:22:12 +0200 Message-ID: <1506007346-10037-10-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506007346-10037-1-git-send-email-jjhiblot@ti.com> References: <1506007346-10037-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 09/23] mmc: omap_hsmmc: use mmc_of_parse to populate mmc_config 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" From: Kishon Vijay Abraham I Use the mmc_of_parse library function to populate mmc_config instead of repeating the same code in host controller driver. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Jean-Jacques Hiblot --- drivers/mmc/omap_hsmmc.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 116aa31..734854b 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -1291,32 +1291,18 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev) struct mmc_config *cfg = &plat->cfg; const void *fdt = gd->fdt_blob; int node = dev_of_offset(dev); - int val; + int ret; plat->base_addr = map_physmem(devfdt_get_addr(dev), sizeof(struct hsmmc *), MAP_NOCACHE); - cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS; - val = fdtdec_get_int(fdt, node, "bus-width", -1); - if (val < 0) { - printf("error: bus-width property missing\n"); - return -ENOENT; - } - - switch (val) { - case 0x8: - cfg->host_caps |= MMC_MODE_8BIT; - case 0x4: - cfg->host_caps |= MMC_MODE_4BIT; - break; - default: - printf("error: invalid bus-width property\n"); - return -ENOENT; - } + ret = mmc_of_parse(fdt, node, cfg); + if (ret < 0) + return ret; + cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS; cfg->f_min = 400000; - cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000); cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT; if (fdtdec_get_bool(fdt, node, "ti,dual-volt"))