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 5B907C433EF for ; Sun, 3 Jul 2022 12:39:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 71239844C3; Sun, 3 Jul 2022 14:39:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="GtqIBRPk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 594DD844B7; Sun, 3 Jul 2022 14:39:20 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 46A85844C3 for ; Sun, 3 Jul 2022 14:39:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC8FBB80838; Sun, 3 Jul 2022 12:39:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70863C341C6; Sun, 3 Jul 2022 12:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656851956; bh=PwlsHBzs83xs9RBWCMEkZSmmEfUhTpF0Hnkp3MJzV8o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GtqIBRPk4cTRpEt7PGlqu3Z+5rLKy9Ggg5urRAPD/HZC3SZRdasO8h5EzzyO4/KJM V4/5yNzrmMor9FZPdTsEyPxAiW6fP4PvE06BW2nLfK7Fegn6iEok/TBLlhLAQZnaMP Dj7Cv4TQrh3HLOQjqRxyKkSKZT/OFukLBbHGIkruA2B0YqIUxr3S0fkavqnT4AQdO7 79aHzH6xbwY1R0zr9toNKmLgeb8Q8qb1ZxM1bFQghSAXA2BjY4IDVz0Lsp1vhte0Q2 RGDEV2qD1xn6A9F8ymB/p+K9Wq8ruWgcxVy8k+nxuvyRd+nsMWmCPWJNaCbBHxdToy 0axgAua0j7M8w== Received: by pali.im (Postfix) id E472B11B0; Sun, 3 Jul 2022 14:39:13 +0200 (CEST) Date: Sun, 3 Jul 2022 14:39:13 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: "Peng Fan (OSS)" , Priyanka Jain , Qiang Zhao , Shengzhou Liu , Sinan Akman Cc: u-boot@lists.denx.de Subject: Re: [PATCH v3] board: freescale: p1_p2_rdb_pc: Fix parsing inverted bits from boot input data Message-ID: <20220703123913.szw7ljcxdcujr5ts@pali> References: <8d8a6be1-6033-5771-0e0e-f51de1488e69@oss.nxp.com> <20220616123707.8562-1-pali@kernel.org> <20220623130408.qlrlrkb2rno5ussd@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220623130408.qlrlrkb2rno5ussd@pali> User-Agent: NeoMutt/20180716 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 Thursday 23 June 2022 15:04:08 Pali Rohár wrote: > On Thursday 16 June 2022 14:37:07 Pali Rohár wrote: > > On some boards upper 4 bits of i2c boot input data (register 0) are > > inverted. Information which bits are inverted is stored in register 2. > > > > So invert read input data back according to register 2 prior processing > > them. This fixes printing "rom_loc: value" line during booting. > > > > Signed-off-by: Pali Rohár > > --- > > Changes in v3: > > * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74 > > PING? PING? > > Changes in v2: > > * Use register 2 for detecting which bits needs to be inverted > > --- > > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > > index 6665aa4ba94e..d36306f35427 100644 > > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > > @@ -174,7 +174,7 @@ int checkboard(void) > > { > > struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE); > > ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); > > - u8 in, out, io_config, val; > > + u8 in, out, invert, io_config, val; > > int bus_num = CONFIG_SYS_SPD_BUS_NUM; > > > > /* FIXME: This should just use the model from the device tree or similar */ > > @@ -198,6 +198,7 @@ int checkboard(void) > > > > if (dm_i2c_read(dev, 0, &in, 1) < 0 || > > dm_i2c_read(dev, 1, &out, 1) < 0 || > > + dm_i2c_read(dev, 2, &invert, 1) < 0 || > > dm_i2c_read(dev, 3, &io_config, 1) < 0) { > > printf("Error reading i2c boot information!\n"); > > return 0; /* Don't want to hang() on this error */ > > @@ -207,13 +208,14 @@ int checkboard(void) > > > > if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 || > > i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 || > > + i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 || > > i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) { > > printf("Error reading i2c boot information!\n"); > > return 0; /* Don't want to hang() on this error */ > > } > > #endif > > > > - val = (in & io_config) | (out & (~io_config)); > > + val = ((in ^ invert) & io_config) | (out & (~io_config)); > > > > puts("rom_loc: "); > > if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) { > > -- > > 2.20.1 > >