From patchwork Tue Sep 10 16:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13798914 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 D30F8EDE9A3 for ; Tue, 10 Sep 2024 16:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o1hDqtVqiV/aX1h4XvmroKUK+ZQ/3Ms3NrT6oivQF+g=; b=B5at5ekv5tKz8W+zbWtxHt5snm eiRzubagJ9powSScOR+N69tmRFecZMuA16BegkQ3oOLjSH+GsQGzf96csWvpgWXJHL3rJ+UMnRVSy RotjnitR4+h6MV7bo0tzNKemrz8sVboSrVdlYDzpje+WRAlvnPsSJtq+MBmGmQYnXbpuuYUamj0JP l/tvnm7xhaLPvbolZbwb2hMaXe1CZhLfolZwHBh+xez0GkKFl5F34K/phjcdLp1fRf/xgwGbY36Fk jmeisag3F/vfdlIODfKTojDOf81ScqW59S6HpqBfX8Wc/mGKXeJ4Rk7x3RlPhRK1eSdEMiDx+bS+G WiNreCjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3qO-00000006LzX-3asd; Tue, 10 Sep 2024 16:35:56 +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 1so3nd-00000006LAy-21EF for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:07 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-374c1e5fe79so3792836f8f.1 for ; Tue, 10 Sep 2024 09:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985983; x=1726590783; 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=o1hDqtVqiV/aX1h4XvmroKUK+ZQ/3Ms3NrT6oivQF+g=; b=aSECQX8t8oozR1EGhigwthXhKPGEZcwOtOrGvxzJ0UpT/thpwxabGlmatoaWP6JsvA hkFh8aZGBBcMOXwBUk65iKpdg9ahfpir2RhVQsBySYt+Qo+N9UfVOJfcs13tf/5GZvhI 7K4yCNxGhFYMppgRAzxY+bPdN1axFhgpZzJL0pifzdZlGOeOtf1xE6wJOZgYgTm3Zg5E HGpeQNJW6lH4iWxvxXcmhCtnrYu2/AR+T3LPlE7PwiKAWqbJxQSFM9g8Bmzj4bPw/kxO s/PFyDJ/mhaZOCZbwWEXEhhZjjKG3VyqQ5Tsq9ZOeTTpQBF9JMx3hha60tHUGIy67bGJ 1/kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985983; x=1726590783; 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=o1hDqtVqiV/aX1h4XvmroKUK+ZQ/3Ms3NrT6oivQF+g=; b=QHoql9U3weAfXQEmqpWqjcRsPvh8uvUOu/Kfj8vwo8++WgW+qbPZDc4Kz489KlRmvG s40OWMuu2Cg2TPQNNcEzpKPXC3q6g4hYMT+r4z1zIKVK4OVCS/KnLSz25xfqXWHTiSk1 aAzpeRCm70YNse6yJxFHfouiGsO72eg4QzwnHHPvtKFYThYvFyOC4T4Mowx7Hi/Ca9mU t5VS7Wc6N25VnF9Y0j5hSkleW/tIoGsLO0TkEiKdvwFHiwPhQGn7rOiLFjzZnqe/bejM xmj5wzIiC7B9W0R2nkkTSXJkQ4KMUJwAQMJh8dhWySzJxW2IikHL/2wxSsgCYtBiA4Fo 4njg== X-Gm-Message-State: AOJu0YxeEcbSIDhxme52oFrnCMp56gj1RudoNscP3VzkQeCzHRBobjyc 8tHprjlgL1cPG5iOv0Yi8vy5+7a0vaRwQFK/KvB93k7uVaAgQj+DOBN7evSuWCI= X-Google-Smtp-Source: AGHT+IFH59dMtSyNh7I/3WfwlYfHuMIivRRdyOaildtpWKUEoDTns5XbC6x76J50TkiaYXWsITBbmg== X-Received: by 2002:adf:cf09:0:b0:374:c651:4abf with SMTP id ffacd0b85a97d-3788969feb9mr9056641f8f.52.1725985982855; Tue, 10 Sep 2024 09:33:02 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:02 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:43 +0200 Subject: [PATCH v5 1/9] reset: amlogic: convert driver to regmap MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-1-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5135; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=4VEzXjRyAdc+s0ybDA3IP98hrZK72BhbDpiWxhkjQHY=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS0LOglI0FGds477b9AQjE45jlk1P8b7S9Ch gvPHtXspCmJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0tAAKCRDm/A8cN/La hcV3D/4gRYU9Uq7kJahPMTbuJSt7Ql6GYfpoar3B0U+Wo8OAw8hZOR10Yc4wuWNRsvrdUXz7TTg THwq0hEJtvshHYIqxuD/kSVrTE6Ha0Cyqq5JoEqzmxr+EVBPgIJRayEx8iNlC2y17kldgKTENgg msszAvsvo++eV5KIIl3mxQWoQ3eoGrYJqv73DEu3LNAhH3KYjroR7U5dojFH5UVu2H7llzbz1xA Re3N4lkfnbvZglOQ+Ur9mr/1sGGQJfsjrQmeGW5CvQlk0wKW8tBi0+on2e/fMk5ejRuuP2XedcN 8i+Wm+ybn9I0QBZm2fm3OhSiJzzh/ZPTVHIW5PQTsMTMP2jb7/mBRIvfEhH1OM08AN/ZM0SQ4r6 txAhLskuqHZDsMl0YsxU1qzZX1K/M51hzq/OlBCsf2Ke6eKTwQ01BRQFtwibcGi9hk/aQzbas4M 4cdpCxLIQyZK+wPSqK6EWU/Eznf5pYnfW4l49Hyh7b544JxTSekXmNv76AID0GXQZl7o2aJ/uRJ ++5blmIBwvYS7dQVRIELRqhsdlQbzWHA42y8mYCUibeqLTwo+l8xnMy0JW3SLklGDHZfoofwiWa hTMc4l6jqK26IVKH9DGupIht0K8j2cxO7YfJA1Nemy4vvNLO3GuapbAaxr1oGcDjHDsDoyuxnls jltoZnT+NliAMcw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093305_578791_337A5C77 X-CRM114-Status: GOOD ( 20.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/Kconfig | 1 + drivers/reset/reset-meson.c | 79 ++++++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 5484a65f66b9..c730ba6f678b 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -157,6 +157,7 @@ config RESET_MESON tristate "Meson Reset Driver" depends on ARCH_MESON || COMPILE_TEST default ARCH_MESON + select REGMAP_MMIO help This enables the reset driver for Amlogic Meson SoCs. 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 Tue Sep 10 16:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13798921 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 4E23CEDE9A3 for ; Tue, 10 Sep 2024 16:37: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n0U3ETN12gpBLws4jxOpUFqH+6wugx8Wdm0xkOdNhP8=; b=jXqbjuQLtrfx4RS3twppqMfj+H tRA8R3boujNF/h4rEY5UtqJ1+DwKtRxCU5qZyd9vi6sbu+juzeLYi39iLTnNSyCA5U/bx+h4u4Fal BBdGubzXrluB/rrqTpBfFBHqUJbUQL3yWcaITFDhEBpk8stNmXwY1/yb6pjSZVKLoeoXCohELxZhb +UooGzTvqWE4cfyO4wQcN5CvTZe1/PrwaLwXyiLhAGPIRBhWk+r2j/rkXsje09oHKHRbpj+4fTsvS PbiO1gyhRfElZ3EfEGgyWBWiS9JzbtTsVTDMHYhg1PtBprcVjC+GEuNrt252J2YPR9dRrClJuVhqh Tc9FkcDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3rP-00000006MEJ-1DJW; Tue, 10 Sep 2024 16:36:59 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3ne-00000006LBk-0TZG for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:08 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso53465155e9.1 for ; Tue, 10 Sep 2024 09:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985984; x=1726590784; 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=wA5aG6VIiO2QdHvEPr6INd3pql51Pi6CnM92UG5Uf+cySWY6zaFPb3Z071U8gN/Emk EIRFPMTijqDEzqiztbeCMg+yxYT+jKEMF/g/d+2YPYg6QO29r8UhiH5wZeAtYy+xpDVY Q49IT/+bApxVnT4mhjcsompUsp5S5ZSWBq1BB+C8m5xrwvwi2mnpJzN8ZGkv/N41JnZF 1N/7Y8QALdLenJtGD4rvDdNy0Ek2QCg5Av1zuAI4AjV93xCa4AJnjTaL5y5JHkqBKXFX I0e024B0D7OHNoYqxH9CtpXOV7rsHSAZk2DCEZfJXjTOc9iW1MnxCwzEeRWO5Zdik3Wa g+bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985984; x=1726590784; 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=bXNJIJU8KZ2J6Ff+6uSdAcG19oAPm+6JXM9vHJ/vkWVtiUnsr79jD4iOPtrxGT3EwB UbERxmnzC0RNySKFMyj4rLhMlOoUjNKD73wZpW0qn20tlPiqAq1tXSbl1hN09cszxQ5M ng48vmKPcFoYFNwdWHfITh07juW6Ra/whvmcMMb3c2OhR/kF4fXHLdpDMduAjYWsXsUW F+pOYnBGZhYG72dqHnjqJTWOFuJx01ac4eDYDQ4ncEsz48QCANXFwDG9yCs5p3ITO5TX C29+MXhJbtPvSkq8qP77lGXfli6z5IdNRfbGre1XPjQZY4fDRuvFRMhhapFgV5JKS6fM 1zSw== X-Gm-Message-State: AOJu0YwDPPsIWGaLkGnI2Bn+AryYbFRSbRnd6nThUk1eYV/9YHXRWqxt FBA4aqwBSzKxW84kR+swTr6sRArGiXdr4e4QxwznpfXvpp6ZpsbiMKQG52VaQa4= X-Google-Smtp-Source: AGHT+IHShZC5ser6whptXqE3MziINpbjBLNBW3nIUDCuOdeUJAsHeKnZjihpf41vXmHzwdkenZA7/Q== X-Received: by 2002:a05:600c:1ca0:b0:42c:b995:2100 with SMTP id 5b1f17b1804b1-42cb99524bcmr46920325e9.6.1725985983707; Tue, 10 Sep 2024 09:33:03 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:03 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:44 +0200 Subject: [PATCH v5 2/9] reset: amlogic: use generic data matching function MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-2-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=817; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=TBFxeGrFtyl6fNkBC1RzGGAepksDKxjvf8LT6xC71TA=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS1Tkc+OOhDTyGuf4iOz47SD4YGoUz7E+CiS j9zs6E46TSJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0tQAKCRDm/A8cN/La heo4EACaHd8VKcIzQJwErNdFqhTeL2cOA+CG3ICx/ce5La3RkdLGPTaHDUhm3zbPRsiJD9yjhDq h/cSnJ9bJlHcZq1G8m7oLngE5vcTT+m1hRv2I4qoFPXJBdv5/UceUHfpAXOhEURdAVbGLBNm27V N4l0Sy71IZ6tzRTbH+upcUJ6Kx9CzgKthfROp1YZ7zD48S5ISB20/G6n8pPfmXETtlzRNqgisOm B1fYBxPUAlBBnEtiXYzcNJmfaCo5jPHevgij4uwrsie185bk1AFr3KaDGGPw/LNEOs/RY5XhzUD YOUBpGTjZChUJtfyOr3z1WdR5+yqgonHq5ZLr7PvZrDjbJ1mY26anrHktPP0tAlSmle69BZbNID wE2ahBPtUKhUSBkpbDpG8FqzLe7rU+frCKzvt5XMYfoknEwpFIoHVYamq1u3p5MkThrMe4P52Ug z65bOHFHwfvFMcKNhxzOoKPA/LjGlaccL3z2/p8iN1CNzAztFKOYijwJ7eAD73YYNe4SKj3CcZ3 /MnmvxyB/4wg1gQcPyZCQVzdEtozcDAp1V77yOuDntw53GaXCaMGrViwCt3xxsiUL4+S8TkCyuN p5X7wasd/QoChIDLr/pf4jHpOzFtzOiiBO4MqvFz1cN8fH/QmIf7F0WsK8muH1OOvO21Vo8QYll 3Xl8IjLdwY50hfQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093306_260172_21A95FFE X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Tue Sep 10 16:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13798922 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 36F6FEDE9A3 for ; Tue, 10 Sep 2024 16:38: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=zPFzzfrNGp3n//aiBK1y1VtGXH gb5EvtGZJhjH3HKuiJHO/VwwmwmCtg7wU5+18ucis4M/YqCPleneUwTNff7O4hXfeHu2HikL9OLzi gXmpPMMtsnjy51d966T/Ux8hgc7TM1YgnZznKfJe1DTRkYVgLJ329IcBvYeGpHFk1XxlnLVsEd7o4 2Ght4z9PPo5AQBAwXH9eV4+Jef2Qn1FeQnxq/DhILh2YB00IcPrVPi/h/+ZdshQRp3YKQut4ZmpaR 2ag2JHJDkJAvPz22EbJq7fsIGVr3IpUGhHZ+xeON06f6Y+U2UAIZKnHpvkdWO+j8ESveIRHFaWdC3 cQzVB+1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3sQ-00000006Mlp-1eap; Tue, 10 Sep 2024 16:38:02 +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 1so3ne-00000006LCJ-0IM1 for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:09 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-374b5f27cf2so3417420f8f.1 for ; Tue, 10 Sep 2024 09:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985985; x=1726590785; 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=0fp3Yfgd8k8w+Tfvzd37yQZ6cFHB8IpMP/wi9kUTp8Npcczf9jhO3ENwYdz8zAPOib G5uftl6l4ymjp8r1JBk5SUeS89pQLjh7i7gx4jpFmJfWQ2m3N6o+twOkPFutMmN6TJpc thjJj3brYSFQfdOVAD5oT7GbbQCDJRB9ooy55nfHA1HnNz9+2uTbkkQBQ+S9xpd4umP3 bI/HulgrFmo1rKP+xUr6u2JaoAvR9VPkqRbTt3ohvq1VyXppwX0766Cn/ah8iAXPR4X/ YlSB5usdFj4vtncr0xNqRfeZMR1X+aFmZ82ZNeZlncUu3nyZ/2LE4bJ8QxdM63Zo41/A LVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985985; x=1726590785; 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=USsS3rFryBHUatBeeAZjHegPf4HI23AESYuykQT8wX0DQBc9gXRjq7KiTVyCR9pII5 Sf9mm50I3QtAqxIiW68ADXEsx1Adq2obONProH/Tjc96vcI3znX/pMRmiFW909HplA6F sFQ9RcCWlzlJYBjX5KEVwMbcsmSV0Agd6c5A1/4KSrKE/fkj5NSyj1kGS+NJ9ZT8u8T7 BBJ345HDliicDn6OxRlP7/zZPiIjqMIL7SBt5ueNC5x83qA8QvJue2Fi/qLdX1EuFfLc C5yt6Mdq56zoCnbVx+r26vb/yXBlmzQppVmyBill68/GeLyhJOB/rqblug3wb+/Mu9tT qyPg== X-Gm-Message-State: AOJu0YyKBdHiV7FE6Y8tjdYj3vfqN++oQeOaJUMfCkw0+IKVjTX8oLK6 Bm+/CROAthTKNL6lywtlhY0de80kLBUSm0iYvMsrebHpw7VvFWxWKM4EPhVvYfY= X-Google-Smtp-Source: AGHT+IEYJJaHk2U/FX9vPPozpXuXIiqpvUnZX4hJXDjt5ixtTHSPLiv++R22SrtDiFbpcEWrBAzjsg== X-Received: by 2002:a5d:4fc4:0:b0:374:c23a:2ce8 with SMTP id ffacd0b85a97d-37892727bddmr6243973f8f.52.1725985984538; Tue, 10 Sep 2024 09:33:04 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:04 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:45 +0200 Subject: [PATCH v5 3/9] reset: amlogic: make parameters unsigned MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-3-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=737; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=I6joFYKtEZpmpOu7whQFwYwYWPHiUyzVlrs8QkUbiqU=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS2itiARGZrvq/tXETgO2AUVYcuyrsCp7sa0 TH9q3ap+YaJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0tgAKCRDm/A8cN/La hYasD/9S8uCMfSuqThBYflvkEd3zYbAGGV2FKUHajNLbUZ8VsNZkd12w8M26sndSWIOKHfuxjX9 +6MJOUuFzPgOtJGf4SRvnrbuxybbEHDCdebuH/cDExu+w851pesycvMjHWytEecEw0NXZjwtP8E 9zCL7KqqImvL00hVnKIYeTFhV/RCFMwkdmmPHx4AJk2FC47EWJiBJY3dtTzF9qwnyPnB+0HebwO 6Qq4VpsarQpb1fbJk3zdq9fNxSAQOPf6YNZN2C5A5/91iokwBBx9nguKnZkRpLg/I5IjnuyvTG7 wDVcRM+P1jDrREVS/mbt4rS0LpPtPowBIs02f1hJNSAQ+8Jo1k52QCiA4BpHWZ5T7KQycPBTzof BJF9Lh4CFKTTV/oA45QIkebSFA1ME6YH2UbRRT3cMEdds1PwIMWQpD/u/DtoUzZsEVIYGMA+Lr5 jkz9xuf0oJaKnaQ4UzDD/ctFZzCTnoCvIem12B7njHXYOlJST8dm/Jpec+EdrAWLQUmmEz4M312 7ZqkkW2jymzi/jvgNHor7I904jwR95vulk5yYyWujz6jb/2xBpM7dmKMBr4+vcVkfUI4N8QjuSJ GZnXwVTDvf8+a/M4zGQn6ENeqirvhTx5idTF2OrAfvEublCWVlY8LdTsv+pLuB9Cc0ttIpPRPY/ K5THCKSgsv9WOTw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093306_375079_5DC462CD X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Tue Sep 10 16:32: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: 13798923 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 A3FF1EDE9A3 for ; Tue, 10 Sep 2024 16:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O/Yf+6uxXV0kV2P21eOVpIseB4Hi71hF6SfqZ+9Zm0M=; b=zpxEKnWe/lJsVgWDQ6pbxhXB/P KZsi/VwUVh/xPURTJyPonU0DRlWtco2xM6KwU/bIYZz7GaR7gXDnYS6Ofc+mbXeOaIVCDrvLjkqid sudRyelSQsvLFsVt/95CfS2uTC46jQnZfQBwgkvCRiFYIFUcTvowsKgpSKj+pXaCPULYbrutDbXm/ yZKfZAHnNVRFpL/agR4G4peZJydnxtmdBfMxwnYKEGlIudZttrAOxXAlM4DVEkzepgBMgDcoDLxru Da5McoFIZNUPFaE/oHTkjfT41AHJu5u5sbCnoVuuV0dBxFeDxZNQiF31dH5lyfa6uhs1y69CWJSri elsHBI0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3tQ-00000006NBk-1nPz; Tue, 10 Sep 2024 16:39:04 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nf-00000006LDG-0l6Z for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:10 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so9920805e9.3 for ; Tue, 10 Sep 2024 09:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985985; x=1726590785; 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=SmrKYEK7HwZpxY+rQj1+rqixcwYlbPkVwW+yDle9iJJwzymCfXTtHpJDmLweSlozsn wLZ0xiDmvZBlEK+EIUbg58j65jaYzuTB0XE80ok+jm2CMxObCCXI9+AOyzmDDEEB/S7H +p05TBnLXnrYcVvzp2yU9Dho7SljsxC9Wmce1qenuUthq6k2bHIZQJMSTU3CK3bN5Qg2 XSChOeZtm0DRzc95ms+xjVBq3JpE7eAAz/lV/MMtbNv/ZZ3SRlTtL8w9hTNQA/ZDHrzk w8wueuncCIDDSQ3oGpuTTHapu2b5Nt8NLBeLdlDGrppZZR+J1eE90I0dVZyP/Xq3Gq9C ivgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985985; x=1726590785; 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=aIo/G0Y8zC2ihHEzkfcG8EtWVunqoaruYVVP73OH7B/cC08LaN3+XKCsDh2IoFvdiC WTMDzHZ7Bj7GsSyNcI6y0X0NqgJv1v9xiej/mXsKYH+m0Xp5xW3guCOVicLjJ4hzjacU ytxhPZDGxlSjeUEK7rBIG/K/7+5hlkLeaf2ORygpFEqrB7615TH3V7mrzrejnATkpPAT ER0KZOeaxfLg0sktG1eA5kQacVm+HnFKtjH+QVmFJRnq4ZiF25KHKf0NoZS3A9aLkadz P8zxNi89n1QWgxU/j0MSLt4vldPOmC++y2K2SmXslvJQxvG2iBWXi0EXj5MrjnS76Jdz MH7g== X-Gm-Message-State: AOJu0YxDTESKEYwcBC5QQfcyzl1LyrguBc2YjpPkqL8uEuLAR4q1oatv ib/RyLpW9sB/nBto7Wm3CYtP2asrSyowDT7RruhCs4i+ESuM93mgHmQbSxzHf64= X-Google-Smtp-Source: AGHT+IHTj1g8Y395YW3wLjECUH+eCckaYId/zx6ot0b8rNoXiVuTR4Rq2dpj9I0vr3gefwHx3RCAxA== X-Received: by 2002:a05:600c:3b25:b0:42c:b905:2c04 with SMTP id 5b1f17b1804b1-42ccd325012mr2207915e9.12.1725985985361; Tue, 10 Sep 2024 09:33:05 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:05 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:46 +0200 Subject: [PATCH v5 4/9] reset: amlogic: add driver parameters MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-4-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2306; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=G/tkeTFlEEIIRl13gZHjvQ8SKXa0knkQG6ZsLKG6Sak=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS3TGn2HCTwzONvcK+JqbnLVn31ARCNTMtTE h4EpAyoLdKJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0twAKCRDm/A8cN/La hZOaEACwoFmJBZJC0dAuoD9d5L/78cmabU9CiavCRFGVKkqa+GZUy6usmXyIac4i0bnd611HSQa vtmP1c5D5GRo6kfRDrbP3y4RkINUB19THzvysfcZu2AfMCJDnCb4FE3XrJD/ZRnzZh8gtYVhnYB PExbL5n28LHuibOXeGB5pT46CYR3joyRQ6LxwXvxEx6+JZkWjMrd/wkREUuqEfqJ9AbHbBcEGqi Bv2lWXv4hntGJWRLUuK6J/n8kZY5Sf0c2ozu1Ho3f4K62kcJlwOmii97BubTJ/sJFFK41SfK0S0 iWIjpOEA06NfL+VQWsuUrlOKpyiZwB32Hu9El32JS1XrKlwAfUTTG5Cq4ZezmuvqI/draqbT4gc H4Cn1cn98ZnBWJ8StokvGVh4RHlD4WjcTBIQqGzxQLQF5ZA/Ypxze125XlTVHmBbY7K3Wln4LgF 6v+pi0hMlqZiIs4PSEodj8DaCcKLRDwHya6M+XO0Zl4Q9669IKGmbSPtRTRCafd3mozDcUHEGPn UmVIjPSo9z9aOdpQqCInKP4wRz3x7Zvuu/0GAqLJRejkZ3ZtmdYXzTFPmYNwJt34HhQvMKGRshR 68rKKWYbJIxr4/AWTNEPfRZJ/mnnq7I36KrfVW8a0gFRbIW9pTXHaLHzbST7QY2Fw34Gw0vBY51 +oL2r8AAbh7C/fQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093307_449757_5E4DF75E X-CRM114-Status: GOOD ( 15.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Neil Armstrong --- 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 Tue Sep 10 16:32: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: 13798925 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 49F97EDE9A3 for ; Tue, 10 Sep 2024 16:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=Nt8BVBe23vrs64W8U+bX0eva8x H/TL6aU+/MmLPxa2u3xGRMvw8NXQ75sYlIeg1ErjdLRjaMhSnJt8TqMWVap5n0Gb3KLPgdSONWI6C 5/cn5QntM2VW347Wxoblsoo34kGnhtT8hBlBc5TC4a58uz7WD5c8sbPWO37nrwqHDksZbuv7KWYtz ot9fvNgMJxjT9t+RetI3qnhh3TN8hTTkedfZvMRDczXdaJa+4c7f+tU7tyI5ddC/dBbq8YNudVpip x27EKJFkEddlD24gFwqaiF7NEMYvqD/12qvYVvIrFW/mNy3DXJm79Rfir5WaGDrB8CSkH/dX4rFGb xkqJyw3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3vT-00000006O6N-2eJb; Tue, 10 Sep 2024 16:41:11 +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 1so3ng-00000006LEe-0tCc for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:11 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cc8782869so4782275e9.2 for ; Tue, 10 Sep 2024 09:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985987; x=1726590787; 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=e/Bxdt3Fhd0cux55q83hV2kvv9y5eVN73c7H/Iu/d18LE81hfNHI4b6bejMVSUGDxQ skPgkYIz2crBH0rMa8vyCdlXZ8TzYbcxsrZNlMyGJuMAkxu4t5hwZrgrDho0MCfOp1mx t2WttHH6JbZG2M8Ml6QQMRKDR2aENPOEVgA945TC2sL4xFYJYW9ichGw4vq1lA/+j0gK jRbuSZU7a7oJE+pZZKvHNpMDZSKxeQNgzdeb/YFc2GX/NqSHmKkTNvZoKHlaAkqFIhjv b4/ToFYyu8tXNN1Rqj7QL5msKXDTLcfMM38OQJN5uSTAvQ/2J5dj6tNIjPLgdOB/kvb/ 7ydw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985987; x=1726590787; 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=PngVRRPy1Oz5Lx1q+S//Vz6cOQv8T5QNGIJ3sy373IfxDAu9hAkNldZ7joXTEVgyza FCIW9h71ONZOQpoKLzNdf7OpeuMbqEJEv/8AGpER6Bgx8TvlQ2CECdcq5PAQzDqB0xwu gk30RzNViD1i7izu3WYBT601Rb9YzkDDxajcXzQxfLoWvtnXDRl4BlJ7uLaEG8STa2E1 tynWgKCQfB+4iotEjn8s2KU+yy5q77bCnLl36Hbzm1vXxmWRFr0qRF3Cq3sSr/JZzEPx vJ9/SSU3F8vX5w4GpO+zVI39tvEcWckJcJ7c9V7qz1sr+mOjf6mmdecfKgqAiiiOW8SO okyw== X-Gm-Message-State: AOJu0YxvKRiSlVZsNSAm/0woBvRuqEyQEW2sJqqgDc42jDVbbCg0yfa0 PDUSzauHu6KUwiRkcNUw1b48T+Pp85NHpz+7EYS9F/UONIymAd6FMLBFvRt94hw= X-Google-Smtp-Source: AGHT+IELeFZVXHB+dwXP0xf8ZS6Er0WzIl4bpD5+ge/OijJX97JS1vEUgvv9Z7lgj+Okf1bFaFzwGg== X-Received: by 2002:a05:600c:3505:b0:42c:b950:680b with SMTP id 5b1f17b1804b1-42ccd32def2mr1984735e9.20.1725985986626; Tue, 10 Sep 2024 09:33:06 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:05 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:47 +0200 Subject: [PATCH v5 5/9] reset: amlogic: use reset number instead of register count MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-5-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2112; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=iSedGQJkeoX1rk7eD0ZddgTbF2MZs7+12PeFSEIOANY=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS45Bs5y3vQPAmVRmGscavL+gV5EWCMzd7SC 9DniJBvY4OJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0uAAKCRDm/A8cN/La hYidD/oDQlXMGcC2jMCZUcZhPtkNwrsiXGV3YnQzZ/hEtN6zIOn1pG2sP692fUaetlarc979okT 8FKOG19JZIkY3XWvjinkjjAA4r7zladAnmiUBjcIBURVH324hvQEzfvZfyM/rby29mHLZ2TYZt+ Ck8Xln43sdaOBg29bIzpPGbGFn/YrjYl9uBjpV7rFqzsb7y2mcsShZ/78n/oc1XemLRjEBO5gZM RrkCyKKjh9nDwUuP8yeAysbwIIpLDX0r4a9qjc0axe9ZWZb0Ikrw6B3sS9xsXN483JlZaCp0y2Z dT/OYZAV7R6uLFfwQztxV8kC7eKiEUQvoDKt+9TIGaJcY7DgGLC+YDW4cWEpkManE4NCyjUQQH+ 96R0YMhIiEqOK8fCbblAVxQucnVT5Ndtx0zB4SOnr1zlWrWboCVPVEdDJp9P/IyyKTddG/Y7egT GAvDOY3j5Y9phAbBuldCt/RlckHHXArWis5uvbDmS0UbqiYLDEUHLYDI7V13F+UOYOZ5xPDbK5y AVu2RffIF9oihE/UG6u1Hz7/mD5S3AolHvxIGeOMb9vqKW8RQbVwhdF8jZ7DKmU42JLOiZ3DlqN KhGydB/QWi59I0xvR53rUOvKYgVJMLt5n7W9smRox69akxsJwjy03hyqVZA+/ZL6zEXhl4lvm87 vN9FRnWbdwhxqWQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093308_455578_AEE94A7A X-CRM114-Status: GOOD ( 13.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Tue Sep 10 16:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13798924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58CD4EDE99A for ; Tue, 10 Sep 2024 16:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=W2USI4evU1TlZoi0vx0ljC38Z3 sUn1Bwl+1/GsG/tfDpD62uKZSpgWi0uw1C/3UEuFxrejUXKpeR+TQ+uOgAGYcS6MDy6Zu7yBjc0o+ ZeXOMuun2oURHm/Q0+SMQytiwHnS38GguHI4DCUAaLeS3vq4C1WoWeLGAWMlbui7Ne6iI2JsgCnHK vIvGnOgzHMzglVgm7Bml6EkK3K6cogYbhGQ+OPVhb5uPD17ewHhxdpM6pnz1W7IT8E29Tvng0RC75 UdZDR2W1Sks5PkCnAWih5C1e76bWM1tTWCIo7alCZJ25+nCDkNnyR6tUrwEmhySGsHNCfYi8cE0oV yLGwdKGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3uT-00000006NmC-0uxI; Tue, 10 Sep 2024 16:40:09 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nh-00000006LFJ-1hAm for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:11 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-374c180d123so3227245f8f.3 for ; Tue, 10 Sep 2024 09:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985988; x=1726590788; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=A6dxngggIuJ9wxMppET8hxXABE5udPPlrof/efQ3UzqyUzo40UAywiLwsXtGf7yehq XrBkmEZ9Uq9j8BX8iQxeABuShu6mbejb3gnRWDAWdBQRKcgBiHznYQJjJiVux/svfcuF QytmjqXJ0VuTlQ4KoUjgVZEFfGWI6XXg5cedC+FtfVWXzcMVk7Kx46RvJWrKShCW7Sq3 5ZMiy+C8+CUKE3BVNE4IPM5k7qFdZyWcUtoI04/B+ZLG4bmFAzSoYGwwwOkygvJX7fnE R3GMUjS7RjEVkjpawZVxpBhCH6cgPxO/+0HMIhDdVQ+ZrjmfYVI1OlHZ1kz+xGTbijyX SM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985988; x=1726590788; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=d2YZc5LbrwbZcDd5SXWc1EYmbfuzcWck6wOKeA22mDxj6ulahAuhCm7c5TOBjInJVr HRX96Hg8Pv4fCxh/ulp5J+WGJYImie4YuZVjF37w6Fc0LL2RtucqAnuEco5jmtstND4m hukx1slBL6dUO3xhAtZA5hZywTDonXCjOH5hFJUa6VpKUHjI9bGiX2kWsWofpPzW1i7+ uCUO2VUfSqMZUes1XRhpNUWY10FEdbu7DwuLvHQyhfkK8u4ywYhveEoMlJ/Vh5PyuXMM cOmBTvntkJyPtGtuBVEWR81n1g6c573OiIH9dgm97yS4SwOCy2nef2Kltwtgz0R3Y28U ++Kw== X-Gm-Message-State: AOJu0YwtdqQuSlWoBK6P5/il018dExjzOuApJXtw46DjiCqMC+GLq2m7 13fdaw02fmtrev9Sl85U1IHTx4pWhPiACnljGbJq/OKIo/zPviCKiNycH+vrt0GY7FPWYt/zXYW p X-Google-Smtp-Source: AGHT+IEAQR9BO+yAiqhladmdOuF5JjCwDfl9NeIYLrsC3j51II+i92+uH3mBlNCFN/eHNfMzuinSIQ== X-Received: by 2002:adf:efc7:0:b0:374:c9cd:9bf4 with SMTP id ffacd0b85a97d-37894a6ac0bmr6234424f8f.52.1725985987538; Tue, 10 Sep 2024 09:33:07 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:07 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:48 +0200 Subject: [PATCH v5 6/9] reset: amlogic: add reset status support MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-6-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1583; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=uFpLNDx7axOqsTgkkJPsc6yBsPXI/ygS3MYpVh8ixvI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS5Os8nvAWVam3MD2aXk6qjTKElTgYwG+Kmm 81fEj+NPRWJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0uQAKCRDm/A8cN/La hcGoD/oDe94aoo17S/5UrJ6BEEh90EQJYvYYF5PUECrF/0sE2pzULDxN6SQSJCoos6SZRTpKJDn KfICwBxmuB0xw8V4/nmyQedtEXVXk1Kf70mAAJv8V4NL2iSgN1sE2sIjopMdiFIGiFMLwpMbyVW sfadAYSoKlovdC61RAI/KhGdJC5E5Am4Z8yfbyte3uQRta5Exc1qZW/KIQURO+SOLECgobPOWn7 VD/YoCt4b58k+36xBVn220LxPQ2p7824F159MBmZ+jlGLyI8iZGqmfpuSH05Uw1WAy1uRBIUEw5 TffX4O09FNQK/YCrEPOoaoW7rMgmt/i2D1X18yNSShFBaBv1wWy/cVUZoRBIUzj+WItN2gu2hxE OUPLhhrdIy8HHDwZ8rmy/kYc5X41OUYb4SJyVIqdZzTTuFKByz4iiAaB2o2ueh/L3/Vwk1J+TNh CLiKbvfCwo6fYos2qhZKgxESTmGjT+h4jPrgke7pQL4MGr/oIJa8L+EZ2zbYhOqWhY3ggWTzqYR VAW1PHcDfflSvfLSj/kIw4TRupXEGn1E41vRThuQOfKjnk8Bq6p5tE7f+1hMERLbHgArN/8qRyF ujXJXCUB+iLoIivAAWgseixWB5eGPrQ+aNaTm9Jn/lcnjHjLzlPKJpLFH+LpMdtRlmHP6fX6jTA RfjUTfIn8IhRhXQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093309_543543_2E663FE1 X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a callback to check the status of the level reset, as done in the reset driver of the audio clock controller. This is done keep the functionality when the audio reset controller get migrated to meson-reset. Reviewed-by: Neil Armstrong Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index e31c1b7c9e4d..af690d3012ec 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -68,6 +68,22 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, BIT(bit), assert ? BIT(bit) : 0); } +static int meson_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int val, offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + + regmap_read(data->map, offset, &val); + val = !!(BIT(bit) & val); + + return val ^ data->param->level_low_reset; +} + static int meson_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { @@ -84,6 +100,7 @@ static const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, .deassert = meson_reset_deassert, + .status = meson_reset_status, }; static const struct meson_reset_param meson8b_param = { From patchwork Tue Sep 10 16:32: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: 13798929 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 59ACFEDE9A3 for ; Tue, 10 Sep 2024 16:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7QSINvKV6nbZV2fQuAbJusgVvaCiwjnmEbgnT95Es5s=; b=kRBlQkFIf7fzyLedgwlIJ008BV mX4uYqQwS6DwW4+O9usF86ClGyayYtmc14EGIzE37zwlme1NVCZqEDyy3F0KhXqGancKUZNuEGxZj DQSv06Hc0e/K5CzsFJfqdInbpE9IRsQGOSqFvSB/dPtRN0AmUhiCAhDg4pVtDXfX67/5+QUZXTZds mrL4CpqNxjZuzwbUT44zOIRx4yk+xezOl2gE4MncqmS+us11E+3fIpz2/Lj8byQWdDPe8uxp7+s6g PnJmibDga6T6pyW1HSTwZ5OInPdvBmDpFZw+CB/yIEc/0ia/y5f6MBiWkuzrPhD/5/H4ylGuRyY+g UNchUf9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3wU-00000006ONK-28d8; Tue, 10 Sep 2024 16:42:14 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3ni-00000006LGR-2bUr for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:12 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so33488535e9.0 for ; Tue, 10 Sep 2024 09:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985989; x=1726590789; 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=7QSINvKV6nbZV2fQuAbJusgVvaCiwjnmEbgnT95Es5s=; b=YZTkQSZPzmltRYe1JG2p8HJuvXuPfIDOLtqpfCyDRxg1nMRiLFHU1Ir/zV9la0JfS6 XwrVmq26FnRuOp5M4oTGJW8+Ig5FHqvJVFFanPmZKVolmkIKOKZR1pRfoVzrj1Yc+QUY DS8BeA16E8cceTQp18pzdh0CNvqGbU/Oi3d/O8qa8etegx1jyKB7qgixKfXcqEKv3LyF RszIjeGl3nq/KHJMfPA2/fhRIaxDaZoQwbxi1PrgoQwSVxHMz9x2II2KvaZCTadkjxER JfCvMsT49a9TsBBo2rhmu2o7KqbcDsMxqjZ0Fw90Z5p8zXrslyupsTv3KV5fr4xngiqd Ovfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985989; x=1726590789; 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=7QSINvKV6nbZV2fQuAbJusgVvaCiwjnmEbgnT95Es5s=; b=SGVTkcDfIlzCTllFMs+ttZYZ0lbLIu5WRqe63ZhteMC3zgP528j3Jwy2XrHo4lebMy tBGscgdJdh4x9P9CR4Kvc3ih5nV0V6JjPYX3Q5Znsil5cT6irZoQcjASt5Vgfyq8vMDS 2fJhmuQPfujR18wAi0NN+CADIjg3P8t5NAp0qQ3wyB7mIbk9EagLldfp25cch/ORDv1A QcDPyRlcCuhi+lqb8c4LL2PAhcyKvjPn54Y7qZ7sM5TiM8X+F40j6WjuuTvTgYxxRh4P gA9RVi5pRejmmk7whiX2qrW20ThDeBhb5Nobxn8dj9p8+oMfsV54VTpnuBYJgJBhcfTj zVbQ== X-Gm-Message-State: AOJu0Yw+a4Ic2PPDoVQYBX8TPzY5Vp1rLnjoIHD+Z163vy7ow4B6zdYd j6RRFF+VOKbWnNb1JbCqf3OI67he+xxCTv2yWTJzC9jUk4B3+/ZyQrP8K4Mvaqs= X-Google-Smtp-Source: AGHT+IHiOGsYoN/QOonTnWDkK8vql9LoMqXEvKgjoSQX7zg5og4UwUh7/sOiYoeyGJfrJVS7mxl9Uw== X-Received: by 2002:a05:600c:3c88:b0:426:59fe:ac27 with SMTP id 5b1f17b1804b1-42c9f9e087amr145081685e9.26.1725985989123; Tue, 10 Sep 2024 09:33:09 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:08 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:49 +0200 Subject: [PATCH v5 7/9] reset: amlogic: move drivers to a dedicated directory MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-7-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4173; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=9xw/UbuAm3lkXdgMs5mApQR/yO7d5t0DYqss2FrWhZc=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS6n8wPd2WR3HfaoRCWgNRnfZ+NRpRnOiLOc gAnCM4mHzuJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0ugAKCRDm/A8cN/La hQFxD/41k1AeedXrANqdaPu5EeRp+u77A08mMOLI6TEPmKy78HrTQcdOxHVrKcDr8fS3UXuQpiq G91PrZSzurQS90IKgIJ0Av/JrTh+2mE3OvHKujuIiYVGlgY6WjgUUtgHUi4y1stDgS16uEe34Mo vtRCxFAlmof9ZbyvysEuChKlDYUEyxR/gBkDDiYt0Qy77IgzgbLCRe1tkVIYE/t3twvlvD0X/Qg jWSporf9EsnYygm66tqilaxGpM/cbm2XnN9tn0xQVMsDkRz/MIeTBBqMb3PTR8zmXqfB/cjf488 F52FSaiAd0AYrFUE4hrX19SqQ2jBtkGnjp2LlMTZu13ul8BzP8e9sqcRoJpOM7blhfyPxMRsBYl 2dc23+DtkT1/H4ehS68Gaw5j12vnQBzJoTTmApHdL5uuZubGWjwdvJ3TZMUUeOgNqiKGBLhyn43 sh74BNUBWYYQS/kOgml9e3zfIWwmXUZjlEb6AoSFvP4Zfdti5v3mF2ZMrSvtUIlqsgzo41xCuRH JxYNL7F4WKu+qflzt27jHYlQDhWaXYdX8tAPg8hWIXzitmThT0F+9vJ6QOZaCiBE79SAvVCJAO2 8TLxJ9Mp7CSnvDaMTm/9SzQIYal2+E2FOI6aIpgsD43HGluEjwguD/PasFJUafhw5B8FUdNMqH3 9e03/zOgRtnHjMQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093310_830601_DFC3D485 X-CRM114-Status: GOOD ( 16.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 | 16 +--------------- drivers/reset/Makefile | 3 +-- drivers/reset/amlogic/Kconfig | 14 ++++++++++++++ drivers/reset/amlogic/Makefile | 2 ++ drivers/reset/{ => amlogic}/reset-meson-audio-arb.c | 0 drivers/reset/{ => amlogic}/reset-meson.c | 0 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index c730ba6f678b..d28c4401a310 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -153,21 +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 - select REGMAP_MMIO - 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 @@ -357,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..532e6a4f7865 --- /dev/null +++ b/drivers/reset/amlogic/Kconfig @@ -0,0 +1,14 @@ +config RESET_MESON + tristate "Meson Reset Driver" + depends on ARCH_MESON || COMPILE_TEST + default ARCH_MESON + select REGMAP_MMIO + 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 Tue Sep 10 16:32: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: 13798930 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 A2494EDE9A3 for ; Tue, 10 Sep 2024 16:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jdhmdJqA/EyjrFNuD6QzQPCe1kr/HLVNmesNpkTvFG8=; b=bYVzO9x9qLF1kDXm1ooh6i5cR7 f2Y5kDTivYsz4VPnkrGPSUyWILDu1Ki1AgiRg1ME2Kh8YbNYtidJNGM1kghpjxHsT+Lt+DMv9iG3A DFi6HCQMSKV4RXLQopMFnvgPAE6uGLRZdld3kqUubiI866C73koKbEBMVwSxoIWSeUoJ/fMhalLUB Lyw/nfYaVh5hZAIyVtikWfHqit7XmwPo+l4qXahSkZc3NAvIgLDAPuaqpurXqYZyPxbi8XSin+L96 BfAJ5lmhU60pcCSkJyjFTc5nejtasocUxlR/yDyUIDUT0eNnVHilYn9PBkmiBBYmTDXgGYJ5foGUM GMeX0kLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3xV-00000006OhO-1DKQ; Tue, 10 Sep 2024 16:43:17 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nj-00000006LH9-2JEq for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:13 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so9921515e9.3 for ; Tue, 10 Sep 2024 09:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985990; x=1726590790; 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=jdhmdJqA/EyjrFNuD6QzQPCe1kr/HLVNmesNpkTvFG8=; b=vPlR5+Qq8fa9Kl95vHaRxgcGGAHEQ0qkoF50xr6EuUFSiZi3Gr1mKp2rZtvWSwTaFd 7iyxIORHtv/wupAuMOsB540gdsIHZUWTj3C5wrQbRpq1h9zZs9plXMEeuo/bnb/godvT IX0xr6Pu3XR50j+9Ud8WWda+JMI3g3GokfwgjQrOpEllT3TPPccEA6njKm8jiFJjiR3Y 4Ig/lyy6+WxX5CJNbrxppQ7o84SFHVaFIc0a0LNpeotXuvU11WnOCZ2RyfdgKWd7Majj 5HkD4Zsxct6eZYjE/rjy6bDKU1PZF0wcFGxAtF5NmPUOIQO3szlQJw+/hH0SyLn3/mhM dAjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985990; x=1726590790; 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=jdhmdJqA/EyjrFNuD6QzQPCe1kr/HLVNmesNpkTvFG8=; b=BAVKMvlRkMUaV5o51Z4lGij4bUYBQbKVdhauk7eKWKKWv3F1Ul/4IB6OL7S6jNqBXf HyX3LUcmI6lZyRaxXlcWMmBy7j2jr1fUjzbKHWYq5Vq67Zf0qUo6h8i0XdqCbZa93Dph EoNRvxUra1JW72QWwyT4GeDuAhyxk+9oy8gUPJM1GRY8oYspwmpjf9Y1ApsXAq61ZQyB TZ7yjYmNNIjKqB2eDYCHeD63xfkiaCgWxncMpFSqJuyDmC7/52o7HkBKzKuolMJrfWjp XnEZtcPG6z3UAU0+OXb/BMtxPAJshUL7F8ZcQL+9izu+wf3T0sornuyfQ0lBNKvWPZPv S4Vg== X-Gm-Message-State: AOJu0YyvcXp9xjL0xtdNBnShoaX6DRlkuEmsf4ZGclAL4aJRDlHoD9KE QPrQNESvo5BUrCPtblK53sIRNYkSkcp+V9/Bxxo6xS5SozH+rodf8MYtPmZSRl8= X-Google-Smtp-Source: AGHT+IG0AbAhGMFiLKIpKgecMzRUKowqar+Tq4u+vnpZI/+6Lvxx9Ij6skVPyUAN8aUk/W1kE7M6Sw== X-Received: by 2002:a05:600c:1549:b0:42c:acb0:dda5 with SMTP id 5b1f17b1804b1-42ccd30c286mr2390415e9.1.1725985989916; Tue, 10 Sep 2024 09:33:09 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:09 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:50 +0200 Subject: [PATCH v5 8/9] reset: amlogic: split the device core and platform probe MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-8-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=11278; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=Y2iBifCKerss9PeXY+mNFJFaOt4z3yePdb10uNuG3wQ=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS7BE55V32yPq8m1dzSvsGLZUB5NTINws7JD Duz7ppsnL+JAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0uwAKCRDm/A8cN/La hRWQD/9Rht4NZSryoBK6rvt/1gkE8AYg4yXpm4IX/vV9md2JzoEStF9v1pRbXvCmI8FGebY0sHA VOcf5+0MXKveEbIXwDa+b2bDasYnxOSAyi4EyidTUitXP525Qhwxb9/mBeZ9r2y0S1fXv1fUlnv Q77zf+NtCsXsE+creuzdjSPLa8VQxI28vr+6XpIOIXo4PfkRu1FcMO2UB/r+JG1MTFSvVVAfFIL jdj9pOGJBB6JtTsp8N0zvqY04+a2Rln+OGo8RmoRWSRmAF9iQiY49UNR0QbpLEbyokncf4YjW1H gEwBTC5BbidnQehnJouioBfHVi0Hi1aMffgNklJmX1ZiZPuydfEQeKCG3w6/RzZS0KFjI/SAaJw bfTQ3/t+w9Rv1xTvyX5LggLyf5aeRQ7uF//lQVEVZR8+sqUtgaZ5ao2bLPrWIUqOBgpopb/R42i WzXHFSVZJFhgNf47tSRs3Z8JQtadzlHN2LYM7MdVFVN7Xw5BtQkolJsQLduCfNwTlJImUM9Bbri h8A/D6Ebm+CZLvq8vGI5ig9hVF0YUER9q7x0aKbWQfgRIu0JpmDtqDFUQvAEKhKjw2q4zhmgZ1T ycGkKj6JWb1aSalcGkNk6kC1FQADmp2KRz0FBG+GMd1Zt/shZ4Qfa9+KDVd3ElGRV304T5cvX25 qCroFfMuPIAkE1w== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093311_840262_1ACF5066 X-CRM114-Status: GOOD ( 23.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Neil Armstrong --- drivers/reset/amlogic/Kconfig | 7 +- 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, 167 insertions(+), 108 deletions(-) diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig index 532e6a4f7865..1d77987088f4 100644 --- a/drivers/reset/amlogic/Kconfig +++ b/drivers/reset/amlogic/Kconfig @@ -1,10 +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 Tue Sep 10 16:32: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: 13798931 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 C32F4EDE9A3 for ; Tue, 10 Sep 2024 16:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DiOqSLRv0cjYat8BpAAj37wTt3CDM1EXasAdqabdPNs=; b=DIlERoTSsdV6qa3nEfdpR2Jibl fvuzK5t15oYxpHXeuawProxvag5SZuHx27Bjbu1e2g7RPNA0b3dOb0WzzDz9L5eC+b6uG7F7RmY2k u4Y3CRNWg6gPpnc8F8tGboK7i3nPuzknMd2drkRIHpWevRSe1w8H6DXtRH3s8SJ0VUzR6fDPL4CQB tKfbFsh5L3qQH0SFLvdGngd2Pscm5E5AOwyp2GRfdt6mLpUpATsmTxttRNNTk2a0Wwo5qWU8OoJoE 2CbvmuD3NgmOe6Bbv2AwwrGsOm9NEPgD9NNEbo/4Riu3ColuNA8jVL5FKK7PYMWp9Nip7KPWx/SW8 LtVaJriw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3yW-00000006Oxo-0N6T; Tue, 10 Sep 2024 16:44:20 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nk-00000006LHz-31Mi for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 16:33:15 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-374c1120a32so678695f8f.1 for ; Tue, 10 Sep 2024 09:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725985991; x=1726590791; 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=DiOqSLRv0cjYat8BpAAj37wTt3CDM1EXasAdqabdPNs=; b=1+FjZb4qANnPTCZhTIMEHs2JdOxp3wZwTdnymDxacNY1qITfsYl6bQtotI8XmtZttC 8zZvDN11Q8O/FcEyE/8Ko6/NJhjfCf6B708hTzdWX8VUCuEiaYiZWOq0wyUbC+ns1G8b sT7qejJwB7y1rc8p9wM3jwnpaoF/IrgVaZV6LE7lW7/di299musz55M2jEydrYvyxIDo YLIiX/UXbQ9Em4YPFQghPAP9bzAmfXRc4wyMRNaCs80AhI1J8AkkbpH85fCcS8Ksr4/d STlgmw2koclP+2nQTmC+pDOTFlqiywIiAP+Q9KtUfzvVzI9+gpEK1V8lC6CvjVOZOFY9 aQ0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985991; x=1726590791; 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=DiOqSLRv0cjYat8BpAAj37wTt3CDM1EXasAdqabdPNs=; b=wjTbmehFgLOMuiXa38vMWM1aHqRYDG1GuUub4JFdwxWyDoGOUtQ3Zev2fiEq4MZrEP 9z6lSYmyTxpZpMY34us7s3Vrx6dc5FaPeGR4SGBfiXIwKAGH0XuB9qYuPCxuV+W9IcUT iNjHG5lLeJHsxg3HGtVe+AOEBft9J4DSGTl74oFqGsbOYf5ryu48OyM1qSfIgOq7hGNx AO9lbvq9klTRwxfYyuqssBmzeubZcdweBSIqa2+uI33Bj4k/Gnnt4rIUHmVgRC6xchVJ CNi3DDwnUEHbwJyywWItdj0ZHBDNfa/9bIu/dHAPXH96lA8VtMQpbDXrDi53enN+hNLY DmZQ== X-Gm-Message-State: AOJu0YzeVoO7WTXcYv9C+GwO+F0b2bWdRq5v6J1W08g6ti6L3iGmvOeu aYO9SYHN17oY0lg9TYVs9LXMg1H5moTYNXYHghwCQfMSSYBbGa9jQwoAJ7cKmx4= X-Google-Smtp-Source: AGHT+IHOckoxe0JL/4WHoUkDjjXjPPgihli3S39FifyWODZU6iQe3Mih7nuSpc8qwfgocD/VgC6ROQ== X-Received: by 2002:adf:ebc2:0:b0:35f:d70:6193 with SMTP id ffacd0b85a97d-378b07f6d00mr146998f8f.41.1725985990749; Tue, 10 Sep 2024 09:33:10 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:8ba7:bfe4:fea9:65b]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42cc1375189sm25076025e9.1.2024.09.10.09.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 09:33:10 -0700 (PDT) From: Jerome Brunet Date: Tue, 10 Sep 2024 18:32:51 +0200 Subject: [PATCH v5 9/9] reset: amlogic: add auxiliary reset driver support MIME-Version: 1.0 Message-Id: <20240910-meson-rst-aux-v5-9-60be62635d3e@baylibre.com> References: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> In-Reply-To: <20240910-meson-rst-aux-v5-0-60be62635d3e@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=9862; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=u91lamdMkF92PpI/055SiMTUxxxWT4COkRvJ+pY0Iy8=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm4HS8bsGgOqSjd2mE4O60vlFbI+/HjwbMGSlHQ cvQmOJV9PWJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZuB0vAAKCRDm/A8cN/La hYdTD/4/1Pyh39PS/VeHZaFq6kuvxZkaQClJIh4OoHc57mBcfMPcf1hvW/npV/SEGYpRO+QCC5l psmjjow8oukt/0Gqafw/O2y+UrV95v/vlrKW30ZVAPU0a9B/GH61kIqoIrhO1VHu565zkwcabB9 y1evOI7g3E4E1YE+ERDmFI9Too0kpwmOzF0aBS6qAl2XGVrav7fR4opr+rm2/moGQaHjSPSbD3A 0CkOnpY4fK7hiP/ZZxDuL7Xp3Wr+kCPqm2b06TXosU4gtKl4jLMJfixSWkznmomYZz6eOpGoqxC X9Dcmdu0XWMDpSvJvMRIZXgZFtq8rizcBEpE96Iz46E7uXlVmUBo69LVAi1rKvyBSZn4y1a0g6W Tdy22/QeED8i53mrQzT1d0Zb3qyJktlv07mCXY3QIp28FFUQFlH41F9s9AhP0wA2byIcbHzClg1 3a7FqNHBLOmw7wY6moZJ99E9uWwRsio38Nmj8Ru4f0MIYhJ1bpFnGvOokbbLvMdpDKWorxyntBh JciWq29e4F8L+LFS6OgqwljAhdrC0SgmIcwR5GUrWU014c9WViGRrkfDeXUB+N1j8nOttn5TuWv kzd8no1SMgIDmqBYXB8rqJGrO3LLK0vqAI9ptaERtmSOrEAyWxdp8UDSd3uSOXRkNai3iSNncRx APxrbVtg4gqptlA== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_093312_836227_85011D17 X-CRM114-Status: GOOD ( 25.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add 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..3bee9fd60269 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_COMMON + 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 */