mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
dm: Don't allow U_BOOT_DEVICE() when of-platdata is used
With of-platdata, the devicetree is supposed to specify all the devices in the system. So far this hasn't really mattered since of-platdata still works correctly. However, new of-platdata features rely on numbering the devices in a particular order so that they can be referenced by a single integer. It is tricky to implement this efficiently when other devices are present in the build. To address this, disable use of U_BOOT_DEVICE() when of-platdata is enabled. This seems acceptable as it is not supposed to be used at all, except in SPL/TPL, where of-platdata is the recommended approach. This breaks one non-compliant boards at present: mx6cuboxi Signed-off-by: Simon Glass <sjg@chromium.org> (disable CONFIG_IMX_THERMAL for mx6cuboxi to avoid a build error)
This commit is contained in:
parent
4e28a259fd
commit
cb43ac184f
3 changed files with 14 additions and 0 deletions
|
@ -55,9 +55,17 @@ struct driver_rt {
|
|||
* NOTE: Avoid using these except in extreme circumstances, where device tree
|
||||
* is not feasible (e.g. serial driver in SPL where <8KB of SRAM is
|
||||
* available). U-Boot's driver model uses device tree for configuration.
|
||||
*
|
||||
* When of-platdata is in use, U_BOOT_DEVICE() cannot be used outside of the
|
||||
* dt-platdata.c file created by dtoc
|
||||
*/
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(DT_PLATDATA_C)
|
||||
#define U_BOOT_DEVICE(__name) _Static_assert(false, \
|
||||
"Cannot use U_BOOT_DEVICE with of-platdata. Please use devicetree instead")
|
||||
#else
|
||||
#define U_BOOT_DEVICE(__name) \
|
||||
ll_entry_declare(struct driver_info, __name, driver_info)
|
||||
#endif
|
||||
|
||||
/* Declare a list of devices. The argument is a driver_info[] array */
|
||||
#define U_BOOT_DEVICES(__name) \
|
||||
|
|
|
@ -673,6 +673,9 @@ class DtbPlatdata(object):
|
|||
information.
|
||||
"""
|
||||
self.out_header()
|
||||
self.out('/* Allow use of U_BOOT_DEVICE() in this file */\n')
|
||||
self.out('#define DT_PLATDATA_C\n')
|
||||
self.out('\n')
|
||||
self.out('#include <common.h>\n')
|
||||
self.out('#include <dm.h>\n')
|
||||
self.out('#include <dt-structs.h>\n')
|
||||
|
|
|
@ -44,6 +44,9 @@ C_HEADER = '''/*
|
|||
* This file was generated by dtoc from a .dtb (device tree binary) file.
|
||||
*/
|
||||
|
||||
/* Allow use of U_BOOT_DEVICE() in this file */
|
||||
#define DT_PLATDATA_C
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <dt-structs.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue