From patchwork Fri Aug 4 17:43:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9881877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F154F602B8 for ; Fri, 4 Aug 2017 17:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6E49289AB for ; Fri, 4 Aug 2017 17:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB473289DA; Fri, 4 Aug 2017 17:55:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5DAEF289BD for ; Fri, 4 Aug 2017 17:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tVQQ71IE/3L6OLryI+K9b1gwBxFKndAarCRaO0i1Q6k=; b=N4cgIrffzXHWliL0tSwoJBnk7b FT+5OHOh2tatC+twB20pzzoRrby2zL7qKnv8FVD8JtKrCZsu9hA4gT12Q4gEKaZdPGwtwARm0n/rO J1/XnJUki/8gjC4mczUM8017Hb50SmUjkR13u71PCX2bcTIXR89zel0x1/8k9zXMHyAnK/vSrHvBh kHvKEHazM0rVx29BBDlIwiFxbUUPGlbfKnb2gJPzwlMiqkvYaj2yT5sLQGOdXhzorDQCbA45C3cDc ojrz7KgY+YyJVYzh7y7AXHHFmYv1VrRdSup1h3VPINh6e/KAkLUtS9artYTggo2+xKD3NuvcAPWYB wNv7O5Cg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ddgoj-0006K6-Ta; Fri, 04 Aug 2017 17:55:21 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddgeE-0005sP-Bj for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2017 17:45:10 +0000 Received: by mail-wm0-x230.google.com with SMTP id m85so25329213wma.0 for ; Fri, 04 Aug 2017 10:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JQrldQDbPuDDYNGH9bPgdwwd8jpBtykkvwTd+GnqxiU=; b=eEjtsULWNFXh0LWSA4U3noIq+hAvdESk+2CEJk0S2TR25DZrt+x2DWl0lwYnGmaGhl UQseHDzgNAvX3we8u6NS1YR80W9K0es86DhZ50Vq4mb4C971lTqXE7ZhYHS+3/mDokmM 5KHy4HNF18EkW/LN9EvyLJ0Hg5TdhGwF1miWkkERfOe27F7GLgQbAwp2TFzDdvC8BTlj 4OvhMfTeYemh3cH+rU5NPYuHXLpuAxfHYV3UwvATsqK1awW1jpnSUT9v3elQzsZ+VD9c GLtPbXTgpCD7+5aCLPvUf7F5VcZ2fMe2iLB/XvgaukrqRh2Cso6csatjM2k4+nVtLPBc 3V8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JQrldQDbPuDDYNGH9bPgdwwd8jpBtykkvwTd+GnqxiU=; b=d5ktCgSmiw6e90aR9E9+BB5JLUB0QL8PeopyMNjM51ZqufE2EygZV/AJI4gN/4sIEz 0WOkuhPolLn+tauugdoW03PlrqckdwDjLClma56GyMsdpjMgVY+mMUk/JUNwvyV7oLO4 t5bF7tGdfX/UVSExbkE6Efmlz1hEk0Yu8NFgeRveumbpZ8OWopsYnYohk/7y0/NTh2iC /9RxlBAs602BdAxys3UFhrpa+wFAZytFQltp/j8V5plitQwQ6SfsgKdhJo/pE4a/pZP9 EllfWG2Aq9+HK9Eo7i8UkUmVeRhgKRCL+fR6X9L9vbq8LsI5MduYVyWZ6skBnnB1eUqG 5ktQ== X-Gm-Message-State: AHYfb5gE+EanQSzKf+qnzX81L6p8qPJInamBKxjNecJ3NtHk+Q/NhQvi nZbf4/m4DrwEIr57 X-Received: by 10.28.150.87 with SMTP id y84mr1750472wmd.67.1501868648601; Fri, 04 Aug 2017 10:44:08 -0700 (PDT) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id p17sm996082wma.45.2017.08.04.10.44.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 10:44:08 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Carlo Caione Subject: [PATCH 06/14] mmc: meson-gx: rework set_ios function Date: Fri, 4 Aug 2017 19:43:45 +0200 Message-Id: <20170804174353.16486-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170804174353.16486-1-jbrunet@baylibre.com> References: <20170804174353.16486-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170804_104431_144312_A8A32E80 X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove conditional write of cfg register. Warn if set_clk fails for some reason. Consistently use host->dev instead of mixing with mmc_dev(mmc) Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 61668891b4fc..18fff28025d8 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -445,8 +445,8 @@ static void meson_mmc_set_tuning_params(struct mmc_host *mmc) static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct meson_host *host = mmc_priv(mmc); - u32 bus_width; - u32 val, orig; + u32 bus_width, val; + int err; /* * GPIO regulator, only controls switching between 1v8 and @@ -474,7 +474,7 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) int ret = regulator_enable(mmc->supply.vqmmc); if (ret < 0) - dev_err(mmc_dev(mmc), + dev_err(host->dev, "failed to enable vqmmc regulator\n"); else host->vqmmc_enabled = true; @@ -483,9 +483,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) break; } - - meson_mmc_clk_set(host, ios->clock); - /* Bus width */ switch (ios->bus_width) { case MMC_BUS_WIDTH_1: @@ -504,8 +501,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) } val = readl(host->regs + SD_EMMC_CFG); - orig = val; - val &= ~CFG_BUS_WIDTH_MASK; val |= FIELD_PREP(CFG_BUS_WIDTH_MASK, bus_width); @@ -519,11 +514,12 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (ios->timing == MMC_TIMING_MMC_HS400) val |= CFG_CHK_DS; - if (val != orig) { - writel(val, host->regs + SD_EMMC_CFG); - dev_dbg(host->dev, "%s: SD_EMMC_CFG: 0x%08x -> 0x%08x\n", - __func__, orig, val); - } + err = meson_mmc_clk_set(host, ios->clock); + if (err) + dev_err(host->dev, "Failed to set clock: %d\n,", err); + + writel(val, host->regs + SD_EMMC_CFG); + dev_dbg(host->dev, "SD_EMMC_CFG: 0x%08x\n", val); } static void meson_mmc_request_done(struct mmc_host *mmc,