From patchwork Thu Jan 25 10:51:28 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: 125785 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1026264ljf; Thu, 25 Jan 2018 02:52:13 -0800 (PST) X-Google-Smtp-Source: AH8x2270gIuF9RMhes3BhKWUqXpWfdDrVFslYfU0E2RIOdO16vaIULYy3znX9+qBw3YxIG3SEHK3 X-Received: by 10.80.170.61 with SMTP id o58mr17050141edc.142.1516877533609; Thu, 25 Jan 2018 02:52:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516877533; cv=none; d=google.com; s=arc-20160816; b=e6Vepj+C8GDxVFbGXY6yU/oKWkGRXOC231R8MElsu+y6rlTvCyV8azKyYJtA4pj2q5 +9MOM+VQprboxzB1jwP9YS+TM78FJB34BvRgqubCjJolFapN9WUVknJ2uUrCrvkMKHbX JmZEtxlH3ia+u52xgctAvCwizcsLhiDpLbE3F+PdRUDcVTiPDgmi4Uj4nA7pwsVBGOwj yrvOUJuTPbPyay2y/v5QhuXnFcI2WhEuDMNeeN2voLp8hiAhowh6CwAa3x+4/i//A+dt iPmPYrdlLOsFaUFBScNiIZMynMXvn30HcVSw0DDqbr7vuPspDL1d1K9hVJNuXOLVp7M7 7tfw== 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=jw6JZCtLk65H7kEGR8pkBlhhicV7SwPdCrwH004J19I=; b=HN8vacQFoOk2qf7IlbZge+Szxswh+CgNOjMvDXv5+UGmkrulknVVdz5TMtRIB9ibXr skGFyMVy+Htm2WWWoDfhfQ99Yf23PycEQrMqi02exr/sV424jViXcwA7cFzMdM7//w/9 79UMEmhEAq6I8nwnaS8IQ9vSkUeNgqpuS+ZID93gJPg+mJrztSl7VGAGI/yxpgLRUMUf /+lJM6MsMZtsucAhX/7z4XzM5/Ku4P1xzbTd1/7h9sSrvumBO1rNPX3moCRDIx7bpaRj ntdNTAeINe2oxmqHGstCAxfwxzN0eQ03v4HpJffH0Gr5mMqAmAW/X0m1ZUthSPN8X4mV WmgA== 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=NBpXuIWY; 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 m32si1891716ede.497.2018.01.25.02.52.13; Thu, 25 Jan 2018 02:52:13 -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=NBpXuIWY; 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 38B64C2237B; Thu, 25 Jan 2018 10:52:06 +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 AFEA7C2235E; Thu, 25 Jan 2018 10:52:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3BDFAC2235E; Thu, 25 Jan 2018 10:52:03 +0000 (UTC) Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by lists.denx.de (Postfix) with ESMTPS id 8226DC21FBD for ; Thu, 25 Jan 2018 10:52:02 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w0PAq0oC011643; Thu, 25 Jan 2018 04:52:00 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1516877520; bh=tfwxI0af8A8nRL0DKelne7NDnn5tKkKaBkdejSnLh44=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NBpXuIWY7kdnpE1pthEPtNYnxPcgn3L7KyDsNGrNS4rFtTOdh8Jp59bLLTENTbcfC RxYfx4TQORgRtZ/TUejlxnr56ZbGLQoY6izlJ+a6q6od6b6yT4jAB3X/jhBEC6KWkv NxahKgLhN6K2zt0DxZvcBm3ymzP+beZmqzGJJ7VE= 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 w0PAq0bD019887; Thu, 25 Jan 2018 04:52:00 -0600 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_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 25 Jan 2018 04:51:59 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) 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.1261.35 via Frontend Transport; Thu, 25 Jan 2018 04:51:59 -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 w0PApxfE004702; Thu, 25 Jan 2018 04:51:59 -0600 From: Jean-Jacques Hiblot To: , , , Date: Thu, 25 Jan 2018 11:51:28 +0100 Message-ID: <1516877510-14863-3-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 02/24] mmc: omap_hsmmc: cleanup omap_hsmmc_set_ios 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 No functional change. Move bus width configuration setting to a separate function and invoke it only if there is a change in the bus width. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Jean-Jacques Hiblot --- drivers/mmc/omap_hsmmc.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index f5917b0..f02a7a5e 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -62,6 +62,7 @@ struct omap_hsmmc_data { #if !CONFIG_IS_ENABLED(DM_MMC) struct mmc_config cfg; #endif + uint bus_width; uint clock; #ifdef OMAP_HSMMC_USE_GPIO #if CONFIG_IS_ENABLED(DM_MMC) @@ -812,17 +813,9 @@ static void omap_hsmmc_set_clock(struct mmc *mmc) omap_hsmmc_start_clock(mmc_base); } -#if !CONFIG_IS_ENABLED(DM_MMC) -static int omap_hsmmc_set_ios(struct mmc *mmc) +static void omap_hsmmc_set_bus_width(struct mmc *mmc) { struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); -#else -static int omap_hsmmc_set_ios(struct udevice *dev) -{ - struct omap_hsmmc_data *priv = dev_get_priv(dev); - struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct mmc *mmc = upriv->mmc; -#endif struct hsmmc *mmc_base; mmc_base = priv->base_addr; @@ -849,6 +842,24 @@ static int omap_hsmmc_set_ios(struct udevice *dev) break; } + priv->bus_width = mmc->bus_width; +} + +#if !CONFIG_IS_ENABLED(DM_MMC) +static int omap_hsmmc_set_ios(struct mmc *mmc) +{ + struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc); +#else +static int omap_hsmmc_set_ios(struct udevice *dev) +{ + struct omap_hsmmc_data *priv = dev_get_priv(dev); + struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); + struct mmc *mmc = upriv->mmc; +#endif + + if (priv->bus_width != mmc->bus_width) + omap_hsmmc_set_bus_width(mmc); + if (priv->clock != mmc->clock) omap_hsmmc_set_clock(mmc);