diff options
author | Tom Rini <trini@konsulko.com> | 2021-07-23 15:30:48 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-23 15:30:48 +0300 |
commit | f534d93cbf34f1d1762b04eb5680e84bef5e1fe1 (patch) | |
tree | 09a0231852e9df884a8da30db093ac1932978814 | |
parent | 4906d698d3960b70cf8000299da35412efd4f51d (diff) | |
parent | 988002dcd931e7236422e4d158c397d964ba1360 (diff) | |
download | u-boot-f534d93cbf34f1d1762b04eb5680e84bef5e1fe1.tar.xz |
Merge branch '2021-07-23-assorted-fixes'
- Assorted FIT, optee, pcf8575, mux, vexpress64 and distro bootcmd fixes.
- Allow pinmux status to take pin names
-rw-r--r-- | cmd/part.c | 2 | ||||
-rw-r--r-- | cmd/pinmux.c | 71 | ||||
-rw-r--r-- | common/Kconfig.boot | 1 | ||||
-rw-r--r-- | common/image-fit.c | 3 | ||||
-rw-r--r-- | common/spl/spl.c | 4 | ||||
-rw-r--r-- | drivers/gpio/pcf8575_gpio.c | 43 | ||||
-rw-r--r-- | drivers/tee/optee/core.c | 21 | ||||
-rw-r--r-- | drivers/tee/tee-uclass.c | 19 | ||||
-rw-r--r-- | include/config_distro_bootcmd.h | 2 | ||||
-rw-r--r-- | include/configs/SBx81LIFKW.h | 1 | ||||
-rw-r--r-- | include/configs/SBx81LIFXCAT.h | 1 | ||||
-rw-r--r-- | include/configs/ebisu.h | 1 | ||||
-rw-r--r-- | include/configs/vexpress_aemv8a.h | 58 | ||||
-rw-r--r-- | include/configs/xilinx_versal.h | 1 | ||||
-rw-r--r-- | include/dm/pinctrl.h | 2 | ||||
-rw-r--r-- | include/mux.h | 4 | ||||
-rw-r--r-- | include/tee.h | 6 | ||||
-rw-r--r-- | test/cmd/Makefile | 1 | ||||
-rw-r--r-- | test/cmd/pinmux.c | 36 | ||||
-rw-r--r-- | test/py/tests/test_pinmux.py | 4 |
20 files changed, 197 insertions, 84 deletions
diff --git a/cmd/part.c b/cmd/part.c index 3395c17b89..e0463b5a54 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -140,7 +140,7 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param) return 1; } else { part = part_get_info_by_name(desc, argv[2], &info); - if (part == -1) + if (part < 0) return 1; } diff --git a/cmd/pinmux.c b/cmd/pinmux.c index 9942b15419..2d23357526 100644 --- a/cmd/pinmux.c +++ b/cmd/pinmux.c @@ -41,31 +41,43 @@ static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } -static int show_pinmux(struct udevice *dev) +/** + * Print the muxing information for one or all pins of one pinctrl device + * + * @param dev pinctrl device + * @param name NULL to display all the pins + * or name of the pin to display + * @return 0 on success, non-0 on error + */ +static int show_pinmux(struct udevice *dev, char *name) { char pin_name[PINNAME_SIZE]; char pin_mux[PINMUX_SIZE]; int pins_count; int i; int ret; + bool found = false; pins_count = pinctrl_get_pins_count(dev); if (pins_count == -ENOSYS) { - printf("Ops get_pins_count not supported\n"); + printf("Ops get_pins_count not supported by %s\n", dev->name); return pins_count; } for (i = 0; i < pins_count; i++) { ret = pinctrl_get_pin_name(dev, i, pin_name, PINNAME_SIZE); - if (ret == -ENOSYS) { - printf("Ops get_pin_name not supported\n"); + if (ret) { + printf("Ops get_pin_name error (%d) by %s\n", ret, dev->name); return ret; } - + if (name && strcmp(name, pin_name)) + continue; + found = true; ret = pinctrl_get_pin_muxing(dev, i, pin_mux, PINMUX_SIZE); if (ret) { - printf("Ops get_pin_muxing error (%d)\n", ret); + printf("Ops get_pin_muxing error (%d) by %s in %s\n", + ret, pin_name, dev->name); return ret; } @@ -73,6 +85,9 @@ static int show_pinmux(struct udevice *dev) PINMUX_SIZE, pin_mux); } + if (!found) + return -ENOENT; + return 0; } @@ -80,25 +95,41 @@ static int do_status(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct udevice *dev; - int ret = CMD_RET_USAGE; + char *name; + int ret; - if (currdev && (argc < 2 || strcmp(argv[1], "-a"))) - return show_pinmux(currdev); + if (argc < 2) { + if (!currdev) { + printf("pin-controller device not selected\n"); + return CMD_RET_FAILURE; + } + show_pinmux(currdev, NULL); + return CMD_RET_SUCCESS; + } - if (argc < 2 || strcmp(argv[1], "-a")) - return ret; + if (strcmp(argv[1], "-a")) + name = argv[1]; + else + name = NULL; uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) { - /* insert a separator between each pin-controller display */ - printf("--------------------------\n"); - printf("%s:\n", dev->name); - ret = show_pinmux(dev); - if (ret < 0) - printf("Can't display pin muxing for %s\n", - dev->name); + if (!name) { + /* insert a separator between each pin-controller display */ + printf("--------------------------\n"); + printf("%s:\n", dev->name); + } + ret = show_pinmux(dev, name); + /* stop when the status of requested pin is displayed */ + if (name && !ret) + return CMD_RET_SUCCESS; } - return ret; + if (name) { + printf("%s not found\n", name); + return CMD_RET_FAILURE; + } + + return CMD_RET_SUCCESS; } static int do_list(struct cmd_tbl *cmdtp, int flag, int argc, @@ -146,5 +177,5 @@ U_BOOT_CMD(pinmux, CONFIG_SYS_MAXARGS, 1, do_pinmux, "show pin-controller muxing", "list - list UCLASS_PINCTRL devices\n" "pinmux dev [pincontroller-name] - select pin-controller device\n" - "pinmux status [-a] - print pin-controller muxing [for all]\n" + "pinmux status [-a | pin-name] - print pin-controller muxing [for all | for pin-name]\n" ) diff --git a/common/Kconfig.boot b/common/Kconfig.boot index ae3f2b6f62..b4dc49e019 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -358,6 +358,7 @@ config HAVE_SYS_TEXT_BASE config SYS_TEXT_BASE depends on HAVE_SYS_TEXT_BASE + default 0x0 if POSITION_INDEPENDENT default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 default 0x4a000000 if ARCH_SUNXI && !MACH_SUN9I && !MACH_SUN8I_V3S default 0x2a000000 if ARCH_SUNXI && MACH_SUN9I diff --git a/common/image-fit.c b/common/image-fit.c index 28bd8e78c7..d6b2c3c7ec 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1777,7 +1777,8 @@ int fit_conf_find_compat(const void *fit, const void *fdt) } /* search in this config's kernel FDT */ - if (fit_image_get_data(fit, kfdt_noffset, &fdt, &sz)) { + if (fit_image_get_data_and_size(fit, kfdt_noffset, + &fdt, &sz)) { debug("Failed to get fdt \"%s\".\n", kfdt_name); continue; } diff --git a/common/spl/spl.c b/common/spl/spl.c index 3b96f2fc31..3ec16d0de6 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -200,7 +200,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image) spl_image->name = "U-Boot"; } -#ifdef CONFIG_SPL_LOAD_FIT_FULL +#if CONFIG_IS_ENABLED(LOAD_FIT_FULL) /* Parse and load full fitImage in SPL */ static int spl_load_fit_image(struct spl_image_info *spl_image, const struct image_header *header) @@ -307,7 +307,7 @@ __weak int spl_parse_legacy_header(struct spl_image_info *spl_image, int spl_parse_image_header(struct spl_image_info *spl_image, const struct image_header *header) { -#ifdef CONFIG_SPL_LOAD_FIT_FULL +#if CONFIG_IS_ENABLED(LOAD_FIT_FULL) int ret = spl_load_fit_image(spl_image, header); if (!ret) diff --git a/drivers/gpio/pcf8575_gpio.c b/drivers/gpio/pcf8575_gpio.c index 359646266c..d5930d941f 100644 --- a/drivers/gpio/pcf8575_gpio.c +++ b/drivers/gpio/pcf8575_gpio.c @@ -12,15 +12,9 @@ * * Copyright (C) 2007 David Brownell * - */ - -/* - * NOTE: The driver and devicetree bindings are borrowed from Linux - * Kernel, but driver does not support all PCF857x devices. It currently - * supports PCF8575 16-bit expander by TI and NXP. + * Add support for 8 bit expanders - like pca8574 + * Copyright (C) 2021 Lukasz Majewski - DENX Software Engineering * - * TODO(vigneshr@ti.com): - * Support 8 bit PCF857x compatible expanders. */ #include <common.h> @@ -34,8 +28,6 @@ DECLARE_GLOBAL_DATA_PTR; struct pcf8575_chip { - int gpio_count; /* No. GPIOs supported by the chip */ - /* NOTE: these chips have strange "quasi-bidirectional" I/O pins. * We can't actually know whether a pin is configured (a) as output * and driving the signal low, or (b) as input and reporting a low @@ -49,18 +41,17 @@ struct pcf8575_chip { * reset state. Otherwise it flags pins to be driven low. */ unsigned int out; /* software latch */ - const char *bank_name; /* Name of the expander bank */ }; -/* Read/Write to 16-bit I/O expander */ +/* Read/Write to I/O expander */ -static int pcf8575_i2c_write_le16(struct udevice *dev, unsigned int word) +static int pcf8575_i2c_write(struct udevice *dev, unsigned int word) { struct dm_i2c_chip *chip = dev_get_parent_plat(dev); u8 buf[2] = { word & 0xff, word >> 8, }; int ret; - ret = dm_i2c_write(dev, 0, buf, 2); + ret = dm_i2c_write(dev, 0, buf, dev_get_driver_data(dev)); if (ret) printf("%s i2c write failed to addr %x\n", __func__, chip->chip_addr); @@ -68,13 +59,13 @@ static int pcf8575_i2c_write_le16(struct udevice *dev, unsigned int word) return ret; } -static int pcf8575_i2c_read_le16(struct udevice *dev) +static int pcf8575_i2c_read(struct udevice *dev) { struct dm_i2c_chip *chip = dev_get_parent_plat(dev); - u8 buf[2]; + u8 buf[2] = {0x00, 0x00}; int ret; - ret = dm_i2c_read(dev, 0, buf, 2); + ret = dm_i2c_read(dev, 0, buf, dev_get_driver_data(dev)); if (ret) { printf("%s i2c read failed from addr %x\n", __func__, chip->chip_addr); @@ -90,7 +81,7 @@ static int pcf8575_direction_input(struct udevice *dev, unsigned offset) int status; plat->out |= BIT(offset); - status = pcf8575_i2c_write_le16(dev, plat->out); + status = pcf8575_i2c_write(dev, plat->out); return status; } @@ -106,7 +97,7 @@ static int pcf8575_direction_output(struct udevice *dev, else plat->out &= ~BIT(offset); - ret = pcf8575_i2c_write_le16(dev, plat->out); + ret = pcf8575_i2c_write(dev, plat->out); return ret; } @@ -115,7 +106,7 @@ static int pcf8575_get_value(struct udevice *dev, unsigned int offset) { int value; - value = pcf8575_i2c_read_le16(dev); + value = pcf8575_i2c_read(dev); return (value < 0) ? value : ((value & BIT(offset)) >> offset); } @@ -133,8 +124,11 @@ static int pcf8575_ofdata_plat(struct udevice *dev) int n_latch; - uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "gpio-count", 16); + /* + * Number of pins depends on the expander device and is specified + * in the struct udevice_id (as in the Linue kernel). + */ + uc_priv->gpio_count = dev_get_driver_data(dev) * 8; uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "gpio-bank-name", NULL); if (!uc_priv->bank_name) @@ -166,8 +160,9 @@ static const struct dm_gpio_ops pcf8575_gpio_ops = { }; static const struct udevice_id pcf8575_gpio_ids[] = { - { .compatible = "nxp,pcf8575" }, - { .compatible = "ti,pcf8575" }, + { .compatible = "nxp,pcf8575", .data = 2 }, + { .compatible = "ti,pcf8575", .data = 2 }, + { .compatible = "nxp,pca8574", .data = 1 }, { } }; diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 73dbb22ba0..dad46aa388 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -1,9 +1,10 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (c) 2018 Linaro Limited + * Copyright (c) 2018-2020 Linaro Limited */ #include <common.h> +#include <cpu_func.h> #include <dm.h> #include <dm/device_compat.h> #include <log.h> @@ -295,6 +296,16 @@ static u32 call_err_to_res(u32 call_err) } } +static void flush_shm_dcache(struct udevice *dev, struct optee_msg_arg *arg) +{ + size_t sz = OPTEE_MSG_GET_ARG_SIZE(arg->num_params); + + flush_dcache_range(rounddown((ulong)arg, CONFIG_SYS_CACHELINE_SIZE), + roundup((ulong)arg + sz, CONFIG_SYS_CACHELINE_SIZE)); + + tee_flush_all_shm_dcache(dev); +} + static u32 do_call_with_arg(struct udevice *dev, struct optee_msg_arg *arg) { struct optee_pdata *pdata = dev_get_plat(dev); @@ -305,9 +316,17 @@ static u32 do_call_with_arg(struct udevice *dev, struct optee_msg_arg *arg) while (true) { struct arm_smccc_res res; + /* If cache are off from U-Boot, sync the cache shared with OP-TEE */ + if (!dcache_status()) + flush_shm_dcache(dev, arg); + pdata->invoke_fn(param.a0, param.a1, param.a2, param.a3, param.a4, param.a5, param.a6, param.a7, &res); + /* If cache are off from U-Boot, sync the cache shared with OP-TEE */ + if (!dcache_status()) + flush_shm_dcache(dev, arg); + free(page_list); page_list = NULL; diff --git a/drivers/tee/tee-uclass.c b/drivers/tee/tee-uclass.c index cb1b28e2f8..52412a4098 100644 --- a/drivers/tee/tee-uclass.c +++ b/drivers/tee/tee-uclass.c @@ -1,15 +1,17 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (c) 2018 Linaro Limited + * Copyright (c) 2018-2020 Linaro Limited */ #define LOG_CATEGORY UCLASS_TEE #include <common.h> +#include <cpu_func.h> #include <dm.h> #include <log.h> #include <malloc.h> #include <tee.h> +#include <asm/cache.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> @@ -235,3 +237,18 @@ void tee_optee_ta_uuid_to_octets(u8 d[TEE_UUID_LEN], d[7] = s->time_hi_and_version; memcpy(d + 8, s->clock_seq_and_node, sizeof(s->clock_seq_and_node)); } + +void tee_flush_all_shm_dcache(struct udevice *dev) +{ + struct tee_uclass_priv *priv = dev_get_uclass_priv(dev); + struct tee_shm *s; + + list_for_each_entry(s, &priv->list_shm, link) { + ulong start = rounddown((ulong)s->addr, + CONFIG_SYS_CACHELINE_SIZE); + ulong end = roundup((ulong)s->addr + s->size, + CONFIG_SYS_CACHELINE_SIZE); + + flush_dcache_range(start, end); + } +} diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 2627c2a6a5..e70423f25d 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -375,7 +375,7 @@ #endif #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \ "bootcmd_dhcp=" \ - "setenv devtype " #devtypel "; " \ + "devtype=" #devtypel "; " \ BOOTENV_RUN_NET_USB_START \ BOOTENV_RUN_PCI_ENUM \ "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \ diff --git a/include/configs/SBx81LIFKW.h b/include/configs/SBx81LIFKW.h index eaa6b9246c..ded494cfa9 100644 --- a/include/configs/SBx81LIFKW.h +++ b/include/configs/SBx81LIFKW.h @@ -84,7 +84,6 @@ * Ethernet Driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NET_MULTI /* specify more that one ports available */ #define CONFIG_MVGBE /* Enable kirkwood Gbe Controller Driver */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable a single port */ #define CONFIG_PHY_BASE_ADR 0x01 diff --git a/include/configs/SBx81LIFXCAT.h b/include/configs/SBx81LIFXCAT.h index c0dc3d38c1..06bbd8642e 100644 --- a/include/configs/SBx81LIFXCAT.h +++ b/include/configs/SBx81LIFXCAT.h @@ -84,7 +84,6 @@ * Ethernet Driver configuration */ #ifdef CONFIG_CMD_NET -#define CONFIG_NET_MULTI /* specify more that one ports available */ #define CONFIG_MVGBE /* Enable kirkwood Gbe Controller Driver */ #define CONFIG_MVGBE_PORTS {1, 0} /* enable a single port */ #define CONFIG_PHY_BASE_ADR 0x01 diff --git a/include/configs/ebisu.h b/include/configs/ebisu.h index 19ec74fb58..48d4c8a948 100644 --- a/include/configs/ebisu.h +++ b/include/configs/ebisu.h @@ -14,7 +14,6 @@ #include "rcar-gen3-common.h" /* Ethernet RAVB */ -#define CONFIG_NET_MULTI #define CONFIG_BITBANGMII_MULTI /* Generic Timer Definitions (use in assembler source) */ diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 7318fb6c58..54b5967a89 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -126,6 +126,39 @@ /* Initial environment variables */ #ifdef CONFIG_TARGET_VEXPRESS64_JUNO +/* Copy the kernel and FDT to DRAM memory and boot */ +#define BOOTENV_DEV_AFS(devtypeu, devtypel, instance) \ + "bootcmd_afs=" \ + "afs load ${kernel_name} ${kernel_addr_r} ;"\ + "if test $? -eq 1; then "\ + " echo Loading ${kernel_alt_name} instead of ${kernel_name}; "\ + " afs load ${kernel_alt_name} ${kernel_addr_r};"\ + "fi ; "\ + "afs load ${fdtfile} ${fdt_addr_r} ;"\ + "if test $? -eq 1; then "\ + " echo Loading ${fdt_alt_name} instead of ${fdtfile}; "\ + " afs load ${fdt_alt_name} ${fdt_addr_r}; "\ + "fi ; "\ + "fdt addr ${fdt_addr_r}; fdt resize; " \ + "if afs load ${ramdisk_name} ${ramdisk_addr_r} ; "\ + "then "\ + " setenv ramdisk_param ${ramdisk_addr_r}; "\ + "else "\ + " setenv ramdisk_param -; "\ + "fi ; " \ + "booti ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}\0" +#define BOOTENV_DEV_NAME_AFS(devtypeu, devtypel, instance) "afs " + +#define BOOT_TARGET_DEVICES(func) \ + func(USB, usb, 0) \ + func(SATA, sata, 0) \ + func(SATA, sata, 1) \ + func(PXE, pxe, na) \ + func(DHCP, dhcp, na) \ + func(AFS, afs, na) + +#include <config_distro_bootcmd.h> + /* * Defines where the kernel and FDT exist in NOR flash and where it will * be copied into DRAM @@ -139,30 +172,7 @@ "fdtfile=board.dtb\0" \ "fdt_alt_name=juno\0" \ "fdt_addr_r=0x80000000\0" \ - -#ifndef CONFIG_BOOTCOMMAND -/* Copy the kernel and FDT to DRAM memory and boot */ -#define CONFIG_BOOTCOMMAND "afs load ${kernel_name} ${kernel_addr_r} ;"\ - "if test $? -eq 1; then "\ - " echo Loading ${kernel_alt_name} instead of "\ - "${kernel_name}; "\ - " afs load ${kernel_alt_name} ${kernel_addr_r};"\ - "fi ; "\ - "afs load ${fdtfile} ${fdt_addr_r} ;"\ - "if test $? -eq 1; then "\ - " echo Loading ${fdt_alt_name} instead of "\ - "${fdtfile}; "\ - " afs load ${fdt_alt_name} ${fdt_addr_r}; "\ - "fi ; "\ - "fdt addr ${fdt_addr_r}; fdt resize; " \ - "if afs load ${ramdisk_name} ${ramdisk_addr_r} ; "\ - "then "\ - " setenv ramdisk_param ${ramdisk_addr_r}; "\ - " else setenv ramdisk_param -; "\ - "fi ; " \ - "booti ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}" -#endif - + BOOTENV #elif CONFIG_TARGET_VEXPRESS64_BASE_FVP #define CONFIG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index ebe81968d1..aae128f5ed 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -53,7 +53,6 @@ /* Ethernet driver */ #if defined(CONFIG_ZYNQ_GEM) -# define CONFIG_NET_MULTI # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN # define PHY_ANEG_TIMEOUT 20000 #endif diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h index 1bdc8d3cbd..695e78ad0d 100644 --- a/include/dm/pinctrl.h +++ b/include/dm/pinctrl.h @@ -587,7 +587,7 @@ int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf, * * This allows to know the number of pins owned by a given pin-controller * - * Return: Number of pins if OK, or negative error code on failure + * Return: Number of pins if OK, or -ENOSYS when not supported */ int pinctrl_get_pins_count(struct udevice *dev); diff --git a/include/mux.h b/include/mux.h index 23844f480a..9f80991274 100644 --- a/include/mux.h +++ b/include/mux.h @@ -51,7 +51,7 @@ unsigned int mux_control_states(struct mux_control *mux); */ int __must_check mux_control_select(struct mux_control *mux, unsigned int state); -#define mux_control_try_select(mux) mux_control_select(mux) +#define mux_control_try_select(mux, state) mux_control_select(mux, state) /** * mux_control_deselect() - Deselect the previously selected multiplexer state. @@ -128,7 +128,7 @@ int __must_check mux_control_select(struct mux_control *mux, return -ENOSYS; } -#define mux_control_try_select(mux) mux_control_select(mux) +#define mux_control_try_select(mux, state) mux_control_select(mux, state) int mux_control_deselect(struct mux_control *mux) { diff --git a/include/tee.h b/include/tee.h index 99367b258e..2ef29bfc8f 100644 --- a/include/tee.h +++ b/include/tee.h @@ -377,4 +377,10 @@ void tee_optee_ta_uuid_from_octets(struct tee_optee_ta_uuid *d, void tee_optee_ta_uuid_to_octets(u8 d[TEE_UUID_LEN], const struct tee_optee_ta_uuid *s); +/** + * tee_flush_all_shm_dcache() - Flush data cache for all shared memories + * @dev: The TEE device + */ +void tee_flush_all_shm_dcache(struct udevice *dev); + #endif /* __TEE_H */ diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 2cfe43a6bd..a59adb1e6d 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -8,5 +8,6 @@ endif obj-y += mem.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o +obj-$(CONFIG_CMD_PINMUX) += pinmux.o obj-$(CONFIG_CMD_PWM) += pwm.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c new file mode 100644 index 0000000000..8ae807b537 --- /dev/null +++ b/test/cmd/pinmux.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Executes tests for pinmux command + * + * Copyright (C) 2021, STMicroelectronics - All Rights Reserved + */ + +#include <common.h> +#include <command.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) +{ + /* Test that 'pinmux status <pinname>' displays the selected pin. */ + console_record_reset(); + run_command("pinmux status a5", 0); + ut_assert_nextline("a5 : gpio input . "); + ut_assert_console_end(); + + console_record_reset(); + run_command("pinmux status P7", 0); + ut_assert_nextline("P7 : GPIO2 bias-pull-down input-enable. "); + ut_assert_console_end(); + + console_record_reset(); + run_command("pinmux status P9", 0); + ut_assert_nextline("single-pinctrl pinctrl-single-no-width: missing register width"); + ut_assert_nextline("P9 not found"); + ut_assert_console_end(); + + return 0; +} + +DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/py/tests/test_pinmux.py b/test/py/tests/test_pinmux.py index 0cbbae000c..b3ae2ab024 100644 --- a/test/py/tests/test_pinmux.py +++ b/test/py/tests/test_pinmux.py @@ -13,9 +13,9 @@ def test_pinmux_usage_1(u_boot_console): @pytest.mark.buildconfigspec('cmd_pinmux') def test_pinmux_usage_2(u_boot_console): """Test that 'pinmux status' executed without previous "pinmux dev" - command displays pinmux usage.""" + command displays error message.""" output = u_boot_console.run_command('pinmux status') - assert 'Usage:' in output + assert 'pin-controller device not selected' in output @pytest.mark.buildconfigspec('cmd_pinmux') @pytest.mark.boardspec('sandbox') |