Add a utility function to create the pinctrl groups in the DT

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Add pinctrl parsing and registration for the UART

This way, the pin muxing should be properly set, thanks to the data provided by
fex.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Move the bootargs manipulation to a function of its own

That will allow to extend the bootargs from several functions instead of
centralizing anything we could do into one huge single function.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Add ATAGS parsing function

This will allow to pass the memory size, initrd addresses and bootargs to Linux
through the device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Import FDT utility functions

Import a few functions from u-boot to manipulate phandles

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Move the pinctrl allocation function to fdt_tools

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Fix phandle lookup

The fdt_get_phandle function actually doesn't allocate a new one, but actually
retrieve the value of the 'phandle' property in the given node, which is not
really what we were using it for. Switch to fdt_create_phandle that does the
right thing.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Add missing fdt offset lookup

After the call to fdt_create_phandle, a new property might have been added, and
thus the offset of the parent node might have changed. Call fdt_path_offset to
lookup the possibly new offset before actually using it again.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Defaults pull and drive properties to 0

We might end up with values that are not the correct values, or the one
expected by the pinctrl binding. Sanitize the input by defaulting these values
unless we have sensible input.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Fix a port number off-by-one error

The port number is actually indexed starting from 1 instead of 0 like assumed.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>