diff options
author | Furquan Shaikh <furquan@google.com> | 2019-10-23 09:46:45 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-10-25 06:54:50 +0000 |
commit | 80212aa1040577cf052bbf9f12abe079e36e4cf8 (patch) | |
tree | 1e6a031e54ef47d5e284bef0b5349920a472b455 | |
parent | 91c8d35be36521a9fbe39c0bfd54562cf3cf5a2c (diff) |
mb/google/hatch: Configure GPIOs in mainboard chip->init()
mainboard_silicon_init_params() is supposed to be used for only
overriding any FSP params as per mainboard configuration. GPIOs should
be configured by mainboard as part of its chip init(). This ensures
proper ordering w.r.t. any common operations that the SoC code might
want to perform e.g. snapshot ITSS polarities.
This change moves the configuration of GPIOs from
mainboard_silicon_init_params() to mainboard
chip->init(). Additionally, this change moves mainboard_ec_init() to
mainboard dev->init().
TEST=Verified that GPIOs are configured properly and hatch boots to
OS.
Change-Id: Ia509471a3678c60454cd4f14625f151860d9b9d2
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36267
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/mainboard/google/hatch/ramstage.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/mainboard/google/hatch/ramstage.c b/src/mainboard/google/hatch/ramstage.c index 04e1bc10ea..e9f50625cd 100644 --- a/src/mainboard/google/hatch/ramstage.c +++ b/src/mainboard/google/hatch/ramstage.c @@ -23,19 +23,7 @@ void mainboard_silicon_init_params(FSP_S_CONFIG *params) { - const struct pad_config *base_table; - const struct pad_config *override_table; - size_t base_gpios; - size_t override_gpios; - variant_devtree_update(); - base_table = base_gpio_table(&base_gpios); - override_table = override_gpio_table(&override_gpios); - - gpio_configure_pads_with_override(base_table, - base_gpios, - override_table, - override_gpios); } void __weak variant_devtree_update(void) @@ -43,13 +31,34 @@ void __weak variant_devtree_update(void) /* Override dev tree settings per board */ } -static void mainboard_enable(struct device *dev) +static void mainboard_init(struct device *dev) { mainboard_ec_init(); +} +static void mainboard_enable(struct device *dev) +{ + dev->ops->init = mainboard_init; dev->ops->acpi_inject_dsdt_generator = chromeos_dsdt_generator; } +static void mainboard_chip_init(void *chip_info) +{ + const struct pad_config *base_table; + const struct pad_config *override_table; + size_t base_gpios; + size_t override_gpios; + + base_table = base_gpio_table(&base_gpios); + override_table = override_gpio_table(&override_gpios); + + gpio_configure_pads_with_override(base_table, + base_gpios, + override_table, + override_gpios); +} + struct chip_operations mainboard_ops = { + .init = mainboard_chip_init, .enable_dev = mainboard_enable, }; |