Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5385451rwb; Mon, 21 Nov 2022 22:12:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf62epqM2ULYA9O21d3eLcJJdbxveYzLWiZqfqCkAq1AERTSdmyrG+VzzjJ/QrposNrVHK11 X-Received: by 2002:a05:6402:4515:b0:461:cf2b:627b with SMTP id ez21-20020a056402451500b00461cf2b627bmr19096952edb.73.1669097542913; Mon, 21 Nov 2022 22:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669097542; cv=none; d=google.com; s=arc-20160816; b=zt1k1ueai8n83XIFzdyUjG2T08OPxJQfxXIPbkmaHVg6uY0VbA3/boxrVmXGIKbiKq lFJk1GCdrwZcH/LCszOtQnYUvGLLiwdVfgoIrUGxge9uGpXB12aRrj+PPzN3dfUcMyjb lt7+BbG817yRq19C6l2V+el4VtB0TAPjirnGskcIknZEbfEtkHmUWHSemlhudEo6+o6h FcI9R8Zsrpke5Mj1FSbNhnu3V9sCDhigfBeBZs+Kp5n3Z5TkRBBdf218fFqnvOEADMAL zCvQuk1+7HzUotniIFY4c4tmgZsMSL5TNayDKDcm9Sq0XkNBuasbOTnp/oRicKoA3SS7 kGCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=R/xgtArkmRxzfZI9UTCj+h917gYDefsgtFmeLn0Suyo=; b=rnh15Tx6FBQmh9hZife8Hspt/pcZfFG4VMM5yGL+G8f7v+W/F5f2HDzhYdLwuhctWG AUS5wIkWooVd9QqBV00VwWxpb1L6BHucP98izZ8oGxp/JPYlW4b7veHCaIz8hy1ALGJ/ Awpt5yMe/JV5aGtan8zQkJLXyBWP3iMj7TM2Y82c66/LwYkax0wpHd07EetRkgCwICWY khPcM3PzcInXMnaW64k2MnPkC3RqJyhTAY6f8EfqPuF1SHv1Hk5shMvKizmZjmCpCOMu t9LCbASm86OG8kcsowYH2lyPzRIxl+iy1w8Y79NWj5bhzfbQRHAtVen0b7tdMlgRwzoZ dL2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa11-20020a170906fd8b00b0078df2f22f80si7213903ejb.647.2022.11.21.22.12.00; Mon, 21 Nov 2022 22:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231876AbiKVF40 (ORCPT + 91 others); Tue, 22 Nov 2022 00:56:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231981AbiKVF4F (ORCPT ); Tue, 22 Nov 2022 00:56:05 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17AC62654E; Mon, 21 Nov 2022 21:55:32 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 73B0B24DCA6; Tue, 22 Nov 2022 13:55:29 +0800 (CST) Received: from EXMBX072.cuchost.com (172.16.6.82) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 22 Nov 2022 13:55:29 +0800 Received: from [192.168.125.106] (113.72.144.23) by EXMBX072.cuchost.com (172.16.6.82) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 22 Nov 2022 13:55:28 +0800 Message-ID: <62d63104-e392-b002-717d-682193d21c27@starfivetech.com> Date: Tue, 22 Nov 2022 13:55:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH v2 13/14] reset: starfive: Add StarFive JH7110 reset driver Content-Language: en-US To: Emil Renner Berthing CC: "linux-riscv@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-clk@vger.kernel.org" , Conor Dooley , Palmer Dabbelt , Rob Herring , Krzysztof Kozlowski , Stephen Boyd , "Michael Turquette" , Philipp Zabel , "linux-kernel@vger.kernel.org" References: <20221118010627.70576-1-hal.feng@starfivetech.com> <20221118010627.70576-14-hal.feng@starfivetech.com> From: Hal Feng In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [113.72.144.23] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX072.cuchost.com (172.16.6.82) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 19 Nov 2022 01:14:50 +0800, Emil Renner Berthing wrote: > On Fri, 18 Nov 2022 at 02:06, Hal Feng wrote: >> diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c >> new file mode 100644 >> index 000000000000..00f3b4ecfb02 >> --- /dev/null >> +++ b/drivers/reset/starfive/reset-starfive-jh7110.c >> @@ -0,0 +1,67 @@ >> +// SPDX-License-Identifier: GPL-2.0-or-later >> +/* >> + * Reset driver for the StarFive JH7110 SoC >> + * >> + * Copyright (C) 2022 StarFive Technology Co., Ltd. >> + * Copyright (C) 2022 Hal Feng >> + */ >> + >> +#include >> + >> +#include "reset-starfive-jh71x0.h" >> + >> +#include >> + >> +static int jh7110_reset_probe(struct auxiliary_device *adev, >> + const struct auxiliary_device_id *id) >> +{ >> + struct reset_info *info = (struct reset_info *)(id->driver_data); >> + void __iomem *base = dev_get_drvdata(adev->dev.parent); >> + >> + if (!info || !base) >> + return -ENODEV; >> + >> + return reset_starfive_jh71x0_register(&adev->dev, adev->dev.parent->of_node, >> + base + info->assert_offset, >> + base + info->status_offset, >> + info->asserted, >> + info->nr_resets, >> + false); >> +} >> + >> +static const struct reset_info jh7110_sys_info = { >> + .nr_resets = JH7110_SYSRST_END, >> + .assert_offset = 0x2F8, >> + .status_offset = 0x308, >> + .asserted = NULL, >> +}; >> + >> +static const struct reset_info jh7110_aon_info = { >> + .nr_resets = JH7110_AONRST_END, >> + .assert_offset = 0x38, >> + .status_offset = 0x3C, >> + .asserted = NULL, >> +}; > > It doesn't seem like syscrg, aoncrg or stgcrg have any inverted lines. > Do you know if any other CRGs do? If not you can just leave out the > .asserted member and always pass NULL. All JH7110 CRGs don't have inverted lines, and it could be modified as what you said. > >> +static const struct auxiliary_device_id jh7110_reset_ids[] = { >> + { >> + .name = "clk_starfive_jh71x0.reset-sys", >> + .driver_data = (kernel_ulong_t)&jh7110_sys_info, >> + }, >> + { >> + .name = "clk_starfive_jh71x0.reset-aon", >> + .driver_data = (kernel_ulong_t)&jh7110_aon_info, >> + }, >> + { /* sentinel */ } >> +}; >> +MODULE_DEVICE_TABLE(auxiliary, jh7110_reset_ids); >> + >> +static struct auxiliary_driver jh7110_reset_driver = { >> + .probe = jh7110_reset_probe, >> + .id_table = jh7110_reset_ids, >> +}; >> +module_auxiliary_driver(jh7110_reset_driver); >> + >> +MODULE_DESCRIPTION("StarFive JH7110 Reset Driver"); >> +MODULE_AUTHOR("Hal Feng "); >> +MODULE_LICENSE("GPL"); >> diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.h b/drivers/reset/starfive/reset-starfive-jh71x0.h >> index e6b27110de48..63a94ee1b395 100644 >> --- a/drivers/reset/starfive/reset-starfive-jh71x0.h >> +++ b/drivers/reset/starfive/reset-starfive-jh71x0.h >> @@ -6,6 +6,13 @@ >> #ifndef __RESET_STARFIVE_JH71X0_H >> #define __RESET_STARFIVE_JH71X0_H >> >> +struct reset_info { >> + unsigned int nr_resets; >> + unsigned int assert_offset; >> + unsigned int status_offset; >> + const u32 *asserted; >> +}; > > This struct isn't used outside of reset-starfive-jh7110.c, so no need > to define it in this header. > Also consider calling it jh7110_reset_info so it blends in with the > functions defined in that file. Maybe it can be used in JH7100 audio reset? Best regards, Hal > >> int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_node, >> void __iomem *assert, void __iomem *status, >> const u32 *asserted, unsigned int nr_resets,