aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini2024-01-25 11:01:38 -0500
committerTom Rini2024-01-25 11:01:38 -0500
commite7f9e5eb584dd0b5d1b1ff82fe607d6da9940cc6 (patch)
tree5d78cc0c1339a9d7196876aa029f6e94ca247e72
parent15e7927b5a2d33666af19879577bf0c30ab088fe (diff)
parent53c3e386063b9e1ab955d4658a035f1eea8a1cc0 (diff)
Merge branch '2024-01-24-assorted-fixes-and-updates'
- Increase SYS_MAXARGS default, verdin-am62 improvements (and required cleanup), assorted cleanups throughout the code base.
-rw-r--r--arch/arm/mach-k3/am625_fdt.c23
-rw-r--r--arch/arm/mach-k3/include/mach/am62_hardware.h39
-rw-r--r--board/ti/common/board_detect.c4
-rw-r--r--board/toradex/verdin-am62/verdin-am62.c52
-rw-r--r--cmd/Kconfig2
-rw-r--r--cmd/bootmenu.c10
-rw-r--r--common/console.c27
-rw-r--r--drivers/reset/reset-hisilicon.c15
-rw-r--r--include/dfu.h1
-rw-r--r--include/dm/pinctrl.h2
-rw-r--r--include/hwspinlock.h2
-rw-r--r--include/i2c_eeprom.h2
-rw-r--r--include/nvmem.h2
-rw-r--r--include/power-domain.h2
-rw-r--r--include/power/regulator.h2
-rw-r--r--include/remoteproc.h1
-rw-r--r--include/soc.h2
-rw-r--r--include/spi-mem.h2
-rw-r--r--include/sysinfo.h2
-rw-r--r--include/tlv_eeprom.h2
-rw-r--r--lib/charset.c4
-rw-r--r--test/unicode_ut.c11
-rw-r--r--tools/docker/Dockerfile6
23 files changed, 160 insertions, 55 deletions
diff --git a/arch/arm/mach-k3/am625_fdt.c b/arch/arm/mach-k3/am625_fdt.c
index 37806907af1..970dd3447de 100644
--- a/arch/arm/mach-k3/am625_fdt.c
+++ b/arch/arm/mach-k3/am625_fdt.c
@@ -38,29 +38,6 @@ static void fdt_fixup_pru_node_am625(void *blob, int has_pru)
fdt_del_node_path(blob, "/bus@f0000/pruss@30040000");
}
-static int k3_get_core_nr(void)
-{
- u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
-
- return (full_devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT;
-}
-
-static int k3_has_pru(void)
-{
- u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
- u32 feature_mask = (full_devid & JTAG_DEV_FEATURES_MASK) >>
- JTAG_DEV_FEATURES_SHIFT;
-
- return !(feature_mask & JTAG_DEV_FEATURE_NO_PRU);
-}
-
-static int k3_has_gpu(void)
-{
- u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
-
- return (full_devid & JTAG_DEV_GPU_MASK) >> JTAG_DEV_GPU_SHIFT;
-}
-
int ft_system_setup(void *blob, struct bd_info *bd)
{
fdt_fixup_cores_nodes_am625(blob, k3_get_core_nr());
diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h b/arch/arm/mach-k3/include/mach/am62_hardware.h
index acd2d109c2c..54380f36e16 100644
--- a/arch/arm/mach-k3/include/mach/am62_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
@@ -79,6 +79,45 @@
#define TI_SRAM_SCRATCH_BOARD_EEPROM_START 0x43c30000
+static inline int k3_get_core_nr(void)
+{
+ u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
+
+ return (full_devid & JTAG_DEV_CORE_NR_MASK) >> JTAG_DEV_CORE_NR_SHIFT;
+}
+
+static inline char k3_get_speed_grade(void)
+{
+ u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
+ u32 speed_grade = (full_devid & JTAG_DEV_SPEED_MASK) >>
+ JTAG_DEV_SPEED_SHIFT;
+
+ return 'A' - 1 + speed_grade;
+}
+
+static inline int k3_get_temp_grade(void)
+{
+ u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
+
+ return (full_devid & JTAG_DEV_TEMP_MASK) >> JTAG_DEV_TEMP_SHIFT;
+}
+
+static inline int k3_has_pru(void)
+{
+ u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
+ u32 feature_mask = (full_devid & JTAG_DEV_FEATURES_MASK) >>
+ JTAG_DEV_FEATURES_SHIFT;
+
+ return !(feature_mask & JTAG_DEV_FEATURE_NO_PRU);
+}
+
+static inline int k3_has_gpu(void)
+{
+ u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
+
+ return (full_devid & JTAG_DEV_GPU_MASK) >> JTAG_DEV_GPU_SHIFT;
+}
+
#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
static const u32 put_device_ids[] = {};
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 0ec6d1aaf4c..38e23ccbb67 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -129,7 +129,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
rc = dm_i2c_read(dev, 0x1, &offset_test, sizeof(offset_test));
- if (*((u32 *)ep) != (header & 0xFF))
+ if (offset_test != ((header >> 8) & 0xFF))
one_byte_addressing = false;
/* Corrupted data??? */
@@ -181,7 +181,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
rc = i2c_read(dev_addr, 0x1, byte, &offset_test, sizeof(offset_test));
- if (*((u32 *)ep) != (header & 0xFF))
+ if (offset_test != ((header >> 8) & 0xFF))
one_byte_addressing = false;
/* Corrupted data??? */
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c
index 2718263eb19..395eb365a0b 100644
--- a/board/toradex/verdin-am62/verdin-am62.c
+++ b/board/toradex/verdin-am62/verdin-am62.c
@@ -14,10 +14,13 @@
#include <fdt_support.h>
#include <init.h>
#include <k3-ddrss.h>
+#include <power/regulator.h>
#include <spl.h>
#include "../common/tdx-cfg-block.h"
+#define VDD_CORE_REG "buck1"
+
DECLARE_GLOBAL_DATA_PTR;
int board_init(void)
@@ -50,9 +53,37 @@ int board_fit_config_name_match(const char *name)
}
#endif
+static u32 get_vdd_core_nominal(void)
+{
+ int core_uvolt;
+
+ switch (k3_get_speed_grade()) {
+ case 'G':
+ case 'K':
+ case 'S':
+ core_uvolt = 750000;
+ break;
+ case 'T':
+ default:
+ core_uvolt = 850000;
+ break;
+ }
+ return core_uvolt;
+}
+
#if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)
{
+ int core_uvolt;
+
+ core_uvolt = get_vdd_core_nominal();
+ if (core_uvolt != 850000) {
+ do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1",
+ "regulator-max-microvolt", core_uvolt, 0);
+ do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1",
+ "regulator-min-microvolt", core_uvolt, 0);
+ }
+
return ft_common_board_setup(blob, bd);
}
#endif
@@ -87,6 +118,22 @@ static void select_dt_from_module_version(void)
int board_late_init(void)
{
+ int ret;
+ int core_uvolt;
+ struct udevice *dev = NULL;
+
+ core_uvolt = get_vdd_core_nominal();
+ if (core_uvolt != 850000) {
+ /* Set CPU core voltage to 0.75V for slower speed grades */
+ ret = regulator_get_by_devname(VDD_CORE_REG, &dev);
+ if (ret)
+ pr_err("VDD CORE Regulator get error: %d\n", ret);
+
+ ret = regulator_set_value_force(dev, core_uvolt);
+ if (ret)
+ pr_err("VDD CORE Regulator value setting error: %d\n", ret);
+ }
+
select_dt_from_module_version();
return 0;
@@ -102,12 +149,13 @@ void spl_board_init(void)
{
u32 val;
- /* Set USB0 PHY core voltage to 0.85V */
+ /* Clear USB0_PHY_CTRL_CORE_VOLTAGE */
+ /* TI recommends to clear the bit independent of VDDA_CORE_USB */
val = readl(CTRLMMR_USB0_PHY_CTRL);
val &= ~(CORE_VOLTAGE);
writel(val, CTRLMMR_USB0_PHY_CTRL);
- /* Set USB1 PHY core voltage to 0.85V */
+ /* Clear USB1_PHY_CTRL_CORE_VOLTAGE */
val = readl(CTRLMMR_USB1_PHY_CTRL);
val &= ~(CORE_VOLTAGE);
writel(val, CTRLMMR_USB1_PHY_CTRL);
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 58ab357c707..06aae30df30 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -94,7 +94,7 @@ config SYS_PROMPT_HUSH_PS2
config SYS_MAXARGS
int "Maximum number arguments accepted by commands"
- default 16
+ default 64
config SYS_XTRACE
bool "Command execution tracer"
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 987b16889f8..78184fccab2 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -119,7 +119,7 @@ static char *bootmenu_choice_entry(void *data)
iter = iter->next;
return iter->key;
case BKEY_QUIT:
- /* Quit by choosing the last entry - U-Boot console */
+ /* Quit by choosing the last entry */
iter = menu->first;
while (iter->next)
iter = iter->next;
@@ -361,15 +361,15 @@ static struct bootmenu_data *bootmenu_create(int delay)
}
#endif
- /* Add U-Boot console entry at the end */
+ /* Add Exit entry at the end */
if (i <= MAX_COUNT - 1) {
entry = malloc(sizeof(struct bootmenu_entry));
if (!entry)
goto cleanup;
- /* Add Quit entry if entering U-Boot console is disabled */
+ /* Add Quit entry if exiting bootmenu is disabled */
if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE))
- entry->title = strdup("U-Boot console");
+ entry->title = strdup("Exit");
else
entry->title = strdup("Quit");
@@ -532,7 +532,7 @@ static enum bootmenu_ret bootmenu_show(int delay)
title = strdup(iter->title);
command = strdup(iter->command);
- /* last entry is U-Boot console or Quit */
+ /* last entry exits bootmenu */
if (iter->num == iter->menu->count - 1) {
ret = BOOTMENU_RET_QUIT;
goto cleanup;
diff --git a/common/console.c b/common/console.c
index cad65891fc9..aa3053bc441 100644
--- a/common/console.c
+++ b/common/console.c
@@ -1049,9 +1049,16 @@ int console_clear(void)
return 0;
}
+static char *get_stdio(const u8 std)
+{
+ return stdio_devices[std] ? stdio_devices[std]->name : "No devices available!";
+}
+
static void stdio_print_current_devices(void)
{
- char *stdinname, *stdoutname, *stderrname;
+ char *stdinname = NULL;
+ char *stdoutname = NULL;
+ char *stderrname = NULL;
if (CONFIG_IS_ENABLED(CONSOLE_MUX) &&
CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)) {
@@ -1059,22 +1066,12 @@ static void stdio_print_current_devices(void)
stdinname = env_get("stdin");
stdoutname = env_get("stdout");
stderrname = env_get("stderr");
-
- stdinname = stdinname ? : "No input devices available!";
- stdoutname = stdoutname ? : "No output devices available!";
- stderrname = stderrname ? : "No error devices available!";
- } else {
- stdinname = stdio_devices[stdin] ?
- stdio_devices[stdin]->name :
- "No input devices available!";
- stdoutname = stdio_devices[stdout] ?
- stdio_devices[stdout]->name :
- "No output devices available!";
- stderrname = stdio_devices[stderr] ?
- stdio_devices[stderr]->name :
- "No error devices available!";
}
+ stdinname = stdinname ? : get_stdio(stdin);
+ stdoutname = stdoutname ? : get_stdio(stdout);
+ stderrname = stderrname ? : get_stdio(stderr);
+
/* Print information */
puts("In: ");
printf("%s\n", stdinname);
diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c
index 8152cec2271..85e02b296b0 100644
--- a/drivers/reset/reset-hisilicon.c
+++ b/drivers/reset/reset-hisilicon.c
@@ -49,7 +49,18 @@ static int hisi_reset_assert(struct reset_ctl *rst)
static int hisi_reset_of_xlate(struct reset_ctl *rst,
struct ofnode_phandle_args *args)
{
- if (args->args_count != 3) {
+ unsigned long polarity;
+
+ switch (args->args_count) {
+ case 2:
+ polarity = ASSERT_SET;
+ break;
+
+ case 3:
+ polarity = args->args[2];
+ break;
+
+ default:
debug("Invalid args_count: %d\n", args->args_count);
return -EINVAL;
}
@@ -57,7 +68,7 @@ static int hisi_reset_of_xlate(struct reset_ctl *rst,
/* Use .data field as register offset and .id field as bit shift */
rst->data = args->args[0];
rst->id = args->args[1];
- rst->polarity = args->args[2];
+ rst->polarity = polarity;
return 0;
}
diff --git a/include/dfu.h b/include/dfu.h
index 2f42781888a..fa1918cd663 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -10,6 +10,7 @@
#ifndef __DFU_ENTITY_H_
#define __DFU_ENTITY_H_
+#include <linux/errno.h>
#include <linux/list.h>
#include <mmc.h>
#include <spi_flash.h>
diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h
index 70d8cc5ecac..e41baea6200 100644
--- a/include/dm/pinctrl.h
+++ b/include/dm/pinctrl.h
@@ -6,6 +6,8 @@
#ifndef __PINCTRL_H
#define __PINCTRL_H
+#include <linux/errno.h>
+
#define PINNAME_SIZE 10
#define PINMUX_SIZE 90
diff --git a/include/hwspinlock.h b/include/hwspinlock.h
index d8556c0b4b4..dd5135442ec 100644
--- a/include/hwspinlock.h
+++ b/include/hwspinlock.h
@@ -6,6 +6,8 @@
#ifndef _HWSPINLOCK_H_
#define _HWSPINLOCK_H_
+#include <linux/errno.h>
+
/**
* Implement a hwspinlock uclass.
* Hardware spinlocks are used to perform hardware protection of
diff --git a/include/i2c_eeprom.h b/include/i2c_eeprom.h
index 32dcb034973..cba991e3574 100644
--- a/include/i2c_eeprom.h
+++ b/include/i2c_eeprom.h
@@ -6,6 +6,8 @@
#ifndef __I2C_EEPROM
#define __I2C_EEPROM
+#include <linux/errno.h>
+
struct udevice;
struct i2c_eeprom_ops {
diff --git a/include/nvmem.h b/include/nvmem.h
index 822e698bdd4..e6a8a98828b 100644
--- a/include/nvmem.h
+++ b/include/nvmem.h
@@ -6,6 +6,8 @@
#ifndef NVMEM_H
#define NVMEM_H
+#include <linux/errno.h>
+
/**
* DOC: Design
*
diff --git a/include/power-domain.h b/include/power-domain.h
index 2ff6c77cd76..18525073e5e 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -6,6 +6,8 @@
#ifndef _POWER_DOMAIN_H
#define _POWER_DOMAIN_H
+#include <linux/errno.h>
+
/**
* A power domain is a portion of an SoC or chip that is powered by a
* switchable source of power. In many cases, software has control over the
diff --git a/include/power/regulator.h b/include/power/regulator.h
index 200652cb3d7..bb07a814c79 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -7,6 +7,8 @@
#ifndef _INCLUDE_REGULATOR_H_
#define _INCLUDE_REGULATOR_H_
+#include <linux/errno.h>
+
struct udevice;
/**
diff --git a/include/remoteproc.h b/include/remoteproc.h
index a11dc8a9b6c..91a88791a47 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -14,6 +14,7 @@
* platforms have moved to dm/fdt.
*/
#include <dm/platdata.h> /* For platform data support - non dt world */
+#include <linux/errno.h>
/**
* struct fw_rsc_hdr - firmware resource entry header
diff --git a/include/soc.h b/include/soc.h
index 850db28b76a..b8cfc507706 100644
--- a/include/soc.h
+++ b/include/soc.h
@@ -7,6 +7,8 @@
#ifndef __SOC_H
#define __SOC_H
+#include <linux/errno.h>
+
#define SOC_MAX_STR_SIZE 128
struct udevice;
diff --git a/include/spi-mem.h b/include/spi-mem.h
index b07cf2ed83d..3c8e95b6f53 100644
--- a/include/spi-mem.h
+++ b/include/spi-mem.h
@@ -11,6 +11,8 @@
#ifndef __UBOOT_SPI_MEM_H
#define __UBOOT_SPI_MEM_H
+#include <linux/errno.h>
+
struct udevice;
#define SPI_MEM_OP_CMD(__opcode, __buswidth) \
diff --git a/include/sysinfo.h b/include/sysinfo.h
index f2c1aa29d18..524c7d6b223 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -7,6 +7,8 @@
#ifndef __SYSINFO_H__
#define __SYSINFO_H__
+#include <linux/errno.h>
+
struct udevice;
/*
diff --git a/include/tlv_eeprom.h b/include/tlv_eeprom.h
index fd45e5f6ebb..2b1e19b2bdd 100644
--- a/include/tlv_eeprom.h
+++ b/include/tlv_eeprom.h
@@ -7,6 +7,8 @@
#ifndef __TLV_EEPROM_H_
#define __TLV_EEPROM_H_
+#include <linux/errno.h>
+
/*
* The Definition of the TlvInfo EEPROM format can be found at onie.org or
* github.com/onie
diff --git a/lib/charset.c b/lib/charset.c
index 89057ef7ce2..2b43175b1d9 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -570,6 +570,10 @@ int utf8_to_utf32_stream(u8 c, char *buffer)
}
if (pos == end)
return 0;
+ /*
+ * Appending the byte lead to an invalid UTF-8 byte sequence.
+ * Consider it as the start of a new code sequence.
+ */
*buffer = 0;
}
}
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 1d0d90c2d73..47c3f52774c 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -752,9 +752,10 @@ static int unicode_test_utf8_to_utf32_stream(struct unit_test_state *uts)
const u32 u1[] = {0x55, 0x2D, 0x42, 0x6F, 0x6F, 0x74, 0x0000};
const u32 u2[] = {0x6B, 0x61, 0x66, 0x62, 0xE1, 0x74, 0x75, 0x72, 0x00};
- const u32 u3[] = {0x0392, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x74,
- 0x20, 0x42, 0x00};
+ const u32 u3[] = {0x6f5c, 0x6c34, 0x8266};
const u32 u4[] = {0x6A, 0x32, 0x6C, 0x00};
+ const u32 u5[] = {0x0392, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x74,
+ 0x20, 0x42, 0x00};
memset(buf, 0, sizeof(buf));
utf8_to_utf32_stream_helper(d1, buf);
@@ -765,10 +766,14 @@ static int unicode_test_utf8_to_utf32_stream(struct unit_test_state *uts)
ut_asserteq_mem(u2, buf, sizeof(u2));
memset(buf, 0, sizeof(buf));
- utf8_to_utf32_stream_helper(d5, buf);
+ utf8_to_utf32_stream_helper(d3, buf);
ut_asserteq_mem(u3, buf, sizeof(u3));
memset(buf, 0, sizeof(buf));
+ utf8_to_utf32_stream_helper(d5, buf);
+ ut_asserteq_mem(u5, buf, sizeof(u5));
+
+ memset(buf, 0, sizeof(buf));
utf8_to_utf32_stream_helper(j2, buf);
ut_asserteq_mem(u4, buf, sizeof(u4));
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 0e2dd0a6a94..6122776bc64 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -240,12 +240,14 @@ USER uboot:uboot
# COPY / ADD directives don't work as we need them to.
RUN wget -O /tmp/pytest-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/test/py/requirements.txt
RUN wget -O /tmp/sphinx-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/doc/sphinx/requirements.txt
+RUN wget -O /tmp/buildman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/buildman/requirements.txt
RUN virtualenv -p /usr/bin/python3 /tmp/venv && \
. /tmp/venv/bin/activate && \
pip install -r /tmp/pytest-requirements.txt \
- -r /tmp/sphinx-requirements.txt && \
+ -r /tmp/sphinx-requirements.txt \
+ -r /tmp/buildman-requirements.txt && \
deactivate && \
- rm -rf /tmp/venv /tmp/pytest-requirements.txt /tmp/sphinx-requirements.txt
+ rm -rf /tmp/venv /tmp/*-requirements.txt
# Create the buildman config file
RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman