dm: core: remove unnecessary return condition in driver lookup

The variable "drv" never becomes NULL because ll_entry_start()
always returns a valid pointer even if there are no entries.

The case "n_ents == 0" is covered by the following "for" loop.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
dm: core: remove unnecessary return condition in uclass lookup

These conditions never happen.
 - There is no real uclass with UCLASS_INVALID id.
 - uclass never becomes NULL because ll_entry_start() always returns
   a valid pointer.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
dm: core: refactor linker lists lookup code

It looks simpler to use ll_entry_end() than ll_entry_count().
We can save one variable.  (and it will be helpful for the upcoming
commit.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
dm: core: look up drivers more efficiently

The DM initialization function, dm_init_and_scan() is called twice,
before and after relocation.

In the first DM scan, only some of drivers are bound for the use in
pre-reloc code (mostly UART drivers).  In the second scan, all the
drivers are bound.

In the current implementation, all the drivers are collected into a
single array.  Every driver is searched through the array and then
the DM_FLAG_PRE_RELOC flag is checked.  In the pre-reloc DM scan,
drivers without DM_FLAG_PRE_RELOC are ignored.  This algorithm works
enough, but is not very efficient.

This commit aims to split drivers into two contiguous arrays,
pre-reloc drivers and post-reloc drivers.  The drivers in the former
group are declared with U_BOOT_DRIVER_F.  The others are declared with
U_BOOT_DRIVER.
                                                    pre      post
                            _____________________  reloc     reloc
  .u_boot_list_2_driver1_1  |                   |    ||       ||
                            |                   |    ||       ||
                            |                   |    ||       ||
                            |  U_BOOT_DRIVER_F  |    ||       ||
                            |     (driver1)     |   _||_      ||
                            |                   |   \  /      ||
  .u_boot_list_2_driver1_3  |___________________|    \/       ||
  .u_boot_list_2_driver2_1  |                   |             ||
                            |                   |             ||
                            |                   |             ||
                            |   U_BOOT_DRIVER   |             ||
                            |     (driver2)     |            _||_
                            |                   |            \  /
  .u_boot_list_2_driver2_3  |___________________|             \/

The pre-reloc DM scan searches drivers from .u_boot_list_2_driver1_1
to .u_boot_list_2_driver1_3.  The post-reloc scan searches ones from
.u_boot_list_2_driver1_1 and .u_boot_list_2_driver2_3.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
dm: core: declare pre-reloc drivers with U_BOOT_DRIVER_F

Replace U_BOOT_DRIVER with U_BOOT_DRIVER_F where the DM_FLAG_PRE_RELOC
flag is set.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
dm: core: abolish u-boot,dm-pre-reloc property

The driver model supports two ways to provide the device information,
platform data and device tree.  Either way works to bind devices and
drivers, but there is unconsistency in terms of

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>