diff mbox

[U-Boot,10/10] pinctrl: Avoid binding all pinconfig nodes before relocation

Message ID 1451391772-6203-11-git-send-email-sjg@chromium.org
State Accepted
Commit 5589a8182957054f8ac4ec3d91492710e718e44d
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Dec. 29, 2015, 12:22 p.m. UTC
This can create a large number of pinctrl devices. It chews up early
malloc() memory and takes time. Only bind those which are marked as needed
before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/pinctrl/pinctrl-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass Jan. 16, 2016, 1:26 a.m. UTC | #1
On 29 December 2015 at 05:22, Simon Glass <sjg@chromium.org> wrote:
> This can create a large number of pinctrl devices. It chews up early
> malloc() memory and takes time. Only bind those which are marked as needed
> before relocation.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/pinctrl/pinctrl-uclass.c | 4 ++++
>  1 file changed, 4 insertions(+)

Applied to u-boot-dm!
diff mbox

Patch

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index b5fdcd1..c42b312 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -111,12 +111,16 @@  static int pinconfig_post_bind(struct udevice *dev)
 {
 	const void *fdt = gd->fdt_blob;
 	int offset = dev->of_offset;
+	bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC);
 	const char *name;
 	int ret;
 
 	for (offset = fdt_first_subnode(fdt, offset);
 	     offset > 0;
 	     offset = fdt_next_subnode(fdt, offset)) {
+		if (pre_reloc_only &&
+		    !fdt_getprop(fdt, offset, "u-boot,dm-pre-reloc", NULL))
+			continue;
 		/*
 		 * If this node has "compatible" property, this is not
 		 * a pin configuration node, but a normal device. skip.