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: 9881951 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 9FE7560360 for ; Fri, 4 Aug 2017 18:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92D04288A2 for ; Fri, 4 Aug 2017 18:50:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87CB8289DE; Fri, 4 Aug 2017 18:50:22 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE 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 484FA288A2 for ; Fri, 4 Aug 2017 18:50:22 +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=qgFbPmh1G+m8myRxf/tgaOMV2LBVZScIGJGrDc+nNnc=; b=F94f8RT4lsYa14XzeeNQj84evq 4goiCPqoDUEazdkDL+EfJGPMnN3ToecYHYL3itqGY2hzCxZoaxDk00P5uU2za8V3KGE33XEMcWhMN XbdGHuoglcmetp/ApECV/+nDbAdifGyxCiWLiT0rrF78WFI4akx1wdzh5IbRCSC+YR4g9i2EAj6Nc /xCJH47f+f29mT+0AcYj91g8titNxjGQtw4tPGitKd9G05JZxh3xqKi5r1bZlq2POJ1tgPjzOLAGt ASz5HlhTRzoDVhnFe82N7gJjBTXgMk6dbWSxXng0+QCLoEOVhW1m3UcPAa2Y9tipimfZBFjnAIUBq L1XHwOnw==; 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 1ddhfv-0000Fb-Mr; Fri, 04 Aug 2017 18:50:19 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddhfT-0006p8-OQ for linux-arm-kernel@bombadil.infradead.org; Fri, 04 Aug 2017 18:49:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8O+knQwEPCgAh7lPu3WW+PSOR/Gn2mbFWCSMtlR1+E4=; b=YfGixoSAkGW8H9Q9uqDjlzYZs LRGHnXHATNFvHQSKuKCKv/Ku2HWA3KSGMXs9cDDgNrHRnABkzj5MW3oyE/YWcpVCeBCYKVx45ttAm DVBvG0c4CP2s9dlMU2ZNd4U/wT6avEkMjOsTznZQWqLJvYDZlIOEczE62kuW4pmHo57Ite4OoZQ1v HACnaEP//vW0DOUaKaXUJ2nR49WwiClJ6cO9vEFXalM3xooTl/biOKyFoNEedAA7Jhe7jJLYW6Ior 5PR2nKyzt2IclAxYubxCHuvsWtWt5PkgufbRnQ3J3G/keVXbfV8ms5KGKtf6nNhym+j7NrHKpcrkN CUdIwAgvQ==; Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddgeJ-0001yL-8B for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2017 17:44:38 +0000 Received: by mail-wr0-x22f.google.com with SMTP id 33so19262267wrz.4 for ; Fri, 04 Aug 2017 10:44:08 -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=JUzBakwQqDaQYYqgpYK8AsDa1V3kLSIT8xg7bF29DWjHlbvGD7hzFlWdOjaYcXVKKM P/dHKW6ArEgech0vMmTIoC6qo++yMCQKMQYFqUN1125N4ahJrfzJY3JSCda6iI+ZYIKd pTMC9ZeZhXefq5zLIi2V75zIZQLrNmgppG0oO/Kenm1hbOi+X3efFG42FUEvFi6NNTlm QQLHnKR7aixNdDNQGNEyer1UzEQCFrV+6YNM+vsLmTVv68xLqvLfpn4ZbQRc8Wq0m2m6 ibGRYKzcoQefYvJLjaMIRXB9W7LvyzFVrwVksMpL6+GLljjfog8RfXMLwjJOKDrEEkDu VXRg== X-Gm-Message-State: AIVw113KvDCl/c2UZ0KZTNBNsbUVwaWnGHq3fqcbq+nLHi4bLlLG6+6s 8V0QClGh2fkMqZb7 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 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> 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 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);