From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 844F81CF8D; Wed, 19 Jun 2024 14:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806688; cv=none; b=Kszq8J13LUC+Tx+cU+/hcfS5Ms0bmZCQOkhnl8HNb6Yoc69IhEkO6wolKTeOAUGGjg7cO9FSevJNu0Hljfx4fCJeY6erzcg+uhgYUqxpxusxsSaGe/oZaTkuMLKCNo/dwilmUTRae8AY4jJ7wGOLd0VuPy+VxWcxEPXxEBK8o2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806688; c=relaxed/simple; bh=RGSHa7sfaiEy5D4a/j1wrv+LOR9Q1Itk+/bpvv3EMrQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TlAVWiHN94tBjJuDVdmjZfQlvViSUPvNTso6JmJiTtMExc8iRpmClV1Dp2/cFKaHJqgjbUTE8EEJVigkbTBJ5xVgaW5C4IwNkQXud3QQMarxEN+PL1HEbGRT8uLVwoKf8lJpbNs+mFFmlIWC9W5bp3KUaKUhXwHXDZMewaSYb54= 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=ApBt96rQ; arc=none smtp.client-ip=209.85.215.180 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ApBt96rQ" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-70a365a4532so2876849a12.1; Wed, 19 Jun 2024 07:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718806686; x=1719411486; 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=logi2V8osBzXhzd35gF5npZIF3ONa+VvHKEUDyy2HCQ=; b=ApBt96rQqEvbqton4MbNvsCGZXNaGHeaBKI/EpmaN258rLVSJbOK4ks5uq+ajaZPmg RaFeS7he4I/lyZ4SzCV+WlnVx0UIlgjVJg2KGAeObMmnPQlHr//r5zom17SeYu8dpIze LpezjzSnZhegBs9QEv7UCq+0DtDZT4opQQBkllYZcNLZXCFI6ESn9BzHgoq2NWdgvido gmb8dnmayjoijHdlDRWSiQcit0i5hNAxC7zw9MB4BibR6EpqdNcQjMmv5dAkW2/6aXUs orRnB1fQg/XmIIilGAdxlqzQCYqKqjllKtUeEPR+j6he3RGdngKDjN6qpttHUWaCKhJ+ FnIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806686; x=1719411486; 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=logi2V8osBzXhzd35gF5npZIF3ONa+VvHKEUDyy2HCQ=; b=koPqU8TkCUc12g84gUwJj/vyyC1jTHlnAy4P54s70v9tWC3NLFFgdWt03niXMcMYNS pTQWF9vjTfec1JqPK0W8sD9voKT5c4ZK3co/BEmFEoO/0LZ70pZnnfTyGH/PVExGTbth VnMfuQXuT7WdQNJbNEB/jRIlphbtQ1pL6o0qHyi0+FjMKrliHSdwtFpLIIR5WBSMM+tN 39XqzdlgEE1Sk1pwD05HA3u7xrscdDDStcL4cFmD22WSATPrmunjfqlHC/yZUPJWIc87 ivenGwjsdrj+Yyk1s9IiWuqz2K2XCyKbWjzembnGe5NtDHJiZhg/OpGUOee6tMzQrdV5 8hOw== X-Forwarded-Encrypted: i=1; AJvYcCV+rc2GAi3hPyabHadgtJ5iP6eNM45nJssgv+oCvquzgiM/Dfe68vTkQTj1h9WcnXyZ0Mfo5G9P/M8cSzGRSiV20rLTz/Cno5R38odSQlGERqLyr0CP0TiN9Y/I+6doxvoqbxln9Ow1zGQ= X-Gm-Message-State: AOJu0YzdlAQw0YpOlyNRtlJxGoDxQjb5Ox6v09Cd0w6bOHJlkfoThkp9 wLZXfpqMbOPtN4spiurvwERGAZkralBCRT+KP0NQqzWcfwHwnd+C X-Google-Smtp-Source: AGHT+IEWg9UInkYQIxfsa4v520A/FhV/0j9YrrqxpE2GgK7xvcCxFUZIcPus6ZaDoqLvMHsbspm+9Q== X-Received: by 2002:a17:90b:a44:b0:2c3:40b6:293b with SMTP id 98e67ed59e1d1-2c7b5da95d0mr2617806a91.39.1718806685579; Wed, 19 Jun 2024 07:18:05 -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 98e67ed59e1d1-2c77ba5b202sm3120071a91.36.2024.06.19.07.18.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jun 2024 07:18:04 -0700 (PDT) Sender: Guenter Roeck Message-ID: <52d9ec36-2ac8-427a-8631-c7730c979bd0@roeck-us.net> Date: Wed, 19 Jun 2024 07:18:02 -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: [RFT PATCH v2 2/3] hwmon: (spd5118) Use spd5118 specific read/write operations To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: Paul Menzel , Armin Wolf , Wolfram Sang , linux-kernel@vger.kernel.org, =?UTF-8?Q?Ren=C3=A9_Rebe?= , Stephen Horvath , Sasha Kozachuk , John Hamrick , Chris Sarra , linux-hwmon@vger.kernel.org, Jean Delvare , Heiner Kallweit References: <20240618195348.1670547-1-linux@roeck-us.net> <20240618195348.1670547-3-linux@roeck-us.net> <661def21-b0a9-49c1-937e-8526008f529c@roeck-us.net> <4755d088-7eab-47ca-923c-db1fdf3611ab@gmx.de> <6845cc2d-c50b-415b-af49-bf57333ee939@molgen.mpg.de> <0b8ae7fa-e3d3-4d31-9b4b-657b15c2d19c@t-8ch.de> <879b15c1-d924-41d9-a41d-da785b943d26@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+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s j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zg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <879b15c1-d924-41d9-a41d-da785b943d26@t-8ch.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/19/24 02:13, Thomas Weißschuh wrote: > On 2024-06-18 18:02:51+0000, Guenter Roeck wrote: >> On 6/18/24 17:50, Thomas Weißschuh wrote: >>> On 2024-06-18 17:23:44+0000, Guenter Roeck wrote: >>>> On 6/18/24 16:39, Paul Menzel wrote: >>>>> [Cc: +Heiner] >>>>> >>>>> >>>>> Dear Armin, >>>>> >>>>> >>>>> Am 19.06.24 um 01:28 schrieb Armin Wolf: >>>>>> Am 19.06.24 um 00:28 schrieb Wolfram Sang: >>>>>> >>>>>>>> to 86 degrees C. If that doesn't work, we'll be really out of luck >>>>>>>> with that controller (or at least I don't have an idea what else to try). >>>>>>> >>>>>>> Try CCing Heiner Kallweit for ideas about the i801 controller. >>>>> >>>>>> i am not Heiner Kallweit, but i found something interesting in >>>>>> commit ba9ad2af7019 ("i2c: i801: Fix I2C Block Read on 8-Series/C220 and later"). >>>>>> >>>>>> Basically, it seems that the i802 i2c controller indeed features a SPD write disable bit which blocks all writes for slave addresses 0x50-0x57. >>>>>> >>>>>> Does the i801 i2c controller driver print something like "SPD Write Disable is set" during boot? >>>>> >>>>> Nice find. Yes, it does: >>>>> >>>> >>>> Yes, definitely. I didn't have any recent datasheets, so I missed that flag. >>>> Oh well :-(. >>>> >>>>>     [    5.462605] i801_smbus 0000:00:1f.4: SPD Write Disable is set >>>>>     [    5.468399] i801_smbus 0000:00:1f.4: SMBus using PCI interrupt >>>>> >>>> >>>> Bummer. That explains the problem. It means that the BIOS effectively >>>> blocks reading the eeprom on your system (because that would require writing >>>> the page register), as well as changing temperature limits. That is really >>>> annoying, but there is nothing we can do about it. Maybe the BIOS has a >>>> configuration flag to enable or disable write protect, but I doubt it. >>> >>> What about using 16bit addressing mode? >>> >>> Alternatively, at initial power on, the host can set the Table 112, “MR11” [3] = ‘1’ to address the entire 1024 bytes of >>> non-volatile memory with 2 bytes of address and hence not required to go through page selection to address entire >>> non-volatile memory. >>> >>> regmap-i2c allows 16bit addresses when I2C_FUNC_SMBUS_I2C_BLOCK is supported, >>> which to me looks like it should be the case on i801 for ICH5. >>> >> >> Good idea, but it doesn't work. I can get write operations with >> 16-bit register addresses to work even on piix4, but read operations >> require writing a 16-bit register address followed by byte reads (see >> regmap_i2c_smbus_i2c_read_reg16). Unfortunately, spd5118 devices >> don't auto-increment the address on byte read operations, meaning >> each byte read returns data from address 0x00 (i.e., it returns >> 0x51). Try "i2cdump -y -f 0 0x50 c" and you'll see what I mean. >> Maybe there is a way around it, but I have not found it. > > Thanks for the pointer to regmap_i2c_smbus_i2c_read_reg16(). > I'm not really familiar with I2C/SMBUS ... > > Did you look into "2.6.8.3 Default Read Address Pointer Mode"? > Yes, I did, and, yes, setting that for each planned read operation might do the trick, but even that would not work here since writes are blocked. On top of that, it would be extremely expensive (one would have to write the address into the default address registers before starting a read). The reason to use 16-bit access mode would be to simplify access, not to make it more expensive. > I am failing to understand how that address pointer mode would ever make > sense without address auto-increment. Oh, it kind of does, as long as each access is a single i2c operation. One would have to use a SMBus read word operation to read two bytes with a single SMBus command. I guess one could also use something similar to an i2c block operation - start a read with no command byte and just keep going. > >> On top of that, configuring 16-bit mode requires a write operation >> into the page register, and that is blocked. > > ... this one on the other hand is really obvious. > There is actually another problem: When I tried enabling 16-bit mode in my system, I initially had trouble clearing it. When I rebooted, I got a BIOS error telling me that the configuration changed, and it gave me the option to either enter setup or continue. A soft reset did not clear the bit. Power cycle did, but I got the "configuration changed" message again. So even if we would get 16-bit mode to work, it would not be a good idea because it would expose people to the "configuration changed" BIOS message. Resetting the bit on shutdown and when unloading the driver would not help because that would not happen when the system crashes. So, in summary, 16-bit mode is just not usable. If some BIOS actually enables it, we might have to disable it or figure out how to use it without depending on "Default Read Address Pointer Mode". Thanks, Guenter