Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3712530pxv; Mon, 26 Jul 2021 10:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjGk6tlz8Ll9g+60oUuH3vCWNLUd3zdwUxxOF/rZXN5KR5nR9FWSKEnRA8732yFHZuf0QS X-Received: by 2002:a92:7b14:: with SMTP id w20mr11502023ilc.122.1627318907517; Mon, 26 Jul 2021 10:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627318907; cv=none; d=google.com; s=arc-20160816; b=eKyLEf1xt1BcTI1vRuOFt3rCofYQ/idzMjIhcDuhRGkmQ6dzzzp2pJyzTOlUcvsL1o z2ukhyCFAjk/ufjBxZlAmExL9Hr3Umg+h5ljsRsBT97+1RsefifC2xbUAAMWIr+p7N7r Rq/t4WelvJoRKnPc1Lwi/Zt0SlI9RfyIePxRm3AVuCE89xoYCSwPK1Va6Gyv7BgufuGo XkC2CJHOdIFPCiJOK+Cd6qXB7/kZGo4idmCenWLWAZCOPcWVBPooTJvrI8bNCBN1vRjY 7vdnHq9ToIhRW9TP6Mnt7paXPgcvZEHiFWIxLO7DIx4JWDyMEQSu0qCv8kcqepjWcxWp z/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aGcJMVb1jHgEbC6YhSrJEZ7j3imfKpnBjJpuFgTHeng=; b=uxfPvhtJU+IBVJ4+IkV3BM8R9jrKPBsT+dzwWOJs3OdpgPgUdKaMfqvo23stzIdyf8 UOdjfVWnUm31xPQr3hX32Ksf5do31iT37Ae6SzMyoG3kx0zMh4YQMc9gXvxuazzPJtS2 iqPGXPXERk6zcAEDi7O9Z6FYonue5ccCPM35VgktXDLM59kAzHR6q28vxGg8fTluzHDj kKGocysmhuCasXJHJEoaz4OSS6Uunv+4iXe9qCHDu6u/3MmJTtvbvGF686x9GJj/bA3D vJcMNMlyCWFUKH90QkThvjFNIlO65NPH8rJ5y8jrWi9n82Q21SSxOx03JZViIebQk+cJ LWMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UXUfVLhc; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si375758iop.79.2021.07.26.10.01.35; Mon, 26 Jul 2021 10:01:47 -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=@linuxfoundation.org header.s=korg header.b=UXUfVLhc; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238480AbhGZPjr (ORCPT + 99 others); Mon, 26 Jul 2021 11:39:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:37426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236941AbhGZPWl (ORCPT ); Mon, 26 Jul 2021 11:22:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F53B60240; Mon, 26 Jul 2021 16:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315387; bh=nu9HSbVDtzUnXxN8axmqDqNWOmNMTz0F8iLHUC/jB3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXUfVLhcFHd42PNCNXp/xvv9l/gfpi4gsGkUVSBwlySaa4xzwx/rNXkl9yh8yJE1y R3U5gKCSr1QuxNZCMsYqE0404KFr65An3B3Lgy87a6Z48SUuHKN8AEv5Uzm3LOZMJ4 PFRob1M03aiizeYDo1xb8XuV3XXuU/eotEvJJw24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.10 077/167] spi: cadence: Correct initialisation of runtime PM again Date: Mon, 26 Jul 2021 17:38:30 +0200 Message-Id: <20210726153841.988981253@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153839.371771838@linuxfoundation.org> References: <20210726153839.371771838@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Vasut [ Upstream commit 56912da7a68c8356df6a6740476237441b0b792a ] The original implementation of RPM handling in probe() was mostly correct, except it failed to call pm_runtime_get_*() to activate the hardware. The subsequent fix, 734882a8bf98 ("spi: cadence: Correct initialisation of runtime PM"), breaks the implementation further, to the point where the system using this hard IP on ZynqMP hangs on boot, because it accesses hardware which is gated off. Undo 734882a8bf98 ("spi: cadence: Correct initialisation of runtime PM") and instead add missing pm_runtime_get_noresume() and move the RPM disabling all the way to the end of probe(). That makes ZynqMP not hang on boot yet again. Fixes: 734882a8bf98 ("spi: cadence: Correct initialisation of runtime PM") Signed-off-by: Marek Vasut Cc: Charles Keepax Cc: Mark Brown Link: https://lore.kernel.org/r/20210716182133.218640-1-marex@denx.de Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-cadence.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index a3afd1b9ac56..ceb16e70d235 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev) goto clk_dis_apb; } + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); if (ret < 0) master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; @@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev) /* SPI controller initializations */ cdns_spi_init_hw(xspi); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); - irq = platform_get_irq(pdev, 0); if (irq <= 0) { ret = -ENXIO; @@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev) master->bits_per_word_mask = SPI_BPW_MASK(8); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_put_autosuspend(&pdev->dev); + ret = spi_register_master(master); if (ret) { dev_err(&pdev->dev, "spi_register_master failed\n"); -- 2.30.2