All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] cmd: i2c: fix default address len for DM_I2C
@ 2022-08-11 17:57 Tim Harvey
  2022-08-13 14:59 ` Simon Glass
  0 siblings, 1 reply; 8+ messages in thread
From: Tim Harvey @ 2022-08-11 17:57 UTC (permalink / raw)
  To: u-boot; +Cc: Tim Harvey

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 <tharvey@gateworks.com>

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-18 12:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 17:57 [PATCH] [RFC] cmd: i2c: fix default address len for DM_I2C Tim Harvey
2022-08-13 14:59 ` Simon Glass
2022-08-15 17:48   ` Tim Harvey
2022-08-15 22:16     ` Simon Glass
2022-08-16 19:50       ` Tim Harvey
2022-08-16 20:47         ` Simon Glass
     [not found]           ` <CAP4LtEjW38y1T8Dd-mD0+P68NK19TOMagRp4XZ1-oxfS9gD7vQ@mail.gmail.com>
2022-08-17 19:50             ` Fwd: " Nicolas IOOSS
2022-08-17 22:44               ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.