From patchwork Fri Aug 4 17:43:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9881831 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 A1154602B8 for ; Fri, 4 Aug 2017 17:46:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F2F02891B for ; Fri, 4 Aug 2017 17:46:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8441A28930; Fri, 4 Aug 2017 17:46:29 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27AA62891B for ; Fri, 4 Aug 2017 17:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753167AbdHDRoL (ORCPT ); Fri, 4 Aug 2017 13:44:11 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:38461 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752981AbdHDRoI (ORCPT ); Fri, 4 Aug 2017 13:44:08 -0400 Received: by mail-wr0-f177.google.com with SMTP id f21so19227535wrf.5 for ; Fri, 04 Aug 2017 10:44:07 -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=8O+knQwEPCgAh7lPu3WW+PSOR/Gn2mbFWCSMtlR1+E4=; b=w12NmWC3TXcT8NAT4S+/wg9B5IbbZTPA9q4mSRT3YfXBKIPCsSmrP9GYqy9y1QEaYw PJ81uJaOn4AO6spWf1NOkDkhDyI+LfBRN62VdxMXq7cjWJ67rEFpn+42AZ9PQ7P7PdVc fHLwHUpkOOwjTxEzTM4+NJMU/n9hf6FbkXoXFlLwughF1v3Gj/FOK8Z66JfcU0S177RU GxTLsskA/VqP/XVtD8n0foC4Iwtnt9LuRcM/0HXrhhihUmEIfgDZbGDB3Y43P934+Kjl NfRjPAaLBKhC4UKdFyVleBSYfPagoZWu/mbVUn5UzlXYQndceMfQlCYSgBVKgkJKW3HA TzPg== 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=8O+knQwEPCgAh7lPu3WW+PSOR/Gn2mbFWCSMtlR1+E4=; b=WTFy7Un9Uie2z02lGhdUoyx5mryL0BY2O0s1qkFizp/4kMilg3ilc0PJJDIw3jD41k 8hNFxtofQ39noawh7t0TJv8kHsFTVPLbqrTPU8zgjAzT0GTd7SAiyQ5+oDbvwSLCbg1i jZEvxo+VtVGNutFfJqUVcSDkH6MmuWyVewEsMnKmuPoqxq4DA6S1YhrvAA5wiRGAgpKs W2Xh61qdpEuEVTJi6MybAY8tWkUKWnKljTX7l+PRJ3Jy7LY2YwRAEfZYoshG1KQZizuU 4tykEwDfrb8TA5rgbGgatjRacXCq0THeEpL3XyjsieR08MRLzVlgSWxCPfQqySAQhjMJ lH8Q== X-Gm-Message-State: AIVw112GYO+b7Xx5ziTo1x425ydX40oQi+lqphGLBnLu3Xxldwp7sSUP 7iYaijYpmcdqZ+0u X-Received: by 10.223.153.179 with SMTP id y48mr2257040wrb.168.1501868646878; Fri, 04 Aug 2017 10:44:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 10:44:06 -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 05/14] mmc: meson-gx: cfg init overwrite values Date: Fri, 4 Aug 2017 19:43:44 +0200 Message-Id: <20170804174353.16486-6-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-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP cfg init function overwrite values set in the clk init function Remove the cfg pokes from the clk init. Actually, trying to use the CLK_AUTO, like initially tried in clk_init, would break the card initialization BEWARE not to poke the cfg register while the divider value in clk register is 0. It crashes the SoC. Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index a399fbd415f4..61668891b4fc 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -337,7 +337,7 @@ static int meson_mmc_clk_init(struct meson_host *host) int i, ret = 0; const char *mux_parent_names[MUX_CLK_NUM_PARENTS]; const char *clk_div_parents[1]; - u32 clk_reg, cfg; + u32 clk_reg; /* get the mux parents */ for (i = 0; i < MUX_CLK_NUM_PARENTS; i++) { @@ -403,12 +403,6 @@ static int meson_mmc_clk_init(struct meson_host *host) clk_reg &= ~CLK_ALWAYS_ON; writel(clk_reg, host->regs + SD_EMMC_CLOCK); - /* Ensure clock starts in "auto" mode, not "always on" */ - cfg = readl(host->regs + SD_EMMC_CFG); - cfg &= ~CFG_CLK_ALWAYS_ON; - cfg |= CFG_AUTO_CLK; - writel(cfg, host->regs + SD_EMMC_CFG); - ret = clk_prepare_enable(host->cfg_div_clk); if (ret) return ret; @@ -958,6 +952,9 @@ static int meson_mmc_probe(struct platform_device *pdev) if (ret) goto err_core_clk; + /* set config to sane default */ + meson_mmc_cfg_init(host); + /* Stop execution */ writel(0, host->regs + SD_EMMC_START); @@ -966,9 +963,6 @@ static int meson_mmc_probe(struct platform_device *pdev) writel(IRQ_EN_MASK, host->regs + SD_EMMC_STATUS); writel(IRQ_EN_MASK, host->regs + SD_EMMC_IRQ_EN); - /* set config to sane default */ - meson_mmc_cfg_init(host); - ret = devm_request_threaded_irq(&pdev->dev, irq, meson_mmc_irq, meson_mmc_irq_thread, IRQF_SHARED, NULL, host);