Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp507079lqj; Sun, 2 Jun 2024 08:26:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWW9Arg/UH4hNPn687aIWb95Sy8mHCf3+GGTQK05dKq2vjQ/XZ4UcUta/n9wBWSyBywWt6f7PbBL4CL8sG1M2koYIM5hIiywCSxqfumRQ== X-Google-Smtp-Source: AGHT+IEHnJ0DW7OpSq35nHaJ4bCv+67EPGVVTRV0D0Lrw6d5fgCvSIdVIChqFPsvghEdYnykx97K X-Received: by 2002:a05:620a:3887:b0:794:f1f1:804 with SMTP id af79cd13be357-794f5cc64a9mr669518385a.52.1717341985225; Sun, 02 Jun 2024 08:26:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717341985; cv=pass; d=google.com; s=arc-20160816; b=gk8iSACSn1LQKbH3MLoi7G9XtiXAZJf/lg864ZOZeaic7pIBCvg0pQa54j4yOTzxwd kZJmpf5gHbUT2u7URYB1a/TOg0MpQ22VPnCBA/Ujalq/XiZu7QMMEdgsT1ubttnfmYFS zWx4tb097u8/RFXjz49bpWDk3EDnuoAZ72xEwS+KrxJOgQAkdoLTEwTuybgjBc2aSt0d GOEgKF9Qq7hkocGYe3nbz7/4pT9Ea+WfrhwXJiiOiOuesHY6I3pMEn8u5odvtGkvvqHe uMnl3ZoXQ+7o7+TludVqBgEfRissJJETUN09ewWUj9T42/UHnD7UTRE7zE2q+27ZgxHn uDaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=7EvfgY6PKPV319I7n7pojRWg9bK+qmS6AU4WZVV7aVM=; fh=m4p8WiJVRFEwivoZ9revBdxWdJ0gtZ+RFHLIDaxz5wo=; b=j97BPky+sA/mhtkTMPpqhEVz7+cB6KiPfWAlEvEWQKHXEW6Wy6D5X0pLZyv9Z28jZa 200VI2SqyftHpDPEfULWi9PJ7THXw9zhBr4wljZJ+egbLpEMQkBeV06PIScymtr7lM/U MXvvw6q7dhp89bkCyBvIsp0726eqWUcWTEB1exyPnmLgnZxcp8x2PI4TanOheLgds5dY pGlBdt+NU0stM5w7OwJTQ7zitI3ojwKvZl4u3KGJq0bjwuSUPigEcmwM/7ciIP8KT2Ox rJBFLCploj4Gq53MsUlaUMp0fHn9ggx8+d5EYuW5iV8Z6TVWsZrUXYtw1FpDDAzLhXVR DF9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ipho9KgC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198321-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794f3062fadsi659273885a.254.2024.06.02.08.26.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 08:26:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ipho9KgC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198321-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D9D9D1C2129C for ; Sun, 2 Jun 2024 15:26:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A80B481AC; Sun, 2 Jun 2024 15:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ipho9KgC" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E0C0433D8; Sun, 2 Jun 2024 15:25:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717341956; cv=none; b=iUKXxqCa1Vu0zXqgZvpVd0vrqYEAD2gV+TLsg8P8ou/EPSXdSbnPaHM+dGwoRE5M/cquGApb37Owd1c3j/WSVGWidwELOlxVnxmB3uJYShlY8ZgBHjizUx9gSkBJMvWBBvWtRFQ4wQho4HE7jlBL3I/b8xA7Z/V6oFlMNWnRJt4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717341956; c=relaxed/simple; bh=lpZusebmPPOM2E+bgMGI8hFwQqWLWhfREgwS2GZgn1o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PKF/W8aqNv0DSPDw6oT7XcPiIDUE0TK2YdlcCa0gBEmgznld6KueLfQXH2tU7aoAHqhZjX1GJO1ZEDMuWHbz1jaUNSh8tVyPi/ZmvhVhF+xY5mJx8WSoUKlw7jLVUyC3ULwMk1lYgsfnPQ1nfSQ/qxQpII9To0Ln3Bo9he4ndUk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ipho9KgC; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2bfffa3c748so2787841a91.3; Sun, 02 Jun 2024 08:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717341954; x=1717946754; 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:sender:from:to:cc:subject:date:message-id:reply-to; bh=7EvfgY6PKPV319I7n7pojRWg9bK+qmS6AU4WZVV7aVM=; b=ipho9KgC1tbZVt7ZI2gRG0k/ufUPyNhVDOpVw6Fx6ESIBV9Xqs/mztFkF6za9SoQUG VnR+lF0BbisG38WFjSF4bxx+0Q3Ml8pFZeqBvYtOG/7Ks74GZscbt7Q0afDpBRMGb3vS fIr1rKgyhU503NmpjOZfp+K31BJq4FJEyi/YaVOP0soT8GbuqcG8NOGcSZHGjpCmpC50 KxFVdcSWoA0jrD3TSIrC4fZUvHTMdtF+3acaO9RS4lLsZ1vz9hOxTsXzjSBJGjeogm5d RYWa4QEL/VCoPu9q6QI/W/U46e668wXNNZ3xROFo/B2ZYoFr8IlZLjTFNhTWbg5eXYyF QrWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717341954; x=1717946754; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7EvfgY6PKPV319I7n7pojRWg9bK+qmS6AU4WZVV7aVM=; b=Yx8KsYki8s/F0XvPRJI03gzhcaXYsO+3II3mdt2zijH1Gdb0CM7HQ87wHG5FAQ46Xa f/6spyNEmZl9kv/UpoxvuRJqzi9/YnRCsP80X2xhC4TFAqMejwqZrpl5rstkuevGl+EB RSeJt/UWXrZSRgQaqaw+GmWNLuYDVp7lkFPvT1jxELXqKVmonlMFwm3SNbOmQaYgvkNV ZBPOVDOSJdlY5PRG9UNYXBAM1jpk20DHcWFgx/ruLZnZsXfxnxfWOn7DSx2SMKA7BeMZ yo6ZdA7hWRIhUEvBw95reuUG9pxRAB9bvPi2wh5MkHF8RGBXj/U/+SwHQjSkqBM3TMOf kyfA== X-Forwarded-Encrypted: i=1; AJvYcCV6wDAQDrF4/ZN1AZO99ScA8t7ml3inLrfA0jfKv3oVR7vwa0UN+IHGjL53wYh4M/VO2gTWtTTgnIllkSEC0YV90/s8wsarBYvyMcjwhvYebbvqZ3OFn+xPXEzuBys1ZJbeM8JwSvzcVw== X-Gm-Message-State: AOJu0Yw3az1RoVyUQZWSTZrmfZqdP2y4civ9K4w/yehsuQqrS3mUUcLX DU7CH/GE2fltAhd09Bio2smQKhpE7tR26LdPT37Nw9DDEnvby+0y X-Received: by 2002:a17:903:187:b0:1f6:7f37:c116 with SMTP id d9443c01a7336-1f67f37c64cmr1603585ad.63.1717341954080; Sun, 02 Jun 2024 08:25:54 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323dda6esm48118785ad.141.2024.06.02.08.25.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Jun 2024 08:25:53 -0700 (PDT) Sender: Guenter Roeck Message-ID: <5baf4a58-0926-4d7c-bd4b-c755aced6d50@roeck-us.net> Date: Sun, 2 Jun 2024 08:25:50 -0700 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 RFT v3 4/4] hwmon: (spd5118) Add support for reading SPD data To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Armin Wolf Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-kernel@vger.kernel.org, =?UTF-8?Q?Ren=C3=A9_Rebe?= , Wolfram Sang References: <20240531230556.1409532-1-linux@roeck-us.net> <20240531230556.1409532-5-linux@roeck-us.net> <4cc979c3-3ce0-4f31-b5d0-508e1af5fdf4@roeck-us.net> <4e4341e4-2165-40d4-909c-9d5164e97942@t-8ch.de> <04d55009-c4a7-49e6-b098-545f20719f83@t-8ch.de> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJl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OrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <04d55009-c4a7-49e6-b098-545f20719f83@t-8ch.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/2/24 00:55, Thomas Weißschuh wrote: > On 2024-06-01 21:23:24+0000, Armin Wolf wrote: >> Am 01.06.24 um 16:08 schrieb Thomas Weißschuh: >> >>> On 2024-06-01 06:48:29+0000, Guenter Roeck wrote: >>> >>> >>> >>>> Makes sense. Another question: >>>> >>>> This: >>>> >>>> + struct nvmem_config nvmem_config = { >>>> + .type = NVMEM_TYPE_EEPROM, >>>> + .name = dev_name(dev), >>>> + .id = NVMEM_DEVID_AUTO, >>>> >>>> results in: >>>> >>>> $ ls /sys/bus/nvmem/devices >>>> 0-00501 0-00512 0-00523 0-00534 cmos_nvram0 >>>> ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^ >>>> >>>> which really doesn't look good. My current plan is to go with NVMEM_DEVID_NONE, >>>> which results in >>>> >>>> $ ls /sys/bus/nvmem/devices >>>> 0-0050 0-0051 0-0052 0-0053 cmos_nvram0 >>>> >>>> We could also used fixed strings, but "spd" results in "spd[1-4]" which >>>> I think would be a bit misleading since the DDR3/4 SPD data format is >>>> different, and "spd5118" would result in "spd5118[1-4]" which again would >>>> look odd. Any suggestions ? >>> In order of descending, personal preference: >>> >>> * spd-ddr5-[0-3] (.id = client->address - 0x50) >> >> Hi, >> >> this will break as soon as more than 8 DDR5 DIMMs are installed. > > i2c_register_spd() only handles 8 DIMMs, too. > JESD 300-5B.01 (section 2.6.5) also defines i2c addresses for 8 DIMMS only. > > Outside of that range we could fall back to something else. > >>> * spd-ddr5-[0-3] (NVMEM_DEVID_AUTO) >>> * Same with only "ddr5-" >>> * spd5118-[0-3] >>> * Your proposal from above >>> * nvmem[0-3] (default handling) >>> * 0-0050-[0-3] >>> >>> Also can't a user of the eeprom already figure out which kind of module >>> it is by looking at the eeprom contents? >>> The first few bytes used for that seem to be compatible between at least >>> DDR4 and DDR5. >>> >>> So using plain spd[1-4] could be enough. >> >> This could cause problems when DDR6 arrives. >> Personally i would prefer the spd5118-X (NVMEM_DEVID_AUTO) format. > > I have the impression that the eeprom layouts are designed to be > forward and backward compatible. > > If a non-DDR5-aware parser reads the contents of a DDR5 eeprom it will > fail the CRC check, so there can be no accidental misinterpretation. > (Because the CRC'ed area is larger and the CRC is at another location) > > On the other hand the first bytes of DDR4 and DDR5 are compatible, so > even an unaware parser can recognize that a SPD eeprom is being read and > which DIMM type and specification revision it is. > > This seems intentional and therefore should also hold true for DDR5 to DDR6. > Looking into how this is handled by other drivers: - at24 generates directories named {bus}-005{0-7}X, where X is from NVMEM_DEVID_AUTO. Alternatively, it uses the 'label' devicetree property. In that case, the name will be