From patchwork Tue Jan 30 15:01:31 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: 126225 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp3438541ljd; Tue, 30 Jan 2018 07:02:10 -0800 (PST) X-Google-Smtp-Source: AH8x225LzKC4PlFJokV7Ch3YRj3f9rb9+1O09IcrTRMGALo/uKU7oz7HGnybWN7I3jyF5o3rhONH X-Received: by 10.80.144.53 with SMTP id b50mr51473967eda.265.1517324530223; Tue, 30 Jan 2018 07:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517324530; cv=none; d=google.com; s=arc-20160816; b=mBpD43ZTgSe64n1QJlWMmk3hPsGJlfc9j+0U3lvdOAhu4ckmp9/TrwxSWi0SkT3izk UPeJsgmzXG9DllCak+iri6TvcflGhLKoU/90UTxWrTHAhC3DDAKRSWSmVQh9d3m15agD rQQlFY5MAULOwXFTS0SRQjjVdhmlJNWG5MuGeKUF3MmiTbbVzaLhglgvCGlqwLJ13Vkm j/3RQLhTJLs+EAU5+BoIQu0tLl0s6yQR6vTt73ynsT8HerUYd5J8zy4wXYBhyBqWTzEp dszv6ABsXKlqjB6ZqajW9xhIi935ir1Swf1D/NmF+Ipczv4+Xn+vtALDz4MV9yGfRXEN iNTQ== 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=/yM96DnWvthYqzSS50MfbJoZ9lgLbT8s6f1Y+Yw/8mg=; b=U5mU7aQfMv7Tq/dRnBebwvs8dgY1R5bw+FIpgFLMlcel631fD4eO77Dh6JvpWWL9+J EOMXeDfj6Uo42ieo+KF2poPOHSHFsbmtmdbNdyV809nIIXKnqmI0to55K4dWKHhEgaIL dSyjIb4c8Kudvo1a5LdGJISaeBSKBwnRzUlxjWX1gu/fyK45qMzbqayMXeB1HDsA7WfJ DUlhsM3Y2FuesdxJMMCi+/PolaEIHWWwIgxJDmsOqMoWJj1AWAta09E4Pm4swqAXUMfC cvV4xe7H31tfXkZFfwjHKf/BWZ/r2pvkzq9Iw7SIAVacSVg9e65i3yOabNIM0I0BLffz ID8Q== 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=K9N6SQfV; 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 i60si166551edd.278.2018.01.30.07.02.09; Tue, 30 Jan 2018 07:02:10 -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=K9N6SQfV; 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 9BC55C21E79; Tue, 30 Jan 2018 15:02: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 172A2C21DA6; Tue, 30 Jan 2018 15:02:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E12F0C21DD7; Tue, 30 Jan 2018 15:02:02 +0000 (UTC) Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by lists.denx.de (Postfix) with ESMTPS id 21F68C21C8F for ; Tue, 30 Jan 2018 15:02:01 +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 w0UF1xNS024867; Tue, 30 Jan 2018 09:01:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1517324519; bh=rzA5u5Ca4VgD59j3Igg4GYd2ClqJKkkDA1weoqWjCug=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=K9N6SQfVwvwBPTkmWD6uJPQdPhlyEOFtBN4H1IGf6q55ONyNqmQokQWjyJrRKM77l wZVYQWtM+TA63Uwukp8RvWXJvVvTjdkVIhsMs0184lVFu784gWEC2sV9TclOXQIdO4 Fy0RlXXoMPk9vbiFWtIzrGZG91Rk6A1lQEOtA4+w= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w0UF1xV9004691; Tue, 30 Jan 2018 09:01:59 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE102.ent.ti.com (157.170.170.32) 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:01:59 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE105.ent.ti.com (157.170.170.35) 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:01:59 -0600 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 w0UF1wCn011698; Tue, 30 Jan 2018 09:01:58 -0600 From: Jean-Jacques Hiblot To: , , , Date: Tue, 30 Jan 2018 16:01:31 +0100 Message-ID: <1517324513-13875-3-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 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 --- Changes in v3: None 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 fa8681a..713faab 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) @@ -814,17 +815,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; @@ -851,6 +844,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);