All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] Align U-Boot I2C DM bus ID handling with Linux
@ 2019-01-18 15:13 Michal Simek
  2019-01-18 15:13 ` [U-Boot] [PATCH 1/4] dm: core: Add of_alias_get_highest_id() Michal Simek
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Michal Simek @ 2019-01-18 15:13 UTC (permalink / raw)
  To: u-boot

U-Boot with I2C_DM enabled is not capable to list i2c busses connected
to i2c mux. For getting this work there is a need to find out highest
alias ID and use this uniq number for new buses connected to I2C mux.
This series is making this happen.

There is only one missing piece which is that also i2c controllers which
are not listed in DT are not using this feature.
For getting this work it would be necessary to setup dev->req_seq in
pre_bind function.

int i2c_pre_bind(struct udevice *dev)
{
	if (dev->req_seq == -1) {
		dev->req_seq = ++i2c_highest_id;
	}
	return 0;
}

It can be done also in post_bind but it looks quite weird that
controller has highest ID then i2c-mux sub-buses connected to it.
For example:
ZynqMP> i2c bus
Bus 3:	i2c at ff020000
   20: gpio at 20, offset len 1, flags 0
   21: gpio at 21, offset len 1, flags 0
   75: i2c-mux at 75, offset len 1, flags 0
Bus 0:	i2c at ff020000->i2c-mux at 75->i2c at 0
Bus 1:	i2c at ff020000->i2c-mux at 75->i2c at 1
Bus 2:	i2c at ff020000->i2c-mux at 75->i2c at 2
Bus 17:	i2c at ff030000
   74: i2c-mux at 74, offset len 1, flags 0
   75: i2c-mux at 75, offset len 1, flags 0
Bus 4:	i2c at ff030000->i2c-mux at 74->i2c at 0
Bus 5:	i2c at ff030000->i2c-mux at 74->i2c at 1
Bus 6:	i2c at ff030000->i2c-mux at 74->i2c at 2
Bus 7:	i2c at ff030000->i2c-mux at 74->i2c at 3
...

That's why I think it would be better to introduce pre_bind hooks and
call it in device_bind_common() before binding childs.

Thanks,
Michal


Michal Simek (4):
  dm: core: Add of_alias_get_highest_id()
  fdt: Introduce fdtdec_get_alias_highest_id()
  i2c: dm: Record maximum id of devices before probing devices
  i2c: mux: Add support for not listed sub-buses

 drivers/core/of_access.c           | 18 ++++++++++++++++++
 drivers/i2c/i2c-uclass.c           | 19 +++++++++++++++++++
 drivers/i2c/muxes/i2c-mux-uclass.c | 35 +++++++++++++++++++++++++++++++++--
 include/dm/of_access.h             |  9 +++++++++
 include/fdtdec.h                   | 13 +++++++++++++
 include/i2c.h                      |  3 +++
 lib/fdtdec.c                       | 33 +++++++++++++++++++++++++++++++++
 7 files changed, 128 insertions(+), 2 deletions(-)

-- 
1.9.1

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

end of thread, other threads:[~2019-02-02  6:22 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18 15:13 [U-Boot] [PATCH 0/4] Align U-Boot I2C DM bus ID handling with Linux Michal Simek
2019-01-18 15:13 ` [U-Boot] [PATCH 1/4] dm: core: Add of_alias_get_highest_id() Michal Simek
2019-01-28 12:35   ` Michal Simek
2019-01-31 10:04   ` Simon Glass
2019-01-31 10:19     ` Michal Simek
2019-02-02  6:05       ` Simon Glass
2019-01-18 15:13 ` [U-Boot] [PATCH 2/4] fdt: Introduce fdtdec_get_alias_highest_id() Michal Simek
2019-01-31 10:04   ` Simon Glass
2019-01-31 10:14     ` Michal Simek
2019-01-18 15:13 ` [U-Boot] [PATCH 3/4] i2c: dm: Record maximum id of devices before probing devices Michal Simek
2019-01-31 10:04   ` Simon Glass
2019-01-31 11:03     ` Michal Simek
2019-02-02  6:05       ` Simon Glass
2019-02-02  6:22         ` Michal Simek
2019-01-18 15:13 ` [U-Boot] [PATCH 4/4] i2c: mux: Add support for not listed sub-buses Michal Simek
2019-01-24  8:27   ` Michal Simek
2019-01-31 10:04   ` Simon Glass
2019-01-31 15:05     ` Michal Simek
2019-01-18 15:24 ` [U-Boot] [PATCH 0/4] Align U-Boot I2C DM bus ID handling with Linux Michal Simek

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.