From patchwork Fri Sep 6 13:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794205 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 0D684CE7B0D for ; Fri, 6 Sep 2024 13:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=0v7BMUCMRZeBAOHdSAmB0mwWwkln/JTZLqWnmOURzs8=; b=YJtW6vMFjLO0pB gC3kswjUwOuqzQMDq+mFH6gv/MbgC7TrUElvMzzEUA/KiZb+zmn+abTlGfsnj+VMh5H7aADIxd2QC r5AuIGHVRoLl3NnVHOLFdH8bE8FskBPlsn+0Eh2ZuF5i0SX10NH98yzMDjRb/aG/YTg/nZG3WLxFg rsc2u5/6mMKyCoG5ZEiqEjsv3pyX2ApGXqQEExNzk3HKki6yH93bITn7nsPP/Hj/+vCPpinO7NWVb YZawYPRVHCVyoaMQpncd7klgvLVymPEYXu5jHxblJT3PYfKrC6+sfQe6Ve37Z+BDshM6NINJyvmip ywt7ns0I02DJVKTeNeXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ8D-0000000CMQ7-35DV; Fri, 06 Sep 2024 13:36:09 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7S-0000000CMAO-3nQe for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:24 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-374c326c638so1383435f8f.2 for ; Fri, 06 Sep 2024 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629721; x=1726234521; 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=/k8Vw9s8c3vx1FzrrsUK66X+N4rd9Tj8aDo0ScuGc6U=; b=YaCl0Y++HiVK7k20fbiC01uv8/tdsoaGvx8Fg5I6WxhIpplemyloENz+1nWYa79SWe 2E6lvpadcriZSA7wU+MpUX7PC9l7nrzGbDKCbak6k6W4I2/qQCwKYPN1u3+AeTI6GHig FALxm5XSNutAcNL1ncGQ7DfqLDQxxNF3YaukICpycPqjXhfNn4A4JYk4HANWnUHM2IYi LuWPzvJNJh/WkukWnHjdY6yZAkMOlzCIsmcdWnO0EGPFSG7ICPEAABf9xPdjAW7mdTVJ l5ubxowiDe6CzaOXgQ4PqtRzgJQZJqaTsmGcfM5LE5gnxylbWPJOR83TAKJC3fs9DgJy vVPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629721; x=1726234521; 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=/k8Vw9s8c3vx1FzrrsUK66X+N4rd9Tj8aDo0ScuGc6U=; b=kzCSWQDpuOJYVrw4/fb9m8IN2vG40fu3cakn3qBZMTlDn9Fj6ZvKGL40uiHbQCja40 u8+hkPtV3k9I5yIzR86XKv9+FszyJs9BUdh2lhjtkShkgu1DuhHBrp7jCzcuscHiCKdO rbW/D8Wumts16JGyCfbtD1Roy4cpFfPAqFYXu+b54XgFx4AjJqoIRI9H4GhHKnF2vgMf TM6S6+vxfxwcftGtKBJJLvtxZEN0LlSdLiI6ZJcddH6mFUvmutjFed1njjCEY5UQfBBu Y/PJ05Oj/CoUTMeA0Oc1HJrXBLbLGOxp6aD/R+It/H+IjveAHEjtgcdZb2jHbe5hfTf4 EF1Q== X-Forwarded-Encrypted: i=1; AJvYcCVWYVUTUplfmiV6DwgGWjerwyQYyywcJC6zYveySpxi+H1TVOVIeLAwby3KGG+E0CXmnBdxOOIVXZkYVIHz@lists.infradead.org X-Gm-Message-State: AOJu0YwfQ1xugSQ2b1JFYl6aux0iuHsNjF+ja32rhv6KjR23Hzn3zI4j lP8Cv0e29pRGsZkTz0kaI6W0JOdndwsdfwpKWycwbtqCdfJaaHIvYkmEpMhK2GXHkf4C97HF4uF 3 X-Google-Smtp-Source: AGHT+IG6zGp+EGPyl2G/sbXQM+iPf9ynjtzmZ9+oRa6GrrDLZwIH2kFh1EK96Z7tR1FuVnxf2OaClA== X-Received: by 2002:adf:f610:0:b0:371:82ec:206f with SMTP id ffacd0b85a97d-378895c71b8mr1873113f8f.16.1725629720180; Fri, 06 Sep 2024 06:35:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:19 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:46 +0200 Subject: [PATCH v4 1/9] reset: amlogic: convert driver to regmap MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-1-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=4710; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=nr6iNBU9QPCIvnO9/MQUvPA1RIWVyVRjkH+HH1AHiQI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUOaSvOFexQNmqHkSGVtcoiU+q5cdE3wWeos pGVbRanLvKJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFDgAKCRDm/A8cN/La hYXbD/9xqasTIEVkwp3pKd+o2zGkOPC0wgIxIRtlVKClkbYJ6Obm8DdMqe3C080mzvx3aQdj3BQ E+sGkfcg0+gFc0bEz7G5fv2HxkMiWOPO8HtxjlMInf4ncihnVGxWXnzDQujH1Xvnv2D1yz5wY+U S3wmUEo0Uh362C8F5+uMhaunHxEYVMPw6p2cQiRJdBy+1QGlS3uKMJ17dxG+SnNhfYvOsahsKoR XfmQg8tbZUs19uPqswVBmNZAowF548LF7Y+zPxtve0oGSCHyA22sGxuSFol2osUbAk5cnQl1Z5v DNoM7nQm6MHspbLdY89r3SXEyTvBLw+XSzd6vAwvTfjgQZ/ZwJ/Id+XL1RDGpmylvhMs3Tf4uA2 ZQjloABTRZJ4DiW1rJbAePnOUnjNmtGDFV+Y2FmmgRBqc8VTj2DAVKEJs+e71PfrmEGhUhjvrwZ JWG/54oT8NXUfkrhickGdU0iI3YTvYfSgnowcCCiaPzXn9P/7J585vtGXiPMUM/EMIGCRplVsjY /WzuRwoOOsQbyvij3SFUrhEYaX0K9o0VZ2puNlAlwrHGjN4OuAlbKOPy1cteyErWbRPItw4xn40 tUCpjnZIQyMk9nbMbErpi7dxJ1OK0WL3Ti4NeFfWFV7C2UzBn4Orrmn4Ra+tqJIrrJ22eMkbloN YQFDPL/27gC1EUA== 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_063523_110272_B05B69C6 X-CRM114-Status: GOOD ( 16.63 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org To allow using the same driver for the main reset controller and the auxiliary ones embedded in the clock controllers, convert the the Amlogic reset driver to regmap. Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 79 ++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 1e9fca3e30e8..9dd38cc209e2 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -11,36 +11,43 @@ #include #include #include +#include #include #include #include -#define BITS_PER_REG 32 - struct meson_reset_param { int reg_count; int level_offset; }; struct meson_reset { - void __iomem *reg_base; const struct meson_reset_param *param; struct reset_controller_dev rcdev; - spinlock_t lock; + struct regmap *map; }; +static void meson_reset_offset_and_bit(struct meson_reset *data, + unsigned long id, + unsigned int *offset, + unsigned int *bit) +{ + unsigned int stride = regmap_get_reg_stride(data->map); + + *offset = (id / (stride * BITS_PER_BYTE)) * stride; + *bit = id % (stride * BITS_PER_BYTE); +} + static int meson_reset_reset(struct reset_controller_dev *rcdev, - unsigned long id) + unsigned long id) { struct meson_reset *data = container_of(rcdev, struct meson_reset, rcdev); - unsigned int bank = id / BITS_PER_REG; - unsigned int offset = id % BITS_PER_REG; - void __iomem *reg_addr = data->reg_base + (bank << 2); + unsigned int offset, bit; - writel(BIT(offset), reg_addr); + meson_reset_offset_and_bit(data, id, &offset, &bit); - return 0; + return regmap_write(data->map, offset, BIT(bit)); } static int meson_reset_level(struct reset_controller_dev *rcdev, @@ -48,25 +55,13 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, { struct meson_reset *data = container_of(rcdev, struct meson_reset, rcdev); - unsigned int bank = id / BITS_PER_REG; - unsigned int offset = id % BITS_PER_REG; - void __iomem *reg_addr; - unsigned long flags; - u32 reg; + unsigned int offset, bit; - reg_addr = data->reg_base + data->param->level_offset + (bank << 2); + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; - spin_lock_irqsave(&data->lock, flags); - - reg = readl(reg_addr); - if (assert) - writel(reg & ~BIT(offset), reg_addr); - else - writel(reg | BIT(offset), reg_addr); - - spin_unlock_irqrestore(&data->lock, flags); - - return 0; + return regmap_update_bits(data->map, offset, + BIT(bit), assert ? 0 : BIT(bit)); } static int meson_reset_assert(struct reset_controller_dev *rcdev, @@ -119,30 +114,42 @@ static const struct of_device_id meson_reset_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, meson_reset_dt_ids); +static const struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + static int meson_reset_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct meson_reset *data; + void __iomem *base; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->reg_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(data->reg_base)) - return PTR_ERR(data->reg_base); + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); - data->param = of_device_get_match_data(&pdev->dev); + data->param = of_device_get_match_data(dev); if (!data->param) return -ENODEV; - spin_lock_init(&data->lock); + data->map = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(data->map)) + return dev_err_probe(dev, PTR_ERR(data->map), + "can't init regmap mmio region\n"); data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = data->param->reg_count * BITS_PER_REG; + data->rcdev.nr_resets = data->param->reg_count * BITS_PER_BYTE + * regmap_config.reg_stride; data->rcdev.ops = &meson_reset_ops; - data->rcdev.of_node = pdev->dev.of_node; + data->rcdev.of_node = dev->of_node; - return devm_reset_controller_register(&pdev->dev, &data->rcdev); + return devm_reset_controller_register(dev, &data->rcdev); } static struct platform_driver meson_reset_driver = { From patchwork Fri Sep 6 13:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794206 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 7AB88CE7AE3 for ; Fri, 6 Sep 2024 13:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=xDB+mJ8NnJVuw4S/+39ioKqtowivvXEs2McmPDbQ4TQ=; b=Dk+tbVcDNB0lmk EWJMvYhmwh0Jbix5c7BnKl0v1hR1KerrajGvfGD/1QPE07JPA1t5rmthPyZ75tqZFzyY12cm4FWBx 0yNyD0XV0DKJ+2ENeZTRW8MGMBamHefiIPxSIu6yepLxZgjlWxFd2tArMBY0ApT0TOfbY2lNtliRJ JiXeuAtw9aIqYHaZbwwkCFYMeKAP+pp0Ttr7SKE5gwtc5G43WDlo0+Hp0juNezZ1dAGp6eS2q7rox BxWUdvYi/2b17U6u4kwRqBU+1DQsv/d/iqcTBKqV3QpW6sidQywDTZ1cY7rpdNud0NO6GSARGtrWt 7TwMiXNrGmt0dAOzIsug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZB7-0000000CN8S-1tgo; Fri, 06 Sep 2024 13:39:09 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7T-0000000CMAS-0JBj for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:26 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3770320574aso1123168f8f.2 for ; Fri, 06 Sep 2024 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629721; x=1726234521; 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=n0U3ETN12gpBLws4jxOpUFqH+6wugx8Wdm0xkOdNhP8=; b=NsQDNGaAH3TKgPOsWS9Rsz+v/UEDQB03FAm7SCefYhfRgtiIRQz+eqS9pLJmcqwoRw U0zPwkgb6SxWT3UAxkoMq3tePJqr7+MUmrPVCehsR6i6s9RELW5yO+7XAife6hRgXZ4x 4b01UJHebLYoQlCB5ZGKL1AAHNIJ3toX1c8/7FqF5GymmZMUQ12aZEQ5RFebnD0baVWO 8P56WD5lwouX+XDyRKR3hAlJXpa+q2Vj9K3s8BmakaNo+JAfg/CX54nzRb8czD1VLBrZ POBDjXiBTxdp3GVK/TO1YeMSMdW1wgmVDTAGhsqtj+NnyagRBvDIMz2VR5u422z4T5Bl yEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629721; x=1726234521; 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=n0U3ETN12gpBLws4jxOpUFqH+6wugx8Wdm0xkOdNhP8=; b=n+dxRneYZv0TO9FB+tU+xm28QjNC5sGq9ebIzTrubBYJsZcC1UwQcW3RKWbMnYUPAN UkD3C1bzrJGt15GtzWDiIEHMLtjRXoGLlpKdDvViUZ2ZJaCtn0IKk8mnFFELRZlg75Lw cjWjdyotrrrB1VqLsu3BCQINx9Xk8w6LokH9IywZ9lD3gxAGXS6zrV0uvF69yl1c2agX UDqHcGORD+O6EUpP9Kn/2ApdtZSqAY5ym76FH+EfUj41DBAndS0TXX/MMUPxf8oGMWfp OamE4G2akTNcqqNwa+QGyAsapXzK2I01E2+0JA+Y7eYeWwCvugDU+LP2sy9kDtuNjLM4 kFGw== X-Forwarded-Encrypted: i=1; AJvYcCV+W9nmtqFm7HMDTiU8aUksumwpVH6H28qPXMPY2yIJV+mGEJ8VmcTgXjZgdjsprwiy3F+25NWLzajGJ6td@lists.infradead.org X-Gm-Message-State: AOJu0YyCMklX4D4VnfQrkWOoJYcyPFnJdj1W3jmP2ylspOBnLxEb2XHK v4bicNjsMQTzUrFsdXi0M7Kpj+Bb9Yknzk7jWkQnct1OzLaZZopFmhxRBojo774= X-Google-Smtp-Source: AGHT+IEck+AkM1e/F0oOBSh0/l7dodO/LMFTYdYmPo9Gy7QWWQWyEDnvdz0QhdH2CJo/6tO+xwN3iQ== X-Received: by 2002:adf:f582:0:b0:374:bb1b:d8a1 with SMTP id ffacd0b85a97d-378895c8952mr1681058f8f.13.1725629721019; Fri, 06 Sep 2024 06:35:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:20 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:47 +0200 Subject: [PATCH v4 2/9] reset: amlogic: use generic data matching function MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-2-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=817; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=TBFxeGrFtyl6fNkBC1RzGGAepksDKxjvf8LT6xC71TA=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUPlC/gkEKuYmmJSQFov72bIlxBAfcOhgW4+ tmdinirt7SJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFDwAKCRDm/A8cN/La hQTKD/4pjOSZAMxRwxoSirqwtsKwMZIFFQfvnMpj+2MVvE21rHthawohviXi+usbOJmPUVQRXAJ HHFX1T+o1qac3mBV7OJnyYJUAa9oyOuAEtLVCacbf/7TWUqZMXkE94/X4wCXh4Yt1BXpb8Q6oSU fIO6fPEWnp9RMgV8/nxVDYsV90TieDzn4NSn83gi/HVVTNJ2yXNMy2DjFxnuX4z4SfDIx3z8vlq DItjRZA468lzaiwM296nMgxYQsaBbaZIYHJbNT9GR8RJZB5GHo/3mQc/+TJavvQ3SD5sfbtQ9PE HTz4fwQfparPEt/35j1yhRdt03MA3szrle8mRZOTGA65+ZqlnHRrS6wdMl9DYApZbWbZ7lllcKC df42W1hHxnAPHGO+gpFakwaSQ9eNrUgS3p5Z3fQ6pZ6FHhltqf6pSbKDUh7YwTMctpA0eFgoaBI pDTfOkbf+ssxJLITWhuK0vCpTSuxUP7HjaKS9ImfIN6RNskQnkW6uGtuk5/fcWR2bEgy9MTorKU piCPrf11mlVRG3eqdlUyn73x36SIg9qHAfpSe8mprHa/ns8KjOlQpdbeaPS1jlvr0OVz4ky8Xsw 3xH6ZVD2EvQvgiXrz/y1T7v1MNRxSV187cbhXr6cfzb79j5HqCXVQZ83oi/hgop+0Z6dVJmkJ0l O8Q4U8PHuYbHXdA== 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_063523_204545_B4B7E1B8 X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org There is no need to use the DT specific function to get matching data, use the generic one instead Suggested-by: Stephen Boyd Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 9dd38cc209e2..848c2d88503e 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -134,7 +134,7 @@ static int meson_reset_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - data->param = of_device_get_match_data(dev); + data->param = device_get_match_data(dev); if (!data->param) return -ENODEV; From patchwork Fri Sep 6 13:34: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: 13794207 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 E1258CE7B10 for ; Fri, 6 Sep 2024 13:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=w2k4u5IXZmkut1lazLdLquzC3lWpNU2sXa3JEL0JAIE=; b=hKrIcanfjej7HH y7W1rv+hD7npKv4L8p3yUQ+qq7LmJdo0xq4/U4flvhK4rz7RDlvD34GFepUZnV+jIOMyH/uuSGqtv V2y6LmP5oq7u+lUsV+SC1M90JoBRJSvxMRB33RqI//WKcQFXaZCXA1j8K8NTtI9hv89TP6ovw+NiR kmD0i+m9WTZNr6W/+EQg8uM1w5jivngEpa0UMCAdfVOCV5wQnWa/M9YuwjtCHRA9gGY7OfWhaw+ei dUXax0IIAT+e/itaEU5/7nL3J5xL45v7GEeblUXTwxDPaJYCSZQW9Ov/Xu0I7YRUX8aylll8lJqjq x7WunSJZeK4fKZRRZ4ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZC4-0000000CNJt-09iV; Fri, 06 Sep 2024 13:40:08 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7U-0000000CMAX-0u0h for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:27 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-374ca7a10d4so1300567f8f.3 for ; Fri, 06 Sep 2024 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629722; x=1726234522; 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=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=qEmog9pmXK1clKYr0aTVCCpDq1mE3Uihbr7BzuArW+/w6ZPvRVIDSL5JL2dNr4X5Kh XKLKtjtd72Tc9lUtbpXxdpHMdrYBDXcmsWsh11K73MiFXpGPFiao0fl9Bllx433RDLrm fKdcZx9MBeHp1B8gnm8qGhRDVlT6q1OxVrQ0um3asGpzmH0aDUTtH+zAq7euX0Lnsj7h 0xdrUUi0c9I5IlGNXQWFXTAh1k6nWviJvpV2kzQmFRlF2slidMOTSRc/a7GkZsx24GJ6 qUUicgyWy+QFZbPKWcGykmUTZqnOCDi9ZgxHO5C42OX0HurBcwHmIHyaUmen5f/oaRaX xgpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629722; x=1726234522; 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=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=Ypp2mqVD3nRqeEgLWBenNDmH0+AFKYLd0lXGMRwh/8iXTqR0mmlbpmaDt6fOryFG8y qSgCOVzbNBPd8yBBCYA1drAdi/iZFUelRllSAh/rqwN1gVBPVpwx2lPKhflGu6MuHt4n z0nbNjKfH7TiUStPNheLrtoFZ1BkJLJJrPHell5g1lC4uRB7O0Av8Sg85AscbtDsP28n T656QXhHJFJsWU4E2iiqyhuqoe7703M4Ghc7sdkEOoD1I2Yt3DqPJBMQm9P4wedfLnFh Z9cfL7FIHq7cXuZen/7sGTnXFczZNyDgV5yjq7wRn8mNRvkJy/1OAMN0HZ503qS0m0/o Qejg== X-Forwarded-Encrypted: i=1; AJvYcCX0CkH29LfCGf+x+uvlNHChDCpwIKuQOGdZfpwPLcZuVVfbXFvqtwZNy4pO/nlWJawOz7JSW9ZcTnKhzvtt@lists.infradead.org X-Gm-Message-State: AOJu0YxSJdS47XOW6AcdTCkHY5WTzNO8qOOw8die095LX1T9o02MHmns GsXHzTSahdsPkwWOZb0yOUEWE+4ZxA6p4tjYoz8FYQxJleu4NoKEyeifIoUpnvs= X-Google-Smtp-Source: AGHT+IEwO1wdUIgNHfUjloM9p7/zFIXeW9bGZBl/gFhtcN9dlE9gFZ3qMxWb8RFlBR6gNKwxbZsDRw== X-Received: by 2002:a5d:6489:0:b0:378:8dea:4bee with SMTP id ffacd0b85a97d-3788dea4cbdmr1782508f8f.33.1725629721865; Fri, 06 Sep 2024 06:35:21 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:21 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:48 +0200 Subject: [PATCH v4 3/9] reset: amlogic: make parameters unsigned MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-3-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=737; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=I6joFYKtEZpmpOu7whQFwYwYWPHiUyzVlrs8QkUbiqU=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUQZPuqhHgOSA7hBjezMd0lE2tAgtqtIzJ/g bQLwVOijb+JAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEAAKCRDm/A8cN/La ha10EACEv7fsnJOpH21ZFCiItZ/Yqvl+n8x74Q1Gz3GCAc/jBem4TBUzXI6KtVmikN4Hp1xbDLD emfslboEq3eLb+CV1Cd3+f1tVDWTrHPl9v5lzr52rrecxAc1byBWQnfX8GQIIG+G5BLVN0NT1B9 ekvTWohL/zIEsekBTTjWQW1s+n0TSsXO2wBYWKK316irfGP1q91T60SmnxoPoHeeMh+JsNClAD5 oATwmBoEfx0Im6PXo7Og2aZsdxYUTkHJYIYgEYzhG99Y7ly06aVRo65pDtIn7JSKX95B2t/PUz1 Flo8XVHGvqdiXTRfdAi4GRXHZuYB7cFafY/P/e1M8jFEkhaSUWzPAMZi1qrWfxjYTW4IYTdS8ul Y+Idcl5yZfRSnlr+pbsXfM7FXmPJEYXna6QY7FCwXn6Elf+FLRRB7ghZCygO+fl+bzpxBmgJugC k3QttDeP9hdF8b00E4I9OlXhUgDrkzKM375fYNv2GtTGSZRu0YQODBASHGHKS8wuQGvlpND7IaH WBAG/6x33vTHlrCl54/7IF64OMCwBSlRfHnRwQuOp3DmSlFPJlRYdrzT/6sHQIq1KxB3heHGO6a xWEfwzA9MZUSmlv62mF2hhCIt2bt8gEQHy9/IvanxrnOJ7Bc9tURlajy/rPBw7wRuVAAwF1o1tm bSnaYfrHA1sD4pQ== 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_063524_263725_C38986A3 X-CRM114-Status: GOOD ( 10.14 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org register count and offset cannot be negative. Use unsigned integer for this. Suggested-by: Stephen Boyd Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 848c2d88503e..50bd2241ef2f 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -17,8 +17,8 @@ #include struct meson_reset_param { - int reg_count; - int level_offset; + unsigned int reg_count; + unsigned int level_offset; }; struct meson_reset { From patchwork Fri Sep 6 13:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794212 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 9EBD1CE7B10 for ; Fri, 6 Sep 2024 13:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=ZlvdD4+4NJQYglI0zY9EOqll2BO+gdvyB7fgk9Ap2oE=; b=DornNgld+wYq3g e8Y6C+XlvDeVHAJacGDUO0oroL8MfeuRhB1dSSqvT1jW6gc0KoPlDI94Av+FJUndVjcVrmEBksSAh ViG97CBI8A0UcNukvkWOzx8bZnbMXGTACenhAt7rE2ZGBmsFZj93RSWWuV1nTC1U7njU4+5LWNDQs e5h/hMq2wvz2LGVyOZCaYTY2TSJFafPc2BYAbk5+0aVB+URtDu/4yAgXZg9K2+OgREmZjGABtNQRI y0trTJYvOJgjR3lHBKa2gtcL/8TgLCtvjqu3UnXg/EH1B1xvat12iuLl/lNbwTVtHUb8Ug4/1/lkr UIUY9CPVlQpFExsH35KA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZDy-0000000CNky-20E9; Fri, 06 Sep 2024 13:42:06 +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-0000000CMC8-15bw for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:28 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42bb72a5e0bso16634495e9.1 for ; Fri, 06 Sep 2024 06:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629723; x=1726234523; 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=O/Yf+6uxXV0kV2P21eOVpIseB4Hi71hF6SfqZ+9Zm0M=; b=fQXxMMukRte79MlkU1al/pumsP0dkFRlIT6IhXEpE8U0d7gTzcy/3RITirjRP1xzhP jvLXCpwRdunTsmizxgwq1RpbZXlknUs8qtyMNwoE2Rg6AW1JGWV+SSsL4+OrgY4VAAMG Qp85p9ceiZ1Mpn0s5r3wIWcqi2E7aZEmm5glsbSOPc4YvbF37cfKj8SizsuiJYacCTu6 CSiuhSA4zdO90R8uE/ipb4gVbyp/i+CrroNs4GBm17Aj1vpbGhAkug+qphiqZb87v9uX PrLn3zaXbmVYoAdJd4cKADw4PK/DzdCtRxdE7AyzpCZ4IU+mHyDSte0EKKNdW0npZ5aU KTWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629723; x=1726234523; 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=O/Yf+6uxXV0kV2P21eOVpIseB4Hi71hF6SfqZ+9Zm0M=; b=uWWJ1yDDiYesvLBMCPVw/t3zNEKZ507FxHOVlQ7HDB4//we0oMIe4fZyV+jp+zq/Ak lyYKeSMPOdKV8cMJRlOQ9FTONTADT2YewzIXuTVm6Rc+cafIUmVr65+7Pgha0tWSkHn6 gguqi1CkzjTfE6PWfO/VoQTbujMmiAVFr9jDp78dkG3cCxTkRbThm4l6aTGYECpYH66H 8zYJtVLwuHSy+4O8vVdYhgZpnETulY2TfX9MYc9fs6tQyJANLveadA9h66gu8EsHkrqG VVTTlLEqqITrDrBtdL1kWd//LeO23/owiSUz3NaZJ76xQvbAq3N1XjBy/4xjQo8Tcb4T fA1g== X-Forwarded-Encrypted: i=1; AJvYcCUYyZ5OS/ifuBqncqDIyxCOvPOjbVk35vYwHNSMug0Ozuq5s3WMP9O0eWp6TLD45QLxHijDZuor5FHHwyFm@lists.infradead.org X-Gm-Message-State: AOJu0Yx92mJp9IBhVQElcQiXtwn5A0V3dCuCX9nUl8tiwwSjK+CP8COP znieKJou4ilbF1YoN0yiueG0jMj4b+c06MfUy4Y16SBNOf2vUlQ22Yt/d59Ur6A= X-Google-Smtp-Source: AGHT+IF4VeYSejIOXDRrzU8oFu6IoWvoH1EbJ5dlPLojrpKx18ZFCT5/tQgZrXuWY+yDBawS4bkpsg== X-Received: by 2002:a05:600c:5102:b0:425:80d5:b8b2 with SMTP id 5b1f17b1804b1-42bb01bd7f2mr186682155e9.16.1725629722686; Fri, 06 Sep 2024 06:35:22 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:22 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:49 +0200 Subject: [PATCH v4 4/9] reset: amlogic: add driver parameters MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-4-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=2306; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=G/tkeTFlEEIIRl13gZHjvQ8SKXa0knkQG6ZsLKG6Sak=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wURQtL+kwNEuoxQUrfvKDLVp+YLuENebFZ9b EI5WC0kuH+JAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEQAKCRDm/A8cN/La hTELD/9DwP8483wvZNoxdOUqFzHXI3fW9Yq0ENw8+O5MWleGZI7s4zhbM5tR0nhZ+eKIJ/04OLH uTBXT/3cAuJbsvKvZhkfHNYFLmwIuZ8TnAeKDv3FOCdOLNI+eTxU/laPVSffIlMeL0IaSmXArU7 rAtJuSsfQk85EWJAC3Pukr4UTlixjjA47G3MTYNX5fsYwFnnir96qY32HuM1IFKUoeHGqYcg5e/ xfhXtHap04BOu1MW8ivfRiPP+VcqbHyiRnmHUgSWD7oG+lv/a+5j5j9B4nsb3v9/9EOQ/QwqiWp 90DR917dWwxagt/dwUl8q157/xg8F1v2LjbQNxNzkHzA+0CeMtmzHEGS65jGyC9xigrqSy2I6z/ EoFCKxup+FH15RJm3EPgL+xLoy84E9w44Rx9Y4IQgOsjaFEdyPhDY1Qk0UBcZLynvqxQSuIOZv7 E+RjWDMPz1gqZyp+i4PabmhMkAXe8/4MoXWG+Dc3NX3gk0vS2Kjoc+cfQPBHFnSV+XOkG0FZjyG Wf87NMBWnjbOilmSXsAVHUZtRwuI+j2tFpeKFzd2Ct3KM/irXsIixyN8G8gQ3y9uDjViSD+gYrz U6VHtXjD7AR+tNrrBdSxscGgheUbcmQNcnYSyJmP07GxaxX2z2mgTIhq3iKkZDOEpyzcn+BvtMy Rk9kgTHEN+8PZGw== 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_063525_483003_7FC5E0ED X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org To allow using the same driver for the main reset controller and the auxiliary ones embedded in the clock controllers, allow to customise the reset offset, same as the level offset. Also add an option to make the level reset active low or high. Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 50bd2241ef2f..6a90613c8095 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -18,7 +18,9 @@ struct meson_reset_param { unsigned int reg_count; + unsigned int reset_offset; unsigned int level_offset; + bool level_low_reset; }; struct meson_reset { @@ -46,6 +48,7 @@ static int meson_reset_reset(struct reset_controller_dev *rcdev, unsigned int offset, bit; meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->reset_offset; return regmap_write(data->map, offset, BIT(bit)); } @@ -59,9 +62,10 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, meson_reset_offset_and_bit(data, id, &offset, &bit); offset += data->param->level_offset; + assert ^= data->param->level_low_reset; return regmap_update_bits(data->map, offset, - BIT(bit), assert ? 0 : BIT(bit)); + BIT(bit), assert ? BIT(bit) : 0); } static int meson_reset_assert(struct reset_controller_dev *rcdev, @@ -84,22 +88,30 @@ static const struct reset_control_ops meson_reset_ops = { static const struct meson_reset_param meson8b_param = { .reg_count = 8, + .reset_offset = 0x0, .level_offset = 0x7c, + .level_low_reset = true, }; static const struct meson_reset_param meson_a1_param = { .reg_count = 3, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct meson_reset_param meson_s4_param = { .reg_count = 6, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct meson_reset_param t7_param = { .reg_count = 7, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct of_device_id meson_reset_dt_ids[] = { From patchwork Fri Sep 6 13:34:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794213 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 B0FB1CE7B14 for ; Fri, 6 Sep 2024 13:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=eZhANUihhiEJVx7SrnlhiK6NoVSRVoUVqz+LiAYcykc=; b=uW4wU3vfdiYbK6 bDRBuoe6MZHHnKK/+0/FxyXL1r7z+yIS/woR6H4UEYZwDdS4dJnFOAqBlcoyCoT0ZOSWzKokjNzQh Aco+VU4MmYCacQPPLQ1nnfSKvyJEw3e6o+I3HqRZsM79vrlNmA+TdwZi2cf/Vc30SkxGfCeE+n6fD nulNIxN2VZkDFuvI4vOm1skVFWPfKTzhwXTPCoFlx8g0YzRHb4mHZ7VbZu9C3+K8gw9Acc4Leb2Mb 0manZuCWD3LTSeA7k8s97NrowhRch6nU/SjjzNJ4WOUVJTEouqzwsC/EpBKOqHIIpsQ+h4R7vmdCa MnVW2xEhFuK5xnfO+06w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZDy-0000000CNl4-3nzr; Fri, 06 Sep 2024 13:42:06 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7V-0000000CMCE-3aey for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:28 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-374cacf18b1so1370177f8f.2 for ; Fri, 06 Sep 2024 06:35:24 -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=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=gatNDuKD0PYES9QNY2sO6pz6EQOYVm6Td6VCdLo56hAkeeVvUIkGvHTcGSIjfwGBbk oCdZXV5MmviJQyuFLpjTOkIs/SgQ+p++JVOEEb7ZzFGDJsznGz+p51x+nftwBJYrGmcu /OY34tzy+R8MxoAYdPKr7OmOoFyaNQGC+QGcVoIgx2/yRN/Ruo4n+EOLlrG/Hsmzj7RM x1lb6ey0WIyahYx93FtRU65N7evbmAVaH1wpMscfAbZ61dhzEN2ZtlOIEKPcPiTACm3w i4cnkM4BHLUOErrgrpXqarhGmaB+LVd+dgRkhxcsOG9d/jUyyknQPFREnARk3Nd6hebb 29VQ== 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=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=jyvM0xwQQ1EiFgJKN+csghwUHrubDDSAkAyZUhBbRiFKjt++72YLfmjwxY5YC4JdKt hcb3E0WSexuL6CGb3XhDolHBI2mTYlsgY1oe5vIviIm1wDwauRruVptYbxgPlZxR8CS1 /L6r1p4oLVZk71oV70TMjsMGO3HO77exTHowVMr2Slk1oHMWe5QFMO2BbMMu7NLn/ihD T8FTtQpVJS1YS/Foiw6IQsoMJ8z10RdVDzBXZdO031CR958x4zqddtkN4ezfSymi1bm4 NDVL/fOdbdSnJzxFV9DUXN/t+mjqrthEk/oaSDIYyqYObmHdsws09me+F60llpFwLRml nEtQ== X-Forwarded-Encrypted: i=1; AJvYcCVubOCmfRvgQBVULRYrwqSSBuIYjRUHSXyW88nSY5+ucuRx3ozDz1cZtKCDQ6UQ9ZIY5ij2REn9KVMZ/+zQ@lists.infradead.org X-Gm-Message-State: AOJu0YyF6yaZeLp9VVlh8mCEbNakaXIYipI8USjZ5kQNcSDvCW3OdB03 Cewq37JPWR00E3WWVme6ZIrOqccp6ES6kMbhwtZQ1hxsLUVcuUcbdo0usbM3ma8= X-Google-Smtp-Source: AGHT+IHtyPvrZcVdwFmw8XQihKzwGBhzTpX6IW6Bq3OFAXKmFfW1m1vMKo12rNUklRp2d6TUNkaT6g== X-Received: by 2002:a05:6000:223:b0:374:d1dd:1cc1 with SMTP id ffacd0b85a97d-374d1dd1e44mr8801291f8f.2.1725629723501; Fri, 06 Sep 2024 06:35:23 -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.22 (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:50 +0200 Subject: [PATCH v4 5/9] reset: amlogic: use reset number instead of register count MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-5-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=2112; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=iSedGQJkeoX1rk7eD0ZddgTbF2MZs7+12PeFSEIOANY=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUSHEcD7K2lLWF6rnCrk05yGhK2svJKDRc0t qPznnAbxlWJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEgAKCRDm/A8cN/La hX7fD/40NAGXsNPZZOklKjEefS6iDGIJJ66e6aq5vjJ4tJFkgU1UCHM6HtnWyGrwVH7bCATlkrc zfdZW5t3tTl4pqOCl+vOKaRSGrHBT35G8Ox9hJlFRW3Snso5iJyPuQ+CTrYma1JrEHyGz7krZZS 847buYbjmFRvpRorM2qQfwsNbhDXNzhoPGlb33dLmRRHSobID92DGHGWH1qfLjv1l1LQEx2yTwJ NgfluH6D0qkQUH0bvGbO8Ci2nIdl39PfEYyvHVG9MZw1mvwlUs1Qc72y0OXci599sge1sDLvLdS h0Zaj3/tu0HSDSprt8k03YFFg5NoAUvEVoJiAvpb3itN5TnzzVk20dnXth6oHFnijLTrN/2jy97 A6LoYexCGpUx2EnQkiBdXc56R8qlL8X43hA86h4rZzo33O4F8bXsleFUZXGUESfHWpgJWdk7Gfq uutDTN//4THhTnzPuOUe9x2+wpjasBkUm5AeSeXWg2eukaSOc6i5WVbS2g+hem1WolVvXIFjlO2 jgbjZIMP8OdSA274I0TiF1VItV2l4Xkpj6dt1ZD+H3p1zQuQrzmPbXjPgKFSARxvBYufdW3kejF MB/0K6fkFBtjMUv1nnkv6T4sXp24yjYyFokjOzjEUV6kYajijkoNJftGFrmewhrX3n1ZHwmaj2W XVQkI2IQt/4Pf3Q== 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_063525_995844_2FF13C82 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The reset driver from audio clock controller may register less reset than a register can hold. To avoid making any change while switching to auxiliary support, use the number of reset instead of the register count to define the bounds of the reset controller. Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 6a90613c8095..e31c1b7c9e4d 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -17,7 +17,7 @@ #include struct meson_reset_param { - unsigned int reg_count; + unsigned int reset_num; unsigned int reset_offset; unsigned int level_offset; bool level_low_reset; @@ -87,28 +87,28 @@ static const struct reset_control_ops meson_reset_ops = { }; static const struct meson_reset_param meson8b_param = { - .reg_count = 8, + .reset_num = 256, .reset_offset = 0x0, .level_offset = 0x7c, .level_low_reset = true, }; static const struct meson_reset_param meson_a1_param = { - .reg_count = 3, + .reset_num = 96, .reset_offset = 0x0, .level_offset = 0x40, .level_low_reset = true, }; static const struct meson_reset_param meson_s4_param = { - .reg_count = 6, + .reset_num = 192, .reset_offset = 0x0, .level_offset = 0x40, .level_low_reset = true, }; static const struct meson_reset_param t7_param = { - .reg_count = 7, + .reset_num = 224, .reset_offset = 0x0, .level_offset = 0x40, .level_low_reset = true, @@ -156,8 +156,7 @@ static int meson_reset_probe(struct platform_device *pdev) "can't init regmap mmio region\n"); data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = data->param->reg_count * BITS_PER_BYTE - * regmap_config.reg_stride; + data->rcdev.nr_resets = data->param->reset_num; data->rcdev.ops = &meson_reset_ops; data->rcdev.of_node = dev->of_node; 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: 13794214 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 224F8CE7B14 for ; Fri, 6 Sep 2024 13:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=z/wVLVFIoWgkg/P9OwKqQcYwWmuvphKNVWv8buBKvTE=; b=jX3fPh5PRLW+4U SfTWwvdUrsBF2+tyttrfIRfIdzqXUK79ZQ+eYZmokhnu/0zqJGztQpPL6cYqAdofKwS/FMiSayPW3 EW37X+844X4W++ZCJc4qoXfIwmP1VoDCdp5mjfQRmbjYz9CQKFhYcHri0ogG/RU9ZXVWy6fW+lhNQ 1EqgbCRhtSC49xY4j3TP44y319uH2y/T68qmLDY4MpAr39aWhhktb1GFp+YOxgVxljKxItzXzdKIl 1TCdELaKnyeOB5M/MwDlEG9JwlvnyxSR1IQtPfPDZbfGqxc9RPTh60+ouAC1YrvTsSUv/UM8sqBfB dXuAwgX+EIXZycTZU/ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZEv-0000000CNwL-33AT; Fri, 06 Sep 2024 13:43:05 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7V-0000000CMCh-3itF for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:29 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-374bd059b12so1178164f8f.1 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=LyIdJ/X1Pyh4wh5JPJJx+NEr0z/avYcFTvd7ROTRQhM5bVLmAywFdS53bKvbzmcHbm mQ3cud/yYfdnisF1AYwXHsRLOFAMpocElEnsm7AHalYfFLkEwqluuBqDkb7f+B5FMwI9 GwZSzLMiyC+7EgB2AjB8wTECzJgCJZosIFqRHV4Jg2rRlY+6gkWW6VjxCOvCLP+HxN4+ V7u78e/Ig+c6pXhgZ4fznB0yT6BnCjWelJkTfhjT4uYoyrBGDKtEYgZIcbVD3q/62hvo KxLAm7MV1bOWDgpXQPgh39HKZSNU3dKhWomze9fVQEHr8tHRPF+fdr6KRDa2j1kMo9gn qBuA== X-Forwarded-Encrypted: i=1; AJvYcCXlVK7LA6CfBAZ0F20JGSO4W1zVuNr1RpEFcBaKGpKOnvMU5EY4mve5XR204VJE4ExeSkto1+YPRkYtkl9L@lists.infradead.org X-Gm-Message-State: AOJu0YzbohisPkfHNGXkijrfnKwQhmtcF0BJiI5nPKIRo3gKXzT9waTg sk9t5UuTQ1tH8SccWgQturEaYgWpmcfzdPN2zbdCF6wzfVf/0bszDJiXzZhbojc= 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_100933_953EA7CC X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=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 = { From patchwork Fri Sep 6 13:34:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794217 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 55176CE7B17 for ; Fri, 6 Sep 2024 13:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=CLC74m0bII41eSn4lCsq2rscWWnD5VXvbSul1xjimKs=; b=hu8gtrJCa3NbEP quCGJkkURBUFv0Wu/W65K0A8PojcuYKHEvFYuna0ZCoJnXVHXMNiC5KKPB+i08a/g00BUhnWjOkw/ pq5eLNGlzGZ+L5Wygj6FPwXbRX8nmFjmyBFWxS8+jlIxn4aElicXTvpYaqB50bmcnIaORNdIoU1t5 z3L2EsaoQ2C2Br0ODNjCt0a5GkZTNNNrOs2WPZIvROKWDMAc2uBliti8Bm4AdTL4fLQHn1Yuq/0+Y a1UT/sovHpnRx97BtK2EEV8DV7/WDjN/pky+krHwiv0H+ZVOaryLaV7Ce24stht5jsGXf09alT7Tt 2eu4j2vg/QtfKTH5oEIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZGu-0000000COSi-00kK; Fri, 06 Sep 2024 13:45:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7c-0000000CMH0-43UG for linux-amlogic@bombadil.infradead.org; Fri, 06 Sep 2024 13:35:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=BnQdKWJeHpVt5Y9jsfTTvKxRhE Z43sZu+4dERWHxm3CnYLvBEVR5Ren4fGZiS1HknruBzS81rqwusd+gzKYpuHdjYGgfVUqjdnirYlx 2I/9NuUO/gt8CwQY1Axis6qqImMMoZ+bhLUX6PV6+GL21rJ2kPTN0WgiwWZT3nNwUNIGYJGgn2t+X lNKu1o6WOuG2MhEv7MIeETKMRrKTBUgdA82tbBM7cvqZG+TlW/m0Zv+jaWITEU21hFyvNiMrFyEg+ VHRrajC2gSc0jRw/Tp+3DPrLolo1jj0VJyzgUznUrKeQDf+oISmdHR9uv0eGacaUGMZ2kbhzE4JDZ kT1H/SYg==; Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1smZ7Y-00000000fh6-3zb6 for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:31 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42c94eb9822so15567975e9.0 for ; Fri, 06 Sep 2024 06:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629725; x=1726234525; 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=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=R+ByeKAEFK4GYtbRS5c4MR1nfURZSzxZxspZRbkVSkSsL8Bor6icP3ZNed4AJ10c1z h01YRtDroM8ijbx9vbpOULEKLucq59m+Pe/uVwcUl93g3l9A+Lrr+wLCeomo5jH/5tpe RUrl0SexwD7ZRRzXIDALLqoZJzp7srs+40Xgs/7K1PlA/y8ll/WrG9QSGxw85SMQi3Qb zAAf4ggWCWe205yu34Y6WKayikaqKSMtPGI9ixaXsRQewB1WKJdKN6kyVE+yNRYQQCxx WLX+uDp6eq2V0BRu8r8YwYjAElPZe2FI4qgYvNztX9dgFeviUIYAAOmzG8o2Uj3DU+6Z ELUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629725; x=1726234525; 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=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=jtGzTVGLJ1B2KmDsDUhgYEFzJ2rpHBxbDOHkaMun8r7KNTEbhh0SNgj3eDgGVwN8El lidGu5OyiumTrlba9TKee0wtBB0BVpRpi7/tGavOwmKyNLq4f2pYlzvQTg+laye4GuVt YmjInlDHWtSpWNoSZuX9tTOKlJ8EtFZk+qNHcSzQTS4pPmW3az+ci0TN18VihdpExDqH yMZveBZhsvMMo+Ahxy6nlWnId70/uLkVWM3hXPyuWVc6N+PAiWP8bn4ymSby/kCOKE1H f/c3DZG4u/Xa5H3WEYaJmTwg4ZkqTkkV4mPzoNd+xxbqyUiPFCZ79PSlvLm4e6B6wMgF bMFA== X-Forwarded-Encrypted: i=1; AJvYcCWTROpt05l633US914GSUlnvyHGnudqeFYYImD3oZPkXjgOAL/dK8H1/zLR+GDQSsOgkSUkNWwI8y2eUPsD@lists.infradead.org X-Gm-Message-State: AOJu0YzRCJ0O3eQRpdm8Orm/Dc+bPCDjA8nJqjNnJWxkNlLMbgnos0iu NfI5VPu65iSfKeVqmHqD+cq4mPZOzYd+HVMQHjmd/rXPr0NT/bWx8+prUA00TarMgyKxw5ykVKX g X-Google-Smtp-Source: AGHT+IHTMY70b2wlGnBeKNWQ1H9t8xY5YyM7J9AJV6VQM+f6aKmz2fjdTwT/C0XAKinvOj3j1jrQmg== X-Received: by 2002:a5d:58c1:0:b0:368:5a8c:580b with SMTP id ffacd0b85a97d-378895c73d1mr2022486f8f.19.1725629725133; Fri, 06 Sep 2024 06:35:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:24 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:52 +0200 Subject: [PATCH v4 7/9] reset: amlogic: move drivers to a dedicated directory MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-7-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=4127; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=yrGWoxCpwHnlg0sdrbvMgawxznUl/m0tFw6lwaYIwVQ=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUT1wWu7fYlSNotSd/YCXGraANoQxIW+ZEPS XPNFQxPKCyJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEwAKCRDm/A8cN/La hZihEACuzpcQEZLYGWXGGYjSdQb2I7XyOrvYAwbZ/bhUGUbWntGZO2HkWalrWET3GnMTnCeu1g5 n3CDJpxVbSOke6/YnOGA86Z6L4QxjDE18SB3x3XvQ7Jx0JcHzVYpULT+Rb/2J/ItXbpe5tiC8CE /k75o3tYZuc4KUTQDjjXnenlqbcMupjzGuj9w9PbyXPchrLC7H7qEMuicnD3owMstSeinZtExx9 KyffddVYX1zkYzI6xQXhbm2Vp6vCYu4kKgtE25HQN3UdqgU+iu/XrT8TDMFwKdSacOWsBuOwXuO pAALO6F9cgglE9WFAl+c+hFVkcFIAJ/YhsYMIrWzxekYRsREDZGEBabKt45wp7tdNDueU6UkaM2 xwG4MKaKjJN0GVOUsjDpGagr2c/sDCHtf/5kOpEtKbkCq99lhftOcHFSfT8iqd2pce1vFjUqfa5 ZBJONWyc/hUS+l2bUE/KC/C71xLW+juq36/70HAW33dF5wmx1n7o/p7o26G4DF31HKB33gfqao7 f+6X9ZwK5iZUp2LrlfgtdXE1uqxzwM0tc4vBTSl0TdW7b+6G1LXxEPMWXC4uGdC4TkGw/QaKYj9 JvsKrF6QE9jR9vSHbdBiqQNjRHdCoJ+QQ3VsncLkgP7MpsXz5AYVHewJyK8/AzOS2JUlzBp3zf1 a4WeASVXIgbJhjw== 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_143529_641609_6510C2A3 X-CRM114-Status: GOOD ( 14.45 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org The meson reset driver will be split in two part, one implemeting the ops, the other providing the platform driver support. This will be done to facilitate the addition of the auxiliary bus support. To avoid making a mess in drivers/reset/ while doing so, move the amlogic reset drivers to a dedicated directory. Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/Kconfig | 15 +-------------- drivers/reset/Makefile | 3 +-- drivers/reset/amlogic/Kconfig | 13 +++++++++++++ drivers/reset/amlogic/Makefile | 2 ++ drivers/reset/{ => amlogic}/reset-meson-audio-arb.c | 0 drivers/reset/{ => amlogic}/reset-meson.c | 0 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 5484a65f66b9..d28c4401a310 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -153,20 +153,6 @@ config RESET_MCHP_SPARX5 help This driver supports switch core reset for the Microchip Sparx5 SoC. -config RESET_MESON - tristate "Meson Reset Driver" - depends on ARCH_MESON || COMPILE_TEST - default ARCH_MESON - help - This enables the reset driver for Amlogic Meson SoCs. - -config RESET_MESON_AUDIO_ARB - tristate "Meson Audio Memory Arbiter Reset Driver" - depends on ARCH_MESON || COMPILE_TEST - help - This enables the reset driver for Audio Memory Arbiter of - Amlogic's A113 based SoCs - config RESET_NPCM bool "NPCM BMC Reset Driver" if COMPILE_TEST default ARCH_NPCM @@ -356,6 +342,7 @@ config RESET_ZYNQMP help This enables the reset controller driver for Xilinx ZynqMP SoCs. +source "drivers/reset/amlogic/Kconfig" source "drivers/reset/starfive/Kconfig" source "drivers/reset/sti/Kconfig" source "drivers/reset/hisilicon/Kconfig" diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 4411a2a124d7..677c4d1e2632 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += core.o +obj-y += amlogic/ obj-y += hisilicon/ obj-y += starfive/ obj-y += sti/ @@ -21,8 +22,6 @@ obj-$(CONFIG_RESET_K210) += reset-k210.o obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o obj-$(CONFIG_RESET_MCHP_SPARX5) += reset-microchip-sparx5.o -obj-$(CONFIG_RESET_MESON) += reset-meson.o -obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o obj-$(CONFIG_RESET_NPCM) += reset-npcm.o obj-$(CONFIG_RESET_NUVOTON_MA35D1) += reset-ma35d1.o obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig new file mode 100644 index 000000000000..7ed9cf50f038 --- /dev/null +++ b/drivers/reset/amlogic/Kconfig @@ -0,0 +1,13 @@ +config RESET_MESON + tristate "Meson Reset Driver" + depends on ARCH_MESON || COMPILE_TEST + default ARCH_MESON + help + This enables the reset driver for Amlogic Meson SoCs. + +config RESET_MESON_AUDIO_ARB + tristate "Meson Audio Memory Arbiter Reset Driver" + depends on ARCH_MESON || COMPILE_TEST + help + This enables the reset driver for Audio Memory Arbiter of + Amlogic's A113 based SoCs diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile new file mode 100644 index 000000000000..55509fc78513 --- /dev/null +++ b/drivers/reset/amlogic/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/amlogic/reset-meson-audio-arb.c similarity index 100% rename from drivers/reset/reset-meson-audio-arb.c rename to drivers/reset/amlogic/reset-meson-audio-arb.c diff --git a/drivers/reset/reset-meson.c b/drivers/reset/amlogic/reset-meson.c similarity index 100% rename from drivers/reset/reset-meson.c rename to drivers/reset/amlogic/reset-meson.c From patchwork Fri Sep 6 13:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794216 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 41F5ECE7B14 for ; Fri, 6 Sep 2024 13:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=P4hTWer321Jo3cri+wwlG4y0iF5PtXTphPQgDePlTyE=; b=Okhxgd6yxw8XWm mfTO3DPZZ2wDzmhPjaRAsbLIcyVDbZ+raVUCXtIjuTSgp3op5eVE0oCW+a7tGYSQDWZSOFY9uGRW7 1xsNdHrh+KuHhnyEIfU6yMizLnGy/OLNrXAY0an1R/GAD2kyq+BClgZSrMdF+3q5u2dHLtYy7N7Gi BP192rjCgZT7/Fi5zGZwQGEVt603HPXELDYUf63S289AYIUnKkoL3YWQC3Vvy1ZiDZdd7tWUJyDAK A7+XHASsPTxdyTgTBHtuPSoQr6KrdH4SgOrRPFaMEdBS7sGrkRBRUtCx024kF+2fgR6XE0OPT2Ag1 1LttnkYeMPAY6aDfIXYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZFv-0000000COEo-3Tym; Fri, 06 Sep 2024 13:44:07 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7Y-0000000CMEU-2EAR for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:31 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42c94e59b93so17276265e9.1 for ; Fri, 06 Sep 2024 06:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629726; x=1726234526; 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=jKMMJ9BB/WECkuysAuWF0PWUWeyazpVDPxUVb4YJ+No=; b=vA3HTcYxCQzCYBPjJj39DuqFToFp9+N+k2/MZ01aTs6smPwbovY+6h86bl+zXJIwnX Fa4HKl9qqQSrKX4OkWyWXR0VFezqQ8ZKOCIrIP2CYcmaEOm2gUCr2igCiozhXTDWlyyv y8H04E8ySEhpu0jAICIroRqGeoYm416HL21mAG5BWjCGp2xdEzp5IJ2T262dTMQIyH0f PiUYTA5ds++5hSwSQioh1y2EuV30GMVDuZb3IyM8Nd+FyZMzNrmHVMzAS08N+iBfuRwx mR50I7uLcJza2eSWuAURsDl5euXVoCcnH5LbhlpuEN3XfFAcfG0Up0oeW4taXZ0PvDmn 3amQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629726; x=1726234526; 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=jKMMJ9BB/WECkuysAuWF0PWUWeyazpVDPxUVb4YJ+No=; b=pdgeesaeruztM2+wElSdpGMVWMnpISSyJoVxDMr5fwSw5+OERKPTQc5wesnpfkR795 FxxNP5OFx3aqFYQvqa52RkeDKTf7LYO88myuICPNKBrOaA1Lsjr6SFMJ8cerrmuYOuMT rrrQIx5mzrUiieICFXQkZbsYAdh1WLh/gY03VGIITQwvh2UHOrYz77DzTaHfJRUg2ls2 JIQaLTznEg+rSgOnfr6G/z1R2QSyPd4zL3vu1IkDanebwV2nnGGbHaYMO1tzWgaIRaY6 cVqkZQsvFlAUNDpX8FyzdN1w3mEsbiyruyjHA3dvpJpSts3i/pJ24wHCMCoyutdUxOc+ selQ== X-Forwarded-Encrypted: i=1; AJvYcCX2DvbzPo3MaL7ykeDKxd46vPBRVpslkOxdbJDVtUMnkVZTKX1uURfzdL4hUKSSUFGpzHzNhylNGmcfa4kH@lists.infradead.org X-Gm-Message-State: AOJu0YwZanofge/HWZXVOh6GNw62qBUW6I2gqyhVVSmWaPuQTcTYMCCq 1IcUKLd39FyeYOTw5o+PNuhaAKre9ruMf2xZOpbBjYOFY0ljXO4tI+l1xg+cbY4= X-Google-Smtp-Source: AGHT+IGV6zV/WTaWuRrt0ffNBSswfD9eOdNjMdzrfqpP+uGnA+r/gDgGAHL0aVp2/ptE+weUTiXXhQ== X-Received: by 2002:adf:a395:0:b0:374:adf1:9232 with SMTP id ffacd0b85a97d-378885f1a1bmr1615357f8f.19.1725629726006; Fri, 06 Sep 2024 06:35:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:25 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:53 +0200 Subject: [PATCH v4 8/9] reset: amlogic: split the device core and platform probe MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-8-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=11277; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=BE5kz+4uxHRB80G5vKRFxE31qcQuiKDy33BrekIRUq0=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUUgJNt2+rEFoswms9TnCWD1oUqWy4jyl035 jdYp/PEpQKJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFFAAKCRDm/A8cN/La hbl4D/40yJVP8AcXu2tPLszmvcmib8sY3fWM3mceDx3OF7eM8J+oF/RPvXE4Oj3m5z8y7suWsGJ XAACVzUNvRpYV4s+BUAPw/7rnugBAdbi2JY7ifPksWoSVIdTwxI4Y39EnFVqs4NOGQsQChZvllr 2qgRbwzUNZLJQw7MNCgTG7vX2f6o+ZPgQC4gRCYVNJzmEqeZC9OimwWa4tr7WmffsTEeNeSiMPR BTYZAqoNGepvHCFIP120x3IIaGp2VGldci3ulqJhRt4oWSWUQyPU9T0ZMwkjF36zKBuRzZw5wsZ Bh+rxedojqEg/bdl18SHaG+OVFQjMpnyr+lhoLas/6HHM5hL4okO85tFlCAxZOtXnNsHfypsV7V fmsbfxiq/LUO39+n4dm/xFwAM0Y4bPVUnvCcgwatko44e8TVAHUSYAUC3T7r9EBNFjB24rucAVX ejGs6SRspQjAcop0M0MeTl02CzhK2paBVJzefjQL4kl9EJnmHujn59GrhooUxTLRlcnU7Z07yT4 WBj7MpFLIkGtJobzerSwE+V9i84elR/b8rTnaAEhqWzVFlQu4ONDwGEyrSD2Z7DTSOH72LOwOe9 JW1xFXKJIPhI6rb3+XCtbmpGoB17lbs8Utpsm/8P3gZZmX0IJV2HSSQTNMmJKAr8UI/sA31lLE2 +rG2bclA4dGtfRQ== 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_063528_672153_0A31A7FC X-CRM114-Status: GOOD ( 21.69 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org To prepare the addition of the auxiliary device support, split out the device coomon functions from the probe of the platform device. The device core function will be common to both the platform and auxiliary driver. Signed-off-by: Jerome Brunet --- drivers/reset/amlogic/Kconfig | 8 +- drivers/reset/amlogic/Makefile | 1 + drivers/reset/amlogic/reset-meson-common.c | 121 ++++++++++++++++++++++++++++ drivers/reset/amlogic/reset-meson.c | 122 ++++------------------------- drivers/reset/amlogic/reset-meson.h | 24 ++++++ 5 files changed, 168 insertions(+), 108 deletions(-) diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig index 7ed9cf50f038..1d77987088f4 100644 --- a/drivers/reset/amlogic/Kconfig +++ b/drivers/reset/amlogic/Kconfig @@ -1,9 +1,15 @@ +config RESET_MESON_COMMON + tristate + select REGMAP + config RESET_MESON tristate "Meson Reset Driver" depends on ARCH_MESON || COMPILE_TEST default ARCH_MESON + select REGMAP_MMIO + select RESET_MESON_COMMON help - This enables the reset driver for Amlogic Meson SoCs. + This enables the reset driver for Amlogic SoCs. config RESET_MESON_AUDIO_ARB tristate "Meson Audio Memory Arbiter Reset Driver" diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile index 55509fc78513..74aaa2fb5e13 100644 --- a/drivers/reset/amlogic/Makefile +++ b/drivers/reset/amlogic/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_COMMON) += reset-meson-common.o obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/amlogic/reset-meson-common.c b/drivers/reset/amlogic/reset-meson-common.c new file mode 100644 index 000000000000..d57544801ae9 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson-common.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Amlogic Meson Reset core functions + * + * Copyright (c) 2016-2024 BayLibre, SAS. + * Authors: Neil Armstrong + * Jerome Brunet + */ + +#include +#include +#include +#include + +#include "reset-meson.h" + +struct meson_reset { + const struct meson_reset_param *param; + struct reset_controller_dev rcdev; + struct regmap *map; +}; + +static void meson_reset_offset_and_bit(struct meson_reset *data, + unsigned long id, + unsigned int *offset, + unsigned int *bit) +{ + unsigned int stride = regmap_get_reg_stride(data->map); + + *offset = (id / (stride * BITS_PER_BYTE)) * stride; + *bit = id % (stride * BITS_PER_BYTE); +} + +static int meson_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->reset_offset; + + return regmap_write(data->map, offset, BIT(bit)); +} + +static int meson_reset_level(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + assert ^= data->param->level_low_reset; + + return regmap_update_bits(data->map, offset, + 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) +{ + return meson_reset_level(rcdev, id, true); +} + +static int meson_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return meson_reset_level(rcdev, id, false); +} + +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, +}; + +int meson_reset_controller_register(struct device *dev, struct regmap *map, + const struct meson_reset_param *param) +{ + struct meson_reset *data; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->param = param; + data->map = map; + data->rcdev.owner = dev->driver->owner; + data->rcdev.nr_resets = param->reset_num; + data->rcdev.ops = &meson_reset_ops; + data->rcdev.of_node = dev->of_node; + + return devm_reset_controller_register(dev, &data->rcdev); +} +EXPORT_SYMBOL_NS_GPL(meson_reset_controller_register, MESON_RESET); + +MODULE_DESCRIPTION("Amlogic Meson Reset Core function"); +MODULE_AUTHOR("Neil Armstrong "); +MODULE_AUTHOR("Jerome Brunet "); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson.c b/drivers/reset/amlogic/reset-meson.c index af690d3012ec..feb19bf6da77 100644 --- a/drivers/reset/amlogic/reset-meson.c +++ b/drivers/reset/amlogic/reset-meson.c @@ -2,106 +2,20 @@ /* * Amlogic Meson Reset Controller driver * - * Copyright (c) 2016 BayLibre, SAS. - * Author: Neil Armstrong + * Copyright (c) 2016-2024 BayLibre, SAS. + * Authors: Neil Armstrong + * Jerome Brunet */ + #include -#include #include #include #include #include #include #include -#include -#include - -struct meson_reset_param { - unsigned int reset_num; - unsigned int reset_offset; - unsigned int level_offset; - bool level_low_reset; -}; - -struct meson_reset { - const struct meson_reset_param *param; - struct reset_controller_dev rcdev; - struct regmap *map; -}; - -static void meson_reset_offset_and_bit(struct meson_reset *data, - unsigned long id, - unsigned int *offset, - unsigned int *bit) -{ - unsigned int stride = regmap_get_reg_stride(data->map); - - *offset = (id / (stride * BITS_PER_BYTE)) * stride; - *bit = id % (stride * BITS_PER_BYTE); -} - -static int meson_reset_reset(struct reset_controller_dev *rcdev, - unsigned long id) -{ - struct meson_reset *data = - container_of(rcdev, struct meson_reset, rcdev); - unsigned int offset, bit; - - meson_reset_offset_and_bit(data, id, &offset, &bit); - offset += data->param->reset_offset; - - return regmap_write(data->map, offset, BIT(bit)); -} - -static int meson_reset_level(struct reset_controller_dev *rcdev, - unsigned long id, bool assert) -{ - struct meson_reset *data = - container_of(rcdev, struct meson_reset, rcdev); - unsigned int offset, bit; - - meson_reset_offset_and_bit(data, id, &offset, &bit); - offset += data->param->level_offset; - assert ^= data->param->level_low_reset; - return regmap_update_bits(data->map, offset, - 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) -{ - return meson_reset_level(rcdev, id, true); -} - -static int meson_reset_deassert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - return meson_reset_level(rcdev, id, false); -} - -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, -}; +#include "reset-meson.h" static const struct meson_reset_param meson8b_param = { .reset_num = 256, @@ -151,33 +65,25 @@ static const struct regmap_config regmap_config = { static int meson_reset_probe(struct platform_device *pdev) { + const struct meson_reset_param *param; struct device *dev = &pdev->dev; - struct meson_reset *data; + struct regmap *map; void __iomem *base; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); - data->param = device_get_match_data(dev); - if (!data->param) + param = device_get_match_data(dev); + if (!param) return -ENODEV; - data->map = devm_regmap_init_mmio(dev, base, ®map_config); - if (IS_ERR(data->map)) - return dev_err_probe(dev, PTR_ERR(data->map), + map = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(map)) + return dev_err_probe(dev, PTR_ERR(map), "can't init regmap mmio region\n"); - data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = data->param->reset_num; - data->rcdev.ops = &meson_reset_ops; - data->rcdev.of_node = dev->of_node; - - return devm_reset_controller_register(dev, &data->rcdev); + return meson_reset_controller_register(dev, map, param); } static struct platform_driver meson_reset_driver = { @@ -191,4 +97,6 @@ module_platform_driver(meson_reset_driver); MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver"); MODULE_AUTHOR("Neil Armstrong "); +MODULE_AUTHOR("Jerome Brunet "); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson.h b/drivers/reset/amlogic/reset-meson.h new file mode 100644 index 000000000000..4e1dbd7569c5 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* + * Copyright (c) 2024 BayLibre, SAS. + * Author: Jerome Brunet + */ + +#ifndef __MESON_RESET_H +#define __MESON_RESET_H + +#include +#include +#include + +struct meson_reset_param { + unsigned int reset_num; + unsigned int reset_offset; + unsigned int level_offset; + bool level_low_reset; +}; + +int meson_reset_controller_register(struct device *dev, struct regmap *map, + const struct meson_reset_param *param); + +#endif /* __MESON_RESET_H */ From patchwork Fri Sep 6 13:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794215 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 0BEE5CE7B10 for ; Fri, 6 Sep 2024 13:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :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=HwP1IssJJt3h4UTCqFcWAQgAo2Hns15v+Vkl00QLVjg=; b=Qv4T8II/sbSzej 9Asi1chdP/HliVJJlpE8hrxnQBs5iIp+4Y4WGim2iED+P7qKPKptEf2+d9f72ZCAqldHUgTccm9NM gDK7IcjoP+jrQuZxXp3L3zfV3v1SL76uF8GAvGtccpRzqdRZCQhWkqT9Sc+Utd7racSgLraB9/Ugk zJC8A6BrXOix6GBrXuznvGoY1FoVc8ePwHpNc6uqu1clw4J3/o8MZRhsdTcSwd0OiUM6C883ndOjT 5xXbwmCJY59EZNYbfWe/2h5Mj6mQdwa7UzKvZju2NW1wEDShu/fuRhGThOw47uaAcNQQbWmPcHx4M e/qyY/nlMy1KlaSmFSSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZFw-0000000COEv-0q1q; Fri, 06 Sep 2024 13:44:08 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7Z-0000000CMEp-13cx for linux-amlogic@lists.infradead.org; Fri, 06 Sep 2024 13:35:31 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42c5347b2f7so16681925e9.0 for ; Fri, 06 Sep 2024 06:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629727; x=1726234527; 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=5fQ+cdLJYbOn3NF5s//ezlsttCjL0fvaEZaJE8odEpo=; b=fkCraSdCMXsAExgvsW0r3ROgA5P584NnWh43bdO6SCGDOQhUsaFpo4tEE693Roupc8 UNZ5loJf4IHtaQVnysPd2Orx9CY6LgWRIQoavOsC7Zt2wTnmMlHNxcOErAv517z8YjJj wF66ckC3oTkUINqYeOutYkdFr3nqKWaZyXSFyj5nWjRlAIwxFbyuwU57mySp3Q4D4+Ho Qb//Z2KFa4/Q64oPVHGnqW66XdepOn92N8DqxrIrErsvcxKe/HTd1V+haz1yQ8lDGJ5e vW0/VdNbPqSKXOecYCLX4d/QngJRyxfi/Z03Ry0ZvJ2BQkNwDwX0+FO5Wws9D23j1IqH vDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629727; x=1726234527; 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=5fQ+cdLJYbOn3NF5s//ezlsttCjL0fvaEZaJE8odEpo=; b=TbnT23oqf6f2mO7o/Q8KhgRgMqLOUWGSJeQ8hF14SF+eHe8+T59X+nTEHKUhnq1iDz l+TpznwM1Qx2/IrzIZt+lPnYbo11bnhFl5QWXqLYyAK6jF7n4sGF4Rc4UUwdd2uBh+Mr Pq67YHYpXXlVsQsvCNsnBKZ20KdiCtsOqVK0E4J9l9v0jY4FNBgyOvkj2E87NPc2TShH TI1p1rRZ7ifbdNZejaRR74fkUfELA7exAckUitpLdma4QBfuSsCHchM7C+JugkKpqog/ UzSXOoG+PoeqlPZ7kpPQkpKfXJTOb0O6cS9LG0HCENO0Js0uVzkVPlWOC1uFQd3tTwxx MqlQ== X-Forwarded-Encrypted: i=1; AJvYcCW3sHpFazhMswo0Qit8Sp8kRIqcNR9yEBEGl9rb0dbSzd2Ouq0+dB+EiOonWIhxPIkViZLBNTSUZOZXxaJQ@lists.infradead.org X-Gm-Message-State: AOJu0YxzrZE+OaUDrUeH+f9aeuMDPgoCqlzC9gbGmJ9asro4Ssi7/WH4 6Ic2AB7juvRrdzuBJzynnxyRlPHMHlzHmmsxzHYE9gxP0rZvIQZKonfvrsRlAD8= X-Google-Smtp-Source: AGHT+IHmymTxLOs3PLKO0c6jWSVpOPktEs2qQjYl+O557HjFRG7O8Rjb+6CkqWWmmtxCWJdK5yFMkg== X-Received: by 2002:a5d:5c88:0:b0:374:c8d1:70be with SMTP id ffacd0b85a97d-374c8d171c7mr10723438f8f.38.1725629726803; Fri, 06 Sep 2024 06:35:26 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:26 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:54 +0200 Subject: [PATCH v4 9/9] reset: amlogic: add auxiliary reset driver support MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-9-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=9860; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=XLWvH9i6+Kiiy0dwA5ikE9sDbinj1MBPG77NiOiU0DA=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUVnaG4Noluao1RPwFCG8nJSg/MLQxRGJ+cl +kM2Q6CvHiJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFFQAKCRDm/A8cN/La hWKAEACMfSqWEFrl9iF4MECgBdKRSQcUCnhQQll1l+KRJ1LEaOl+9R3JwC/Enr4fuBzdvMq5CLX ALYld5gdTC2zl44G0TO1qR28l3lhTXxktZ/IKzZWDqoLVl+IEH9SiKAHtBBkXL302IcTKVFMLsm zIJFOuTvLpaY4vVHv8X1kRtg6MbSXNTR5M3IkZF3kaA9HNL23p8G686VqPeQRukBqZpkXu1RsQv 5SAsfVvrbZ9fKii/pSZ5rNs+dkTpI5DODllw4D3YKROqfxacVEo2Llv23u1mtK4AK+nK6VpQP/v aPDW7oK4MyeL0JWURpZDu5V0Qr5cWU6R2IPjEgLkE20vB67Q3ad4UpXWU7Q9yoaBKTZbt/DiDqN GiPyaAoqv15xkDx2z1RgEshsUVSCDPD5591Jvmx0q1cWYhlaIM6j58K6em0dvmVpMDN+x3ZBCPE yfKW4T5+TjeBuKVkyXdFkApCs4kpTsUiGEbyuhx5nL/2JPJMszTEMMcNeQ0XqKuQjWWqMcpL5Y+ JBCzN27mEUefdEYVfaZVHX7TWlEsvUCcD8tBFEzAYHz7n+zx2QKF2gYlefttF2jVSYihMQ3ptdf /DmhPGaZxPxS0FrNtOPWEZXQDZxowyUSw6gno9hY3nk+vKz3H4HltKJV4HB+7dOAft3ptPwva5Z 5XofjCd6Ucn3B7g== 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_063529_518501_DF2343D2 X-CRM114-Status: GOOD ( 23.83 ) X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Add support for the reset controller present in the audio clock controller of the g12 and sm1 SoC families, using the auxiliary bus. This is expected to replace the driver currently present directly within the related clock driver. Signed-off-by: Jerome Brunet --- drivers/reset/amlogic/Kconfig | 8 ++ drivers/reset/amlogic/Makefile | 1 + drivers/reset/amlogic/reset-meson-aux.c | 136 +++++++++++++++++++++++++++++ drivers/reset/amlogic/reset-meson-common.c | 25 +++++- drivers/reset/amlogic/reset-meson.c | 3 + drivers/reset/amlogic/reset-meson.h | 4 + include/soc/amlogic/reset-meson-aux.h | 23 +++++ 7 files changed, 198 insertions(+), 2 deletions(-) diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig index 1d77987088f4..e73ee5d63264 100644 --- a/drivers/reset/amlogic/Kconfig +++ b/drivers/reset/amlogic/Kconfig @@ -11,6 +11,14 @@ config RESET_MESON help This enables the reset driver for Amlogic SoCs. +config RESET_MESON_AUX + tristate "Meson Reset Auxiliary Driver" + depends on ARCH_MESON || COMPILE_TEST + select AUXILIARY_BUS + select RESET_MESON_CORE + help + This enables the reset auxiliary driver for Amlogic SoCs. + config RESET_MESON_AUDIO_ARB tristate "Meson Audio Memory Arbiter Reset Driver" depends on ARCH_MESON || COMPILE_TEST diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile index 74aaa2fb5e13..ca99a691282c 100644 --- a/drivers/reset/amlogic/Makefile +++ b/drivers/reset/amlogic/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_AUX) += reset-meson-aux.o obj-$(CONFIG_RESET_MESON_COMMON) += reset-meson-common.o obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/amlogic/reset-meson-aux.c b/drivers/reset/amlogic/reset-meson-aux.c new file mode 100644 index 000000000000..dd8453001db9 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson-aux.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Amlogic Meson Reset Auxiliary driver + * + * Copyright (c) 2024 BayLibre, SAS. + * Author: Jerome Brunet + */ + +#include +#include +#include +#include +#include +#include + +#include "reset-meson.h" +#include + +static DEFINE_IDA(meson_rst_aux_ida); + +struct meson_reset_adev { + struct auxiliary_device adev; + struct regmap *map; +}; + +#define to_meson_reset_adev(_adev) \ + container_of((_adev), struct meson_reset_adev, adev) + +static const struct meson_reset_param meson_g12a_audio_param = { + .reset_ops = &meson_reset_toggle_ops, + .reset_num = 26, + .level_offset = 0x24, +}; + +static const struct meson_reset_param meson_sm1_audio_param = { + .reset_ops = &meson_reset_toggle_ops, + .reset_num = 39, + .level_offset = 0x28, +}; + +static const struct auxiliary_device_id meson_reset_aux_ids[] = { + { + .name = "axg-audio-clkc.rst-g12a", + .driver_data = (kernel_ulong_t)&meson_g12a_audio_param, + }, { + .name = "axg-audio-clkc.rst-sm1", + .driver_data = (kernel_ulong_t)&meson_sm1_audio_param, + }, {} +}; +MODULE_DEVICE_TABLE(auxiliary, meson_reset_aux_ids); + +static int meson_reset_aux_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + const struct meson_reset_param *param = + (const struct meson_reset_param *)(id->driver_data); + struct meson_reset_adev *raux = + to_meson_reset_adev(adev); + + return meson_reset_controller_register(&adev->dev, raux->map, param); +} + +static struct auxiliary_driver meson_reset_aux_driver = { + .probe = meson_reset_aux_probe, + .id_table = meson_reset_aux_ids, +}; +module_auxiliary_driver(meson_reset_aux_driver); + +static void meson_rst_aux_release(struct device *dev) +{ + struct auxiliary_device *adev = to_auxiliary_dev(dev); + struct meson_reset_adev *raux = + to_meson_reset_adev(adev); + + ida_free(&meson_rst_aux_ida, adev->id); + kfree(raux); +} + +static void meson_rst_aux_unregister_adev(void *_adev) +{ + struct auxiliary_device *adev = _adev; + + auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); +} + +int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name) +{ + struct meson_reset_adev *raux; + struct auxiliary_device *adev; + int ret; + + raux = kzalloc(sizeof(*raux), GFP_KERNEL); + if (!raux) + return -ENOMEM; + + ret = ida_alloc(&meson_rst_aux_ida, GFP_KERNEL); + if (ret < 0) + goto raux_free; + + raux->map = map; + + adev = &raux->adev; + adev->id = ret; + adev->name = adev_name; + adev->dev.parent = dev; + adev->dev.release = meson_rst_aux_release; + device_set_of_node_from_dev(&adev->dev, dev); + + ret = auxiliary_device_init(adev); + if (ret) + goto ida_free; + + ret = __auxiliary_device_add(adev, dev->driver->name); + if (ret) { + auxiliary_device_uninit(adev); + return ret; + } + + return devm_add_action_or_reset(dev, meson_rst_aux_unregister_adev, + adev); + +ida_free: + ida_free(&meson_rst_aux_ida, adev->id); +raux_free: + kfree(raux); + return ret; +} +EXPORT_SYMBOL_GPL(devm_meson_rst_aux_register); + +MODULE_DESCRIPTION("Amlogic Meson Reset Auxiliary driver"); +MODULE_AUTHOR("Jerome Brunet "); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson-common.c b/drivers/reset/amlogic/reset-meson-common.c index d57544801ae9..a7b1b250a64d 100644 --- a/drivers/reset/amlogic/reset-meson-common.c +++ b/drivers/reset/amlogic/reset-meson-common.c @@ -87,12 +87,33 @@ static int meson_reset_deassert(struct reset_controller_dev *rcdev, return meson_reset_level(rcdev, id, false); } -static const struct reset_control_ops meson_reset_ops = { +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); +} + +const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, .deassert = meson_reset_deassert, .status = meson_reset_status, }; +EXPORT_SYMBOL_NS_GPL(meson_reset_ops, MESON_RESET); + +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, +}; +EXPORT_SYMBOL_NS_GPL(meson_reset_toggle_ops, MESON_RESET); int meson_reset_controller_register(struct device *dev, struct regmap *map, const struct meson_reset_param *param) @@ -107,7 +128,7 @@ int meson_reset_controller_register(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 = data->param->reset_ops; data->rcdev.of_node = dev->of_node; return devm_reset_controller_register(dev, &data->rcdev); diff --git a/drivers/reset/amlogic/reset-meson.c b/drivers/reset/amlogic/reset-meson.c index feb19bf6da77..6ae4ed6b7f8b 100644 --- a/drivers/reset/amlogic/reset-meson.c +++ b/drivers/reset/amlogic/reset-meson.c @@ -18,6 +18,7 @@ #include "reset-meson.h" static const struct meson_reset_param meson8b_param = { + .reset_ops = &meson_reset_ops, .reset_num = 256, .reset_offset = 0x0, .level_offset = 0x7c, @@ -25,6 +26,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, @@ -32,6 +34,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, diff --git a/drivers/reset/amlogic/reset-meson.h b/drivers/reset/amlogic/reset-meson.h index 4e1dbd7569c5..2051e126dc3a 100644 --- a/drivers/reset/amlogic/reset-meson.h +++ b/drivers/reset/amlogic/reset-meson.h @@ -12,6 +12,7 @@ #include struct meson_reset_param { + const struct reset_control_ops *reset_ops; unsigned int reset_num; unsigned int reset_offset; unsigned int level_offset; @@ -21,4 +22,7 @@ struct meson_reset_param { int meson_reset_controller_register(struct device *dev, struct regmap *map, const struct meson_reset_param *param); +extern const struct reset_control_ops meson_reset_ops; +extern const struct reset_control_ops meson_reset_toggle_ops; + #endif /* __MESON_RESET_H */ diff --git a/include/soc/amlogic/reset-meson-aux.h b/include/soc/amlogic/reset-meson-aux.h new file mode 100644 index 000000000000..d8a15d48c984 --- /dev/null +++ b/include/soc/amlogic/reset-meson-aux.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SOC_RESET_MESON_AUX_H +#define __SOC_RESET_MESON_AUX_H + +#include + +struct device; +struct regmap; + +#if IS_ENABLED(CONFIG_RESET_MESON_AUX) +int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name); +#else +static inline int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name) +{ + return 0; +} +#endif + +#endif /* __SOC_RESET_MESON_AUX_H */