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.
This commit is contained in:
Tom Rini
2024-01-25 11:01:38 -05:00
23 changed files with 160 additions and 55 deletions

View File

@@ -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());

View File

@@ -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[] = {};

View File

@@ -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??? */

View File

@@ -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);

View File

@@ -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"

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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>

View File

@@ -6,6 +6,8 @@
#ifndef __PINCTRL_H
#define __PINCTRL_H
#include <linux/errno.h>
#define PINNAME_SIZE 10
#define PINMUX_SIZE 90

View File

@@ -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

View File

@@ -6,6 +6,8 @@
#ifndef __I2C_EEPROM
#define __I2C_EEPROM
#include <linux/errno.h>
struct udevice;
struct i2c_eeprom_ops {

View File

@@ -6,6 +6,8 @@
#ifndef NVMEM_H
#define NVMEM_H
#include <linux/errno.h>
/**
* DOC: Design
*

View File

@@ -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

View File

@@ -7,6 +7,8 @@
#ifndef _INCLUDE_REGULATOR_H_
#define _INCLUDE_REGULATOR_H_
#include <linux/errno.h>
struct udevice;
/**

View File

@@ -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

View File

@@ -7,6 +7,8 @@
#ifndef __SOC_H
#define __SOC_H
#include <linux/errno.h>
#define SOC_MAX_STR_SIZE 128
struct udevice;

View File

@@ -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) \

View File

@@ -7,6 +7,8 @@
#ifndef __SYSINFO_H__
#define __SYSINFO_H__
#include <linux/errno.h>
struct udevice;
/*

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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,9 +766,13 @@ 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));

View File

@@ -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