Files
rt-thread/components/drivers
lhxj 7641ef6885 [drivers] Fix OFW bus conflict and prevent duplicate device creation
Problem:
When enumerating device tree nodes, platform bus and native buses (I2C/SPI)
may create duplicate devices for the same OFW node, causing cross-bus conflicts.
This triggers assertion failure '(dev->bus != new_bus)' in
rt_bus_reload_driver_device() during boot on minimal DM-enabled systems.

Root Cause:
1. Platform bus tries to reload devices that already belong to other buses
   by calling rt_bus_reload_driver_device(dev->bus, dev), which violates
   the API contract (requires dev->bus != new_bus).
2. Native buses (I2C/SPI) do not mark OFW nodes as occupied, so platform
   bus creates duplicate platform devices for I2C/SPI client nodes.

Solution:
1. components/drivers/core/platform_ofw.c: Return RT_EOK when np->dev exists,
   letting the native bus handle device lifecycle instead of cross-bus reload.
2. components/drivers/i2c/dev_i2c_bus.c: Mark i2c_client_np->dev during scan
   to prevent platform bus from duplicating I2C client devices.
3. components/drivers/spi/dev_spi_bus.c: Mark spi_dev_np->dev during scan
   to prevent platform bus from duplicating SPI devices.

Tested on Spacemit K1 RISC-V platform with minimal DM configuration.

Signed-off-by: lhxj <2743257167@qq.com>
2026-01-20 22:05:28 +08:00
..
2024-12-13 10:39:20 +08:00
2025-12-04 15:55:33 +08:00
2025-12-03 21:47:49 +08:00
2025-12-26 21:04:42 +08:00
2025-12-10 16:58:10 +08:00
2025-12-09 13:58:43 +08:00
2025-12-07 22:58:09 +08:00
2025-12-08 17:06:12 +08:00
2025-12-10 17:04:23 +08:00
2025-12-11 11:05:47 +08:00
2025-12-08 17:00:08 +08:00
2025-12-09 14:33:31 +08:00
2025-12-10 16:53:09 +08:00
2025-12-26 21:04:42 +08:00
2013-01-08 22:40:58 +08:00