Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp449732lqs; Tue, 5 Mar 2024 06:52:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXhAm++g2FDZXVteeipDw1nA/bo6AHzD1whneM1xEUAW/980gwVXP+ejhX8q7si8wUKvDRYHkh2GWa+1lBV/TS+AMF84Atnm7Z8jH38wA== X-Google-Smtp-Source: AGHT+IEF07j5f2uRrq4ykoXnMYutd/GHrT0P59Kuk7Jq5AOU43SpFS9tcAIO0gmvxxwGQfpbR/Cj X-Received: by 2002:aca:1304:0:b0:3c1:d2c8:a252 with SMTP id e4-20020aca1304000000b003c1d2c8a252mr1873697oii.12.1709650348206; Tue, 05 Mar 2024 06:52:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709650348; cv=pass; d=google.com; s=arc-20160816; b=Z2+PGJnJWEarQvkGn7rkuER6c0T57v+z+hacSw/3v02B8+E7GUoI5Nv2TT7nO12oB8 6Lc6XmtAhajlTX+VKdUl+NeD28Ms+Htec/DNExgdEJHBMzHqrGFYCd3cIAZCELqz35ij 0K74oGRkn8MjRXLuiOVPw2KlRiSZOdEk7Kys1rr5FGqyZFy2uMYf9usMg30yoXt9Cacc DT2teBAONdVA+//RfxW9EBvORG+AfcEHSFYlVbr8KJKinXWbGGFX7clJHsVDrBl5c1YQ ErRFVcTBrmZBXR7qzBiXkVJDlEzbr7LicgrWJcPQGwAMQhNkgVPKPtaxBvBv8vyjTM9r ZRFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=AKhuDWIm1BPr27gwl174Fb5zsGzliY8/tG4oNFZpEp4=; fh=N3ZVKUqb7Uj8jtKo5KskQ+NL3iWHNyTzQG4bnv1Z7TY=; b=x8dhlKtCYFmtuCNOMXgKAxDGiS9V6p1lqrhUVFNBXRcZPqAgNkiWBFiYEGu4evfaww ks7HcTjcpvjWqQHzG9gzvSIjmaQ0KwZDb3KBZyGXK0s9zEEnpLcjyG2tLoc/2neYKRGs mh5RtF3AzvOSzUuffWDwiodKMTe+u07M61f4ME5PHJ18aithYbOnV0gCbNqPJFwz8rht 2K2mtdoCyDkFB9HjXOJZ6uxpqqCV9jYBFKyNL0anJp40beG1gKRQMYw3tH2oQ1DhfsnJ 8rvUEvuiRNhmq6Q6DEEYPBOiTiBlH9IBs3wo6ER2EI9qqMVRdvuOKlj6fVUueTuH1IU0 gSvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R99UqG6Q; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-92535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i184-20020a639dc1000000b005d8b313de29si10193925pgd.650.2024.03.05.06.52.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 06:52:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R99UqG6Q; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-92535-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9EE8628B09C for ; Tue, 5 Mar 2024 14:43:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 441E386AD8; Tue, 5 Mar 2024 14:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="R99UqG6Q" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3638E8663A; Tue, 5 Mar 2024 14:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709649791; cv=none; b=ClpreLiwP85FjMzPKmCMP/Gr76XpbmPymvJVJB+13gj/3ldXwSJg5Ntk28z9wv2rYhrIa+whx1BOVUuIwMLlCbDtVcw7+PIu/v/jbsCzdDg7+t9hWhHMjHST5+8ssBZQ9KXs7M+CKpEqWNDwX9gGxUzRgmlrCYQpiGllTUhYnNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709649791; c=relaxed/simple; bh=/PhlOnmbeHoBdA1OxTwHCaySbDcZFamjy5RrHUoJbVI=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=QhngjWsT1TsU9p3JKoPFXSsooA5JTYOzJDfrUri78XaY7YeTRy7qyph6j6Qz0loxbqorKSz64l5W11xz+aLyI53BG1MFLgbR1uiQGqiGwUQwoMBuj+f3/hajDF68O0YOJbECl8Ir+rGyTbuPYkILcQ9wOAEPpZ7Pk94cHVJoikk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=R99UqG6Q; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 425EgwqH115585; Tue, 5 Mar 2024 08:42:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1709649778; bh=AKhuDWIm1BPr27gwl174Fb5zsGzliY8/tG4oNFZpEp4=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=R99UqG6Qxvk50QEyvsofdsFZevatbPcW6izpcrVAl2VcTwxxh8UcAkJwxHvZ8NcK3 Hlf87106eRLLHe0EzaNtxRIUEqUQqu/c+za1LkyGPpG/Q8P/FvoVB4tI/jSIftar3q A6K6ojr+ZxsFPWYSj0i3UOlMuZgsCFslgnjjdCp0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 425EgwjP030270 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Mar 2024 08:42:58 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 5 Mar 2024 08:42:57 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 5 Mar 2024 08:42:57 -0600 Received: from [10.249.42.149] ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 425Egv2K130222; Tue, 5 Mar 2024 08:42:57 -0600 Message-ID: <1fe44306-b507-4017-8f47-598a76d9dbee@ti.com> Date: Tue, 5 Mar 2024 08:42:57 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] dt-bindings: hwinfo: ti,k3-socinfo: Add nvmem-cells To: Krzysztof Kozlowski , Markus Schneider-Pargmann CC: Rob Herring , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Krzysztof Kozlowski , Conor Dooley , Srinivas Kandagatla , Santosh Shilimkar , , , References: <20240206143711.2410135-1-msp@baylibre.com> <20240206143711.2410135-3-msp@baylibre.com> <20240206184305.GA1875492-robh@kernel.org> <48902771-5d3b-448a-8a74-ac18fb4f1a86@linaro.org> <620a2dca-1901-43d4-8b2b-7ae823705a6e@linaro.org> Content-Language: en-US From: Andrew Davis In-Reply-To: <620a2dca-1901-43d4-8b2b-7ae823705a6e@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On 3/5/24 8:11 AM, Krzysztof Kozlowski wrote: > On 05/03/2024 12:17, Markus Schneider-Pargmann wrote: >> Hi Krzysztof, >> >> On Tue, Mar 05, 2024 at 08:43:03AM +0100, Krzysztof Kozlowski wrote: >>> On 04/03/2024 11:36, Markus Schneider-Pargmann wrote: >>>> Hi, >>>> >>>> On Sat, Feb 17, 2024 at 03:25:30PM +0100, Krzysztof Kozlowski wrote: >>>>> On 14/02/2024 10:31, Markus Schneider-Pargmann wrote: >>>>>> Hi Rob, >>>>>> >>>>>> On Tue, Feb 06, 2024 at 06:43:05PM +0000, Rob Herring wrote: >>>>>>> On Tue, Feb 06, 2024 at 03:37:09PM +0100, Markus Schneider-Pargmann wrote: >>>>>>>> The information k3-socinfo requires is stored in an efuse area. This >>>>>>>> area is required by other devices/drivers as well, so using nvmem-cells >>>>>>>> can be a cleaner way to describe which information are used. >>>>>>>> >>>>>>>> If nvmem-cells are supplied, the address range is not required. >>>>>>>> Cells chipvariant, chippartno and chipmanufacturer are introduced to >>>>>>>> cover all required information. >>>>>>>> >>>>>>>> Signed-off-by: Markus Schneider-Pargmann >>>>>>>> Reviewed-by: Andrew Davis >>>>>>>> --- >>>>>>>> .../bindings/hwinfo/ti,k3-socinfo.yaml | 23 ++++++++++++++++++- >>>>>>>> 1 file changed, 22 insertions(+), 1 deletion(-) >>>>>>>> >>>>>>>> diff --git a/Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml b/Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml >>>>>>>> index dada28b47ea0..f085b7275b7d 100644 >>>>>>>> --- a/Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml >>>>>>>> +++ b/Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml >>>>>>>> @@ -26,9 +26,24 @@ properties: >>>>>>>> reg: >>>>>>>> maxItems: 1 >>>>>>>> >>>>>>>> + nvmem-cells: >>>>>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array >>>>>>>> + >>>>>>>> + nvmem-cell-names: >>>>>>>> + items: >>>>>>>> + - const: chipvariant >>>>>>>> + - const: chippartno >>>>>>>> + - const: chipmanufacturer >>>>>>>> + >>>>>>>> required: >>>>>>>> - compatible >>>>>>>> - - reg >>>>>>>> + >>>>>>>> +oneOf: >>>>>>>> + - required: >>>>>>>> + - reg >>>>>>>> + - required: >>>>>>>> + - nvmem-cells >>>>>>>> + - nvmem-cell-names >>>>>>>> >>>>>>>> additionalProperties: false >>>>>>>> >>>>>>>> @@ -38,3 +53,9 @@ examples: >>>>>>>> compatible = "ti,am654-chipid"; >>>>>>>> reg = <0x43000014 0x4>; >>>>>>>> }; >>>>>>>> + - | >>>>>>>> + chipid: chipid@14 { >>>>>>>> + compatible = "ti,am654-chipid"; >>>>>>> >>>>>>> This isn't compatible if you have a completely different way to access >>>>>>> it. >>>>>> >>>>>> Thanks, it is not entirely clear to me how I could go forward with this? >>>>>> Are you suggesting to use a different compatible? Or is it something >>>>>> else I could do to proceed with this conversion? >>>>> >>>>> What you claim now, is that you have one device with entirely different >>>>> interfaces and programming model. So either this is not the same device >>>>> or you just wrote bindings to whatever you have in driver. >>>>> >>>>> Nothing in commit msg explains this. >>>>> >>>>> What you should do? Depends. If you just write bindings for driver, then >>>>> stop. It's a NAK. Instead write bindings for hardware. >>>>> >>>>> If the first choice, just the hardware is somehow like this, then >>>>> explain in commit msg and device description, how this device can be >>>>> connected over other bus, not MMIO. You can draw some schematics in >>>>> commit msg explaining architecture etc. >>>> >>>> Sorry the information provided in the commit message is not very clear. >>>> >>>> The basic access to the registes is still MMIO. nvmem is used to have a >>>> better abstraction and cleaner description of the hardware. >>>> >>>> Currently most of the data is exported using the parent syscon device. >>>> The relevant data is read-only and contained in a single register with >>>> offset 0x14: >>>> - Chip variant >>>> - Chip part number >>>> - Chip manufacturer >>>> >>>> There are more read-only registers in this section of address space. >>>> These are relevant to other components as they define the operating >>>> points for example. For the OPP table relevant are chip variant and chip >>>> speed (which is in a different register). >>>> >>>> Instead of devices refering to this whole register range of 0x20000 in >>> >>> Whaaaaat? >>> >>>> size, I would like to introduce this nvmem abstraction in between that >>>> describes the information and can directly be referenced by the devices >>>> that depend on it. In this case the above mentioned register with offset >>>> 0x14 is instead described as nvmem-layout like this: >>>> >>>> nvmem-layout { >>>> compatible = "fixed-layout"; >>>> #address-cells = <1>; >>>> #size-cells = <1>; >>>> >>>> chip_manufacturer: jtagidmfg@14 { >>>> reg = <0x14 0x2>; >>>> bits = <1 11>; >>>> }; >>>> >>>> chip_partno: jtagidpartno@15 { >>>> reg = <0x15 0x3>; >>>> bits = <4 16>; >>>> }; >>>> >>>> chip_variant: jtagidvariant@17 { >>>> reg = <0x17 0x1>; >>>> bits = <4 4>; >>>> }; >>>> >>>> chip_speed: jtaguseridspeed@18 { >>>> reg = <0x18 0x4>; >>>> bits = <6 5>; >>>> }; >>>> >>>> The underlying registers are still the same but they are not hidden >>>> by the syscon phandles anymore. >>>> >>>> The device that consumes this data would now use >>>> >>>> nvmem-cells = <&chip_variant>, <&chip_speed>; >>>> nvmem-cell-names = "chipvariant", "chipspeed"; >>>> >>>> instead of >>>> >>>> syscon = <&wkup_conf>; >>> >>> syscon allows you this as well - via phandle arguments. >>> >>> nvmem is for non-volatile memory, like OCOTP and eFUSE. This is not for >>> accessing regular MMIO registers of system-controller, regardless >>> whether they are read-only or not (regmap handles this nicely, BTW). >>> Although probably Apple efuses and few others can confuse here. It still >>> looks like you convert regular system-controller block into nvmem, >>> because you prefer that Linux driver abstraction... >> >> The above mentioned data is set in the factory. There is other >> non-volatile data, like device feature registers, in the same address >> region, as well as OTP data like MAC and USB IDs. But it is not a pure >> non-volatile memory region. The data is copied into these registers by >> the ROM at boot. > > Still entire block is MMIO IP in your SoC, not a efuse/OTP hardware. > nvmem is not for regular MMIO registers which are sometimes R, sometimes RW. Most eFuse/OTP hardware is accessed via MMIO, not sure what that changes. This "block" is a whole bunch of smaller logical chunks of registers, some are actually mapped to eFuses like our MAC addresses. Regions like factory fused MAC addresses are exactly what nvmem does well[0]. Yes, we *could* just have this whole area be one massive blanked syscon region that every driver just manually pokes into with syscon phandles everywhere. But that is hacky and hides details, it is not how DT normally looks. We would like to correctly model our device now with nodes for each "reg" region. We took the syscon shortcut before, and we want to correct that mistake. So what are our options? Is the objection here that this is a new nvmem way of modeling this region changes the compatible "ti,am654-chipid"? If so then would you be open to us adding a new compatible that uses the nvmem nodes? We could then convert over one by one and keeping full backwards compatibility while we do it. Thanks, Andrew [0] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml#L16 > > Best regards, > Krzysztof > >