![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Walk the unflattened tree and register **struct rt_platform_device** for driver **probe**. Core OFW APIs: OFW nodes and properties.
Source: **components/drivers/core/platform_ofw.c**. Platform driver API: Platform bus.
**INIT_PLATFORM_EXPORT(platform_ofw_device_probe)**:
/clocks** subtree (providers before consumers)/** root (depth-first)/firmware**/chosen/simple-framebuffer** (if present)For each available child of **parent_np**:
| Skip when | Reason |
|---|---|
**np->dev set** | Already instantiated |
**RT_OFW_F_SYSTEM or RT_OFW_F_READLY** | Meta or bound node |
No **compatible** and no real name | Anonymous container |
**compatible in platform_ofw_ids** | Action |
|---|---|
**simple-bus**, **simple-mfd**, **isa**, **arm,amba-bus** | Recurse **platform_ofw_device_probe_once(np)** first |
| Leaf | **alloc_ofw_platform_device** → **rt_platform_device_register** |
**ofw_device_rename**: **reg**-based name (lx.%.*s) when decodable, else hierarchical path.
| State | Behavior |
|---|---|
No **np->dev** | Create pdev, register (runs **probe**) |
**dev without driver** | **rt_bus_reload_driver_device** |
| Probed | **RT_EOK** |
Call from consumers after **rt_ofw_parse_phandle_cells** when provider **rt_ofw_data** is NULL.
| API | Role |
|---|---|
**rt_platform_ofw_device_probe_child** | Register single child under non-root parent |
**rt_platform_ofw_free** | Clear **RT_OFW_F_PLATFORM**, **rt_ofw_node_put**, free pdev |
| Issue | Mitigation |
|---|---|
| Clock provider late | Ensure **/clocks** nodes probe first (built-in order) |
No **rt_platform_ofw_request** | Provider never probes — phandle parse succeeds but **rt_ofw_data** NULL |
Bus not in **platform_ofw_ids** | Children still register as leaf platform devices if **compatible** present |