Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2868459rdb; Wed, 15 Nov 2023 13:02:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnKhp8PYWZozvqra0hC+dKU8vR/UOLaQi52eTjsl2ibe6jSdCDWpvJvhnejcx2mwaoNyxk X-Received: by 2002:a05:620a:372a:b0:767:ff8e:74ff with SMTP id de42-20020a05620a372a00b00767ff8e74ffmr9899982qkb.25.1700082146302; Wed, 15 Nov 2023 13:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700082146; cv=none; d=google.com; s=arc-20160816; b=qAwLKB81Maq9y3rEKGVOTyLssGQ8+rOx+R5zidaJKI/pdR5guDsOjV6f25mv1apFJJ aLQa8U33kkaDL0RxBSJc7AY5kI7Vhnf8vBnx0b5eD26sYb+/BfbmanboTGRvs01yVQhh K5VCxspA/ZVwOzH3U+yq+WqveJGj8C8m9+w7yzAH4GVF6aSYKXitabJBO9crNXG/uAvV pofcCd7btKJ17rt2P6Hh3CMStr0rEsiGW4Db+AqBsjG4YCu+/EOi85PW33cPnq2fK7yb Xo2Gz5L4+aTkdD7GP/9Qr/YmqaUPRLuYE4DqOGgs4uS+GmOwO71zYPJ7TfVpjpfBmN6q Uj1Q== 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:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=+WC2Zj75Zg21qI6EGfizkP9vCMfRFqtrZKpHL3RY1XU=; fh=hBERb2jHKScK2QucVlyg1oDAfiGYZGkZm7rhJ3zYiI4=; b=e4WAqSTE8O1rRL8ODnIbwGRE6Ly1INxF29hWNjE36k2gQDN7NneoOMXpJhdw3ulPRL yQKooy8fxyIhsLJy+2Lu1TPGwgA9QnKBvhrtm4lhzj9tYn8U1FyyS9FgiBHpsizN0Jke UuKS9EEiYiUViR1GOEjUJ7oN4k69ACHstoLmg0No5cE6J7rJNuiJfrCaaM8N2aWeHhX/ JwiObJ71NB0kagqja/vsp+opculOcH7y8Y8gR23VxUErTEGHSeeqy7NCiiIgfKtSO7ed 5+4EBPYOPxYfh5eclEJ9YILARgzYR7bJ+k/MTlstJMGgWniBUYUkrXFPDiOy3sMWLDi2 kpEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pbx+yQ+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k21-20020a05620a0b9500b007756fe9b8desi9409704qkh.588.2023.11.15.13.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 13:02:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pbx+yQ+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0CCC88077FFB; Wed, 15 Nov 2023 13:02:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235744AbjKOVBW (ORCPT + 99 others); Wed, 15 Nov 2023 16:01:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbjKOVBD (ORCPT ); Wed, 15 Nov 2023 16:01:03 -0500 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AEE919A8 for ; Wed, 15 Nov 2023 13:00:20 -0800 (PST) Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-670e7ae4a2eso11479466d6.1 for ; Wed, 15 Nov 2023 13:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700082019; x=1700686819; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=+WC2Zj75Zg21qI6EGfizkP9vCMfRFqtrZKpHL3RY1XU=; b=pbx+yQ+OBfAm7QugRKoSyghSuCBIMfdl8BMs7VGmeGT+kfrIqSfIbeJRgSUugxLncb RaZ1bxEDFNVBlWsKjKtSDkbgWarmaQ74Hmqf1pT/IKVWWYMPUwrkstI/vIKj8ANQvse/ w/A9+pJZv951o1d4rB+hp0iqQhvIwG1iz2FUaX3iZqrVj2bMYGTGiMiIN+aWnnZaSj4S x/pWbOc6qXgNUUApoWkiiyFQTwEXKE+Oum3ZjWwZHSHx7quXqCvLdrIBca+5WUyYkUI2 D2M7Ot3SewTolzP7en+PPnYdPsaX5utxA0yCLyRMUfqH665T62xNlDUS66addYHSkves Jw5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700082019; x=1700686819; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+WC2Zj75Zg21qI6EGfizkP9vCMfRFqtrZKpHL3RY1XU=; b=j9rSRXMnYD/DdA7m1X8NdU2n3hJb/s5iYeHn2ul9xeBynOuJbI5kS6MvdcBexqKR6B KHhDbI560/c2jMFuuLfkm2AYBdRhu6hlittd3hJWjkE0EINxb3TCRX4ekZCak5TLO44U JhdzH+ytKSiUAHEIr1qS/kdxRF+n6IUKK8pCrvsDCuFqq7YJWzOHTbm4XAe/86JXljba d66YsGOTHIPLaqjnn0RpShxCcZ5zBTSzR3Gwt3fTIOg6eSbibkFKb4Sy4lQLdRDnoKYL sBT0dZLyBVku+E88UtUvzIKnUvmMUjS+MGqnbnvESsjdZ2RF9fNERKa06gMOpWoKRGWg 6CJA== X-Gm-Message-State: AOJu0YyxwLL6aqTzirsY7Lx2ipPrytDvQYevYT+lZL1aRKTrJr9J6rZD 1Sl50aftCKNtSMQPZvNujebg2g== X-Received: by 2002:a05:6214:1706:b0:66d:6a92:16c2 with SMTP id db6-20020a056214170600b0066d6a9216c2mr11472607qvb.8.1700082019450; Wed, 15 Nov 2023 13:00:19 -0800 (PST) Received: from [172.25.83.73] ([12.186.190.2]) by smtp.gmail.com with ESMTPSA id j11-20020a0ce6ab000000b00655ec7bbfd0sm824726qvn.7.2023.11.15.13.00.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Nov 2023 13:00:18 -0800 (PST) Message-ID: <42ad3f60-2755-4d3b-a766-8e4404f76a7c@linaro.org> Date: Wed, 15 Nov 2023 22:00:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] dt-bindings: reset: Add binding for Sophgo CV1800B reset controller To: Jisheng Zhang , Conor Dooley Cc: Samuel Holland , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Chao Wei , Chen Wang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org References: <20231113005503.2423-1-jszhang@kernel.org> <20231113005503.2423-2-jszhang@kernel.org> <44f21244-5bf1-4e0f-80a9-6ec76d65eea4@linaro.org> <80e28d77-4a0e-4827-91c0-951094176bbd@sifive.com> <20231115-upward-unsworn-7746e0aeb5dd@squawk> Content-Language: en-US From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrcnp5c3p0b2Yua296bG93c2tpQGxpbmFyby5vcmc+wsGUBBMBCgA+FiEE m9B+DgxR+NWWd7dUG5NDfTtBYpsFAmI+BxMCGwMFCRRfreEFCwkIBwIGFQoJCAsCBBYCAwEC HgECF4AACgkQG5NDfTtBYptgbhAAjAGunRoOTduBeC7V6GGOQMYIT5n3Ou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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 15 Nov 2023 13:02:14 -0800 (PST) On 15/11/2023 16:15, Jisheng Zhang wrote: > On Wed, Nov 15, 2023 at 03:02:21PM +0000, Conor Dooley wrote: >> On Wed, Nov 15, 2023 at 09:56:07AM -0500, Samuel Holland wrote: >>> On 2023-11-15 7:27 AM, Jisheng Zhang wrote: >>>> On Tue, Nov 14, 2023 at 10:12:35PM +0100, Krzysztof Kozlowski wrote: >>>>> On 13/11/2023 01:55, Jisheng Zhang wrote: >>>>> ... >>>>> >>>>>> diff --git a/include/dt-bindings/reset/sophgo,cv1800b-reset.h b/include/dt-bindings/reset/sophgo,cv1800b-reset.h >>>>>> new file mode 100644 >>>>>> index 000000000000..28dda71369b4 >>>>>> --- /dev/null >>>>>> +++ b/include/dt-bindings/reset/sophgo,cv1800b-reset.h >>>>>> @@ -0,0 +1,96 @@ >>>>>> +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ >>>>>> +/* >>>>>> + * Copyright (C) 2023 Sophgo Technology Inc. All rights reserved. >>>>>> + * Copyright (C) 2023 Jisheng Zhang >>>>>> + */ >>>>>> + >>>>>> +#ifndef _DT_BINDINGS_CV1800B_RESET_H >>>>>> +#define _DT_BINDINGS_CV1800B_RESET_H >>>>>> + >>>>>> +/* 0-1 */ >>>>>> +#define RST_DDR 2 >>>>>> +#define RST_H264C 3 >>>>>> +#define RST_JPEG 4 >>>>>> +#define RST_H265C 5 >>>>>> +#define RST_VIPSYS 6 >>>>>> +#define RST_TDMA 7 >>>>>> +#define RST_TPU 8 >>>>>> +#define RST_TPUSYS 9 >>>>>> +/* 10 */ >>>>> >>>>> Why do you have empty IDs? IDs start at 0 and are incremented by 1. >>>> >>>> there's 1:1 mapping between the ID and bit. Some bits are reserved, I.E >>>> no actions at all. Is "ID start at 0 and increment by 1" documented >>>> in some docs? From another side, I also notice some SoCs especially >>>> those which make use of reset-simple driver don't strictly follow >>>> this rule, for example, amlogic,meson-a1-reset.h and so on. What >>>> happened? >>>> >>>> And I'd like to ask a question here before cooking 2nd version: >>>> if the HW programming logic is the same as reset-simple, but some >>>> or many bits are reserved, what's the can-be-accepted way to support >>>> the reset controller? Use reset-simple? Obviously if we want the >>>> "ID start at 0 and increment by 1" rule, then we have to write >>>> a custom driver which almost use the reset-simple but with a >>>> customized mapping. >>> >>> There are two possible situations. Either the reset specifier maps directly to >>> something in the hardware, or you are inventing some brand new enumeration to >>> use as a specifier. >>> >>> In the first situation, you do not need a header. We assume the user will look >>> to the SoC documentation if they want to know what the numbers mean. (You aren't >>> _creating_ an ABI, since the ABI is already defined by the hardware.) >>> >>> In the second situation, since we are inventing something new, the numbers >>> should be contiguous. This is what Krzysztof's comment was about. >>> >>> For this reset device, the numbers are hardware bit offsets, so you are in the >>> first situation. So I think the recommended solution here is to remove the >>> header entirely and use the bit numbers directly in the SoC devicetree. >>> >>> It's still appropriate to use reset-simple. Adding some new mapping would make >>> things more complicated for no benefit. >> >> Further, I think it is fine in that case to have a header, just the >> header doesn't belong as a binding, and can instead go in the dts >> directory. > > Hi Samuel, Conor, > > thanks a lot for the suggestion! There is actually a thing here I missed. If this is a reset-simple driver with dedicated SoC-specific compatible, you could want to have a binding header to have IDs. This way later you can easily replace the driver with another implementation, which does no rely on 1-1 mapping to reset bits. Therefore the reset-simple could be the exception where reset-bits could have a meaning as binding header. Best regards, Krzysztof