From patchwork Fri Sep 6 13:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794210 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 721B5CE7B10 for ; Fri, 6 Sep 2024 13:39: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=/k8Vw9s8c3vx1FzrrsUK66X+N4rd9Tj8aDo0ScuGc6U=; b=TP+6tsHoXV3t4Jsq71lvSiefGa ZG62Qw6mIGNc0F+amK7ZnJ1gHyZiJ/HNT4tbk0H57D4cJd/gRs8dIZ0SZUNp1Uy6VzYpFzck/AGWf vy4nqJ6E6vXy7LdS5MDt2eA0gnrBNtNIE8cjW/yHIn319ol3Wk57MUkt+mHd66aautOBonI3fE33F sXvKn0B/+XlJds6911B2zphF1H0g27zawAWUAp+eGkCsvnDYYIXZHUHLt1sCNKpp4TUwscAZ2XdHz Ci0Qr+1EWG6vHvunLSaqv2LDvjnm/xeG5ykhBWbnH6Gcg3Af4xM1DLO2GJ7VY/aSoNFLiYrgt7Bv7 ZEapEVFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZB6-0000000CN87-376e; Fri, 06 Sep 2024 13:39:08 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7S-0000000CMAN-3msG for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:26 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-374c326c638so1383434f8f.2 for ; Fri, 06 Sep 2024 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629721; x=1726234521; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/k8Vw9s8c3vx1FzrrsUK66X+N4rd9Tj8aDo0ScuGc6U=; b=YaCl0Y++HiVK7k20fbiC01uv8/tdsoaGvx8Fg5I6WxhIpplemyloENz+1nWYa79SWe 2E6lvpadcriZSA7wU+MpUX7PC9l7nrzGbDKCbak6k6W4I2/qQCwKYPN1u3+AeTI6GHig FALxm5XSNutAcNL1ncGQ7DfqLDQxxNF3YaukICpycPqjXhfNn4A4JYk4HANWnUHM2IYi LuWPzvJNJh/WkukWnHjdY6yZAkMOlzCIsmcdWnO0EGPFSG7ICPEAABf9xPdjAW7mdTVJ l5ubxowiDe6CzaOXgQ4PqtRzgJQZJqaTsmGcfM5LE5gnxylbWPJOR83TAKJC3fs9DgJy vVPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629721; x=1726234521; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/k8Vw9s8c3vx1FzrrsUK66X+N4rd9Tj8aDo0ScuGc6U=; b=P/aAHfp7q37jqFRQC8kDz9wyw1EWF87e2gSr3mbUSXPtDlTc+N+cFgyEvfg+NLLzrd eiBPh/h70pPd4FMh0P58T4wsOgPd2X0s77A/BvXGFSZEz6OUoGENBzdFHpUGQFKaW4bl S0bqMSFfU7mpz8Asgxn0eYnn0JWwpiUWq/JhY1AmkVW7PF/4eoTZ++amh4RAkAu9acKR u/esFX8yooEM7aX3Wmw7qhmf8ux7nOmo/vikDywIMJITY9cKHFsHRer3v4NTq1ufsRtQ VqGGVdRrrA7jCXesO8EuCu2cQMWVRw6tllm1GK2MnvxImWPcI6PlfNvp7Ut1EEEYLIMl 9ilg== X-Gm-Message-State: AOJu0Yy6PrcJa2xMjj1G7qdZnt9gMc3puWugIk9S+0V1d1Dq/0iYNzO8 PuWvwktzk4SyujK1zmDVR5aMvNkU+B//kzTnq+l4Sso/5tcnZpQcqD6OLc0hgZQ= X-Google-Smtp-Source: AGHT+IG6zGp+EGPyl2G/sbXQM+iPf9ynjtzmZ9+oRa6GrrDLZwIH2kFh1EK96Z7tR1FuVnxf2OaClA== X-Received: by 2002:adf:f610:0:b0:371:82ec:206f with SMTP id ffacd0b85a97d-378895c71b8mr1873113f8f.16.1725629720180; Fri, 06 Sep 2024 06:35:20 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:19 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:46 +0200 Subject: [PATCH v4 1/9] reset: amlogic: convert driver to regmap MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-1-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4710; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=nr6iNBU9QPCIvnO9/MQUvPA1RIWVyVRjkH+HH1AHiQI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUOaSvOFexQNmqHkSGVtcoiU+q5cdE3wWeos pGVbRanLvKJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFDgAKCRDm/A8cN/La hYXbD/9xqasTIEVkwp3pKd+o2zGkOPC0wgIxIRtlVKClkbYJ6Obm8DdMqe3C080mzvx3aQdj3BQ E+sGkfcg0+gFc0bEz7G5fv2HxkMiWOPO8HtxjlMInf4ncihnVGxWXnzDQujH1Xvnv2D1yz5wY+U S3wmUEo0Uh362C8F5+uMhaunHxEYVMPw6p2cQiRJdBy+1QGlS3uKMJ17dxG+SnNhfYvOsahsKoR XfmQg8tbZUs19uPqswVBmNZAowF548LF7Y+zPxtve0oGSCHyA22sGxuSFol2osUbAk5cnQl1Z5v DNoM7nQm6MHspbLdY89r3SXEyTvBLw+XSzd6vAwvTfjgQZ/ZwJ/Id+XL1RDGpmylvhMs3Tf4uA2 ZQjloABTRZJ4DiW1rJbAePnOUnjNmtGDFV+Y2FmmgRBqc8VTj2DAVKEJs+e71PfrmEGhUhjvrwZ JWG/54oT8NXUfkrhickGdU0iI3YTvYfSgnowcCCiaPzXn9P/7J585vtGXiPMUM/EMIGCRplVsjY /WzuRwoOOsQbyvij3SFUrhEYaX0K9o0VZ2puNlAlwrHGjN4OuAlbKOPy1cteyErWbRPItw4xn40 tUCpjnZIQyMk9nbMbErpi7dxJ1OK0WL3Ti4NeFfWFV7C2UzBn4Orrmn4Ra+tqJIrrJ22eMkbloN YQFDPL/27gC1EUA== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063523_161800_99BAACC1 X-CRM114-Status: GOOD ( 18.17 ) 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/reset-meson.c | 79 ++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 1e9fca3e30e8..9dd38cc209e2 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -11,36 +11,43 @@ #include #include #include +#include #include #include #include -#define BITS_PER_REG 32 - struct meson_reset_param { int reg_count; int level_offset; }; struct meson_reset { - void __iomem *reg_base; const struct meson_reset_param *param; struct reset_controller_dev rcdev; - spinlock_t lock; + struct regmap *map; }; +static void meson_reset_offset_and_bit(struct meson_reset *data, + unsigned long id, + unsigned int *offset, + unsigned int *bit) +{ + unsigned int stride = regmap_get_reg_stride(data->map); + + *offset = (id / (stride * BITS_PER_BYTE)) * stride; + *bit = id % (stride * BITS_PER_BYTE); +} + static int meson_reset_reset(struct reset_controller_dev *rcdev, - unsigned long id) + unsigned long id) { struct meson_reset *data = container_of(rcdev, struct meson_reset, rcdev); - unsigned int bank = id / BITS_PER_REG; - unsigned int offset = id % BITS_PER_REG; - void __iomem *reg_addr = data->reg_base + (bank << 2); + unsigned int offset, bit; - writel(BIT(offset), reg_addr); + meson_reset_offset_and_bit(data, id, &offset, &bit); - return 0; + return regmap_write(data->map, offset, BIT(bit)); } static int meson_reset_level(struct reset_controller_dev *rcdev, @@ -48,25 +55,13 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, { struct meson_reset *data = container_of(rcdev, struct meson_reset, rcdev); - unsigned int bank = id / BITS_PER_REG; - unsigned int offset = id % BITS_PER_REG; - void __iomem *reg_addr; - unsigned long flags; - u32 reg; + unsigned int offset, bit; - reg_addr = data->reg_base + data->param->level_offset + (bank << 2); + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; - spin_lock_irqsave(&data->lock, flags); - - reg = readl(reg_addr); - if (assert) - writel(reg & ~BIT(offset), reg_addr); - else - writel(reg | BIT(offset), reg_addr); - - spin_unlock_irqrestore(&data->lock, flags); - - return 0; + return regmap_update_bits(data->map, offset, + BIT(bit), assert ? 0 : BIT(bit)); } static int meson_reset_assert(struct reset_controller_dev *rcdev, @@ -119,30 +114,42 @@ static const struct of_device_id meson_reset_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, meson_reset_dt_ids); +static const struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + static int meson_reset_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct meson_reset *data; + void __iomem *base; - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; - data->reg_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(data->reg_base)) - return PTR_ERR(data->reg_base); + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); - data->param = of_device_get_match_data(&pdev->dev); + data->param = of_device_get_match_data(dev); if (!data->param) return -ENODEV; - spin_lock_init(&data->lock); + data->map = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(data->map)) + return dev_err_probe(dev, PTR_ERR(data->map), + "can't init regmap mmio region\n"); data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = data->param->reg_count * BITS_PER_REG; + data->rcdev.nr_resets = data->param->reg_count * BITS_PER_BYTE + * regmap_config.reg_stride; data->rcdev.ops = &meson_reset_ops; - data->rcdev.of_node = pdev->dev.of_node; + data->rcdev.of_node = dev->of_node; - return devm_reset_controller_register(&pdev->dev, &data->rcdev); + return devm_reset_controller_register(dev, &data->rcdev); } static struct platform_driver meson_reset_driver = { From patchwork Fri Sep 6 13:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794209 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 B53C3CE7B10 for ; Fri, 6 Sep 2024 13:38: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: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=oOVCeDhMsTiea95mJFsYFS3mIU IdGvL2vC2BI19f+noEFuigJ8Mij3SBZbX2dnvNaz3/JDCFdHICXHsMhteWi5H0wl3TOw63KeJ5EWe S5/Q53fNi3PVgg+m8VW+knJzS+RlQ2+4rx8TaUKqDdr00yksN8GNmfWO/r6TME3tU0AhBhicoi3As gw3Z/24AXyeqwZ2nubm9Ynv9/f6gBvyrrKzWxByZd7YySBwMTqQEh8Uit/eu7O7fciylZFS+FLLRT W+/1/PYN4yY/SFlUwz3YuSNH2uc4kAWSzpL12TQ3+MsEWYZk5uZJd9yQRWVyKzeK+xpD19YEq1QHf IaoaD14Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZA9-0000000CN10-1dYX; Fri, 06 Sep 2024 13:38:09 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7T-0000000CMAR-0Ie3 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:26 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-374c1963cb6so1141641f8f.3 for ; Fri, 06 Sep 2024 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629721; x=1726234521; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n0U3ETN12gpBLws4jxOpUFqH+6wugx8Wdm0xkOdNhP8=; b=NsQDNGaAH3TKgPOsWS9Rsz+v/UEDQB03FAm7SCefYhfRgtiIRQz+eqS9pLJmcqwoRw U0zPwkgb6SxWT3UAxkoMq3tePJqr7+MUmrPVCehsR6i6s9RELW5yO+7XAife6hRgXZ4x 4b01UJHebLYoQlCB5ZGKL1AAHNIJ3toX1c8/7FqF5GymmZMUQ12aZEQ5RFebnD0baVWO 8P56WD5lwouX+XDyRKR3hAlJXpa+q2Vj9K3s8BmakaNo+JAfg/CX54nzRb8czD1VLBrZ POBDjXiBTxdp3GVK/TO1YeMSMdW1wgmVDTAGhsqtj+NnyagRBvDIMz2VR5u422z4T5Bl yEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629721; x=1726234521; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n0U3ETN12gpBLws4jxOpUFqH+6wugx8Wdm0xkOdNhP8=; b=mCC9bUvZ5FWkUGTLPHGS0mYPCK8mrGWps3ibqcLld7e5gPkdSct3RMJE0cLl8ltS/O HONINixv22zfQCB2QvUhiMSmiKwhrK/6knPOzndUA9fvPVfzcHSUUbRZdMwoR+2ONqKp GS066B8bQImjAlZ85huH8/SVYKsUsWQjUl02nQjv7zFWN3xykyPw1Yp/SHB3gpOLVCWw QWpiv3dKCS8vtNfushxoB+umCV+l9J2egc6gzCrYL9Ycr1sihC2kvo9k1tYMuOWykmix wWUpv/e3Yn+DcWCtucyXPxWgXOGr6FmWgRYHWR3CZTqo2yEMLGQazr6Pehsp3cKf2RNw jBWA== X-Gm-Message-State: AOJu0YxYBVinxPy0uyQ4HrMl3aozb6j/9SbOsYlghVTqIs7cnY6YZWPD LBiVV+oEi6ULTwloXPHKhqWbGYHzMXK884wy3fBhKAy8pgTbPeLUFTe6RGu3jUU= X-Google-Smtp-Source: AGHT+IEck+AkM1e/F0oOBSh0/l7dodO/LMFTYdYmPo9Gy7QWWQWyEDnvdz0QhdH2CJo/6tO+xwN3iQ== X-Received: by 2002:adf:f582:0:b0:374:bb1b:d8a1 with SMTP id ffacd0b85a97d-378895c8952mr1681058f8f.13.1725629721019; Fri, 06 Sep 2024 06:35:21 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:20 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:47 +0200 Subject: [PATCH v4 2/9] reset: amlogic: use generic data matching function MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-2-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=817; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=TBFxeGrFtyl6fNkBC1RzGGAepksDKxjvf8LT6xC71TA=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUPlC/gkEKuYmmJSQFov72bIlxBAfcOhgW4+ tmdinirt7SJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFDwAKCRDm/A8cN/La hQTKD/4pjOSZAMxRwxoSirqwtsKwMZIFFQfvnMpj+2MVvE21rHthawohviXi+usbOJmPUVQRXAJ HHFX1T+o1qac3mBV7OJnyYJUAa9oyOuAEtLVCacbf/7TWUqZMXkE94/X4wCXh4Yt1BXpb8Q6oSU fIO6fPEWnp9RMgV8/nxVDYsV90TieDzn4NSn83gi/HVVTNJ2yXNMy2DjFxnuX4z4SfDIx3z8vlq DItjRZA468lzaiwM296nMgxYQsaBbaZIYHJbNT9GR8RJZB5GHo/3mQc/+TJavvQ3SD5sfbtQ9PE HTz4fwQfparPEt/35j1yhRdt03MA3szrle8mRZOTGA65+ZqlnHRrS6wdMl9DYApZbWbZ7lllcKC df42W1hHxnAPHGO+gpFakwaSQ9eNrUgS3p5Z3fQ6pZ6FHhltqf6pSbKDUh7YwTMctpA0eFgoaBI pDTfOkbf+ssxJLITWhuK0vCpTSuxUP7HjaKS9ImfIN6RNskQnkW6uGtuk5/fcWR2bEgy9MTorKU piCPrf11mlVRG3eqdlUyn73x36SIg9qHAfpSe8mprHa/ns8KjOlQpdbeaPS1jlvr0OVz4ky8Xsw 3xH6ZVD2EvQvgiXrz/y1T7v1MNRxSV187cbhXr6cfzb79j5HqCXVQZ83oi/hgop+0Z6dVJmkJ0l O8Q4U8PHuYbHXdA== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063523_210025_7C1C4A66 X-CRM114-Status: GOOD ( 13.02 ) 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 Fri Sep 6 13:34:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794208 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 A9F56CE7B0D for ; Fri, 6 Sep 2024 13:37: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=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=E3MrTNbPszTwzb0kdHrl4HS7rO 4OWqLUokKzKyvB0jHpg30WZ2u/ePRe99UNSHIo8s4x9qplFNKuzesogqWzWv9y1JcPFgNYMdMof7+ cAPFj2RGKgZNQc6OTp/6yyVEEvONDRBMDLU/VCFfXHndR+O5piwMS4+I3DzDAmPY8ZQAtsUVheXWj dSjyIFqsmFZrA0gEZXU1HQmnpASYPiioeLb5yP/dncNVNNykPfPD8Gfqg7SzZGGuX9VH+ESdeVuDI NBZaVY4WOtACdcHOsgPQ4Vrm9YbJ1xkqIG6JygFlDmZizfqSi6Lewx8tWsalwOcPStDZEUEIvylzn Et7poHpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ9A-0000000CMhg-37id; Fri, 06 Sep 2024 13:37:08 +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 1smZ7T-0000000CMAY-1UAb for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:26 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-374ca7a10d4so1300568f8f.3 for ; Fri, 06 Sep 2024 06:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629722; x=1726234522; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=qEmog9pmXK1clKYr0aTVCCpDq1mE3Uihbr7BzuArW+/w6ZPvRVIDSL5JL2dNr4X5Kh XKLKtjtd72Tc9lUtbpXxdpHMdrYBDXcmsWsh11K73MiFXpGPFiao0fl9Bllx433RDLrm fKdcZx9MBeHp1B8gnm8qGhRDVlT6q1OxVrQ0um3asGpzmH0aDUTtH+zAq7euX0Lnsj7h 0xdrUUi0c9I5IlGNXQWFXTAh1k6nWviJvpV2kzQmFRlF2slidMOTSRc/a7GkZsx24GJ6 qUUicgyWy+QFZbPKWcGykmUTZqnOCDi9ZgxHO5C42OX0HurBcwHmIHyaUmen5f/oaRaX xgpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629722; x=1726234522; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RdCiYPdjlPcL03UXJdJSn9R8TB2L5xNznH8+xFLLXME=; b=a7P0mghV6sdwoLtR0Nwqvxr5TMO+hfbY+EJwhQ+LzLwiZD7UnOtLpdzKLyWJyZOHG2 y875zATrmRZDKTOrf+fCghUg3PYFv5bnVGsqbAAL3hcxpLuc/5Zgfu/A+flfN4F2pRZP /W+iDkVy5q5UcAGIKbR/aGXBT7qYBJv+tatu7zT9HrbZBSAe2fZI17dQ9VKHowK9OLb7 zVZjBDsW9Luh+J2DUFpRe4LfVFozlRCtO0ALoqqHsvO7COT2bWbet6Kvo83WF/Gbvi41 JDyoFtYzlY5+7oNmDnWByvh7xHH0lhUNyMj7gWqAgVpXkwuAZqT6GpKjfjvSUm6+tPIR VL8A== X-Gm-Message-State: AOJu0Yxlh0VPaKu4+iswbqWo6ceb1Rw0EB1/+tS+4TSE1D5T/m0d7rWq P/fFduMTOBsKERyrF9gDme0ZcSakmKXxVPWPUR4McANEvD7emp0ZpR+QhLFH0Zk= X-Google-Smtp-Source: AGHT+IEwO1wdUIgNHfUjloM9p7/zFIXeW9bGZBl/gFhtcN9dlE9gFZ3qMxWb8RFlBR6gNKwxbZsDRw== X-Received: by 2002:a5d:6489:0:b0:378:8dea:4bee with SMTP id ffacd0b85a97d-3788dea4cbdmr1782508f8f.33.1725629721865; Fri, 06 Sep 2024 06:35:21 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:21 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:48 +0200 Subject: [PATCH v4 3/9] reset: amlogic: make parameters unsigned MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-3-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=737; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=I6joFYKtEZpmpOu7whQFwYwYWPHiUyzVlrs8QkUbiqU=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUQZPuqhHgOSA7hBjezMd0lE2tAgtqtIzJ/g bQLwVOijb+JAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEAAKCRDm/A8cN/La ha10EACEv7fsnJOpH21ZFCiItZ/Yqvl+n8x74Q1Gz3GCAc/jBem4TBUzXI6KtVmikN4Hp1xbDLD emfslboEq3eLb+CV1Cd3+f1tVDWTrHPl9v5lzr52rrecxAc1byBWQnfX8GQIIG+G5BLVN0NT1B9 ekvTWohL/zIEsekBTTjWQW1s+n0TSsXO2wBYWKK316irfGP1q91T60SmnxoPoHeeMh+JsNClAD5 oATwmBoEfx0Im6PXo7Og2aZsdxYUTkHJYIYgEYzhG99Y7ly06aVRo65pDtIn7JSKX95B2t/PUz1 Flo8XVHGvqdiXTRfdAi4GRXHZuYB7cFafY/P/e1M8jFEkhaSUWzPAMZi1qrWfxjYTW4IYTdS8ul Y+Idcl5yZfRSnlr+pbsXfM7FXmPJEYXna6QY7FCwXn6Elf+FLRRB7ghZCygO+fl+bzpxBmgJugC k3QttDeP9hdF8b00E4I9OlXhUgDrkzKM375fYNv2GtTGSZRu0YQODBASHGHKS8wuQGvlpND7IaH WBAG/6x33vTHlrCl54/7IF64OMCwBSlRfHnRwQuOp3DmSlFPJlRYdrzT/6sHQIq1KxB3heHGO6a xWEfwzA9MZUSmlv62mF2hhCIt2bt8gEQHy9/IvanxrnOJ7Bc9tURlajy/rPBw7wRuVAAwF1o1tm bSnaYfrHA1sD4pQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063523_460952_056A1F0E X-CRM114-Status: GOOD ( 11.45 ) 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 Fri Sep 6 13:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794219 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 A5DAACE7B10 for ; Fri, 6 Sep 2024 13:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: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=LAJaS+mk3TAPUVefvXuD3YGkz1 mcW4hC+TWdKPdh+ekoI73iuw3x8hxl2nQaqUZUZU/Y1nUuiH/V3osxxCJfpJc0F7aSBeAaZkR+bbz OO0ZZ+wcxbH01LnLLxS6E0aNycgPX5Th5enccTczpaOTOtl9iq31hyzwzj0xJyyGVTUgFrOefZt8m 72x6lh0Oh7kgZY5NVgluc5kT2LnF7w4S3j9RLaDoSou7MwvvBemw9Y+FXUdiwRdzeLrG5jHA2cSp8 KaXjpv/iLYngcO1/IKBZSplRlruD+9xQbiZyVpUTo4k4zHsDMurqReD/SQaZAoJXCkAD+wUUyRwdt 9zexqDJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZDx-0000000CNkh-3jdp; Fri, 06 Sep 2024 13:42: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 1smZ7V-0000000CMC7-13G8 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:28 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42bbdf7f860so16585575e9.3 for ; Fri, 06 Sep 2024 06:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629723; x=1726234523; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=O/Yf+6uxXV0kV2P21eOVpIseB4Hi71hF6SfqZ+9Zm0M=; b=fQXxMMukRte79MlkU1al/pumsP0dkFRlIT6IhXEpE8U0d7gTzcy/3RITirjRP1xzhP jvLXCpwRdunTsmizxgwq1RpbZXlknUs8qtyMNwoE2Rg6AW1JGWV+SSsL4+OrgY4VAAMG Qp85p9ceiZ1Mpn0s5r3wIWcqi2E7aZEmm5glsbSOPc4YvbF37cfKj8SizsuiJYacCTu6 CSiuhSA4zdO90R8uE/ipb4gVbyp/i+CrroNs4GBm17Aj1vpbGhAkug+qphiqZb87v9uX PrLn3zaXbmVYoAdJd4cKADw4PK/DzdCtRxdE7AyzpCZ4IU+mHyDSte0EKKNdW0npZ5aU KTWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629723; x=1726234523; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O/Yf+6uxXV0kV2P21eOVpIseB4Hi71hF6SfqZ+9Zm0M=; b=qYksUpyXJsuWKXoxBehAefFSrabnOfwmzVF9BPJv6ywiGM8ySWxo+9CaTGS/FcuXKz hwtw4ac1c/2Apwx3Ad9hVajZJS5zJlke+iGRsJF/dlru1Uqk0kEQdm0VTQgfCuLP+Vfd rAsr35O7+Aq7Aliq+B2DQW3rmIAn7Vh52C0KjE6Mr77Bo3cuQ8k4d/NVyQqRN+sKtbGA Sb9tAvHNxda4RkdI0kSijqedV5B9sSNL+g0yx2SSGDW1YGeSAXz8L5EpUcVwDWdqhT7q 8O9QDVoLn8nB1d0VzoDw5Rz74U41hlqR7ubdoko6hvO7qaeGHBguQcS4di6HB1I9Jlxu iDAw== X-Gm-Message-State: AOJu0YzUpeCUz43OxGrjL+b2nNh1POri1q6uANVvJhYZRFN12S1DzNc8 wFYe/wFVb4HLRCwWeFEqNyXJfh5G15H5arkegpkMEZtImM6qwgZFXwEIeNOBcT4= X-Google-Smtp-Source: AGHT+IF4VeYSejIOXDRrzU8oFu6IoWvoH1EbJ5dlPLojrpKx18ZFCT5/tQgZrXuWY+yDBawS4bkpsg== X-Received: by 2002:a05:600c:5102:b0:425:80d5:b8b2 with SMTP id 5b1f17b1804b1-42bb01bd7f2mr186682155e9.16.1725629722686; Fri, 06 Sep 2024 06:35:22 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:22 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:49 +0200 Subject: [PATCH v4 4/9] reset: amlogic: add driver parameters MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-4-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2306; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=G/tkeTFlEEIIRl13gZHjvQ8SKXa0knkQG6ZsLKG6Sak=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wURQtL+kwNEuoxQUrfvKDLVp+YLuENebFZ9b EI5WC0kuH+JAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEQAKCRDm/A8cN/La hTELD/9DwP8483wvZNoxdOUqFzHXI3fW9Yq0ENw8+O5MWleGZI7s4zhbM5tR0nhZ+eKIJ/04OLH uTBXT/3cAuJbsvKvZhkfHNYFLmwIuZ8TnAeKDv3FOCdOLNI+eTxU/laPVSffIlMeL0IaSmXArU7 rAtJuSsfQk85EWJAC3Pukr4UTlixjjA47G3MTYNX5fsYwFnnir96qY32HuM1IFKUoeHGqYcg5e/ xfhXtHap04BOu1MW8ivfRiPP+VcqbHyiRnmHUgSWD7oG+lv/a+5j5j9B4nsb3v9/9EOQ/QwqiWp 90DR917dWwxagt/dwUl8q157/xg8F1v2LjbQNxNzkHzA+0CeMtmzHEGS65jGyC9xigrqSy2I6z/ EoFCKxup+FH15RJm3EPgL+xLoy84E9w44Rx9Y4IQgOsjaFEdyPhDY1Qk0UBcZLynvqxQSuIOZv7 E+RjWDMPz1gqZyp+i4PabmhMkAXe8/4MoXWG+Dc3NX3gk0vS2Kjoc+cfQPBHFnSV+XOkG0FZjyG Wf87NMBWnjbOilmSXsAVHUZtRwuI+j2tFpeKFzd2Ct3KM/irXsIixyN8G8gQ3y9uDjViSD+gYrz U6VHtXjD7AR+tNrrBdSxscGgheUbcmQNcnYSyJmP07GxaxX2z2mgTIhq3iKkZDOEpyzcn+BvtMy Rk9kgTHEN+8PZGw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063525_472236_23781729 X-CRM114-Status: GOOD ( 14.66 ) 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 --- drivers/reset/reset-meson.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 50bd2241ef2f..6a90613c8095 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -18,7 +18,9 @@ struct meson_reset_param { unsigned int reg_count; + unsigned int reset_offset; unsigned int level_offset; + bool level_low_reset; }; struct meson_reset { @@ -46,6 +48,7 @@ static int meson_reset_reset(struct reset_controller_dev *rcdev, unsigned int offset, bit; meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->reset_offset; return regmap_write(data->map, offset, BIT(bit)); } @@ -59,9 +62,10 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, meson_reset_offset_and_bit(data, id, &offset, &bit); offset += data->param->level_offset; + assert ^= data->param->level_low_reset; return regmap_update_bits(data->map, offset, - BIT(bit), assert ? 0 : BIT(bit)); + BIT(bit), assert ? BIT(bit) : 0); } static int meson_reset_assert(struct reset_controller_dev *rcdev, @@ -84,22 +88,30 @@ static const struct reset_control_ops meson_reset_ops = { static const struct meson_reset_param meson8b_param = { .reg_count = 8, + .reset_offset = 0x0, .level_offset = 0x7c, + .level_low_reset = true, }; static const struct meson_reset_param meson_a1_param = { .reg_count = 3, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct meson_reset_param meson_s4_param = { .reg_count = 6, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct meson_reset_param t7_param = { .reg_count = 7, + .reset_offset = 0x0, .level_offset = 0x40, + .level_low_reset = true, }; static const struct of_device_id meson_reset_dt_ids[] = { From patchwork Fri Sep 6 13:34:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794218 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 A3E13CE7B14 for ; Fri, 6 Sep 2024 13:41: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=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=vQmBVDsWwNk3EZi2tcPbKhhYGA NGgEPUz9SXUDuidX4YN66DujjC9NFfya6E0k3oTGUXIsXKIGdkTR7ydRlQdmivhHEF1VeLVqyHcor Z663Nv8QoX9qVBervUWT7jaK/zSuQaB2nVgW5NtgXfw/N4ka+cU0nhqlzBPvGtewWHM+jd9NUD01n ih+DrECVHPYTfrjzv3vkZHwVBssT3MOTgDXstp24LNzX7XwBAwaR5Tqei6myq2HCHNMGi/LHLsb0n DJ2EUxnrs+1mTQ6AK80VVeP5hLjCkHiGSyY08VfuI9TC5DPBMx5RvoJYUlppbpW0VCf4t+VibnQo6 hvxb4DJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZD1-0000000CNbQ-0Tnc; Fri, 06 Sep 2024 13:41:07 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7V-0000000CMCF-07xq for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:28 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-371941bbfb0so1311970f8f.0 for ; Fri, 06 Sep 2024 06:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629724; x=1726234524; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=gatNDuKD0PYES9QNY2sO6pz6EQOYVm6Td6VCdLo56hAkeeVvUIkGvHTcGSIjfwGBbk oCdZXV5MmviJQyuFLpjTOkIs/SgQ+p++JVOEEb7ZzFGDJsznGz+p51x+nftwBJYrGmcu /OY34tzy+R8MxoAYdPKr7OmOoFyaNQGC+QGcVoIgx2/yRN/Ruo4n+EOLlrG/Hsmzj7RM x1lb6ey0WIyahYx93FtRU65N7evbmAVaH1wpMscfAbZ61dhzEN2ZtlOIEKPcPiTACm3w i4cnkM4BHLUOErrgrpXqarhGmaB+LVd+dgRkhxcsOG9d/jUyyknQPFREnARk3Nd6hebb 29VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629724; x=1726234524; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yr1sayqKxsWDgBZHQ1bM3Uke54ske3bCnU2ZK9PgUEo=; b=iGUvZcI3cf4rGhRC0zNU5Kw6QGB8QDQSIoWkeskcJ0PuKSznu82ykHGolyy5GbY9TP oZOIoKVvHArMAMuxRkN8PORj632IRIjv8xE0GDmGQcrV7CAwyeu0WO23FBntj1HtLTk3 U5ytr3zuUxG/UPB67jyHdRfJ+b/KvxSFzfk6ge4FhntHYPMSw1D4sPDiBxH0dEkiOQPZ wiEdGHTsdUKctV5joHbsMtViHHUNV0AGjknb+8TWkc01JaRUQFWJUZJt66zwFp/SLRQO h5FMpG2IsoscTf5LT9RLZqWIGLLqlZZdT+fLYyNyzGHE4UVtbKnUpozD8HPFi6T1OHUI n0dw== X-Gm-Message-State: AOJu0YwUbUBR3iISIBnozhGt7pKGubXt5syxNe+g9x5uNWWNdV+xtpld Kj+1h6lrh/sB9QmfUp/Ws5TmSxbS3SDTG8cLSPU3WseARk8ehLeLpYvXQhhyGp4= X-Google-Smtp-Source: AGHT+IHtyPvrZcVdwFmw8XQihKzwGBhzTpX6IW6Bq3OFAXKmFfW1m1vMKo12rNUklRp2d6TUNkaT6g== X-Received: by 2002:a05:6000:223:b0:374:d1dd:1cc1 with SMTP id ffacd0b85a97d-374d1dd1e44mr8801291f8f.2.1725629723501; Fri, 06 Sep 2024 06:35:23 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:23 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:50 +0200 Subject: [PATCH v4 5/9] reset: amlogic: use reset number instead of register count MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-5-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2112; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=iSedGQJkeoX1rk7eD0ZddgTbF2MZs7+12PeFSEIOANY=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUSHEcD7K2lLWF6rnCrk05yGhK2svJKDRc0t qPznnAbxlWJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEgAKCRDm/A8cN/La hX7fD/40NAGXsNPZZOklKjEefS6iDGIJJ66e6aq5vjJ4tJFkgU1UCHM6HtnWyGrwVH7bCATlkrc zfdZW5t3tTl4pqOCl+vOKaRSGrHBT35G8Ox9hJlFRW3Snso5iJyPuQ+CTrYma1JrEHyGz7krZZS 847buYbjmFRvpRorM2qQfwsNbhDXNzhoPGlb33dLmRRHSobID92DGHGWH1qfLjv1l1LQEx2yTwJ NgfluH6D0qkQUH0bvGbO8Ci2nIdl39PfEYyvHVG9MZw1mvwlUs1Qc72y0OXci599sge1sDLvLdS h0Zaj3/tu0HSDSprt8k03YFFg5NoAUvEVoJiAvpb3itN5TnzzVk20dnXth6oHFnijLTrN/2jy97 A6LoYexCGpUx2EnQkiBdXc56R8qlL8X43hA86h4rZzo33O4F8bXsleFUZXGUESfHWpgJWdk7Gfq uutDTN//4THhTnzPuOUe9x2+wpjasBkUm5AeSeXWg2eukaSOc6i5WVbS2g+hem1WolVvXIFjlO2 jgbjZIMP8OdSA274I0TiF1VItV2l4Xkpj6dt1ZD+H3p1zQuQrzmPbXjPgKFSARxvBYufdW3kejF MB/0K6fkFBtjMUv1nnkv6T4sXp24yjYyFokjOzjEUV6kYajijkoNJftGFrmewhrX3n1ZHwmaj2W XVQkI2IQt/4Pf3Q== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063525_322372_978FA632 X-CRM114-Status: GOOD ( 13.46 ) 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 Fri Sep 6 13:34:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794220 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 B40C4CE7B15 for ; Fri, 6 Sep 2024 13:43: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=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=Rn7oc60JNrrtrMrudWXVefLRyd sX8Acq2bT0F3IxicihwUC5yxBM1FBjWB6R0gesSwK+4DlpLnTFsRwD/3gA5BUE9XK5e4SC/oS4MHq QXdk3MN8Ue0DYH8R5w4ejvAR3SAjgR9E55JNh9rQ1k7I9qNIP+KWpq4xkzXDnwmQPOiNuKTz02hrY w8ADv6rOdFT08urp6zhJdwlejNR+rfnj1LlEB6CSxAu0XPVfGYauC2/XRnXRHWOtvmyZ5XvAps6I0 wVl1tjTuYI/arADRi5jYc/+khtLS5dTlt3iKvMgBGkA39Uk70YqZ0RgDxLF034RuivgVvUmhzI0D6 9v8jR7Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZEv-0000000CNvy-04TW; Fri, 06 Sep 2024 13:43: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 1smZ7V-0000000CMCi-3bXX for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:29 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42c5347b2f7so16681525e9.0 for ; Fri, 06 Sep 2024 06:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629724; x=1726234524; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=auBQVUy/CJomTzJoxm2b9pgsN2Mc0xGTmk3eg4TJ1TuUAQ+qK84/SPDCjnQXaqCEap M3yDK6gQgnyFloIkLH8iS8/nFaawJp+2vy+1wQCS9Uh5CXPsUzPz/1dIyqPlQxoI6IeD lPbyMQpZbWlTu3z7ZoIf0On8JYTjEQF2MYby/qG3ci/NHlU5IYPwk11kGRfGrxQUPxKU agHbR5XxUzo/Vop5gzvfLHkTWwMA2QZ/oIKPR3JpHQfzzBsK5qNcP07JHIYfN6yttv+k FCMgrzG1dmdZ3Bs4ZS5wI1u6EVbSxjLgzkiU0k9QXuXWugVKmL2g11BfIQW+TsZQIHq5 P14w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629724; x=1726234524; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0tSPL9hjXApUYKXuHpC3lX5106d4gltSKmV8tShxn0Y=; b=bw3T0SHaY0S0Xr5iE9h6PoyprhdMFEBOLDDVzYkTkfx6xhQOI/umITcMCSECi2PFEW e6dHJCkOi9bFCERjpH34WgGcuns0uNKrkehc53Zn96jdgYyfbP/9Jr1FDLmvBaMr+HW1 L681hW+wB8+xG4bDJkir4j+887ZZkbpZU3mDbPm/uWCAZAS/ThdhNu04/0B1dpWxM4rv j6DrrFiPeeexCSoqD4Cle62/SzJzzQRcVjGBUfDdd8dKGVxWbCEaDlj+qBmrdTIgjRHy 8leyWz3tlYotlDM6S19DjNDBiqc2aWYhFvR3uA58oZxC14T3sCdgMti0lfZbB5vC/8Xv 5ZAA== X-Gm-Message-State: AOJu0YxvI0Ds8KTHMCyOTZsij/MDrqGpSSuGYA70zEcxgNTrwEvFGsis zf46SjvMxHIZq43wVgDAwNnhxVm1XQn46k2bx1pzx3JFdF8vFQFTGmRd5ZMCVNc= X-Google-Smtp-Source: AGHT+IGh0HbWA2IvTSqHJmBK+lJ8nsE3aksAjKs/B6hcz+IVxN5XBkRPlliYSkbr5ltAj9mYwc0NkA== X-Received: by 2002:a5d:58f6:0:b0:378:81aa:2662 with SMTP id ffacd0b85a97d-37881aa26fcmr3879235f8f.7.1725629724309; Fri, 06 Sep 2024 06:35:24 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:23 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:51 +0200 Subject: [PATCH v4 6/9] reset: amlogic: add reset status support MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-6-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1583; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=uFpLNDx7axOqsTgkkJPsc6yBsPXI/ygS3MYpVh8ixvI=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUSAS3Nbjn5SPm8sfJpgm5HVfxx1YI3Rng9m a7emBSfQleJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEgAKCRDm/A8cN/La hX01D/9jPU8wNhdj3cGkbDsDFOcUizWHJTxZQVNcuuvU3YARiZ2ZWZxxVIO2g+S1MEiVC9f1Xg+ 9cILnAENe6RqjcnmegHUjrxB7wHtVTz66G87kwhuR7kp+92TDUF0iCWSiqE7Sh+rOYKFVmmOVQh nxdcc3rMZSneO8iie3cV++LFLFWH5wR5rMiU57p0dr6hIBgm+k2OQZUXLvX/JeFcY4KKUg4HREA 1BsXFzwkMcz/ZgCrVqokLqtODgO/D0cdd/58UU398+ZwDv9AZjAS7l1DBeZu1tW9o8drO8Gcsto IuTOrD/lNYTolBFNq0DGn7RdZo+cBrW18ZetSwDCM3F5z7/xA/+aabkyh4WAeLLg4KL9kdtJq5Y uk/hOesetOkgJ8gDzcjWPb+suk5mIlbslUCr6FTqomWQxb+Ufdup6FHxTjTpwrQTnpZiJQaBKCB QFVaCzFdtouKsSgzkkIAg6a4e7rI4PAb6eU79NX5XovlY+mk6PKINUJ3rQszHUw6/UFltA7w85w JA59QJVLz8sbJvgxudM1ULR7wz3qYiAMuhOlgbmBv1UQHXrvymqUKHHFRYgghQD5xIKG5tRIfOX 5KypBuiGoS2L2Hxe3PtZX5FbiB9eqd7rthdOBIIbo0sCzjqtua+AG6niI+Nfww0xrqV3BwcWi9J IHxrsEzom9u9wCQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063526_066388_803F4F64 X-CRM114-Status: GOOD ( 13.71 ) 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 Fri Sep 6 13:34:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794224 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 A760ECE7B14 for ; Fri, 6 Sep 2024 13:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: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=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=hjfXX+YvnCY8Ojj6aEVB8X8Fsz 9SFen/UQ4STTcUf5KHo7Eo65KgsY0mjaYAT8Hd2wzvWR6KMu/M0TOvEwvjQ3wSJztBTK1cBOMrV+T aza21h9K0i6zdSxE1CdJGsfRZZkLmnpnqPjENSHp6OJ0vWR97prvldEh1+cIuLpS8nzM833B0pk5W 2MXD7tPNBeumeln9+37EXhHzMmhX2/F4lMpqLMbwBVtYJAwALRfJhtBe1kLptRsvvGaelyOHMt/TD 1fmDWDc5bOX9mqchf1PRF6m9CSfEAPM5WeLZ55R95IatGUMwkKRkp1mg8YDo7VNKWxJGkASlr0gpB Wdz0bJrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZHs-0000000COoC-2Lut; Fri, 06 Sep 2024 13:46:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7d-0000000CMH4-37XU for linux-arm-kernel@bombadil.infradead.org; Fri, 06 Sep 2024 13:35:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=BnQdKWJeHpVt5Y9jsfTTvKxRhE Z43sZu+4dERWHxm3CnYLvBEVR5Ren4fGZiS1HknruBzS81rqwusd+gzKYpuHdjYGgfVUqjdnirYlx 2I/9NuUO/gt8CwQY1Axis6qqImMMoZ+bhLUX6PV6+GL21rJ2kPTN0WgiwWZT3nNwUNIGYJGgn2t+X lNKu1o6WOuG2MhEv7MIeETKMRrKTBUgdA82tbBM7cvqZG+TlW/m0Zv+jaWITEU21hFyvNiMrFyEg+ VHRrajC2gSc0jRw/Tp+3DPrLolo1jj0VJyzgUznUrKeQDf+oISmdHR9uv0eGacaUGMZ2kbhzE4JDZ kT1H/SYg==; Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1smZ7Y-00000000fh7-3rw2 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:32 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42c79deb7c4so15492915e9.3 for ; Fri, 06 Sep 2024 06:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629725; x=1726234525; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=R+ByeKAEFK4GYtbRS5c4MR1nfURZSzxZxspZRbkVSkSsL8Bor6icP3ZNed4AJ10c1z h01YRtDroM8ijbx9vbpOULEKLucq59m+Pe/uVwcUl93g3l9A+Lrr+wLCeomo5jH/5tpe RUrl0SexwD7ZRRzXIDALLqoZJzp7srs+40Xgs/7K1PlA/y8ll/WrG9QSGxw85SMQi3Qb zAAf4ggWCWe205yu34Y6WKayikaqKSMtPGI9ixaXsRQewB1WKJdKN6kyVE+yNRYQQCxx WLX+uDp6eq2V0BRu8r8YwYjAElPZe2FI4qgYvNztX9dgFeviUIYAAOmzG8o2Uj3DU+6Z ELUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629725; x=1726234525; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A7e2t080sCK0X27JFCHbHxpErVD3WPN9VMtlJLZs3BY=; b=pp/OT48O0UnqdDpuD1JReiQjvOHqdfQhKHBq3o0ys/8YWp4Y47tmwOIhFeps+K/DuF NqIrt5VGIkJeUBJocyc2PSalp0WfilIyMWrInXcZrm1znJSV/TW0OUuzK36FLpQQUGY4 pY1JmiDYBAo9S3rC7cijlaIYRtMEVCwY7yBolIkUyUrdCRXxR+ZylEBwN8XjphmyjVzj WWFp3MNpI8vvJXWO8YyQMp1wzKu6CothI/8BGhdjL2gOG54tvcIB2OID5pH4TGCi8gOt Qtfejc0kGA3HwADkZiiRtN3/kzhjhkJM7gjJ/jQ8FS5sys5DaRfWeTvNzPYmp1YW2B8u OnOQ== X-Gm-Message-State: AOJu0Yw0u+qclEnu6b3xWWahKpoeyClY/mD1iZblNQsfrsXmFQnOEOzS Swt/BTtzcWhGs+m/TwOhjIGtPduWrR0PAryP5wioaDxZAL1X2AkS5PYLD82fz3I= X-Google-Smtp-Source: AGHT+IHTMY70b2wlGnBeKNWQ1H9t8xY5YyM7J9AJV6VQM+f6aKmz2fjdTwT/C0XAKinvOj3j1jrQmg== X-Received: by 2002:a5d:58c1:0:b0:368:5a8c:580b with SMTP id ffacd0b85a97d-378895c73d1mr2022486f8f.19.1725629725133; Fri, 06 Sep 2024 06:35:25 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:24 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:52 +0200 Subject: [PATCH v4 7/9] reset: amlogic: move drivers to a dedicated directory MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-7-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4127; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=yrGWoxCpwHnlg0sdrbvMgawxznUl/m0tFw6lwaYIwVQ=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUT1wWu7fYlSNotSd/YCXGraANoQxIW+ZEPS XPNFQxPKCyJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFEwAKCRDm/A8cN/La hZihEACuzpcQEZLYGWXGGYjSdQb2I7XyOrvYAwbZ/bhUGUbWntGZO2HkWalrWET3GnMTnCeu1g5 n3CDJpxVbSOke6/YnOGA86Z6L4QxjDE18SB3x3XvQ7Jx0JcHzVYpULT+Rb/2J/ItXbpe5tiC8CE /k75o3tYZuc4KUTQDjjXnenlqbcMupjzGuj9w9PbyXPchrLC7H7qEMuicnD3owMstSeinZtExx9 KyffddVYX1zkYzI6xQXhbm2Vp6vCYu4kKgtE25HQN3UdqgU+iu/XrT8TDMFwKdSacOWsBuOwXuO pAALO6F9cgglE9WFAl+c+hFVkcFIAJ/YhsYMIrWzxekYRsREDZGEBabKt45wp7tdNDueU6UkaM2 xwG4MKaKjJN0GVOUsjDpGagr2c/sDCHtf/5kOpEtKbkCq99lhftOcHFSfT8iqd2pce1vFjUqfa5 ZBJONWyc/hUS+l2bUE/KC/C71xLW+juq36/70HAW33dF5wmx1n7o/p7o26G4DF31HKB33gfqao7 f+6X9ZwK5iZUp2LrlfgtdXE1uqxzwM0tc4vBTSl0TdW7b+6G1LXxEPMWXC4uGdC4TkGw/QaKYj9 JvsKrF6QE9jR9vSHbdBiqQNjRHdCoJ+QQ3VsncLkgP7MpsXz5AYVHewJyK8/AzOS2JUlzBp3zf1 a4WeASVXIgbJhjw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_143529_627459_062872DA X-CRM114-Status: GOOD ( 15.99 ) 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 | 15 +-------------- drivers/reset/Makefile | 3 +-- drivers/reset/amlogic/Kconfig | 13 +++++++++++++ drivers/reset/amlogic/Makefile | 2 ++ drivers/reset/{ => amlogic}/reset-meson-audio-arb.c | 0 drivers/reset/{ => amlogic}/reset-meson.c | 0 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 5484a65f66b9..d28c4401a310 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -153,20 +153,6 @@ config RESET_MCHP_SPARX5 help This driver supports switch core reset for the Microchip Sparx5 SoC. -config RESET_MESON - tristate "Meson Reset Driver" - depends on ARCH_MESON || COMPILE_TEST - default ARCH_MESON - help - This enables the reset driver for Amlogic Meson SoCs. - -config RESET_MESON_AUDIO_ARB - tristate "Meson Audio Memory Arbiter Reset Driver" - depends on ARCH_MESON || COMPILE_TEST - help - This enables the reset driver for Audio Memory Arbiter of - Amlogic's A113 based SoCs - config RESET_NPCM bool "NPCM BMC Reset Driver" if COMPILE_TEST default ARCH_NPCM @@ -356,6 +342,7 @@ config RESET_ZYNQMP help This enables the reset controller driver for Xilinx ZynqMP SoCs. +source "drivers/reset/amlogic/Kconfig" source "drivers/reset/starfive/Kconfig" source "drivers/reset/sti/Kconfig" source "drivers/reset/hisilicon/Kconfig" diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 4411a2a124d7..677c4d1e2632 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += core.o +obj-y += amlogic/ obj-y += hisilicon/ obj-y += starfive/ obj-y += sti/ @@ -21,8 +22,6 @@ obj-$(CONFIG_RESET_K210) += reset-k210.o obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o obj-$(CONFIG_RESET_MCHP_SPARX5) += reset-microchip-sparx5.o -obj-$(CONFIG_RESET_MESON) += reset-meson.o -obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o obj-$(CONFIG_RESET_NPCM) += reset-npcm.o obj-$(CONFIG_RESET_NUVOTON_MA35D1) += reset-ma35d1.o obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig new file mode 100644 index 000000000000..7ed9cf50f038 --- /dev/null +++ b/drivers/reset/amlogic/Kconfig @@ -0,0 +1,13 @@ +config RESET_MESON + tristate "Meson Reset Driver" + depends on ARCH_MESON || COMPILE_TEST + default ARCH_MESON + help + This enables the reset driver for Amlogic Meson SoCs. + +config RESET_MESON_AUDIO_ARB + tristate "Meson Audio Memory Arbiter Reset Driver" + depends on ARCH_MESON || COMPILE_TEST + help + This enables the reset driver for Audio Memory Arbiter of + Amlogic's A113 based SoCs diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile new file mode 100644 index 000000000000..55509fc78513 --- /dev/null +++ b/drivers/reset/amlogic/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/amlogic/reset-meson-audio-arb.c similarity index 100% rename from drivers/reset/reset-meson-audio-arb.c rename to drivers/reset/amlogic/reset-meson-audio-arb.c diff --git a/drivers/reset/reset-meson.c b/drivers/reset/amlogic/reset-meson.c similarity index 100% rename from drivers/reset/reset-meson.c rename to drivers/reset/amlogic/reset-meson.c From patchwork Fri Sep 6 13:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794221 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 1065ECE7B15 for ; Fri, 6 Sep 2024 13:44:18 +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=jKMMJ9BB/WECkuysAuWF0PWUWeyazpVDPxUVb4YJ+No=; b=xygLHduEJA8zpd6VxhKv9WWlfJ 1i/diLT05pwQlGpLnDt7izB7lz/E9a3hI1z+0GuXihrVcXLizRjEdNB3wYkL1P4NsTU8OlI7TQsdG qZWrGqgGemBGB+cDgXtU6SevMJjlDxNn8tloTynv6CBT1Fzk9eXmI32a96MIQ6DCBnD6zqJJWbqiY ZWgaAlnWIEaOoheYzINwQ8HOLv2kRJ90giuFaFOtm+1ckKalkLl2I2a1TQ9zveBL2hC4XJ2Gm/XuG ZnkjhhOoMWbeXGxrmyRoJ/xojP+3Xo9dVzN2a1zmCrvMntp2oyO5lRzMgG+x0/jDBj6b/7WoeC1+j U7jHUGEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZFv-0000000COEi-1BRk; Fri, 06 Sep 2024 13:44:07 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZ7X-0000000CMEX-2qaO for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:30 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-374c7d14191so1720835f8f.0 for ; Fri, 06 Sep 2024 06:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629726; x=1726234526; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jKMMJ9BB/WECkuysAuWF0PWUWeyazpVDPxUVb4YJ+No=; b=vA3HTcYxCQzCYBPjJj39DuqFToFp9+N+k2/MZ01aTs6smPwbovY+6h86bl+zXJIwnX Fa4HKl9qqQSrKX4OkWyWXR0VFezqQ8ZKOCIrIP2CYcmaEOm2gUCr2igCiozhXTDWlyyv y8H04E8ySEhpu0jAICIroRqGeoYm416HL21mAG5BWjCGp2xdEzp5IJ2T262dTMQIyH0f PiUYTA5ds++5hSwSQioh1y2EuV30GMVDuZb3IyM8Nd+FyZMzNrmHVMzAS08N+iBfuRwx mR50I7uLcJza2eSWuAURsDl5euXVoCcnH5LbhlpuEN3XfFAcfG0Up0oeW4taXZ0PvDmn 3amQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629726; x=1726234526; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jKMMJ9BB/WECkuysAuWF0PWUWeyazpVDPxUVb4YJ+No=; b=NmLDgKau7bKZ6u/fuM+Sp/kRwcKiYHG3xYwQKfVEDU2nE6KMVqJKOtGACZDdxo9VV7 IPm62Ym0PTztZrh7boxzJ3e5GEYm4Mp7gy7Mqu+RfsqdBa4jeCvqvIa2/C7zgtg4Eezz TcsUpPQo0ZqiZcvj0duVH7WJ+J8S6reUF77bWayoN5hdwzQRYP3NCmU64sij1vvLvHyo zwcL5RkqHCFcTE/UmGm0ZSx+LpG50dygi6qjKRuogQDQJgsnK/M0Ju62u0e5RD0TpQB5 eeJEQO186msS1vMSOO/aRVrpA5QUO6l+wvjQNM5Yw926swagqvC8bp0xXXMcDienbKIG XHFg== X-Gm-Message-State: AOJu0YwQVxwCXFeQhYwn/VRZQWcVdZhe2OaSe3t5u5K2yNpfu20KZF88 yA+8N+q96Mom1r4xhbzaPnWU1ScNVczmtfNfiETMSKKhNce09M+nE1EwmBWMly4= X-Google-Smtp-Source: AGHT+IGV6zV/WTaWuRrt0ffNBSswfD9eOdNjMdzrfqpP+uGnA+r/gDgGAHL0aVp2/ptE+weUTiXXhQ== X-Received: by 2002:adf:a395:0:b0:374:adf1:9232 with SMTP id ffacd0b85a97d-378885f1a1bmr1615357f8f.19.1725629726006; Fri, 06 Sep 2024 06:35:26 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:25 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:53 +0200 Subject: [PATCH v4 8/9] reset: amlogic: split the device core and platform probe MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-8-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=11277; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=BE5kz+4uxHRB80G5vKRFxE31qcQuiKDy33BrekIRUq0=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUUgJNt2+rEFoswms9TnCWD1oUqWy4jyl035 jdYp/PEpQKJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFFAAKCRDm/A8cN/La hbl4D/40yJVP8AcXu2tPLszmvcmib8sY3fWM3mceDx3OF7eM8J+oF/RPvXE4Oj3m5z8y7suWsGJ XAACVzUNvRpYV4s+BUAPw/7rnugBAdbi2JY7ifPksWoSVIdTwxI4Y39EnFVqs4NOGQsQChZvllr 2qgRbwzUNZLJQw7MNCgTG7vX2f6o+ZPgQC4gRCYVNJzmEqeZC9OimwWa4tr7WmffsTEeNeSiMPR BTYZAqoNGepvHCFIP120x3IIaGp2VGldci3ulqJhRt4oWSWUQyPU9T0ZMwkjF36zKBuRzZw5wsZ Bh+rxedojqEg/bdl18SHaG+OVFQjMpnyr+lhoLas/6HHM5hL4okO85tFlCAxZOtXnNsHfypsV7V fmsbfxiq/LUO39+n4dm/xFwAM0Y4bPVUnvCcgwatko44e8TVAHUSYAUC3T7r9EBNFjB24rucAVX ejGs6SRspQjAcop0M0MeTl02CzhK2paBVJzefjQL4kl9EJnmHujn59GrhooUxTLRlcnU7Z07yT4 WBj7MpFLIkGtJobzerSwE+V9i84elR/b8rTnaAEhqWzVFlQu4ONDwGEyrSD2Z7DTSOH72LOwOe9 JW1xFXKJIPhI6rb3+XCtbmpGoB17lbs8Utpsm/8P3gZZmX0IJV2HSSQTNMmJKAr8UI/sA31lLE2 +rG2bclA4dGtfRQ== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063527_978938_9493DEAB X-CRM114-Status: GOOD ( 23.21 ) 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 --- drivers/reset/amlogic/Kconfig | 8 +- drivers/reset/amlogic/Makefile | 1 + drivers/reset/amlogic/reset-meson-common.c | 121 ++++++++++++++++++++++++++++ drivers/reset/amlogic/reset-meson.c | 122 ++++------------------------- drivers/reset/amlogic/reset-meson.h | 24 ++++++ 5 files changed, 168 insertions(+), 108 deletions(-) diff --git a/drivers/reset/amlogic/Kconfig b/drivers/reset/amlogic/Kconfig index 7ed9cf50f038..1d77987088f4 100644 --- a/drivers/reset/amlogic/Kconfig +++ b/drivers/reset/amlogic/Kconfig @@ -1,9 +1,15 @@ +config RESET_MESON_COMMON + tristate + select REGMAP + config RESET_MESON tristate "Meson Reset Driver" depends on ARCH_MESON || COMPILE_TEST default ARCH_MESON + select REGMAP_MMIO + select RESET_MESON_COMMON help - This enables the reset driver for Amlogic Meson SoCs. + This enables the reset driver for Amlogic SoCs. config RESET_MESON_AUDIO_ARB tristate "Meson Audio Memory Arbiter Reset Driver" diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile index 55509fc78513..74aaa2fb5e13 100644 --- a/drivers/reset/amlogic/Makefile +++ b/drivers/reset/amlogic/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_COMMON) += reset-meson-common.o obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/amlogic/reset-meson-common.c b/drivers/reset/amlogic/reset-meson-common.c new file mode 100644 index 000000000000..d57544801ae9 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson-common.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Amlogic Meson Reset core functions + * + * Copyright (c) 2016-2024 BayLibre, SAS. + * Authors: Neil Armstrong + * Jerome Brunet + */ + +#include +#include +#include +#include + +#include "reset-meson.h" + +struct meson_reset { + const struct meson_reset_param *param; + struct reset_controller_dev rcdev; + struct regmap *map; +}; + +static void meson_reset_offset_and_bit(struct meson_reset *data, + unsigned long id, + unsigned int *offset, + unsigned int *bit) +{ + unsigned int stride = regmap_get_reg_stride(data->map); + + *offset = (id / (stride * BITS_PER_BYTE)) * stride; + *bit = id % (stride * BITS_PER_BYTE); +} + +static int meson_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->reset_offset; + + return regmap_write(data->map, offset, BIT(bit)); +} + +static int meson_reset_level(struct reset_controller_dev *rcdev, + unsigned long id, bool assert) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + assert ^= data->param->level_low_reset; + + return regmap_update_bits(data->map, offset, + BIT(bit), assert ? BIT(bit) : 0); +} + +static int meson_reset_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct meson_reset *data = + container_of(rcdev, struct meson_reset, rcdev); + unsigned int val, offset, bit; + + meson_reset_offset_and_bit(data, id, &offset, &bit); + offset += data->param->level_offset; + + regmap_read(data->map, offset, &val); + val = !!(BIT(bit) & val); + + return val ^ data->param->level_low_reset; +} + +static int meson_reset_assert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return meson_reset_level(rcdev, id, true); +} + +static int meson_reset_deassert(struct reset_controller_dev *rcdev, + unsigned long id) +{ + return meson_reset_level(rcdev, id, false); +} + +static const struct reset_control_ops meson_reset_ops = { + .reset = meson_reset_reset, + .assert = meson_reset_assert, + .deassert = meson_reset_deassert, + .status = meson_reset_status, +}; + +int meson_reset_controller_register(struct device *dev, struct regmap *map, + const struct meson_reset_param *param) +{ + struct meson_reset *data; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->param = param; + data->map = map; + data->rcdev.owner = dev->driver->owner; + data->rcdev.nr_resets = param->reset_num; + data->rcdev.ops = &meson_reset_ops; + data->rcdev.of_node = dev->of_node; + + return devm_reset_controller_register(dev, &data->rcdev); +} +EXPORT_SYMBOL_NS_GPL(meson_reset_controller_register, MESON_RESET); + +MODULE_DESCRIPTION("Amlogic Meson Reset Core function"); +MODULE_AUTHOR("Neil Armstrong "); +MODULE_AUTHOR("Jerome Brunet "); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson.c b/drivers/reset/amlogic/reset-meson.c index af690d3012ec..feb19bf6da77 100644 --- a/drivers/reset/amlogic/reset-meson.c +++ b/drivers/reset/amlogic/reset-meson.c @@ -2,106 +2,20 @@ /* * Amlogic Meson Reset Controller driver * - * Copyright (c) 2016 BayLibre, SAS. - * Author: Neil Armstrong + * Copyright (c) 2016-2024 BayLibre, SAS. + * Authors: Neil Armstrong + * Jerome Brunet */ + #include -#include #include #include #include #include #include #include -#include -#include - -struct meson_reset_param { - unsigned int reset_num; - unsigned int reset_offset; - unsigned int level_offset; - bool level_low_reset; -}; - -struct meson_reset { - const struct meson_reset_param *param; - struct reset_controller_dev rcdev; - struct regmap *map; -}; - -static void meson_reset_offset_and_bit(struct meson_reset *data, - unsigned long id, - unsigned int *offset, - unsigned int *bit) -{ - unsigned int stride = regmap_get_reg_stride(data->map); - - *offset = (id / (stride * BITS_PER_BYTE)) * stride; - *bit = id % (stride * BITS_PER_BYTE); -} - -static int meson_reset_reset(struct reset_controller_dev *rcdev, - unsigned long id) -{ - struct meson_reset *data = - container_of(rcdev, struct meson_reset, rcdev); - unsigned int offset, bit; - - meson_reset_offset_and_bit(data, id, &offset, &bit); - offset += data->param->reset_offset; - - return regmap_write(data->map, offset, BIT(bit)); -} - -static int meson_reset_level(struct reset_controller_dev *rcdev, - unsigned long id, bool assert) -{ - struct meson_reset *data = - container_of(rcdev, struct meson_reset, rcdev); - unsigned int offset, bit; - - meson_reset_offset_and_bit(data, id, &offset, &bit); - offset += data->param->level_offset; - assert ^= data->param->level_low_reset; - return regmap_update_bits(data->map, offset, - BIT(bit), assert ? BIT(bit) : 0); -} - -static int meson_reset_status(struct reset_controller_dev *rcdev, - unsigned long id) -{ - struct meson_reset *data = - container_of(rcdev, struct meson_reset, rcdev); - unsigned int val, offset, bit; - - meson_reset_offset_and_bit(data, id, &offset, &bit); - offset += data->param->level_offset; - - regmap_read(data->map, offset, &val); - val = !!(BIT(bit) & val); - - return val ^ data->param->level_low_reset; -} - -static int meson_reset_assert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - return meson_reset_level(rcdev, id, true); -} - -static int meson_reset_deassert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - return meson_reset_level(rcdev, id, false); -} - -static const struct reset_control_ops meson_reset_ops = { - .reset = meson_reset_reset, - .assert = meson_reset_assert, - .deassert = meson_reset_deassert, - .status = meson_reset_status, -}; +#include "reset-meson.h" static const struct meson_reset_param meson8b_param = { .reset_num = 256, @@ -151,33 +65,25 @@ static const struct regmap_config regmap_config = { static int meson_reset_probe(struct platform_device *pdev) { + const struct meson_reset_param *param; struct device *dev = &pdev->dev; - struct meson_reset *data; + struct regmap *map; void __iomem *base; - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); - data->param = device_get_match_data(dev); - if (!data->param) + param = device_get_match_data(dev); + if (!param) return -ENODEV; - data->map = devm_regmap_init_mmio(dev, base, ®map_config); - if (IS_ERR(data->map)) - return dev_err_probe(dev, PTR_ERR(data->map), + map = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(map)) + return dev_err_probe(dev, PTR_ERR(map), "can't init regmap mmio region\n"); - data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = data->param->reset_num; - data->rcdev.ops = &meson_reset_ops; - data->rcdev.of_node = dev->of_node; - - return devm_reset_controller_register(dev, &data->rcdev); + return meson_reset_controller_register(dev, map, param); } static struct platform_driver meson_reset_driver = { @@ -191,4 +97,6 @@ module_platform_driver(meson_reset_driver); MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver"); MODULE_AUTHOR("Neil Armstrong "); +MODULE_AUTHOR("Jerome Brunet "); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson.h b/drivers/reset/amlogic/reset-meson.h new file mode 100644 index 000000000000..4e1dbd7569c5 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* + * Copyright (c) 2024 BayLibre, SAS. + * Author: Jerome Brunet + */ + +#ifndef __MESON_RESET_H +#define __MESON_RESET_H + +#include +#include +#include + +struct meson_reset_param { + unsigned int reset_num; + unsigned int reset_offset; + unsigned int level_offset; + bool level_low_reset; +}; + +int meson_reset_controller_register(struct device *dev, struct regmap *map, + const struct meson_reset_param *param); + +#endif /* __MESON_RESET_H */ From patchwork Fri Sep 6 13:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13794222 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 C769DCE7B14 for ; Fri, 6 Sep 2024 13:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: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=5fQ+cdLJYbOn3NF5s//ezlsttCjL0fvaEZaJE8odEpo=; b=I8xfBmgPfdLd4XQbIeTwyeLtyO 5SO3I7tS8MyEbuucLrfkmT6bx5QDfr2kCbBR2SAHElrqZrdhsEDk+7itRX0XUyGjjJiQuRBAkn7LM jTeT7/w8qq8RTCPSX1yWT8nJ2MxmJ4S+9RuUZ0gxArL83nRMV3tE3ALU8IPXIzEw/0xFzo2T75VGo xxqovphruHUYsJ8jTZhPKNWc+ZqNmBskvaaAZk8ZcpEnG11OJCEAZnGotDgmiIEp4P110QWc/Q3hn kFDjowhnvJguYTuBW6Aave6xFl84th3IshTxmxgyJkFIiWSyqZ/6ZLGeZFXPM0VY2ZTZM/F717706 m90nXGWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZGt-0000000COSO-1Y2n; Fri, 06 Sep 2024 13:45:07 +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 1smZ7Z-0000000CMEq-115B for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 13:35:31 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-374ca65cafdso1119869f8f.2 for ; Fri, 06 Sep 2024 06:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725629727; x=1726234527; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5fQ+cdLJYbOn3NF5s//ezlsttCjL0fvaEZaJE8odEpo=; b=fkCraSdCMXsAExgvsW0r3ROgA5P584NnWh43bdO6SCGDOQhUsaFpo4tEE693Roupc8 UNZ5loJf4IHtaQVnysPd2Orx9CY6LgWRIQoavOsC7Zt2wTnmMlHNxcOErAv517z8YjJj wF66ckC3oTkUINqYeOutYkdFr3nqKWaZyXSFyj5nWjRlAIwxFbyuwU57mySp3Q4D4+Ho Qb//Z2KFa4/Q64oPVHGnqW66XdepOn92N8DqxrIrErsvcxKe/HTd1V+haz1yQ8lDGJ5e vW0/VdNbPqSKXOecYCLX4d/QngJRyxfi/Z03Ry0ZvJ2BQkNwDwX0+FO5Wws9D23j1IqH vDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629727; x=1726234527; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5fQ+cdLJYbOn3NF5s//ezlsttCjL0fvaEZaJE8odEpo=; b=OBobrZH/A7jwDSOhHNEe889pnY3EzWc/Sf8iZqkiXhJfCd4wlpWQqV33/J06QzTcP2 umCx9TH4gYciSzjCmxZgcBALd3Alj4QViOKkRkKCjdWXzKQQv9Edg7V4gztUZG8l/564 QSJurnkSlucrWDW9NJiqDejLkvSeRPbkRWtPzrIfS/F+l6LmD1OUaGxIDGG0CZCFYa66 UBZSZ76JAswY2PewhUR0G8U1EcPC6mPAfLoGZd5nDPrLdzsZD8W9+89jFRPGdZ49onQf GO1cIWOHaYVkspaJ/iSjaJxYPH477bREQb6CwbD9kazmeyzFyi+esqS3yqWUO0qFcs1H GrOQ== X-Gm-Message-State: AOJu0Yx6n+gHkAeXsF4/rVl6KymR7SmRVXikra0lQVP1UxcXghAUdOnX /ILosxwNPEed5jNuQjYv9Cg82J/aulyebati6jexveGbs4zVeS+70Ecl9vsLnTs= X-Google-Smtp-Source: AGHT+IHmymTxLOs3PLKO0c6jWSVpOPktEs2qQjYl+O557HjFRG7O8Rjb+6CkqWWmmtxCWJdK5yFMkg== X-Received: by 2002:a5d:5c88:0:b0:374:c8d1:70be with SMTP id ffacd0b85a97d-374c8d171c7mr10723438f8f.38.1725629726803; Fri, 06 Sep 2024 06:35:26 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:b0ad:b504:10d4:481d]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3749eea60e2sm21684597f8f.62.2024.09.06.06.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:35:26 -0700 (PDT) From: Jerome Brunet Date: Fri, 06 Sep 2024 15:34:54 +0200 Subject: [PATCH v4 9/9] reset: amlogic: add auxiliary reset driver support MIME-Version: 1.0 Message-Id: <20240906-meson-rst-aux-v4-9-08824c3d108b@baylibre.com> References: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> In-Reply-To: <20240906-meson-rst-aux-v4-0-08824c3d108b@baylibre.com> To: Philipp Zabel , Stephen Boyd , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jiucheng Xu Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=9860; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=XLWvH9i6+Kiiy0dwA5ikE9sDbinj1MBPG77NiOiU0DA=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBm2wUVnaG4Noluao1RPwFCG8nJSg/MLQxRGJ+cl +kM2Q6CvHiJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZtsFFQAKCRDm/A8cN/La hWKAEACMfSqWEFrl9iF4MECgBdKRSQcUCnhQQll1l+KRJ1LEaOl+9R3JwC/Enr4fuBzdvMq5CLX ALYld5gdTC2zl44G0TO1qR28l3lhTXxktZ/IKzZWDqoLVl+IEH9SiKAHtBBkXL302IcTKVFMLsm zIJFOuTvLpaY4vVHv8X1kRtg6MbSXNTR5M3IkZF3kaA9HNL23p8G686VqPeQRukBqZpkXu1RsQv 5SAsfVvrbZ9fKii/pSZ5rNs+dkTpI5DODllw4D3YKROqfxacVEo2Llv23u1mtK4AK+nK6VpQP/v aPDW7oK4MyeL0JWURpZDu5V0Qr5cWU6R2IPjEgLkE20vB67Q3ad4UpXWU7Q9yoaBKTZbt/DiDqN GiPyaAoqv15xkDx2z1RgEshsUVSCDPD5591Jvmx0q1cWYhlaIM6j58K6em0dvmVpMDN+x3ZBCPE yfKW4T5+TjeBuKVkyXdFkApCs4kpTsUiGEbyuhx5nL/2JPJMszTEMMcNeQ0XqKuQjWWqMcpL5Y+ JBCzN27mEUefdEYVfaZVHX7TWlEsvUCcD8tBFEzAYHz7n+zx2QKF2gYlefttF2jVSYihMQ3ptdf /DmhPGaZxPxS0FrNtOPWEZXQDZxowyUSw6gno9hY3nk+vKz3H4HltKJV4HB+7dOAft3ptPwva5Z 5XofjCd6Ucn3B7g== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_063529_459939_066AFFE7 X-CRM114-Status: GOOD ( 25.36 ) 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..e73ee5d63264 100644 --- a/drivers/reset/amlogic/Kconfig +++ b/drivers/reset/amlogic/Kconfig @@ -11,6 +11,14 @@ config RESET_MESON help This enables the reset driver for Amlogic SoCs. +config RESET_MESON_AUX + tristate "Meson Reset Auxiliary Driver" + depends on ARCH_MESON || COMPILE_TEST + select AUXILIARY_BUS + select RESET_MESON_CORE + help + This enables the reset auxiliary driver for Amlogic SoCs. + config RESET_MESON_AUDIO_ARB tristate "Meson Audio Memory Arbiter Reset Driver" depends on ARCH_MESON || COMPILE_TEST diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile index 74aaa2fb5e13..ca99a691282c 100644 --- a/drivers/reset/amlogic/Makefile +++ b/drivers/reset/amlogic/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_RESET_MESON) += reset-meson.o +obj-$(CONFIG_RESET_MESON_AUX) += reset-meson-aux.o obj-$(CONFIG_RESET_MESON_COMMON) += reset-meson-common.o obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o diff --git a/drivers/reset/amlogic/reset-meson-aux.c b/drivers/reset/amlogic/reset-meson-aux.c new file mode 100644 index 000000000000..dd8453001db9 --- /dev/null +++ b/drivers/reset/amlogic/reset-meson-aux.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Amlogic Meson Reset Auxiliary driver + * + * Copyright (c) 2024 BayLibre, SAS. + * Author: Jerome Brunet + */ + +#include +#include +#include +#include +#include +#include + +#include "reset-meson.h" +#include + +static DEFINE_IDA(meson_rst_aux_ida); + +struct meson_reset_adev { + struct auxiliary_device adev; + struct regmap *map; +}; + +#define to_meson_reset_adev(_adev) \ + container_of((_adev), struct meson_reset_adev, adev) + +static const struct meson_reset_param meson_g12a_audio_param = { + .reset_ops = &meson_reset_toggle_ops, + .reset_num = 26, + .level_offset = 0x24, +}; + +static const struct meson_reset_param meson_sm1_audio_param = { + .reset_ops = &meson_reset_toggle_ops, + .reset_num = 39, + .level_offset = 0x28, +}; + +static const struct auxiliary_device_id meson_reset_aux_ids[] = { + { + .name = "axg-audio-clkc.rst-g12a", + .driver_data = (kernel_ulong_t)&meson_g12a_audio_param, + }, { + .name = "axg-audio-clkc.rst-sm1", + .driver_data = (kernel_ulong_t)&meson_sm1_audio_param, + }, {} +}; +MODULE_DEVICE_TABLE(auxiliary, meson_reset_aux_ids); + +static int meson_reset_aux_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + const struct meson_reset_param *param = + (const struct meson_reset_param *)(id->driver_data); + struct meson_reset_adev *raux = + to_meson_reset_adev(adev); + + return meson_reset_controller_register(&adev->dev, raux->map, param); +} + +static struct auxiliary_driver meson_reset_aux_driver = { + .probe = meson_reset_aux_probe, + .id_table = meson_reset_aux_ids, +}; +module_auxiliary_driver(meson_reset_aux_driver); + +static void meson_rst_aux_release(struct device *dev) +{ + struct auxiliary_device *adev = to_auxiliary_dev(dev); + struct meson_reset_adev *raux = + to_meson_reset_adev(adev); + + ida_free(&meson_rst_aux_ida, adev->id); + kfree(raux); +} + +static void meson_rst_aux_unregister_adev(void *_adev) +{ + struct auxiliary_device *adev = _adev; + + auxiliary_device_delete(adev); + auxiliary_device_uninit(adev); +} + +int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name) +{ + struct meson_reset_adev *raux; + struct auxiliary_device *adev; + int ret; + + raux = kzalloc(sizeof(*raux), GFP_KERNEL); + if (!raux) + return -ENOMEM; + + ret = ida_alloc(&meson_rst_aux_ida, GFP_KERNEL); + if (ret < 0) + goto raux_free; + + raux->map = map; + + adev = &raux->adev; + adev->id = ret; + adev->name = adev_name; + adev->dev.parent = dev; + adev->dev.release = meson_rst_aux_release; + device_set_of_node_from_dev(&adev->dev, dev); + + ret = auxiliary_device_init(adev); + if (ret) + goto ida_free; + + ret = __auxiliary_device_add(adev, dev->driver->name); + if (ret) { + auxiliary_device_uninit(adev); + return ret; + } + + return devm_add_action_or_reset(dev, meson_rst_aux_unregister_adev, + adev); + +ida_free: + ida_free(&meson_rst_aux_ida, adev->id); +raux_free: + kfree(raux); + return ret; +} +EXPORT_SYMBOL_GPL(devm_meson_rst_aux_register); + +MODULE_DESCRIPTION("Amlogic Meson Reset Auxiliary driver"); +MODULE_AUTHOR("Jerome Brunet "); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(MESON_RESET); diff --git a/drivers/reset/amlogic/reset-meson-common.c b/drivers/reset/amlogic/reset-meson-common.c index d57544801ae9..a7b1b250a64d 100644 --- a/drivers/reset/amlogic/reset-meson-common.c +++ b/drivers/reset/amlogic/reset-meson-common.c @@ -87,12 +87,33 @@ static int meson_reset_deassert(struct reset_controller_dev *rcdev, return meson_reset_level(rcdev, id, false); } -static const struct reset_control_ops meson_reset_ops = { +static int meson_reset_level_toggle(struct reset_controller_dev *rcdev, + unsigned long id) +{ + int ret; + + ret = meson_reset_assert(rcdev, id); + if (ret) + return ret; + + return meson_reset_deassert(rcdev, id); +} + +const struct reset_control_ops meson_reset_ops = { .reset = meson_reset_reset, .assert = meson_reset_assert, .deassert = meson_reset_deassert, .status = meson_reset_status, }; +EXPORT_SYMBOL_NS_GPL(meson_reset_ops, MESON_RESET); + +const struct reset_control_ops meson_reset_toggle_ops = { + .reset = meson_reset_level_toggle, + .assert = meson_reset_assert, + .deassert = meson_reset_deassert, + .status = meson_reset_status, +}; +EXPORT_SYMBOL_NS_GPL(meson_reset_toggle_ops, MESON_RESET); int meson_reset_controller_register(struct device *dev, struct regmap *map, const struct meson_reset_param *param) @@ -107,7 +128,7 @@ int meson_reset_controller_register(struct device *dev, struct regmap *map, data->map = map; data->rcdev.owner = dev->driver->owner; data->rcdev.nr_resets = param->reset_num; - data->rcdev.ops = &meson_reset_ops; + data->rcdev.ops = data->param->reset_ops; data->rcdev.of_node = dev->of_node; return devm_reset_controller_register(dev, &data->rcdev); diff --git a/drivers/reset/amlogic/reset-meson.c b/drivers/reset/amlogic/reset-meson.c index feb19bf6da77..6ae4ed6b7f8b 100644 --- a/drivers/reset/amlogic/reset-meson.c +++ b/drivers/reset/amlogic/reset-meson.c @@ -18,6 +18,7 @@ #include "reset-meson.h" static const struct meson_reset_param meson8b_param = { + .reset_ops = &meson_reset_ops, .reset_num = 256, .reset_offset = 0x0, .level_offset = 0x7c, @@ -25,6 +26,7 @@ static const struct meson_reset_param meson8b_param = { }; static const struct meson_reset_param meson_a1_param = { + .reset_ops = &meson_reset_ops, .reset_num = 96, .reset_offset = 0x0, .level_offset = 0x40, @@ -32,6 +34,7 @@ static const struct meson_reset_param meson_a1_param = { }; static const struct meson_reset_param meson_s4_param = { + .reset_ops = &meson_reset_ops, .reset_num = 192, .reset_offset = 0x0, .level_offset = 0x40, diff --git a/drivers/reset/amlogic/reset-meson.h b/drivers/reset/amlogic/reset-meson.h index 4e1dbd7569c5..2051e126dc3a 100644 --- a/drivers/reset/amlogic/reset-meson.h +++ b/drivers/reset/amlogic/reset-meson.h @@ -12,6 +12,7 @@ #include struct meson_reset_param { + const struct reset_control_ops *reset_ops; unsigned int reset_num; unsigned int reset_offset; unsigned int level_offset; @@ -21,4 +22,7 @@ struct meson_reset_param { int meson_reset_controller_register(struct device *dev, struct regmap *map, const struct meson_reset_param *param); +extern const struct reset_control_ops meson_reset_ops; +extern const struct reset_control_ops meson_reset_toggle_ops; + #endif /* __MESON_RESET_H */ diff --git a/include/soc/amlogic/reset-meson-aux.h b/include/soc/amlogic/reset-meson-aux.h new file mode 100644 index 000000000000..d8a15d48c984 --- /dev/null +++ b/include/soc/amlogic/reset-meson-aux.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SOC_RESET_MESON_AUX_H +#define __SOC_RESET_MESON_AUX_H + +#include + +struct device; +struct regmap; + +#if IS_ENABLED(CONFIG_RESET_MESON_AUX) +int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name); +#else +static inline int devm_meson_rst_aux_register(struct device *dev, + struct regmap *map, + const char *adev_name) +{ + return 0; +} +#endif + +#endif /* __SOC_RESET_MESON_AUX_H */