Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2092832rdb; Mon, 20 Nov 2023 01:26:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbU202OZ24v986vDLLwzuI01P3af4ds+mAP53bKOIZ1zyQOXpAIGHo5BGuR+VW9SaJ/wH9 X-Received: by 2002:a9d:6b11:0:b0:6d3:3dcf:bb92 with SMTP id g17-20020a9d6b11000000b006d33dcfbb92mr7803411otp.37.1700472413120; Mon, 20 Nov 2023 01:26:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700472413; cv=none; d=google.com; s=arc-20160816; b=ytFcUbaaXRZHu/ZZTVV51ACfZJMp1ZRRgqHdYaBbZnf/Ju7MHalAT06BoP2cELQZoO j8jOx/PLwypQS/q/jyIaU/VhYFokG66MUgbJII6Hg8i9swoYLRzWMkMUT5F2Xxgo+jiF oHJRIi2G/481vG0tB48t/ioyVIKbphxOOVMtDoZn87i0mXw2/binRM0Ezu9QqdiCdWUm 9u7RA4AqTRW2H03e+wlW8OHLLqp+EPT76z+/bp7o9uQtXkDBe2/sQ1OklbehFEv8z0DM CVaMcI5/hadVg3L5R+je9UywrsmepiEF5eQHg12wcNKhQfzwkFzmqKs9Ug//rhgDShV8 ZOdQ== 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:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=4AF3n0SRzgHa2UDxd/HcriGc7qp/yO7N04amhSH3xPk=; fh=R5z3XicpYsEV6rtrr2PKz9ORQrFYOkIFQizMZtcEWqw=; b=PLotNP+9I537Q/QAZQQ6Fr0GLH6UBAfGk1Ut0IJsBzQDOteKglUJssI99nK7weu8uN kd6HEOwvhLffFAJ8E44h08+pzs5/tDXsx57wDGkCgxhZWs4ZUemtVp013AuMYUTra7Xt EbwpOuj+cuBVuiAk1Uj5BTo1JYoATFsweYYxUP72ho3y5f3dmNrTsGGcOfpx2mzUlCAl ziC0259iSGeDq2qku+9YSofXpmgV5TEptkCiO+4oKrlLreV0D28RXMP477uuPmEM/pWI GKKM9JRt/DLsnbxS+PKyMaalCtAGzS92NTfoMudVtFpKRJSBiAgW77aFUHUXK15LgWso 57aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uJU9w/zj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id 128-20020a630286000000b005bdfe7528c9si7618832pgc.726.2023.11.20.01.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:26:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uJU9w/zj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id CFA5380A1353; Mon, 20 Nov 2023 01:26:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232276AbjKTJ0l (ORCPT + 99 others); Mon, 20 Nov 2023 04:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjKTJ0k (ORCPT ); Mon, 20 Nov 2023 04:26:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9218E85 for ; Mon, 20 Nov 2023 01:26:36 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFF53C433C9; Mon, 20 Nov 2023 09:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700472396; bh=aOxpQAtChyjTZEv09tF1ryBfUJPyxBj6YGIQUqKs6tw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=uJU9w/zjkHoV/sLrwdRnJ1BvRC0CNl0GMTEC7BRmOgsWOm0I3np8JThlOAd0qfPIP pcpihy954oxJWJ2acLGs5x2XdAG8qFazI+v4ZW715Me6qRkAoc7SwCIRh1mAmbFB1M D1Jw4xPsiI9+MeduSR8dxGdFcWdhyBUXYQbLrjnwKgNHUGZfUMBwpoY08ngVOu96Gk pSDzEsWMsl/5LcdWGep80gGit+EOLUCQu6HFGR96Fr9kLmD0nCK6i4pzrlNRVrU1yg 6kSLZC67OZ6XYyh3WaeF21MEAShv++AWktEUA/BHMKltPBOdCncSKDLcOC1dK2Te30 93Jl0/jKp1/2A== Message-ID: <3d72e17b-aa8d-4611-996e-4a4adc7a2fdd@kernel.org> Date: Mon, 20 Nov 2023 10:26:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/7] w1: ds2433: add support for ds28ec20 eeprom Content-Language: en-US To: marc.ferland@gmail.com, krzysztof.kozlowski@linaro.org Cc: gregkh@linuxfoundation.org, marc.ferland@sonatest.com, jeff.dagenais@gmail.com, rdunlap@infradead.org, linux-kernel@vger.kernel.org References: <20231117192909.98944-1-marc.ferland@sonatest.com> <20231117192909.98944-6-marc.ferland@sonatest.com> From: Krzysztof Kozlowski Autoc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Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/ JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB YpsFAmA872oFCRRflLYACgkQG5NDfTtBYpvScw/9GrqBrVLuJoJ52qBBKUBDo4E+5fU1bjt0 Gv0nh/hNJuecuRY6aemU6HOPNc2t8QHMSvwbSF+Vp9ZkOvrM36yUOufctoqON+wXrliEY0J4 ksR89ZILRRAold9Mh0YDqEJc1HmuxYLJ7lnbLYH1oui8bLbMBM8S2Uo9RKqV2GROLi44enVt vdrDvo+CxKj2K+d4cleCNiz5qbTxPUW/cgkwG0lJc4I4sso7l4XMDKn95c7JtNsuzqKvhEVS oic5by3fbUnuI0cemeizF4QdtX2uQxrP7RwHFBd+YUia7zCcz0//rv6FZmAxWZGy5arNl6Vm lQqNo7/Poh8WWfRS+xegBxc6hBXahpyUKphAKYkah+m+I0QToCfnGKnPqyYIMDEHCS/RfqA5 t8F+O56+oyLBAeWX7XcmyM6TGeVfb+OZVMJnZzK0s2VYAuI0Rl87FBFYgULdgqKV7R7WHzwD uZwJCLykjad45hsWcOGk3OcaAGQS6NDlfhM6O9aYNwGL6tGt/6BkRikNOs7VDEa4/HlbaSJo 7FgndGw1kWmkeL6oQh7wBvYll2buKod4qYntmNKEicoHGU+x91Gcan8mCoqhJkbqrL7+nXG2 5Q/GS5M9RFWS+nYyJh+c3OcfKqVcZQNANItt7+ULzdNJuhvTRRdC3g9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: <20231117192909.98944-6-marc.ferland@sonatest.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 20 Nov 2023 01:26:50 -0800 (PST) On 17/11/2023 20:29, marc.ferland@gmail.com wrote: > From: Marc Ferland > > The ds28ec20 eeprom is (almost) backward compatible with the > ds2433. The only major differences are: > > - the eeprom size is now 2560 bytes instead of 512; > - the number of pages is now 80 (same page size as the ds2433: 256 bits); > - the programming time has increased from 5ms to 10ms; > > This patch adds support for the ds28ec20 to the ds2433 driver. From > the datasheet: The DS28EC20 provides a high degree of backward > compatibility with the DS2433. Besides the different family codes, the > only protocol change that is required on an existing DS2433 > implementation is a lengthening of the programming duration (tPROG) > from 5ms to 10ms. > > Tests: > > dmesg now returns: > > w1_master_driver w1_bus_master1: Attaching one wire slave 43.000000478756 crc e0 > > instead of: > > w1_master_driver w1_bus_master1: Attaching one wire slave 43.000000478756 crc e0 > w1_master_driver w1_bus_master1: Family 43 for 43.000000478756.e0 is not registered. > > Test script: > > #!/bin/sh > > EEPROM=/sys/bus/w1/devices/43-000000478756/eeprom > BINFILE1=/home/root/file1.bin > BINFILE2=/home/root/file2.bin > > for BS in 1 2 3 4 8 16 32 64 128 256 512 1024 2560; do > dd if=/dev/random of=${BINFILE1} bs=${BS} count=1 status=none > dd if=${BINFILE1} of=${EEPROM} status=none > dd if=${EEPROM} of=${BINFILE2} bs=${BS} count=1 status=none > if ! cmp --silent ${BINFILE1} ${BINFILE2}; then > echo file1 > hexdump ${BINFILE1} > echo file2 > hexdump ${BINFILE2} > echo FAIL > exit 1 > fi > echo "${BS} OK!" > done > > Test results (CONFIG_W1_SLAVE_DS2433_CRC is not set): > > $ cat /proc/config.gz | gunzip | grep CONFIG_W1_SLAVE_DS2433 > CONFIG_W1_SLAVE_DS2433=m > # CONFIG_W1_SLAVE_DS2433_CRC is not set > > # ./test.sh > 1 OK! > 2 OK! > 3 OK! > 4 OK! > 8 OK! > 16 OK! > 32 OK! > 64 OK! > 128 OK! > 256 OK! > 512 OK! > 1024 OK! > 2560 OK! > > Test results (CONFIG_W1_SLAVE_DS2433_CRC=y): > > $ cat /proc/config.gz | gunzip | grep CONFIG_W1_SLAVE_DS2433 > CONFIG_W1_SLAVE_DS2433=m > CONFIG_W1_SLAVE_DS2433_CRC=y > > # create a 32 bytes block with a crc, i.e.: > 00000000 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 |123456789:;<=>?@| > 00000010 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e ba 63 |ABCDEFGHIJKLMN.c| > > # fill all 80 blocks > $ dd if=test.bin of=/sys/bus/w1/devices/43-000000478756/eeprom bs=32 count=80 > > # read back all blocks, i.e.: > $ hexdump -C /sys/bus/w1/devices/43-000000478756/eeprom > 00000000 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 |123456789:;<=>?@| > 00000010 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e ba 63 |ABCDEFGHIJKLMN.c| > 00000020 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 |123456789:;<=>?@| > 00000030 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e ba 63 |ABCDEFGHIJKLMN.c| > ... > 000009e0 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 |123456789:;<=>?@| > 000009f0 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e ba 63 |ABCDEFGHIJKLMN.c| > 00000a00 > > Signed-off-by: Marc Ferland > --- > drivers/w1/slaves/w1_ds2433.c | 84 +++++++++++++++++++++++++++++++---- > 1 file changed, 75 insertions(+), 9 deletions(-) > > diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c > index 04c3eee9e5d7..69bdf3dba573 100644 > --- a/drivers/w1/slaves/w1_ds2433.c > +++ b/drivers/w1/slaves/w1_ds2433.c > @@ -1,8 +1,9 @@ > // SPDX-License-Identifier: GPL-2.0-only > /* > - * w1_ds2433.c - w1 family 23 (DS2433) driver > + * w1_ds2433.c - w1 family 23 (DS2433) & 43 (DS28EC20) eeprom driver > * > * Copyright (c) 2005 Ben Gardner > + * Copyright (c) 2023 Marc Ferland > */ > > #include > @@ -23,6 +24,7 @@ > #include > > #define W1_F23_EEPROM_DS2433 0x23 > +#define W1_F43_EEPROM_DS28EC20 0x43 > > #define W1_PAGE_SIZE 32 > #define W1_PAGE_BITS 5 > @@ -45,10 +47,16 @@ static const struct ds2433_config config_f23 = { > .tprog = 5, > }; > > +static const struct ds2433_config config_f43 = { > + .eeprom_size = 2560, > + .page_count = 80, > + .tprog = 10, > +}; > + > struct w1_data { > #ifdef CONFIG_W1_SLAVE_DS2433_CRC > - u8 *memory; > - u32 validcrc; > + u8 *memory; > + unsigned long *validcrc; Why do you change it? This is actually candidate for its own patch with its own justification (not "groundwork" but a reason why such code is better). Best regards, Krzysztof