Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp744971rdb; Thu, 22 Feb 2024 20:12:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX7DJ2tLCoUMvD9jJifnoFZFDzOql3VypnfU2RWnA436adW3fmus1AyWQrordxJYB+SA/aSuLOFrhcHdXSopkgJSUZMdujsFOP0ITvuhQ== X-Google-Smtp-Source: AGHT+IHT+bikXSi9ZUO3VnwvjYi2lfWkopolg8xFUVfzwewEM3MuQO9LtTSWOItEpZPxy38Z73oq X-Received: by 2002:a05:6358:5391:b0:179:f2:daa4 with SMTP id z17-20020a056358539100b0017900f2daa4mr1013394rwe.24.1708661524097; Thu, 22 Feb 2024 20:12:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708661524; cv=pass; d=google.com; s=arc-20160816; b=FjjHxHbqGQ24HlhDegfQxXyvNZafmzuk3yiCrHDQmLDITW0e79jWdIF1ko3KsPVCru tWWcyWShb4RN5CghGnKehXFALeuvPRyegDWqZyejAucCCbsMr3+Zy8DolHGZFEC7oI9c 5Juv+k+Sic9JNZG+ayNR8R83Vm8pBiJr0mVxzhloHgCXWGMFn/SVEXqDa9H1earEIp+P g6eauMmzd04S9luzVOmwj92HigLepROzvHy6HyoxzrVdVWHGbf7+iW2R69va66IJabD/ 9iGQeRcSl3IWVuqAuLznz3rWx+YYvTqtOy+AOpYlFyZCWL1loPtCMCEwoXi6KjWxq1iw SykQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=2+kui3rF8OVERqBfrbtrESqaK9kTj65yv1h19o2Kbbs=; fh=v9eDaXLBM4EIWvXGxm7HVV0FdJjPOnBmQsTyxhEFunc=; b=uiZoIuvux2vWGlrlWAAnfRPoKHKNpdDSVTD/Stx6VDRc5zGdhN9OqrM8NyFz7Di4St gm16s7Q/k9BoAa1+aSlWInNCEX+MR5ac5ezNH6QU0BJalPxyrpBDOxjHcHCNFSp6SCOj 7Z5E5HBDL3e5Fus4+HfwoVNHrMVZrPAvqOAN2WRuFWYhFKjgppQARdqGTAZbnFgtMuqT J1qdE/DPjhhU0SWP3zJ+W24AO0tk4G9EznUqfs8vNWDR/Pgdxlzk4pLqJShm95j+WeIu 4Lz6xlermrrsOgmgZiW7EQUQvzABg+WKdm01QHz23vZbkKvpHEcFZBJp6I4nNelekwM/ Hsrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqc+9AuQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y15-20020aa7804f000000b006e0e22268fbsi11109202pfm.354.2024.02.22.20.12.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 20:12:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqc+9AuQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 339D1B262AE for ; Fri, 23 Feb 2024 03:52:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD94611CB6; Fri, 23 Feb 2024 03:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jqc+9AuQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B256111B5; Fri, 23 Feb 2024 03:49:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708660191; cv=none; b=m6Gv8wP1R1wnrf/Hairuiv60/0tUenJA1UDIXvOnqSEqDhTIvbqVebzRUg1kDrXnvZDdnNB/EZlUrwxaNl6FukPD3ScDesGDEdiEjyd7Us4X1B8YrsDGGlcFVKhakaJJlH8k18wiRuBzL//jPpqT+r6Wgi2hr/yxohmc6bnI7Y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708660191; c=relaxed/simple; bh=TWYzt4cWE702k5VOaGpWj9p2plXpYzNDkLilGGhbLfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TTEH5YVBXzjxuVjcHy3WRjyT0Ug6AD5o325xNoz27jt2aRl/YMhK8Dwa9ibEdp2G3dpinLtV93km3ITK7vaPauxxGJKEnK6hdFmwdGEt+TwfMXQGfJyXu7rwXHDog7Iv0YZt9abVoKUdoihLmNaqMSB8w1oDlQ93YgcqPCbhZqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jqc+9AuQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 9B710C433A6; Fri, 23 Feb 2024 03:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708660190; bh=TWYzt4cWE702k5VOaGpWj9p2plXpYzNDkLilGGhbLfg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jqc+9AuQt9R+RFyxDbEXLasVKrOHbloI3R9NUuBgLCLw7/qNkRGQx0FDzweBtoO72 h8brlCRB+MH8L+ZcTFyn5hme99s75Bi4yFwxKyGPpJ4Dj0L/tBbkaugzGVP/g4LT7D Bh5xkGwUVOqQrB4h7m3JUjxin/esA1qWVU0H3qXtdTAchnGWLRNcKiHzENybnHXQa0 a3vZczf0lGAJUw+60ovLSDoKFZS0KmDHZikCSuPGWL2NTUE3fDZkmzHKr/+i9DMuNP UYKuuqo0AXBvrepPVMMFUkCKqGgtXhxXOx2NvUUexnBYpwTMlAtAwGKrbCzHQcBGdR URzHf17w2vt4w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E373C54798; Fri, 23 Feb 2024 03:49:50 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Fri, 23 Feb 2024 11:49:47 +0800 Subject: [PATCH 2/2] drivers: bus: simple-pm-bus: Get and deassert resets exclusively Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240223-b4-bus-v1-2-2803c3ac4673@outlook.com> References: <20240223-b4-bus-v1-0-2803c3ac4673@outlook.com> In-Reply-To: <20240223-b4-bus-v1-0-2803c3ac4673@outlook.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708660187; l=1979; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=JWFA4aEPe9UmKX/cnL2dAlkZhpNjtIvdqZ32qXjuGyM=; b=qcHy1AJ2U0hzEwKWQHgC3iK0+xqjk8WbWl2uq7fhr6LqaRXcHt0ct/VyrmF1YNi9UhZRUXtJi 6PhcXTFCv+eBZKsu7+gUxThU6jlKAvTTFu0oUsKCCNpUvnj66v+mIiW X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: From: Yang Xiwen Simple Power-Managed bus controller may need functional reset(s) to be deasserted before child devices connected to the bus can be accessed. Get the reset(s) as an array and assert/deassert the reset(s) when the bus is being power managed. One example is that HiSilicon USB2 INNO PHY test bus needs to deassert the reset to the bus before accessing its registers. Signed-off-by: Yang Xiwen --- drivers/bus/simple-pm-bus.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index 50870c827889..d84dbd61c02b 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -16,9 +16,11 @@ #include #include #include +#include struct simple_pm_bus { struct clk_bulk_data *clks; + struct reset_control *rsts; int num_clks; }; @@ -62,6 +64,10 @@ static int simple_pm_bus_probe(struct platform_device *pdev) if (bus->num_clks < 0) return dev_err_probe(&pdev->dev, bus->num_clks, "failed to get clocks\n"); + bus->rsts = devm_reset_control_array_get(dev, false, true); + if (IS_ERR(bus->rsts)) + return dev_err_probe(&pdev->dev, PTR_ERR(bus->rsts), "failed to get resets\n"); + dev_set_drvdata(&pdev->dev, bus); dev_dbg(&pdev->dev, "%s\n", __func__); @@ -92,7 +98,7 @@ static int simple_pm_bus_runtime_suspend(struct device *dev) clk_bulk_disable_unprepare(bus->num_clks, bus->clks); - return 0; + return reset_control_assert(bus->rsts); } static int simple_pm_bus_runtime_resume(struct device *dev) @@ -106,6 +112,12 @@ static int simple_pm_bus_runtime_resume(struct device *dev) return ret; } + ret = reset_control_deassert(bus->rsts); + if (ret) { + dev_err(dev, "failed to deassert resets: %d\n", ret); + return ret; + } + return 0; } -- 2.43.0