Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp53357ybg; Mon, 8 Jun 2020 16:13:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhmO0321Ey1tnGgnnm+mS0EFaztVaiPk5tsliOEZNxz4U/vBnEoKq+yQkbJqcmbWvks/m6 X-Received: by 2002:a17:906:22d0:: with SMTP id q16mr10437280eja.455.1591658016199; Mon, 08 Jun 2020 16:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658016; cv=none; d=google.com; s=arc-20160816; b=sDfhfWzPLFLg3ypyxgeL1YvrTRBhqMHLYQaDxhDjju/OUWlyN7UNQfGiwfkjSf7PSU AhSCp3cUQqK3ZRGBGTO28IXa618tfkLjUHMxJ6uPz++45Hg6BrEO5bB/FB+LKb4kq8pZ q6QXmKrNVx6FCyf0vreu98OPPSs4/LDIRoVsKKw3hkwTVv3HbUIdptHe4BKX+gOdvqfq EFzaSFl4BYOHAvOErsCQRrfcDyLAP5oNuKyXN2fUD1qkM12bLZ6W245GYKcrzm8KCu1Q IJ668VUMJLTaa+LhzsyMKRXFd0xs1VFOWlo01SNwRIqQqkz2POKFXDAn1cW6iYhBdaYh DayA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fyRWJJJKVq78fC+uhV8upRczZMXVq0F5dfLOah1hEpg=; b=pnjHK2QN1yWCIP20hN6VmZtUPTpdBa0W0GNtYwSv1UpGczoa5bb6wwPAeguxxAcCgr ygL1gSwkVQKXZE3k16drzMCsVNln9z9yCDiTyEt+NNxBNEBpb3ppT4aI2DcQL/jNwrwK VYAL6+EwLBjzyAa5WHK6Mqc26Q3zTLMUL+SZ6/Ms9nVZYGr9NZKBjlKBab0zJZ/+sXhy pZ0INlzdLeQhvJ8AMekH/ZVC1KvVNtelx6TrzeDsWNuDkCjgdq4F/KGSzLP/t7mpEizI KkFIGBaFerONb0CXxvEVhJ104sikHwMOPwJK7upBQO8MR7DKXdLvF7p4qp+YKn5Wm8fX bT5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ruNEgV7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si9636267edq.98.2020.06.08.16.13.13; Mon, 08 Jun 2020 16:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ruNEgV7k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbgFHXIk (ORCPT + 99 others); Mon, 8 Jun 2020 19:08:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:52342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbgFHXHq (ORCPT ); Mon, 8 Jun 2020 19:07:46 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A72D20888; Mon, 8 Jun 2020 23:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657666; bh=OaiQKm1bB3NmMoGKTxrJngEVvq3569afw1osq8OEFZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ruNEgV7kIJbhNz4ws/2nOm4I69roVOGO5ElZRJjJy1YAse6dtOl2ddZMuO47JEVtA NxWBmcqdxafQeZOslHRM6LoSZr1GonP0MlqE/zGp+7TkZx0uXqG916fNIsPLe/DelL GbOWSVnif37OrPMwI1Zi3Vr9Hva4tBGJgBBLuWQM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ludovic Barre , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 076/274] mmc: mmci_sdmmc: fix power on issue due to pwr_reg initialization Date: Mon, 8 Jun 2020 19:02:49 -0400 Message-Id: <20200608230607.3361041-76-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ludovic Barre [ Upstream commit 33ba6fec0012e47f4e72bfab922b99327373f210 ] This patch fix a power-on issue, and avoid to retry the power sequence. In power off sequence: sdmmc must set pwr_reg in "power-cycle" state (value 0x2), to prevent the card from being supplied through the signal lines (all the lines are driven low). In power on sequence: when the power is stable, sdmmc must set pwr_reg in "power-off" state (value 0x0) to drive all signal to high before to set "power-on". To avoid writing the same value to the power register several times, this register is cached by the pwr_reg variable. At probe pwr_reg is initialized to 0 by kzalloc of mmc_alloc_host. Like pwr_reg value is 0 at probing, the power on sequence fail because the "power-off" state is not writes (value 0x0) and the lines remain drive to low. This patch initializes "pwr_reg" variable with power register value. This it done in sdmmc variant init to not disturb default mmci behavior. Signed-off-by: Ludovic Barre Link: https://lore.kernel.org/r/20200420161831.5043-1-ludovic.barre@st.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/mmci_stm32_sdmmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c index d33e62bd6153..14f99d8aa3f0 100644 --- a/drivers/mmc/host/mmci_stm32_sdmmc.c +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c @@ -519,6 +519,7 @@ void sdmmc_variant_init(struct mmci_host *host) struct sdmmc_dlyb *dlyb; host->ops = &sdmmc_variant_ops; + host->pwr_reg = readl_relaxed(host->base + MMCIPOWER); base_dlyb = devm_of_iomap(mmc_dev(host->mmc), np, 1, NULL); if (IS_ERR(base_dlyb)) -- 2.25.1