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: 9913209 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 00D13602A0 for ; Mon, 21 Aug 2017 16:08:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAB1E287B7 for ; Mon, 21 Aug 2017 16:08:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFAA5287C1; Mon, 21 Aug 2017 16:08:10 +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 3C218287BB for ; Mon, 21 Aug 2017 16:08:07 +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=uArdb0lflo6JkQKfYOG9bAkWSskhuS6oeEBhyrzLw2o=; b=OukNlpjQfQ7kL8AmgkzGvmUjmn Gm06OAGEsPIiTt/T7sMNSn+HIJQO5hK6EEa7CJ/9xOUXzn7ztVFeVeqDXl/iXu+V1m7sVc/oUys03 gqOHiivG1X569w4/50gvol6DIwNdRu6/myyhu1JHhYXE0Cn4aCqggGTzVxpo8QKMs7l+xStzLsIsj ovGUldl+gQ7bmA8p8YSV2tOBXjlIhK1IZI99HuxKcUJFvliFtTvkTwOALFvJtVMxMkBG8UCsjGNkD FlitHPd3o1SMuVJOqYpTpaOulr9NcOGzB8EAmBXB+VlPdwue9/nkwFZhyh4W4nEGMPIXDd1wb2kAz yfy44/AA==; 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 1djpEX-0004zR-F1; Mon, 21 Aug 2017 16:07:21 +0000 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djpAp-0001FH-A0 for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2017 16:03:37 +0000 Received: by mail-wr0-x22d.google.com with SMTP id p8so39039544wrf.5 for ; Mon, 21 Aug 2017 09:03:13 -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=X2GJ10R8tAjk3QIFWMp9Jsj+pQneUTVGQt3tmXTUTskjCtdDOwYe3r+Tz1ctb5cfFS cVCG9URQnP4BIJb3CvFUiMVKmgBWkD9JhU2CfmtXG5jf4xzPDNWiSfISZaKoGTpYlxzc HRfW0CtnlsF7AVNmgzxQ9r45QvFJy2+0HixeqbNTCZ8HPsq7USHQA3Vz5IaZpaitj5+M XrLU/1b/twcIj6Yin49eh19Rl4qjF5MG1ICNT6E6L1pGHRwMfobvsfoqicCEtgdwVOW1 t6MOdYyfFga8gh8jNoX0nzBr2S/fLRLvGBuEDxxkjpBeaggxyKrcYfA6FgVoERpUKiBR UjUA== X-Gm-Message-State: AHYfb5idZaISa5Ta80p88Xu/ihsGoFw1Htxssq+AIGolnvJeQtKWsK6Z C0G4wd2MBC6KH9Wv 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170821_090331_562477_D1D05E73 X-CRM114-Status: GOOD ( 13.16 ) 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 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,