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: 13798911 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 2A98BEDE9A3 for ; Tue, 10 Sep 2024 16:34:01 +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=ys/iH1pdo+yD7zY+TiZtBRyPSodGI3zS82TLE04KFsk=; b=2IeeUaSqIeYnPM KKPU93tchqOjm/P4ylsh+c5w80gQlJ3O8rwWv00iuBSb19M+C9y2FNt9MoxzGdqCBg6YdBT4uyfk+ b/bgczDwDqYQyhowhbMVw3tZSVkLX6wuuC2qZSt6nszynKVAGNCWXXdpITnt//mHGi8YrC0mzZfC0 Dn4+N0spLto9dUUd2QKZeRSuOW8S6sEmqs0zPs3L1J5Lmegn40AIc1SsSitGygnCn87pSO5ig0gn+ IAMbSlbdJhTA2Pui11N5oPYyJkZck6MPzLDFzb0axOVpK/Uzpv8zqgS7nk0BMK7gdwTj3neRWdLrC Ya8G4gz2ONURyHnrhclQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3oO-00000006LQU-00gs; Tue, 10 Sep 2024 16:33:52 +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 1so3nd-00000006LAx-0ZJn for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:07 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-374c1963cb6so3615472f8f.3 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=NNDXZIv3S4nkYOCQbzg7C3+qb8iRAj+TsXnuNBWD6bQjxPkk5jd1Mj697vRRWFeVvw iAZ4xW0UDSxrTy7p18ZQMmUnWR5sR32jz0vXFDTssgjrvfm8KAOtC5a09D/CvWkG5QF9 fxmCTYfvkZZgZeM1TvKPRY4nPvRO6QvXO0+Qwk7gxbGKV3x1lzLy3qw9zacdVisFy6CG vStPt389NHr1IMdHX4X8yOrB6HXMo6SFPftHlyaptHWgKLTJzl4mAR3yopbJ9Q6766qW 6UznB9KEun68a6J2okV7DW3WWwAtFawXFU2/7hdOwi4GXZjMaRTbvfPHGhP7ic6BoxU7 6yDg== X-Forwarded-Encrypted: i=1; AJvYcCWo2+tx7K6dc6B+Zz0wUWhNyovNPdEoMN/dwfkuSylk7UMyKR0BeCVST6Px4OzoI6IZ7gwu3Q/V9xs2i5wV@lists.infradead.org X-Gm-Message-State: AOJu0YywrdRVCFHLB3vy7abPxNj0NcfJvv4uyQjgzr4y7WrgzKY7hih7 W1D/7U6d/rArryh8x6LfUyyyIQ1fxaNsnay4mbA8osQQD8xyHPiwT14FOyO2ZAc= 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_242860_26AE8181 X-CRM114-Status: GOOD ( 18.47 ) 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/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: 13798916 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 81EFFEDE9A4 for ; Tue, 10 Sep 2024 16:37: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: 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=t4E4o52XvyJP/6 dnBLMXtrxUUj7tzvREzP8/VXO17456hlGxJKgNepEVMRfeESce+MdzZJ+RfY9Q3GV4sVaVvqeyder wVx+RCIBNOoZE0eUBsFQfSPFIhL42B1kYLPSPSxN2GJwGQtwMrtvV0npNVReyGt0fkn3ESCGri12u r6z38WpMAYeUxBlyEmpTshZ9rsKiv3gIK65V9fa9Vj165p+8OrylHSLCIRlF4zPQmOzvSnwYEWn2x lxyBfr9tnEfzN9dyg3eY4Brb+W73XiFkPPX73vQMGEONcNQ5aKAuwXlVxJQbxdieKFGT2Pc1JToUL Ec8rshZNq8X4mZswHcwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3rQ-00000006MEv-0AH5; Tue, 10 Sep 2024 16:37:00 +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 1so3ne-00000006LBj-0T0C for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:09 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-42cae4eb026so34165015e9.0 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=pikdFwIWDGac8wIJiEGhEpfVNQFuIpAKugacNB3/mATq4S27zc2LkhzJDcJENLq2J0 N51nKj1Am5AWqMNY1qYEWwKRW7zpm8c7MXGhkMir33y1TtyRotjKSDa8hVs/s1HGJYkP 4x6zgvLiTvudqIQP1Uo2jm0PhyFm/1mOO1X24Up3BcVcA7keWngnFibY7S6z5Gg0mA0g sdtkpskM9mCOx4pG7RpPA17040s/fV0+fbvTzTVJTl9E89xtuSaOmxBww5cTgxfA0bUv YkK/qF0v4n9POrHSKmka8GIrxT9xBsnDEaCY77Ro5yQY9wnozZG2z8G38iZco8E0Ty7D e92A== X-Forwarded-Encrypted: i=1; AJvYcCU5nsS/gnjHzNZknTJFaz48193C2VsemW9AcFhX//pP8GV1oL3BEQRVZDRnuECXYyoVF1dlgCmF/kiFRi9A@lists.infradead.org X-Gm-Message-State: AOJu0Yyf5JcWCVwidRpKhCdd1osu7/sSNLPuE18kdUeLKrs0dXW12J64 /t1jBonAbAewLUMgQ4ByPGB9Lk9M5FD51Q5HcncLkLFUXYDQbC1BzW00eKlR4UQ= 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_292092_01A6EFA0 X-CRM114-Status: GOOD ( 11.75 ) 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 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: 13798917 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 A5B9CEDE9A3 for ; Tue, 10 Sep 2024 16:38:08 +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=TAP9x5wlsrKa1O /XRvBy0r0gcZKPspHjelB7KGMbw2q1x/uQfUpASMmLENZ7ujV2GDyuL8fGvqYSSr4JgM8egC0aeTq vMEg1yFCXbRt/dHS8h9pMTMTasXxTNdQYPHGSkgJiDxLuGV00MqDnO0b/i230MiKlaCi6Irui8AFh Zpt8SGCDtkp1I9z1ucxsvncQef1iO1poead4B8pZnvyb0MemXiH1khn99BqLKlj2PJD/TJ47ZSZIP EIb167IoQtbGA+EMQ2R073A3TktTKuY2eLp2kQKv7BnxbOtQTDecz95u3r0cL8xneEKEK7TuBSkSr yODd/WfW1VTYI7uRmyBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3sR-00000006Mlx-0KU2; Tue, 10 Sep 2024 16:38:03 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3ne-00000006LCK-1p05 for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:09 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-374cacf18b1so3335588f8f.2 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=RzAI+sjErcM0zVzQ0GC7NhjvRogXek05u7LRNTPratXWkH4IRGAQ/MvbTzlZZ/pEAi ZVaLriiAFCkpD+xiEE6zl0Q4K74dE++ueKcj9zH0wlLIeU/cuevxO47S/+RZZ6VLCcps F6n16qrTHLm6vYMT956PvQUMPeU5qgrkdn9sUQpONbRvRniXt9v9taGs5EFcduAWvCKr tFWRaq5wvLpPN3DBDL8YYGOya7y1DUnWRxh+BmVMfOS34JLanMK3V5kE+fHXDP9zo6vm m8qIQvyVcFjbYaqPZmyl8+dvMk8ey1Jj4Jjfm7Qjil2upiQwKWEym+uP7pR7l2fkAbWp h3yg== X-Forwarded-Encrypted: i=1; AJvYcCV2Aa2EIsVsTw+G4Tqu4hCdCS4liDhqZFFL9CdQzdruOoQVvLMU8Q5HxKnWXYSR/4kyQErYQ8hr0ToPxumG@lists.infradead.org X-Gm-Message-State: AOJu0YwCMkMYQPd6fUKRHg9u3gySKbunr3tLUE6bF6ed8YQYHhsmDn9U dVzqys9VDUf7ql55XdfeStu78gSoQqYujNtnvDce8p4kmTu78NKBS5bJ75XKKGI= 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_545381_029E26E8 X-CRM114-Status: GOOD ( 10.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 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: 13798918 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 EC676EDE9A3 for ; Tue, 10 Sep 2024 16:39: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=ZlvdD4+4NJQYglI0zY9EOqll2BO+gdvyB7fgk9Ap2oE=; b=utZZ/L4LcSM8TX tJ9PQFKuuBIDgwKHPr/zDEpg7lzvGxykBGqKKPOfIJ0g7Rhfoxn+NL5rvXoChbiQdEOteJTPIUE83 KBDAdbhVUy9mVBcelNxffbOJunsjAm4x0sc8S3ersdT/2KyFdJ/aNKt7HPQ0psbQxPAMqNJB3O8kG B/kss7DKJ3PB8S3Rb8XXyiUAiwJMI0HUIKriqQNaOSez0qzY0VYKUrnX234SMzUh+Fh6fEow4DFXz fDu4SKI/xCJ1KBJ/uNnhbPI7OXkxMh3TSSpWX/yRXD0fPj0Jho8jyttxmsV+wgVOfm0QTiqVfKn66 8vyFHbLosCzwvfKz+sEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3tR-00000006NC5-1Y1B; Tue, 10 Sep 2024 16:39:05 +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 1so3nf-00000006LDI-3C28 for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:10 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so9920815e9.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=sZpPlzdil1/oNM4P3eIDQJR3Of9QE62dZGnQ7ewpZVKBV3JO1UuqlrZi0TNbWBTI4l ODmMJABovsnjRDCVWMFkPCX0p4r5i1vWKGktUjOLh5E0jsflgKWUgcKTFr1oXgcXWl1o MHTbMPFNrsFNJ/m/nwGjbNQARnyjmHxdWnT8UEc5gG28UYTUueY1sSjVmLRZcdpvTAmL g3TK+9TxlWnucJbKA81jVH0RaeChE86374lw9Z1Gb8mtppUnbtEXNA8564uHh2npgJ/O VGolFkq6jV7phe/mScSpsWuFpT5Y4llnazi7qE0eW/zyBoBsH8j6YsAtZdrNXkc/WDFp 4xsw== X-Forwarded-Encrypted: i=1; AJvYcCXPNqLnfEICg9FIhFUBCUF1GlFjgU3+tn8JwltBscUWOctB6ynfH1PU5rkGYRu/vxTbwSWHCayjJ/DkiCwo@lists.infradead.org X-Gm-Message-State: AOJu0YwKyIGTrnVoxMSqYrR5u5sY+1m+uCXhnQqNFUpAG0weKCd+PPdh 2LE8pZL/p2vgaiwDKieSVnFMWdV12EP8n5XGmuaLJnP7eZ1DO2uD7ViDYlkB6WyZkcXtri9MJTm y 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_093308_132357_84584427 X-CRM114-Status: GOOD ( 13.46 ) 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 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: 13798919 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 5F35AEDE99A for ; Tue, 10 Sep 2024 16:39: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=Subn3mhIa1SDVZ +VEl6rT0cUO2FaW/87ryMU0UTmhP6Pa/LT7DxwjEn3uDDQFx1JWRi1DpgU5csrrY1FUloh/tz6GiB pMiuu2m3HrAfbmaYuWbFc2AxuTqPowe6NGLoXRnBt8WuCtliBF894QuhfmENcBhSQGH6JvzHTnDUH 12XIYFfsOYs7v0YJT3x7g0j2yYwAA7l//mYF+u29nNbSyQoWvwrIJiF5sp+0aQzfUDrfR8qKqmEQb oyaqenEPDVvyVcXu+uIKbxW3ApCXJdLebd5i23tQrSBkBEQqxhpNVQHcHJH52Cv1Y4MujDjF0nyDP f8qs8GykHflG5NSFFGxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3tR-00000006NCJ-3XUU; Tue, 10 Sep 2024 16:39:05 +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-00000006LEd-0vRA for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:10 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so9921015e9.3 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=LoUBofZZIXrUTfz7aFsmi8Mvht5Z2A4R869Os8M/NPHVbnOMpmuv3OYyxszokx3sYR mBWwtNT6Scx29qjpa85yN7YxEEtlrdG8Rgli3OjKpXoAWXSM1QnrbEA/LWKsh347ap1+ E5XmYQ8BbEMWK0t0LCpExE4QNofajH9yJbJznkmCbKE+fMVO7oEtTu2qPP2UdRvtKixl /IjMW5e+yE73aO91VBaLPloXBITH6ZuNXhtzA50M1MJ734gVQ5abxu9Ts8NAlYkqk2Gm tFSBDlMP9MyLDLCKtw0Soz3+yFUN3IaD0OpGaw/SjzUJpB5HSjz+XI4BwPngi1mK/6er hIrQ== X-Forwarded-Encrypted: i=1; AJvYcCXqGyLq1NB3EYv+EbRof3Rn5s6MN7qjx1BJ1AwgicEQsrEeh/f77097CplVabk7NWZh+6Gf2oWh6Pe1eyvR@lists.infradead.org X-Gm-Message-State: AOJu0YwWx3QRqigbEcgQ2zm4W3/sJjdsXUV0hj8hFvndueE1vsXHdT0b hbVl/ugURJsRcNtTS8n1bNCso1LaIlqZA4HJgOapdGT2ereHSWQ25Wgso2w8k+0= 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_461523_0C6A17D2 X-CRM114-Status: GOOD ( 12.30 ) 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 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: 13798920 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 7A8EDEDE99A for ; Tue, 10 Sep 2024 16:40: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=z/wVLVFIoWgkg/P9OwKqQcYwWmuvphKNVWv8buBKvTE=; b=zuHXA/E7/gi9ON YHWf0C15kIDAOHE5TspljA5jDx7TIOUrJkHHYPbx9h8z0Y3lisTNLnIxRFQmjN6w1pa+vPl4gNBwA RYX3xdGlmkmETEPdZ7tWSkb/D7SzKRgmkGTAgB5xU9UGsh9SutGqqlmm4Z7jZ+kyqPLz1eq20T1WX JiQCOgwKv8AfLYhcRty8BScnLhrQszlLuEufBeK2jVfD19gG4KQdOwH59hl038ZyN/BurVK3N9qGp yO8UCdZ+JUnftQnKGr1qB7Dg/msiRVQ7AzTbWhvX89MrGfP+vWDbCREH9jyFYYmVv0q2WCVk3UVFA Cp8kgDQVi7l1MZC+3s4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3uT-00000006Nnh-3zLT; Tue, 10 Sep 2024 16:40:09 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nh-00000006LFK-3z0G for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:11 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-374c180d123so3227247f8f.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=a73Frb2Ta4cS+bMPHcsxYywSOyr0OWg/+mKc/5jlkoBaIiI29hUNIG06H+YYoREFT0 t8jFW+FXScQFhehNEFtxBeyxCpB6euegehSwcCcdHUjYFtMDRVj6CF8T892kOF0ZYglJ g6JsU14n5nUY9BatNtmuLZ+UvXcxsr0fGA86Ue1d+5gHfbPU0hYuvygRBHceQvX5yCV5 yM9kjQglPxi3/FRgVYPSpUqhe5GqpLXGTG+2BHcd192btmmMSl66VR74HWxBEhaOJOOt UM55H4Xp1H9ZGBI1uyshqeYv/darXrxS0vuZeIv90FTVpY5alIOychq35Dmv52vqh3Do gJig== X-Forwarded-Encrypted: i=1; AJvYcCWJxoeUDUDJCoqyWc5PiCpgADYdfCAOqptMeyZZWNke2Rqi8+Vc4dyaG/nVzBfJANSp983nCVjgOdHBwVSy@lists.infradead.org X-Gm-Message-State: AOJu0Yzr15liFBfjFLaK2ktM3GszJ9bOaDDnJuw0vFpi3zWVcbWI2TlL Jrfwi58W4sU4KWCKeI9QOToeFfchioj6cmlW99F+NXxxCnVjaHcGj4o+WnNZyZU= 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_093310_082740_2AE79C8A X-CRM114-Status: GOOD ( 12.53 ) 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 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: 13798926 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 1C7E8EDE9A3 for ; Tue, 10 Sep 2024 16:42:21 +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=7PjBm9aXyZaXZ1WJ5tAO/glwAiHezV98vmqnNIa0C6E=; b=024aL2vZXz8gdG zTT50mIoQyuUYnz36Vm4xikk1MlJbBWHa4emj6NTn4K2GIFsR4cWv7o0ayZxbdVv6CofH0KGMGa8j drAdKxK9y4Sj2pV0X92IXyOjU4cRoZguUq7AnR7TFlk2MjmEkQ13S1G4mw0aIOGiY3TMrg9rqI7P7 CmHdq+dbeSniPB+UWMB8j6QjaOuhGBvYB1GQCrZUBaPsCA4pA9vELWEfX6CNKSPoYaYJr35AfDJiy j2Q1taptAn7UmpsFvekLKZGdq7aPdHy9JQnU9q0BfN22U826bq+K+o34f2Npf17++1LnL4d+iI7Lx ecg00ugX5OUEGnfqE2mA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3wV-00000006ONe-0QWn; Tue, 10 Sep 2024 16:42:15 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nj-00000006LGQ-27je for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:13 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso31330995e9.2 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=YIEtK7UWe80CIAS/Auqo//y+XH21W6WDibzhAYhmcogYxjCx2GYlKsL72euSu9TjdG 7jR5M/Ij52mqiA+zN7X01JgGPuOvaLXhPN2A7SqV68qZiMZ5VBi2oKtB2pU2HQPgo8c9 KdzsV7/adxg7Sgo0f5teD+i/VSG9HI/1T8FZOw9zTnu2vpfm4X9LvM/XhcKjuPBYT840 4/1Kx3XknGGEuyrU4nko3wEQ2TqRQqfkHjRQGMcYQbjNCPPppe0hUmwpG1pOroiA6rdv d/+I2fBYweGq8YWwO6CpTZdHBULdcpYQbfWohY6PaprZ2M5GXX3sqbpAlyVZE42qF94t AtHA== X-Forwarded-Encrypted: i=1; AJvYcCWKEsktOq332NR71quNAGIDRtdGOSsl9Kxk1BIVGlhAvMcHV1exIGkfLhWlqVsJE2R8Is8Zw24IJ5HaXsfS@lists.infradead.org X-Gm-Message-State: AOJu0YwTqtlg+Gj+8Dr7Yx1gQP1mwxdWGnQL5pM3r4mjnKCY1F8Ij6GB TKmVR3n8dpAt/g8E6T/aGSgUBiwJkWAWap/fUBAWyPVrzJbH/CntfESfUrxXORI= 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_093311_632428_917707B0 X-CRM114-Status: GOOD ( 14.99 ) 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 | 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: 13798927 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 46119EDE99A for ; Tue, 10 Sep 2024 16:43: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: 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=6sLSa+HwvXjok16Zjt2pu+hHWP55z8qNjMr2Ks5erHI=; b=yWYMWRx2lQqIs9 k39TJjnumBP3vqEB8fA0ueZW52AaEy+Fd+YzCj+73/vbVn8pRUxJdlTLYoqrFk+2/VXgXcNbvxa/q X16TbnfnysGfFf6liJgH1Ljfas90ygEueZOIrZTS8c8uSaiCxi4MwV5MZHye1m5ps3z4/p/uQkFMz JNS7qalG/aLdeeDfhOEQargooQDAgvphV64yp6ZCmnGXTew/QYhZGKh6pMWybqSnCKn9v6S4mrcFU 0NY2T3G1JOcdNtNZdeA6ZET6sGul+3HWZdapjuaPasA6XHEtyhAXGAnPjgdtoJwl+e7Hn+dS82rju pDSpGtUY9xwsLdog9mkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3xW-00000006Oij-3sGZ; Tue, 10 Sep 2024 16:43:18 +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 1so3nk-00000006LH7-1pJN for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:15 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42cc8782869so4782835e9.2 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=kuYY2MqJkgz3za1rTET1fyqEErtNdC6relQGQfFoCqkR224DxfLJVf5Svk6piifzgR s3ih79SLOwqTn/jRbjDNFt9i0NkGc+lD0PEqpun41X8N4N9ZlcWgGenw6lbTdU4tIket z6dBjV9FuM04xYFGBfTx6fCYgrFyl7j9oLpIlweOssf57EH8k6Gur4nxlLbP8AIgZKmG dhy4OKdH4X0TWKCkdHeotJrqsaI7Q5uW26hkkQxHoGKXPXQRqhS9NELHyPIrzbp1xEB1 AjShLjIiKcTS/7UZCPgj4fV4MlqMEUb1aKUjLXOBwEqoF459grHj4wtei1vYv2D80Wwr DKCg== X-Forwarded-Encrypted: i=1; AJvYcCUpzpXI+iGxggYozyWtg3tXeZT/w+nl2UIhjo1BIYRvd+Mvw91eFl8oSgufAd4b1mwtKuRFTHiF5fpdo1bS@lists.infradead.org X-Gm-Message-State: AOJu0YyThnu/C+cZf0O3MyWPqgj+eIozVGWd/vFMhA2rPH3n34zVIfhC RiH20Uo9Bv3inTjFNZqJwsoYX3Ci85K1Uu2QnKA83wI/HR2ZLCxNISIbF9wbTEpaZW3u+BrheA0 I 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_093312_536812_C088D58A X-CRM114-Status: GOOD ( 21.95 ) 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 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: 13798928 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 A1A5FEDE9A3 for ; Tue, 10 Sep 2024 16:43: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: 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=ggofjbHvmh4IlNTWdy8m7B0QsHZJe2zc3+BpX5XTgDA=; b=FBjn8teRBoTF6o ya0gSGZJeYU/ByP5Sh7YCEcRzlm7pBF+4weJJBtTyzfuMqzToEZ7Ccki7krMsU3wPgtmwSmZO2M4a eck2/b+KTNPG9W+hYUJ9B0vP++RxVZLFOxPFqqSqGIkPYCgPYNL2EYGtCWewLE061vYYBCMbCeH/e ++thoHh0lEkogsklztB+tMRXmVWe9AR4/kQ9NszcFSsYupqa38CayMtzN39X9Ev0p/lG8LEUM4jmS APWHxedFQpKoqd+kwB1tMJ+Y+gR50BAqA+YId8edzCCo/DwF+TC3HuRAflY5NJZOo0baalEgkuQgl cYGjDKOu9uOg1+nlG5DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3xW-00000006Oi9-12xn; Tue, 10 Sep 2024 16:43:18 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so3nk-00000006LHy-1eZS for linux-amlogic@lists.infradead.org; Tue, 10 Sep 2024 16:33:14 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cbb08a1a5so9921665e9.3 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=HXRDeTM2if4tIwIW9IXJ6ZtFO2ICY0AtmP8jIZhbP6thZXTmZ3luYj+e4bxZUiHp0J 1kb0yp/5UPS5LDfD+K5VHi81aOGEiKRk0MRo5MoOnLZZ/GwIaXHiyVxybxtg8sFHn7Hq VJbPqGY9dpYKTD8si3dabBfYdBcIiPY+as5Im4aF3Cl1o0NED3qWmATnIIyQ2VrzVkaC iLyDrKlcwYC3n60bWF4hC0wyadDg/q+qBFXsKn8GLHRSQLOlU0rOF0PnNy9xtVo/Il7c j2W1Rtr6W4kbC9Ee3VSsXTYIWNufPuegY51xV5kIeLotZwfeFyN3vPH7srLAKTmuiBPg j6Ew== X-Forwarded-Encrypted: i=1; AJvYcCUEFmI+Wy4I0ERvpOxsOcxtK5aNoG14KEBIA1V7lrzpp3iluGCnOE2h8aEzcmjzzwa6R3UJcOmwiRAvLNUo@lists.infradead.org X-Gm-Message-State: AOJu0Yx5DJHb7r5sssUfN5luo8HoEXWktnYPR4A8GGc72jBqcvBQU8T7 4iiZHvUsoudkyJmmui8cVz7C09weU60eTtdUKIFIkALckyRS4Cesz42XBOada1U= 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_665987_9DB6478B X-CRM114-Status: GOOD ( 23.97 ) 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..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 */