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: 109451 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2476841qge; Fri, 4 Aug 2017 10:46:34 -0700 (PDT) X-Received: by 10.98.166.153 with SMTP id r25mr3238322pfl.155.1501868794512; Fri, 04 Aug 2017 10:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501868794; cv=none; d=google.com; s=arc-20160816; b=vGSm/NNSkGCToEJx9YbYNyVPlxQHqB5yESVBk5LQl/YVrl/yeU6XLUFdK+cbQaLbZS p7YVV1V1LOPuzXnH3cMrezYNtuRfVm1KRfelWdrymzoRic8uTm1p9gDClTDzawidzAtA ScciJct4Uc4nt8kX1yaaUmuCVdW/75JlT8xTmpokAq1KgJIW+WK9oJh3YmdBOXyVkCqe ViO9okXepxdSzKQui9311TyxWrBWm7swcL36Q1DFnqI53cqPWUQt+fijYGZ5X3+6Nqec EpD/w3AA8a2CcXjckzW/CF7dsWcC+EsNPLp3CBs0ff1tvYnZtV8n6THriD5T9rmt7Isl FYtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=JQrldQDbPuDDYNGH9bPgdwwd8jpBtykkvwTd+GnqxiU=; b=ZBc0qdwDhle/35vQ4cWLmdrPeGtY2DvbhApuyGvJzEj/AdS6dAnU5ZVPBD5qcu/KI8 PV5lQi0/LjWP87mQ2UupijVy5Yml+SPuV2UksK3kx0vWdK8UrpL1GirZ7L0PCg4W3n5j Yy/LfpiuRdaJ8ggolY8nG+UDG23HW1p+A6SEl9wLyWc0HS4MgNHIki+4GoDEQ49RIjeV SXQUnMgURGxmpS8PrKiMiEAuxbPLOZSOjXsXMXOIg2AhHJXHdyzkmCZydkhZQycVg42M nTahRTqUoXPxiQ0tDXTwRYSgZ/jlh/z6DQn3fAB9jZUL9CG/6Ako4mAn8jMz9CwOvKWx 3New== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.b=eEjtsULW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x126si1328798pfx.113.2017.08.04.10.46.34; Fri, 04 Aug 2017 10:46:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.b=eEjtsULW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753322AbdHDRqc (ORCPT + 25 others); Fri, 4 Aug 2017 13:46:32 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:35988 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753135AbdHDRoJ (ORCPT ); Fri, 4 Aug 2017 13:44:09 -0400 Received: by mail-wm0-f47.google.com with SMTP id t201so25291952wmt.1 for ; Fri, 04 Aug 2017 10:44:09 -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=lUvgtHemqJKrEzepkO19cU+pCeVWvoofzOW/oHI6Ky8dSIovDY8vLEyedhlLtw6Rhq JjqKxMINsLmRHoON9BNQSFGQaFY6kyUvXWWCuNfeC+2KeW5mZtxnLD5QzYLkFfCXkh/X Z4HdvJGeZtp8NX85cdiq0tIXiDjWLbd9gBQLQ1pf93q36wbhjRC3jFuD+l8qBBYAD7As BHF+UoJBxSmf7f2OG5Ut7dLmdoxCbCtxkmsiZ5fsYe63aHoIIvl8SpekAV48DxyPbyA8 sMeN8ieenNOfIm8JILn5KJY75S1TQUWZjCCn+pxVdZL/k20Bruq4USOfn1AW1jxGa+X6 hV+g== X-Gm-Message-State: AHYfb5iRXLKXxm5Gx2lOQgg9+q01tFopWFyGyI/PEa4BKY+dXHViWs9i KKD4oeUYu/+EE4r+ 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 Cc: Jerome Brunet , linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.4 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,