dm: fix comments

The struct udevice stands for a device, not a driver.
The driver_info.name is a driver's name, which is referenced
to bind devices.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: do not check the existence of uclass operation

The function uclass_add() checks uc_drv->ops as follows:

        if (uc_drv->ops) {
                dm_warn("No ops for uclass id %d\n", id);
                return -EINVAL;
        }

It seems odd because it warns "No ops" when uc_drv->ops has
non-NULL pointer.  (Looks opposite.)

Anyway, most of UCLASS_DRIVER entries have no .ops member.
This check makes no sense.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: simplify the loop in lists_driver_lookup_name()

if (strncmp(name, entry->name, len))
                continue;

        /* Full match */
        if (len == strlen(entry->name))
                return entry;

is equivalent to:

        if (!strcmp(name, entry->name))
                return entry;

The latter is simpler.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
linker_lists: include <linux/compiler.h>

The header file include/linker_lists.h uses __aligned();
therefore it depends on include/linux/compiler.h

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: include <linker_lists.h> from platdata.h and uclass.h

The header files include/dm/platdata.h and include/dm/uclass.h
use ll_entry_declare(); therefore they depend on
include/linker_lists.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: fix include guard

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: add of_match_ptr() macro

The driver model supports two ways for passing device parameters;
Device Tree and platform_data (board file).
Each driver should generally support both of them because some
popular IPs are used on various platforms.

Assume the following scenario:
  - The driver Foo is used on SoC Bar and SoC Baz
  - The SoC Bar uses Device Tree control (CONFIG_OF_CONTROL=y)
  - The SoC Baz does not support Device Tree; uses a board file

In this situation, the device driver Foo should work with/without
the device tree control.  The driver should have .of_match and
.ofdata_to_platdata members for SoC Bar, while they are meaningless
for SoC Baz; therefore those device-tree control code should go
inside #ifdef CONFIG_OF_CONTROL.

The driver code will be like this:

  #ifdef CONFIG_OF_CONTROL
  static const struct udevice_id foo_of_match = {
          { .compatible = "foo_driver" },
          {},
  }

  static int foo_ofdata_to_platdata(struct udevice *dev)
  {
          ...
  }
  #endif

  U_BOOT_DRIVER(foo_driver) = {
          ...
          .of_match = of_match_ptr(foo_of_match),
          .ofdata_to_platdata = of_match_ptr(foo_ofdata_to_platdata),
          ...
  }

This idea has been borrowed from Linux.
(In Linux, this macro is defined in include/linux/of.h)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
arm: goni: add i2c_init_board()

Add proper initialization of GPIO pins used by software i2c.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
dm: exynos: dts: Convert /include/ to #include

We should be consistent about this. The kernel has moved to #include
which breaks error reporting to some extent but does allow us to include
binding files.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Bring in pinctrl dts files from Linux kernel

Bring in required device tree files for pinctrl from Linux v3.14. These
are initially unchanged and have a number of pieces not needed by U-Boot.

Note that exynos5420 is renamed to exynos54xx here since we want to
support exynos5422 also.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: dts: Remove unused pinctrl information to save space

We don't include the pinctrl functions for U-Boot as they use up quite
a bit of space and are not used.

We could instead perhaps eliminate this material with fdtgrep, but so far
this tool has not made it to upstream.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: dts: Adjust device tree files for U-Boot

The pinctrl bindings used by Linux are an incomplete description of the
hardware. It is possible in most cases to determine the register address
of each, but not in all cases. By adding an additional property we can
fix this, and avoid adding a table to U-Boot for every single Exynos
SOC.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Add pinctrl settings for smdkc100

These describe the GPIOs in enough detail for U-Boot's GPIO driver to
operate.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Add pinctrl settings for s5p_goni

These describe the GPIOs in enough detail for U-Boot's GPIO driver to
operate.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Move smdkc100 to generic board

The generic board deadline is approaching, and we need this feature to
enable driver model. Enable CONFIG_SYS_GENERIC_BOARD for smdkc100.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Move s5p_goni to generic board

The generic board deadline is approaching, and we need this feature to
enable driver model. Enable CONFIG_SYS_GENERIC_BOARD for s5p_goni.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Tidy up GPIO headers

The wrong header is being included, thus requiring the code to re-declare
the generic GPIO interface in each GPIO header.

Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Tidy up GPIO defines

The defines at the top of the GPIO driver use single-character names for
parameters which are not very descriptive.

Improve these to use descriptive parameter names.

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: Make sure that GPIOs are requested

With driver model GPIOs must be requested before use. Make sure this is
done correctly.

(Note that the soft SPI part of universal is omitted, since this driver
is about to be replaced with a driver-model-aware version)

Signed-off-by: Simon Glass <sjg@chromium.org>
dm: exynos: gpio: Convert to driver model

Convert the exynos GPIO driver to driver model. This implements the generic
GPIO interface but not the extra Exynos-specific functions.

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