From patchwork Fri Sep 6 13:34:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794220 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B40C4CE7B15 for ; Fri, 6 Sep 2024 13:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=Rn7oc60JNrrtrMrudWXVefLRyd sX8Acq2bT0F3IxicihwUC5yxBM1FBjWB6R0gesSwK+4DlpLnTFsRwD/3gA5BUE9XK5e4SC/oS4MHq QXdk3MN8Ue0DYH8R5w4ejvAR3SAjgR9E55JNh9rQ1k7I9qNIP+KWpq4xkzXDnwmQPOiNuKTz02hrY w8ADv6rOdFT08urp6zhJdwlejNR+rfnj1LlEB6CSxAu0XPVfGYauC2/XRnXRHWOtvmyZ5XvAps6I0 wVl1tjTuYI/arADRi5jYc/+khtLS5dTlt3iKvMgBGkA39Uk70YqZ0RgDxLF034RuivgVvUmhzI0D6 9v8jR7Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZEv-0000000CNvy-04TW; Fri, 06 Sep 2024 13:43:05 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7V-0000000CMCi-3bXX for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:29 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42c5347b2f7so16681525e9.0 for ; Fri, 06 Sep 2024 06:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629724; x=1726234524; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=auBQVUy/CJomTzJoxm2b9pgsN2Mc0xGTmk3eg4TJ1TuUAQ+qK84/SPDCjnQXaqCEap M3yDK6gQgnyFloIkLH8iS8/nFaawJp+2vy+1wQCS9Uh5CXPsUzPz/1dIyqPlQxoI6IeD lPbyMQpZbWlTu3z7ZoIf0On8JYTjEQF2MYby/qG3ci/NHlU5IYPwk11kGRfGrxQUPxKU agHbR5XxUzo/Vop5gzvfLHkTWwMA2QZ/oIKPR3JpHQfzzBsK5qNcP07JHIYfN6yttv+k FCMgrzG1dmdZ3Bs4ZS5wI1u6EVbSxjLgzkiU0k9QXuXWugVKmL2g11BfIQW+TsZQIHq5 P14w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629724; x=1726234524; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=bw3T0SHaY0S0Xr5iE9h6PoyprhdMFEBOLDDVzYkTkfx6xhQOI/umITcMCSECi2PFEW e6dHJCkOi9bFCERjpH34WgGcuns0uNKrkehc53Zn96jdgYyfbP/9Jr1FDLmvBaMr+HW1 L681hW+wB8+xG4bDJkir4j+887ZZkbpZU3mDbPm/uWCAZAS/ThdhNu04/0B1dpWxM4rv j6DrrFiPeeexCSoqD4Cle62/SzJzzQRcVjGBUfDdd8dKGVxWbCEaDlj+qBmrdTIgjRHy 8leyWz3tlYotlDM6S19DjNDBiqc2aWYhFvR3uA58oZxC14T3sCdgMti0lfZbB5vC/8Xv 5ZAA== X-Gm-Message-State: AOJu0YxvI0Ds8KTHMCyOTZsij/MDrqGpSSuGYA70zEcxgNTrwEvFGsis zf46SjvMxHIZq43wVgDAwNnhxVm1XQn46k2bx1pzx3JFdF8vFQFTGmRd5ZMCVNc= X-Google-Smtp-Source: AGHT+IGh0HbWA2IvTSqHJmBK+lJ8nsE3aksAjKs/B6hcz+IVxN5XBkRPlliYSkbr5ltAj9mYwc0NkA== X-Received: by 2002:a5d:58f6:0:b0:378:81aa:2662 with SMTP id ffacd0b85a97d-37881aa26fcmr3879235f8f.7.1725629724309; Fri, 06 Sep 2024 06:35:24 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:23 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:51 +0200 Subject: [PATCH v4 6/9] reset: amlogic: add reset status support MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-6-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1583; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=uFpLNDx7axOqsTgkkJPsc6yBsPXI/ygS3MYpVh8ixvI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUSAS3Nbjn5SPm8sfJpgm5HVfxx1YI3Rng9m a7emBSfQleJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEgAKCRDm/A8cN/La hX01D/9jPU8wNhdj3cGkbDsDFOcUizWHJTxZQVNcuuvU3YARiZ2ZWZxxVIO2g+S1MEiVC9f1Xg+ 9cILnAENe6RqjcnmegHUjrxB7wHtVTz66G87kwhuR7kp+92TDUF0iCWSiqE7Sh+rOYKFVmmOVQh nxdcc3rMZSneO8iie3cV++LFLFWH5wR5rMiU57p0dr6hIBgm+k2OQZUXLvX/JeFcY4KKUg4HREA 1BsXFzwkMcz/ZgCrVqokLqtODgO/D0cdd/58UU398+ZwDv9AZjAS7l1DBeZu1tW9o8drO8Gcsto IuTOrD/lNYTolBFNq0DGn7RdZo+cBrW18ZetSwDCM3F5z7/xA/+aabkyh4WAeLLg4KL9kdtJq5Y uk/hOesetOkgJ8gDzcjWPb+suk5mIlbslUCr6FTqomWQxb+Ufdup6FHxTjTpwrQTnpZiJQaBKCB QFVaCzFdtouKsSgzkkIAg6a4e7rI4PAb6eU79NX5XovlY+mk6PKINUJ3rQszHUw6/UFltA7w85w JA59QJVLz8sbJvgxudM1ULR7wz3qYiAMuhOlgbmBv1UQHXrvymqUKHHFRYgghQD5xIKG5tRIfOX 5KypBuiGoS2L2Hxe3PtZX5FbiB9eqd7rthdOBIIbo0sCzjqtua+AG6niI+Nfww0xrqV3BwcWi9J IHxrsEzom9u9wCQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063526_066388_803F4F64 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a callback to check the status of the level reset, as done in the reset driver of the audio clock controller. This is done keep the functionality when the audio reset controller get migrated to meson-reset. Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index e31c1b7c9e4d..af690d3012ec 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -68,6 +68,22 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, BIT(bit), assert ? BIT(bit) : 0); } +static int meson_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int val, offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + + regmap_read(data->map, offset, &val); + val = !!(BIT(bit) & val); + + return val ^ data->param->level_low_reset; +} + static int meson_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { @@ -84,6 +100,7 @@ static const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, .deassert = meson_reset_deassert, + .status = meson_reset_status, }; static const struct meson_reset_param meson8b_param = {