From patchwork Thu Sep 5 13:50:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 173146 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp743090ilq; Thu, 5 Sep 2019 06:50:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyUTsur3tHpBhk+bCd4tm8fB/vjoz41RWw4srzDQr9t/vdfn15Nng4G8WJgyIm+wUz/39a X-Received: by 2002:a17:902:7b94:: with SMTP id w20mr3399627pll.227.1567691452585; Thu, 05 Sep 2019 06:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567691452; cv=none; d=google.com; s=arc-20160816; b=vhP7/6kf56xIk9F+zNNTFuhD4+tdutlVK96l74woHd9sqnrl5PIwzSQNQWK39aKfgn IlQ22Bj55mXYGxXM2N4et3OL7jKhLJZNidMr7agYXlVTcDk8GX8Fkx1esVcaWeKjsuu3 8LP0JaaisM+0uTj6Hjx5pOdMdy1isJYKBautJmOSXPPQ4toGuc0W6+/2K23Sz6LTlc+S na8qw8aPEMU1sXJ/rndlSz+KUVdy50kucf2gt7s89cWebFLROj1Via7rr11pixlgAZlQ f9ysI6M1LX4+Le4vgvLSUKSJwrtcgkUyFcV6XBYEwyV+93ABhagH6aPNGFLR6SUsM8bW 1lWg== 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=7lkoesH5emPCZ1WO3WioUS9Ej0K8oiEzZCArs+vDclk=; b=obSEWc4YCW5lmzq22M7nMxmUdTHAAYYuYfC1ow9Vnv3nQhcpv80wx2QYwDRKUzU/ux REe9bQFvVwm0iUFLvkcM0rfVcVvyDVl0qzxT+BwqKWIOtiuDhYN+4pcFmbu2SjC+4FO4 F0a8nRMyqBoGt6J8VoXpo3EqxLSlWtZ+Wt+KMox8d0/umqq3gGefg+MbYdoGHKAB/TQf VZsEAIgP/7xiATyBMmQ85QWcVfLuYislV1lDiPZAmur2BUEKCsTG3Pq8J5LaOD8QgDAg WgxRNuDGF5iZgrnsH3gp1cW2pyM/H1kavLRNTysHYyv159577C4cerFPP8EP6C3nl4kc k+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=GuL5k8VK; 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 l14si1841199pga.567.2019.09.05.06.50.52; Thu, 05 Sep 2019 06:50:52 -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=GuL5k8VK; 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 S1732387AbfIENuv (ORCPT + 28 others); Thu, 5 Sep 2019 09:50:51 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34544 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731008AbfIENut (ORCPT ); Thu, 5 Sep 2019 09:50:49 -0400 Received: by mail-wr1-f66.google.com with SMTP id s18so2904273wrn.1 for ; Thu, 05 Sep 2019 06:50:47 -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=7lkoesH5emPCZ1WO3WioUS9Ej0K8oiEzZCArs+vDclk=; b=GuL5k8VK7SEUa+eInzXIJKoFOrY5XaFAmFl23toxiV9qAxemzM16AiY5hfan5632fD Ar2eIp2Upvmf7AHmPSJnRaZz7ftMWRdjsHuOXlZrLHn/Qu/j9XNJnng7FoZ3hChfhFK3 hOaBNN7s5cqT3FS0T/Qmw5WNPAh2PbxyadZqHbHVd91S1FULPPx0wFL5+ba2EbHP8+28 XpsvjJbsCOEYKO8eVcJGQ9o8ZpZHE9zUHsf9YGglvLcMsAhy4UgdcbhLxIHkMB5H/afR U2zqGMb3SeB8Xb02JsPQcHc4AkdUsVpcdyzi5EJO5VaPLwmy69xBAhSsIOJRB16JPT8T Wu9Q== 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=7lkoesH5emPCZ1WO3WioUS9Ej0K8oiEzZCArs+vDclk=; b=Fb9sdaaJ8EEZlR5HFKmKqEH/j/xwmUe8CTh7yCvHAz+RMbxZm/3XKY8+/CRYMg99s8 I+9xU/0KvXcB/h4mfcMmQjfugZDHcLW7FGMwgPYJpHI3eltaloPBPhFTEoWxWr7e+ydn Gb992pohRhDlEo9TYxjyXG76VHDetKxMsuXVlUe5pYsQ4bEi/onjxUo2hhvgJT183f0b 15rrzKS+65sEhZNOJSG+89fZr0ILP02xjfnxFNKvRaJfJu/kTy3i8WaSyrZtZ9Ejw1rC yHBVi71nXuQS4j8pnrEJ+dYxtKmPf9nxqK84Z1TXjld+vAGxUW+Ic93HR0SyxAfkpVGh wV8A== X-Gm-Message-State: APjAAAUP5Pn9xSPbkfJiOTeXn0D82wH8VyN1b/WdkJnOTITTmWUnS5JF e3hJ0V6KbqIP9PXM2RFwrSuJ0A== X-Received: by 2002:a5d:4985:: with SMTP id r5mr2618861wrq.71.1567691446803; Thu, 05 Sep 2019 06:50:46 -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 y3sm3324893wra.88.2019.09.05.06.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 06:50:46 -0700 (PDT) From: Jerome Brunet To: Philipp Zabel Cc: Jerome Brunet , Kevin Hilman , linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] reset: meson-audio-arb: add sm1 support Date: Thu, 5 Sep 2019 15:50:40 +0200 Message-Id: <20190905135040.6635-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905135040.6635-1-jbrunet@baylibre.com> References: <20190905135040.6635-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the new arb reset lines of the SM1 SoC family Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson-audio-arb.c | 43 +++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/reset-meson-audio-arb.c index c53a2185a039..1dc06e08a8da 100644 --- a/drivers/reset/reset-meson-audio-arb.c +++ b/drivers/reset/reset-meson-audio-arb.c @@ -19,6 +19,11 @@ struct meson_audio_arb_data { spinlock_t lock; }; +struct meson_audio_arb_match_data { + const unsigned int *reset_bits; + unsigned int reset_num; +}; + #define ARB_GENERAL_BIT 31 static const unsigned int axg_audio_arb_reset_bits[] = { @@ -30,6 +35,27 @@ static const unsigned int axg_audio_arb_reset_bits[] = { [AXG_ARB_FRDDR_C] = 6, }; +static const struct meson_audio_arb_match_data axg_audio_arb_match = { + .reset_bits = axg_audio_arb_reset_bits, + .reset_num = ARRAY_SIZE(axg_audio_arb_reset_bits), +}; + +static const unsigned int sm1_audio_arb_reset_bits[] = { + [AXG_ARB_TODDR_A] = 0, + [AXG_ARB_TODDR_B] = 1, + [AXG_ARB_TODDR_C] = 2, + [AXG_ARB_FRDDR_A] = 4, + [AXG_ARB_FRDDR_B] = 5, + [AXG_ARB_FRDDR_C] = 6, + [AXG_ARB_TODDR_D] = 3, + [AXG_ARB_FRDDR_D] = 7, +}; + +static const struct meson_audio_arb_match_data sm1_audio_arb_match = { + .reset_bits = sm1_audio_arb_reset_bits, + .reset_num = ARRAY_SIZE(sm1_audio_arb_reset_bits), +}; + static int meson_audio_arb_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { @@ -82,7 +108,13 @@ static const struct reset_control_ops meson_audio_arb_rstc_ops = { }; static const struct of_device_id meson_audio_arb_of_match[] = { - { .compatible = "amlogic,meson-axg-audio-arb", }, + { + .compatible = "amlogic,meson-axg-audio-arb", + .data = &axg_audio_arb_match, + }, { + .compatible = "amlogic,meson-sm1-audio-arb", + .data = &sm1_audio_arb_match, + }, {} }; MODULE_DEVICE_TABLE(of, meson_audio_arb_of_match); @@ -104,10 +136,15 @@ static int meson_audio_arb_remove(struct platform_device *pdev) static int meson_audio_arb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + const struct meson_audio_arb_match_data *data; struct meson_audio_arb_data *arb; struct resource *res; int ret; + data = of_device_get_match_data(dev); + if (!data) + return -EINVAL; + arb = devm_kzalloc(dev, sizeof(*arb), GFP_KERNEL); if (!arb) return -ENOMEM; @@ -126,8 +163,8 @@ static int meson_audio_arb_probe(struct platform_device *pdev) return PTR_ERR(arb->regs); spin_lock_init(&arb->lock); - arb->reset_bits = axg_audio_arb_reset_bits; - arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits); + arb->reset_bits = data->reset_bits; + arb->rstc.nr_resets = data->reset_num; arb->rstc.ops = &meson_audio_arb_rstc_ops; arb->rstc.of_node = dev->of_node; arb->rstc.owner = THIS_MODULE;