diff options
author | Tom Rini <trini@konsulko.com> | 2020-11-06 08:41:49 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-11-06 09:46:43 -0500 |
commit | d062c1344cefb6c368b96efea4c2a20e63657b8d (patch) | |
tree | 56dcc373217bbcb248c35f7253c9478c1ba7e715 /drivers | |
parent | 71d3fa7efa4fc07e6f161c742397ddbe4466c631 (diff) | |
parent | e4f8e543f1a905857a753a1d411997a81f4f52aa (diff) | |
download | u-boot-d062c1344cefb6c368b96efea4c2a20e63657b8d.zip u-boot-d062c1344cefb6c368b96efea4c2a20e63657b8d.tar.gz u-boot-d062c1344cefb6c368b96efea4c2a20e63657b8d.tar.bz2 |
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Add a new SMBIOS parser and enable it when booting from coreboot
- Fix up various driver names to avoid dtoc warnings
- Fully enable ACPI support on Google Chromebook Coral
- Add a way to set SMBIOS properties using the devicetree
- Update existing boards to use devicetree for SMBIOS using a new
default sysinfo driver
Diffstat (limited to 'drivers')
26 files changed, 231 insertions, 196 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index ed8a39c..b1ada1c 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -30,8 +30,6 @@ source "drivers/ddr/Kconfig" source "drivers/demo/Kconfig" -source "drivers/board/Kconfig" - source "drivers/ddr/fsl/Kconfig" source "drivers/dfu/Kconfig" @@ -114,6 +112,8 @@ source "drivers/spi/Kconfig" source "drivers/spmi/Kconfig" +source "drivers/sysinfo/Kconfig" + source "drivers/sysreset/Kconfig" source "drivers/tee/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 33f1d53..e371bc3 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -27,9 +27,9 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/ obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/ obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/ +obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += power/acpi_pmc/ -obj-$(CONFIG_$(SPL_)BOARD) += board/ obj-$(CONFIG_XEN) += xen/ obj-$(CONFIG_$(SPL_)FPGA) += fpga/ diff --git a/drivers/board/Kconfig b/drivers/board/Kconfig deleted file mode 100644 index 254f657..0000000 --- a/drivers/board/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -menuconfig BOARD - bool "Device Information" - help - Support methods to query hardware configurations from internal - mechanisms (e.g. reading GPIO values, determining the presence of - devices on busses, etc.). This enables the usage of U-Boot with - modular board architectures. - -if BOARD - -config SPL_BOARD - depends on SPL_DM - bool "Enable board driver support in SPL" - -config BOARD_GAZERBEAM - bool "Enable board driver for the Gazerbeam board" - help - Support querying device information for the gdsys Gazerbeam board. - -config BOARD_SANDBOX - bool "Enable board driver for the Sandbox board" - help - Support querying device information for the Sandbox boards. - -endif diff --git a/drivers/board/Makefile b/drivers/board/Makefile deleted file mode 100644 index cc16361..0000000 --- a/drivers/board/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# (C) Copyright 2017 -# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc -obj-y += board-uclass.o -obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o -obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o diff --git a/drivers/board/board-uclass.c b/drivers/board/board-uclass.c deleted file mode 100644 index b5485e9..0000000 --- a/drivers/board/board-uclass.c +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2017 - * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc - */ - -#include <common.h> -#include <dm.h> -#include <board.h> - -int board_get(struct udevice **devp) -{ - return uclass_first_device_err(UCLASS_BOARD, devp); -} - -int board_detect(struct udevice *dev) -{ - struct board_ops *ops = board_get_ops(dev); - - if (!ops->detect) - return -ENOSYS; - - return ops->detect(dev); -} - -int board_get_fit_loadable(struct udevice *dev, int index, - const char *type, const char **strp) -{ - struct board_ops *ops = board_get_ops(dev); - - if (!ops->get_fit_loadable) - return -ENOSYS; - - return ops->get_fit_loadable(dev, index, type, strp); -} - -int board_get_bool(struct udevice *dev, int id, bool *val) -{ - struct board_ops *ops = board_get_ops(dev); - - if (!ops->get_bool) - return -ENOSYS; - - return ops->get_bool(dev, id, val); -} - -int board_get_int(struct udevice *dev, int id, int *val) -{ - struct board_ops *ops = board_get_ops(dev); - - if (!ops->get_int) - return -ENOSYS; - - return ops->get_int(dev, id, val); -} - -int board_get_str(struct udevice *dev, int id, size_t size, char *val) -{ - struct board_ops *ops = board_get_ops(dev); - - if (!ops->get_str) - return -ENOSYS; - - return ops->get_str(dev, id, size, val); -} - -UCLASS_DRIVER(board) = { - .id = UCLASS_BOARD, - .name = "board", - .post_bind = dm_scan_fdt_dev, -}; diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c index 7fe9399..63a791f 100644 --- a/drivers/core/acpi.c +++ b/drivers/core/acpi.c @@ -268,8 +268,7 @@ int acpi_recurse_method(struct acpi_ctx *ctx, struct udevice *parent, if (func) { void *start = ctx->current; - log_debug("\n"); - log_debug("- %s %p\n", parent->name, func); + log_debug("- method %d, %s %p\n", method, parent->name, func); ret = device_ofdata_to_platdata(parent); if (ret) return log_msg_ret("ofdata", ret); @@ -299,7 +298,6 @@ int acpi_fill_ssdt(struct acpi_ctx *ctx) int ret; log_debug("Writing SSDT tables\n"); - item_count = 0; ret = acpi_recurse_method(ctx, dm_root(), METHOD_FILL_SSDT, TYPE_SSDT); log_debug("Writing SSDT finished, err=%d\n", ret); ret = sort_acpi_item_type(ctx, start, TYPE_SSDT); @@ -315,7 +313,6 @@ int acpi_inject_dsdt(struct acpi_ctx *ctx) int ret; log_debug("Writing DSDT tables\n"); - item_count = 0; ret = acpi_recurse_method(ctx, dm_root(), METHOD_INJECT_DSDT, TYPE_DSDT); log_debug("Writing DSDT finished, err=%d\n", ret); @@ -326,6 +323,11 @@ int acpi_inject_dsdt(struct acpi_ctx *ctx) return ret; } +void acpi_reset_items(void) +{ + item_count = 0; +} + int acpi_write_dev_tables(struct acpi_ctx *ctx) { int ret; diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index 6a3a8c4..c3b67f2 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -193,8 +193,8 @@ static const struct udevice_id intel_intel_gpio_ids[] = { { } }; -U_BOOT_DRIVER(gpio_intel) = { - .name = "gpio_intel", +U_BOOT_DRIVER(intel_gpio) = { + .name = "intel_gpio", .id = UCLASS_GPIO, .of_match = intel_intel_gpio_ids, .ops = &gpio_intel_ops, diff --git a/drivers/misc/cros_ec_i2c.c b/drivers/misc/cros_ec_i2c.c index c00f5f7..664bd2b 100644 --- a/drivers/misc/cros_ec_i2c.c +++ b/drivers/misc/cros_ec_i2c.c @@ -231,8 +231,8 @@ static const struct udevice_id cros_ec_ids[] = { { } }; -U_BOOT_DRIVER(cros_ec_i2c) = { - .name = "cros_ec_i2c", +U_BOOT_DRIVER(google_cros_ec_i2c) = { + .name = "google_cros_ec_i2c", .id = UCLASS_CROS_EC, .of_match = cros_ec_ids, .probe = cros_ec_probe, diff --git a/drivers/misc/cros_ec_lpc.c b/drivers/misc/cros_ec_lpc.c index 4ad6c8c..63702f9 100644 --- a/drivers/misc/cros_ec_lpc.c +++ b/drivers/misc/cros_ec_lpc.c @@ -243,8 +243,8 @@ static const struct udevice_id cros_ec_ids[] = { { } }; -U_BOOT_DRIVER(cros_ec_lpc) = { - .name = "cros_ec_lpc", +U_BOOT_DRIVER(google_cros_ec_lpc) = { + .name = "google_cros_ec_lpc", .id = UCLASS_CROS_EC, .of_match = cros_ec_ids, .probe = cros_ec_probe, diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c index 153f971..bbc9630 100644 --- a/drivers/misc/cros_ec_spi.c +++ b/drivers/misc/cros_ec_spi.c @@ -184,8 +184,8 @@ static const struct udevice_id cros_ec_ids[] = { { } }; -U_BOOT_DRIVER(cros_ec_spi) = { - .name = "cros_ec_spi", +U_BOOT_DRIVER(google_cros_ec_spi) = { + .name = "google_cros_ec_spi", .id = UCLASS_CROS_EC, .of_match = cros_ec_ids, .probe = cros_ec_probe, diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c index ba21c9d..e3d2464 100644 --- a/drivers/pinctrl/intel/pinctrl.c +++ b/drivers/pinctrl/intel/pinctrl.c @@ -154,7 +154,7 @@ static int pinctrl_get_device(uint pad, struct udevice **devp) return 0; } } - printf("pad %d not found\n", pad); + log_debug("pad %d not found\n", pad); return -ENOTBLK; } diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c index 7624a99..727bacf 100644 --- a/drivers/pinctrl/intel/pinctrl_apl.c +++ b/drivers/pinctrl/intel/pinctrl_apl.c @@ -174,7 +174,7 @@ static const struct udevice_id apl_gpio_ids[] = { { } }; -U_BOOT_DRIVER(apl_pinctrl_drv) = { +U_BOOT_DRIVER(intel_apl_pinctrl) = { .name = "intel_apl_pinctrl", .id = UCLASS_PINCTRL, .of_match = apl_gpio_ids, diff --git a/drivers/rtc/mc146818.c b/drivers/rtc/mc146818.c index b98c39d..71f96e2 100644 --- a/drivers/rtc/mc146818.c +++ b/drivers/rtc/mc146818.c @@ -246,8 +246,8 @@ static const struct udevice_id rtc_mc146818_ids[] = { { } }; -U_BOOT_DRIVER(rtc_mc146818) = { - .name = "rtc_mc146818", +U_BOOT_DRIVER(motorola_mc146818) = { + .name = "motorola_mc146818", .id = UCLASS_RTC, .of_match = rtc_mc146818_ids, .probe = rtc_mc146818_probe, diff --git a/drivers/sound/da7219.c b/drivers/sound/da7219.c index 6bc1ad0..8d674bc 100644 --- a/drivers/sound/da7219.c +++ b/drivers/sound/da7219.c @@ -54,13 +54,13 @@ static int da7219_acpi_fill_ssdt(const struct udevice *dev, acpigen_write_name(ctx, "_CRS"); acpigen_write_resourcetemplate_header(ctx); ret = acpi_device_write_i2c_dev(ctx, dev); - if (ret) + if (ret < 0) return log_msg_ret("i2c", ret); /* Use either Interrupt() or GpioInt() */ ret = acpi_device_write_interrupt_or_gpio(ctx, (struct udevice *)dev, "req-gpios"); - if (ret) + if (ret < 0) return log_msg_ret("irq_gpio", ret); acpigen_write_resourcetemplate_footer(ctx); diff --git a/drivers/sound/max98357a.c b/drivers/sound/max98357a.c index 827262d..b3d27a3 100644 --- a/drivers/sound/max98357a.c +++ b/drivers/sound/max98357a.c @@ -69,7 +69,7 @@ static int max98357a_acpi_fill_ssdt(const struct udevice *dev, acpigen_write_name(ctx, "_CRS"); acpigen_write_resourcetemplate_header(ctx); ret = acpi_device_write_gpio_desc(ctx, &priv->sdmode_gpio); - if (ret) + if (ret < 0) return log_msg_ret("gpio", ret); acpigen_write_resourcetemplate_footer(ctx); diff --git a/drivers/sysinfo/Kconfig b/drivers/sysinfo/Kconfig new file mode 100644 index 0000000..85c1e81 --- /dev/null +++ b/drivers/sysinfo/Kconfig @@ -0,0 +1,33 @@ +menuconfig SYSINFO + bool "Device System Information" + help + Support methods to query hardware configurations from internal + mechanisms (e.g. reading GPIO values, determining the presence of + devices on busses, etc.). This enables the usage of U-Boot with + modular board architectures. + +if SYSINFO + +config SPL_SYSINFO + depends on SPL_DM + bool "Enable board driver support in SPL" + +config SYSINFO_GAZERBEAM + bool "Enable sysinfo driver for the Gazerbeam board" + help + Support querying device information for the gdsys Gazerbeam board. + +config SYSINFO_SANDBOX + bool "Enable sysinfo driver for the Sandbox board" + help + Support querying device information for the Sandbox boards. + +config SYSINFO_SMBIOS + bool "Provide a default sysinfo driver for SMBIOS information" + help + Some boards want to specify the manufacturer or product name but do + not need to have their own sysinfo driver. This includes a default + one which provides a way to specify this SMBIOS information in the + devicetree, without needing any board-specific functionality. + +endif diff --git a/drivers/sysinfo/Makefile b/drivers/sysinfo/Makefile new file mode 100644 index 0000000..6d04fcb --- /dev/null +++ b/drivers/sysinfo/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2017 +# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc +obj-y += sysinfo-uclass.o +obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o +obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o +obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.o diff --git a/drivers/board/gazerbeam.c b/drivers/sysinfo/gazerbeam.c index ed50fc5..9e7a496 100644 --- a/drivers/board/gazerbeam.c +++ b/drivers/sysinfo/gazerbeam.c @@ -6,7 +6,7 @@ #include <common.h> #include <dm.h> -#include <board.h> +#include <sysinfo.h> #include <i2c.h> #include <log.h> #include <asm/gpio.h> @@ -27,16 +27,16 @@ static const int SC_GPIO_NO; static const int CON_GPIO_NO = 1; /** - * struct board_gazerbeam_priv - Private data structure for the gazerbeam board - * driver. - * @reset_gpios: GPIOs for the board's reset GPIOs. - * @var_gpios: GPIOs for the board's hardware variant GPIOs - * @ver_gpios: GPIOs for the board's hardware version GPIOs - * @variant: Container for the board's hardware variant (CON/CPU) - * @multichannel: Container for the board's multichannel variant (MC4/MC2/SC) - * @hwversion: Container for the board's hardware version + * struct sysinfo_gazerbeam_priv - Private data structure for the gazerbeam + * sysinfo driver + * @reset_gpios: GPIOs for the sysinfo's reset GPIOs. + * @var_gpios: GPIOs for the sysinfo's hardware variant GPIOs + * @ver_gpios: GPIOs for the sysinfo's hardware version GPIOs + * @variant: Container for the sysinfo's hardware variant (CON/CPU) + * @multichannel: Container for the sysinfo's multichannel variant (MC4/MC2/SC) + * @hwversion: Container for the sysinfo's hardware version */ -struct board_gazerbeam_priv { +struct sysinfo_gazerbeam_priv { struct gpio_desc reset_gpios[2]; struct gpio_desc var_gpios[2]; struct gpio_desc ver_gpios[4]; @@ -46,19 +46,19 @@ struct board_gazerbeam_priv { }; /** - * _read_board_variant_data() - Read variant information from the hardware. - * @dev: The board device for which to determine the multichannel and device + * _read_sysinfo_variant_data() - Read variant information from the hardware. + * @dev: The sysinfo device for which to determine the multichannel and device * type information. * - * The data read from the board's hardware (mostly hard-wired GPIOs) is stored + * The data read from the sysinfo's hardware (mostly hard-wired GPIOs) is stored * in the private data structure of the driver to be used by other driver * methods. * * Return: 0 if OK, -ve on error. */ -static int _read_board_variant_data(struct udevice *dev) +static int _read_sysinfo_variant_data(struct udevice *dev) { - struct board_gazerbeam_priv *priv = dev_get_priv(dev); + struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev); struct udevice *i2c_bus; struct udevice *dummy; char *listname; @@ -129,10 +129,10 @@ static int _read_board_variant_data(struct udevice *dev) } /** - * _read_hwversion() - Read the hardware version from the board. - * @dev: The board device for which to read the hardware version. + * _read_hwversion() - Read the hardware version from the sysinfo. + * @dev: The sysinfo device for which to read the hardware version. * - * The hardware version read from the board (from hard-wired GPIOs) is stored + * The hardware version read from the sysinfo (from hard-wired GPIOs) is stored * in the private data structure of the driver to be used by other driver * methods. * @@ -140,7 +140,7 @@ static int _read_board_variant_data(struct udevice *dev) */ static int _read_hwversion(struct udevice *dev) { - struct board_gazerbeam_priv *priv = dev_get_priv(dev); + struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev); int res; res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios, @@ -172,11 +172,11 @@ static int _read_hwversion(struct udevice *dev) return 0; } -static int board_gazerbeam_detect(struct udevice *dev) +static int sysinfo_gazerbeam_detect(struct udevice *dev) { int res; - res = _read_board_variant_data(dev); + res = _read_sysinfo_variant_data(dev); if (res) { debug("%s: Error reading multichannel variant (err = %d)\n", dev->name, res); @@ -193,9 +193,9 @@ static int board_gazerbeam_detect(struct udevice *dev) return 0; } -static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val) +static int sysinfo_gazerbeam_get_int(struct udevice *dev, int id, int *val) { - struct board_gazerbeam_priv *priv = dev_get_priv(dev); + struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev); switch (id) { case BOARD_MULTICHANNEL: @@ -215,19 +215,19 @@ static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val) return 0; } -static const struct udevice_id board_gazerbeam_ids[] = { - { .compatible = "gdsys,board_gazerbeam" }, +static const struct udevice_id sysinfo_gazerbeam_ids[] = { + { .compatible = "gdsys,sysinfo-gazerbeam" }, { /* sentinel */ } }; -static const struct board_ops board_gazerbeam_ops = { - .detect = board_gazerbeam_detect, - .get_int = board_gazerbeam_get_int, +static const struct sysinfo_ops sysinfo_gazerbeam_ops = { + .detect = sysinfo_gazerbeam_detect, + .get_int = sysinfo_gazerbeam_get_int, }; -static int board_gazerbeam_probe(struct udevice *dev) +static int sysinfo_gazerbeam_probe(struct udevice *dev) { - struct board_gazerbeam_priv *priv = dev_get_priv(dev); + struct sysinfo_gazerbeam_priv *priv = dev_get_priv(dev); int gpio_num, i; gpio_num = gpio_request_list_by_name(dev, "reset-gpios", @@ -255,11 +255,11 @@ static int board_gazerbeam_probe(struct udevice *dev) return 0; } -U_BOOT_DRIVER(board_gazerbeam) = { - .name = "board_gazerbeam", - .id = UCLASS_BOARD, - .of_match = board_gazerbeam_ids, - .ops = &board_gazerbeam_ops, - .priv_auto_alloc_size = sizeof(struct board_gazerbeam_priv), - .probe = board_gazerbeam_probe, +U_BOOT_DRIVER(sysinfo_gazerbeam) = { + .name = "sysinfo_gazerbeam", + .id = UCLASS_SYSINFO, + .of_match = sysinfo_gazerbeam_ids, + .ops = &sysinfo_gazerbeam_ops, + .priv_auto_alloc_size = sizeof(struct sysinfo_gazerbeam_priv), + .probe = sysinfo_gazerbeam_probe, }; diff --git a/drivers/board/gazerbeam.h b/drivers/sysinfo/gazerbeam.h index 171729d..171729d 100644 --- a/drivers/board/gazerbeam.h +++ b/drivers/sysinfo/gazerbeam.h diff --git a/drivers/board/sandbox.c b/drivers/sysinfo/sandbox.c index 50621e4..62a1cb4 100644 --- a/drivers/board/sandbox.c +++ b/drivers/sysinfo/sandbox.c @@ -6,11 +6,11 @@ #include <common.h> #include <dm.h> -#include <board.h> +#include <sysinfo.h> #include "sandbox.h" -struct board_sandbox_priv { +struct sysinfo_sandbox_priv { bool called_detect; int test_i1; int test_i2; @@ -19,9 +19,9 @@ struct board_sandbox_priv { char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng", "Carcosa", "Yuggoth", "The Nameless City"}; -int board_sandbox_detect(struct udevice *dev) +int sysinfo_sandbox_detect(struct udevice *dev) { - struct board_sandbox_priv *priv = dev_get_priv(dev); + struct sysinfo_sandbox_priv *priv = dev_get_priv(dev); priv->called_detect = true; priv->test_i2 = 100; @@ -29,9 +29,9 @@ int board_sandbox_detect(struct udevice *dev) return 0; } -int board_sandbox_get_bool(struct udevice *dev, int id, bool *val) +int sysinfo_sandbox_get_bool(struct udevice *dev, int id, bool *val) { - struct board_sandbox_priv *priv = dev_get_priv(dev); + struct sysinfo_sandbox_priv *priv = dev_get_priv(dev); switch (id) { case BOOL_CALLED_DETECT: @@ -43,9 +43,9 @@ int board_sandbox_get_bool(struct udevice *dev, int id, bool *val) return -ENOENT; } -int board_sandbox_get_int(struct udevice *dev, int id, int *val) +int sysinfo_sandbox_get_int(struct udevice *dev, int id, int *val) { - struct board_sandbox_priv *priv = dev_get_priv(dev); + struct sysinfo_sandbox_priv *priv = dev_get_priv(dev); switch (id) { case INT_TEST1: @@ -63,9 +63,9 @@ int board_sandbox_get_int(struct udevice *dev, int id, int *val) return -ENOENT; } -int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val) +int sysinfo_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val) { - struct board_sandbox_priv *priv = dev_get_priv(dev); + struct sysinfo_sandbox_priv *priv = dev_get_priv(dev); int i1 = priv->test_i1; int i2 = priv->test_i2; int index = (i1 * i2) % ARRAY_SIZE(vacation_spots); @@ -80,28 +80,28 @@ int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val) return -ENOENT; } -static const struct udevice_id board_sandbox_ids[] = { - { .compatible = "sandbox,board_sandbox" }, +static const struct udevice_id sysinfo_sandbox_ids[] = { + { .compatible = "sandbox,sysinfo-sandbox" }, { /* sentinel */ } }; -static const struct board_ops board_sandbox_ops = { - .detect = board_sandbox_detect, - .get_bool = board_sandbox_get_bool, - .get_int = board_sandbox_get_int, - .get_str = board_sandbox_get_str, +static const struct sysinfo_ops sysinfo_sandbox_ops = { + .detect = sysinfo_sandbox_detect, + .get_bool = sysinfo_sandbox_get_bool, + .get_int = sysinfo_sandbox_get_int, + .get_str = sysinfo_sandbox_get_str, }; -int board_sandbox_probe(struct udevice *dev) +int sysinfo_sandbox_probe(struct udevice *dev) { return 0; } -U_BOOT_DRIVER(board_sandbox) = { - .name = "board_sandbox", - .id = UCLASS_BOARD, - .of_match = board_sandbox_ids, - .ops = &board_sandbox_ops, - .priv_auto_alloc_size = sizeof(struct board_sandbox_priv), - .probe = board_sandbox_probe, +U_BOOT_DRIVER(sysinfo_sandbox) = { + .name = "sysinfo_sandbox", + .id = UCLASS_SYSINFO, + .of_match = sysinfo_sandbox_ids, + .ops = &sysinfo_sandbox_ops, + .priv_auto_alloc_size = sizeof(struct sysinfo_sandbox_priv), + .probe = sysinfo_sandbox_probe, }; diff --git a/drivers/board/sandbox.h b/drivers/sysinfo/sandbox.h index 2cff494..2cff494 100644 --- a/drivers/board/sandbox.h +++ b/drivers/sysinfo/sandbox.h diff --git a/drivers/sysinfo/smbios.c b/drivers/sysinfo/smbios.c new file mode 100644 index 0000000..80ebd19 --- /dev/null +++ b/drivers/sysinfo/smbios.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#include <common.h> +#include <dm.h> +#include <sysinfo.h> + +static const struct udevice_id sysinfo_smbios_ids[] = { + { .compatible = "u-boot,sysinfo-smbios" }, + { /* sentinel */ } +}; + +static const struct sysinfo_ops sysinfo_smbios_ops = { +}; + +U_BOOT_DRIVER(sysinfo_smbios) = { + .name = "sysinfo_smbios", + .id = UCLASS_SYSINFO, + .of_match = sysinfo_smbios_ids, + .ops = &sysinfo_smbios_ops, +}; diff --git a/drivers/sysinfo/sysinfo-uclass.c b/drivers/sysinfo/sysinfo-uclass.c new file mode 100644 index 0000000..6df58fe --- /dev/null +++ b/drivers/sysinfo/sysinfo-uclass.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2017 + * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc + */ + +#include <common.h> +#include <dm.h> +#include <sysinfo.h> + +int sysinfo_get(struct udevice **devp) +{ + return uclass_first_device_err(UCLASS_SYSINFO, devp); +} + +int sysinfo_detect(struct udevice *dev) +{ + struct sysinfo_ops *ops = sysinfo_get_ops(dev); + + if (!ops->detect) + return -ENOSYS; + + return ops->detect(dev); +} + +int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type, + const char **strp) +{ + struct sysinfo_ops *ops = sysinfo_get_ops(dev); + + if (!ops->get_fit_loadable) + return -ENOSYS; + + return ops->get_fit_loadable(dev, index, type, strp); +} + +int sysinfo_get_bool(struct udevice *dev, int id, bool *val) +{ + struct sysinfo_ops *ops = sysinfo_get_ops(dev); + + if (!ops->get_bool) + return -ENOSYS; + + return ops->get_bool(dev, id, val); +} + +int sysinfo_get_int(struct udevice *dev, int id, int *val) +{ + struct sysinfo_ops *ops = sysinfo_get_ops(dev); + + if (!ops->get_int) + return -ENOSYS; + + return ops->get_int(dev, id, val); +} + +int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val) +{ + struct sysinfo_ops *ops = sysinfo_get_ops(dev); + + if (!ops->get_str) + return -ENOSYS; + + return ops->get_str(dev, id, size, val); +} + +UCLASS_DRIVER(sysinfo) = { + .id = UCLASS_SYSINFO, + .name = "sysinfo", + .post_bind = dm_scan_fdt_dev, +}; diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c index bc91143..7682ffb 100644 --- a/drivers/sysreset/sysreset_x86.c +++ b/drivers/sysreset/sysreset_x86.c @@ -148,8 +148,8 @@ static struct sysreset_ops x86_sysreset_ops = { .get_last = x86_sysreset_get_last, }; -U_BOOT_DRIVER(x86_sysreset) = { - .name = "x86-sysreset", +U_BOOT_DRIVER(x86_reset) = { + .name = "x86_reset", .id = UCLASS_SYSRESET, .of_match = x86_sysreset_ids, .ops = &x86_sysreset_ops, diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index ba77042..6139252 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -5,12 +5,12 @@ */ #include <common.h> -#include <board.h> #include <clk.h> #include <dm.h> #include <irq_func.h> #include <log.h> #include <status_led.h> +#include <sysinfo.h> #include <time.h> #include <timer.h> #include <watchdog.h> @@ -97,7 +97,7 @@ int interrupt_init(void) { immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; struct udevice *csb; - struct udevice *board; + struct udevice *sysinfo; struct udevice *timer; struct mpc83xx_timer_priv *timer_priv; struct clk clock; @@ -112,12 +112,12 @@ int interrupt_init(void) timer_priv = dev_get_priv(timer); - if (board_get(&board)) { - debug("%s: board device could not be fetched.\n", __func__); + if (sysinfo_get(&sysinfo)) { + debug("%s: sysinfo device could not be fetched.\n", __func__); return -ENOENT; } - ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, board, + ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, sysinfo, "csb", &csb); if (ret) { debug("%s: Could not retrieve CSB device (error: %d)", diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index abc0a1d..e367770 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -482,8 +482,8 @@ static const struct udevice_id tsc_timer_ids[] = { { } }; -U_BOOT_DRIVER(tsc_timer) = { - .name = "tsc_timer", +U_BOOT_DRIVER(x86_tsc_timer) = { + .name = "x86_tsc_timer", .id = UCLASS_TIMER, .of_match = tsc_timer_ids, .probe = tsc_timer_probe, |