From mboxrd@z Thu Jan 1 00:00:00 1970 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 586D9C32771 for ; Fri, 19 Aug 2022 13:57:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D0CA845CE; Fri, 19 Aug 2022 15:57:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YS6yV8D3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE953849BC; Fri, 19 Aug 2022 15:57:22 +0200 (CEST) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8761684236 for ; Fri, 19 Aug 2022 15:57:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robertcnelson@gmail.com Received: by mail-pf1-x434.google.com with SMTP id x19so1609134pfq.1 for ; Fri, 19 Aug 2022 06:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=XknXMqfL16M1N+KJxGz9n/E4dmjHKph+UBmDgaZ0JFw=; b=YS6yV8D3P76Qfpi0TTjYCO4+o79cIbkWMZYsg/dN48QyPim8VJ5ivXkVQiVB2aHlpu poeFUTKcNeU34iu4dxPc4dzy8dfhXzv9DxKpdzBUihnD8WMR1P2e2u8IcYiWv6xvBC+j cFcMbcdXjXQq5uRNZKxMnceee3hCakIoOY9wTz0T/Z8CACWwG2STNk48BsIzzoJXUn+H b65oi/2hBh4wBM8di5ep+am7VynLNwINm3eeEY6G3aVpGIogQQvjzY+TskieK5FinpsA Cq5R7+XNK7tkpEW399Bnzjo0MuZ+EiVgokTl8rnasLZxZozguoz/60NXgSJlm3deGu2m /+kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=XknXMqfL16M1N+KJxGz9n/E4dmjHKph+UBmDgaZ0JFw=; b=O9BGXQiH6Js4sPkC1PMQKO1i6cdhuPY41+IlyUMtjl3q3s7fMH7mqIEGMyz728PLHS tv0jSe5b5slcCHEVRE49E06NpdDdqMXxB0HmPu5LbuO1Df7ifU+IQQihc+/NeI27u4yh ciI0M8vrGalHmiFQANJ3Q6FcBZoAdInwVSkHn0cmj3HnhAZwVs1PC7gzFMAdGwTcDaQR MBuhWKcp8aBuodFza48vFBEVv9N5sbz5HDKJNIFKvnHZ3eJGk0ORZheMMGLQ/R0hagHq zeKz8zsIy9UdFXTcxLxUTFDXfx97wlyn4HZ1nl+R38k89nTdl6IjQ4at2saUqozuIWsa QthA== X-Gm-Message-State: ACgBeo1/odR21GuCVMQh4vj3zgv8hS+A4ABjU1vQ5RFGVBZ3cs4N4W1Z y/wYpPAuYA9qY2pkroe6S/ieEW7LglWp3D9G5EA= X-Google-Smtp-Source: AA6agR5kk4wpiIcBa0wBuJy9goiVEBw9ZGQbkqzmZ1yBbfDuOaJBspjHuUHcPC5gRFaLGoseLsVqJex3Q2MMvbnM5D4= X-Received: by 2002:a63:fa49:0:b0:429:fd87:3171 with SMTP id g9-20020a63fa49000000b00429fd873171mr6036382pgk.504.1660917437610; Fri, 19 Aug 2022 06:57:17 -0700 (PDT) MIME-Version: 1.0 References: <20220818082805.6575-1-matwey.kornilov@gmail.com> <20220819093016.diyfagg7hds7tbwv@reoccupy> In-Reply-To: <20220819093016.diyfagg7hds7tbwv@reoccupy> From: Robert Nelson Date: Fri, 19 Aug 2022 08:56:51 -0500 Message-ID: Subject: Re: [BISECTED] BeagleBone Black doesn't boot after a58147c2dbbf To: Nishanth Menon Cc: "Matwey V. Kornilov" , U-Boot-Denx , Tom Rini Content-Type: text/plain; charset="UTF-8" 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 On Fri, Aug 19, 2022 at 4:30 AM Nishanth Menon wrote: > > On 11:28-20220818, Matwey V. Kornilov wrote: > > I've played a little and now I believe that the issue is that EEPROM read addr > > pointer is somehow corrupted due to 1-byte address write. The EEPROM is > > definitely have two-byte read address accoring the datasheet. > > I've failed to unravel exact rule what is happening when only one address byte > > is set, but was able to read random places of EEPROM. > > > > > > However, the following diff makes the board bootable. > > > > > > diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c > > index ed34991377..26edddccc6 100644 > > --- a/board/ti/common/board_detect.c > > +++ b/board/ti/common/board_detect.c > > @@ -86,7 +86,6 @@ __weak void gpi2c_init(void) > > static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, > > u32 header, u32 size, uint8_t *ep) > > { > > - u32 hdr_read = 0xdeadbeef; > > int rc; > > > > #if CONFIG_IS_ENABLED(DM_I2C) > > @@ -113,10 +112,10 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, > > * We must allow for fall through to check the data if 2 byte > > * addressing works > > */ > > - (void)dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); > > + rc = dm_i2c_read(dev, 0, ep, size); > > > > /* Corrupted data??? */ > > - if (hdr_read != header) { > > + if (rc || (*((u32*)ep) != header)) { > > /* > > * read the eeprom header using i2c again, but use only a > > * 2 byte address (some newer boards need this..) > > @@ -125,16 +124,13 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, > > if (rc) > > return rc; > > > > - rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); > > + rc = dm_i2c_read(dev, 0, ep, size); > > if (rc) > > return rc; > > } > > - if (hdr_read != header) > > + if (*((u32*)ep) != header) > > return -1; > > > > - rc = dm_i2c_read(dev, 0, ep, size); > > - if (rc) > > - return rc; > > #else > > u32 byte; > > This does work. I tested a few variations of boards to check this > concept out.. but anyways.. on beaglebone black (element 14 boards): > > NOTE: This will improve detection times for 1 byte eeprom based boot, > since there is no retry.. > > However for boards with 2 byte addressing eeproms: > > master branch: https://pasteboard.co/n3P8yhSq6pem.png > Time from first attempt to read eeprom to actual trigger of final eeprom > read attempt: ~4ms > > With this patch: https://pasteboard.co/IVQzHwMuhc4p.png > Time from first attempt to read eeprom to actual trigger of final eeprom > read attempt: ~18ms > > IMHO, 14ms penalty is'nt a bad deal for dealing with variations of > eeproms we are seeing in the wild. > > You can find the data (analog+digital capture) here: > https://github.com/nmenon/data-captures/tree/main/i2c-eeprom-1byte-captures > Tool used to capture (and view): https://www.saleae.com/downloads/ > > Tom, Robert, folks: what do you folks think? I'm okay with the delay. if we only had 'one' production run it would be a different story.. But with 10 years of manufacturing, parts will EOL and vary. Let's go with the safe slower route.. Regards, -- Robert Nelson https://rcn-ee.com/