Skip to contentSkip to conversation

x86: Minor improvements mostly for image loading

PATCH Superseded Simon Glass 2 participants 7 messages Feb 6, 2021 – Mar 22, 2021 x86

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover x86: Minor improvements mostly for image loading

This series provides a few improvements for loading of images. It also provides a way to show more detailed model information as well as an of-platdata fix noticed recently.

Note that this series depends on the GPIO series here:

http://patchwork.ozlabs.org/project/uboot/list/?series=226118

Changes in v4:
- Rebase to x86/master (but will not build until GPIO series lands)
- Update cover letter

Changes in v3:
- Rebase to master
- Rebase to master
- Drop patches previously applied

Changes in v2:
- Fix two missing asterisks in comments

Simon Glass (2):
sysinfo: Allow showing model info from sysinfo
x86: coral: Show memory config and SKU ID on startup

 arch/x86/dts/chromebook_coral.dts             |  11 ++
 board/google/chromebook_coral/coral.c         | 139 +++++++++++++++++-
 board/google/chromebook_coral/variant_gpio.h  |   6 -
 common/board_info.c                           |  37 ++++-
 .../sysinfo/google,coral.txt                  |  37 +++++
 include/sysinfo.h                             |   4 +
 6 files changed, 212 insertions(+), 22 deletions(-)
 create mode 100644 doc/device-tree-bindings/sysinfo/google,coral.txt
Signature · 1 line
2.30.0.478.g8a0d178c01-goog
#1 lore raw

PATCH v4 1/2 sysinfo: Allow showing model info from sysinfo

Some boards may want to show the SKU ID or other information obtained at runtime. Allow this to come from sysinfo. The board can then provide a sysinfo driver to provide it.

---

(no changes since v3)

Changes in v3:
- Rebase to master

 common/board_info.c | 37 +++++++++++++++++++++++++++++--------
 include/sysinfo.h   |  4 ++++
 2 files changed, 33 insertions(+), 8 deletions(-)
common/board_info.c +29 -8
index a6db087f960..20a2dea1f35 100644
@@ -1,30 +1,51 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <dm.h>
 #include <init.h>
+#include <sysinfo.h>
 #include <linux/libfdt.h>
 #include <linux/compiler.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 int __weak checkboard(void)
 {
 	return 0;
 }
 
 /*
- * If the root node of the DTB has a "model" property, show it.
+ * Check sysinfo for board information. Failing that if the root node of the DTB
+ * has a "model" property, show it.
+ *
  * Then call checkboard().
  */
 int __weak show_board_info(void)
 {
-#ifdef CONFIG_OF_CONTROL
-	DECLARE_GLOBAL_DATA_PTR;
-	const char *model;
+	if (IS_ENABLED(CONFIG_OF_CONTROL)) {
+		struct udevice *dev;
+		const char *model;
+		char str[80];
+		int ret = -ENOSYS;
+
+		if (IS_ENABLED(CONFIG_SYSINFO)) {
+			/* This might provide more detail */
+			ret = uclass_first_device_err(UCLASS_SYSINFO, &dev);
+			if (!ret)
+				ret = sysinfo_get_str(dev,
+						      SYSINFO_ID_BOARD_MODEL,
+						      sizeof(str), str);
+		}
 
-	model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+		/* Fail back to the main 'model' if available */
+		if (ret)
+			model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+		else
+			model = str;
 
-	if (model)
-		printf("Model: %s\n", model);
-#endif
+		if (model)
+			printf("Model: %s\n", model);
+	}
 
 	return checkboard();
 }
include/sysinfo.h +4 -0
index 743f3554659..f4ffb1a3503 100644
@@ -35,9 +35,13 @@
 enum sysinfo_id {
 	SYSINFO_ID_NONE,
 
+	/* For SMBIOS tables */
 	SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
 	SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
 
+	/* For show_board_info() */
+	SYSINFO_ID_BOARD_MODEL,
+
 	/* First value available for downstream/board used */
 	SYSINFO_ID_USER = 0x1000,
 };
Signature · 1 line
2.30.0.478.g8a0d178c01-goog
#2 lore raw

PATCH v4 2/2 x86: coral: Show memory config and SKU ID on startup

In reply to Simon Glass

Provide the model information through sysinfo so that it shows up on boot. For memconfig 4 pins are provided, for 16 combinations. For SKU ID there are two options:

- two pins provided in a ternary arrangement, for 9 combinations.
- reading from the EC

Add a binding doc and drop the unused #defines as well.

Example:

U-Boot 2021.01-rc5

   CPU:   Intel(R) Celeron(R) CPU N3450 @ 1.10GHz
   DRAM:  3.9 GiB
   MMC:   sdmmc at 1b,0: 1, emmc at 1c,0: 2

Video: 1024x768x32 @ b0000000
Model: Google Coral (memconfig 5, SKU 3)

This depends on the GPIO series:

http://patchwork.ozlabs.org/project/uboot/list/?series=228126

---

Changes in v4:
- Rebase to x86/master (but will not build until GPIO series lands)
- Update cover letter

Changes in v3:
- Rebase to master
- Drop patches previously applied

Changes in v2:
- Fix two missing asterisks in comments

 arch/x86/dts/chromebook_coral.dts             |  11 ++
 board/google/chromebook_coral/coral.c         | 139 +++++++++++++++++-
 board/google/chromebook_coral/variant_gpio.h  |   6 -
 .../sysinfo/google,coral.txt                  |  37 +++++
 4 files changed, 179 insertions(+), 14 deletions(-)
 create mode 100644 doc/device-tree-bindings/sysinfo/google,coral.txt
arch/x86/dts/chromebook_coral.dts +11 -0
index 2ffe3b423c3..18bbafe5981 100644
@@ -55,6 +55,17 @@
 		recovery-gpios = <&gpio_nw (-1) GPIO_ACTIVE_LOW>;
 		write-protect-gpios = <&gpio_nw GPIO_75 GPIO_ACTIVE_HIGH>;
 		phase-enforce-gpios = <&gpio_n GPIO_10 GPIO_ACTIVE_HIGH>;
+		memconfig-gpios = <&gpio_nw GPIO_101 GPIO_ACTIVE_HIGH
+			&gpio_nw GPIO_102 GPIO_ACTIVE_HIGH
+			&gpio_n GPIO_38 GPIO_ACTIVE_HIGH
+			&gpio_n GPIO_45 GPIO_ACTIVE_HIGH>;
+
+		/*
+		 * This is used for reef only:
+		 *
+		 * skuconfig-gpios = <&gpio_nw GPIO_16 GPIO_ACTIVE_HIGH
+		 *	&gpio_nw GPIO_17 GPIO_ACTIVE_HIGH>;
+		 */
 		smbios {
 			/* Type 1 table */
 			system {
board/google/chromebook_coral/coral.c +131 -8

185 lines not on this page · raw message

board/google/chromebook_coral/variant_gpio.h +0 -6
index f516d88be5c..403e2419a71 100644
@@ -34,12 +34,6 @@
 /* Determine if board is in final shipping mode. */
 #define GPIO_SHIP_MODE	GPIO_10
 
-/*  Memory SKU GPIOs. */
-#define MEM_CONFIG3	GPIO_45
-#define MEM_CONFIG2	GPIO_38
-#define MEM_CONFIG1	GPIO_102
-#define MEM_CONFIG0	GPIO_101
-
 /* DMIC_CONFIG_PIN: High for 1-DMIC and low for 4-DMIC's */
 #define DMIC_CONFIG_PIN	GPIO_17
 
doc/device-tree-bindings/sysinfo/google,coral.txt new file +37 -0
new file mode 100644
index 00000000000..d8a1a79687e
@@ -0,0 +1,37 @@
+Google Coral sysinfo information
+================================
+
+This binding allows information about the board to be described. It includes
+the SMBIOS binding as well.
+
+Required properties:
+
+  - compatible: "google,coral"
+  - recovery-gpios: GPIO to use for recovery button (-1 if none)
+  - wite-protect-gpios: GPIO to use for write-protect screw
+  - phase-enforce-gpios: GPIO to indicate the board is in final ship mode
+  - memconfig-gpios: 4 GPIOs to use to read memory config (as base2 int)
+
+Optional properties:
+  - skuconfig-gpios: 2 GPIOs to use to read SKU ID. If not present, the
+       Chromium OS EC SKU_ID is used instead
+
+Example:
+
+board: board {
+	compatible = "google,coral";
+	recovery-gpios = <&gpio_nw (-1) GPIO_ACTIVE_LOW>;
+	write-protect-gpios = <&gpio_nw GPIO_75 GPIO_ACTIVE_HIGH>;
+	phase-enforce-gpios = <&gpio_n GPIO_10 GPIO_ACTIVE_HIGH>;
+	memconfig-gpios = <&gpio_nw GPIO_101 GPIO_ACTIVE_HIGH
+		&gpio_nw GPIO_102 GPIO_ACTIVE_HIGH
+		&gpio_n GPIO_38 GPIO_ACTIVE_HIGH
+		&gpio_n GPIO_45 GPIO_ACTIVE_HIGH>;
+
+	/*
+	 * This is used for reef only:
+	 *
+	 * skuconfig-gpios = <&gpio_nw GPIO_16 GPIO_ACTIVE_HIGH
+	 *	&gpio_nw GPIO_17 GPIO_ACTIVE_HIGH>;
+	 */
+ };
Signature · 1 line
2.30.0.478.g8a0d178c01-goog
#3 lore raw

PATCH v4 2/2 x86: coral: Show memory config and SKU ID on startup

Hi Simon,

Quoted 20 lines · Simon Glass

Provide the model information through sysinfo so that it shows up on boot. For memconfig 4 pins are provided, for 16 combinations. For SKU ID there are two options:

- two pins provided in a ternary arrangement, for 9 combinations.
- reading from the EC

Add a binding doc and drop the unused #defines as well.

Example:

   U-Boot 2021.01-rc5

   CPU:   Intel(R) Celeron(R) CPU N3450 @ 1.10GHz
   DRAM:  3.9 GiB
   MMC:   sdmmc at 1b,0: 1, emmc at 1c,0: 2
   Video: 1024x768x32 @ b0000000
   Model: Google Coral (memconfig 5, SKU 3)
Quoted 3 lines

This depends on the GPIO series:

   http://patchwork.ozlabs.org/project/uboot/list/?series=228126

It looks this series is applied as patchwork returns nothing?

But the CI still fails
https://source.denx.de/u-boot/custodians/u-boot-x86/-/jobs/235619

Quoted 9 lines

---

Changes in v4:
- Rebase to x86/master (but will not build until GPIO series lands)
- Update cover letter

Regards,
Bin

#4 lore raw

PATCH v4 2/2 x86: coral: Show memory config and SKU ID on startup

Hi Bin,

Quoted 24 lines · Bin Meng

Hi Simon,

Quoted 20 lines · Simon Glass

Provide the model information through sysinfo so that it shows up on boot. For memconfig 4 pins are provided, for 16 combinations. For SKU ID there are two options:

- two pins provided in a ternary arrangement, for 9 combinations.
- reading from the EC

Add a binding doc and drop the unused #defines as well.

Example:

   U-Boot 2021.01-rc5

   CPU:   Intel(R) Celeron(R) CPU N3450 @ 1.10GHz
   DRAM:  3.9 GiB
   MMC:   sdmmc at 1b,0: 1, emmc at 1c,0: 2
   Video: 1024x768x32 @ b0000000
   Model: Google Coral (memconfig 5, SKU 3)
Quoted 8 lines
Quoted 3 lines

This depends on the GPIO series:

   http://patchwork.ozlabs.org/project/uboot/list/?series=228126

It looks this series is applied as patchwork returns nothing?

But the CI still fails
https://source.denx.de/u-boot/custodians/u-boot-x86/-/jobs/235619

Can you apply it to u-boot-x86/next perhaps? The GPIO series was applied to -next, not -master.

Regards,
Simon

#5 lore raw

PATCH v4 2/2 x86: coral: Show memory config and SKU ID on startup

Hi Bin,

Quoted 32 lines · Simon Glass

Hi Bin,

Quoted 28 lines · Bin Meng

Hi Simon,

Quoted 23 lines · Simon Glass

Provide the model information through sysinfo so that it shows up on boot. For memconfig 4 pins are provided, for 16 combinations. For SKU ID there are two options:

- two pins provided in a ternary arrangement, for 9 combinations.
- reading from the EC

Add a binding doc and drop the unused #defines as well.

Example:

   U-Boot 2021.01-rc5

   CPU:   Intel(R) Celeron(R) CPU N3450 @ 1.10GHz
   DRAM:  3.9 GiB
   MMC:   sdmmc at 1b,0: 1, emmc at 1c,0: 2
   Video: 1024x768x32 @ b0000000
   Model: Google Coral (memconfig 5, SKU 3)

This depends on the GPIO series:

   http://patchwork.ozlabs.org/project/uboot/list/?series=228126
Quoted 7 lines
Quoted 4 lines

It looks this series is applied as patchwork returns nothing?

But the CI still fails
https://source.denx.de/u-boot/custodians/u-boot-x86/-/jobs/235619

Can you apply it to u-boot-x86/next perhaps? The GPIO series was applied to -next, not -master.

I've sent a new version, v5, which should apply on the U-Boot -next branch. Are you keeping a -next for x86? If not I am happy to apply it via dm.

Regards,
Simon

#6 lore raw

PATCH v4 2/2 x86: coral: Show memory config and SKU ID on startup

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Bin,

Quoted 37 lines · Simon Glass

Hi Bin,

Quoted 32 lines · Bin Meng

Hi Simon,

Quoted 20 lines · Simon Glass

Provide the model information through sysinfo so that it shows up on boot. For memconfig 4 pins are provided, for 16 combinations. For SKU ID there are two options:

- two pins provided in a ternary arrangement, for 9 combinations.
- reading from the EC

Add a binding doc and drop the unused #defines as well.

Example:

   U-Boot 2021.01-rc5

   CPU:   Intel(R) Celeron(R) CPU N3450 @ 1.10GHz
   DRAM:  3.9 GiB
   MMC:   sdmmc at 1b,0: 1, emmc at 1c,0: 2
   Video: 1024x768x32 @ b0000000
   Model: Google Coral (memconfig 5, SKU 3)
Quoted 3 lines

This depends on the GPIO series:

   http://patchwork.ozlabs.org/project/uboot/list/?series=228126

It looks this series is applied as patchwork returns nothing?

But the CI still fails
https://source.denx.de/u-boot/custodians/u-boot-x86/-/jobs/235619

Quoted 6 lines
Quoted 2 lines

Can you apply it to u-boot-x86/next perhaps? The GPIO series was applied to -next, not -master.

I've sent a new version, v5, which should apply on the U-Boot -next branch. Are you keeping a -next for x86? If not I am happy to apply it via dm.

No, I did not track u-boot/next in the x86 repo. Feel free to apply this series via dm.

Regards,
Bin