diff options
Diffstat (limited to 'include')
29 files changed, 574 insertions, 321 deletions
diff --git a/include/axp221.h b/include/axp221.h index 32b988f3a9c..8a4a3cca82f 100644 --- a/include/axp221.h +++ b/include/axp221.h @@ -53,10 +53,6 @@ #ifdef CONFIG_AXP221_POWER #define AXP_POWER_STATUS 0x00 #define AXP_POWER_STATUS_ALDO_IN BIT(0) -#define AXP_VBUS_IPSOUT 0x30 -#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) -#define AXP_MISC_CTRL 0x8f -#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) #define AXP_GPIO0_CTRL 0x90 #define AXP_GPIO1_CTRL 0x92 #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ diff --git a/include/axp809.h b/include/axp809.h index 71a7cb2aaa1..3bd71b3d1a3 100644 --- a/include/axp809.h +++ b/include/axp809.h @@ -47,10 +47,6 @@ #ifdef CONFIG_AXP809_POWER #define AXP_POWER_STATUS 0x00 #define AXP_POWER_STATUS_ALDO_IN BIT(0) -#define AXP_VBUS_IPSOUT 0x30 -#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) -#define AXP_MISC_CTRL 0x8f -#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) #define AXP_GPIO0_CTRL 0x90 #define AXP_GPIO1_CTRL 0x92 #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ diff --git a/include/axp818.h b/include/axp818.h index 08ac35d15fa..b3a9686e0e5 100644 --- a/include/axp818.h +++ b/include/axp818.h @@ -61,10 +61,6 @@ #ifdef CONFIG_AXP818_POWER #define AXP_POWER_STATUS 0x00 #define AXP_POWER_STATUS_ALDO_IN BIT(0) -#define AXP_VBUS_IPSOUT 0x30 -#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) -#define AXP_MISC_CTRL 0x8f -#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) #define AXP_GPIO0_CTRL 0x90 #define AXP_GPIO1_CTRL 0x92 #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 8ac3a4feeb8..7b6ac6eed9d 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -194,6 +194,11 @@ #define SCAN_DEV_FOR_EFI #endif +#ifndef SCAN_DEV_FOR_BOOT_PARTS +#define SCAN_DEV_FOR_BOOT_PARTS \ + "part list ${devtype} ${devnum} -bootable devplist; " +#endif + #ifdef CONFIG_SATA #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata) #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV @@ -538,7 +543,7 @@ "\0" \ \ "scan_dev_for_boot_part=" \ - "part list ${devtype} ${devnum} -bootable devplist; " \ + SCAN_DEV_FOR_BOOT_PARTS \ "env exists devplist || setenv devplist 1; " \ "for distro_bootpart in ${devplist}; do " \ "if fstype ${devtype} " \ diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index cf43fc05025..d2164b41d6d 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -126,6 +126,8 @@ "setenv fdtfile am335x-bonegreen.dtb; fi; " \ "if test $board_name = BBGW; then " \ "setenv fdtfile am335x-bonegreen-wireless.dtb; fi; " \ + "if test $board_name = BBGE; then " \ + "setenv fdtfile am335x-bonegreen-eco.dtb; fi; " \ "if test $board_name = BBBL; then " \ "setenv fdtfile am335x-boneblue.dtb; fi; " \ "if test $board_name = BBEN; then " \ diff --git a/include/configs/imx95_evk.h b/include/configs/imx95_evk.h new file mode 100644 index 00000000000..2eebdadc51d --- /dev/null +++ b/include/configs/imx95_evk.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2025 NXP + */ + +#ifndef __IMX95_EVK_H +#define __IMX95_EVK_H + +#include <linux/sizes.h> +#include <linux/stringify.h> +#include <asm/arch/imx-regs.h> + +#define CFG_SYS_INIT_RAM_ADDR 0x90000000 +#define CFG_SYS_INIT_RAM_SIZE 0x200000 + +#define CFG_SYS_SDRAM_BASE 0x90000000 +#define PHYS_SDRAM 0x90000000 +/* Totally 16GB */ +#define PHYS_SDRAM_SIZE 0x70000000 /* 2GB - 256MB DDR */ +#define PHYS_SDRAM_2_SIZE 0x380000000 /* 14GB */ + +#define WDOG_BASE_ADDR WDG3_BASE_ADDR + +#endif diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h index 00ec9efba57..e6f8dee668d 100644 --- a/include/configs/stm32f746-disco.h +++ b/include/configs/stm32f746-disco.h @@ -30,7 +30,7 @@ #include <config_distro_bootcmd.h> #define CFG_EXTRA_ENV_SETTINGS \ "kernel_addr_r=0xC0008000\0" \ - "fdtfile="CONFIG_DEFAULT_DEVICE_TREE".dtb\0" \ + "fdtfile="CONFIG_DEFAULT_FDT_FILE".dtb\0" \ "fdt_addr_r=0xC0408000\0" \ "scriptaddr=0xC0418000\0" \ "pxefile_addr_r=0xC0428000\0" \ diff --git a/include/configs/stm32mp15_dh_dhsom.h b/include/configs/stm32mp15_dh_dhsom.h index c004a8cec82..267e3446779 100644 --- a/include/configs/stm32mp15_dh_dhsom.h +++ b/include/configs/stm32mp15_dh_dhsom.h @@ -17,7 +17,40 @@ " 0x800000\0" #endif +/* Add the search for AB partitons */ +#define SCAN_DEV_FOR_BOOT_PARTS \ + "run dh_check_if_ab; " \ + "if test -z \"${devplist}\"; " \ + "then " \ + "part list ${devtype} ${devnum} -bootable devplist; " \ + "fi; " + #define STM32MP_BOARD_EXTRA_ENV \ + "altbootcmd= " \ + "setenv dh_ab_get_partnames " \ + "'setenv dh_ab_partnames ${dh_ab_partname_secondary} " \ + "${dh_ab_partname_primary}' && " \ + "run bootcmd\0" \ + "dh_check_if_ab= " /* Sets devplist if AB partitions*/ \ + "echo test for AB on ${devtype} ${devnum} && " \ + "run dh_ab_get_partnames && " \ + "setenv devplist && " \ + "for partname in ${dh_ab_partnames}; do " \ + "setenv partnum && " \ + "if part number ${devtype} ${devnum} ${partname} partnum; "\ + "then " \ + "setenv devplist \"${devplist} ${partnum}\" && "\ + "setenv bootretry 60 ;" \ + "fi; " \ + "done ; " \ + "if test -n \"${devplist}\"; " \ + "then echo AB partitions found! ; " \ + "fi\0" \ + "dh_ab_get_partnames= " /* Sets dh_ab_partnames */ \ + "setenv dh_ab_partnames ${dh_ab_partname_primary} " \ + "${dh_ab_partname_secondary}\0" \ + "dh_ab_partname_primary=rootfs-a\0" /* Names of AB partitions */\ + "dh_ab_partname_secondary=rootfs-b\0" \ "dh_preboot=" \ "run dh_testbench_backward_compat\0" \ "dh_update_sd_to_emmc=" /* Install U-Boot from SD to eMMC */ \ diff --git a/include/configs/stm32mp25_common.h b/include/configs/stm32mp25_common.h index ec980eea856..b42316fd8ac 100644 --- a/include/configs/stm32mp25_common.h +++ b/include/configs/stm32mp25_common.h @@ -21,4 +21,106 @@ */ #define CFG_SYS_BOOTMAPSZ SZ_256M +/*****************************************************************************/ +#ifdef CONFIG_DISTRO_DEFAULTS +/*****************************************************************************/ + +#ifdef CONFIG_NET +#define BOOT_TARGET_PXE(func) func(PXE, pxe, na) +#else +#define BOOT_TARGET_PXE(func) +#endif + +#ifdef CONFIG_CMD_MMC +#define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0) +#define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1) +#define BOOT_TARGET_MMC2(func) func(MMC, mmc, 2) +#else +#define BOOT_TARGET_MMC0(func) +#define BOOT_TARGET_MMC1(func) +#define BOOT_TARGET_MMC2(func) +#endif + +#ifdef CONFIG_CMD_UBIFS +#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot) +#else +#define BOOT_TARGET_UBIFS(func) +#endif + +#ifdef CONFIG_CMD_USB +#define BOOT_TARGET_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_USB(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_MMC1(func) \ + BOOT_TARGET_UBIFS(func) \ + BOOT_TARGET_MMC0(func) \ + BOOT_TARGET_MMC2(func) \ + BOOT_TARGET_USB(func) \ + BOOT_TARGET_PXE(func) + +/* + * default bootcmd for stm32mp25: + * for serial/usb: execute the stm32prog command + * for mmc boot (eMMC, SD card), distro boot on the same mmc device + * for NAND or SPI-NAND boot, distro boot with UBIFS on UBI partition + * for other boot, use the default distro order in ${boot_targets} + */ +#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \ + "echo \"Boot over ${boot_device}${boot_instance}!\";" \ + "if test ${boot_device} = serial || test ${boot_device} = usb;" \ + "then stm32prog ${boot_device} ${boot_instance}; " \ + "else " \ + "run env_check;" \ + "if test ${boot_device} = mmc;" \ + "then env set boot_targets \"mmc${boot_instance}\"; fi;" \ + "if test ${boot_device} = nand ||" \ + " test ${boot_device} = spi-nand ;" \ + "then env set boot_targets ubifs0; fi;" \ + "run distro_bootcmd;" \ + "fi;\0" + +#ifndef STM32MP_BOARD_EXTRA_ENV +#define STM32MP_BOARD_EXTRA_ENV +#endif + +#define STM32MP_EXTRA \ + "env_check=if env info -p -d -q; then env save; fi\0" \ + "boot_net_usb_start=true\0" +/* + * memory layout for 96MB uncompressed/compressed kernel, + * 1M fdt, 1M script, 1M pxe and 1M for overlay + * and the ramdisk at the end. + */ +#define __KERNEL_COMP_ADDR_R __stringify(0x84000000) +#define __KERNEL_COMP_SIZE_R __stringify(0x04000000) +#define __KERNEL_ADDR_R __stringify(0x8a000000) +#define __FDT_ADDR_R __stringify(0x90000000) +#define __SCRIPT_ADDR_R __stringify(0x90100000) +#define __PXEFILE_ADDR_R __stringify(0x90200000) +#define __FDTOVERLAY_ADDR_R __stringify(0x90300000) +#define __RAMDISK_ADDR_R __stringify(0x90400000) + +#define STM32MP_MEM_LAYOUT \ + "kernel_addr_r=" __KERNEL_ADDR_R "\0" \ + "fdt_addr_r=" __FDT_ADDR_R "\0" \ + "scriptaddr=" __SCRIPT_ADDR_R "\0" \ + "pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \ + "fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \ + "ramdisk_addr_r=" __RAMDISK_ADDR_R "\0" \ + "kernel_comp_addr_r=" __KERNEL_COMP_ADDR_R "\0" \ + "kernel_comp_size=" __KERNEL_COMP_SIZE_R "\0" + +#include <config_distro_bootcmd.h> +#define CFG_EXTRA_ENV_SETTINGS \ + STM32MP_MEM_LAYOUT \ + STM32MP_BOOTCMD \ + BOOTENV \ + STM32MP_EXTRA \ + STM32MP_BOARD_EXTRA_ENV + +#endif + #endif /* __CONFIG_STM32MP25_COMMMON_H */ diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h new file mode 100644 index 00000000000..ab5a4a91644 --- /dev/null +++ b/include/configs/stm32mp25_st_common.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */ +/* + * Copyright (C) 2022, STMicroelectronics - All Rights Reserved + * + * Configuration settings for the STMicroelectonics STM32MP25x boards + */ + +#ifndef __CONFIG_STM32MP25_ST_COMMON_H__ +#define __CONFIG_STM32MP25_ST_COMMON_H__ + +#define STM32MP_BOARD_EXTRA_ENV \ + "usb_pgood_delay=2000\0" \ + "console=ttySTM0\0" + +#include <configs/stm32mp25_common.h> + +#ifdef CFG_EXTRA_ENV_SETTINGS +/* + * default bootcmd for stm32mp25 STMicroelectronics boards: + * for serial/usb: execute the stm32prog command + * for mmc boot (eMMC, SD card), distro boot on the same mmc device + * for nand or spi-nand boot, distro boot with ubifs on UBI partition or + * sdcard + * for nor boot, distro boot on SD card = mmc0 ONLY ! + */ +#define ST_STM32MP25_BOOTCMD "bootcmd_stm32mp=" \ + "echo \"Boot over ${boot_device}${boot_instance}!\";" \ + "if test ${boot_device} = serial || test ${boot_device} = usb;" \ + "then stm32prog ${boot_device} ${boot_instance}; " \ + "else " \ + "run env_check;" \ + "if test ${boot_device} = mmc;" \ + "then env set boot_targets \"mmc${boot_instance}\"; fi;" \ + "if test ${boot_device} = nand ||" \ + " test ${boot_device} = spi-nand ;" \ + "then env set boot_targets ubifs0 mmc0; fi;" \ + "if test ${boot_device} = nor;" \ + "then env set boot_targets mmc0; fi;" \ + "run distro_bootcmd;" \ + "fi;\0" + +#undef CFG_EXTRA_ENV_SETTINGS +#define CFG_EXTRA_ENV_SETTINGS \ + STM32MP_MEM_LAYOUT \ + ST_STM32MP25_BOOTCMD \ + BOOTENV \ + STM32MP_EXTRA \ + STM32MP_BOARD_EXTRA_ENV + +#endif +#endif diff --git a/include/console.h b/include/console.h index 57fdb0834c1..8d0d7bb8a4c 100644 --- a/include/console.h +++ b/include/console.h @@ -170,6 +170,21 @@ int console_announce_r(void); void console_puts_select_stderr(bool serial_only, const char *s); /** + * console_printf_select_stderr() - Output a formatted string to selected devs + * + * This writes to stderr only. It is useful for outputting errors. Note that it + * uses its own buffer, separate from the print buffer, to allow printing + * messages within console/stdio code + * + * @serial_only: true to output only to serial, false to output to everything + * else + * @fmt: Printf format string, followed by format arguments + * Return: number of characters written + */ +int console_printf_select_stderr(bool serial_only, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + +/** * console_clear() - Clear the console * * Uses an ANSI sequence to clear the display, failing back to clearing the diff --git a/include/dt-bindings/clock/stih407-clks.h b/include/dt-bindings/clock/stih407-clks.h deleted file mode 100644 index 082edd9badf..00000000000 --- a/include/dt-bindings/clock/stih407-clks.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This header provides constants clk index STMicroelectronics - * STiH407 SoC. - */ -#ifndef _DT_BINDINGS_CLK_STIH407 -#define _DT_BINDINGS_CLK_STIH407 - -/* CLOCKGEN A0 */ -#define CLK_IC_LMI0 0 -#define CLK_IC_LMI1 1 - -/* CLOCKGEN C0 */ -#define CLK_ICN_GPU 0 -#define CLK_FDMA 1 -#define CLK_NAND 2 -#define CLK_HVA 3 -#define CLK_PROC_STFE 4 -#define CLK_PROC_TP 5 -#define CLK_RX_ICN_DMU 6 -#define CLK_RX_ICN_DISP_0 6 -#define CLK_RX_ICN_DISP_1 6 -#define CLK_RX_ICN_HVA 7 -#define CLK_RX_ICN_TS 7 -#define CLK_ICN_CPU 8 -#define CLK_TX_ICN_DMU 9 -#define CLK_TX_ICN_HVA 9 -#define CLK_TX_ICN_TS 9 -#define CLK_ICN_COMPO 9 -#define CLK_MMC_0 10 -#define CLK_MMC_1 11 -#define CLK_JPEGDEC 12 -#define CLK_ICN_REG 13 -#define CLK_TRACE_A9 13 -#define CLK_PTI_STM 13 -#define CLK_EXT2F_A9 13 -#define CLK_IC_BDISP_0 14 -#define CLK_IC_BDISP_1 15 -#define CLK_PP_DMU 16 -#define CLK_VID_DMU 17 -#define CLK_DSS_LPC 18 -#define CLK_ST231_AUD_0 19 -#define CLK_ST231_GP_0 19 -#define CLK_ST231_GP_1 20 -#define CLK_ST231_DMU 21 -#define CLK_ICN_LMI 22 -#define CLK_TX_ICN_DISP_0 23 -#define CLK_TX_ICN_DISP_1 23 -#define CLK_ICN_SBC 24 -#define CLK_STFE_FRC2 25 -#define CLK_ETH_PHY 26 -#define CLK_ETH_REF_PHYCLK 27 -#define CLK_FLASH_PROMIP 28 -#define CLK_MAIN_DISP 29 -#define CLK_AUX_DISP 30 -#define CLK_COMPO_DVP 31 - -/* CLOCKGEN D0 */ -#define CLK_PCM_0 0 -#define CLK_PCM_1 1 -#define CLK_PCM_2 2 -#define CLK_SPDIFF 3 - -/* CLOCKGEN D2 */ -#define CLK_PIX_MAIN_DISP 0 -#define CLK_PIX_PIP 1 -#define CLK_PIX_GDP1 2 -#define CLK_PIX_GDP2 3 -#define CLK_PIX_GDP3 4 -#define CLK_PIX_GDP4 5 -#define CLK_PIX_AUX_DISP 6 -#define CLK_DENC 7 -#define CLK_PIX_HDDAC 8 -#define CLK_HDDAC 9 -#define CLK_SDDAC 10 -#define CLK_PIX_DVO 11 -#define CLK_DVO 12 -#define CLK_PIX_HDMI 13 -#define CLK_TMDS_HDMI 14 -#define CLK_REF_HDMIPHY 15 - -/* CLOCKGEN D3 */ -#define CLK_STFE_FRC1 0 -#define CLK_TSOUT_0 1 -#define CLK_TSOUT_1 2 -#define CLK_MCHI 3 -#define CLK_VSENS_COMPO 4 -#define CLK_FRC1_REMOTE 5 -#define CLK_LPC_0 6 -#define CLK_LPC_1 7 -#endif diff --git a/include/dt-bindings/clock/stih410-clks.h b/include/dt-bindings/clock/stih410-clks.h deleted file mode 100644 index 2097a4bbe15..00000000000 --- a/include/dt-bindings/clock/stih410-clks.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This header provides constants clk index STMicroelectronics - * STiH410 SoC. - */ -#ifndef _DT_BINDINGS_CLK_STIH410 -#define _DT_BINDINGS_CLK_STIH410 - -#include "stih407-clks.h" - -/* STiH410 introduces new clock outputs compared to STiH407 */ - -/* CLOCKGEN C0 */ -#define CLK_TX_ICN_HADES 32 -#define CLK_RX_ICN_HADES 33 -#define CLK_ICN_REG_16 34 -#define CLK_PP_HADES 35 -#define CLK_CLUST_HADES 36 -#define CLK_HWPE_HADES 37 -#define CLK_FC_HADES 38 - -/* CLOCKGEN D0 */ -#define CLK_PCMR10_MASTER 4 -#define CLK_USB2_PHY 5 - -#endif diff --git a/include/dt-bindings/mfd/st-lpc.h b/include/dt-bindings/mfd/st-lpc.h deleted file mode 100644 index d05894afa7e..00000000000 --- a/include/dt-bindings/mfd/st-lpc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This header provides shared DT/Driver defines for ST's LPC device - * - * Copyright (C) 2014 STMicroelectronics -- All Rights Reserved - * - * Author: Lee Jones <lee.jones@linaro.org> for STMicroelectronics - */ - -#ifndef __DT_BINDINGS_ST_LPC_H__ -#define __DT_BINDINGS_ST_LPC_H__ - -#define ST_LPC_MODE_RTC 0 -#define ST_LPC_MODE_WDT 1 -#define ST_LPC_MODE_CLKSRC 2 - -#endif /* __DT_BINDINGS_ST_LPC_H__ */ diff --git a/include/dt-bindings/reset/stih407-resets.h b/include/dt-bindings/reset/stih407-resets.h deleted file mode 100644 index 4ab3a1c9495..00000000000 --- a/include/dt-bindings/reset/stih407-resets.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This header provides constants for the reset controller - * based peripheral powerdown requests on the STMicroelectronics - * STiH407 SoC. - */ -#ifndef _DT_BINDINGS_RESET_CONTROLLER_STIH407 -#define _DT_BINDINGS_RESET_CONTROLLER_STIH407 - -/* Powerdown requests control 0 */ -#define STIH407_EMISS_POWERDOWN 0 -#define STIH407_NAND_POWERDOWN 1 - -/* Synp GMAC PowerDown */ -#define STIH407_ETH1_POWERDOWN 2 - -/* Powerdown requests control 1 */ -#define STIH407_USB3_POWERDOWN 3 -#define STIH407_USB2_PORT1_POWERDOWN 4 -#define STIH407_USB2_PORT0_POWERDOWN 5 -#define STIH407_PCIE1_POWERDOWN 6 -#define STIH407_PCIE0_POWERDOWN 7 -#define STIH407_SATA1_POWERDOWN 8 -#define STIH407_SATA0_POWERDOWN 9 - -/* Reset defines */ -#define STIH407_ETH1_SOFTRESET 0 -#define STIH407_MMC1_SOFTRESET 1 -#define STIH407_PICOPHY_SOFTRESET 2 -#define STIH407_IRB_SOFTRESET 3 -#define STIH407_PCIE0_SOFTRESET 4 -#define STIH407_PCIE1_SOFTRESET 5 -#define STIH407_SATA0_SOFTRESET 6 -#define STIH407_SATA1_SOFTRESET 7 -#define STIH407_MIPHY0_SOFTRESET 8 -#define STIH407_MIPHY1_SOFTRESET 9 -#define STIH407_MIPHY2_SOFTRESET 10 -#define STIH407_SATA0_PWR_SOFTRESET 11 -#define STIH407_SATA1_PWR_SOFTRESET 12 -#define STIH407_DELTA_SOFTRESET 13 -#define STIH407_BLITTER_SOFTRESET 14 -#define STIH407_HDTVOUT_SOFTRESET 15 -#define STIH407_HDQVDP_SOFTRESET 16 -#define STIH407_VDP_AUX_SOFTRESET 17 -#define STIH407_COMPO_SOFTRESET 18 -#define STIH407_HDMI_TX_PHY_SOFTRESET 19 -#define STIH407_JPEG_DEC_SOFTRESET 20 -#define STIH407_VP8_DEC_SOFTRESET 21 -#define STIH407_GPU_SOFTRESET 22 -#define STIH407_HVA_SOFTRESET 23 -#define STIH407_ERAM_HVA_SOFTRESET 24 -#define STIH407_LPM_SOFTRESET 25 -#define STIH407_KEYSCAN_SOFTRESET 26 -#define STIH407_USB2_PORT0_SOFTRESET 27 -#define STIH407_USB2_PORT1_SOFTRESET 28 -#define STIH407_ST231_AUD_SOFTRESET 29 -#define STIH407_ST231_DMU_SOFTRESET 30 -#define STIH407_ST231_GP0_SOFTRESET 31 -#define STIH407_ST231_GP1_SOFTRESET 32 - -/* Picophy reset defines */ -#define STIH407_PICOPHY0_RESET 0 -#define STIH407_PICOPHY1_RESET 1 -#define STIH407_PICOPHY2_RESET 2 - -#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH407 */ diff --git a/include/efi_loader.h b/include/efi_loader.h index 144b749278a..84e8cfe320e 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -597,6 +597,8 @@ efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var, void *efi_get_configuration_table(const efi_guid_t *guid); /* Install device tree */ efi_status_t efi_install_fdt(void *fdt); +/* Install initrd */ +efi_status_t efi_install_initrd(void *initrd, size_t initd_sz); /* Execute loaded UEFI image */ efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options); /* Run loaded UEFI image with given fdt */ diff --git a/include/env_internal.h b/include/env_internal.h index c1c0727e4d0..ee939ba4293 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -113,6 +113,7 @@ enum env_location { ENVL_ONENAND, ENVL_REMOTE, ENVL_SPI_FLASH, + ENVL_MTD, ENVL_UBI, ENVL_NOWHERE, diff --git a/include/event.h b/include/event.h index 75141a192a4..1d267f1d105 100644 --- a/include/event.h +++ b/include/event.h @@ -154,6 +154,15 @@ enum event_t { EVT_MAIN_LOOP, /** + * @EVT_OF_LIVE_BUILT: + * This event is triggered immediately after the live device tree has been + * built. This allows for machine specific fixups to be done to the live tree + * (like disabling known-unsupported devices) before it is used. This + * event is only available if OF_LIVE is enabled and is only used after relocation. + */ + EVT_OF_LIVE_BUILT, + + /** * @EVT_COUNT: * This constants holds the maximum event number + 1 and is used when * looping over all event classes. @@ -203,6 +212,15 @@ union event_data { oftree tree; struct bootm_headers *images; } ft_fixup; + + /** + * struct event_of_live_built - livetree has been built + * + * @root: The root node of the live device tree + */ + struct event_of_live_built { + struct device_node *root; + } of_live_built; }; /** diff --git a/include/imx8image.h b/include/imx8image.h index 6b95e93fb50..e0d25c5b6c9 100644 --- a/include/imx8image.h +++ b/include/imx8image.h @@ -157,7 +157,9 @@ enum imx8image_cmd { CMD_SOC_TYPE, CMD_CONTAINER, CMD_IMAGE, - CMD_DATA + CMD_DATA, + CMD_DUMMY_V2X, + CMD_HOLD, }; enum imx8image_core_type { @@ -169,7 +171,9 @@ enum imx8image_core_type { CFG_A35, CFG_A55, CFG_A53, - CFG_A72 + CFG_A72, + CFG_M33, + CFG_OEI, }; enum imx8image_fld_types { @@ -208,7 +212,10 @@ typedef enum option_type { FILEOFF, MSG_BLOCK, SENTINEL, - UPOWER + UPOWER, + OEI, + DUMMY_V2X, + HOLD, } option_type_t; typedef struct { @@ -227,12 +234,16 @@ typedef struct { #define CORE_CA35 4 #define CORE_CA72 5 #define CORE_SECO 6 +#define CORE_M33 7 #define CORE_ULP_CM33 0x1 #define CORE_ULP_CA35 0x2 #define CORE_ULP_UPOWER 0x4 #define CORE_ULP_SENTINEL 0x6 +#define CORE_IMX95_M33P 0 +#define CORE_IMX95_A55C0 2 + #define SC_R_OTP 357U #define SC_R_DEBUG 354U #define SC_R_ROM_0 236U @@ -246,10 +257,12 @@ typedef struct { #define IMG_TYPE_EXEC 0x03 /* Executable image type */ #define IMG_TYPE_DATA 0x04 /* Data image type */ #define IMG_TYPE_DCD_DDR 0x05 /* DCD/DDR image type */ +#define IMG_TYPE_OEI 0x05 /* Optional Executable image type */ #define IMG_TYPE_SECO 0x06 /* SECO image type */ #define IMG_TYPE_SENTINEL 0x06 /* SENTINEL image type */ #define IMG_TYPE_PROV 0x07 /* Provisioning image type */ #define IMG_TYPE_DEK 0x08 /* DEK validation type */ +#define IMG_TYPE_V2X_DUMMY 0x0E /* V2X Dummy image */ #define IMG_TYPE_SHIFT 0 #define IMG_TYPE_MASK 0x1f diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index b8b207f7b5c..4eef4ab0488 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -569,7 +569,7 @@ struct spi_nor { u8 rdsr_dummy; u8 rdsr_addr_nbytes; u8 addr_mode_nbytes; -#ifdef CONFIG_SPI_FLASH_BAR +#if CONFIG_IS_ENABLED(SPI_FLASH_BAR) u8 bank_read_cmd; u8 bank_write_cmd; u8 bank_curr; diff --git a/include/lmb.h b/include/lmb.h index 0d316c64c0a..606a92cca48 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -27,9 +27,9 @@ * %LMB_NONOTIFY: Do not notify other modules of changes to this memory region */ #define LMB_NONE 0 -#define LMB_NOMAP BIT(0) -#define LMB_NOOVERWRITE BIT(1) -#define LMB_NONOTIFY BIT(2) +#define LMB_NOMAP BIT(1) +#define LMB_NOOVERWRITE BIT(2) +#define LMB_NONOTIFY BIT(3) /** * enum lmb_map_op - memory map operation diff --git a/include/pci_ids.h b/include/pci_ids.h index a8939b105f1..cfff275daba 100644 --- a/include/pci_ids.h +++ b/include/pci_ids.h @@ -2725,6 +2725,7 @@ #define PCI_DEVICE_ID_INTEL_I210_SERDES_FLASHLESS 0x157c #define PCI_DEVICE_ID_INTEL_I225_UNPROGRAMMED 0x15fd #define PCI_DEVICE_ID_INTEL_I225_IT 0x0d9f +#define PCI_DEVICE_ID_INTEL_I225_V 0x15f3 #define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index 33e0e18c30d..d6586eb3ff9 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -27,6 +27,7 @@ struct scmi_channel; * @clock_dev: SCMI clock protocol device * @resetdom_dev: SCMI reset domain protocol device * @voltagedom_dev: SCMI voltage domain protocol device + * @pinctrl_dev: SCMI pin control protocol device */ struct scmi_agent_priv { u32 version; @@ -43,6 +44,7 @@ struct scmi_agent_priv { struct udevice *clock_dev; struct udevice *resetdom_dev; struct udevice *voltagedom_dev; + struct udevice *pinctrl_dev; }; static inline u32 scmi_version(struct udevice *dev) @@ -115,4 +117,19 @@ struct scmi_agent_ops { struct scmi_msg *msg); }; +struct scmi_proto_match { + unsigned int proto_id; +}; + +struct scmi_proto_driver { + struct driver *driver; + const struct scmi_proto_match *match; +}; + +#define U_BOOT_SCMI_PROTO_DRIVER(__name, __match) \ + ll_entry_declare(struct scmi_proto_driver, __name, scmi_proto_driver) = { \ + .driver = llsym(struct driver, __name, driver), \ + .match = __match, \ + } + #endif /* _SCMI_TRANSPORT_UCLASS_H */ diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index 7abb2a6f36b..9046de7e3e7 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -24,6 +24,8 @@ enum scmi_std_protocol { SCMI_PROTOCOL_ID_SENSOR = 0x15, SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16, SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17, + SCMI_PROTOCOL_ID_PINCTRL = 0x19, + SCMI_PROTOCOL_ID_IMX_MISC = 0x84, }; enum scmi_status_code { @@ -49,6 +51,10 @@ enum scmi_discovery_id { SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2, }; +enum scmi_imx_misc_message_id { + SCMI_MISC_ROM_PASSOVER_GET = 0x7 +}; + /* * SCMI Base Protocol */ @@ -139,7 +145,7 @@ struct scmi_base_discover_impl_version_out { struct scmi_base_discover_list_protocols_out { s32 status; u32 num_protocols; - u32 protocols[3]; + u32 protocols[]; }; /** @@ -725,12 +731,15 @@ int scmi_pwd_name_get(struct udevice *dev, u32 domain_id, u8 **name); /* * SCMI Clock Protocol */ +#define CLOCK_PROTOCOL_VERSION_3_0 0x30000 enum scmi_clock_message_id { SCMI_CLOCK_ATTRIBUTES = 0x3, SCMI_CLOCK_RATE_SET = 0x5, SCMI_CLOCK_RATE_GET = 0x6, SCMI_CLOCK_CONFIG_SET = 0x7, + SCMI_CLOCK_PARENT_SET = 0xD, + SCMI_CLOCK_GET_PERMISSIONS = 0xF, }; #define SCMI_CLK_PROTO_ATTR_COUNT_MASK GENMASK(15, 0) @@ -769,6 +778,7 @@ struct scmi_clk_attribute_in { struct scmi_clk_attribute_out { s32 status; u32 attributes; +#define CLK_HAS_RESTRICTIONS(x) ((x) & BIT(1)) char clock_name[SCMI_CLOCK_NAME_LENGTH_MAX]; }; @@ -833,6 +843,45 @@ struct scmi_clk_rate_set_out { s32 status; }; +/** + * struct scmi_clk_parent_state_in - Message payload for CLOCK_PARENT_SET command + * @clock_id: SCMI clock ID + * @parent_clk: SCMI clock ID + */ +struct scmi_clk_parent_set_in { + u32 clock_id; + u32 parent_clk; +}; + +/** + * struct scmi_clk_parent_set_out - Response payload for CLOCK_PARENT_SET command + * @status: SCMI command status + */ +struct scmi_clk_parent_set_out { + s32 status; +}; + +/** + * @clock_id: Identifier for the clock device. + */ +struct scmi_clk_get_permissions_in { + u32 clock_id; +}; + +/** + * @status: Negative 32-bit integers are used to return error status codes. + * @permissions: Bit[31] Clock state control, Bit[30] Clock parent control, + * Bit[29] Clock rate control, Bits[28:0] Reserved, must be zero. + */ +struct scmi_clk_get_permissions_out { + s32 status; + u32 permissions; +}; + +#define SUPPORT_CLK_STAT_CONTROL BIT(31) +#define SUPPORT_CLK_PARENT_CONTROL BIT(30) +#define SUPPORT_CLK_RATE_CONTROL BIT(29) + /* * SCMI Reset Domain Protocol */ @@ -1005,4 +1054,57 @@ struct scmi_voltd_level_get_out { s32 voltage_level; }; +/* SCMI Pinctrl Protocol */ +enum scmi_pinctrl_message_id { + SCMI_MSG_PINCTRL_CONFIG_SET = 0x6 +}; + +struct scmi_pin_config { + u32 type; + u32 val; +}; + +/** + * struct scmi_pad_config_set_in - Message payload for PAD_CONFIG_SET command + * @identifier: Identifier for the pin or group. + * @function_id: Identifier for the function selected to be enabled + * for the selected pin or group. This field is set to + * 0xFFFFFFFF if no function should be enabled by the + * pin or group. + * @attributes: Bits[31:11] Reserved, must be zero. + * Bit[10] Function valid. + * Bits[9:2] Number of configurations to set. + * Bits[1:0] Selector: Whether the identifier field + * refers to a pin or a group. + * @configs: Array of configurations. + */ +struct scmi_pinctrl_config_set_in { + u32 identifier; + u32 function_id; + u32 attributes; + struct scmi_pin_config configs[4]; +}; + +struct scmi_pinctrl_config_set_out { + s32 status; +}; + +/* SCMI Perf Protocol */ +enum scmi_perf_message_id { + SCMI_PERF_DOMAIN_ATTRIBUTES = 0x3, + SCMI_PERF_DESCRIBE_LEVELS = 0x4, + SCMI_PERF_LIMITS_SET = 0x5, + SCMI_PERF_LIMITS_GET = 0x6, + SCMI_PERF_LEVEL_SET = 0x7, + SCMI_PERF_LEVEL_GET = 0x8 +}; + +struct scmi_perf_in { + u32 domain_id; + u32 perf_level; +}; + +struct scmi_perf_out { + s32 status; +}; #endif /* _SCMI_PROTOCOLS_H */ diff --git a/include/sunxi_gpio.h b/include/sunxi_gpio.h index 122987c395e..12b54c8dda4 100644 --- a/include/sunxi_gpio.h +++ b/include/sunxi_gpio.h @@ -82,7 +82,6 @@ enum sunxi_gpio_number { SUNXI_GPIO_L_START = 352, SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M), - SUNXI_GPIO_AXP0_START = 1024, }; /* SUNXI GPIO number definitions */ @@ -99,8 +98,6 @@ enum sunxi_gpio_number { #define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr)) #define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr)) -#define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr)) - /* GPIO pin function config */ #define SUNXI_GPIO_INPUT 0 #define SUNXI_GPIO_OUTPUT 1 @@ -185,11 +182,6 @@ enum sunxi_gpio_number { #define SUNXI_GPIO_PULL_UP 1 #define SUNXI_GPIO_PULL_DOWN 2 -/* Virtual AXP0 GPIOs */ -#define SUNXI_GPIO_AXP0_PREFIX "AXP0-" -#define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 -#define SUNXI_GPIO_AXP0_GPIO_COUNT 6 - struct sunxi_gpio_plat { void *regs; char bank_name[3]; diff --git a/include/test/video.h b/include/test/video.h new file mode 100644 index 00000000000..000fd708c86 --- /dev/null +++ b/include/test/video.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2013 Google, Inc. + */ + +#ifndef __TEST_VIDEO_H +#define __TEST_VIDEO_H + +#include <stdbool.h> + +struct udevice; +struct unit_test_state; + +/** + * video_compress_fb() - Compress the frame buffer and return its size + * + * We want to write tests which perform operations on the video console and + * check that the frame buffer ends up with the correct contents. But it is + * painful to store 'known good' images for comparison with the frame + * buffer. As an alternative, we can compress the frame buffer and check the + * size of the compressed data. This provides a pretty good level of + * certainty and the resulting tests need only check a single value. + * + * @uts: Test state + * @dev: Video device + * @use_copy: Use copy frame buffer if available + * Return: compressed size of the frame buffer, or -ve on error + */ +int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, + bool use_copy); + +/** + * check_copy_frame_buffer() - Compare main frame buffer to copy + * + * If the copy frame buffer is enabled, this compares it to the main + * frame buffer. Normally they should have the same contents after a + * sync. + * + * @uts: Test state + * @dev: Video device + * Return: 0, or -ve on error + */ +int video_check_copy_fb(struct unit_test_state *uts, struct udevice *dev); + +#endif diff --git a/include/uthread.h b/include/uthread.h index 89fa552a6f6..11a19aa9488 100644 --- a/include/uthread.h +++ b/include/uthread.h @@ -51,7 +51,10 @@ struct uthread { }; /** - * Internal state of a struct uthread_mutex + * enum uthread_mutex_state - internal state of a struct uthread_mutex + * + * @UTHREAD_MUTEX_UNLOCKED: mutex has no owner + * @UTHREAD_MUTEX_LOCKED: mutex has one owner */ enum uthread_mutex_state { UTHREAD_MUTEX_UNLOCKED = 0, @@ -59,7 +62,9 @@ enum uthread_mutex_state { }; /** - * Uthread mutex + * struct uthread_mutex - a mutex object + * + * @state: the internal state of the mutex */ struct uthread_mutex { enum uthread_mutex_state state; diff --git a/include/video.h b/include/video.h index a1f7fd7e839..9ea6b676463 100644 --- a/include/video.h +++ b/include/video.h @@ -85,6 +85,11 @@ enum video_format { * @fb_size: Frame buffer size * @copy_fb: Copy of the frame buffer to keep up to date; see struct * video_uc_plat + * @damage: A bounding box of framebuffer regions updated since last sync + * @damage.xstart: X start position in pixels from the left + * @damage.ystart: Y start position in pixels from the top + * @damage.xend: X end position in pixels from the left + * @damage.xend: Y end position in pixels from the top * @line_length: Length of each frame buffer line, in bytes. This can be * set by the driver, but if not, the uclass will set it after * probing @@ -95,6 +100,7 @@ enum video_format { * @fg_col_idx: Foreground color code (bit 3 = bold, bit 0-2 = color) * @bg_col_idx: Background color code (bit 3 = bold, bit 0-2 = color) * @last_sync: Monotonic time of last video sync + * @white_on_black: Use a black background */ struct video_priv { /* Things set up by the driver: */ @@ -113,6 +119,12 @@ struct video_priv { void *fb; int fb_size; void *copy_fb; + struct { + int xstart; + int ystart; + int xend; + int yend; + } damage; int line_length; u32 colour_fg; u32 colour_bg; @@ -120,6 +132,7 @@ struct video_priv { u8 fg_col_idx; u8 bg_col_idx; ulong last_sync; + bool white_on_black; }; /** @@ -236,7 +249,7 @@ int video_fill(struct udevice *dev, u32 colour); /** * video_fill_part() - Erase a region * - * Erase a rectangle of the display within the given bounds. + * Erase a rectangle on the display within the given bounds * * @dev: Device to update * @xstart: X start position in pixels from the left @@ -250,6 +263,23 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, int yend, u32 colour); /** + * video_draw_box() - Draw a box + * + * Draw a rectangle on the display within the given bounds + * + * @dev: Device to update + * @x0: X start position in pixels from the left + * @y0: Y start position in pixels from the top + * @x1: X end position in pixels from the left + * @y1: Y end position in pixels from the top + * @width: width in pixels + * @colour: Value to write + * Return: 0 if OK, -ENOSYS if the display depth is not supported + */ +int video_draw_box(struct udevice *dev, int x0, int y0, int x1, int y1, + int width, u32 colour); + +/** * video_sync() - Sync a device's frame buffer with its hardware * * @vid: Device to sync @@ -259,8 +289,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, * @return: 0 on success, error code otherwise * * Some frame buffers are cached or have a secondary frame buffer. This - * function syncs these up so that the current contents of the U-Boot frame - * buffer are displayed to the user. + * function syncs the damaged parts of them up so that the current contents + * of the U-Boot frame buffer are displayed to the user. It clears the damage + * buffer. */ int video_sync(struct udevice *vid, bool force); @@ -335,6 +366,16 @@ void video_set_flush_dcache(struct udevice *dev, bool flush); void video_set_default_colors(struct udevice *dev, bool invert); /** + * video_set_white_on_black() - Change the setting for white-on-black + * + * This does nothing if the setting is already the same. + * + * @dev: video device + * @white_on_black: true to use white-on-black, false for black-on-white + */ +void video_set_white_on_black(struct udevice *dev, bool white_on_black); + +/** * video_default_font_height() - Get the default font height * * @dev: video device @@ -343,42 +384,29 @@ void video_set_default_colors(struct udevice *dev, bool invert); */ int video_default_font_height(struct udevice *dev); -#ifdef CONFIG_VIDEO_COPY +#ifdef CONFIG_VIDEO_DAMAGE /** - * vidconsole_sync_copy() - Sync back to the copy framebuffer + * video_damage() - Notify the video subsystem about screen updates. * - * This ensures that the copy framebuffer has the same data as the framebuffer - * for a particular region. It should be called after the framebuffer is updated - * - * @from and @to can be in either order. The region between them is synced. - * - * @dev: Vidconsole device being updated - * @from: Start/end address within the framebuffer (->fb) - * @to: Other address within the frame buffer - * Return: 0 if OK, -EFAULT if the start address is before the start of the - * frame buffer start - */ -int video_sync_copy(struct udevice *dev, void *from, void *to); - -/** - * video_sync_copy_all() - Sync the entire framebuffer to the copy + * @vid: Device to sync + * @x: Upper left X coordinate of the damaged rectangle + * @y: Upper left Y coordinate of the damaged rectangle + * @width: Width of the damaged rectangle + * @height: Height of the damaged rectangle * - * @dev: Vidconsole device being updated - * Return: 0 (always) + * Some frame buffers are cached or have a secondary frame buffer. This + * function notifies the video subsystem about rectangles that were updated + * within the frame buffer. They may only get written to the screen on the + * next call to video_sync(). */ -int video_sync_copy_all(struct udevice *dev); +void video_damage(struct udevice *vid, int x, int y, int width, int height); #else -static inline int video_sync_copy(struct udevice *dev, void *from, void *to) -{ - return 0; -} - -static inline int video_sync_copy_all(struct udevice *dev) +static inline void video_damage(struct udevice *vid, int x, int y, int width, + int height) { - return 0; + return; } - -#endif +#endif /* CONFIG_VIDEO_DAMAGE */ /** * video_is_active() - Test if one video device it active diff --git a/include/video_console.h b/include/video_console.h index 723d2315606..8f3f58f3aa9 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -6,6 +6,7 @@ #ifndef __video_console_h #define __video_console_h +#include <alist.h> #include <video.h> struct abuf; @@ -52,6 +53,7 @@ enum { * @row_saved: Saved Y position in pixels (0=top) * @escape_buf: Buffer to accumulate escape sequence * @utf8_buf: Buffer to accumulate UTF-8 byte sequence + * @quiet: Suppress all output from stdio */ struct vidconsole_priv { struct stdio_dev sdev; @@ -76,6 +78,7 @@ struct vidconsole_priv { int col_saved; char escape_buf[32]; char utf8_buf[5]; + bool quiet; }; /** @@ -120,6 +123,19 @@ struct vidconsole_bbox { }; /** + * vidconsole_mline - Holds information about a line of measured text + * + * @bbox: Bounding box of the line, assuming it starts at 0,0 + * @start: String index of the first character in the line + * @len: Number of characters in the line + */ +struct vidconsole_mline { + struct vidconsole_bbox bbox; + int start; + int len; +}; + +/** * struct vidconsole_ops - Video console operations * * These operations work on either an absolute console position (measured @@ -228,18 +244,26 @@ struct vidconsole_ops { int (*select_font)(struct udevice *dev, const char *name, uint size); /** - * measure() - Measure the bounds of some text + * measure() - Measure the bounding box of some text * - * @dev: Device to adjust + * The text can include newlines + * + * @dev: Console device to use * @name: Font name to use (NULL to use default) * @size: Font size to use (0 to use default) * @text: Text to measure + * @limit: Width limit for each line, or -1 if none * @bbox: Returns bounding box of text, assuming it is positioned * at 0,0 + * @lines: If non-NULL, this must be an alist of + * struct vidconsole_mline inited by caller. A separate + * record is added for each line of text + * * Returns: 0 on success, -ENOENT if no such font */ int (*measure)(struct udevice *dev, const char *name, uint size, - const char *text, struct vidconsole_bbox *bbox); + const char *text, int limit, + struct vidconsole_bbox *bbox, struct alist *lines); /** * nominal() - Measure the expected width of a line of text @@ -320,19 +344,27 @@ int vidconsole_get_font(struct udevice *dev, int seq, */ int vidconsole_select_font(struct udevice *dev, const char *name, uint size); -/* - * vidconsole_measure() - Measuring the bounding box of some text +/** + * vidconsole_measure() - Measure the bounding box of some text * - * @dev: Console device to use - * @name: Font name, NULL for default - * @size: Font size, ignored if @name is NULL - * @text: Text to measure - * @bbox: Returns nounding box of text - * Returns: 0 if OK, -ve on error + * The text can include newlines + * + * @dev: Device to adjust + * @name: Font name to use (NULL to use default) + * @size: Font size to use (0 to use default) + * @text: Text to measure + * @limit: Width limit for each line, or -1 if none + * @bbox: Returns bounding box of text, assuming it is positioned + * at 0,0 + * @lines: If non-NULL, this must be an alist of + * struct vidconsole_mline inited by caller. The list is emptied + * and then a separate record is added for each line of text + * + * Returns: 0 on success, -ENOENT if no such font */ int vidconsole_measure(struct udevice *dev, const char *name, uint size, - const char *text, struct vidconsole_bbox *bbox); - + const char *text, int limit, + struct vidconsole_bbox *bbox, struct alist *lines); /** * vidconsole_nominal() - Measure the expected width of a line of text * @@ -470,6 +502,23 @@ int vidconsole_entry_start(struct udevice *dev); int vidconsole_put_char(struct udevice *dev, char ch); /** + * vidconsole_put_stringn() - Output part of a string to the current console pos + * + * Outputs part of a string to the console and advances the cursor. This + * function handles wrapping to new lines and scrolling the console. Special + * characters are handled also: \n, \r, \b and \t. + * + * The device always starts with the cursor at position 0,0 (top left). It + * can be adjusted manually using vidconsole_position_cursor(). + * + * @dev: Device to adjust + * @str: String to write + * @maxlen: Maximum chars to output, or -1 for all + * Return: 0 if OK, -ve on error + */ +int vidconsole_put_stringn(struct udevice *dev, const char *str, int maxlen); + +/** * vidconsole_put_string() - Output a string to the current console position * * Outputs a string to the console and advances the cursor. This function @@ -537,56 +586,12 @@ void vidconsole_list_fonts(struct udevice *dev); */ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep); -#ifdef CONFIG_VIDEO_COPY -/** - * vidconsole_sync_copy() - Sync back to the copy framebuffer - * - * This ensures that the copy framebuffer has the same data as the framebuffer - * for a particular region. It should be called after the framebuffer is updated - * - * @from and @to can be in either order. The region between them is synced. - * - * @dev: Vidconsole device being updated - * @from: Start/end address within the framebuffer (->fb) - * @to: Other address within the frame buffer - * Return: 0 if OK, -EFAULT if the start address is before the start of the - * frame buffer start - */ -int vidconsole_sync_copy(struct udevice *dev, void *from, void *to); - /** - * vidconsole_memmove() - Perform a memmove() within the frame buffer + * vidconsole_set_quiet() - Select whether the console should output stdio * - * This handles a memmove(), e.g. for scrolling. It also updates the copy - * framebuffer. - * - * @dev: Vidconsole device being updated - * @dst: Destination address within the framebuffer (->fb) - * @src: Source address within the framebuffer (->fb) - * @size: Number of bytes to transfer - * Return: 0 if OK, -EFAULT if the start address is before the start of the - * frame buffer start + * @dev: vidconsole device + * @quiet: true to suppress stdout/stderr output, false to enable it */ -int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, - int size); -#else - -#include <string.h> - -static inline int vidconsole_sync_copy(struct udevice *dev, void *from, - void *to) -{ - return 0; -} - -static inline int vidconsole_memmove(struct udevice *dev, void *dst, - const void *src, int size) -{ - memmove(dst, src, size); - - return 0; -} - -#endif +void vidconsole_set_quiet(struct udevice *dev, bool quiet); #endif |