Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp799655ybe; Fri, 13 Sep 2019 06:34:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZ67XRQbsH4e9yXZQWStzvWzzP+2g7POOrnYQeKEB/nv60Vf1g2ATP7IM9SImFv6yU+orI X-Received: by 2002:aa7:da8b:: with SMTP id q11mr47467356eds.19.1568381677551; Fri, 13 Sep 2019 06:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568381677; cv=none; d=google.com; s=arc-20160816; b=jmAB/JEFfIlruqWmBS1f5V02MPz1GiKIYcZUQ8HJYjN+sSWa4U/9cSnGYGY7+ZHzxL LOKzgA2ke3y5NL2+8y6tlcolyrrfIklmNYgXbaRepCRww2fmsksjn+djQUIC4PPZddat ofNVu5smi1r1jmEvzuDs0VOsJaqBMUhzWlbw/RfIyIqLYmib/HjIjOtJUj4G3svQ+4ke SnQo3MVYXnLK6yyHB6G3ORujeMG3x8swjEocGkfPaBlmAdV9/AvtFfdbFkjZZqPqcTTg 7Iz6MzPuMxGSDQOp9v1t0RTqDzXVSyzN5VxDvrDsMxvbOwpa7TaKVCEfdmhZAXkBRqGe f1jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b1TkmLgP87Q3UPBwieChwkJ8t60NEMtObqV9OQe4jhA=; b=aYbNTDjDFn8mKGUdlFRycVoGu41WiOO+3Jxo7SryOUCdr6MuQNp2Aft9PWpIczk4lO Swj+wYuTG1lDVa08kARgfAWA8UloWr3MHMVTt2tCltdG3vaP5hJR86Q5NfAMD/IhD+6B UY5o+WJ+/kZ/oDoEx2K4NrYXpHsxYvxsEkuUee84X+wtOH/CZ9yuVpJMwhXnY3qE+gcx AMjnJVAN/XMRw6GDHdEjV2JAT3FFR4FZxa948UoiiYM/mFK6pv3c2fB10bBPKMiG6pTC o3F4GjonX82bwyJnH3zIeg9NR4CU4KG8Ig5ks2AVdOSY2DgcWAxuzwu5ziBNbD2rNIOl 8avw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1AlLx+oa; 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 c26si14225267ejx.357.2019.09.13.06.34.14; Fri, 13 Sep 2019 06:34:37 -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=@kernel.org header.s=default header.b=1AlLx+oa; 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 S2389349AbfIMNQt (ORCPT + 99 others); Fri, 13 Sep 2019 09:16:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:43682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389214AbfIMNQq (ORCPT ); Fri, 13 Sep 2019 09:16:46 -0400 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E18F120717; Fri, 13 Sep 2019 13:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380605; bh=ao2KN6nkrJRRgCQMaG6wwvL0TDA2aYFqBntUtLWoWy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1AlLx+oaX9lAOvyxw4DWXHPoYFceMKcqIdVm4lmFiCz1gvUy4qUW49hfy0IBS8zj+ oQTurp6E9CEqq5Ongee7AK9XZaAnWXn/pzohxANiomxh+ha4HA4hh8yvJ1rt+fnLY8 zyCqdCOOo9293yN0Ajg2n6wUmfUTQtlntADc+NsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takeshi Saito , Marek Vasut , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Simon Horman , Wolfram Sang , Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 098/190] mmc: renesas_sdhi: Fix card initialization failure in high speed mode Date: Fri, 13 Sep 2019 14:05:53 +0100 Message-Id: <20190913130607.445320954@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130559.669563815@linuxfoundation.org> References: <20190913130559.669563815@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit d30ae056adb81e1d2b8b953efa74735a020b8e3b ] This fixes card initialization failure in high speed mode. If U-Boot uses SDR or HS200/400 mode before starting Linux and Linux DT does not enable SDR/HS200/HS400 mode, card initialization fails in high speed mode. It is necessary to initialize SCC registers during card initialization phase. HW reset function is registered only for a port with either of SDR/HS200/HS400 properties in device tree. If SDR/HS200/HS400 properties are not present in device tree, SCC registers will not be reset. In SoC that support SCC registers, HW reset function should be registered regardless of the configuration of device tree. Reproduction procedure: - Use U-Boot that support MMC HS200/400 mode. - Delete HS200/HS400 properties in device tree. (Delete mmc-hs200-1_8v and mmc-hs400-1_8v) - MMC port works high speed mode and all commands fail. Signed-off-by: Takeshi Saito Signed-off-by: Marek Vasut Cc: Niklas Söderlund Cc: Simon Horman Reviewed-by: Wolfram Sang Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/renesas_sdhi_core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 45baf5d9120e3..61f0faddfd889 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -636,6 +636,13 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->ops.card_busy = renesas_sdhi_card_busy; host->ops.start_signal_voltage_switch = renesas_sdhi_start_signal_voltage_switch; + + /* SDR and HS200/400 registers requires HW reset */ + if (of_data && of_data->scc_offset) { + priv->scc_ctl = host->ctl + of_data->scc_offset; + host->mmc->caps |= MMC_CAP_HW_RESET; + host->hw_reset = renesas_sdhi_hw_reset; + } } /* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */ @@ -693,8 +700,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, const struct renesas_sdhi_scc *taps = of_data->taps; bool hit = false; - host->mmc->caps |= MMC_CAP_HW_RESET; - for (i = 0; i < of_data->taps_num; i++) { if (taps[i].clk_rate == 0 || taps[i].clk_rate == host->mmc->f_max) { @@ -707,12 +712,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (!hit) dev_warn(&host->pdev->dev, "Unknown clock rate for SDR104\n"); - priv->scc_ctl = host->ctl + of_data->scc_offset; host->init_tuning = renesas_sdhi_init_tuning; host->prepare_tuning = renesas_sdhi_prepare_tuning; host->select_tuning = renesas_sdhi_select_tuning; host->check_scc_error = renesas_sdhi_check_scc_error; - host->hw_reset = renesas_sdhi_hw_reset; host->prepare_hs400_tuning = renesas_sdhi_prepare_hs400_tuning; host->hs400_downgrade = renesas_sdhi_disable_scc; -- 2.20.1