From patchwork Mon Aug 28 14:29:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9925625 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 7332B60329 for ; Mon, 28 Aug 2017 14:30:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65DD0286D4 for ; Mon, 28 Aug 2017 14:30:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AA44286E4; Mon, 28 Aug 2017 14:30:39 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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 DF7C1286D4 for ; Mon, 28 Aug 2017 14:30:38 +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=VDlKqpE2zZ+vYMBW+NcH0QyNlVdrf0mcGPPd8gR7Mlg=; b=SbI/+w/tWdNMglYYam8zDHpW+G cD7B3G1ecstnxwl3gr66pKagzJ151PZxvqHOkIhMsVjr4RAILobPc5t3UXLcDvH6lK8mcG+ItyiOx ym3JcAwM9bIBNJ7Y7h13w7EMAa5Y87QqhcZbr2SLOvuzUdXIYlI/y9aEdi4nB/wBGlmJkq4K+pmN2 0kwg+eQlASiuYJ+D+cojeW4mX99ftu5F8SLPnU8oPcYEUuV4sN5V+MgFv42+KM10o1r+pEUdjsSQC a61HCnwRSPicT6MjgI8XykosbNRFldi3l/eMp0kTg0mYHKe+pPmWZ7VoR7roGBfVU193S9GgPHClN l1m+Sezw==; 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 1dmL3i-0006Ht-Pp; Mon, 28 Aug 2017 14:30:34 +0000 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmL2u-0004Wr-B7 for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2017 14:29:46 +0000 Received: by mail-wr0-x232.google.com with SMTP id z91so2236225wrc.1 for ; Mon, 28 Aug 2017 07:29:23 -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=nY5vKq86mNqda4qj8Dd1b9Eoxv8nkED9wOV2EJqvD+Q=; b=ADrsH5hzRP/gPsqY1dUfBwQDT7VInkxe0j3Pr00C1KakaeKlKM5+fPf7LCq6nVHBiz g+H8uMahQqOhZkVw806zrEGFAQ9c+qbFO7zjHuWOaemMsIXFSmIU8N9us5NZg8Fpp8Ml pzAFlQmrlBEeeh7kNFnon5qjP921ENA99kTl2w8bQ62/jPqF5NqcbU0IhPVHOc0OBLGt A6UklAuwAPS014rjPYtaNoyQ34ZmqhptkqZnIHAbunx9RdfpHEogAni3pDt9rgnho4ok 2zJ7gBKMHw7N7fUCWetXOUn/wHijjvw8qqgTiFcs5hl755JmRbPEeJEh7xzPdfmF8ZAV symQ== 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=nY5vKq86mNqda4qj8Dd1b9Eoxv8nkED9wOV2EJqvD+Q=; b=JU3YLoKBbDCAPMccKAGgFsaJJQLavWmt+W1J+UKnv7ahlGoD5kFYKEoligt26088wH bAzuzPeyhDAkmIMC3G1yfHBkOlVfs4DgvhvJ/Do09A4v2FDn7oLfrYm/I1ikVF5efu+7 XZHcd9H9CJ1goXCUgU9naiquYyO0Xg1bXqm+5QuUPJXFYYUFb9VfzCLYSE57fNuIWUkS 8qDBoQ4q87Kg4K+1dqui6t4G4b9Q+aKPhTo6Cz188MrB4y4hPzJRtB8DM3bzriC+gsRV wIM7gWAkrwvpv34blr5szxB3Rr8OSjZPU8O8YumDDVgAXq2VQRTxgYKgm7jC2s/5ucvx lXUg== X-Gm-Message-State: AHYfb5jZlfpV9K/cgAkK9l6ahMeIAkILAUeSwXTaCVcCNl8AD2R5Hfrg ZiS34u6FORcMC3AK X-Received: by 10.223.138.239 with SMTP id z44mr509845wrz.85.1503930562305; Mon, 28 Aug 2017 07:29:22 -0700 (PDT) Received: from localhost.localdomain (uluru.liltaz.com. [163.172.81.188]) by smtp.googlemail.com with ESMTPSA id z39sm604792wrz.61.2017.08.28.07.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 07:29:21 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Carlo Caione Subject: [PATCH v3 03/13] mmc: meson-gx: rework set_ios function Date: Mon, 28 Aug 2017 16:29:05 +0200 Message-Id: <20170828142915.27020-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170828142915.27020-1-jbrunet@baylibre.com> References: <20170828142915.27020-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_072944_655644_1BF33FBF X-CRM114-Status: GOOD ( 12.84 ) 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) Reviewed-by: Kevin Hilman 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 7d14d382cb1c..0d29f1f347eb 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -444,8 +444,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 @@ -473,7 +473,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; @@ -482,9 +482,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: @@ -503,8 +500,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); @@ -518,11 +513,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,