From patchwork Mon Aug 12 12:32:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 171070 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2775338ily; Mon, 12 Aug 2019 05:33:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYU55crsOClCh/xpv559Q8QC1X3gAKNp0hqADe5KmZmDFUQj8D+r0jQEeTS7TDXeWvD/AQ X-Received: by 2002:aa7:9254:: with SMTP id 20mr36571635pfp.212.1565613191584; Mon, 12 Aug 2019 05:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565613191; cv=none; d=google.com; s=arc-20160816; b=yj1qskTOepfpZMaL2v59YAFbraXX7BxOPNbDBS6VHnk2LVXV/R8RLHaeUZ9IWxyo4k wA6vYP13/8ybhU3f8dm1RwLA+KRBVCRNXwneQ5FXj3zYiXnOyiuQjR/btaOfw+j5CH+l DZE8TY6st6wxcqjleaWZit4xG33YvCs2FVPLf3+eCMkKhxZaZNw+DNimekSm8nhQ8sb5 GIeop6bnc1Z0ZpQCxLhOdi89HLDpf+aDAto5oYR4PGdePlRwDZot17KocG7SSOckwR16 1VmS7Vwn7aL54uwAeFHrRVz26EmMazethKLA/yRSBrjofg5aWwim9ZrbPAR70zrlhJS1 EA7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=plGjGyOid1jI+Xxis9Als2EenBhEyLHhPcpZxpUYN30=; b=oeb6DFmuhulEtpdotrAJw2bIG4WTTlq4m4RWFxxEi7QuXhCrNIAy+bdxwlzjPHQi8A b/jcpIka0/FqxsEwgrxg+ZoNxjmJGszlsOpcRG2EAXybAb9OBCFfVn8y41frAKhZM8M/ sLxFQB6jF+xnr9XkxItO5EGyD4eQAY7F40reBa53xRpCxRAOQxvkwj8kRbjQjYk8VUJn ZNmypgDvP/EHxDtLnsH4kTlJx7WM18NNLGeu/mrHlEuEIaH5aNNN7ceaPp3fOhd2Garl rvLtxs/nJwpuoIeIonCu8+Fl+soIAsVfxcfj8kvaYS1y5Re8KjKh9e6WrhNulz6Kpsni J4iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=XpYjyWdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o191si6037042pfg.155.2019.08.12.05.33.11; Mon, 12 Aug 2019 05:33:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=XpYjyWdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728781AbfHLMdK (ORCPT + 28 others); Mon, 12 Aug 2019 08:33:10 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40924 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbfHLMdA (ORCPT ); Mon, 12 Aug 2019 08:33:00 -0400 Received: by mail-wr1-f68.google.com with SMTP id r1so5311474wrl.7 for ; Mon, 12 Aug 2019 05:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=plGjGyOid1jI+Xxis9Als2EenBhEyLHhPcpZxpUYN30=; b=XpYjyWdYBPsfSVDPqs6fexsdgC4vL2x6VRpB6oaxOfECc6Mn2cmm6J/8mSgqpaawLe W3P/RY77ybPvnTPMIxOq36v5XwRau6gkHfMlvDqV72+eqoIJVPF6kHoIDGvFiIOBCqDA zw0YxxmmDvx0T4x+sVAPSCxL2aVRncYaifq4S63oRnyjBD7JRlN9bVz0hjexlWe+qx92 8PRyRwf6GVeu2i9C7D9nnDbyh+jNo1l8Ea6i7jHkuXCWjk/pATBN+CqJjI+JIesAcHS7 zdCym0I/xWqggw9bfpyyXbyqvbiSNRMSASOmfrZgwWBHHxfzbvOBKjjiZ60JUQgXmSQJ GKiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=plGjGyOid1jI+Xxis9Als2EenBhEyLHhPcpZxpUYN30=; b=MWviTWcpGO+7sy0tVwRMcEcvEkeLc+4GITuU//oQsoZeTb9lqOwjyy48U3k+gH3Vlc pFKtpPEdVcmnC887rnD1jzRkOdGE5dVdxR4pzKfR4sVtS45uwE9IAm92L9APhCcH0ZdQ i55BMMxHntghbZx8tYufmkWCm0NRdoVcB8nXTDRwL3jKgQH1jv4Er9J8QXEM97bs7Mio jrOhlaENL4ek81mreXUY4JnxI0Marmu79kdZ6qapabYAHV+5nBxlfRqhLhrr2HhSZMN0 xaj1Eis9tQ44J+pjfpZBe7qnTopV2JubNUzhc7ZE6Zhmo02Od8Tsxd64frPQB9JEDMcZ IwpQ== X-Gm-Message-State: APjAAAW/g3KxdmnE1LKjtAXrdQiwZUS/s++/9rr0XWsnKmfpVKMJ6X4X uWnSlOJWwk1GyZY111Y2nSykVg== X-Received: by 2002:adf:9484:: with SMTP id 4mr13629346wrr.14.1565613178522; Mon, 12 Aug 2019 05:32:58 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id z6sm15886432wre.76.2019.08.12.05.32.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 05:32:58 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong Cc: Jerome Brunet , Kevin Hilman , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: clock: meson: add resets to the audio clock controller Date: Mon, 12 Aug 2019 14:32:52 +0200 Message-Id: <20190812123253.4734-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812123253.4734-1-jbrunet@baylibre.com> References: <20190812123253.4734-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the documentation and bindings for the resets provided by the g12a audio clock controller Signed-off-by: Jerome Brunet --- .../bindings/clock/amlogic,axg-audio-clkc.txt | 1 + .../reset/amlogic,meson-g12a-audio-reset.h | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h -- 2.21.0 Reviewed-by: Neil Armstrong diff --git a/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt b/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt index 0f777749f4f1..b3957d10d241 100644 --- a/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt +++ b/Documentation/devicetree/bindings/clock/amlogic,axg-audio-clkc.txt @@ -22,6 +22,7 @@ Required Properties: components. - resets : phandle of the internal reset line - #clock-cells : should be 1. +- #reset-cells : should be 1 on the g12a (and following) soc family Each clock is assigned an identifier and client nodes can use this identifier to specify the clock which they consume. All available clocks are defined as diff --git a/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h b/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h new file mode 100644 index 000000000000..14b78dabed0e --- /dev/null +++ b/include/dt-bindings/reset/amlogic,meson-g12a-audio-reset.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2019 BayLibre, SAS. + * Author: Jerome Brunet + * + */ + +#ifndef _DT_BINDINGS_AMLOGIC_MESON_G12A_AUDIO_RESET_H +#define _DT_BINDINGS_AMLOGIC_MESON_G12A_AUDIO_RESET_H + +#define AUD_RESET_PDM 0 +#define AUD_RESET_TDMIN_A 1 +#define AUD_RESET_TDMIN_B 2 +#define AUD_RESET_TDMIN_C 3 +#define AUD_RESET_TDMIN_LB 4 +#define AUD_RESET_LOOPBACK 5 +#define AUD_RESET_TODDR_A 6 +#define AUD_RESET_TODDR_B 7 +#define AUD_RESET_TODDR_C 8 +#define AUD_RESET_FRDDR_A 9 +#define AUD_RESET_FRDDR_B 10 +#define AUD_RESET_FRDDR_C 11 +#define AUD_RESET_TDMOUT_A 12 +#define AUD_RESET_TDMOUT_B 13 +#define AUD_RESET_TDMOUT_C 14 +#define AUD_RESET_SPDIFOUT 15 +#define AUD_RESET_SPDIFOUT_B 16 +#define AUD_RESET_SPDIFIN 17 +#define AUD_RESET_EQDRC 18 +#define AUD_RESET_RESAMPLE 19 +#define AUD_RESET_DDRARB 20 +#define AUD_RESET_POWDET 21 +#define AUD_RESET_TORAM 22 +#define AUD_RESET_TOACODEC 23 +#define AUD_RESET_TOHDMITX 24 +#define AUD_RESET_CLKTREE 25 + +#endif From patchwork Mon Aug 12 12:32:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 171069 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2775287ily; Mon, 12 Aug 2019 05:33:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnu6burn9tqf/fLGdhvJX53mHTsmR+d+1xbG5nFK0wSzggw6r2eARUmAVxBqAoNlFmJ7qh X-Received: by 2002:a17:902:9a84:: with SMTP id w4mr31768269plp.160.1565613187950; Mon, 12 Aug 2019 05:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565613187; cv=none; d=google.com; s=arc-20160816; b=sN3xOAWxgeBU2Nuvkb1IyG/uPEfrnFSK5lD22laKKAebRyMpjrYUgmBRPGpFrVA2p8 LZWqwVpJtAGZ83vsYy/3L9b6jKwxqrYK+YN/KqpxWonIXjSVK/yawrLii2swJ/Cl/1Cx 9IlQ8YjS8EafmdHrTbmOKAQ9WGmL4UGBcIUWq8dP4vGHFZxzTEtIXK6hXOSQh9OnGzd4 hz4iGW7g5BtJi2cc47LvXJfszm0EC9Cuz0qjXc2fgtVlhK3Jtm0Wu2L30KK4Ed8FE6r2 d9LlwxWTMZb5Wq1f+aaczMtTIMKf+QB27xM7Sbx6cQRpHrJz1wZu6CZjyQjBBoxm8BNr U9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dqJ4n54yjkwbFCEJq5QMHITUyQhmVlnjTeiFqDxqTrc=; b=02YmdLPN3rLeTDnC7LCc5nxwSQ0+PcQsKz7YS2+sZbWqnUsjvkyY0RuQdnKohS5bLF 5mqnGaHa4evhLtu7JS9McE2g2fI8Zae5Hq19un8HHX5N4F+kEmbhgzJnSX+UzHyVq2sq nWfc14Y71UDEhu7OwLqRMIuYxJzyzl/DSL2EelnN8FBpNlvsDe3vpTiTXJ/A1CQ+6v2N MeWCGYMyopD8o6aAcL4UDYNSkK8SsHdyWwuq9YdV2dm4qJ4VlCHeHnkmmQUgMG8XTGVT o2qMgwb/0iwDjGkAx2JJIGeZfCXCMBZlEgwroQyQNZs5j+FK0Av4DjjJ6R9HavNQoB5H X0Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=kv92oP2M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o191si6037042pfg.155.2019.08.12.05.33.07; Mon, 12 Aug 2019 05:33:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=kv92oP2M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728748AbfHLMdG (ORCPT + 28 others); Mon, 12 Aug 2019 08:33:06 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33624 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728493AbfHLMdC (ORCPT ); Mon, 12 Aug 2019 08:33:02 -0400 Received: by mail-wr1-f66.google.com with SMTP id n9so104521783wru.0 for ; Mon, 12 Aug 2019 05:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dqJ4n54yjkwbFCEJq5QMHITUyQhmVlnjTeiFqDxqTrc=; b=kv92oP2M64Bi/XRGqe2z+1du/iOO7SPa2FaSuz5My6Bls2OISMLzxzQOJmnLEo3BeL M7HkQQp07U6ofG0MbpZzf9duWokZdkwK8qM/Ah+qrubLjk+v7LGFBUxOwZIXoWA8/ZAH eSbfFpcn99oNw61Co8/UMA12yaMZesLT5o//4C42HM8DIr3zIJH3l3spikX5rTVVBqJ5 u1IqLYaXOF9pCyXsw6yJRjhhG40K4kcTru3eCyNTaY3AK1s0InOYefn9KaYJRylZm3wA tb7636NjIyS5ke7GYIp566pFb8Dx3iJu/fIz+BXeCd6eMUVcEzWIKG1mKhMItakVRjhj V8gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dqJ4n54yjkwbFCEJq5QMHITUyQhmVlnjTeiFqDxqTrc=; b=RoHadWq+iEqVZK0B/+7HxZ8z+RZlQ7RaxFDnNgBhoaAC9zq9bZbcu0PtQIFXLLU2hd 0SEa7eAWWqDxBLYziEztj1Y+I9u1l0VIsDgzNdeNFnUb1f1UKDz6Kvc9ALM6avKtUxsS H3hwAURKqAo1qeS+H7Uwz0PIWR7No6W5oZi0IRR6U4XG9hk//1OrdbnsoZamRBGS4UyW SFtyZBX+Cdv3rOvQT/SQLz0FLjU2HzvGRyXoETYJGLPhXqiAZXDSPYDJnxVgnU6Fr/mN t/7d3vQmxfX0avQCxwUmdx1TKk4eciPmwT5K0ddg4MAQnIx6RlOoCZpi/FrFjzEicVh/ enGw== X-Gm-Message-State: APjAAAVWpOfTVpsW97jPJaXOTZxkoQfXHTMHSB3fo4UBAw8wbFifOOJN s4CWylNQ1b9uqaLVgM9CveW+Kg== X-Received: by 2002:adf:a348:: with SMTP id d8mr29164772wrb.235.1565613179498; Mon, 12 Aug 2019 05:32:59 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id z6sm15886432wre.76.2019.08.12.05.32.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 05:32:58 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong Cc: Jerome Brunet , Kevin Hilman , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] clk: meson: axg-audio: add g12a reset support Date: Mon, 12 Aug 2019 14:32:53 +0200 Message-Id: <20190812123253.4734-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812123253.4734-1-jbrunet@baylibre.com> References: <20190812123253.4734-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On the g12a, the register space dedicated to the audio clock also provides some resets. Let the clock controller register a reset provider as well for this SoC family. the axg SoC family does not appear to provide this feature. Signed-off-by: Jerome Brunet --- drivers/clk/meson/axg-audio.c | 107 +++++++++++++++++++++++++++++++++- drivers/clk/meson/axg-audio.h | 1 + 2 files changed, 106 insertions(+), 2 deletions(-) -- 2.21.0 Reviewed-by: Neil Armstrong diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c index 741df7e955ca..6be9df1efce5 100644 --- a/drivers/clk/meson/axg-audio.c +++ b/drivers/clk/meson/axg-audio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "axg-audio.h" @@ -918,6 +919,84 @@ static int devm_clk_get_enable(struct device *dev, char *id) return 0; } +struct axg_audio_reset_data { + struct reset_controller_dev rstc; + struct regmap *map; + unsigned int offset; +}; + +static void axg_audio_reset_reg_and_bit(struct axg_audio_reset_data *rst, + unsigned long id, + unsigned int *reg, + unsigned int *bit) +{ + unsigned int stride = regmap_get_reg_stride(rst->map); + + *reg = (id / (stride * BITS_PER_BYTE)) * stride; + *reg += rst->offset; + *bit = id % (stride * BITS_PER_BYTE); +} + +static int axg_audio_reset_update(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct axg_audio_reset_data *rst = + container_of(rcdev, struct axg_audio_reset_data, rstc); + unsigned int offset, bit; + + axg_audio_reset_reg_and_bit(rst, id, &offset, &bit); + + regmap_update_bits(rst->map, offset, BIT(bit), + assert ? BIT(bit) : 0); + + return 0; +} + +static int axg_audio_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct axg_audio_reset_data *rst = + container_of(rcdev, struct axg_audio_reset_data, rstc); + unsigned int val, offset, bit; + + axg_audio_reset_reg_and_bit(rst, id, &offset, &bit); + + regmap_read(rst->map, offset, &val); + + return !!(val & BIT(bit)); +} + +static int axg_audio_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return axg_audio_reset_update(rcdev, id, true); +} + +static int axg_audio_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return axg_audio_reset_update(rcdev, id, false); +} + +static int axg_audio_reset_toggle(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = axg_audio_reset_assert(rcdev, id); + if (ret) + return ret; + + return axg_audio_reset_deassert(rcdev, id); +} + +static const struct reset_control_ops axg_audio_rstc_ops = { + .assert = axg_audio_reset_assert, + .deassert = axg_audio_reset_deassert, + .reset = axg_audio_reset_toggle, + .status = axg_audio_reset_status, +}; + static const struct regmap_config axg_audio_regmap_cfg = { .reg_bits = 32, .val_bits = 32, @@ -927,12 +1006,15 @@ static const struct regmap_config axg_audio_regmap_cfg = { struct audioclk_data { struct clk_hw_onecell_data *hw_onecell_data; + unsigned int reset_offset; + unsigned int reset_num; }; static int axg_audio_clkc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; const struct audioclk_data *data; + struct axg_audio_reset_data *rst; struct regmap *map; struct resource *res; void __iomem *regs; @@ -984,8 +1066,27 @@ static int axg_audio_clkc_probe(struct platform_device *pdev) } } - return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, - data->hw_onecell_data); + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, + data->hw_onecell_data); + if (ret) + return ret; + + /* Stop here if there is no reset */ + if (!data->reset_num) + return 0; + + rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL); + if (!rst) + return -ENOMEM; + + rst->map = map; + rst->offset = data->reset_offset; + rst->rstc.nr_resets = data->reset_num; + rst->rstc.ops = &axg_audio_rstc_ops; + rst->rstc.of_node = dev->of_node; + rst->rstc.owner = THIS_MODULE; + + return devm_reset_controller_register(dev, &rst->rstc); } static const struct audioclk_data axg_audioclk_data = { @@ -994,6 +1095,8 @@ static const struct audioclk_data axg_audioclk_data = { static const struct audioclk_data g12a_audioclk_data = { .hw_onecell_data = &g12a_audio_hw_onecell_data, + .reset_offset = AUDIO_SW_RESET, + .reset_num = 26, }; static const struct of_device_id clkc_match_table[] = { diff --git a/drivers/clk/meson/axg-audio.h b/drivers/clk/meson/axg-audio.h index 5d972d55d6c7..c00e28b2e1a9 100644 --- a/drivers/clk/meson/axg-audio.h +++ b/drivers/clk/meson/axg-audio.h @@ -22,6 +22,7 @@ #define AUDIO_MCLK_F_CTRL 0x018 #define AUDIO_MST_PAD_CTRL0 0x01c #define AUDIO_MST_PAD_CTRL1 0x020 +#define AUDIO_SW_RESET 0x024 #define AUDIO_MST_A_SCLK_CTRL0 0x040 #define AUDIO_MST_A_SCLK_CTRL1 0x044 #define AUDIO_MST_B_SCLK_CTRL0 0x048