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: 109442 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2474167qge; Fri, 4 Aug 2017 10:44:17 -0700 (PDT) X-Received: by 10.84.236.70 with SMTP id h6mr3784526pln.339.1501868657074; Fri, 04 Aug 2017 10:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501868657; cv=none; d=google.com; s=arc-20160816; b=qBfTsmPa0MiDGMsI0D58TBN6/MfTJuT7Goi60NzAf5AsaVeDWFdksrM3D9mp7NQy0/ 5MkAUobr9Zqdyl1f2LHJOi8ACKxn/mSlmIRohrsN7YBXvPcQ0SCkC8zE0QiHi5+TlpzY 6qd1XlBa4tJOz3rezkvw0HqnMvvuKaKa4rBfrmg2sAv2jk/b8Qo3miBbDZ3NzoL2XzdY fxlViFwIWHyCibsrRiNDn8ha332kNNIHcCjuvGrKxW5h63KpKZtU/EotxdTjGPEIutr6 xFCjkIfiy7zvlclTKW+ISIBWbz7nDnwXC9i6EhbDicvxMQ+Es/JbrLQkaYw+fgjQqxIE 3Nhw== 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=8O+knQwEPCgAh7lPu3WW+PSOR/Gn2mbFWCSMtlR1+E4=; b=Fo0iz+qpzrnhvrQwPo8Y15HLNGj5jHdooo/JTvzmm4AUR0Qj1nEez03MIxCsxPlBC+ IIe+qHland1Uyg1I6PjSWv/ZHvcKdZfBZJwMvluqE9q/rEek4E4j52TQ7lwt0PGguUSJ XYf5jMf6amR7cpWk2qKt3CzBmziRlvC+4e1qMT+gJtnce9vu7rK6t28dGWrMc/OdbXLw f3XY4bPeEbIMDNupCIpvfVrHn7QtWAojd0aIWKWAD/9G5N1mHYDU+MdgI5eK7m6gIrh6 Xmr3oGm5atRJi2+2NGdkG0TmWwiP+BnacNu0BG7Fa3PT3DGPcTd2DLjG9bCd9p8OPAvN Rh1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.b=w12NmWC3; 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 d5si1596563plj.158.2017.08.04.10.44.16; Fri, 04 Aug 2017 10:44:17 -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.b=w12NmWC3; 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 S1753189AbdHDRoN (ORCPT + 25 others); Fri, 4 Aug 2017 13:44:13 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:36530 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890AbdHDRoI (ORCPT ); Fri, 4 Aug 2017 13:44:08 -0400 Received: by mail-wr0-f171.google.com with SMTP id y43so19270222wrd.3 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=Aa71OqvBsNS5QtkgbnX/61hPUbcA2OLJw+psDX7Jf4qkKwLIS30Ezz+p2Jwmx829fM 1NTaCq/avxNVeTjUlSFJvnHzAp3KPy5ysTSpNdWRa6LH2wIa4sw0MQ4nn+UrEs5V6kCl +JqY2nCRgk0SQgRgVjtkdYPvT3Xlj3xRAKsAzt0zVeUhwGOFe0fXRjLX5RY4pXVrIEHY gGWcsfSv2aKBKSbPUtnDxRWBUhATCKjRMfaTJ7PrIvMrNEdqo4cF36Jd33PLq7MK33t+ /0/05D6GBb7GgVC2AYWlZY8eFJ6dzNYAwrVSWfg9x902Ueb5jAjw6Er5MesI7LbHHQl9 XYgg== X-Gm-Message-State: AIVw112VW17WjHv4Q9TtW/a/shgujUVAIm/VX2k0DUFJp0X3psVhiTP6 CQh8YO8VF5z2OO0s 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.4 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);