From patchwork Tue Sep 10 16:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13798924 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 58CD4EDE99A for ; Tue, 10 Sep 2024 16:40:20 +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=W2USI4evU1TlZoi0vx0ljC38Z3 sUn1Bwl+1/GsG/tfDpD62uKZSpgWi0uw1C/3UEuFxrejUXKpeR+TQ+uOgAGYcS6MDy6Zu7yBjc0o+ ZeXOMuun2oURHm/Q0+SMQytiwHnS38GguHI4DCUAaLeS3vq4C1WoWeLGAWMlbui7Ne6iI2JsgCnHK vIvGnOgzHMzglVgm7Bml6EkK3K6cogYbhGQ+OPVhb5uPD17ewHhxdpM6pnz1W7IT8E29Tvng0RC75 UdZDR2W1Sks5PkCnAWih5C1e76bWM1tTWCIo7alCZJ25+nCDkNnyR6tUrwEmhySGsHNCfYi8cE0oV yLGwdKGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3uT-00000006NmC-0uxI; Tue, 10 Sep 2024 16:40:09 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nh-00000006LFJ-1hAm for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:11 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-374c180d123so3227245f8f.3 for ; Tue, 10 Sep 2024 09:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985988; x=1726590788; 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=A6dxngggIuJ9wxMppET8hxXABE5udPPlrof/efQ3UzqyUzo40UAywiLwsXtGf7yehq XrBkmEZ9Uq9j8BX8iQxeABuShu6mbejb3gnRWDAWdBQRKcgBiHznYQJjJiVux/svfcuF QytmjqXJ0VuTlQ4KoUjgVZEFfGWI6XXg5cedC+FtfVWXzcMVk7Kx46RvJWrKShCW7Sq3 5ZMiy+C8+CUKE3BVNE4IPM5k7qFdZyWcUtoI04/B+ZLG4bmFAzSoYGwwwOkygvJX7fnE R3GMUjS7RjEVkjpawZVxpBhCH6cgPxO/+0HMIhDdVQ+ZrjmfYVI1OlHZ1kz+xGTbijyX SM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985988; x=1726590788; 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=d2YZc5LbrwbZcDd5SXWc1EYmbfuzcWck6wOKeA22mDxj6ulahAuhCm7c5TOBjInJVr HRX96Hg8Pv4fCxh/ulp5J+WGJYImie4YuZVjF37w6Fc0LL2RtucqAnuEco5jmtstND4m hukx1slBL6dUO3xhAtZA5hZywTDonXCjOH5hFJUa6VpKUHjI9bGiX2kWsWofpPzW1i7+ uCUO2VUfSqMZUes1XRhpNUWY10FEdbu7DwuLvHQyhfkK8u4ywYhveEoMlJ/Vh5PyuXMM cOmBTvntkJyPtGtuBVEWR81n1g6c573OiIH9dgm97yS4SwOCy2nef2Kltwtgz0R3Y28U ++Kw== X-Gm-Message-State: AOJu0YwtdqQuSlWoBK6P5/il018dExjzOuApJXtw46DjiCqMC+GLq2m7 13fdaw02fmtrev9Sl85U1IHTx4pWhPiACnljGbJq/OKIo/zPviCKiNycH+vrt0GY7FPWYt/zXYW p X-Google-Smtp-Source: AGHT+IEAQR9BO+yAiqhladmdOuF5JjCwDfl9NeIYLrsC3j51II+i92+uH3mBlNCFN/eHNfMzuinSIQ== X-Received: by 2002:adf:efc7:0:b0:374:c9cd:9bf4 with SMTP id ffacd0b85a97d-37894a6ac0bmr6234424f8f.52.1725985987538; Tue, 10 Sep 2024 09:33:07 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:07 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:48 +0200 Subject: [PATCH v5 6/9] reset: amlogic: add reset status support MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-6-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@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/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS5Os8nvAWVam3MD2aXk6qjTKElTgYwG+Kmm 81fEj+NPRWJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0uQAKCRDm/A8cN/La hcGoD/oDe94aoo17S/5UrJ6BEEh90EQJYvYYF5PUECrF/0sE2pzULDxN6SQSJCoos6SZRTpKJDn KfICwBxmuB0xw8V4/nmyQedtEXVXk1Kf70mAAJv8V4NL2iSgN1sE2sIjopMdiFIGiFMLwpMbyVW sfadAYSoKlovdC61RAI/KhGdJC5E5Am4Z8yfbyte3uQRta5Exc1qZW/KIQURO+SOLECgobPOWn7 VD/YoCt4b58k+36xBVn220LxPQ2p7824F159MBmZ+jlGLyI8iZGqmfpuSH05Uw1WAy1uRBIUEw5 TffX4O09FNQK/YCrEPOoaoW7rMgmt/i2D1X18yNSShFBaBv1wWy/cVUZoRBIUzj+WItN2gu2hxE OUPLhhrdIy8HHDwZ8rmy/kYc5X41OUYb4SJyVIqdZzTTuFKByz4iiAaB2o2ueh/L3/Vwk1J+TNh CLiKbvfCwo6fYos2qhZKgxESTmGjT+h4jPrgke7pQL4MGr/oIJa8L+EZ2zbYhOqWhY3ggWTzqYR VAW1PHcDfflSvfLSj/kIw4TRupXEGn1E41vRThuQOfKjnk8Bq6p5tE7f+1hMERLbHgArN/8qRyF ujXJXCUB+iLoIivAAWgseixWB5eGPrQ+aNaTm9Jn/lcnjHjLzlPKJpLFH+LpMdtRlmHP6fX6jTA RfjUTfIn8IhRhXQ== 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-20240910_093309_543543_2E663FE1 X-CRM114-Status: GOOD ( 14.14 ) 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 = {