dm: Preparation for enhanced of-platdata (part B)
Subsystems (11)
cover dm: Preparation for enhanced of-platdata (part B)
This series includes some refactoring of the dtoc tool and some changes to a few drivers (particularly on x86) to reduce TPL size.
It is available at u-boot-dm/prep-working
Simon Glass (20):
pinctrl: Drop post_bind() method when not needed
sysreset: Use a shorter error with SPL
arc: m68k: nds32: nios2: sh: xtensa: Add empty spl.h header
timer: Use a shorter error in TPL
test: Use a simple variable to record removed device
test: Move some test drivers into their own file
dtoc: Make _output_list a top-level function
dtoc: Output the device in a separate function
dtoc: Output the struct values in a separate function
dtoc: Convert _drivers to a dict
dtoc: Scan drivers for available information
dtoc: Allow use of the of_match_ptr() macro
x86: apl: Use const for driver operations
x86: Move call64 into its own section
x86: coral: Move fsp-m settings to a subnode
x86: apl: Update hostbridge to remove unwanted TPL code
x86: apl: Reduce size for TPL
x86: pinctrl: Drop unlikely error messages from TPL
x86: tpl: Remove unwanted devicetree string
x86: Fix header gaurd in asm/pmu.h
arch/arc/include/asm/spl.h | 0 arch/m68k/include/asm/spl.h | 0 arch/nds32/include/asm/spl.h | 0 arch/nios2/include/asm/spl.h | 0 arch/sh/include/asm/spl.h | 0 arch/x86/cpu/apollolake/fsp_m.c | 5 +- arch/x86/cpu/apollolake/hostbridge.c | 14 +- arch/x86/cpu/apollolake/lpc.c | 13 +- arch/x86/cpu/apollolake/pch.c | 4 +- arch/x86/cpu/apollolake/pmc.c | 6 +- arch/x86/cpu/apollolake/uart.c | 4 +- arch/x86/cpu/i386/call64.S | 1 + arch/x86/cpu/intel_common/Makefile | 2 +- arch/x86/cpu/intel_common/itss.c | 4 +- arch/x86/cpu/intel_common/p2sb.c | 6 +- arch/x86/cpu/turbo.c | 5 + arch/x86/dts/chromebook_coral.dts | 5 + arch/x86/include/asm/pmu.h | 6 +- arch/x86/lib/tpl.c | 4 +- arch/xtensa/include/asm/spl.h | 0 board/google/chromebook_coral/coral.c | 4 +- drivers/gpio/intel_gpio.c | 4 +- drivers/misc/Kconfig | 9 + drivers/misc/Makefile | 1 + drivers/misc/test_drv.c | 230 ++++++++++++++++ drivers/pinctrl/intel/pinctrl.c | 11 +- drivers/pinctrl/intel/pinctrl_apl.c | 4 +- drivers/pinctrl/pinctrl-uclass.c | 4 +- drivers/power/acpi_pmc/acpi-pmc-uclass.c | 4 +- drivers/sysreset/sysreset-uclass.c | 12 +- drivers/timer/tsc_timer.c | 4 +- include/dm/test.h | 20 +- include/test/test.h | 9 + lib/time.c | 10 +- test/dm/bus.c | 107 +------- test/dm/test-fdt.c | 120 -------- tools/dtoc/dtb_platdata.py | 336 ++++++++++++++++++----- 37 files changed, 634 insertions(+), 334 deletions(-) create mode 100644 arch/arc/include/asm/spl.h create mode 100644 arch/m68k/include/asm/spl.h create mode 100644 arch/nds32/include/asm/spl.h create mode 100644 arch/nios2/include/asm/spl.h create mode 100644 arch/sh/include/asm/spl.h create mode 100644 arch/xtensa/include/asm/spl.h create mode 100644 drivers/misc/test_drv.c
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 1/20 pinctrl: Drop post_bind() method when not needed
This is not used with of-platdata, so remove it in that case.
---
drivers/pinctrl/pinctrl-uclass.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-uclass.c +3 -1
@@ -305,7 +305,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename)* Some device which is logical like mmc.blk, do not have * a valid ofnode. */ -if (!ofnode_valid (dev->node)) +if (!dev_has_of_node (dev))return 0 ;/* * Try full-implemented pinctrl first.
@@ -416,7 +416,9 @@ static int __maybe_unused pinctrl_post_bind(struct udevice *dev)UCLASS_DRIVER (pinctrl) = { .id =UCLASS_PINCTRL , +#if !CONFIG_IS_ENABLED(OF_PLATDATA) .post_bind = pinctrl_post_bind, +#endif .flags =DM_UC_FLAG_SEQ_ALIAS , .name ="pinctrl" , };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 2/20 sysreset: Use a shorter error with SPL
In reply to Simon GlassUse a minimal error message to save space. Sort the header files while we are here.
---
drivers/sysreset/sysreset-uclass.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/sysreset/sysreset-uclass.c +8 -4
@@ -9,12 +9,13 @@#include <common.h> #include <command.h> #include <cpu_func.h> -#include <hang.h> -#include <log.h> -#include <sysreset.h> #include <dm.h> #include <errno.h> +#include <hang.h> +#include <log.h> #include <regmap.h> +#include <spl.h> +#include <sysreset.h> #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/root.h>
@@ -101,7 +102,10 @@ void sysreset_walk_halt(enum sysreset_t type)mdelay (100 );/* Still no reset? Give up */ -log_err ("System reset not supported on this platform\n" ); +if (spl_phase () <=PHASE_SPL ) +log_err ("no sysreset\n" ); +else +log_err ("System reset not supported on this platform\n" );hang (); }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 3/20 arc: m68k: nds32: nios2: sh: xtensa: Add empty spl.h header
In reply to Simon GlassAt present it is not possible to include spl.h in on these architectures since the asm/spl.h file is not present. We want to be able to use the spl_phase() function, so add empty headers to make things build.
---
arch/arc/include/asm/spl.h | 0 arch/m68k/include/asm/spl.h | 0 arch/nds32/include/asm/spl.h | 0 arch/nios2/include/asm/spl.h | 0 arch/sh/include/asm/spl.h | 0 arch/xtensa/include/asm/spl.h | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 arch/arc/include/asm/spl.h create mode 100644 arch/m68k/include/asm/spl.h create mode 100644 arch/nds32/include/asm/spl.h create mode 100644 arch/nios2/include/asm/spl.h create mode 100644 arch/sh/include/asm/spl.h create mode 100644 arch/xtensa/include/asm/spl.h
arch/arc/include/asm/spl.h new file +0 -0
arch/m68k/include/asm/spl.h new file +0 -0
arch/nds32/include/asm/spl.h new file +0 -0
arch/nios2/include/asm/spl.h new file +0 -0
arch/sh/include/asm/spl.h new file +0 -0
arch/xtensa/include/asm/spl.h new file +0 -0
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 4/20 timer: Use a shorter error in TPL
In reply to Simon GlassThis error should not happen in normal use. Reduce the length of it to save space in the image.
Add an empty spl.h file to sh since it appears to lack this.
---
lib/time.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
lib/time.c +8 -2
@@ -9,6 +9,7 @@#include <dm.h> #include <errno.h> #include <init.h> +#include <spl.h> #include <time.h> #include <timer.h> #include <watchdog.h>
@@ -96,8 +97,13 @@ uint64_t notrace get_ticks(void) } ret =timer_get_count (gd->timer, &count); -if (ret) -panic ("Could not read count from timer (err %d)\n" , ret); +if (ret) { +if (spl_phase () >PHASE_TPL ) +panic ("Could not read count from timer (err %d)\n" , + ret); +else +panic ("no timer (err %d)\n" , ret); + }return count; }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 5/20 test: Use a simple variable to record removed device
In reply to Simon GlassAt present the entire test state is effective passed into a test driver just to record which device was removed. This is unnecessary and makes it harder to track what is going on.
Use a simple boolean instead.
Also drop the unused 'removed' member while we are here.
---
include/dm/test.h | 2 -- test/dm/bus.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-)
include/dm/test.h +0 -2
@@ -134,14 +134,12 @@ extern struct unit_test_state global_dm_test_state;* @testdev: Test device * @force_fail_alloc: Force all memory allocs to fail * @skip_post_probe: Skip uclass post-probe processing -* @removed: Used to keep track of a device that was removed */ struct dm_test_state {struct udevice *root;struct udevice *testdev;int force_fail_alloc;int skip_post_probe; -struct udevice *removed; };/* Declare a new driver model test */
test/dm/bus.c +6 -8
@@ -30,7 +30,8 @@ enum { FLAG_CHILD_REMOVED = -7, }; -static struct dm_test_state *test_state; +/* Records the last testbus device that was removed */ +static struct udevice *testbus_removed;static int testbus_drv_probe (struct udevice *dev) {
@@ -78,11 +79,9 @@ static int testbus_child_post_probe_uclass(struct udevice *dev)static int testbus_child_post_remove (struct udevice *dev) {struct dm_test_parent_data *parent_data =dev_get_parent_priv (dev); -struct dm_test_state *dms = test_state; parent_data->flag +=FLAG_CHILD_REMOVED ; -if (dms) - dms->removed = dev; + testbus_removed = dev;return 0 ; }
@@ -335,11 +334,10 @@ DM_TEST(dm_test_bus_parent_data_uclass,static int dm_test_bus_parent_ops (struct unit_test_state *uts) {struct dm_test_parent_data *parent_data; -struct dm_test_state *dms = uts->priv;struct udevice *bus, *dev;struct uclass *uc; - test_state = dms; + testbus_removed =NULL ;ut_assertok (uclass_get_device (UCLASS_TEST_BUS ,0 , &bus));ut_assertok (uclass_get (UCLASS_TEST_FDT , &uc));
@@ -362,9 +360,9 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts)ut_asserteq (FLAG_CHILD_PROBED , parent_data->flag);ut_assertok (device_remove (dev,DM_REMOVE_NORMAL ));ut_asserteq_ptr (NULL ,dev_get_parent_priv (dev)); -ut_asserteq_ptr (dms->removed, dev); +ut_asserteq_ptr (testbus_removed, dev); } - test_state =NULL ; + testbus_removed =NULL ;return 0 ; }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 6/20 test: Move some test drivers into their own file
In reply to Simon GlassAt present several test drivers are part of the test file itself. Some of these are useful for of-platdata tests. Separate them out so we can use them for other things also.
A few adjustments are needed so this driver can build for sandbox_spl as well.
---
drivers/misc/Kconfig | 9 ++ drivers/misc/Makefile | 1 + drivers/misc/test_drv.c | 230 ++++++++++++++++++++++++++++++++++++++++ include/dm/test.h | 18 ++++ include/test/test.h | 9 ++ test/dm/bus.c | 105 +----------------- test/dm/test-fdt.c | 120 --------------------- 7 files changed, 271 insertions(+), 221 deletions(-) create mode 100644 drivers/misc/test_drv.c
drivers/misc/Kconfig +9 -0
@@ -343,6 +343,15 @@ config TEGRA186_BPMP can make requests to the BPMP. This driver is similar to an MFD driver in the Linux kernel. +config TEST_DRV + bool "Enable support for test drivers" + default y if SANDBOX + help + This enables drivers and uclasses that provides a way of testing the + operations of memory allocation and driver/uclass methods in driver + model. This should only be enabled for testing as it is not useful for + anything else. + config TWL4030_LED bool "Enable TWL4030 LED controller" help
drivers/misc/Makefile +1 -0
@@ -67,6 +67,7 @@ obj-$(CONFIG_STM32_RCC) += stm32_rcc.o obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o obj-$(CONFIG_TEGRA_CAR) += tegra_car.o +obj-$(CONFIG_TEST_DRV) += test_drv.o obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
drivers/misc/test_drv.c new file +230 -0
230 lines not on this page · raw message
include/dm/test.h +18 -0
@@ -167,6 +167,24 @@ struct sandbox_sdl_plat {int font_size; }; +/** +* struct dm_test_parent_plat - Used to track state in bus tests +* +* @count: +* @bind_flag: Indicates that the child post-bind method was called +* @uclass_bind_flag: Also indicates that the child post-bind method was called +*/ +struct dm_test_parent_plat { +int count; +int bind_flag; +int uclass_bind_flag; +}; + +enum { +TEST_FLAG_CHILD_PROBED =10 , +TEST_FLAG_CHILD_REMOVED =-7 , +}; +/* Declare ping methods for the drivers */ int test_ping (struct udevice *dev,int pingval,int *pingret);int testfdt_ping (struct udevice *dev,int pingval,int *pingret);
include/test/test.h +9 -0
@@ -94,6 +94,15 @@ enum { TEST_DEVRES_SIZE3 = 37, }; +/** +* testbus_get_clear_removed() - Test function to obtain removed device +* +* This is used in testbus to find out which device was removed. Calling this +* function returns a pointer to the device and then clears it back to NULL, so +* that a future test can check it. +*/ +struct udevice *testbus_get_clear_removed (void ); +/** * dm_test_main() - Run driver model tests *
test/dm/bus.c +4 -101
132 lines not on this page · raw message
test/dm/test-fdt.c +0 -120
126 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 7/20 dtoc: Make _output_list a top-level function
In reply to Simon GlassIt is annoying to have this function inside its parent since it makes the parent longer and hard to read. Move it to the top level.
---
tools/dtoc/dtb_platdata.py | 80 +++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-)
tools/dtoc/dtb_platdata.py +40 -40
@@ -591,51 +591,51 @@ class DtbPlatdata(object): self.out(';\n') self.out('};\n') + def _output_list(self, node, prop): + """Output the C code for a devicetree property that holds a list + + Args: + node (fdt.Node): Node to output + prop (fdt.Prop): Prop to output + """ + self.buf('{') + vals = [] + # For phandles, output a reference to the platform data + # of the target node. + info = self.get_phandle_argc(prop, node.name) + if info: + # Process the list as pairs of (phandle, id) + pos = 0 + for args in info.args: + phandle_cell = prop.value[pos] + phandle = fdt_util.fdt32_to_cpu(phandle_cell) + target_node = self._fdt.phandle_to_node[phandle] + arg_values = [] + for i in range(args): + arg_values.append( + str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) + pos += 1 + args + vals.append('\t{%d, {%s}}' % (target_node.idx, + ', '.join(arg_values))) + for val in vals: + self.buf('\n\t\t%s,' % val) + else: + for val in prop.value: + vals.append(get_value(prop.type, val)) + + # Put 8 values per line to avoid very long lines. + for i in range(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) + self.buf('}') + def output_node(self, node): """Output the C code for a node Args: node (fdt.Node): node to output """ - def _output_list(node, prop): - """Output the C code for a devicetree property that holds a list - - Args: - node (fdt.Node): Node to output - prop (fdt.Prop): Prop to output - """ - self.buf('{') - vals = [] - # For phandles, output a reference to the platform data - # of the target node. - info = self.get_phandle_argc(prop, node.name) - if info: - # Process the list as pairs of (phandle, id) - pos = 0 - for args in info.args: - phandle_cell = prop.value[pos] - phandle = fdt_util.fdt32_to_cpu(phandle_cell) - target_node = self._fdt.phandle_to_node[phandle] - arg_values = [] - for i in range(args): - arg_values.append( - str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) - pos += 1 + args - vals.append('\t{%d, {%s}}' % (target_node.idx, - ', '.join(arg_values))) - for val in vals: - self.buf('\n\t\t%s,' % val) - else: - for val in prop.value: - vals.append(get_value(prop.type, val)) - - # Put 8 values per line to avoid very long lines. - for i in range(0, len(vals), 8): - if i: - self.buf(',\n\t\t') - self.buf(', '.join(vals[i:i + 8])) - self.buf('}') - struct_name, _ = self.get_normalized_compat_name(node) var_name = conv_name_to_c(node.name) self.buf('/* Node %s index %d */\n' % (node.path, node.idx))
@@ -650,7 +650,7 @@ class DtbPlatdata(object): # Special handling for lists if isinstance(prop.value, list): - _output_list(node, prop) + self._output_list(node, prop) else: self.buf(get_value(prop.type, prop.value)) self.buf(',\n')
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 8/20 dtoc: Output the device in a separate function
In reply to Simon GlassReduce the length of output_node() by moving the device-output functionality into a separate function.
---
tools/dtoc/dtb_platdata.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
tools/dtoc/dtb_platdata.py +22 -11
@@ -630,6 +630,27 @@ class DtbPlatdata(object): self.buf(', '.join(vals[i:i + 8])) self.buf('}') + def _declare_device(self, var_name, struct_name, node_parent): + """Add a device declaration to the output + + This declares a U_BOOT_DEVICE() for the device being processed + + Args: + var_name: C name for the node + struct_name: Name for the dt struct associated with the node + node_parent: Parent of the node (or None if none) + """ + self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name) + self.buf('\t.name\t\t= "%s",\n' % struct_name) + self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name)) + self.buf('\t.plat_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name)) + idx = -1 + if node_parent and node_parent in self._valid_nodes: + idx = node_parent.idx + self.buf('\t.parent_idx\t= %d,\n' % idx) + self.buf('};\n') + self.buf('\n') + def output_node(self, node): """Output the C code for a node
@@ -656,17 +677,7 @@ class DtbPlatdata(object): self.buf(',\n') self.buf('};\n') - # Add a device declaration - self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name) - self.buf('\t.name\t\t= "%s",\n' % struct_name) - self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name)) - self.buf('\t.plat_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name)) - idx = -1 - if node.parent and node.parent in self._valid_nodes: - idx = node.parent.idx - self.buf('\t.parent_idx\t= %d,\n' % idx) - self.buf('};\n') - self.buf('\n') + self._declare_device(var_name, struct_name, node.parent) self.out(''.join(self.get_buf()))
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 9/20 dtoc: Output the struct values in a separate function
In reply to Simon GlassReduce the length of output_node() futher by moving the struct-output functionality into a two separate functions.
---
tools/dtoc/dtb_platdata.py | 50 ++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 16 deletions(-)
tools/dtoc/dtb_platdata.py +34 -16
@@ -651,6 +651,39 @@ class DtbPlatdata(object): self.buf('};\n') self.buf('\n') + def _output_prop(self, node, prop): + """Output a line containing the value of a struct member + + Args: + node: Node being output + prop: Prop object to output + """ + if prop.name in PROP_IGNORE_LIST or prop.name[0] == '#': + return + member_name = conv_name_to_c(prop.name) + self.buf('\t%s= ' % tab_to(3, '.' + member_name)) + + # Special handling for lists + if isinstance(prop.value, list): + self._output_list(node, prop) + else: + self.buf(get_value(prop.type, prop.value)) + self.buf(',\n') + + def _output_values(self, var_name, struct_name, node): + """Output the definition of a device's struct values + + Args: + var_name: C name for the node + struct_name: Name for the dt struct associated with the node + node: Node being output + """ + self.buf('static struct %s%s %s%s = {\n' % + (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) + for pname in sorted(node.props): + self._output_prop(node, node.props[pname]) + self.buf('};\n') + def output_node(self, node): """Output the C code for a node
@@ -660,23 +693,8 @@ class DtbPlatdata(object): struct_name, _ = self.get_normalized_compat_name(node) var_name = conv_name_to_c(node.name) self.buf('/* Node %s index %d */\n' % (node.path, node.idx)) - self.buf('static struct %s%s %s%s = {\n' % - (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) - for pname in sorted(node.props): - prop = node.props[pname] - if pname in PROP_IGNORE_LIST or pname[0] == '#': - continue - member_name = conv_name_to_c(prop.name) - self.buf('\t%s= ' % tab_to(3, '.' + member_name)) - - # Special handling for lists - if isinstance(prop.value, list): - self._output_list(node, prop) - else: - self.buf(get_value(prop.type, prop.value)) - self.buf(',\n') - self.buf('};\n') + self._output_values(var_name, struct_name, node) self._declare_device(var_name, struct_name, node.parent) self.out(''.join(self.get_buf()))
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 10/20 dtoc: Convert _drivers to a dict
In reply to Simon GlassAt present this member holds a simple list of driver names. Update it to be a dict of DriverInfo, with the name being the key. This will allow more information to be added about each driver, in future patches.
---
tools/dtoc/dtb_platdata.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
tools/dtoc/dtb_platdata.py +17 -4
@@ -64,6 +64,17 @@ PhandleInfo = collections.namedtuple('PhandleInfo', ['max_args', 'args']) PhandleLink = collections.namedtuple('PhandleLink', ['var_node', 'dev_name']) +class DriverInfo: + def __init__(self, name): + self.name = name + + def __eq__(self, other): + return self.name == other.name + + def __repr__(self): + return ("DriverInfo(name='%s')" % self.name) + + def conv_name_to_c(name): """Convert a device-tree name to a C identifier
@@ -155,7 +166,9 @@ class DtbPlatdata(object): _outfile: The current output file (sys.stdout or a real file) _warning_disabled: true to disable warnings about driver names not found _lines: Stashed list of output lines for outputting in the future - _drivers: List of valid driver names found in drivers/ + _drivers: Dict of valid driver names found in drivers/ + key: Driver name + value: DriverInfo for that driver _driver_aliases: Dict that holds aliases for driver names key: Driver alias declared with U_BOOT_DRIVER_ALIAS(driver_alias, driver_name)
@@ -171,7 +184,7 @@ class DtbPlatdata(object): self._outfile = None self._warning_disabled = warning_disabled self._lines = [] - self._drivers = [] + self._drivers = {} self._driver_aliases = {} self._drivers_additional = drivers_additional or []
@@ -195,7 +208,7 @@ class DtbPlatdata(object): compat_list_c = get_compat_name(node) for compat_c in compat_list_c: - if not compat_c in self._drivers: + if not compat_c in self._drivers.keys(): compat_c = self._driver_aliases.get(compat_c) if not compat_c: continue
@@ -333,7 +346,7 @@ class DtbPlatdata(object): drivers = re.findall('U_BOOT_DRIVER\((.*)\)', buff) for driver in drivers: - self._drivers.append(driver) + self._drivers[driver] = DriverInfo(driver) # The following re will search for driver aliases declared as # U_BOOT_DRIVER_ALIAS(alias, driver_name)
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 11/20 dtoc: Scan drivers for available information
In reply to Simon GlassAt present we simply record the name of a driver parsed from its implementation file. We also need to get the uclass and a few other things so we can instantiate devices at build time. Add support for collecting this information. This requires parsing each driver file.
---
tools/dtoc/dtb_platdata.py | 171 ++++++++++++++++++++++++++++++++++--- 1 file changed, 161 insertions(+), 10 deletions(-)
tools/dtoc/dtb_platdata.py +161 -10
@@ -65,14 +65,21 @@ PhandleLink = collections.namedtuple('PhandleLink', ['var_node', 'dev_name']) class DriverInfo: - def __init__(self, name): + def __init__(self, name, uclass_id, compat): self.name = name + self.uclass_id = uclass_id + self.compat = compat + self.priv_size = 0 def __eq__(self, other): - return self.name == other.name + return (self.name == other.name and + self.uclass_id == other.uclass_id and + self.compat == other.compat and + self.priv_size == other.priv_size) def __repr__(self): - return ("DriverInfo(name='%s')" % self.name) + return ("DriverInfo(name='%s', uclass_id='%s', compat=%s, priv_size=%s)" % + (self.name, self.uclass_id, self.compat, self.priv_size)) def conv_name_to_c(name):
@@ -174,6 +181,12 @@ class DtbPlatdata(object): U_BOOT_DRIVER_ALIAS(driver_alias, driver_name) value: Driver name declared with U_BOOT_DRIVER(driver_name) _drivers_additional: List of additional drivers to use during scanning + _of_match: Dict holding information about compatible strings + key: Name of struct udevice_id variable + value: Dict of compatible info in that variable: + key: Compatible string, e.g. 'rockchip,rk3288-grf' + value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + _compat_to_driver: Maps compatible strings to DriverInfo """ def __init__(self, dtb_fname, include_disabled, warning_disabled, drivers_additional=None):
@@ -187,6 +200,8 @@ class DtbPlatdata(object): self._drivers = {} self._driver_aliases = {} self._drivers_additional = drivers_additional or [] + self._of_match = {} + self._compat_to_driver = {} def get_normalized_compat_name(self, node): """Get a node's normalized compat name
@@ -325,10 +340,148 @@ class DtbPlatdata(object): return PhandleInfo(max_args, args) return None + def _parse_driver(self, buff): + """Parse a C file to extract driver information contained within + + This parses U_BOOT_DRIVER() structs to obtain various pieces of useful + information. + + It updates the following members: + _drivers - updated with new DriverInfo records for each driver found + in the file + _of_match - updated with each compatible string found in the file + _compat_to_driver - Maps compatible string to DriverInfo + + Args: + buff (str): Contents of file + """ + # Dict holding information about compatible strings collected in this + # function so far + # key: Name of struct udevice_id variable + # value: Dict of compatible info in that variable: + # key: Compatible string, e.g. 'rockchip,rk3288-grf' + # value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + of_match = {} + + # Dict holding driver information collected in this function so far + # key: Driver name (C name as in U_BOOT_DRIVER(xxx)) + # value: DriverInfo + drivers = {} + + # Collect the driver name (None means not found yet) + driver_name = None + re_driver = re.compile(r'U_BOOT_DRIVER\((.*)\)') + + # Collect the uclass ID, e.g. 'UCLASS_SPI' + uclass_id = None + re_id = re.compile(r'\s*\.id\s*=\s*(UCLASS_[A-Z0-9_]+)') + + # Collect the compatible string, e.g. 'rockchip,rk3288-grf' + compat = None + re_compat = re.compile('{\s*.compatible\s*=\s*"(.*)"\s*' + '(,\s*.data\s*=\s*(.*))?\s*},') + + # This is a dict of compatible strings that were found: + # key: Compatible string, e.g. 'rockchip,rk3288-grf' + # value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + compat_dict = {} + + # Holds the var nane of the udevice_id list, e.g. + # 'rk3288_syscon_ids_noc' in + # static const struct udevice_id rk3288_syscon_ids_noc[] = { + ids_name = None + re_ids = re.compile('struct udevice_id (.*)\[\]\s*=') + + # Matches the references to the udevice_id list + re_of_match = re.compile('\.of_match\s*=\s*([a-z0-9_]+),') + + # Matches the header/size information for priv + re_priv = re.compile('^\s*DM_PRIV\((.*)\)$') + drv_name = None + + prefix = '' + for line in buff.splitlines(): + # Handle line continuation + if prefix: + line = prefix + line + prefix = '' + if line.endswith('\\'): + prefix = line[:-1] + continue + + driver_match = re_driver.search(line) + + # If we have seen U_BOOT_DRIVER()... + if driver_name: + id_m = re_id.search(line) + id_of_match = re_of_match.search(line) + if id_m: + uclass_id = id_m.group(1) + elif id_of_match: + compat = id_of_match.group(1) + elif '};' in line: + if uclass_id and compat: + if compat not in of_match: + raise ValueError( + "%s: Unknown compatible var '%s' (found %s)" % + (fn, compat, ','.join(of_match.keys()))) + driver = DriverInfo(driver_name, uclass_id, + of_match[compat]) + drivers[driver_name] = driver + + # This needs to be deterministic, since a driver may + # have multiple compatible strings pointing to it. + # We record the one earliest in the alphabet so it + # will produce the same result on all machines. + for id in of_match[compat]: + old = self._compat_to_driver.get(id) + if not old or driver.name < old.name: + self._compat_to_driver[id] = driver + else: + # The driver does not have a uclass or compat string. + # The first is required but the second is not, so just + # ignore this. + pass + driver_name = None + uclass_id = None + ids_name = None + compat = None + compat_dict = {} + + # If we have seen U_BOOT_DRIVER()... + elif drv_name: + priv = re_priv.match(line) + if priv: + drivers[drv_name].priv_size = priv.group(1) + elif '};' in line: + drv_name = None + elif ids_name: + compat_m = re_compat.search(line) + if compat_m: + compat_dict[compat_m.group(1)] = compat_m.group(3) + elif '};' in line: + of_match[ids_name] = compat_dict + ids_name = None + elif driver_match: + driver_name = driver_match.group(1) + else: + ids_m = re_ids.search(line) + if ids_m: + ids_name = ids_m.group(1) + + # Make the updates based on what we found + self._drivers.update(drivers) + self._of_match.update(of_match) + def scan_driver(self, fname): """Scan a driver file to build a list of driver names and aliases - This procedure will populate self._drivers and self._driver_aliases + It updates the following members: + _drivers - updated with new DriverInfo records for each driver found + in the file + _of_match - updated with each compatible string found in the file + _compat_to_driver - Maps compatible string to DriverInfo + _driver_aliases - Maps alias names to driver name Args fname: Driver filename to scan
@@ -341,12 +494,10 @@ class DtbPlatdata(object): print("Skipping file '%s' due to unicode error" % fname) return - # The following re will search for driver names declared as - # U_BOOT_DRIVER(driver_name) - drivers = re.findall('U_BOOT_DRIVER\((.*)\)', buff) - - for driver in drivers: - self._drivers[driver] = DriverInfo(driver) + # If this file has any U_BOOT_DRIVER() declarations, process it to + # obtain driver information + if 'U_BOOT_DRIVER' in buff: + self._parse_driver(buff) # The following re will search for driver aliases declared as # U_BOOT_DRIVER_ALIAS(alias, driver_name)
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 12/20 dtoc: Allow use of the of_match_ptr() macro
In reply to Simon GlassUpdate the regex for the of_match member to allow of_match_ptr() so it matches both:
.of_match = apl_hostbridge_ids,
and
.of_match = of_match_ptr(apl_hostbridge_ids),
Without this, dtoc emits warnings and cannot find the drivers.
---
tools/dtoc/dtb_platdata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/dtoc/dtb_platdata.py +3 -2
@@ -393,7 +393,8 @@ class DtbPlatdata(object): re_ids = re.compile('struct udevice_id (.*)\[\]\s*=') # Matches the references to the udevice_id list - re_of_match = re.compile('\.of_match\s*=\s*([a-z0-9_]+),') + re_of_match = re.compile( + '\.of_match\s*=\s*(of_match_ptr\()?([a-z0-9_]+)(\))?,') # Matches the header/size information for priv re_priv = re.compile('^\s*DM_PRIV\((.*)\)$')
@@ -418,7 +419,7 @@ class DtbPlatdata(object): if id_m: uclass_id = id_m.group(1) elif id_of_match: - compat = id_of_match.group(1) + compat = id_of_match.group(2) elif '};' in line: if uclass_id and compat: if compat not in of_match:
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 13/20 x86: apl: Use const for driver operations
In reply to Simon GlassUpdate these declarations to const to ensure that the data ends up in the rodata section.
---
arch/x86/cpu/apollolake/pmc.c | 2 +- arch/x86/cpu/intel_common/p2sb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/cpu/apollolake/pmc.c +1 -1
@@ -205,7 +205,7 @@ static int apl_pmc_probe(struct udevice *dev)return 0 ; } -static struct acpi_pmc_ops apl_pmc_ops = { +static const struct acpi_pmc_ops apl_pmc_ops = { .init = apl_pmc_fill_power_state, .prev_sleep_state = apl_prev_sleep_state, .disable_tco = apl_disable_tco,
arch/x86/cpu/intel_common/p2sb.c +1 -1
@@ -180,7 +180,7 @@ static int p2sb_child_post_bind(struct udevice *dev)return 0 ; } -struct p2sb_ops p2sb_ops = { +static const struct p2sb_ops p2sb_ops = { .set_hide = intel_p2sb_set_hide, };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 14/20 x86: Move call64 into its own section
In reply to Simon GlassWhen this code is not used (e.g. by TPL) we want it to be excluded from the image. Put it in its own section so that this happens.
---
arch/x86/cpu/i386/call64.S | 1 + 1 file changed, 1 insertion(+)
arch/x86/cpu/i386/call64.S +1 -0
@@ -11,6 +11,7 @@ #include <asm/processor-flags.h> .code32 +.section .text_call64 .globl cpu_call64 cpu_call64: /*
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 15/20 x86: coral: Move fsp-m settings to a subnode
In reply to Simon GlassAt present these settings are in the node for host-bridge and so are visible in TPL as well as SPL. But they are only used for SPL.
Move them to a subnode so that TPL does not included them.
---
arch/x86/cpu/apollolake/fsp_m.c | 5 ++++- arch/x86/dts/chromebook_coral.dts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/x86/cpu/apollolake/fsp_m.c +4 -1
@@ -32,7 +32,10 @@ int fspm_update_config(struct udevice *dev, struct fspm_upd *upd) node =dev_ofnode (dev);if (!ofnode_valid (node)) -return log_msg_ret ("fsp-m settings" , -ENOENT ); +return log_msg_ret ("node" , -ENOENT ); + node =ofnode_find_subnode (node,"fsp-m" ); +if (!ofnode_valid (node)) +return log_msg_ret ("fspm" , -ENOENT ); ret =fsp_m_update_config_from_dtb (node, cfg);if (ret)
arch/x86/dts/chromebook_coral.dts +5 -0
@@ -174,6 +174,9 @@ */ fsp_s: fsp-s { }; + fsp_m: fsp-m { + u-boot,dm-spl; + }; nhlt { intel,dmic-channels = <4>;
@@ -650,7 +653,9 @@ PAD_CFG_NF(LPC_CLKRUNB, UP_20K, DEEP, NF1) /* LPC_CLKRUN_N */ PAD_CFG_NF(LPC_FRAMEB, NATIVE, DEEP, NF1) /* LPC_FRAME_N */ >; +}; +&fsp_m { fspm,package = <PACKAGE_BGA>; fspm,profile = <PROFILE_LPDDR4_2400_24_22_22>; fspm,memory-down = <MEMORY_DOWN_YES>;
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 16/20 x86: apl: Update hostbridge to remove unwanted TPL code
In reply to Simon GlassAt present several strings from this file appear in the TPL binary. Add preprocessor checks to drop them.
This reduces the TPL binary size by about 128 bytes.
---
arch/x86/cpu/apollolake/hostbridge.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/cpu/apollolake/hostbridge.c +9 -5
@@ -60,6 +60,7 @@ struct apl_hostbridge_plat {pci_dev_t bdf; }; +#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) static const struct nhlt_format_config dmic_1ch_formats[] = { /* 48 KHz 16-bits per sample. */ {
@@ -155,6 +156,7 @@ static const struct nhlt_endp_descriptor dmic_4ch_descriptors[] = { .num_formats = ARRAY_SIZE(dmic_4ch_formats), }, }; +#endif static int apl_hostbridge_early_init_pinctrl (struct udevice *dev) {
@@ -283,7 +285,7 @@ static int apl_acpi_hb_get_name(const struct udevice *dev, char *out_name)return acpi_copy_name (out_name,"RHUB" ); } -#ifdef CONFIG_GENERATE_ACPI_TABLE +#if CONFIG_IS_ENABLED (GENERATE_ACPI_TABLE )static int apl_acpi_hb_write_tables (const struct udevice *dev,struct acpi_ctx *ctx) {
@@ -322,7 +324,6 @@ static int apl_acpi_hb_write_tables(const struct udevice *dev,return 0 ; } -#endif static int apl_acpi_setup_nhlt (const struct udevice *dev,struct acpi_ctx *ctx) {
@@ -347,6 +348,7 @@ static int apl_acpi_setup_nhlt(const struct udevice *dev, struct acpi_ctx *ctx) return log_msg_ret("channels", -EINVAL); } +#endif static int apl_hostbridge_remove (struct udevice *dev) {
@@ -385,21 +387,23 @@ ulong sa_get_tseg_base(struct udevice *dev)struct acpi_ops apl_hostbridge_acpi_ops = { .get_name = apl_acpi_hb_get_name, -#ifdef CONFIG_GENERATE_ACPI_TABLE +#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) .write_tables = apl_acpi_hb_write_tables, -#endif .setup_nhlt = apl_acpi_setup_nhlt, +#endif }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_hostbridge_ids[] = { { .compatible ="intel,apl-hostbridge" }, { } }; +#endif U_BOOT_DRIVER (intel_apl_hostbridge) = { .name ="intel_apl_hostbridge" , .id =UCLASS_NORTHBRIDGE , - .of_match = apl_hostbridge_ids, + .of_match =of_match_ptr (apl_hostbridge_ids), .of_to_plat = apl_hostbridge_of_to_plat, .probe = apl_hostbridge_probe, .remove = apl_hostbridge_remove,
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 17/20 x86: apl: Reduce size for TPL
In reply to Simon GlassUpdate various drivers to use of_match_ptr() and to avoid including debug strings in TPL. Omit the WiFi driver entirely, since it is not used in TPL.
This reduces the TPL binary size by about 608 bytes.
---
arch/x86/cpu/apollolake/lpc.c | 13 ++++++++----- arch/x86/cpu/apollolake/pch.c | 4 +++- arch/x86/cpu/apollolake/pmc.c | 4 +++- arch/x86/cpu/apollolake/uart.c | 4 +++- arch/x86/cpu/intel_common/Makefile | 2 +- arch/x86/cpu/intel_common/itss.c | 4 +++- arch/x86/cpu/intel_common/p2sb.c | 4 +++- arch/x86/cpu/turbo.c | 5 +++++ board/google/chromebook_coral/coral.c | 4 +++- drivers/gpio/intel_gpio.c | 4 +++- drivers/pinctrl/intel/pinctrl_apl.c | 4 +++- drivers/power/acpi_pmc/acpi-pmc-uclass.c | 4 +++- drivers/timer/tsc_timer.c | 4 +++- 13 files changed, 44 insertions(+), 16 deletions(-)
arch/x86/cpu/apollolake/lpc.c +8 -5
@@ -81,10 +81,11 @@ int lpc_open_pmio_window(uint base, uint size) lgir_reg_num =find_unused_pmio_window ();if (lgir_reg_num <0 ) { -log_err ("LPC: Cannot open IO window: %lx size %lx\n" , - bridge_base, size - bridged_size); -log_err ("No more IO windows\n" ); - +if (spl_phase () >PHASE_TPL ) { +log_err ("LPC: Cannot open IO window: %lx size %lx\n" , + bridge_base, size - bridged_size); +log_err ("No more IO windows\n" ); + }return -ENOSPC ; } lgir_reg_offset =LPC_GENERIC_IO_RANGE (lgir_reg_num);
@@ -127,15 +128,17 @@ struct acpi_ops apl_lpc_acpi_ops = { .inject_dsdt = southbridge_inject_dsdt, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_lpc_ids[] = { { .compatible ="intel,apl-lpc" }, { } }; +#endif /* All pads are LPC already configured by the hostbridge, so no probing here */ U_BOOT_DRIVER (intel_apl_lpc) = { .name ="intel_apl_lpc" , .id =UCLASS_LPC , - .of_match = apl_lpc_ids, + .of_match =of_match_ptr (apl_lpc_ids),ACPI_OPS_PTR (&apl_lpc_acpi_ops) };
arch/x86/cpu/apollolake/pch.c +3 -1
@@ -23,14 +23,16 @@ static const struct pch_ops apl_pch_ops = { .set_spi_protect = apl_set_spi_protect, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_pch_ids[] = { { .compatible ="intel,apl-pch" }, { } }; +#endif U_BOOT_DRIVER (intel_apl_pch) = { .name ="intel_apl_pch" , .id =UCLASS_PCH , - .of_match = apl_pch_ids, + .of_match =of_match_ptr (apl_pch_ids), .ops = &apl_pch_ops, };
arch/x86/cpu/apollolake/pmc.c +3 -1
@@ -212,15 +212,17 @@ static const struct acpi_pmc_ops apl_pmc_ops = { .global_reset_set_enable = apl_global_reset_set_enable, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_pmc_ids[] = { { .compatible ="intel,apl-pmc" }, { } }; +#endif U_BOOT_DRIVER (intel_apl_pmc) = { .name ="intel_apl_pmc" , .id =UCLASS_ACPI_PMC , - .of_match = apl_pmc_ids, + .of_match =of_match_ptr (apl_pmc_ids), .of_to_plat = apl_pmc_ofdata_to_uc_plat, .probe = apl_pmc_probe, .ops = &apl_pmc_ops,
arch/x86/cpu/apollolake/uart.c +3 -1
@@ -118,15 +118,17 @@ static int apl_ns16550_of_to_plat(struct udevice *dev)return 0 ; } +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_ns16550_serial_ids[] = { { .compatible ="intel,apl-ns16550" }, { }, }; +#endif U_BOOT_DRIVER (intel_apl_ns16550) = { .name ="intel_apl_ns16550" , .id =UCLASS_SERIAL , - .of_match = apl_ns16550_serial_ids, + .of_match =of_match_ptr (apl_ns16550_serial_ids), .plat_auto =sizeof (struct ns16550_plat ), .priv_auto =sizeof (struct ns16550 ), .ops = &ns16550_serial_ops,
arch/x86/cpu/intel_common/Makefile +1 -1
@@ -26,7 +26,7 @@ obj-y += cpu.o obj-y += fast_spi.o obj-y += lpc.o obj-y += lpss.o -obj-$(CONFIG_INTEL_GENERIC_WIFI) += generic_wifi.o +obj-$(CONFIG_$(SPL_)INTEL_GENERIC_WIFI) += generic_wifi.o ifndef CONFIG_TARGET_EFI_APP obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o ifndef CONFIG_$(SPL_)X86_64
arch/x86/cpu/intel_common/itss.c +3 -1
@@ -230,15 +230,17 @@ static const struct irq_ops itss_ops = {#endif }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id itss_ids[] = { { .compatible ="intel,itss" , .data =X86_IRQT_ITSS }, { } }; +#endif U_BOOT_DRIVER (intel_itss) = { .name ="intel_itss" , .id =UCLASS_IRQ , - .of_match = itss_ids, + .of_match =of_match_ptr (itss_ids), .ops = &itss_ops, .bind = itss_bind, .of_to_plat = itss_of_to_plat,
arch/x86/cpu/intel_common/p2sb.c +3 -1
@@ -184,15 +184,17 @@ static const struct p2sb_ops p2sb_ops = { .set_hide = intel_p2sb_set_hide, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id p2sb_ids[] = { { .compatible ="intel,p2sb" }, { } }; +#endif U_BOOT_DRIVER (intel_p2sb) = { .name ="intel_p2sb" , .id =UCLASS_P2SB , - .of_match = p2sb_ids, + .of_match =of_match_ptr (p2sb_ids), .probe = p2sb_probe, .remove = p2sb_remove, .ops = &p2sb_ops,
arch/x86/cpu/turbo.c +5 -0
@@ -35,12 +35,15 @@ static inline void set_global_turbo_state(int state) }#endif +/* gcc 7.3 does not wwant to drop strings, so use #ifdef */ +#ifndef CONFIG_TPL_BUILD static const char *const turbo_state_desc[] = { [TURBO_UNKNOWN ] ="unknown" , [TURBO_UNAVAILABLE ] ="unavailable" , [TURBO_DISABLED ] ="available but hidden" , [TURBO_ENABLED ] ="available and visible" }; +#endif /* * Determine the current state of Turbo and cache it for later.
@@ -76,7 +79,9 @@ int turbo_get_state(void) }set_global_turbo_state (turbo_state); +#ifndef CONFIG_TPL_BUILD debug ("Turbo is %s\n" , turbo_state_desc[turbo_state]); +#endif return turbo_state; }
board/google/chromebook_coral/coral.c +3 -1
@@ -143,14 +143,16 @@ struct acpi_ops coral_acpi_ops = { .inject_dsdt = chromeos_acpi_gpio_generate, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id coral_ids[] = { { .compatible ="google,coral" }, { } }; +#endif U_BOOT_DRIVER (coral_drv) = { .name ="coral" , .id =UCLASS_SYSINFO , - .of_match = coral_ids, + .of_match =of_match_ptr (coral_ids),ACPI_OPS_PTR (&coral_acpi_ops) };
drivers/gpio/intel_gpio.c +3 -1
@@ -188,15 +188,17 @@ static const struct dm_gpio_ops gpio_intel_ops = {#endif }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id intel_intel_gpio_ids[] = { { .compatible ="intel,gpio" }, { } }; +#endif U_BOOT_DRIVER (intel_gpio) = { .name ="intel_gpio" , .id =UCLASS_GPIO , - .of_match = intel_intel_gpio_ids, + .of_match =of_match_ptr (intel_intel_gpio_ids), .ops = &gpio_intel_ops, .of_to_plat = intel_gpio_of_to_plat, .probe = intel_gpio_probe,
drivers/pinctrl/intel/pinctrl_apl.c +3 -1
@@ -169,15 +169,17 @@ static int apl_pinctrl_of_to_plat(struct udevice *dev)return intel_pinctrl_of_to_plat (dev, comm,2 ); } +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id apl_gpio_ids[] = { { .compatible ="intel,apl-pinctrl" }, { } }; +#endif U_BOOT_DRIVER (intel_apl_pinctrl) = { .name ="intel_apl_pinctrl" , .id =UCLASS_PINCTRL , - .of_match = apl_gpio_ids, + .of_match =of_match_ptr (apl_gpio_ids), .probe = intel_pinctrl_probe, .ops = &intel_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA)
drivers/power/acpi_pmc/acpi-pmc-uclass.c +3 -1
@@ -8,6 +8,7 @@#include <common.h> #include <dm.h> #include <log.h> +#include <spl.h> #include <acpi/acpi_s3.h> #ifdef CONFIG_X86 #include <asm/intel_pinctrl.h>
@@ -60,7 +61,8 @@ int pmc_gpe_init(struct udevice *dev)* are different and if they aren't, use the reset values. */ if (dw[0 ] == dw[1 ] || dw[1 ] == dw[2 ]) { -log_info ("PMC: Using default GPE route" ); +if (spl_phase () >PHASE_TPL ) +log_info ("PMC: Using default GPE route" ); gpio_cfg =readl (upriv->gpe_cfg);for (i =0 ; i < upriv->gpe0_count; i++) dw[i] = gpio_cfg >>gpe0_shift (upriv, i);
drivers/timer/tsc_timer.c +3 -1
@@ -477,15 +477,17 @@ static const struct timer_ops tsc_timer_ops = { .get_count = tsc_timer_get_count, }; +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id tsc_timer_ids[] = { { .compatible ="x86,tsc-timer" , }, { } }; +#endif U_BOOT_DRIVER (x86_tsc_timer) = { .name ="x86_tsc_timer" , .id =UCLASS_TIMER , - .of_match = tsc_timer_ids, + .of_match =of_match_ptr (tsc_timer_ids), .probe = tsc_timer_probe, .ops = &tsc_timer_ops, };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 18/20 x86: pinctrl: Drop unlikely error messages from TPL
In reply to Simon GlassThese errors are only really for development purposes. Drop them to reduce the size of TPL. The error numbers are still reported.
This reduces the TPL binary size on coral by about 160 bytes.
---
drivers/pinctrl/intel/pinctrl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl.c +8 -3
@@ -274,7 +274,9 @@ static int pinctrl_configure_itss(struct udevice *dev, irq =pcr_read32 (dev,PAD_CFG1_OFFSET (pad_cfg_offset)); irq &=PAD_CFG1_IRQ_MASK ;if (!irq) { -log_err ("GPIO %u doesn't support APIC routing\n" , cfg->pad); +if (spl_phase () >PHASE_TPL ) +log_err ("GPIO %u doesn't support APIC routing\n" , + cfg->pad);return -EPROTONOSUPPORT ; }
@@ -314,7 +316,8 @@ static int pinctrl_pad_reset_config_override(const struct pad_community *comm,return config_value; } } -log_err ("Logical-to-Chipset mapping not found\n" ); +if (spl_phase () >PHASE_TPL ) +log_err ("Logical-to-Chipset mapping not found\n" );return -ENOENT ; }
@@ -620,7 +623,9 @@ int intel_pinctrl_of_to_plat(struct udevice *dev,struct intel_pinctrl_priv *priv =dev_get_priv (dev);if (!comm) { -log_err ("Cannot find community for pid %d\n" , pplat->pid); +if (spl_phase () >PHASE_TPL ) +log_err ("Cannot find community for pid %d\n" , + pplat->pid);return -EDOM ; } priv->comm = comm;
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 19/20 x86: tpl: Remove unwanted devicetree string
In reply to Simon GlassUpdate this driver to use of_match_ptr().
This reduces the TPL binary size by about 32 bytes.
---
arch/x86/lib/tpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/lib/tpl.c +3 -1
@@ -133,14 +133,16 @@ void spl_board_init(void)* for devices, so the TPL BARs continue to be used. Once U-Boot starts it does * the auto allocation (after relocation). */ +#if !CONFIG_IS_ENABLED (OF_PLATDATA )static const struct udevice_id tpl_fake_pci_ids[] = { { .compatible ="pci-x86" }, { } }; +#endif U_BOOT_DRIVER (pci_x86) = { .name ="pci_x86" , .id =UCLASS_SIMPLE_BUS , - .of_match = tpl_fake_pci_ids, + .of_match =of_match_ptr (tpl_fake_pci_ids), };#endif
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 20/20 x86: Fix header gaurd in asm/pmu.h
In reply to Simon GlassThis has the wrong name. Fix it.
---
arch/x86/include/asm/pmu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/pmu.h +3 -3
@@ -2,9 +2,9 @@/* * Copyright (c) 2017 Intel Corporation */ -#ifndef _X86_ASM_PMU_IPC_H_ -#define _X86_ASM_PMU_IPC_H_ +#ifndef _X86_ASM_PMU_H_ +#define _X86_ASM_PMU_H_int pmu_turn_power (unsigned int lss,bool on); -#endif /* _X86_ASM_PMU_IPC_H_ */ +#endif /* _X86_ASM_PMU_H_ */
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog