From patchwork Thu Jan 25 10:51:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 125790 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1028363ljf; Thu, 25 Jan 2018 02:56:58 -0800 (PST) X-Google-Smtp-Source: AH8x224cKTLg9BantT4C4whquyfhHlHXqKeHAuf+rm8fXS5BvF0/nub2PmBIik9JhBARnkAXadK/ X-Received: by 10.80.161.5 with SMTP id 5mr29840257edj.65.1516877818595; Thu, 25 Jan 2018 02:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516877818; cv=none; d=google.com; s=arc-20160816; b=k1q3rNZEGQBxmOZc0Kw8a6m3YJEFRIRNW6An5pgjFC/Vyd31I5XYEmc3nBPdDg311B DUtnLg1ley5WM6LXozI7UweofX7rVwC/qHdUjF6s7ji3Hqd7RXbL7aE668trPPnqejYu d0vNfRRQmv8J6Y04PlC2uIxmFtvPL24QT1E2DvtBOe/deCe2yTa1Oz533SaRkquGCZzP KwpEw92Yos0Wu98DH1O62W82NVI20XXq5OfFtoYaFgEeWOqlwv6TiI5xubuu6NvhGbMS qSZqxbhEgTv93PLyTwaG1xwQCkFXD6gM9I1pWYeyENEQeIpA9O/AS2EBn7+y90uKmzc0 YCwg== 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=FEZmWR4WbzNnZB1ZQAjm18wd/QlvkUeYBzxwlPYwDVg=; b=CFuWWOFQHr6ARqtn6ZDZKdO8RLbVmR8W/ZF5j5TiK/lI+oMqUYrLgdjmJuOCKxcqSs OjqR+AdnNP63z95aDcMN6QX2sXEsZos5EKrcfrG6lS3DRN9RJQNjDUFIDlYuOKZic05L mjhYBujc+sI2EI2T55HT5rsohYbpWEXXm7nBgtmCcNwErCy/oCW3XLj0Fz2qwxnlA/3P dTl4hEV4tbG3msiegBDjXtYnOsV+K7HwwGxVbrQ/kJF0ZDXGdofG6WL2onRo+igUGdTq qbUeZoH5CD8BIpITMr9GVh66mhPwo3lH42fBNo1u9pwImgDXr4OeF4DrUwlk8IcitEpD Tj1g== 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=N1QDM0fL; 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 t38si1937267edd.129.2018.01.25.02.56.58; Thu, 25 Jan 2018 02:56:58 -0800 (PST) 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=N1QDM0fL; 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 2A736C223C1; Thu, 25 Jan 2018 10:54:55 +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 2C650C223BE; Thu, 25 Jan 2018 10:52:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 874DFC223B3; Thu, 25 Jan 2018 10:52:14 +0000 (UTC) Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by lists.denx.de (Postfix) with ESMTPS id 07A9FC22380 for ; Thu, 25 Jan 2018 10:52:10 +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 w0PAq9uQ024966; Thu, 25 Jan 2018 04:52:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1516877529; bh=WVAP2M0LOv1ndmzRS13XZgWnqPVhdJopu56g3nnpFgI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=N1QDM0fLwCbRVJOilH0C3zPpiRaE3xZTwTKzMGowZwEWNgNXqBltwS2qWY3VodhkR ouJXQNPlfWK8IEX8JM3d8KZVLzd1xM1CH9SfhC25KPTh1MBYAym8vIlQLyQ9LVrTbm Ty7UZNWis4KG298kmHlFE7HYAwPRbF8WaQeSDbso= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0PAq92w020460; Thu, 25 Jan 2018 04:52:09 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 25 Jan 2018 04:52:08 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 25 Jan 2018 04:52:08 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0PAq8Mo005037; Thu, 25 Jan 2018 04:52:08 -0600 From: Jean-Jacques Hiblot To: , , , Date: Thu, 25 Jan 2018 11:51:35 +0100 Message-ID: <1516877510-14863-10-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516877510-14863-1-git-send-email-jjhiblot@ti.com> References: <1516877510-14863-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 09/24] 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 df3f14c..46c3a04 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -1297,32 +1297,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(dev, 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"))