summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-28 20:35:05 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:26:35 -0700
commitd960f0db289144a80553e4d226d5dd145d63926a (patch)
treebb23dec6d716a8c8bb1375f5d993aa9b90b193e3
parent9eca08dc5986c9e00bb68a4529ec9404a282bc57 (diff)
downloadu-boot-d960f0db289144a80553e4d226d5dd145d63926a.tar.gz
dtoc: Drop dm_populate_phandle_data()
This has not been needed since parent information was added and we started using indicies for references to other drivers instead of pointers. It was kept around in the expectation that it might be needed later. However with the latest updates, it doesn't seem likely that we'll need this in the foreseeable future. Drop dm_populate_phandle_data() from dtoc and driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--doc/driver-model/of-plat.rst16
-rw-r--r--drivers/core/root.c3
-rw-r--r--include/dm/platdata.h8
-rw-r--r--tools/dtoc/dtb_platdata.py6
-rwxr-xr-xtools/dtoc/test_dtoc.py29
5 files changed, 13 insertions, 49 deletions
diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst
index 78afbdbcc9..4ef2fe699a 100644
--- a/doc/driver-model/of-plat.rst
+++ b/doc/driver-model/of-plat.rst
@@ -162,9 +162,6 @@ and the following device declarations:
.parent_idx = -1,
};
- void dm_populate_phandle_data(void) {
- }
-
The device is then instantiated at run-time and the platform data can be
accessed using:
@@ -190,10 +187,7 @@ This macro produces no code, but it is by dtoc tool.
The parent_idx is the index of the parent driver_info structure within its
linker list (instantiated by the U_BOOT_DRVINFO() macro). This is used to support
-dev_get_parent(). The dm_populate_phandle_data() is included to allow for
-fix-ups required by dtoc. It is not currently used. The values in 'clocks' are
-the index of the driver_info for the target device followed by any phandle
-arguments. This is used to support device_get_by_driver_info_idx().
+dev_get_parent().
During the build process dtoc parses both U_BOOT_DRIVER and DM_DRIVER_ALIAS
to build a list of valid driver names and driver aliases. If the 'compatible'
@@ -337,9 +331,11 @@ prevents them being used inadvertently. All usage must be bracketed with
#if CONFIG_IS_ENABLED(OF_PLATDATA).
The dt-plat.c file contains the device declarations and is is built in
-spl/dt-plat.c. It additionally contains the definition of
-dm_populate_phandle_data() which is responsible of filling the phandle
-information by adding references to U_BOOT_DRVINFO by using DM_DRVINFO_GET
+spl/dt-plat.c.
+
+The dm_populate_phandle_data() function that was previous needed has now been
+removed, since dtoc can address the drivers directly from dt-plat.c and does
+not need to fix up things at runtime.
The pylibfdt Python module is used to access the devicetree.
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 3adbc94eb9..78de7cdf87 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -336,9 +336,6 @@ int dm_init_and_scan(bool pre_reloc_only)
{
int ret;
- if (CONFIG_IS_ENABLED(OF_PLATDATA))
- dm_populate_phandle_data();
-
ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
if (ret) {
debug("dm_init() failed: %d\n", ret);
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index dc3cbfcbc7..3821a56f2c 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -86,12 +86,4 @@ struct driver_rt {
#define DM_DRVINFO_GET(__name) \
ll_entry_get(struct driver_info, __name, driver_info)
-/**
- * dm_populate_phandle_data() - Populates phandle data in platda
- *
- * This populates phandle data with an U_BOOT_DRVINFO entry get by
- * DM_DRVINFO_GET. The implementation of this function will be done
- * by dtoc when parsing dtb.
- */
-void dm_populate_phandle_data(void);
#endif
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 4cdbd60c9a..f1c09d629f 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -802,12 +802,6 @@ class DtbPlatdata():
for node in self._valid_nodes:
self.output_node(node)
- # Define dm_populate_phandle_data() which will add the linking between
- # nodes using DM_DRVINFO_GET
- # dtv_dmc_at_xxx.clocks[0].node = DM_DRVINFO_GET(clock_controller_at_xxx)
- self.buf('void dm_populate_phandle_data(void) {\n')
- self.buf('}\n')
-
self.out(''.join(self.get_buf()))
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index f17d2e4b45..bcbf58c45b 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -56,10 +56,6 @@ C_HEADER = '''/*
#include <dt-structs.h>
'''
-C_EMPTY_POPULATE_PHANDLE_DATA = '''void dm_populate_phandle_data(void) {
-}
-'''
-
# This is a test so is allowed to access private things in the module it is
# testing
# pylint: disable=W0212
@@ -190,8 +186,7 @@ class TestDtoc(unittest.TestCase):
self.run_test(['platdata'], dtb_file, output)
with open(output) as infile:
lines = infile.read().splitlines()
- self.assertEqual(C_HEADER.splitlines() + [''] +
- C_EMPTY_POPULATE_PHANDLE_DATA.splitlines(), lines)
+ self.assertEqual(C_HEADER.splitlines() + [''], lines)
struct_text = HEADER + '''
struct dtd_sandbox_i2c_test {
@@ -289,7 +284,7 @@ U_BOOT_DRVINFO(spl_test3) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA
+'''
def test_simple(self):
"""Test output from some simple nodes with various types of data"""
@@ -344,8 +339,6 @@ U_BOOT_DRVINFO(gpios_at_0) = {
\t.parent_idx\t= -1,
};
-void dm_populate_phandle_data(void) {
-}
''', data)
def test_invalid_driver(self):
@@ -376,8 +369,6 @@ U_BOOT_DRVINFO(spl_test) = {
\t.parent_idx\t= -1,
};
-void dm_populate_phandle_data(void) {
-}
''', data)
def test_phandle(self):
@@ -460,8 +451,6 @@ U_BOOT_DRVINFO(phandle_target) = {
\t.parent_idx\t= -1,
};
-void dm_populate_phandle_data(void) {
-}
''', data)
def test_phandle_single(self):
@@ -510,8 +499,6 @@ U_BOOT_DRVINFO(phandle_target) = {
\t.parent_idx\t= -1,
};
-void dm_populate_phandle_data(void) {
-}
''', data)
def test_phandle_cd_gpio(self):
@@ -582,8 +569,6 @@ U_BOOT_DRVINFO(phandle_target) = {
\t.parent_idx\t= -1,
};
-void dm_populate_phandle_data(void) {
-}
''', data)
def test_phandle_bad(self):
@@ -662,7 +647,7 @@ U_BOOT_DRVINFO(test3) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA, data)
+''', data)
def test_addresses32(self):
"""Test output from a node with a 'reg' property with na=1, ns=1"""
@@ -706,7 +691,7 @@ U_BOOT_DRVINFO(test2) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA, data)
+''', data)
def test_addresses64_32(self):
"""Test output from a node with a 'reg' property with na=2, ns=1"""
@@ -764,7 +749,7 @@ U_BOOT_DRVINFO(test3) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA, data)
+''', data)
def test_addresses32_64(self):
"""Test output from a node with a 'reg' property with na=1, ns=2"""
@@ -822,7 +807,7 @@ U_BOOT_DRVINFO(test3) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA, data)
+''', data)
def test_bad_reg(self):
"""Test that a reg property with an invalid type generates an error"""
@@ -885,7 +870,7 @@ U_BOOT_DRVINFO(spl_test2) = {
\t.parent_idx\t= -1,
};
-''' + C_EMPTY_POPULATE_PHANDLE_DATA, data)
+''', data)
def test_stdout(self):
"""Test output to stdout"""