summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/scsi.c8
-rw-r--r--configs/qcom_qcs9100_defconfig2
-rw-r--r--drivers/clk/clk_scmi.c12
-rw-r--r--drivers/firmware/scmi/pinctrl.c2
-rw-r--r--drivers/gpio/Kconfig6
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/gpio_scmi.c248
-rw-r--r--drivers/net/fsl-mc/mc.c45
-rw-r--r--drivers/pinctrl/pinctrl-scmi.c151
-rw-r--r--drivers/scsi/scsi-uclass.c8
-rw-r--r--env/Kconfig30
-rw-r--r--env/scsi.c28
-rw-r--r--include/configs/ls1028ardb.h4
-rw-r--r--include/configs/ls1043a_common.h2
-rw-r--r--include/configs/ls1043aqds.h5
-rw-r--r--include/configs/ls1043ardb.h10
-rw-r--r--include/configs/ls1046a_common.h2
-rw-r--r--include/configs/ls1046afrwy.h6
-rw-r--r--include/configs/ls1046aqds.h5
-rw-r--r--include/configs/ls1046ardb.h10
-rw-r--r--include/configs/lx2160a_common.h2
-rw-r--r--include/configs/lx2160ardb.h5
-rw-r--r--include/scsi.h5
-rw-r--r--test/py/tests/test_scsi.py10
-rw-r--r--tools/u_boot_pylib/pyproject.toml6
25 files changed, 462 insertions, 151 deletions
diff --git a/cmd/scsi.c b/cmd/scsi.c
index 9f7613424e5..ad7d8a4b664 100644
--- a/cmd/scsi.c
+++ b/cmd/scsi.c
@@ -31,13 +31,6 @@ static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc,
int ret;
if (argc == 2) {
- if (strncmp(argv[1], "res", 3) == 0) {
- printf("\nReset SCSI\n");
- ret = scsi_scan(true);
- if (ret)
- return CMD_RET_FAILURE;
- return ret;
- }
if (strncmp(argv[1], "scan", 4) == 0) {
ret = scsi_scan(true);
if (ret)
@@ -52,7 +45,6 @@ static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc,
U_BOOT_CMD(
scsi, 5, 1, do_scsi,
"SCSI sub-system",
- "reset - reset SCSI controller\n"
"scsi info - show available SCSI devices\n"
"scsi scan - (re-)scan SCSI bus\n"
"scsi device [dev] - show or set current device\n"
diff --git a/configs/qcom_qcs9100_defconfig b/configs/qcom_qcs9100_defconfig
index 371448b8b1b..082106157bb 100644
--- a/configs/qcom_qcs9100_defconfig
+++ b/configs/qcom_qcs9100_defconfig
@@ -11,6 +11,6 @@ CONFIG_REMAKE_ELF=y
CONFIG_FASTBOOT_BUF_ADDR=0xdb300000
CONFIG_DEFAULT_DEVICE_TREE="qcom/qcs9100-ride-r3"
CONFIG_ENV_IS_IN_SCSI=y
-CONFIG_SCSI_ENV_PART_UUID="71cb9cd0-acf1-b6cb-ad91-be9572fe11a9"
+CONFIG_ENV_SCSI_PART_UUID="71cb9cd0-acf1-b6cb-ad91-be9572fe11a9"
# CONFIG_ENV_IS_DEFAULT is not set
# CONFIG_ENV_IS_NOWHERE is not set
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index ee237ed6337..12c7b1e8254 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -341,6 +341,12 @@ static int scmi_clk_probe(struct udevice *dev)
if (ret)
return ret;
+ ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, &priv->version);
+ if (ret) {
+ dev_dbg(dev, "%s: get SCMI clock management protocol version failed\n", __func__);
+ return ret;
+ }
+
if (!CONFIG_IS_ENABLED(CLK_CCF))
return 0;
@@ -352,12 +358,6 @@ static int scmi_clk_probe(struct udevice *dev)
if (ret)
return ret;
- ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK, &priv->version);
- if (ret) {
- dev_dbg(dev, "%s: get SCMI clock management protocol version failed\n", __func__);
- return ret;
- }
-
clk_scmi_bulk = kzalloc(num_clocks * sizeof(*clk_scmi), GFP_KERNEL);
if (!clk_scmi_bulk)
return -ENOMEM;
diff --git a/drivers/firmware/scmi/pinctrl.c b/drivers/firmware/scmi/pinctrl.c
index 47f7a8ad9b8..e670538c87f 100644
--- a/drivers/firmware/scmi/pinctrl.c
+++ b/drivers/firmware/scmi/pinctrl.c
@@ -259,6 +259,8 @@ static int scmi_pinctrl_settings_configure_helper(struct udevice *dev,
in->attr = 0;
in->attr |= FIELD_PREP(GENMASK(9, 2), num_configs);
in->attr |= FIELD_PREP(GENMASK(1, 0), select_type);
+ if (function_id != SCMI_PINCTRL_FUNCTION_NONE)
+ in->attr |= BIT(10);
memcpy(in->configs, configs, num_configs * sizeof(u32) * 2);
ret = devm_scmi_process_msg(dev, &msg);
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 1484dd3504c..0b5466b39b8 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -732,6 +732,12 @@ config SLG7XL45106_I2C_GPO
8-bit gpo expander, all gpo lines are controlled by writing
value into data register.
+config GPIO_SCMI
+ bool "SCMI GPIO pinctrl driver"
+ depends on DM_GPIO && PINCTRL_SCMI
+ help
+ Support pinctrl GPIO over the SCMI interface.
+
config ADP5585_GPIO
bool "ADP5585 GPIO driver"
depends on DM_GPIO && DM_I2C
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index fec258f59f5..863557e45ce 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -78,6 +78,7 @@ obj-$(CONFIG_SL28CPLD_GPIO) += sl28cpld-gpio.o
obj-$(CONFIG_ADP5588_GPIO) += adp5588_gpio.o
obj-$(CONFIG_ZYNQMP_GPIO_MODEPIN) += zynqmp_gpio_modepin.o
obj-$(CONFIG_SLG7XL45106_I2C_GPO) += gpio_slg7xl45106.o
+obj-$(CONFIG_GPIO_SCMI) += gpio_scmi.o
obj-$(CONFIG_$(PHASE_)ADP5585_GPIO) += adp5585_gpio.o
obj-$(CONFIG_RZG2L_GPIO) += rzg2l-gpio.o
obj-$(CONFIG_MPFS_GPIO) += mpfs_gpio.o
diff --git a/drivers/gpio/gpio_scmi.c b/drivers/gpio/gpio_scmi.c
new file mode 100644
index 00000000000..d25e3b6a4aa
--- /dev/null
+++ b/drivers/gpio/gpio_scmi.c
@@ -0,0 +1,248 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2026 Linaro Ltd.
+ */
+
+#include <asm/gpio.h>
+#include <dm.h>
+#include <dm/device_compat.h>
+#include <dm/devres.h>
+#include <linux/list.h>
+#include <scmi_protocols.h>
+
+struct scmi_gpio_range {
+ u32 base;
+ u32 offset;
+ u32 npins;
+ struct list_head list;
+};
+
+static int bank_cnt;
+
+struct scmi_gpio_priv {
+ struct udevice *pin_dev;
+ struct list_head gpio_ranges;
+ char *bank_name;
+ u32 num_pins;
+ u16 *pins;
+};
+
+static int scmi_gpio_request(struct udevice *dev, unsigned int offset, const char *label)
+{
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ int pin;
+ int ret;
+
+ if (offset >= priv->num_pins)
+ return -EINVAL;
+ pin = priv->pins[offset];
+
+ ret = scmi_pinctrl_request(priv->pin_dev, SCMI_PIN, pin);
+ if (ret == -EOPNOTSUPP)
+ ret = 0;
+ if (ret)
+ dev_err(dev, "%s(): request failed: %d\n", __func__, ret);
+ return ret;
+}
+
+static int scmi_gpio_rfree(struct udevice *dev, unsigned int offset)
+{
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ int pin;
+ int ret;
+
+ if (offset >= priv->num_pins)
+ return -EINVAL;
+ pin = priv->pins[offset];
+
+ ret = scmi_pinctrl_release(priv->pin_dev, SCMI_PIN, pin);
+ if (ret == -EOPNOTSUPP)
+ ret = 0;
+ if (ret)
+ dev_err(dev, "%s(): release failed: %d\n", __func__, ret);
+ return ret;
+}
+
+static int scmi_gpio_set_flags(struct udevice *dev, unsigned int offset, ulong flags)
+{
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ const int MAX_FLAGS = 10;
+ u32 configs[MAX_FLAGS * 2];
+ int cnt = 0;
+ u32 pin;
+
+ if (offset >= priv->num_pins)
+ return -EINVAL;
+ pin = priv->pins[offset];
+
+ if (flags & GPIOD_IS_OUT) {
+ configs[cnt++] = SCMI_PIN_OUTPUT_MODE;
+ configs[cnt++] = 1;
+ configs[cnt++] = SCMI_PIN_OUTPUT_VALUE;
+ if (flags & GPIOD_IS_OUT_ACTIVE)
+ configs[cnt++] = 1;
+ else
+ configs[cnt++] = 0;
+ }
+ if (flags & GPIOD_IS_IN) {
+ configs[cnt++] = SCMI_PIN_INPUT_MODE;
+ configs[cnt++] = 1;
+ }
+ if (flags & GPIOD_OPEN_DRAIN) {
+ configs[cnt++] = SCMI_PIN_DRIVE_OPEN_DRAIN;
+ configs[cnt++] = 1;
+ }
+ if (flags & GPIOD_OPEN_SOURCE) {
+ configs[cnt++] = SCMI_PIN_DRIVE_OPEN_SOURCE;
+ configs[cnt++] = 1;
+ }
+ if (flags & GPIOD_PULL_UP) {
+ configs[cnt++] = SCMI_PIN_BIAS_PULL_UP;
+ configs[cnt++] = 1;
+ }
+ if (flags & GPIOD_PULL_DOWN) {
+ configs[cnt++] = SCMI_PIN_BIAS_PULL_DOWN;
+ configs[cnt++] = 1;
+ }
+ /* TODO: handle GPIOD_ACTIVE_LOW and GPIOD_IS_AF flags */
+
+ return scmi_pinctrl_settings_configure(priv->pin_dev, SCMI_PIN, pin,
+ cnt / 2, &configs[0]);
+}
+
+static int scmi_gpio_get_value(struct udevice *dev, unsigned int offset)
+{
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ u32 value;
+ int pin;
+ int ret;
+
+ if (offset >= priv->num_pins)
+ return -EINVAL;
+ pin = priv->pins[offset];
+
+ ret = scmi_pinctrl_settings_get_one(priv->pin_dev, SCMI_PIN, pin,
+ SCMI_PIN_INPUT_VALUE, &value);
+ if (ret) {
+ dev_err(dev, "settings_get_one() failed: %d\n", ret);
+ return ret;
+ }
+
+ return value;
+}
+
+static int scmi_gpio_get_function(struct udevice *dev, unsigned int offset)
+{
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ u32 value;
+ int pin;
+ int ret;
+
+ if (offset >= priv->num_pins)
+ return -EINVAL;
+ pin = priv->pins[offset];
+
+ ret = scmi_pinctrl_settings_get_one(priv->pin_dev, SCMI_PIN, pin,
+ SCMI_PIN_INPUT_MODE,
+ &value);
+ if (ret) {
+ dev_err(dev, "settings_get() failed %d\n", ret);
+ return ret;
+ }
+
+ if (value)
+ return GPIOF_INPUT;
+ return GPIOF_OUTPUT;
+}
+
+static const struct dm_gpio_ops scmi_gpio_ops = {
+ .request = scmi_gpio_request,
+ .rfree = scmi_gpio_rfree,
+ .set_flags = scmi_gpio_set_flags,
+ .get_value = scmi_gpio_get_value,
+ .get_function = scmi_gpio_get_function,
+};
+
+static int scmi_gpio_probe(struct udevice *dev)
+{
+ struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+ struct scmi_gpio_priv *priv = dev_get_priv(dev);
+ struct ofnode_phandle_args args;
+ struct scmi_gpio_range *range;
+ int index = 0;
+ int ret, i;
+
+ INIT_LIST_HEAD(&priv->gpio_ranges);
+
+ for (;; index++) {
+ ret = dev_read_phandle_with_args(dev, "gpio-ranges",
+ NULL, 3, index, &args);
+ if (ret)
+ break;
+
+ if (index == 0) {
+ ret = uclass_get_device_by_ofnode(UCLASS_PINCTRL,
+ args.node,
+ &priv->pin_dev);
+ if (ret) {
+ dev_err(dev, "failed to find pinctrl device: %d\n", ret);
+ return ret;
+ }
+ }
+
+ range = devm_kmalloc(dev, sizeof(*range), GFP_KERNEL);
+ if (!range)
+ return -ENOMEM;
+
+ range->base = args.args[0];
+ if (range->base != priv->num_pins) {
+ dev_err(dev, "no gaps allowed in between pins %d vs %d\n",
+ priv->num_pins, range->base);
+ return -EINVAL;
+ }
+ range->offset = args.args[1];
+ range->npins = args.args[2];
+ priv->num_pins += args.args[2];
+ list_add_tail(&range->list, &priv->gpio_ranges);
+ }
+
+ if (priv->num_pins == 0) {
+ dev_err(dev, "failed to registier pin-groups\n");
+ return -EINVAL;
+ }
+
+ priv->pins = devm_kzalloc(dev, priv->num_pins * sizeof(u16), GFP_KERNEL);
+ if (!priv->pins)
+ return -ENOMEM;
+
+ list_for_each_entry(range, &priv->gpio_ranges, list) {
+ for (i = 0; i < range->npins; i++)
+ priv->pins[range->base + i] = range->offset + i;
+ }
+
+ ret = snprintf(NULL, 0, "gpio_scmi%d_", bank_cnt);
+ uc_priv->bank_name = devm_kzalloc(dev, ret + 1, GFP_KERNEL);
+ if (!uc_priv->bank_name)
+ return -ENOMEM;
+ snprintf((char *)uc_priv->bank_name, ret + 1, "gpio_scmi%d_", bank_cnt);
+ bank_cnt++;
+
+ uc_priv->gpio_count = priv->num_pins;
+
+ return 0;
+}
+
+static const struct udevice_id scmi_gpio_match[] = {
+ { .compatible = "scmi-pinctrl-gpio" },
+ { }
+};
+
+U_BOOT_DRIVER(scmi_pinctrl_gpio) = {
+ .name = "scmi_pinctrl_gpio",
+ .id = UCLASS_GPIO,
+ .of_match = scmi_gpio_match,
+ .probe = scmi_gpio_probe,
+ .priv_auto = sizeof(struct scmi_gpio_priv),
+ .ops = &scmi_gpio_ops,
+};
+
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index c8ed702f50a..e28f8d96ed7 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2014 Freescale Semiconductor, Inc.
- * Copyright 2017-2018, 2020-2021 NXP
+ * Copyright 2017-2018, 2020-2021, 2025 NXP
*/
#include <config.h>
#include <command.h>
@@ -72,6 +72,7 @@ static u64 mc_lazy_dpl_addr;
static u32 dpsparser_obj_id;
static u16 dpsparser_handle;
static char *mc_err_msg_apply_spb[] = MC_ERROR_MSG_APPLY_SPB;
+static bool wait_for_dpl;
#ifdef DEBUG
void dump_ram_words(const char *title, void *addr)
@@ -653,7 +654,7 @@ static int load_mc_aiop_img(u64 aiop_fw_addr)
}
#endif
-static int wait_for_mc(bool booting_mc, u32 *final_reg_gsr)
+static int wait_for_mc(u32 *final_reg_gsr)
{
u32 reg_gsr;
u32 mc_fw_boot_status;
@@ -792,7 +793,7 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
* Deassert reset and release MC core 0 to run
*/
out_le32(&mc_ccsr_regs->reg_gcr1, GCR1_P1_DE_RST | GCR1_M_ALL_DE_RST);
- error = wait_for_mc(true, &reg_gsr);
+ error = wait_for_mc(&reg_gsr);
if (error != 0)
goto out;
@@ -855,13 +856,20 @@ int mc_apply_dpl(u64 mc_dpl_addr)
* Tell the MC to deploy the DPL:
*/
out_le32(&mc_ccsr_regs->reg_gsr, 0x0);
- printf("fsl-mc: Deploying data path layout ... ");
- error = wait_for_mc(false, &reg_gsr);
- if (!error)
- mc_dpl_applied = 0;
+ /* Wait for the MC firmware to finish processing the DPL */
+ if (wait_for_dpl) {
+ printf("fsl-mc: Deploying data path layout ... ");
+ error = wait_for_mc(&reg_gsr);
+ if (error)
+ return error;
+ } else {
+ printf("fsl-mc: Started the DPL deploy process\n");
+ }
- return error;
+ mc_dpl_applied = 0;
+
+ return 0;
}
int get_mc_boot_status(void)
@@ -1995,6 +2003,11 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
* later from announce_and_cleanup().
*/
mc_lazy_dpl_addr = mc_dpl_addr;
+
+ wait_for_dpl = true;
+ if (argc >= 5 && strcmp(argv[4], "nowait") == 0)
+ wait_for_dpl = false;
+
break;
}
@@ -2023,6 +2036,10 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
mc_apply_addr = simple_strtoull(argv[3], NULL, 16);
+ wait_for_dpl = true;
+ if (argc >= 5 && strcmp(argv[4], "nowait") == 0)
+ wait_for_dpl = false;
+
/* The user wants DPL applied now */
if (!fsl_mc_ldpaa_exit(NULL))
err = mc_apply_dpl(mc_apply_addr);
@@ -2070,12 +2087,12 @@ static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
U_BOOT_CMD(
fsl_mc, CONFIG_SYS_MAXARGS, 1, do_fsl_mc,
"DPAA2 command to manage Management Complex (MC)",
- "start mc [FW_addr] [DPC_addr] - Start Management Complex\n"
- "fsl_mc apply DPL [DPL_addr] - Apply DPL file\n"
- "fsl_mc lazyapply DPL [DPL_addr] - Apply DPL file on exit\n"
- "fsl_mc apply spb [spb_addr] - Apply SPB Soft Parser Blob\n"
- "fsl_mc start aiop [FW_addr] - Start AIOP\n"
- "fsl_mc dump_log - Dump MC Log\n"
+ "fsl_mc start mc <fw_addr> <DPC_addr> - Start the Management Complex firmware\n"
+ "fsl_mc apply dpl <dpl_addr> [nowait] - Apply the DPL (Data Path Layout) file\n"
+ "fsl_mc lazyapply dpl <DPL_addr> [nowait] - Apply the DPL (Data Path Layout) file on exit\n"
+ "fsl_mc apply spb <spb_addr> - Apply the SPB Soft Parser Blob\n"
+ "fsl_mc start aiop <fw_addr> - Start AIOP\n"
+ "fsl_mc dump_log - Dump the MC Log\n"
);
void mc_env_boot(void)
diff --git a/drivers/pinctrl/pinctrl-scmi.c b/drivers/pinctrl/pinctrl-scmi.c
index 63d4f8ffeb5..fa31b573f31 100644
--- a/drivers/pinctrl/pinctrl-scmi.c
+++ b/drivers/pinctrl/pinctrl-scmi.c
@@ -33,20 +33,6 @@ static const struct pinconf_param pinctrl_scmi_conf_params[] = {
/* The SCMI spec also include "default", "pull-mode" and "input-value */
};
-static bool valid_selector(struct udevice *dev, enum select_type select_type, u32 selector)
-{
- struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
-
- if (select_type == SCMI_PIN)
- return selector < priv->num_pins;
- if (select_type == SCMI_GROUP)
- return selector < priv->num_groups;
- if (select_type == SCMI_FUNCTION)
- return selector < priv->num_functions;
-
- return false;
-}
-
static int pinctrl_scmi_get_pins_count(struct udevice *dev)
{
struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
@@ -98,6 +84,38 @@ static const char *pinctrl_scmi_get_function_name(struct udevice *dev, unsigned
return (const char *)priv->function_info[selector].name;
}
+static int pinctrl_scmi_get_function_id(struct udevice *dev, const char *function)
+{
+ struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
+ int i;
+
+ if (!function)
+ return -EINVAL;
+
+ for (i = 0; i < priv->num_functions; i++) {
+ if (strcmp(priv->function_info[i].name, function) == 0)
+ return i;
+ }
+
+ return -EINVAL;
+}
+
+static int pinctrl_scmi_get_group_id(struct udevice *dev, const char *group)
+{
+ struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
+ int i;
+
+ if (!group)
+ return -EINVAL;
+
+ for (i = 0; i < priv->num_groups; i++) {
+ if (strcmp(priv->group_info[i].name, group) == 0)
+ return i;
+ }
+
+ return -EINVAL;
+}
+
static int pinctrl_scmi_pinmux_set(struct udevice *dev, u32 pin, u32 function)
{
struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
@@ -120,96 +138,35 @@ static int pinctrl_scmi_pinmux_group_set(struct udevice *dev, u32 group, u32 fun
static int pinctrl_scmi_set_state(struct udevice *dev, struct udevice *config)
{
- struct pinctrl_scmi_priv *priv = dev_get_priv(dev);
- /* batch the setup into 20 lines at a go (there are 5 u32s in a config) */
- const int batch_count = 20 * 5;
- u32 prev_type = -1u;
- u32 prev_selector;
- u32 *configs;
- const u32 *prop;
- int offset, cnt, len;
- int ret = 0;
-
- prop = dev_read_prop(config, "pinmux", &len);
- if (!prop)
- return 0;
-
- if (len % sizeof(u32) * 5) {
- dev_err(dev, "invalid pin configuration: len=%d\n", len);
- return -FDT_ERR_BADSTRUCTURE;
- }
-
- configs = kcalloc(batch_count, sizeof(u32), GFP_KERNEL);
- if (!configs)
- return -ENOMEM;
-
- offset = 0;
- cnt = 0;
- while (offset + 4 < len / sizeof(u32)) {
- u32 select_type = fdt32_to_cpu(prop[offset]);
- u32 selector = fdt32_to_cpu(prop[offset + 1]);
- u32 function = fdt32_to_cpu(prop[offset + 2]);
- u32 config_type = fdt32_to_cpu(prop[offset + 3]);
- u32 config_value = fdt32_to_cpu(prop[offset + 4]);
-
- if (select_type > SCMI_GROUP ||
- !valid_selector(dev, select_type, selector) ||
- (function != SCMI_PINCTRL_FUNCTION_NONE &&
- function > priv->num_functions)) {
- dev_err(dev, "invalid pinctrl data (%u %u %u %u %u)\n",
- select_type, selector, function, config_type,
- config_value);
- ret = -EINVAL;
- goto free;
- }
+ int function_id, group_id;
+ const char *function;
+ const char **groups;
+ int group_count;
+ int ret;
+ int i;
- if (function != SCMI_PINCTRL_FUNCTION_NONE) {
- if (cnt) {
- ret = scmi_pinctrl_settings_configure(dev,
- prev_type,
- prev_selector,
- cnt / 2, configs);
- if (ret)
- goto free;
- prev_type = -1u;
- cnt = 0;
- }
- scmi_pinctrl_set_function(dev, select_type, selector, function);
- offset += 5;
- continue;
- }
+ ret = dev_read_string_index(config, "function", 0, &function);
+ if (ret)
+ return ret;
- if (cnt == batch_count)
- goto set;
+ function_id = pinctrl_scmi_get_function_id(dev, function);
+ if (function_id < 0)
+ return function_id;
- if (prev_type == -1u)
- goto store;
+ group_count = dev_read_string_list(config, "groups", &groups);
+ if (group_count < 0)
+ return group_count;
- if (select_type == prev_type && selector == prev_selector)
- goto store;
-set:
- ret = scmi_pinctrl_settings_configure(dev, prev_type, prev_selector,
- cnt / 2, configs);
+ for (i = 0; i < group_count; i++) {
+ group_id = pinctrl_scmi_get_group_id(dev, groups[i]);
+ if (group_id < 0)
+ return group_id;
+ ret = pinctrl_scmi_pinmux_group_set(dev, group_id, function_id);
if (ret)
- goto free;
- cnt = 0;
-store:
- prev_type = select_type;
- prev_selector = selector;
- configs[cnt++] = config_type;
- configs[cnt++] = config_value;
- offset += 5;
+ return ret;
}
- if (cnt)
- ret = scmi_pinctrl_settings_configure(dev, prev_type, prev_selector,
- cnt / 2, configs);
-free:
- kfree(configs);
- if (ret)
- dev_err(dev, "set_state() failed: %d\n", ret);
-
- return ret;
+ return 0;
}
static int get_pin_muxing(struct udevice *dev, unsigned int selector,
diff --git a/drivers/scsi/scsi-uclass.c b/drivers/scsi/scsi-uclass.c
index 3eb6069649f..39b4c7476d4 100644
--- a/drivers/scsi/scsi-uclass.c
+++ b/drivers/scsi/scsi-uclass.c
@@ -29,15 +29,9 @@ int scsi_get_blk_by_uuid(const char *uuid,
struct blk_desc **blk_desc_ptr,
struct disk_partition *part_info_ptr)
{
- static int is_scsi_scanned;
struct blk_desc *blk;
int i, ret;
- if (!is_scsi_scanned) {
- scsi_scan(false /* no verbose */);
- is_scsi_scanned = 1;
- }
-
for (i = 0; i < blk_find_max_devnum(UCLASS_SCSI) + 1; i++) {
ret = blk_get_desc(UCLASS_SCSI, i, &blk);
if (ret)
@@ -50,7 +44,7 @@ int scsi_get_blk_by_uuid(const char *uuid,
}
}
- return -1;
+ return -ENODEV;
}
int scsi_bus_reset(struct udevice *dev)
diff --git a/env/Kconfig b/env/Kconfig
index 532adf884da..7abd82ab6f3 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -294,6 +294,23 @@ config ENV_IS_IN_SCSI
Define this if you have an SCSI device which you want to use for the
environment.
+ - CONFIG_ENV_SIZE:
+
+ The size of the partition where the environment is stored in bytes. Must
+ be a multiple of the partition block size.
+
+ - CONFIG_ENV_SCSI_HW_PARTITION:
+
+ Specifies which SCSI partition the environment is stored in. If not
+ set, defaults to partition 0, the user area. Common values might be
+ 1 (first SCSI boot partition), 2 (second SCSI boot partition). Ignored
+ if CONFIG_ENV_SCSI_PART_UUID is set to non-empty string.
+
+ - CONFIG_ENV_SCSI_PART_UUID:
+
+ UUID of the SCSI partition where the environment is stored.
+
+
config ENV_RANGE
hex "Length of the region in which the environment can be written"
depends on ENV_IS_IN_NAND
@@ -763,7 +780,18 @@ config ENV_MMC_USE_DT
The 2 defines CONFIG_ENV_OFFSET, CONFIG_ENV_OFFSET_REDUND
are not used as fallback.
-config SCSI_ENV_PART_UUID
+config ENV_SCSI_HW_PARTITION
+ string "SCSI hardware partition number"
+ depends on ENV_IS_IN_SCSI
+ default 0
+ help
+ SCSI hardware partition device number on the platform where the
+ environment is stored. Note that this is not related to any software
+ defined partition table but instead if we are in the user area, which is
+ partition 0 or the first boot partition, which is 1 or some other defined
+ partition.
+
+config ENV_SCSI_PART_UUID
string "SCSI partition UUID for saving environment"
depends on ENV_IS_IN_SCSI
help
diff --git a/env/scsi.c b/env/scsi.c
index e56891a9899..91a6c430302 100644
--- a/env/scsi.c
+++ b/env/scsi.c
@@ -33,10 +33,22 @@ static struct env_scsi_info env_part;
static inline struct env_scsi_info *env_scsi_get_part(void)
{
+ static bool is_scsi_scanned;
struct env_scsi_info *ep = &env_part;
- if (scsi_get_blk_by_uuid(CONFIG_SCSI_ENV_PART_UUID, &ep->blk, &ep->part))
- return NULL;
+ if (!is_scsi_scanned) {
+ scsi_scan(false /* no verbose */);
+ is_scsi_scanned = true;
+ }
+
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0') {
+ if (blk_get_device_part_str("scsi", CONFIG_ENV_SCSI_HW_PARTITION,
+ &ep->blk, &ep->part, true))
+ return NULL;
+ } else {
+ if (scsi_get_blk_by_uuid(CONFIG_ENV_SCSI_PART_UUID, &ep->blk, &ep->part))
+ return NULL;
+ }
ep->count = CONFIG_ENV_SIZE / ep->part.blksz;
@@ -83,12 +95,20 @@ static int env_scsi_load(void)
int ret;
if (!ep) {
- env_set_default(CONFIG_SCSI_ENV_PART_UUID " partition not found", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " not found", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition not found", 0);
+
return -ENOENT;
}
if (blk_dread(ep->blk, ep->part.start, ep->count, &envbuf) != ep->count) {
- env_set_default(CONFIG_SCSI_ENV_PART_UUID " partition read failed", 0);
+ if (CONFIG_ENV_SCSI_PART_UUID[0] == '\0')
+ env_set_default("SCSI partition " CONFIG_ENV_SCSI_HW_PARTITION " read failed", 0);
+ else
+ env_set_default(CONFIG_ENV_SCSI_PART_UUID " partition read failed", 0);
+
return -EIO;
}
diff --git a/include/configs/ls1028ardb.h b/include/configs/ls1028ardb.h
index 9c869ee6840..613abc50567 100644
--- a/include/configs/ls1028ardb.h
+++ b/include/configs/ls1028ardb.h
@@ -54,6 +54,9 @@
"board=ls1028ardb\0" \
"hwconfig=fsl_ddr:bank_intlv=auto\0" \
"fdtfile=fsl-ls1028a-rdb.dtb\0" \
+ "image=Image\0" \
+ "extra_bootargs=iommu.passthrough=1 arm-smmu.disable_bypass=0\0" \
+ "othbootargs=video=1920x1080-32@60 cma=640M\0" \
"ramdisk_addr=0x800000\0" \
"ramdisk_size=0x2000000\0" \
"bootm_size=0x10000000\0" \
@@ -76,6 +79,7 @@
"kernelhdr_addr_sd=0x3000\0" \
"kernelhdr_size_sd=0x20\0" \
"console=ttyS0,115200\0" \
+ "console_dbg=earlycon=uart8250,mmio,0x21c0500\0" \
BOOTENV \
"boot_scripts=ls1028ardb_boot.scr\0" \
"boot_script_hdr=hdr_ls1028ardb_bs.out\0" \
diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
index 4c695388d2f..24a717706af 100644
--- a/include/configs/ls1043a_common.h
+++ b/include/configs/ls1043a_common.h
@@ -88,7 +88,7 @@
#include <config_distro_bootcmd.h>
/* Initial environment variables */
-#define CFG_EXTRA_ENV_SETTINGS \
+#define EXTRA_ENV_SETTINGS \
"hwconfig=fsl_ddr:bank_intlv=auto\0" \
"initrd_high=0xffffffffffffffff\0" \
"kernel_addr=0x61000000\0" \
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 7ccbb20bf2e..c06e986e93f 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -295,6 +295,11 @@
/*
* Environment
*/
+#ifndef SPL_NO_MISC
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS \
+ EXTRA_ENV_SETTINGS
+#endif
#include <asm/fsl_secure_boot.h>
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index ef8fdc1912b..90caf8a1371 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -201,4 +201,14 @@
#include <asm/fsl_secure_boot.h>
+#ifndef SPL_NO_MISC
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS \
+ EXTRA_ENV_SETTINGS \
+ "board=ls1043ardb\0" \
+ "fdtfile=fsl-ls1043a-rdb-sdk.dtb\0" \
+ "image=Image\0" \
+ "console_dbg=earlycon=uart8250,mmio,0x21c0500\0"
+#endif
+
#endif /* __LS1043ARDB_H__ */
diff --git a/include/configs/ls1046a_common.h b/include/configs/ls1046a_common.h
index 53ef5975a28..89f96bb3e74 100644
--- a/include/configs/ls1046a_common.h
+++ b/include/configs/ls1046a_common.h
@@ -83,7 +83,7 @@
#endif
#ifndef SPL_NO_MISC
/* Initial environment variables */
-#define CFG_EXTRA_ENV_SETTINGS \
+#define EXTRA_ENV_SETTINGS \
"hwconfig=fsl_ddr:bank_intlv=auto\0" \
"ramdisk_addr=0x800000\0" \
"ramdisk_size=0x2000000\0" \
diff --git a/include/configs/ls1046afrwy.h b/include/configs/ls1046afrwy.h
index 21804fc6654..07846c3bd25 100644
--- a/include/configs/ls1046afrwy.h
+++ b/include/configs/ls1046afrwy.h
@@ -70,6 +70,12 @@
/*
* Environment
*/
+#ifndef SPL_NO_MISC
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS \
+ EXTRA_ENV_SETTINGS
+#endif
+
#define CFG_SYS_FSL_QSPI_BASE 0x40000000
#undef BOOT_TARGET_DEVICES
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 4b4bd7cbe48..001118b8504 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -312,6 +312,11 @@
/*
* Environment
*/
+#ifndef SPL_NO_MISC
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS \
+ EXTRA_ENV_SETTINGS
+#endif
#ifdef CONFIG_TFABOOT
#define IFC_NAND_BOOTCOMMAND "run distro_bootcmd; run nand_bootcmd; " \
diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h
index 0e42a51fc59..a032e52c519 100644
--- a/include/configs/ls1046ardb.h
+++ b/include/configs/ls1046ardb.h
@@ -131,4 +131,14 @@
#include <asm/fsl_secure_boot.h>
+#ifndef SPL_NO_MISC
+/* Initial environment variables */
+#define CFG_EXTRA_ENV_SETTINGS \
+ EXTRA_ENV_SETTINGS \
+ "board=ls1046ardb\0" \
+ "fdtfile=fsl-ls1046a-rdb-sdk.dtb\0" \
+ "image=Image\0" \
+ "console_dbg=earlycon=uart8250,mmio,0x21c0500\0"
+#endif
+
#endif /* __LS1046ARDB_H__ */
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 4c1b4bf2b2c..45b5cbdd85a 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -137,7 +137,7 @@
"kernelhdr_addr_sd=0x3000\0" \
"kernel_size_sd=0x14000\0" \
"kernelhdr_size_sd=0x20\0" \
- "console=ttyAMA0,38400n8\0" \
+ "console=ttyAMA0,115200\0" \
BOOTENV \
"mcmemsize=0x70000000\0" \
XSPI_MC_INIT_CMD \
diff --git a/include/configs/lx2160ardb.h b/include/configs/lx2160ardb.h
index e700a7b1135..725220c5747 100644
--- a/include/configs/lx2160ardb.h
+++ b/include/configs/lx2160ardb.h
@@ -21,6 +21,11 @@
/* Initial environment variables */
#define CFG_EXTRA_ENV_SETTINGS \
+ "board=lx2160ardb\0" \
+ "fdtfile=fsl-lx2160a-rdb.dtb\0" \
+ "image=Image\0" \
+ "extra_bootargs=pci=pcie_bus_perf\0" \
+ "console_dbg=earlycon=pl011,mmio32,0x21c0000\0" \
EXTRA_ENV_SETTINGS \
"boot_scripts=lx2160ardb_boot.scr\0" \
"boot_script_hdr=hdr_lx2160ardb_bs.out\0" \
diff --git a/include/scsi.h b/include/scsi.h
index 8d6c5116419..2520a8b8fe6 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -340,6 +340,7 @@ int scsi_bus_reset(struct udevice *dev);
* scsi_scan() - Scan all SCSI controllers for available devices
*
* @vebose: true to show information about each device found
+ * Return: 0 if OK, -ve on error
*/
int scsi_scan(bool verbose);
@@ -348,15 +349,19 @@ int scsi_scan(bool verbose);
*
* @dev: SCSI bus
* @verbose: true to show information about each device found
+ * Return: 0 if OK, -ve on error
*/
int scsi_scan_dev(struct udevice *dev, bool verbose);
/**
* scsi_get_blk_by_uuid() - Provides SCSI partition information.
*
+ * scsi_scan() must have been called before calling this function.
+ *
* @uuid: UUID of the partition for fetching its info
* @blk_desc_ptr: Provides the blk descriptor
* @part_info_ptr: Provides partition info
+ * Return: 0 if OK, -ve on error
*/
int scsi_get_blk_by_uuid(const char *uuid, struct blk_desc **blk_desc_ptr,
struct disk_partition *part_info_ptr);
diff --git a/test/py/tests/test_scsi.py b/test/py/tests/test_scsi.py
index 2a35e47e558..4390ff65845 100644
--- a/test/py/tests/test_scsi.py
+++ b/test/py/tests/test_scsi.py
@@ -39,16 +39,6 @@ def scsi_setup(ubman):
return dev_num, dev_type, dev_size
@pytest.mark.buildconfigspec('cmd_scsi')
-def test_scsi_reset(ubman):
- dev_num, dev_type, dev_size = scsi_setup(ubman)
- output = ubman.run_command('scsi reset')
- assert f'Device {dev_num}:' in output
- assert f'Type: {dev_type}' in output
- assert f'Capacity: {dev_size}' in output
- output = ubman.run_command('echo $?')
- assert output.endswith('0')
-
[email protected]('cmd_scsi')
def test_scsi_info(ubman):
dev_num, dev_type, dev_size = scsi_setup(ubman)
output = ubman.run_command('scsi info')
diff --git a/tools/u_boot_pylib/pyproject.toml b/tools/u_boot_pylib/pyproject.toml
index a860d134551..ed04d956b4e 100644
--- a/tools/u_boot_pylib/pyproject.toml
+++ b/tools/u_boot_pylib/pyproject.toml
@@ -21,5 +21,11 @@ classifiers = [
"Homepage" = "https://docs.u-boot.org"
"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
+[tool.setuptools]
+packages = ["u_boot_pylib"]
+
+[tool.setuptools.package-dir]
+u_boot_pylib = ""
+
[tool.setuptools.package-data]
u_boot_pylib = ["*.rst"]