Initial implementation invokes device_bind_with_driver_data()
with driver_data parameter equal to 0.
For driver with driver data, the bind command can't bind
correctly this driver or even worse causes data abort as shown below:
As example, for debug purpose on STM32MP1 platform, ethernet
(dwc_eth_qos.c) driver needed to be unbinded/binded.
This driver is using driver data:
static const struct udevice_id eqos_ids[] = {
{
.compatible = "nvidia,tegra186-eqos",
.data = (ulong)&eqos_tegra186_config
},
{
.compatible = "snps,dwmac-4.20a",
.data = (ulong)&eqos_stm32_config
},
{ }
};
After unbinding/binding this driver and probing it (with the dhcp command),
we got a prefetch abort as below:
STM32MP> unbind eth ethernet@
5800a000
STM32MP> bind /soc/ethernet@
5800a000 eth_eqos
STM32MP> dhcp
prefetch abort
pc : [<
4310801c>] lr : [<
ffc8f4ad>]
reloc pc : [<
035ba01c>] lr : [<
c01414ad>]
sp :
fdaf19b0 ip :
ffcea83c fp :
00000001
r10:
ffcfd4a0 r9 :
fdaffed0 r8 :
00000000
r7 :
ffcff304 r6 :
fdc63220 r5 :
00000000 r4 :
fdc5b108
r3 :
43108020 r2 :
00003d39 r1 :
ffcea544 r0 :
fdc63220
Flags: nZCv IRQs off FIQs off Mode SVC_32
Code: data abort
pc : [<
ffc4f9c0>] lr : [<
ffc4f9ad>]
reloc pc : [<
c01019c0>] lr : [<
c01019ad>]
sp :
fdaf18b8 ip :
00000000 fp :
00000001
r10:
ffcd69b2 r9 :
fdaffed0 r8 :
ffcd69aa
r7 :
00000000 r6 :
00000008 r5 :
4310801c r4 :
fffffffc
r3 :
00000001 r2 :
00000028 r1 :
00000000 r0 :
00000006
Flags: NzCv IRQs on FIQs on Mode SVC_32 (T)
Code: 2f00 d1e9 2c00 dce9 (f855) 2024
Resetting CPU ...
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
#include <dm.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
+#include <dm/root.h>
#include <dm/uclass-internal.h>
static int bind_by_class_index(const char *uclass, int index,
}
ofnode = ofnode_path(path);
- ret = device_bind_with_driver_data(parent, drv, ofnode_get_name(ofnode),
- 0, ofnode, &dev);
+ ret = lists_bind_fdt(parent, ofnode, &dev, false);
+
if (!dev || ret) {
printf("Unable to bind. err:%d\n", ret);
return ret;