Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp355223lqo; Thu, 16 May 2024 08:11:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb9DKKYhuOJWVO1eQnQtE9QvfQmCncT5dW2v1dro3qrcPTPi9DqO9A5fOb7HXqQgQ57KYqvf4JMO6qQrUdSOiCdaIJnBE2lTJUp03G5A== X-Google-Smtp-Source: AGHT+IGT8fYXaFqKbFRK1oXZlWeAdtL6KyuawgBWJX0yVkUPvnK8ioT1HHXfzxBl5EbkHEtWCUfC X-Received: by 2002:a05:6a00:3d0f:b0:6f6:7bf1:72cd with SMTP id d2e1a72fcca58-6f67bf17740mr4297026b3a.11.1715872304500; Thu, 16 May 2024 08:11:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715872304; cv=pass; d=google.com; s=arc-20160816; b=SlyFRc7VJ/LjHrxrm+xum3TH+7W6d5tmBgDXkicpHfIOjr1CCsH5kIwyBdTVcxYTZg h2s2TwfNEKy6R7CpOsVG4uUBKTqjGe98qZxrvt6ItKtROKJnVUwNKWMyyBF0cQjuEhrm cruGZWy/g58XBClU5w3gsfPlSJbeCXVLF3XCHWeDo65C9t9Gm9vs7JltmDlRTnpqVjkq OZYS2nsGrNEZIhr5f7IyWm5YRPneC6VflJvQ+BPMpbI8BS1XcxqHLYcAfkUp7hcLxyzB obVSwIiq/UyR3JNiHDwcUZCCe6YNch/Fqfoe64ntUEO1DHfhL3/GoMDQDoFFEP5BoYm5 7wTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zRHJOwdVIwklQU4oj6tmH8SkcGKM9hDuvtKA2hq20zY=; fh=RBKmDO9k6QKlNSt9lq13pudUYJmSdJeZTmGe3BrKik8=; b=pYpwBm+DX1s9RSJRnRZ5HPyNN4J3ustjzf+ZzqO7flUFXQTwL6b+dFd2mvlG8csejx kMms3gI+SkzDU1Kc2PSYuJ/+fnRyErgUdQgYh1xqfwTsAJPa8pTDsTF6xILsnNuQN+J1 gxCJbUTGNhn9lOXlSdgn+SD8UMlrEflMWvew491foIR3FLjxlHKK1MmfteGLHD2wdw7E zf+n8AHbzqjUQXA3rE+Qz/dyyuNyPkPqv8qeZ5aRcIj2+GPzb8raAzKj2Fc0M60BbTNk 7tj7WP3rotnXJF0Gj7Ep1KNJRB2w60CHCZA5DjA1EUxcJ4PZl2L52GPD4k4oXLZ4zx/8 rWvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=hbJwNewz; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-181207-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181207-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2b1bb6csi757491b3a.279.2024.05.16.08.11.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 08:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181207-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=hbJwNewz; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-181207-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181207-linux.lists.archive=gmail.com@vger.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 5B3D1B21230 for ; Thu, 16 May 2024 15:10:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1626314EC68; Thu, 16 May 2024 15:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="hbJwNewz" Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2043B14D71B for ; Thu, 16 May 2024 15:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715872137; cv=none; b=FZTJyQysZi0OGndWi7ZOlW5G/vYnw+dYLCqM4YgHuAVOyEuGqr5VFnBLHJP74B8L6zwAlfNhC2eLA5Hj93aF7btAqcdHujW6ZX5bAWNEhjEoOhWYyzvxTPdjxGwu1NjRgjfrUW80Quyb2MOsPGr8R8Bv1sGjLodNQ4WqLP7vWu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715872137; c=relaxed/simple; bh=tGtxQtR7HQ0uRAG9sLpag+dAG8Y70atmcVnT7vJqVsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XIrWWxkrUGD37Tadf3Pzk1HUiiuRNhuMdcakGsTT1TQdAPrEfO3N3c2xx0Bxe7IFJwUO4RmraOkcySKqIwk1rf/31JW4Mctdkx5H1mZqw0LpMq3NFiwVyf9SNqBnKmIBkCMNWGKwzFpu69pFS/V+wnbpvAmVBeLnwjN89+OrpVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=hbJwNewz; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2e0933d3b5fso11258241fa.2 for ; Thu, 16 May 2024 08:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1715872133; x=1716476933; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zRHJOwdVIwklQU4oj6tmH8SkcGKM9hDuvtKA2hq20zY=; b=hbJwNewzud1Oefpi9c5VwSDD8IUG8RsAFst1DYriSvb0AkKWLyEnRXKXQYP8h7Tp87 EdEQ17XITvLG6F5tkmd5zge1YRcT7ihBxmh6rtPdqNeg4TJQluEqRLWVUFeqH3UJPP9j II7hVjn5dq9H/kXFFf6RPOSvMujTbzJFVtNrbnfuqBJ4cpPdnKXVk0uWuFYvULANVmdo fdEHwtNJoILubrIkdfflLp/oboCzsI7YafTfaVUB2wkMclUTpBKBlLthNV0iNKIZFcVa 2LkGWVry1io8Kjmv4HnHedZkZmcmFa98o6uqFom96+fW8tiNMKrls5tBzAiiOcEKIAvY Bumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715872133; x=1716476933; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zRHJOwdVIwklQU4oj6tmH8SkcGKM9hDuvtKA2hq20zY=; b=CJwXoowRQFaoSon7JNaVGGmgfPKE869AmUcEixqLZGFgWZEnNAacp/SqVfdBf+JBHB EaAe4gWPQDcPtFMhxP5tif39SU/IjYYH9We11I34oN1UiExLYGmhUndpN0UBZpKRYurr k0wblJVwTFMfQ6vLxOOP8Yt2KTc4rj+qO0hPyDaCVQmrbzvxvExvDdLZAgXL18sTTbFU 87ERsymQhnXgzWoMqgH/MKEc4K8fti3By2eWhZkb9GxRcJoNYK40Shjt7dJzuafdFhc0 4eW38jjAUHzK0zmLqC4fKD09WjoLjmYuIlSqWYYd4OIUVS0p7BwrnFQBlwWaspmJnkMJ 5N5g== X-Forwarded-Encrypted: i=1; AJvYcCXzoCfWonM+I6NPx7D5DNgno2Uu9Qvn3um3vAKyZEBlpUJc0Zg7w9X1odw9S5mdqUHi4rC2j2bd0ePlfLR2mZpzCJoZht2+bYiRB630 X-Gm-Message-State: AOJu0YzpUk501Pu0vzjFhO8d2hq1myRIXUoMjOhCyYS0w+JmqSeF9tpg HQow3IcLWPiIhGRTsd7YDt2eDHecolSb4wh2HjenVigD0i00IuhwX30qghjUUPI= X-Received: by 2002:a2e:97c3:0:b0:2e1:f253:152a with SMTP id 38308e7fff4ca-2e5204aef69mr132927271fa.51.1715872133305; Thu, 16 May 2024 08:08:53 -0700 (PDT) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:1fce:7e5a:e201:edd5]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-41f87c25459sm309351725e9.18.2024.05.16.08.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 08:08:52 -0700 (PDT) From: Jerome Brunet To: Philipp Zabel , Stephen Boyd , Neil Armstrong Cc: Jerome Brunet , Jan Dakinevich , linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org Subject: [RFC PATCH 6/9] reset: amlogic: add toggle reset support Date: Thu, 16 May 2024 17:08:36 +0200 Message-ID: <20240516150842.705844-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240516150842.705844-1-jbrunet@baylibre.com> References: <20240516150842.705844-1-jbrunet@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Add the emulation for the reset callback using level reset if reset is not directly supported. This is done to keep the functionality of reset driver of audio clock controller. This is expected to work by the related reset consumers. Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 65ba9190cb53..e34a10b15593 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -17,6 +17,7 @@ #include struct meson_reset_param { + const struct reset_control_ops *reset_ops; unsigned int reset_num; int reset_offset; int level_offset; @@ -98,6 +99,18 @@ static int meson_reset_deassert(struct reset_controller_dev *rcdev, return meson_reset_level(rcdev, id, false); } +static int meson_reset_level_toggle(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = meson_reset_assert(rcdev, id); + if (ret) + return ret; + + return meson_reset_deassert(rcdev, id); +} + static const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, @@ -105,6 +118,13 @@ static const struct reset_control_ops meson_reset_ops = { .status = meson_reset_status, }; +static const struct reset_control_ops meson_reset_toggle_ops = { + .reset = meson_reset_level_toggle, + .assert = meson_reset_assert, + .deassert = meson_reset_deassert, + .status = meson_reset_status, +}; + static int meson_reset_probe(struct device *dev, struct regmap *map, const struct meson_reset_param *param) { @@ -118,13 +138,14 @@ static int meson_reset_probe(struct device *dev, struct regmap *map, data->map = map; data->rcdev.owner = dev->driver->owner; data->rcdev.nr_resets = param->reset_num; - data->rcdev.ops = &meson_reset_ops; + data->rcdev.ops = param->reset_ops; data->rcdev.of_node = dev->of_node; return devm_reset_controller_register(dev, &data->rcdev); } static const struct meson_reset_param meson8b_param = { + .reset_ops = &meson_reset_ops, .reset_num = 256, .reset_offset = 0x0, .level_offset = 0x7c, @@ -132,6 +153,7 @@ static const struct meson_reset_param meson8b_param = { }; static const struct meson_reset_param meson_a1_param = { + .reset_ops = &meson_reset_ops, .reset_num = 96, .reset_offset = 0x0, .level_offset = 0x40, @@ -139,6 +161,7 @@ static const struct meson_reset_param meson_a1_param = { }; static const struct meson_reset_param meson_s4_param = { + .reset_ops = &meson_reset_ops, .reset_num = 192, .reset_offset = 0x0, .level_offset = 0x40, -- 2.43.0