From 84d26e296ab62b172f73b5367d9b7295309dfdd5 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 12 Sep 2015 08:45:19 -0600 Subject: dm: core: Don't use pinctrl for the root device Currently when driver model starts up it finds the root uclass and the pinctrl uclass. This is because even the root node handles pinctrl processing. But this is not useful. The root node is not a real hardware device so cannot require any particular pinmux settings. Also it means that the memory leak tests fails, since they end up freeing more memory than they allocate: the marker it set after the root device and pinctrl uclass are allocated, and later once the pinctrl uclass is freed the memory used by driver model is less than when the marker was set. If a platform needs 'core' pin mulitplex settings it can do this with a driver that is probed on start-up. It would be an abuse of the root node to use this for pinctrl. To avoid this problem, only process pinctrl settings for non-root nodes. Signed-off-by: Simon Glass --- drivers/core/device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 0bc04d4876..833a803696 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -289,8 +289,12 @@ int device_probe_child(struct udevice *dev, void *parent_priv) dev->flags |= DM_FLAG_ACTIVATED; - /* continue regardless of the result of pinctrl */ - pinctrl_select_state(dev, "default"); + /* + * Process pinctrl for everything except the root device, and + * continue regardless of the result of pinctrl. + */ + if (dev->parent) + pinctrl_select_state(dev, "default"); ret = uclass_pre_probe_device(dev); if (ret) -- cgit v1.2.1 From cbfc2ff9da392d61cd456703ea6256996eb8beb1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 12 Sep 2015 08:45:20 -0600 Subject: dm: test: Show the amount of leaked memory on error Adjust the memory leak tests to show the amount of memory leaked. This can be a useful signal as to what is wrong. Signed-off-by: Simon Glass --- test/dm/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/dm/core.c b/test/dm/core.c index 976a70604f..9fbc70d3ed 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -77,7 +77,7 @@ void dm_leak_check_start(struct unit_test_state *uts) int dm_leak_check_end(struct unit_test_state *uts) { struct mallinfo end; - int id; + int id, diff; /* Don't delete the root class, since we started with that */ for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) { @@ -90,6 +90,11 @@ int dm_leak_check_end(struct unit_test_state *uts) } end = mallinfo(); + diff = end.uordblks - uts->start.uordblks; + if (diff > 0) + printf("Leak: lost %#xd bytes\n", diff); + else if (diff < 0) + printf("Leak: gained %#xd bytes\n", -diff); ut_asserteq(uts->start.uordblks, end.uordblks); return 0; -- cgit v1.2.1 From 7bb91dd109e2aff5f7f51aed44ac7890f9a4d158 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 3 Oct 2015 11:21:16 -0600 Subject: sandbox: Correct operaion of 'reset' command Currently 'reset' only works with the test device tree. When run without a device tree, or with the normal device tree, the following error is displayed: Reset not supported on this platform Fix the driver and the standard device tree to avoid this. Signed-off-by: Simon Glass Reported-by: Stephen Warren Tested-by: Stephen Warren --- arch/sandbox/dts/sandbox.dts | 4 ++++ drivers/misc/reset_sandbox.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 65b9125f5f..08f72aceda 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -153,6 +153,10 @@ }; }; + reset@1 { + compatible = "sandbox,reset"; + }; + spi@0 { #address-cells = <1>; #size-cells = <0>; diff --git a/drivers/misc/reset_sandbox.c b/drivers/misc/reset_sandbox.c index 917121bc5e..2691bb031a 100644 --- a/drivers/misc/reset_sandbox.c +++ b/drivers/misc/reset_sandbox.c @@ -40,7 +40,7 @@ static int sandbox_reset_request(struct udevice *dev, enum reset_t type) * (see the U_BOOT_DEVICE() declaration below) should not do anything. * If we are that device, return an error. */ - if (gd->fdt_blob && dev->of_offset == -1) + if (state->fdt_fname && dev->of_offset == -1) return -ENODEV; switch (type) { -- cgit v1.2.1