Commit 3a8ee3df authored by Simon Glass's avatar Simon Glass Committed by Bin Meng
Browse files

board: Rename uclass to sysinfo



This uclass is intended to provide a way to obtain information about a
U-Boot board. But the concept of a U-Boot 'board' is the whole system,
not just one circuit board, meaning that 'board' is something of a
misnomer for this uclass.

In addition, the name 'board' is a bit overused in U-Boot and we want to
use the same uclass to provide SMBIOS information.

The obvious name is 'system' but that is so vague as to be meaningless.
Use 'sysinfo' instead, since this uclass is aimed at providing information
on the system.

Rename everything accordingly.

Note: Due to the patch delta caused by the symbol renames, this patch
shows some renamed files as being deleted in one place and created in
another.
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent a40f890b
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
}; };
board { board {
compatible = "gdsys,board_gazerbeam"; compatible = "gdsys,sysinfo-gazerbeam";
csb = <&board_soc>; csb = <&board_soc>;
serdes = <&SERDES>; serdes = <&SERDES>;
rxaui0 = <&RXAUI0_0>; rxaui0 = <&RXAUI0_0>;
......
...@@ -1103,10 +1103,6 @@ ...@@ -1103,10 +1103,6 @@
compatible = "sandbox,sandbox_osd"; compatible = "sandbox,sandbox_osd";
}; };
board {
compatible = "sandbox,board_sandbox";
};
sandbox_tee { sandbox_tee {
compatible = "sandbox,tee"; compatible = "sandbox,tee";
}; };
...@@ -1242,6 +1238,10 @@ ...@@ -1242,6 +1238,10 @@
reset-names = "valid", "no_mask", "out_of_range"; reset-names = "valid", "no_mask", "out_of_range";
}; };
sysinfo {
compatible = "sandbox,sysinfo-sandbox";
};
some_regmapped-bus { some_regmapped-bus {
#address-cells = <0x1>; #address-cells = <0x1>;
#size-cells = <0x1>; #size-cells = <0x1>;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <dm.h> #include <dm.h>
#include <misc.h> #include <misc.h>
#include <regmap.h> #include <regmap.h>
#include <board.h> #include <sysinfo.h>
#include "../../../drivers/misc/gdsys_soc.h" #include "../../../drivers/misc/gdsys_soc.h"
#include "../../../drivers/misc/gdsys_ioep.h" #include "../../../drivers/misc/gdsys_ioep.h"
...@@ -506,11 +506,11 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ...@@ -506,11 +506,11 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{ {
struct udevice *ioep = NULL; struct udevice *ioep = NULL;
struct udevice *board; struct udevice *sysinfo;
char name[8]; char name[8];
int ret; int ret;
if (board_get(&board)) if (sysinfo_get(&sysinfo))
return CMD_RET_FAILURE; return CMD_RET_FAILURE;
if (argc > 1) { if (argc > 1) {
...@@ -518,7 +518,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ...@@ -518,7 +518,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
snprintf(name, sizeof(name), "ioep%d", i); snprintf(name, sizeof(name), "ioep%d", i);
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep); ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, name,
&ioep);
if (ret || !ioep) { if (ret || !ioep) {
printf("Invalid IOEP %d\n", i); printf("Invalid IOEP %d\n", i);
...@@ -532,7 +533,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ...@@ -532,7 +533,8 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
while (1) { while (1) {
snprintf(name, sizeof(name), "ioep%d", i); snprintf(name, sizeof(name), "ioep%d", i);
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &ioep); ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo,
name, &ioep);
if (ret || !ioep) if (ret || !ioep)
break; break;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
#include <common.h> #include <common.h>
#include <board.h>
#include <command.h> #include <command.h>
#include <dm.h> #include <dm.h>
#include <env.h> #include <env.h>
...@@ -15,11 +14,12 @@ ...@@ -15,11 +14,12 @@
#include <init.h> #include <init.h>
#include <miiphy.h> #include <miiphy.h>
#include <misc.h> #include <misc.h>
#include <sysinfo.h>
#include <tpm-v1.h> #include <tpm-v1.h>
#include <video_osd.h> #include <video_osd.h>
#include "../common/ihs_mdio.h" #include "../common/ihs_mdio.h"
#include "../../../drivers/board/gazerbeam.h" #include "../../../drivers/sysinfo/gazerbeam.h"
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -43,22 +43,22 @@ static int get_tpm(struct udevice **devp) ...@@ -43,22 +43,22 @@ static int get_tpm(struct udevice **devp)
int board_early_init_r(void) int board_early_init_r(void)
{ {
struct udevice *board; struct udevice *sysinfo;
struct udevice *serdes; struct udevice *serdes;
int mc = 0; int mc = 0;
int con = 0; int con = 0;
if (board_get(&board)) if (sysinfo_get(&sysinfo))
puts("Could not find board information device.\n"); puts("Could not find sysinfo information device.\n");
/* Initialize serdes */ /* Initialize serdes */
uclass_get_device_by_phandle(UCLASS_MISC, board, "serdes", &serdes); uclass_get_device_by_phandle(UCLASS_MISC, sysinfo, "serdes", &serdes);
if (board_detect(board)) if (sysinfo_detect(sysinfo))
puts("Device information detection failed.\n"); puts("Device information detection failed.\n");
board_get_int(board, BOARD_MULTICHANNEL, &mc); sysinfo_get_int(sysinfo, BOARD_MULTICHANNEL, &mc);
board_get_int(board, BOARD_VARIANT, &con); sysinfo_get_int(sysinfo, BOARD_VARIANT, &con);
if (mc == 2 || mc == 1) if (mc == 2 || mc == 1)
dev_disable_by_path("/immr@e0000000/i2c@3100/pca9698@22"); dev_disable_by_path("/immr@e0000000/i2c@3100/pca9698@22");
...@@ -84,18 +84,18 @@ int board_early_init_r(void) ...@@ -84,18 +84,18 @@ int board_early_init_r(void)
return 0; return 0;
} }
int checkboard(void) int checksysinfo(void)
{ {
struct udevice *board; struct udevice *sysinfo;
char *s = env_get("serial#"); char *s = env_get("serial#");
int mc = 0; int mc = 0;
int con = 0; int con = 0;
if (board_get(&board)) if (sysinfo_get(&sysinfo))
puts("Could not find board information device.\n"); puts("Could not find sysinfo information device.\n");
board_get_int(board, BOARD_MULTICHANNEL, &mc); sysinfo_get_int(sysinfo, BOARD_MULTICHANNEL, &mc);
board_get_int(board, BOARD_VARIANT, &con); sysinfo_get_int(sysinfo, BOARD_VARIANT, &con);
puts("Board: Gazerbeam "); puts("Board: Gazerbeam ");
printf("%s ", mc == 4 ? "MC4" : mc == 2 ? "MC2" : "SC"); printf("%s ", mc == 4 ? "MC4" : mc == 2 ? "MC2" : "SC");
...@@ -123,20 +123,22 @@ int last_stage_init(void) ...@@ -123,20 +123,22 @@ int last_stage_init(void)
{ {
int fpga_hw_rev = 0; int fpga_hw_rev = 0;
int i; int i;
struct udevice *board; struct udevice *sysinfo;
struct udevice *osd; struct udevice *osd;
struct video_osd_info osd_info; struct video_osd_info osd_info;
struct udevice *tpm; struct udevice *tpm;
int ret; int ret;
if (board_get(&board)) if (sysinfo_get(&sysinfo))
puts("Could not find board information device.\n"); puts("Could not find sysinfo information device.\n");
if (board) { if (sysinfo) {
int res = board_get_int(board, BOARD_HWVERSION, &fpga_hw_rev); int res = sysinfo_get_int(sysinfo, BOARD_HWVERSION,
&fpga_hw_rev);
if (res) if (res)
printf("Could not determind FPGA HW revision (res = %d)\n", res); printf("Could not determind FPGA HW revision (res = %d)\n",
res);
} }
env_set_ulong("fpga_hw_rev", fpga_hw_rev); env_set_ulong("fpga_hw_rev", fpga_hw_rev);
...@@ -154,7 +156,8 @@ int last_stage_init(void) ...@@ -154,7 +156,8 @@ int last_stage_init(void)
snprintf(name, sizeof(name), "rxaui%d", i); snprintf(name, sizeof(name), "rxaui%d", i);
/* Disable RXAUI polarity inversion */ /* Disable RXAUI polarity inversion */
ret = uclass_get_device_by_phandle(UCLASS_MISC, board, name, &rxaui); ret = uclass_get_device_by_phandle(UCLASS_MISC, sysinfo,
name, &rxaui);
if (!ret) if (!ret)
misc_set_enabled(rxaui, false); misc_set_enabled(rxaui, false);
} }
......
...@@ -150,7 +150,7 @@ static const struct udevice_id coral_ids[] = { ...@@ -150,7 +150,7 @@ static const struct udevice_id coral_ids[] = {
U_BOOT_DRIVER(coral_drv) = { U_BOOT_DRIVER(coral_drv) = {
.name = "coral", .name = "coral",
.id = UCLASS_BOARD, .id = UCLASS_SYSINFO,
.of_match = coral_ids, .of_match = coral_ids,
ACPI_OPS_PTR(&coral_acpi_ops) ACPI_OPS_PTR(&coral_acpi_ops)
}; };
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
#include <common.h> #include <common.h>
#include <errno.h> #include <errno.h>
#include <board.h>
#include <fpga.h> #include <fpga.h>
#include <gzip.h> #include <gzip.h>
#include <image.h> #include <image.h>
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>
#include <spl.h> #include <spl.h>
#include <sysinfo.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <linux/libfdt.h> #include <linux/libfdt.h>
...@@ -74,7 +74,7 @@ static int spl_fit_get_image_name(const void *fit, int images, ...@@ -74,7 +74,7 @@ static int spl_fit_get_image_name(const void *fit, int images,
const char *type, int index, const char *type, int index,
const char **outname) const char **outname)
{ {
struct udevice *board; struct udevice *sysinfo;
const char *name, *str; const char *name, *str;
__maybe_unused int node; __maybe_unused int node;
int conf_node; int conf_node;
...@@ -110,19 +110,20 @@ static int spl_fit_get_image_name(const void *fit, int images, ...@@ -110,19 +110,20 @@ static int spl_fit_get_image_name(const void *fit, int images,
} }
} }
if (!found && !board_get(&board)) { if (!found && CONFIG_IS_ENABLED(SYSINFO) && !sysinfo_get(&sysinfo)) {
int rc; int rc;
/* /*
* no string in the property for this index. Check if the board * no string in the property for this index. Check if the
* level code can supply one. * sysinfo-level code can supply one.
*/ */
rc = board_get_fit_loadable(board, index - i - 1, type, &str); rc = sysinfo_get_fit_loadable(sysinfo, index - i - 1, type,
&str);
if (rc && rc != -ENOENT) if (rc && rc != -ENOENT)
return rc; return rc;
if (!rc) { if (!rc) {
/* /*
* The board provided a name for a loadable. * The sysinfo provided a name for a loadable.
* Try to match it against the description properties * Try to match it against the description properties
* first. If no matching node is found, use it as a * first. If no matching node is found, use it as a
* node name. * node name.
......
...@@ -79,7 +79,6 @@ CONFIG_SYSCON=y ...@@ -79,7 +79,6 @@ CONFIG_SYSCON=y
CONFIG_SPL_OF_TRANSLATE=y CONFIG_SPL_OF_TRANSLATE=y
CONFIG_INTEL_ACPIGEN=y CONFIG_INTEL_ACPIGEN=y
CONFIG_CPU=y CONFIG_CPU=y
CONFIG_BOARD=y
CONFIG_DM_I2C=y CONFIG_DM_I2C=y
CONFIG_SYS_I2C_DW=y CONFIG_SYS_I2C_DW=y
CONFIG_MISC=y CONFIG_MISC=y
...@@ -100,6 +99,7 @@ CONFIG_SOUND_MAX98357A=y ...@@ -100,6 +99,7 @@ CONFIG_SOUND_MAX98357A=y
CONFIG_SOUND_RT5677=y CONFIG_SOUND_RT5677=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_ICH_SPI=y CONFIG_ICH_SPI=y
CONFIG_SYSINFO=y
CONFIG_TPL_SYSRESET=y CONFIG_TPL_SYSRESET=y
# CONFIG_TPM_V1 is not set # CONFIG_TPM_V1 is not set
CONFIG_TPM2_CR50_I2C=y CONFIG_TPM2_CR50_I2C=y
......
...@@ -157,8 +157,6 @@ CONFIG_CLK=y ...@@ -157,8 +157,6 @@ CONFIG_CLK=y
CONFIG_ICS8N3QV01=y CONFIG_ICS8N3QV01=y
CONFIG_CPU=y CONFIG_CPU=y
CONFIG_CPU_MPC83XX=y CONFIG_CPU_MPC83XX=y
CONFIG_BOARD=y
CONFIG_BOARD_GAZERBEAM=y
CONFIG_DM_PCA953X=y CONFIG_DM_PCA953X=y
CONFIG_MPC8XXX_GPIO=y CONFIG_MPC8XXX_GPIO=y
CONFIG_DM_I2C=y CONFIG_DM_I2C=y
...@@ -197,6 +195,8 @@ CONFIG_MPC83XX_SDRAM=y ...@@ -197,6 +195,8 @@ CONFIG_MPC83XX_SDRAM=y
CONFIG_DM_RESET=y CONFIG_DM_RESET=y
CONFIG_DM_SERIAL=y CONFIG_DM_SERIAL=y
CONFIG_SYS_NS16550=y CONFIG_SYS_NS16550=y
CONFIG_SYSINFO=y
CONFIG_SYSINFO_GAZERBEAM=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_SYSRESET_MPC83XX=y CONFIG_SYSRESET_MPC83XX=y
CONFIG_TIMER=y CONFIG_TIMER=y
......
...@@ -109,8 +109,6 @@ CONFIG_CPU=y ...@@ -109,8 +109,6 @@ CONFIG_CPU=y
CONFIG_DM_DEMO=y CONFIG_DM_DEMO=y
CONFIG_DM_DEMO_SIMPLE=y CONFIG_DM_DEMO_SIMPLE=y
CONFIG_DM_DEMO_SHAPE=y CONFIG_DM_DEMO_SHAPE=y
CONFIG_BOARD=y
CONFIG_BOARD_SANDBOX=y
CONFIG_GPIO_HOG=y CONFIG_GPIO_HOG=y
CONFIG_DM_GPIO_LOOKUP_LABEL=y CONFIG_DM_GPIO_LOOKUP_LABEL=y
CONFIG_PM8916_GPIO=y CONFIG_PM8916_GPIO=y
...@@ -201,6 +199,8 @@ CONFIG_SOC_DEVICE=y ...@@ -201,6 +199,8 @@ CONFIG_SOC_DEVICE=y
CONFIG_SANDBOX_SPI=y CONFIG_SANDBOX_SPI=y
CONFIG_SPMI=y CONFIG_SPMI=y
CONFIG_SPMI_SANDBOX=y CONFIG_SPMI_SANDBOX=y
CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
......
...@@ -131,8 +131,6 @@ CONFIG_CPU=y ...@@ -131,8 +131,6 @@ CONFIG_CPU=y
CONFIG_DM_DEMO=y CONFIG_DM_DEMO=y
CONFIG_DM_DEMO_SIMPLE=y CONFIG_DM_DEMO_SIMPLE=y
CONFIG_DM_DEMO_SHAPE=y CONFIG_DM_DEMO_SHAPE=y
CONFIG_BOARD=y
CONFIG_BOARD_SANDBOX=y
CONFIG_DMA=y CONFIG_DMA=y
CONFIG_DMA_CHANNELS=y CONFIG_DMA_CHANNELS=y
CONFIG_SANDBOX_DMA=y CONFIG_SANDBOX_DMA=y
...@@ -238,6 +236,8 @@ CONFIG_SOC_DEVICE=y ...@@ -238,6 +236,8 @@ CONFIG_SOC_DEVICE=y
CONFIG_SANDBOX_SPI=y CONFIG_SANDBOX_SPI=y
CONFIG_SPMI=y CONFIG_SPMI=y
CONFIG_SPMI_SANDBOX=y CONFIG_SPMI_SANDBOX=y
CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
......
...@@ -90,8 +90,6 @@ CONFIG_CPU=y ...@@ -90,8 +90,6 @@ CONFIG_CPU=y
CONFIG_DM_DEMO=y CONFIG_DM_DEMO=y
CONFIG_DM_DEMO_SIMPLE=y CONFIG_DM_DEMO_SIMPLE=y
CONFIG_DM_DEMO_SHAPE=y CONFIG_DM_DEMO_SHAPE=y
CONFIG_BOARD=y
CONFIG_BOARD_SANDBOX=y
CONFIG_GPIO_HOG=y CONFIG_GPIO_HOG=y
CONFIG_DM_GPIO_LOOKUP_LABEL=y CONFIG_DM_GPIO_LOOKUP_LABEL=y
CONFIG_PM8916_GPIO=y CONFIG_PM8916_GPIO=y
...@@ -177,6 +175,8 @@ CONFIG_SOC_DEVICE=y ...@@ -177,6 +175,8 @@ CONFIG_SOC_DEVICE=y
CONFIG_SANDBOX_SPI=y CONFIG_SANDBOX_SPI=y
CONFIG_SPMI=y CONFIG_SPMI=y
CONFIG_SPMI_SANDBOX=y CONFIG_SPMI_SANDBOX=y
CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_TIMER=y CONFIG_TIMER=y
CONFIG_TIMER_EARLY=y CONFIG_TIMER_EARLY=y
......
...@@ -111,8 +111,6 @@ CONFIG_CPU=y ...@@ -111,8 +111,6 @@ CONFIG_CPU=y
CONFIG_DM_DEMO=y CONFIG_DM_DEMO=y
CONFIG_DM_DEMO_SIMPLE=y CONFIG_DM_DEMO_SIMPLE=y
CONFIG_DM_DEMO_SHAPE=y CONFIG_DM_DEMO_SHAPE=y
CONFIG_BOARD=y
CONFIG_BOARD_SANDBOX=y
CONFIG_SPL_FIRMWARE=y CONFIG_SPL_FIRMWARE=y
CONFIG_GPIO_HOG=y CONFIG_GPIO_HOG=y
CONFIG_PM8916_GPIO=y CONFIG_PM8916_GPIO=y
...@@ -196,6 +194,8 @@ CONFIG_SOC_DEVICE=y ...@@ -196,6 +194,8 @@ CONFIG_SOC_DEVICE=y
CONFIG_SANDBOX_SPI=y CONFIG_SANDBOX_SPI=y
CONFIG_SPMI=y CONFIG_SPMI=y
CONFIG_SPMI_SANDBOX=y CONFIG_SPMI_SANDBOX=y
CONFIG_SYSINFO=y
CONFIG_SYSINFO_SANDBOX=y
CONFIG_SYSRESET=y CONFIG_SYSRESET=y
CONFIG_SPL_SYSRESET=y CONFIG_SPL_SYSRESET=y
CONFIG_TIMER=y CONFIG_TIMER=y
......
gdsys Gazerbeam board driver gdsys Gazerbeam sysinfo driver
This driver provides capabilities to access the gdsys Gazerbeam board's device This driver provides capabilities to access the gdsys Gazerbeam board's device
information. Furthermore, phandles to some internal devices are provided for information. Furthermore, phandles to some internal devices are provided for
the board files. the board files.
Required properties: Required properties:
- compatible: should be "gdsys,board_gazerbeam" - compatible: should be "gdsys,sysinfo-gazerbeam"
- csb: phandle to the board's coherent system bus (CSB) device node - csb: phandle to the board's coherent system bus (CSB) device node
- rxaui[0-3]: phandles to the rxaui control device nodes - rxaui[0-3]: phandles to the rxaui control device nodes
- fpga[0-1]: phandles to the board's gdsys FPGA device nodes - fpga[0-1]: phandles to the board's gdsys FPGA device nodes
...@@ -17,8 +17,8 @@ Required properties: ...@@ -17,8 +17,8 @@ Required properties:
Example: Example:
board { sysinfo {
compatible = "gdsys,board_gazerbeam"; compatible = "gdsys,sysinfo-gazerbeam";
csb = <&board_soc>; csb = <&board_soc>;
serdes = <&SERDES>; serdes = <&SERDES>;
rxaui0 = <&RXAUI0>; rxaui0 = <&RXAUI0>;
......
...@@ -30,8 +30,6 @@ source "drivers/ddr/Kconfig" ...@@ -30,8 +30,6 @@ source "drivers/ddr/Kconfig"
source "drivers/demo/Kconfig" source "drivers/demo/Kconfig"
source "drivers/board/Kconfig"
source "drivers/ddr/fsl/Kconfig" source "drivers/ddr/fsl/Kconfig"
source "drivers/dfu/Kconfig" source "drivers/dfu/Kconfig"
...@@ -114,6 +112,8 @@ source "drivers/spi/Kconfig" ...@@ -114,6 +112,8 @@ source "drivers/spi/Kconfig"
source "drivers/spmi/Kconfig" source "drivers/spmi/Kconfig"
source "drivers/sysinfo/Kconfig"
source "drivers/sysreset/Kconfig" source "drivers/sysreset/Kconfig"
source "drivers/tee/Kconfig" source "drivers/tee/Kconfig"
......
...@@ -27,9 +27,9 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/ ...@@ -27,9 +27,9 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/
obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/ obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/
obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/
obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/ obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/
obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/
obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/
obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += power/acpi_pmc/ obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += power/acpi_pmc/
obj-$(CONFIG_$(SPL_)BOARD) += board/
obj-$(CONFIG_XEN) += xen/ obj-$(CONFIG_XEN) += xen/
obj-$(CONFIG_$(SPL_)FPGA) += fpga/ obj-$(CONFIG_$(SPL_)FPGA) += fpga/
......
menuconfig BOARD menuconfig SYSINFO
bool "Device Information" bool "Device System Information"
help help
Support methods to query hardware configurations from internal Support methods to query hardware configurations from internal
mechanisms (e.g. reading GPIO values, determining the presence of mechanisms (e.g. reading GPIO values, determining the presence of
devices on busses, etc.). This enables the usage of U-Boot with devices on busses, etc.). This enables the usage of U-Boot with
modular board architectures. modular board architectures.
if BOARD if SYSINFO
config SPL_BOARD config SPL_SYSINFO
depends on SPL_DM depends on SPL_DM
bool "Enable board driver support in SPL" bool "Enable board driver support in SPL"
config BOARD_GAZERBEAM config SYSINFO_GAZERBEAM
bool "Enable board driver for the Gazerbeam board" bool "Enable sysinfo driver for the Gazerbeam board"
help help
Support querying device information for the gdsys Gazerbeam board. Support querying device information for the gdsys Gazerbeam board.
config BOARD_SANDBOX config SYSINFO_SANDBOX
bool "Enable board driver for the Sandbox board" bool "Enable sysinfo driver for the Sandbox board"
help help
Support querying device information for the Sandbox boards. Support querying device information for the Sandbox boards.
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
# #
# (C) Copyright 2017 # (C) Copyright 2017
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc # Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
obj-y += board-uclass.o obj-y += sysinfo-uclass.o
obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o
obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <board.h> #include <sysinfo.h>
#include <i2c.h> #include <i2c.h>
#include <log.h> #include <log.h>
#include <asm/gpio.h> #include <asm/gpio.h>
...@@ -27,16 +27,16 @@ static const int SC_GPIO_NO; ...@@ -27,16 +27,16 @@ static const int SC_GPIO_NO;
static const int CON_GPIO_NO = 1; static const int CON_GPIO_NO = 1;
/** /**
* struct board_gazerbeam_priv - Private data structure for the gazerbeam board * struct sysinfo_gazerbeam_priv - Private data structure for the gazerbeam
* driver. * sysinfo driver
* @reset_gpios: GPIOs for the board's reset GPIOs. * @reset_gpios: GPIOs for the sysinfo's reset GPIOs.
* @var_gpios: GPIOs for the board's hardware variant GPIOs * @var_gpios: GPIOs for the sysinfo's hardware variant GPIOs
* @ver_gpios: GPIOs for the board's hardware version GPIOs * @ver_gpios: GPIOs for the sysinfo's hardware version GPIOs
* @variant: Container for the board's hardware variant (CON/CPU) * @variant: Container for the sysinfo's hardware variant (CON/CPU)
* @multichannel: Container for the board's multichannel variant (MC4/MC2/SC) * @multichannel: Container for the sysinfo's multichannel variant (MC4/MC2/SC)
* @hwversion: Container for the board's hardware version * @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 reset_gpios[2];
struct gpio_desc var_gpios[2]; struct gpio_desc var_gpios[2];
struct gpio_desc ver_gpios[4]; struct gpio_desc ver_gpios[4];
...@@ -46,19 +46,19 @@ struct board_gazerbeam_priv { ...@@ -46,19 +46,19 @@ struct board_gazerbeam_priv {
}; };
/** /**
* _read_board_variant_data() - Read variant information from the hardware. * _read_sysinfo_variant_data() - Read variant information from the hardware.
* @dev: The board device for which to determine the multichannel and device * @dev: The sysinfo device for which to determine the multichannel and device
* type information. * 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 * in the private data structure of the driver to be used by other driver
* methods. * methods.
* *
* Return: 0 if OK, -ve on error. * 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 *i2c_bus;
struct udevice *dummy; struct udevice *dummy;
char *listname; char *listname;
...@@ -129,10 +129,10 @@ static int _read_board_variant_data(struct udevice *dev) ...@@ -129,10 +129,10 @@ static int _read_board_variant_data(struct udevice *dev)
} }
/** /**
* _read_hwversion() - Read the hardware version from the board. * _read_hwversion() - Read the hardware version from the sysinfo.
* @dev: The board device for which to read the hardware version. * @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 * in the private data structure of the driver to be used by other driver
* methods. * methods.
* *
...@@ -140,7 +140,7 @@ static int _read_board_variant_data(struct udevice *dev) ...@@ -140,7 +140,7 @@ static int _read_board_variant_data(struct udevice *dev)
*/ */
static int _read_hwversion(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; int res;
res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios, res = gpio_request_list_by_name(dev, "ver-gpios", priv->ver_gpios,
...@@ -172,11 +172,11 @@ static int _read_hwversion(struct udevice *dev) ...@@ -172,11 +172,11 @@ static int _read_hwversion(struct udevice *dev)
return 0; return 0;
} }
static int board_gazerbeam_detect(struct udevice *dev) static int sysinfo_gazerbeam_detect(struct udevice *dev)
{ {
int res; int res;
res = _read_board_variant_data(dev); res = _read_sysinfo_variant_data(dev);
if (res) { if (res) {
debug("%s: Error reading multichannel variant (err = %d)\n", debug("%s: Error reading multichannel variant (err = %d)\n",
dev->name, res); dev->name, res);
...@@ -193,9 +193,9 @@ static int board_gazerbeam_detect(struct udevice *dev) ...@@ -193,9 +193,9 @@ static int board_gazerbeam_detect(struct udevice *dev)
return 0; 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) { switch (id) {
case BOARD_MULTICHANNEL: case BOARD_MULTICHANNEL:
...@@ -215,19 +215,19 @@ static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val) ...@@ -215,19 +215,19 @@ static int board_gazerbeam_get_int(struct udevice *dev, int id, int *val)
return 0; return 0;
} }
static const struct udevice_id board_gazerbeam_ids[] = { static const struct udevice_id sysinfo_gazerbeam_ids[] = {
{ .compatible = "gdsys,board_gazerbeam" }, { .compatible = "gdsys,sysinfo-gazerbeam" },
{ /* sentinel */ } { /* sentinel */ }
}; };
static const struct board_ops board_gazerbeam_ops = { static const struct sysinfo_ops sysinfo_gazerbeam_ops = {
.detect = board_gazerbeam_detect, .detect = sysinfo_gazerbeam_detect,
.get_int = board_gazerbeam_get_int, .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; int gpio_num, i;
gpio_num = gpio_request_list_by_name(dev, "reset-gpios", gpio_num = gpio_request_list_by_name(dev, "reset-gpios",
...@@ -255,11 +255,11 @@ static int board_gazerbeam_probe(struct udevice *dev) ...@@ -255,11 +255,11 @@ static int board_gazerbeam_probe(struct udevice *dev)
return 0; return 0;
} }
U_BOOT_DRIVER(board_gazerbeam) = { U_BOOT_DRIVER(sysinfo_gazerbeam) = {
.name = "board_gazerbeam", .name = "sysinfo_gazerbeam",
.id = UCLASS_BOARD, .id = UCLASS_SYSINFO,
.of_match = board_gazerbeam_ids, .of_match = sysinfo_gazerbeam_ids,
.ops = &board_gazerbeam_ops, .ops = &sysinfo_gazerbeam_ops,
.priv_auto_alloc_size = sizeof(struct board_gazerbeam_priv), .priv_auto_alloc_size = sizeof(struct sysinfo_gazerbeam_priv),
.probe = board_gazerbeam_probe, .probe = sysinfo_gazerbeam_probe,
}; };
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <board.h> #include <sysinfo.h>
#include "sandbox.h" #include "sandbox.h"
struct board_sandbox_priv { struct sysinfo_sandbox_priv {
bool called_detect; bool called_detect;
int test_i1; int test_i1;
int test_i2; int test_i2;
...@@ -19,9 +19,9 @@ struct board_sandbox_priv { ...@@ -19,9 +19,9 @@ struct board_sandbox_priv {
char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng", char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng",
"Carcosa", "Yuggoth", "The Nameless City"}; "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->called_detect = true;
priv->test_i2 = 100; priv->test_i2 = 100;
...@@ -29,9 +29,9 @@ int board_sandbox_detect(struct udevice *dev) ...@@ -29,9 +29,9 @@ int board_sandbox_detect(struct udevice *dev)
return 0; 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) { switch (id) {
case BOOL_CALLED_DETECT: case BOOL_CALLED_DETECT:
...@@ -43,9 +43,9 @@ int board_sandbox_get_bool(struct udevice *dev, int id, bool *val) ...@@ -43,9 +43,9 @@ int board_sandbox_get_bool(struct udevice *dev, int id, bool *val)
return -ENOENT; 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) { switch (id) {
case INT_TEST1: case INT_TEST1:
...@@ -63,9 +63,9 @@ int board_sandbox_get_int(struct udevice *dev, int id, int *val) ...@@ -63,9 +63,9 @@ int board_sandbox_get_int(struct udevice *dev, int id, int *val)
return -ENOENT; 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 i1 = priv->test_i1;
int i2 = priv->test_i2; int i2 = priv->test_i2;
int index = (i1 * i2) % ARRAY_SIZE(vacation_spots); 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) ...@@ -80,28 +80,28 @@ int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
return -ENOENT; return -ENOENT;
} }
static const struct udevice_id board_sandbox_ids[] = { static const struct udevice_id sysinfo_sandbox_ids[] = {
{ .compatible = "sandbox,board_sandbox" }, { .compatible = "sandbox,sysinfo-sandbox" },
{ /* sentinel */ } { /* sentinel */ }
}; };
static const struct board_ops board_sandbox_ops = { static const struct sysinfo_ops sysinfo_sandbox_ops = {
.detect = board_sandbox_detect, .detect = sysinfo_sandbox_detect,
.get_bool = board_sandbox_get_bool, .get_bool = sysinfo_sandbox_get_bool,
.get_int = board_sandbox_get_int, .get_int = sysinfo_sandbox_get_int,
.get_str = board_sandbox_get_str, .get_str = sysinfo_sandbox_get_str,
}; };
int board_sandbox_probe(struct udevice *dev) int sysinfo_sandbox_probe(struct udevice *dev)
{ {
return 0; return 0;
} }
U_BOOT_DRIVER(board_sandbox) = { U_BOOT_DRIVER(sysinfo_sandbox) = {
.name = "board_sandbox", .name = "sysinfo_sandbox",
.id = UCLASS_BOARD, .id = UCLASS_SYSINFO,
.of_match = board_sandbox_ids, .of_match = sysinfo_sandbox_ids,
.ops = &board_sandbox_ops, .ops = &sysinfo_sandbox_ops,
.priv_auto_alloc_size = sizeof(struct board_sandbox_priv), .priv_auto_alloc_size = sizeof(struct sysinfo_sandbox_priv),
.probe = board_sandbox_probe, .probe = sysinfo_sandbox_probe,
}; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment