From patchwork Tue Jan 30 15:01:38 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: 126242 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3446294ljd; Tue, 30 Jan 2018 07:10:32 -0800 (PST) X-Google-Smtp-Source: AH8x225PgyymQlaWJII1HJeMfEigvaANYoXkq8xEbuZ9m5ciBn/VSNtRqFJGhEvSMm1zATYj+Ldi X-Received: by 10.80.155.7 with SMTP id o7mr39271708edi.105.1517325032016; Tue, 30 Jan 2018 07:10:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517325032; cv=none; d=google.com; s=arc-20160816; b=K5q7235zDp2N51ndVMI/NwqofTWJ5IOk2CsAUFi73LjJkTlkitf0qWqM0KFh/vlap7 E2oysrimmEP1HF6XY1lZ8kt0ef0nNo2y4dyoskkrj17QPJljOLHFiUqrJ5btoIJwbJTH htPIxwk1Y2a476tc282yUc5ZSRwnpcMVa/A78/K9QQtWzehXpqo+oRWLyb3kI39ilQ/2 c4Jf9wKH4rtKFFqMhfxHw0pnwhf+nwG0NZhwpGT67xqyVk8tOVhb1ILd4PxkjpCM3TlG APu35D3aCHg8T6mZpmyFzUiLK1ZIXJ7lwNTaxUsnlrlr7+laicD+41eHbTb/jx4CczHO g+zA== 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=fuWwZ5uUTnPW9x+RcmUh1uzj/GMWBx0EABcULPGGsxs=; b=cnRKGQqB+U6sl4znV48d6RHWhc/2cqAqdGTkrrPpHbdgP5dCUYXUUD49/mGkWWSQlQ PxBP1a+ej6hicEdnkPWJuHUnlyea4TggNgPZu/LjuF3WsRzYADEUAG8ccOpJim7/ETeM wWx7b8Cf+emDsu+lvtv9mak6mI7ksOZ4J/R8/oGVEbSd9EKxYh7362B1R3s5cUB+A0v8 LKLUAlZCu9g/tAC1sRvf9kGZJ5N3otyX83WFAVDEZfsvLdhPqtsxD0XKl/pQRavZexOS M/yvxNu5X1JEWcWhlYNEfUcV164XIaMD3Fv91OHwALuFAD4VGKVm4QBDD6Ue2lTsv1JV AEYQ== 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=Wu77VS7b; 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 q30si2938155edc.507.2018.01.30.07.10.31; Tue, 30 Jan 2018 07:10:32 -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=Wu77VS7b; 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 A26FAC21ECC; Tue, 30 Jan 2018 15:07: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 DEF79C21E8B; Tue, 30 Jan 2018 15:03:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 690F8C21F2F; Tue, 30 Jan 2018 15:02:15 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id 4B4FDC21E65 for ; Tue, 30 Jan 2018 15:02:11 +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 w0UF29iJ027000; Tue, 30 Jan 2018 09:02:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517324529; bh=7tjTVONYHtg2smG658WepHpaZBiNEu9RJrNRm7jQTgw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Wu77VS7baZKJcLMKDwtnAZiucydQ3tx1EQPP20S3XagTUJs3fualN9/VWpG3hGfyj b+ZGyLGhtEFAKUpH/V+zQ9k2edX5dEpr8oePdtF0TQ1zC9b0OnkhL5TfyOUcm+weAu i20twOYf/GK37B9ntIHOJ6cmWzs8WerrYxizmGQc= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0UF29Bh005081; Tue, 30 Jan 2018 09:02:09 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 30 Jan 2018 09:02:09 -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; Tue, 30 Jan 2018 09:02: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 w0UF28Oc032141; Tue, 30 Jan 2018 09:02:08 -0600 From: Jean-Jacques Hiblot To: , , , Date: Tue, 30 Jan 2018 16:01:38 +0100 Message-ID: <1517324513-13875-10-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1517324513-13875-1-git-send-email-jjhiblot@ti.com> References: <1517324513-13875-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 v3 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 --- Changes in v3: None 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 ab4a095..57548ee 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"))