Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86B3EC4332F for ; Wed, 30 Nov 2022 05:21:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3722585334; Wed, 30 Nov 2022 06:21:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="AWR6MsmH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 962BC85346; Wed, 30 Nov 2022 06:21:17 +0100 (CET) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 19A8985327 for ; Wed, 30 Nov 2022 06:21:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-francis@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AU5LApX051818; Tue, 29 Nov 2022 23:21:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1669785670; bh=lnJXqkXX140torSVEpd7rhKhkRbVuRfD0q6SHwElZcI=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=AWR6MsmHrtAdTw5nemZNiUwYI6NPvs4oNLTzlRQl2GQ6aP8Gnx06JYmFTcKQDIyb4 ryyoVrCcFbLgvew2YQvFlHSG3HEnad4ssHs8hjktkEo3FKgXhgB7Rxy7ivO/zDxc+l fd24SSZaCQyGLBf72W1rvXJteTCIcxA9SNN9/2EA= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AU5LAix049688 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 29 Nov 2022 23:21:10 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Tue, 29 Nov 2022 23:21:10 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Tue, 29 Nov 2022 23:21:10 -0600 Received: from [10.250.148.66] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2AU5L6Jq082935; Tue, 29 Nov 2022 23:21:08 -0600 Message-ID: <36ecb238-d57f-718f-87a5-4f9dbe0c3fff@ti.com> Date: Wed, 30 Nov 2022 10:51:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [RFC PATCH] board: ti: common: board_detect: Fix EEPROM read quirk for 2-byte Content-Language: en-US To: Tom Rini , "Matwey V. Kornilov" CC: , , , References: <20221129065010.123065-1-n-francis@ti.com> <20221129133159.GR3787616@bill-the-cat> From: Neha Malcom Francis In-Reply-To: <20221129133159.GR3787616@bill-the-cat> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Tom On 29/11/22 19:01, Tom Rini wrote: > On Tue, Nov 29, 2022 at 03:10:12PM +0300, Matwey V. Kornilov wrote: >> вт, 29 нояб. 2022 г. в 09:50, Neha Malcom Francis : >>> >>> EEPROM detection logic in ti_i2c_eeprom_get() involves figuring out >>> whether addressing is 1-byte or 2-byte. There are currently different >>> behaviours seen across boards as documented in commit bf6376642fe8 >>> ("board: ti: common: board_detect: Fix EEPROM read quirk"). Adding to >>> the list, we see that there are 2-byte EEPROMs that read properly >>> with 1-byte addressing with no offset. >>> >>> For ti_i2c_eeprom_am6_get where eeprom parse operation is dynamic, the >>> earlier commit d2ab2a2bafd5 ("board: ti: common: board_detect: Fix >>> EEPROM read quirk for AM6 style data") tried to resolve this by running >>> ti_i2c_eeprom_get() twice. However this commit along with its former >>> commit fails on J7 platforms where EEPROM successfully return back the >>> header on 1-byte addressing and continues to do so until an offset is >>> introduced. So the second read incorrectly determines the EEPROM as >>> 1-byte addressing. >>> >>> A more generic solution is introduced here to solve >>> this issue: 1-byte read without offset and 1-byte read with offset. If >>> both passes, it follows 1-byte addressing else we proceed with 2-byte >>> addressing check. >>> >>> Tested on J721E, J7200, DRA7xx, AM64x >> >> I'll try to test this on the AM335x boards I have as soon as possible. > > I wonder if we should re-factor this code a bit and not have a single > ti_i2c_eeprom_get but instead build for whichever sets of quirks a given > family of boards has with their EEPROMs. I really worry that we're going > to find that this change here breaks yet another different EEPROM than > before. > Yes that does make sense... considering a new behavior of EEPROM keeps showing up. I will try refactoring the logic that way. -- Thanking You Neha Malcom Francis