From patchwork Fri Feb 23 10:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 205280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp488417dyb; Fri, 23 Feb 2024 02:11:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSNsNVM6Vw3cQM5PxmkWYFRP+XOq2kNRXK+WH6MZqxY1914nBrEm/qI4jGWZVHm+uNKCVwJ/hiYOEVutQY78aMynXmvg== X-Google-Smtp-Source: AGHT+IGQFho79Eij1AqgMPj1scsr/TTOgnaiAqJRHGeXaUkjNZl8OhXT/xm3vWOreEyQdegS4up8 X-Received: by 2002:a05:6214:b69:b0:68c:a83b:b1ba with SMTP id ey9-20020a0562140b6900b0068ca83bb1bamr2303294qvb.38.1708683061987; Fri, 23 Feb 2024 02:11:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708683061; cv=pass; d=google.com; s=arc-20160816; b=lNZXzPU8Xh9pZufHcd1Xr31/ln6BlmuQlKNLkCzSXIm//ci9IuwqJpaUoqsmHqz7uN TDpEDlYw6M/E3QaSk6rlmYnBdZj1x3StQJoU7He1RAvP8RUxMzjiMKErgrj2DMpGn0cf k9vIAIqoIXdWsiZLOmhJhCJtzu2sWQCWr66JO6X+YXT2SyU6B9/QYJ31nqz5+Vptwe9l JP95sKTpsMcgQKZm2tL84+9of3VLl/YVVt7kyhY+UQ6Ex8CtU95qdSGTnlTxI/l4/O0r 1+UIBNHstE78SMkUhXrafIAP93iXlI/n1XzluYDQ9OWPMIwNRaPh14AeUsZR0dnKYYRV td/A== 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=hEpzlRCQW3DHKp4jZLGyKWhv8aUPA9AkA3tyQX7F/M0=; fh=v9eDaXLBM4EIWvXGxm7HVV0FdJjPOnBmQsTyxhEFunc=; b=nlswZxQGqxEJg7NWgwK60cuWZ1r3spbt1oKX4u7a/+87JrnRSVoH4doyt9RnY/KicX rSS1vKH9r2xTPuZJ+lQ6GkwUFAsRd0WNkson7SzFJXI6eChkB+/2dmytQQigv6B1W/Xo GgZf1Gb+nS18HUdoPJToGk4BKhg0c6VjhbIjaEmiAfaW4Rg9bbsAYgrwOOZjZrDy2WvE jj/fuDaEXjz5gmvHY0dxKw3rvmVhWIS5LPNYSbA70mcc9C1a58jHLGlvRl21dmVOfT9u JKPYXbzRcrO7eLuC1+8jwMiJ819ybX8bwSUxs/k85WzuFlyzni2TXIH0LYrdQIywwEBP t4mg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEz3FMCV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78102-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78102-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kl17-20020a056214519100b0068f533cd2e3si13084596qvb.242.2024.02.23.02.11.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 02:11:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78102-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uEz3FMCV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78102-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78102-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BB0711C20983 for ; Fri, 23 Feb 2024 10:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C05855D73A; Fri, 23 Feb 2024 10:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uEz3FMCV" 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 1AAEE5CDC9; Fri, 23 Feb 2024 10:10:22 +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=1708683023; cv=none; b=NPQrqAEimxl97ndlqhUiG15yy5B5PBj3NqSpFyk8t7fv0PJODuay05gfJ6C/0LhXWkn9kubKYzr6N9qcQvWQE0pYirK0tL1Exp4dA/uiD7MJ9C2RKGdY6keE+bd/YU/b5+41nWFxCUajzJGu3kCPYnpIk6GXfUNlbf5DfuhpDj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; c=relaxed/simple; bh=VDASn16XHrLArVByFssljGzmfnx3iO+5GYIVlAb71rE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=To8+9GnpwjLoAxNcaimVXQ3b+92HpVR+IQNxE3IIVbvbZjhlHlnFGZSHMgmVsFjZjtfnW7QgQYuGKAcBE0BiYL/u3ZCCWVDis6nT888j6IVYUe+teLX8Iq34qGG//5AWTthICO5XDlMdgHKp8sRweA0wpbI1a2MzyfkdmMnTnTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uEz3FMCV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id A40F2C433C7; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708683022; bh=VDASn16XHrLArVByFssljGzmfnx3iO+5GYIVlAb71rE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uEz3FMCVFHZ2f0Y/uJSxdXiserLR63OK+2LAqLrXBxnYwYPZyD+obRcT6jZWeOi6a gbaBj5V6BhxjQWw/zvUFray6c5w1PvpG6K8BFfhq05Bgtehp5bO+AkFSsl1Ld6SJU7 G1NsBbhRy6EjH/4qOmwUGxHk7VCCmjEsyHbdI3kh2Mxg5dIWteNapd8tC8QkmvksiQ Yi3CNGAR1WkKZiNtPKgLrgqsT/6yUbZecHUtc1v8YPP8ryZREgv/drIP5hD1Uzz+t4 tZGlG+Z2Amo/kGDKNlr9cn53GazkseGgDF5MgDxHfwjUamTWiHbMc4n3yMGlgs7+8O iGjzAIwf26XXw== 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 88EB6C54E4A; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Fri, 23 Feb 2024 18:10:19 +0800 Subject: [PATCH v2 1/2] dt-bindings: simple-pm-bus: Add optional resets Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-b4-bus-v2-1-da8ba83c1a5f@outlook.com> References: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> In-Reply-To: <20240223-b4-bus-v2-0-da8ba83c1a5f@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=1708683020; l=1517; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=ycKXPbq/zZox0Tf/d90/44XzLN+X/N07MSaWt6t/K2E=; b=agOw8170TwGFqV8jVC0eJJD007zcKmXbtsVJ7/McHN+JkYskRh7W/CLBCbTwN9IkhIkfE3ixC RQGbOxnuHdhAzTsd3e/4fXB+HmhrsluteP4CT/LZ/dUTfl8av+2qs2R 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791684050532313072 X-GMAIL-MSGID: 1791684050532313072 From: Yang Xiwen For some on-soc buses, it is also needed to deassert the resets before access. Document it in the binding. Reviewed-by: Geert Uytterhoeven Signed-off-by: Yang Xiwen --- Documentation/devicetree/bindings/bus/simple-pm-bus.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml index 182134d7a6a3..430638104980 100644 --- a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml +++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml @@ -14,8 +14,9 @@ description: | driver, as it's typically initialized by the boot loader. However, its bus controller is part of a PM domain, or under the control - of a functional clock. Hence, the bus controller's PM domain and/or - clock must be enabled for child devices connected to the bus (either + of a functional clock, and it might have a reset control signal. Hence, + the bus controller's PM domain and/or clock must be enabled, reset control + signal must be deasserted for child devices connected to the bus (either on-SoC or externally) to function. While "simple-pm-bus" follows the "simple-bus" set of properties, as @@ -49,6 +50,8 @@ properties: # Required if clocks is absent, optional otherwise minItems: 1 + resets: true + required: - compatible - '#address-cells' From patchwork Fri Feb 23 10:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 205281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp488423dyb; Fri, 23 Feb 2024 02:11:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZpl4QzzJXWTQyoTsUyd0gg8fycLlK1/Ib0nFPRObH0Z5oBncaUce7eOQivTP+GtOWO08xHKn6bNEG7r7rL2HkVAPDLg== X-Google-Smtp-Source: AGHT+IErUB11m9TmbOYuSlk2qh7DXaZrfz64gHUSGs14r1AAyFChMHxS5+afjldqmn5d7eHbQTrd X-Received: by 2002:a05:6359:4597:b0:17b:89bd:e6cd with SMTP id no23-20020a056359459700b0017b89bde6cdmr269422rwb.8.1708683062341; Fri, 23 Feb 2024 02:11:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708683062; cv=pass; d=google.com; s=arc-20160816; b=K8TYWrdTv0b+hV3ZgQE+KRnvoIWL9J/3CAAKfagM22vGz8+9CnjY2gFjNku9GucRa6 tRbs2UUwoLbNQ6YmMJ0GRqHhy+yF4ObFH3dfZGCrnqnL4TGaoqrkO+PdllsgN8s41GZY IX+xRentRoLhNUNPn+YYjMZXsOgKwlBQtbEezCjQoNf/x0iPcJoBm5HXXHdDSggVf+qt v1ajI5D5MrGfQFdydh2rK3qOWL0+LbU7PYnCFYXqvUzQflsj8Wch/xoxXkdjjZejBgok wuFd/jlCdP3NU8O7WKNRuTV42ML8TfHHue/eCLODaFXLLjJV6G2sXxvlVPPLLVMOKYZf Wkrw== 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=0/tw4h/nOHJGcw8MRwkQ6sJDDsHM8LetHGBhZFKx1bo=; fh=v9eDaXLBM4EIWvXGxm7HVV0FdJjPOnBmQsTyxhEFunc=; b=q0isH5EtKkvZQJLUPECCWlu22eqZPbgoXURMYQ2l+HScT65cHL20CLCIpS3+s0Tgsa pzMUHW2VmxRjuxsPGGFXvbtVgEkgyuvwVLFg0xnpBEqp/Gs0zRqbFS5Sz6VTaBZveP/K v617MfxEU6mLdzVM4UYwtCAbZKzqYvYwERQc/FJozYb4xJQ/v3wVS/puGRWt8qk1JJCE UCeF5AdMccUp3Zr/C5xDU+PdGAoi2A8uzHqa0PiwwbEfxkPxHWeUPL0LMMnTJ67HFBqB aFNrG7Iz/Pxly3Xft4dsRHhRva1fkRL+ybhSWJs+Yvt9R70ajxwDNpjt0JblGnK28hCL GdmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TjvB0QSU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78104-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78104-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a30-20020a62d41e000000b006dbb1f82e81si11928928pfh.170.2024.02.23.02.11.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 02:11:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78104-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TjvB0QSU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-78104-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78104-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B2EB2865EC for ; Fri, 23 Feb 2024 10:11:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D50E75D72C; Fri, 23 Feb 2024 10:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TjvB0QSU" 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 303FA5CDCA; Fri, 23 Feb 2024 10:10:22 +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=1708683023; cv=none; b=mBaxSjv0tEyewQnqTluikvrC26ctbT/JFPMHyiySsVPJPRsPR2x7urJWB2iKPGrhLv+MRQR0+S12EQVWfCwtB55C7BflfjhpEFGt/ItVM69iXNzsYvI58XUvs3HC9tH4ahr/F8cKuxUp7ISJ1ml8eBEk8/sEDWAAx5Q/qq0J54s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; c=relaxed/simple; bh=3U04gKlXchbJ+V24kjC1E8jAr7x4b4Y+oBUhHQOFzN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rvfFjkctzNdGFZdnf91wH6kZMhq96bOCIp3uKDg2ehYWaKwIhCRc/IMIanWY1syYmPI/grJFnVOaiKffHpqbHAblqbOKzFj8GL7qSGFA6l+XsaZx5X/Msjz2UHu/BEMRoKmEEZCOKEVM+2B7L1UdeshmtisatsD4MSZAcZKEJa4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TjvB0QSU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id C09F2C43394; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708683022; bh=3U04gKlXchbJ+V24kjC1E8jAr7x4b4Y+oBUhHQOFzN8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TjvB0QSUvgv3PAcFdrwn2kV1C+sRbekO9orDxO/UtNg7IS0KzkVpTGPUsLWNvnxs/ CJDWj9WiATpH+kx80xaX4LNPwSj2aMyKV2O+iV6DQLzWZxW9UTQ2E4/GIRptnv58xP pb7/fn7KxkjQIjvOCSSkZWW7m/BO6OzEh33fNP/UD927b5R2Q3ioMM243pvAZT84Id GWN4eIjpUxbI8qonSW8503WE7fneIXyRRuKqknjU+0GcLkYudP0BqgbOD62M1vDz/s Sh4XpbZadxwKIHL93olNJNXuuVJDneG7db/HAFIcKVcZvIRGDEFzsSXW0/g7gUavTY +MlMfz9ppnVjQ== 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 A8092C5478C; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Fri, 23 Feb 2024 18:10:20 +0800 Subject: [PATCH v2 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 Message-Id: <20240223-b4-bus-v2-2-da8ba83c1a5f@outlook.com> References: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> In-Reply-To: <20240223-b4-bus-v2-0-da8ba83c1a5f@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=1708683020; l=2336; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=IavnxoIeWBK3APBnyHNZI/y56/+6lr1F3uzJe1D+hR0=; b=MP/vK9i/hsQIRpsFr8imCB448rwViVkMEJMYN2xWPt0Iguka38Nnv3GNOFlLDLlttOq20rWiG hBYhuRFxbd1BPzl4xoRlQ8X0jYQE6ZXq9r0vXmfusoz4ngVIahx9XGT 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791684051018008257 X-GMAIL-MSGID: 1791684051018008257 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. Reviewed-by: Geert Uytterhoeven Signed-off-by: Yang Xiwen --- drivers/bus/simple-pm-bus.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index 50870c827889..f2e98eac0bb4 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -16,15 +16,17 @@ #include #include #include +#include struct simple_pm_bus { struct clk_bulk_data *clks; + struct reset_control *rsts; int num_clks; }; static int simple_pm_bus_probe(struct platform_device *pdev) { - const struct device *dev = &pdev->dev; + struct device *dev = &pdev->dev; const struct of_dev_auxdata *lookup = dev_get_platdata(dev); struct device_node *np = dev->of_node; const struct of_device_id *match; @@ -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_optional_exclusive(dev); + 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; }