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: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/drivers/Kconfig b/drivers/Kconfig
index ed8a39c..b1ada1c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -30,8 +30,6 @@
source "drivers/demo/Kconfig"
-source "drivers/board/Kconfig"
-
source "drivers/ddr/fsl/Kconfig"
source "drivers/dfu/Kconfig"
@@ -114,6 +112,8 @@
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_)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/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/board/sandbox.c b/drivers/board/sandbox.c
deleted file mode 100644
index 50621e4..0000000
--- a/drivers/board/sandbox.c
+++ /dev/null
@@ -1,107 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2018
- * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
- */
-
-#include <common.h>
-#include <dm.h>
-#include <board.h>
-
-#include "sandbox.h"
-
-struct board_sandbox_priv {
- bool called_detect;
- int test_i1;
- int test_i2;
-};
-
-char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng",
- "Carcosa", "Yuggoth", "The Nameless City"};
-
-int board_sandbox_detect(struct udevice *dev)
-{
- struct board_sandbox_priv *priv = dev_get_priv(dev);
-
- priv->called_detect = true;
- priv->test_i2 = 100;
-
- return 0;
-}
-
-int board_sandbox_get_bool(struct udevice *dev, int id, bool *val)
-{
- struct board_sandbox_priv *priv = dev_get_priv(dev);
-
- switch (id) {
- case BOOL_CALLED_DETECT:
- /* Checks if the dectect method has been called */
- *val = priv->called_detect;
- return 0;
- }
-
- return -ENOENT;
-}
-
-int board_sandbox_get_int(struct udevice *dev, int id, int *val)
-{
- struct board_sandbox_priv *priv = dev_get_priv(dev);
-
- switch (id) {
- case INT_TEST1:
- *val = priv->test_i1;
- /* Increments with every call */
- priv->test_i1++;
- return 0;
- case INT_TEST2:
- *val = priv->test_i2;
- /* Decrements with every call */
- priv->test_i2--;
- return 0;
- }
-
- return -ENOENT;
-}
-
-int board_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
-{
- struct board_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);
-
- switch (id) {
- case STR_VACATIONSPOT:
- /* Picks a vacation spot depending on i1 and i2 */
- snprintf(val, size, vacation_spots[index]);
- return 0;
- }
-
- return -ENOENT;
-}
-
-static const struct udevice_id board_sandbox_ids[] = {
- { .compatible = "sandbox,board_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,
-};
-
-int board_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,
-};
diff --git a/drivers/board/Kconfig b/drivers/sysinfo/Kconfig
similarity index 65%
rename from drivers/board/Kconfig
rename to drivers/sysinfo/Kconfig
index 254f657..3914150 100644
--- a/drivers/board/Kconfig
+++ b/drivers/sysinfo/Kconfig
@@ -1,24 +1,24 @@
-menuconfig BOARD
- bool "Device Information"
+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 BOARD
+if SYSINFO
-config SPL_BOARD
+config SPL_SYSINFO
depends on SPL_DM
bool "Enable board driver support in SPL"
-config BOARD_GAZERBEAM
- bool "Enable board driver for the Gazerbeam board"
+config SYSINFO_GAZERBEAM
+ bool "Enable sysinfo 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"
+config SYSINFO_SANDBOX
+ bool "Enable sysinfo driver for the Sandbox board"
help
Support querying device information for the Sandbox boards.
diff --git a/drivers/sysinfo/Makefile b/drivers/sysinfo/Makefile
new file mode 100644
index 0000000..aecf0b0
--- /dev/null
+++ b/drivers/sysinfo/Makefile
@@ -0,0 +1,7 @@
+# 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
diff --git a/drivers/board/gazerbeam.c b/drivers/sysinfo/gazerbeam.c
similarity index 69%
rename from drivers/board/gazerbeam.c
rename to 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 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 @@
};
/**
- * _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 @@
}
/**
- * _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_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 @@
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 @@
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 @@
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 @@
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
similarity index 100%
rename from drivers/board/gazerbeam.h
rename to drivers/sysinfo/gazerbeam.h
diff --git a/drivers/sysinfo/sandbox.c b/drivers/sysinfo/sandbox.c
new file mode 100644
index 0000000..62a1cb4
--- /dev/null
+++ b/drivers/sysinfo/sandbox.c
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018
+ * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <sysinfo.h>
+
+#include "sandbox.h"
+
+struct sysinfo_sandbox_priv {
+ bool called_detect;
+ int test_i1;
+ int test_i2;
+};
+
+char vacation_spots[][64] = {"R'lyeh", "Dreamlands", "Plateau of Leng",
+ "Carcosa", "Yuggoth", "The Nameless City"};
+
+int sysinfo_sandbox_detect(struct udevice *dev)
+{
+ struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
+
+ priv->called_detect = true;
+ priv->test_i2 = 100;
+
+ return 0;
+}
+
+int sysinfo_sandbox_get_bool(struct udevice *dev, int id, bool *val)
+{
+ struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
+
+ switch (id) {
+ case BOOL_CALLED_DETECT:
+ /* Checks if the dectect method has been called */
+ *val = priv->called_detect;
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
+int sysinfo_sandbox_get_int(struct udevice *dev, int id, int *val)
+{
+ struct sysinfo_sandbox_priv *priv = dev_get_priv(dev);
+
+ switch (id) {
+ case INT_TEST1:
+ *val = priv->test_i1;
+ /* Increments with every call */
+ priv->test_i1++;
+ return 0;
+ case INT_TEST2:
+ *val = priv->test_i2;
+ /* Decrements with every call */
+ priv->test_i2--;
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
+int sysinfo_sandbox_get_str(struct udevice *dev, int id, size_t size, char *val)
+{
+ 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);
+
+ switch (id) {
+ case STR_VACATIONSPOT:
+ /* Picks a vacation spot depending on i1 and i2 */
+ snprintf(val, size, vacation_spots[index]);
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
+static const struct udevice_id sysinfo_sandbox_ids[] = {
+ { .compatible = "sandbox,sysinfo-sandbox" },
+ { /* sentinel */ }
+};
+
+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 sysinfo_sandbox_probe(struct udevice *dev)
+{
+ return 0;
+}
+
+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
similarity index 100%
rename from drivers/board/sandbox.h
rename to drivers/sysinfo/sandbox.h
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/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 @@
{
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 @@
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)",