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 7FCD2C19F2A for ; Thu, 11 Aug 2022 17:57:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA07884A53; Thu, 11 Aug 2022 19:57:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id B740D84A53; Thu, 11 Aug 2022 19:57:46 +0200 (CEST) Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4A00884955 for ; Thu, 11 Aug 2022 19:57:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tharvey@gateworks.com Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1oMCRC-00Foiq-5V; Thu, 11 Aug 2022 17:57:42 +0000 From: Tim Harvey To: u-boot@lists.denx.de Cc: Tim Harvey Subject: [PATCH] [RFC] cmd: i2c: fix default address len for DM_I2C Date: Thu, 11 Aug 2022 10:57:40 -0700 Message-Id: <20220811175740.3984704-1-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 According to the comment block "The default {addr} parameter is one byte (.1) which works well for memories and registers with 8 bits of address space." While this is true for legacy I2C a default length of -1 is being passed for DM_I2C which results in a usage error. Restore the documented behavior by always using a default alen of 1. Signed-off-by: Tim Harvey This is an RFC as I'm unclear if we want to restore the legacy usage or enforce a new usage (in which case the comment block should be updated) and I'm not clear if this is documented in other places. If the decision is to enforce a new usage then it is unclear to me how to specifiy the default alen as there is no command for that (i2c alen [len]?). --- cmd/i2c.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cmd/i2c.c b/cmd/i2c.c index bd04b14024be..c57271479e81 100644 --- a/cmd/i2c.c +++ b/cmd/i2c.c @@ -118,17 +118,7 @@ static uchar i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES; #endif #define DISP_LINE_LEN 16 - -/* - * Default for driver model is to use the chip's existing address length. - * For legacy code, this is not stored, so we need to use a suitable - * default. - */ -#if CONFIG_IS_ENABLED(DM_I2C) -#define DEFAULT_ADDR_LEN (-1) -#else #define DEFAULT_ADDR_LEN 1 -#endif #if CONFIG_IS_ENABLED(DM_I2C) static struct udevice *i2c_cur_bus; -- 2.25.1