|
@@ -17,6 +17,7 @@
|
|
#include <drivers/ofw_io.h>
|
|
#include <drivers/ofw_io.h>
|
|
#include <drivers/ofw_fdt.h>
|
|
#include <drivers/ofw_fdt.h>
|
|
#include <drivers/platform.h>
|
|
#include <drivers/platform.h>
|
|
|
|
+#include <drivers/core/bus.h>
|
|
#include <drivers/core/dm.h>
|
|
#include <drivers/core/dm.h>
|
|
|
|
|
|
#include "../ofw/ofw_internal.h"
|
|
#include "../ofw/ofw_internal.h"
|
|
@@ -161,6 +162,7 @@ static rt_err_t platform_ofw_device_probe_once(struct rt_ofw_node *parent_np)
|
|
}
|
|
}
|
|
|
|
|
|
pdev->dev_id = ofw_alias_node_id(np);
|
|
pdev->dev_id = ofw_alias_node_id(np);
|
|
|
|
+ np->dev = &pdev->parent;
|
|
LOG_D("%s register to bus", np->full_name);
|
|
LOG_D("%s register to bus", np->full_name);
|
|
|
|
|
|
rt_platform_device_register(pdev);
|
|
rt_platform_device_register(pdev);
|
|
@@ -199,6 +201,53 @@ rt_err_t rt_platform_ofw_device_probe_child(struct rt_ofw_node *np)
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+rt_err_t rt_platform_ofw_request(struct rt_ofw_node *np)
|
|
|
|
+{
|
|
|
|
+ rt_err_t err;
|
|
|
|
+
|
|
|
|
+ if (np)
|
|
|
|
+ {
|
|
|
|
+ struct rt_device *dev = np->dev;
|
|
|
|
+
|
|
|
|
+ if (dev)
|
|
|
|
+ {
|
|
|
|
+ /* Was create */
|
|
|
|
+ if (dev->drv)
|
|
|
|
+ {
|
|
|
|
+ /* Was probe OK */
|
|
|
|
+ err = RT_EOK;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ err = rt_bus_reload_driver_device(dev->bus, dev);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ struct rt_platform_device *pdev = alloc_ofw_platform_device(np);
|
|
|
|
+
|
|
|
|
+ if (pdev)
|
|
|
|
+ {
|
|
|
|
+ pdev->dev_id = ofw_alias_node_id(np);
|
|
|
|
+ np->dev = &pdev->parent;
|
|
|
|
+ LOG_D("%s register to bus", np->full_name);
|
|
|
|
+
|
|
|
|
+ err = rt_platform_device_register(pdev);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ err = -RT_ENOMEM;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ err = -RT_EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return err;
|
|
|
|
+}
|
|
|
|
+
|
|
static int platform_ofw_device_probe(void)
|
|
static int platform_ofw_device_probe(void)
|
|
{
|
|
{
|
|
rt_err_t err = RT_EOK;
|
|
rt_err_t err = RT_EOK;
|