From patchwork Mon Aug 21 16:02:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110585 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1493919qge; Mon, 21 Aug 2017 09:10:00 -0700 (PDT) X-Received: by 10.84.224.136 with SMTP id s8mr19394509plj.429.1503331800136; Mon, 21 Aug 2017 09:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331800; cv=none; d=google.com; s=arc-20160816; b=aYT2ze/OjyxKoQaiAMzKqTXa0Hv5Kg8oOqHebZtz9IC/tW4ARbvlfgFt+A24qsTtr0 9FrRq99XYe8NkjtZod3wpzeUugp8Tm0Zh9qFrHZ83lB1afgS/jEJx+0PkFmbenn2t2wQ GwPrY20dQmrNNhGHUAx3AbsJJOaEKhfX/CMfH7oNXcF85MehO0ezpzZkYLn1SYr4JtO9 hpwjGAbURTwM6FnpGDiqGeB3I96BH0gUXRzMKUdfCMUyb23hQvBJyQDPtho8y+QQC9EQ sj9bvGE1yRWt+FtkOGVQ52tLOcrFkXTD783157WT8m35w7v6EEhFfvbWBKAY0PXYi0cV aEiQ== 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=rXd6q7OYpdZBu63ve9On+4T4IM8h14fRvuBmXWIXVUI=; b=dSfWIOMvB1XA9hQYblcq/7ZRyar2jv+AJPOCLYexjOmOCHIxc13uGLDnLj/HD1X09K rXTO0NzE3PdZERB65AyEwdNjYHa9JBoESW4fA0JEqpZocbtfxwXzN4SJHLy6Xxpogxiw DssgR9DRas5//nVIcpTaPZrNChBEhYFc5i34PiXSYsCRxWKTOfIoGknyAgUql6KHjNOu AXCUJi+I8xXsmzTNvcc42rIng9Kzpije/C/oPjjrz5/UNX2mwJY5fq5zx4tQY9YsNs0b NO73nkEPU3rE25rC5XxT6eSKzQsj2pDRjNdlMIJhrBj4liWU1jwDO7R0saH/yDOtdjlv IpuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=AFE7Nvx/; 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 62si7022226plf.66.2017.08.21.09.09.59; Mon, 21 Aug 2017 09:10:00 -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.s=20150623 header.b=AFE7Nvx/; 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 S932169AbdHUQJz (ORCPT + 26 others); Mon, 21 Aug 2017 12:09:55 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:35703 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754452AbdHUQDN (ORCPT ); Mon, 21 Aug 2017 12:03:13 -0400 Received: by mail-wr0-f175.google.com with SMTP id k46so28389025wre.2 for ; Mon, 21 Aug 2017 09:03:12 -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=rXd6q7OYpdZBu63ve9On+4T4IM8h14fRvuBmXWIXVUI=; b=AFE7Nvx/7WiFpRD571CiqUnZsKCmYwBa84kVYnnozV9cuHhOi2K5dRGV3fN/2jbAG9 ZtIqTLgbGAKUNeExd4kPk4jScsFAjNht1LusfHEcmBkSt2o3zeFR9MwcZmyiXL4HBl0y unYecosYPYRFfhTn/2ZemSspaUfuFzjuGveus2xWFcJ4p+kvD1umexsbCWnmti81UGVh 1cjqK/XyPEVEsuuJgSu/0/Mq/YVEY588HZkTCWCUNlS8+dMnbKC9JLHNHTVxoW+aoOeS 7V1QDMEw5oPgpFWPEZFrcxnhX0U0P9NjvmiW9Z8vgPSy3LJq96HkBrhHW1WNl31bB3YE Tdzg== 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=rXd6q7OYpdZBu63ve9On+4T4IM8h14fRvuBmXWIXVUI=; b=ukFMVThpABzAtmC8S0QYDiDNX72gznrIwx5bQC6TrFpqq0zFuVXdH8+Jk9Ewnz6w1a H4njsBWmhk0Hbzub58B28f/wedy2vqTBQPTT1cRZpmWCfdteBkbiXWC9hRscY/oHMrYr XwG62LtmX25YcICHWfTl7aebAXM4TashmCyzKfBVj/qsTXSgmPc8Ohl5PESHKt93jw8h RVYX1i0Vv/gOgHDbXUF3Q73Hgl2baVsLsW2Eqr4GgZbbwtNdkAli7WvAYqcbdxXtUrMU pFllYYV4tcNnBjau1zrwGTbxyO2IKiLWYXOR4/GrVvjzpjyWhTC0RWjRhg++J5Mf7mzX lpfQ== X-Gm-Message-State: AHYfb5g35ngiZ07rkO0QZpG5oV6ygg/IURv9AlF4R8MF+bXMxz1iX1w2 KfECcNgBytsPMBOW X-Received: by 10.223.134.189 with SMTP id 58mr2660414wrx.157.1503331392222; Mon, 21 Aug 2017 09:03:12 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:11 -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 v2 06/16] mmc: meson-gx: rework set_ios function Date: Mon, 21 Aug 2017 18:02:51 +0200 Message-Id: <20170821160301.21899-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170821160301.21899-1-jbrunet@baylibre.com> References: <20170821160301.21899-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) Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) -- 2.9.5 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,