[PATCH v2 0/4] efi_loader: centralize known vendor GUIDs
The UEFI specification defines which vendor GUIDs should be used for predefined variables like 'PK'. Currently we have multiple places where this relationship is stored. With this patch series a function for retrieving the GUID is provided and existing code is adjusted to used it. v2: Remove a superfluous value check. Adjust commit messages and comments in the code. Heinrich Schuchardt (4): efi_loader: treat UEFI variable name as const efi_loader: function to get GUID for variable name efi_loader: simplify efi_sigstore_parse_sigdb() efi_loader: simplify tcg2_measure_secure_boot_variable() include/efi_loader.h | 2 +- include/efi_variable.h| 24 ++- lib/efi_loader/efi_signature.c| 38 --- lib/efi_loader/efi_tcg2.c | 31 - lib/efi_loader/efi_var_common.c | 14 ++-- lib/efi_loader/efi_var_mem.c | 7 +++--- lib/efi_loader/efi_variable.c | 9 lib/efi_loader/efi_variable_tee.c | 16 - 8 files changed, 69 insertions(+), 72 deletions(-) -- 2.32.0
[PATCH v2 1/4] efi_loader: treat UEFI variable name as const
UEFI variable names are typically constants and hence should be defined as const. Unfortunately some of our API functions do not define the parameters for UEFI variable names as const. This requires unnecessary conversions. Adjust parameters of several internal functions to tre UEFI variable names as const. Signed-off-by: Heinrich Schuchardt --- v2: adjust commit message --- include/efi_loader.h | 2 +- include/efi_variable.h| 16 ++-- lib/efi_loader/efi_tcg2.c | 2 +- lib/efi_loader/efi_var_common.c | 5 +++-- lib/efi_loader/efi_var_mem.c | 7 --- lib/efi_loader/efi_variable.c | 9 + lib/efi_loader/efi_variable_tee.c | 16 ++-- 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index c440962fe5..125052d002 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -816,7 +816,7 @@ efi_status_t EFIAPI efi_query_variable_info( u64 *remaining_variable_storage_size, u64 *maximum_variable_size); -void *efi_get_var(u16 *name, const efi_guid_t *vendor, efi_uintn_t *size); +void *efi_get_var(const u16 *name, const efi_guid_t *vendor, efi_uintn_t *size); /* * See section 3.1.3 in the v2.7 UEFI spec for more details on diff --git a/include/efi_variable.h b/include/efi_variable.h index 0440d356bc..8f666b2309 100644 --- a/include/efi_variable.h +++ b/include/efi_variable.h @@ -32,7 +32,8 @@ enum efi_auth_var_type { * @timep: authentication time (seconds since start of epoch) * Return: status code */ -efi_status_t efi_get_variable_int(u16 *variable_name, const efi_guid_t *vendor, +efi_status_t efi_get_variable_int(const u16 *variable_name, + const efi_guid_t *vendor, u32 *attributes, efi_uintn_t *data_size, void *data, u64 *timep); @@ -47,7 +48,8 @@ efi_status_t efi_get_variable_int(u16 *variable_name, const efi_guid_t *vendor, * @ro_check: check the read only read only bit in attributes * Return: status code */ -efi_status_t efi_set_variable_int(u16 *variable_name, const efi_guid_t *vendor, +efi_status_t efi_set_variable_int(const u16 *variable_name, + const efi_guid_t *vendor, u32 attributes, efi_uintn_t data_size, const void *data, bool ro_check); @@ -224,7 +226,7 @@ void efi_var_mem_del(struct efi_var_entry *var); * @time: time of authentication (as seconds since start of epoch) * Result: status code */ -efi_status_t efi_var_mem_ins(u16 *variable_name, +efi_status_t efi_var_mem_ins(const u16 *variable_name, const efi_guid_t *vendor, u32 attributes, const efi_uintn_t size1, const void *data1, const efi_uintn_t size2, const void *data2, @@ -251,7 +253,8 @@ efi_status_t efi_init_secure_state(void); * @guid: guid of UEFI variable * Return: identifier for authentication related variables */ -enum efi_auth_var_type efi_auth_var_get_type(u16 *name, const efi_guid_t *guid); +enum efi_auth_var_type efi_auth_var_get_type(const u16 *name, +const efi_guid_t *guid); /** * efi_get_next_variable_name_mem() - Runtime common code across efi variable @@ -280,8 +283,9 @@ efi_get_next_variable_name_mem(efi_uintn_t *variable_name_size, u16 *variable_na * Return: status code */ efi_status_t __efi_runtime -efi_get_variable_mem(u16 *variable_name, const efi_guid_t *vendor, u32 *attributes, -efi_uintn_t *data_size, void *data, u64 *timep); +efi_get_variable_mem(const u16 *variable_name, const efi_guid_t *vendor, +u32 *attributes, efi_uintn_t *data_size, void *data, +u64 *timep); /** * efi_get_variable_runtime() - runtime implementation of GetVariable() diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index d3b8f93f14..ed1506012b 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1365,7 +1365,7 @@ static efi_status_t efi_append_scrtm_version(struct udevice *dev) * Return: status code */ static efi_status_t tcg2_measure_variable(struct udevice *dev, u32 pcr_index, - u32 event_type, u16 *var_name, + u32 event_type, const u16 *var_name, const efi_guid_t *guid, efi_uintn_t data_size, u8 *data) { diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c index a00bbf1620..e179932124 100644 --- a/lib/efi_loader/efi_var_common.c +++ b/lib/efi_loader/efi_var_common.c @@ -374,7 +374,8
[PATCH v2 2/4] efi_loader: function to get GUID for variable name
In multiple places we need the default GUID matching a variable name. The patch provides a library function. For secure boot related variables like 'PK', 'KEK', 'db' a lookup table is used. For all other variable names EFI_GLOBAL_VARIABLE is returned. Signed-off-by: Heinrich Schuchardt --- v2: adjust function documentation --- include/efi_variable.h | 11 +++ lib/efi_loader/efi_var_common.c | 9 + 2 files changed, 20 insertions(+) diff --git a/include/efi_variable.h b/include/efi_variable.h index 8f666b2309..74909e8ec6 100644 --- a/include/efi_variable.h +++ b/include/efi_variable.h @@ -256,6 +256,17 @@ efi_status_t efi_init_secure_state(void); enum efi_auth_var_type efi_auth_var_get_type(const u16 *name, const efi_guid_t *guid); +/** + * efi_auth_var_get_guid() - get the predefined GUID for a variable name + * + * For secure boot related variables a lookup table is used to determine + * the GUID. For all other variables EFI_GLOBAL_VARIABLE is returned. + * + * @name: name of UEFI variable + * Return: guid of UEFI variable + */ +const efi_guid_t *efi_auth_var_get_guid(const u16 *name); + /** * efi_get_next_variable_name_mem() - Runtime common code across efi variable *implementations for GetNextVariable() diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c index e179932124..3cbb7c96c2 100644 --- a/lib/efi_loader/efi_var_common.c +++ b/lib/efi_loader/efi_var_common.c @@ -385,6 +385,15 @@ enum efi_auth_var_type efi_auth_var_get_type(const u16 *name, return EFI_AUTH_VAR_NONE; } +const efi_guid_t *efi_auth_var_get_guid(const u16 *name) +{ + for (size_t i = 0; i < ARRAY_SIZE(name_type); ++i) { + if (!u16_strcmp(name, name_type[i].name)) + return name_type[i].guid; + } + return &efi_global_variable_guid; +} + /** * efi_get_var() - read value of an EFI variable * -- 2.32.0
[PATCH v2 3/4] efi_loader: simplify efi_sigstore_parse_sigdb()
Simplify efi_sigstore_parse_sigdb() by using existing functions. Signed-off-by: Heinrich Schuchardt --- v2: remove a superfluous check --- lib/efi_loader/efi_signature.c | 38 +- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index bdd09881fc..6e3ee3c0c0 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -740,44 +741,15 @@ err: */ struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name) { - struct efi_signature_store *sigstore = NULL; const efi_guid_t *vendor; void *db; efi_uintn_t db_size; - efi_status_t ret; - - if (!u16_strcmp(name, L"PK") || !u16_strcmp(name, L"KEK")) { - vendor = &efi_global_variable_guid; - } else if (!u16_strcmp(name, L"db") || !u16_strcmp(name, L"dbx")) { - vendor = &efi_guid_image_security_database; - } else { - EFI_PRINT("unknown signature database, %ls\n", name); - return NULL; - } - - /* retrieve variable data */ - db_size = 0; - ret = EFI_CALL(efi_get_variable(name, vendor, NULL, &db_size, NULL)); - if (ret == EFI_NOT_FOUND) { - EFI_PRINT("variable, %ls, not found\n", name); - sigstore = calloc(sizeof(*sigstore), 1); - return sigstore; - } else if (ret != EFI_BUFFER_TOO_SMALL) { - EFI_PRINT("Getting variable, %ls, failed\n", name); - return NULL; - } - db = malloc(db_size); + vendor = efi_auth_var_get_guid(name); + db = efi_get_var(name, vendor, &db_size); if (!db) { - EFI_PRINT("Out of memory\n"); - return NULL; - } - - ret = EFI_CALL(efi_get_variable(name, vendor, NULL, &db_size, db)); - if (ret != EFI_SUCCESS) { - EFI_PRINT("Getting variable, %ls, failed\n", name); - free(db); - return NULL; + EFI_PRINT("variable, %ls, not found\n", name); + return calloc(sizeof(struct efi_signature_store), 1); } return efi_build_signature_store(db, db_size); -- 2.32.0
[PATCH v2 4/4] efi_loader: simplify tcg2_measure_secure_boot_variable()
Don't duplicate GUIDs. Signed-off-by: Heinrich Schuchardt --- v2: no change --- lib/efi_loader/efi_tcg2.c | 29 + 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index ed1506012b..52bf1b775f 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -79,17 +80,12 @@ static const struct digest_info hash_algo_list[] = { }, }; -struct variable_info { - u16 *name; - const efi_guid_t*guid; -}; - -static struct variable_info secure_variables[] = { - {L"SecureBoot", &efi_global_variable_guid}, - {L"PK", &efi_global_variable_guid}, - {L"KEK", &efi_global_variable_guid}, - {L"db", &efi_guid_image_security_database}, - {L"dbx", &efi_guid_image_security_database}, +static const u16 *secure_variables[] = { + u"SecureBoot", + u"PK", + u"KEK", + u"db", + u"dbx", }; #define MAX_HASH_COUNT ARRAY_SIZE(hash_algo_list) @@ -1593,19 +1589,20 @@ static efi_status_t tcg2_measure_secure_boot_variable(struct udevice *dev) count = ARRAY_SIZE(secure_variables); for (i = 0; i < count; i++) { + const efi_guid_t *guid; + + guid = efi_auth_var_get_guid(secure_variables[i]); + /* * According to the TCG2 PC Client PFP spec, "SecureBoot", * "PK", "KEK", "db" and "dbx" variables must be measured * even if they are empty. */ - data = efi_get_var(secure_variables[i].name, - secure_variables[i].guid, - &data_size); + data = efi_get_var(secure_variables[i], guid, &data_size); ret = tcg2_measure_variable(dev, 7, EV_EFI_VARIABLE_DRIVER_CONFIG, - secure_variables[i].name, - secure_variables[i].guid, + secure_variables[i], guid, data_size, data); free(data); if (ret != EFI_SUCCESS) -- 2.32.0
Re: [PATCH] riscv: add #define in asm/io.h for some device drivers
Hi Wei, On Thu, Sep 30, 2021 at 7:52 PM wrote: > > From: TekkamanV > > This patch add memcpy_fromio and memcpy_toio definitions for some device %s/add/adds > drivers which has these definitions, like cadence_qspi_apb.c %s/has/have > > Signed-off-by: TekkamanV Please use real name for the contribution, i.e.: following kernel submitting-patches.rst https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n409 > --- > arch/riscv/include/asm/io.h | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h > index acf5a96449..b693fd8cd6 100644 > --- a/arch/riscv/include/asm/io.h > +++ b/arch/riscv/include/asm/io.h > @@ -64,6 +64,10 @@ static inline phys_addr_t map_to_sysmem(const void *ptr) > #define __raw_readl(a) __arch_getl(a) > #define __raw_readq(a) __arch_getq(a) > > +/* adding for some drivers, like cadence_qspi_apb.c */ > +#define memcpy_fromio(a, c, l) memcpy((a), (c), (l)) > +#define memcpy_toio(c, a, l) memcpy((c), (a), (l)) > + > #define dmb() mb() > #define __iormb() rmb() > #define __iowmb() wmb() Otherwise, LGTM: Reviewed-by: Bin Meng Regards, Bin
Re: [PATCH] mtd: Add SPI Nor Flash chip GD25LQ256D ID
On Thu, Sep 30, 2021 at 6:55 PM wrote: > > From: "yanhong.wang" > Please add a brief commit message for this, like providing a datasheet for reference: https://www.gigadevice.com/datasheet/gd25lq256d/ > Signed-off-by: yanhong.wang I believe the name should be spelled as "Yanhong Wang" > --- > drivers/mtd/spi/spi-nor-ids.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c > index 4aef1ddd6e..35fa347c44 100644 > --- a/drivers/mtd/spi/spi-nor-ids.c > +++ b/drivers/mtd/spi/spi-nor-ids.c > @@ -122,6 +122,11 @@ const struct flash_info spi_nor_ids[] = { > SECT_4K | SPI_NOR_DUAL_READ | > SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) > }, > + { > + INFO("gd25lq256d", 0xc86019, 0, 64 * 1024, 512, > + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | > + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) > + }, > #endif > #ifdef CONFIG_SPI_FLASH_ISSI /* ISSI */ > /* ISSI */ Otherwise LGTM: Reviewed-by: Bin Meng
Re: [PATCH 1/2] riscv: Enable SYS_MALLOC_LEN config
On Thu, Sep 30, 2021 at 8:07 PM wrote: > > From: TekkamanV > Please add a commit message. > Signed-off-by: TekkamanV > --- > Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Kconfig b/Kconfig > index a6c42b902f..7f63929c60 100644 > --- a/Kconfig > +++ b/Kconfig > @@ -249,7 +249,7 @@ config SYS_MALLOC_F_LEN > > config SYS_MALLOC_LEN > hex "Define memory for Dynamic allocation" > - depends on ARCH_ZYNQ || ARCH_VERSAL || ARCH_STM32MP || ARCH_ROCKCHIP > + depends on ARCH_ZYNQ || ARCH_VERSAL || ARCH_STM32MP || ARCH_ROCKCHIP > || RISCV You need to also migrate existing RISC-V boards to Kconfig, by removing CONFIG_SYS_MALLOC_LEN from their config.h files. > default 0x200 if ARCH_ROCKCHIP > help > This defines memory to be allocated for Dynamic allocation Regards, Bin
Re: [PATCH 2/2] riscv: Enable SYS_CLK_FREQ config
On Thu, Sep 30, 2021 at 8:07 PM wrote: > > From: TekkamanV > > Signed-off-by: TekkamanV > --- > common/Kconfig.boot | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/Kconfig.boot b/common/Kconfig.boot > index 902a5b8fbe..4f29cc2d56 100644 > --- a/common/Kconfig.boot > +++ b/common/Kconfig.boot > @@ -343,7 +343,7 @@ config SYS_TEXT_BASE > The address in memory that U-Boot will be running from, initially. > > config SYS_CLK_FREQ > - depends on ARC || ARCH_SUNXI || MPC83xx > + depends on ARC || ARCH_SUNXI || MPC83xx || RISCV > int "CPU clock frequency" > help > TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture > -- Why do we need this change? It seems nothing related to RISC-V. Regards, Bin
Re: [RFC 22/22] efi_selftest: block device: adjust dp for a test disk
On 10/1/21 07:02, AKASHI Takahiro wrote: Due to efi_disk-dm integration, the resultant device path for a test disk got slightly changed, with efi_root contained as the first component. The caller of ConnectController() creates a handle with a devicepath and a block IO protocol. The caller can choose whatever devicepath he wants. If this test fails without this patch, this indicates that you broke the code. Please, review your design. Best regards Heinrich Signed-off-by: AKASHI Takahiro --- lib/efi_selftest/efi_selftest_block_device.c | 26 ++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c index 15f03751ac87..cac76249e6b4 100644 --- a/lib/efi_selftest/efi_selftest_block_device.c +++ b/lib/efi_selftest/efi_selftest_block_device.c @@ -30,6 +30,9 @@ static const efi_guid_t guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID; static const efi_guid_t guid_simple_file_system_protocol = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; static const efi_guid_t guid_file_system_info = EFI_FILE_SYSTEM_INFO_GUID; +static efi_guid_t guid_uboot = + EFI_GUID(0xe61d73b9, 0xa384, 0x4acc, \ +0xae, 0xab, 0x82, 0xe8, 0x28, 0xf3, 0x62, 0x8b); static efi_guid_t guid_vendor = EFI_GUID(0xdbca4c98, 0x6cb0, 0x694d, 0x08, 0x72, 0x81, 0x9c, 0x65, 0x0c, 0xb7, 0xb8); @@ -206,25 +209,44 @@ static int setup(const efi_handle_t handle, ret = boottime->allocate_pool(EFI_LOADER_DATA, sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path_vendor) + + sizeof(u8) + sizeof(struct efi_device_path), (void **)&dp); if (ret != EFI_SUCCESS) { efi_st_error("Out of memory\n"); return EFI_ST_FAILURE; } + /* first part */ vendor_node.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; vendor_node.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; vendor_node.dp.length = sizeof(struct efi_device_path_vendor); - boottime->copy_mem(&vendor_node.guid, &guid_vendor, + boottime->copy_mem(&vendor_node.guid, &guid_uboot, sizeof(efi_guid_t)); boottime->copy_mem(dp, &vendor_node, sizeof(struct efi_device_path_vendor)); + + /* second part */ + vendor_node.dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE; + vendor_node.dp.sub_type = DEVICE_PATH_SUB_TYPE_VENDOR; + vendor_node.dp.length = sizeof(struct efi_device_path_vendor) + 1; + + boottime->copy_mem(&vendor_node.guid, &guid_vendor, + sizeof(efi_guid_t)); + boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor), + &vendor_node, + sizeof(struct efi_device_path_vendor)); + /* vendor_data[0] */ + *((char *)dp + sizeof(struct efi_device_path_vendor) * 2) = 0; + end_node.type = DEVICE_PATH_TYPE_END; end_node.sub_type = DEVICE_PATH_SUB_TYPE_END; end_node.length = sizeof(struct efi_device_path); - boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor), + boottime->copy_mem((char *)dp + sizeof(struct efi_device_path_vendor) + + sizeof(struct efi_device_path_vendor) + + sizeof(u8), &end_node, sizeof(struct efi_device_path)); ret = boottime->install_protocol_interface(&disk_handle, &guid_device_path,
Re: [PATCH] Finish converting CONFIG_SYS_CACHELINE_SIZE to Kconfig
On Mon, 30 Aug 2021 19:51:28 PDT (-0700), tr...@konsulko.com wrote: On Tue, Aug 31, 2021 at 04:12:21AM +0200, Daniel Schwierzeck wrote: Am Donnerstag, dem 26.08.2021 um 11:47 -0400 schrieb Tom Rini: > We move the SYS_CACHE_SHIFT_N options from arch/arm/Kconfig to > arch/Kconfig, and introduce SYS_CACHE_SHIFT_4 to provide a size of > 16. > Introduce select statements for other architectures based on current > usage. For MIPS, we take the existing arch-specific symbol and > migrate > to the generic symbol. This lets us remove a little bit of otherwise > unused code. > > Cc: Alexey Brodkin > Cc: Anup Patel > Cc: Atish Patra > Cc: Bin Meng > Cc: Daniel Schwierzeck > Cc: Leo > Cc: Palmer Dabbelt > Cc: Paul Walmsley > Cc: Rick Chen > Cc: Sean Anderson > Cc: Simon Glass > Signed-off-by: Tom Rini > --- > I'm Cc'ing a bunch of RISC-V folks since that's where I'm least > confident and just put it per-board for now. There's nothing in the ISA for cache line sizes, so if it's got to be a fixed number it'l need to be a per-device thing and if there's any correctness issues there (non-coherent stuff, for example) that will break binary compatibility. > --- > arch/Kconfig | 25 + > arch/arc/include/asm/cache.h | 3 --- > arch/arm/Kconfig | 15 --- > arch/mips/Kconfig | 26 +++--- > arch/mips/include/asm/cache.h | 12 +--- > arch/mips/mach-bmips/Kconfig | 20 ++-- > arch/mips/mach-mtmips/Kconfig | 4 ++-- > arch/mips/mach-pic32/Kconfig | 2 +- > arch/powerpc/cpu/mpc83xx/Kconfig | 6 ++ > arch/powerpc/cpu/mpc85xx/Kconfig | 15 +++ > arch/powerpc/cpu/mpc8xx/Kconfig| 2 ++ > arch/powerpc/include/asm/cache.h | 7 --- > arch/riscv/Kconfig | 2 ++ > arch/sandbox/include/asm/cache.h | 1 - > arch/x86/include/asm/cache.h | 7 +-- > include/configs/M5208EVBE.h| 1 - > include/configs/M5235EVB.h | 1 - > include/configs/M5249EVB.h | 1 - > include/configs/M5253DEMO.h| 1 - > include/configs/M5272C3.h | 1 - > include/configs/M5275EVB.h | 1 - > include/configs/M5282EVB.h | 1 - > include/configs/M53017EVB.h| 1 - > include/configs/M5329EVB.h | 1 - > include/configs/M5373EVB.h | 1 - > include/configs/amcore.h | 1 - > include/configs/astro_mcf5373l.h | 1 - > include/configs/cobra5272.h| 1 - > include/configs/eb_cpu5282.h | 1 - > include/configs/mx7ulp_evk.h | 2 -- > include/configs/rk3188_common.h| 2 -- > include/configs/rk3368_common.h| 2 -- > include/configs/sifive-unmatched.h | 2 -- > include/configs/sipeed-maix.h | 1 - > include/configs/stmark2.h | 1 - > 35 files changed, 68 insertions(+), 103 deletions(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index b6f9e177b645..25f4a15b19f9 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -7,6 +7,27 @@ config HAVE_ARCH_IOREMAP > config NEEDS_MANUAL_RELOC >bool > > +config SYS_CACHE_SHIFT_4 > + bool > + > +config SYS_CACHE_SHIFT_5 > + bool > + > +config SYS_CACHE_SHIFT_6 > + bool > + > +config SYS_CACHE_SHIFT_7 > + bool > + > +config SYS_CACHELINE_SIZE > + int > + default 128 if SYS_CACHE_SHIFT_7 > + default 64 if SYS_CACHE_SHIFT_6 > + default 32 if SYS_CACHE_SHIFT_5 > + default 16 if SYS_CACHE_SHIFT_4 > + # Fall-back for MIPS > + default 32 if MIPS can't we get rid of the SYS_ prefix? Also _CACHE_ is ambiguous, L1_CACHE_SHIFT_* and L1_CACHELINE_SIZE are possibly more suitable. Otherwise: I don't see a problem to a follow-up renaming things for further clarity (and using L1 in the name makes sense), but I am for now trying to (as you've probably noticed) plow through the CONFIG backlog and get everything migrated. -- Tom
Re: [PATCH v2 3/4] efi_loader: simplify efi_sigstore_parse_sigdb()
Hi Heinrich, [...] > @@ -740,44 +741,15 @@ err: > */ > struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name) > { > - struct efi_signature_store *sigstore = NULL; > const efi_guid_t *vendor; > void *db; > efi_uintn_t db_size; > - efi_status_t ret; > - > - if (!u16_strcmp(name, L"PK") || !u16_strcmp(name, L"KEK")) { > - vendor = &efi_global_variable_guid; > - } else if (!u16_strcmp(name, L"db") || !u16_strcmp(name, L"dbx")) { > - vendor = &efi_guid_image_security_database; > - } else { > - EFI_PRINT("unknown signature database, %ls\n", name); > - return NULL; > - } > - > - /* retrieve variable data */ > - db_size = 0; > - ret = EFI_CALL(efi_get_variable(name, vendor, NULL, &db_size, NULL)); > - if (ret == EFI_NOT_FOUND) { > - EFI_PRINT("variable, %ls, not found\n", name); > - sigstore = calloc(sizeof(*sigstore), 1); > - return sigstore; > - } else if (ret != EFI_BUFFER_TOO_SMALL) { > - EFI_PRINT("Getting variable, %ls, failed\n", name); > - return NULL; > - } > > - db = malloc(db_size); > + vendor = efi_auth_var_get_guid(name); > + db = efi_get_var(name, vendor, &db_size); > if (!db) { > - EFI_PRINT("Out of memory\n"); > - return NULL; > - } > - > - ret = EFI_CALL(efi_get_variable(name, vendor, NULL, &db_size, db)); > - if (ret != EFI_SUCCESS) { > - EFI_PRINT("Getting variable, %ls, failed\n", name); > - free(db); > - return NULL; > + EFI_PRINT("variable, %ls, not found\n", name); > + return calloc(sizeof(struct efi_signature_store), 1); We are creating a security problem here. The previous code, before returning a calloced buffer, was specifically checking for EFI_NOT_FOUND. The way this is restructured might lead to an weird situation. There's a chance efi_get_var() will return NULL, even if the variable is there (e.g an alloc failed). That's problematic if we want to check 'dbx' though. The new fucntion will return that empty buffer and we'll end up ignoring the 'dbx' entries. Regards /Ilias > } > > return efi_build_signature_store(db, db_size); > -- > 2.32.0 >
Re: [PATCHv2 1/2] arm: Remove flea3 board
On Tue, Sep 14, 2021 at 09:09:31AM -0400, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline. > Remove it. As this is the last mx35 platform, remove that support as > well. > > Cc: Stefano Babic > Signed-off-by: Tom Rini > Acked-by: Stefano Babic Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCHv2 2/2] arm: Remove aspenite board
On Tue, Sep 14, 2021 at 09:09:32AM -0400, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline. > Remove it. As this is the last armada100 platform, remove that support > as well. > > Cc: Prafulla Wadaskar > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 3/6] arm: Remove zmx25 board and ARCH_MX25
On Thu, Sep 09, 2021 at 07:54:50AM -0400, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline. > Remove it. As this is the last ARCH_MX25 platform, remove those > references as well. > > Cc: Matthias Weisser > Cc: Stefano Babic > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 6/6] ppc: Remove MPC8349EMDS board and ARCH_MPC8349 support
On Thu, Sep 09, 2021 at 07:54:53AM -0400, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline. > Remove it. > > Cc: Priyanka Jain > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 4/6] arm: Remove bg0900 board
On Thu, Sep 09, 2021 at 07:54:51AM -0400, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline. > Remove it. > > Cc: Marek Vasut > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/5] kgdb: Remove unused serial related options
On Mon, Sep 13, 2021 at 05:24:51PM -0400, Tom Rini wrote: > We have a few CONFIG options for KGDB that are not referenced, remove > them. > > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 2/5] Convert CONFIG_BAUDRATE to Kconfig
On Mon, Sep 13, 2021 at 05:24:52PM -0400, Tom Rini wrote: > This converts the following to Kconfig: >CONFIG_BAUDRATE > > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 3/5] serial: Use the default CONFIG_SYS_BAUDRATE_TABLE in more platforms
On Mon, Sep 13, 2021 at 05:24:53PM -0400, Tom Rini wrote: > A number of platforms are still defining CONFIG_SYS_BAUDRATE_TABLE to > the fallback default of "{ 9600, 19200, 38400, 57600, 115200 }", but > with varying whitespace, or were introduced after the default fallback > was added. Use the default table here. > > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 4/5] serial: Remove extraneous SYS_MALLOC_F check
On Mon, Sep 13, 2021 at 05:24:54PM -0400, Tom Rini wrote: > We enforce that DM_SERIAL will have SYS_MALLOC_F enabled and so > SYS_MALLOC_F_LEN will have a value. Remove the build-time check. > > Cc: Simon Glass > Signed-off-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 2/5] serial: s5p: Add Apple M1 support
> From: Simon Glass > Date: Sun, 19 Sep 2021 21:15:59 -0600 > > Hi Mark, > > On Sat, 18 Sept 2021 at 07:55, Mark Kettenis wrote: > > > > Apple M1 SoCs include an S5L UART which is a variant of the S5P > > UART. Add support for this variant and enable it by default > > on Apple SoCs. > > > > Signed-off-by: Mark Kettenis > > --- > > arch/arm/include/asm/arch-m1/clk.h | 11 > > arch/arm/include/asm/arch-m1/uart.h | 41 + > > arch/arm/mach-apple/board.c | 5 > > drivers/serial/Kconfig | 2 +- > > drivers/serial/serial_s5p.c | 22 > > 5 files changed, 80 insertions(+), 1 deletion(-) > > create mode 100644 arch/arm/include/asm/arch-m1/clk.h > > create mode 100644 arch/arm/include/asm/arch-m1/uart.h > > > > diff --git a/arch/arm/include/asm/arch-m1/clk.h > > b/arch/arm/include/asm/arch-m1/clk.h > > new file mode 100644 > > index 00..f4326d0c0f > > --- /dev/null > > +++ b/arch/arm/include/asm/arch-m1/clk.h > > @@ -0,0 +1,11 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (C) 2021 Mark Kettenis > > + */ > > + > > +#ifndef __ASM_ARM_ARCH_CLK_H_ > > +#define __ASM_ARM_ARCH_CLK_H_ > > + > > +unsigned long get_uart_clk(int dev_index); > > comment? But this should be in a clock driver, unless you are trying > to get a debug UART up ASAP with minimal code? > > > + > > +#endif > > diff --git a/arch/arm/include/asm/arch-m1/uart.h > > b/arch/arm/include/asm/arch-m1/uart.h > > new file mode 100644 > > index 00..d2a17a221e > > --- /dev/null > > +++ b/arch/arm/include/asm/arch-m1/uart.h > > @@ -0,0 +1,41 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * (C) Copyright 2009 Samsung Electronics > > + * Minkyu Kang > > + * Heungjun Kim > > + */ > > + > > +#ifndef __ASM_ARCH_UART_H_ > > +#define __ASM_ARCH_UART_H_ > > + > > +#ifndef __ASSEMBLY__ > > +/* baudrate rest value */ > > +union br_rest { > > + unsigned short slot; /* udivslot */ > > + unsigned char value; /* ufracval */ > > +}; > > + > > +struct s5p_uart { > > + unsigned intulcon; > > + unsigned intucon; > > + unsigned intufcon; > > + unsigned intumcon; > > + unsigned intutrstat; > > + unsigned intuerstat; > > + unsigned intufstat; > > + unsigned intumstat; > > + unsigned intutxh; > > + unsigned inturxh; > > + unsigned intubrdiv; > > + union br_rest rest; > > + unsigned char res3[0x3fd0]; > > +}; > > + > > +static inline int s5p_uart_divslot(void) > > +{ > > + return 0; > > +} > > + > > +#endif /* __ASSEMBLY__ */ > > + > > +#endif > > diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c > > index 0c8b35292e..8bc5c2f69e 100644 > > --- a/arch/arm/mach-apple/board.c > > +++ b/arch/arm/mach-apple/board.c > > @@ -156,3 +156,8 @@ ulong board_get_usable_ram_top(ulong total_size) > > */ > > return 0x98000; > > } > > + > > +unsigned long get_uart_clk(int dev_index) > > +{ > > + return 2400; > > Should add to devicetree for the driver > > > +} > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig > > index 93348c0929..c3ac773929 100644 > > --- a/drivers/serial/Kconfig > > +++ b/drivers/serial/Kconfig > > @@ -719,7 +719,7 @@ config ROCKCHIP_SERIAL > > > > config S5P_SERIAL > > bool "Support for Samsung S5P UART" > > - depends on ARCH_EXYNOS || ARCH_S5PC1XX > > + depends on ARCH_APPLE || ARCH_EXYNOS || ARCH_S5PC1XX > > default y > > help > > Select this to enable Samsung S5P UART support. > > diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c > > index 6d09952a5d..eb770d9b62 100644 > > --- a/drivers/serial/serial_s5p.c > > +++ b/drivers/serial/serial_s5p.c > > @@ -21,12 +21,21 @@ > > > > DECLARE_GLOBAL_DATA_PTR; > > > > +#ifdef CONFIG_ARCH_APPLE > > This should use the compatible string to decide which variant it is, > then the checks happen at runtime. We should never have arch-specific > #ifdefs in drivers. > > > +#define RX_FIFO_COUNT_SHIFT0 > > +#define RX_FIFO_COUNT_MASK (0xf << RX_FIFO_COUNT_SHIFT) > > +#define RX_FIFO_FULL (1 << 8) > > +#define TX_FIFO_COUNT_SHIFT4 > > +#define TX_FIFO_COUNT_MASK (0xf << TX_FIFO_COUNT_SHIFT) > > +#define TX_FIFO_FULL (1 << 9) > > +#else > > #define RX_FIFO_COUNT_SHIFT0 > > #define RX_FIFO_COUNT_MASK (0xff << RX_FIFO_COUNT_SHIFT) > > #define RX_FIFO_FULL (1 << 8) > > #define TX_FIFO_COUNT_SHIFT16 > > #define TX_FIFO_COUNT_MASK (0xff << TX_FIFO_COUNT_SHIFT) > > #define TX_FIFO_FULL (1 << 24) > > +#endif > > > > /* Information about a serial port */ > > struct s5p_serial_plat { > > @@ -83,7 +92,11 @@ static void __maybe_unused s5p_serial_baud(struct > > s5p_uart *uart, uint uclk, > > if (s5p_uart_divslot()) >
[PATCH] sun7i: Add defconfig and dts for Vivax TPC-9150
This patch uses the (almost) the same settings as those found in the original Android firmware. As such, it gurantees good compatibility. Signed-off-by: Nikola Pavlica --- arch/arm/dts/Makefile| 1 + arch/arm/dts/sun7i-a20-vivax-tpc9150.dts | 299 +++ board/sunxi/MAINTAINERS | 5 + configs/Vivax_TPC9150_defconfig | 13 + 4 files changed, 318 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-vivax-tpc9150.dts create mode 100644 configs/Vivax_TPC9150_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index fc16a57e60..d8e2248272 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -568,6 +568,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-pcduino3.dtb \ sun7i-a20-pcduino3-nano.dtb \ sun7i-a20-primo73.dtb \ + sun7i-a20-vivax-tpc9150.dtb \ sun7i-a20-wexler-tab7200.dtb \ sun7i-a20-wits-pro-a20-dkt.dtb \ sun7i-a20-yones-toptech-bd1078.dtb diff --git a/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts new file mode 100644 index 00..38a3a4ae1c --- /dev/null +++ b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts @@ -0,0 +1,299 @@ +/* + * Copyright 2021 Nikola Pavlica + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include +#include + +/ { + model = "Vivax TPC-9150 tablet"; + compatible = "vivax,tpc-9150", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 5 PWM_POLARITY_INVERTED>; + brightness-levels = <0 1 2 4 6 8 11 14 18 + 23 30 38 48 61 78 100>; + default-brightness-level = <16>; + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ + power-supply = <®_vcc3v3>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; +}; + +&i2c0 { + status = "okay"; + + axp209: pmic@34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&i2c1 { + status = "okay"; + + // you need to manually probe this sensor, the kernel fails to do it on its own + stk8312@3d { +
[PATCH] sun7i: Add defconfig and dts for Vivax TPC-9150 v2
This patch uses the (almost) the same settings as those found in the original Android firmware. As such, it gurantees good compatibility. V2: Small fixes/changes to the config Signed-off-by: Nikola Pavlica --- arch/arm/dts/Makefile| 1 + arch/arm/dts/sun7i-a20-vivax-tpc9150.dts | 299 +++ board/sunxi/MAINTAINERS | 5 + configs/Vivax_TPC9150_defconfig | 13 + 4 files changed, 318 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-vivax-tpc9150.dts create mode 100644 configs/Vivax_TPC9150_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index fc16a57e60..d8e2248272 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -568,6 +568,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-pcduino3.dtb \ sun7i-a20-pcduino3-nano.dtb \ sun7i-a20-primo73.dtb \ + sun7i-a20-vivax-tpc9150.dtb \ sun7i-a20-wexler-tab7200.dtb \ sun7i-a20-wits-pro-a20-dkt.dtb \ sun7i-a20-yones-toptech-bd1078.dtb diff --git a/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts new file mode 100644 index 00..38a3a4ae1c --- /dev/null +++ b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts @@ -0,0 +1,299 @@ +/* + * Copyright 2021 Nikola Pavlica + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include +#include + +/ { + model = "Vivax TPC-9150 tablet"; + compatible = "vivax,tpc-9150", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 5 PWM_POLARITY_INVERTED>; + brightness-levels = <0 1 2 4 6 8 11 14 18 + 23 30 38 48 61 78 100>; + default-brightness-level = <16>; + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ + power-supply = <®_vcc3v3>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; +}; + +&i2c0 { + status = "okay"; + + axp209: pmic@34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&i2c1 { + status = "okay"; + + // you need to manually probe this sensor, the kernel fails to do it on its
[PATCH] sun7i: Add defconfig and dts for Vivax TPC-9150 v3
This patch uses the (almost) the same settings as those found in the original Android firmware. As such, it gurantees good compatibility. V2: Small fixes/changes to the config V3: Checkpatch fixes Signed-off-by: Nikola Pavlica --- arch/arm/dts/Makefile| 1 + arch/arm/dts/sun7i-a20-vivax-tpc9150.dts | 259 +++ board/sunxi/MAINTAINERS | 5 + configs/Vivax_TPC9150_defconfig | 13 ++ 4 files changed, 278 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-vivax-tpc9150.dts create mode 100644 configs/Vivax_TPC9150_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index fc16a57e60..d8e2248272 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -568,6 +568,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-pcduino3.dtb \ sun7i-a20-pcduino3-nano.dtb \ sun7i-a20-primo73.dtb \ + sun7i-a20-vivax-tpc9150.dtb \ sun7i-a20-wexler-tab7200.dtb \ sun7i-a20-wits-pro-a20-dkt.dtb \ sun7i-a20-yones-toptech-bd1078.dtb diff --git a/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts new file mode 100644 index 00..78867c2fe0 --- /dev/null +++ b/arch/arm/dts/sun7i-a20-vivax-tpc9150.dts @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0+ OR X11 +/* + * Copyright 2021 Nikola Pavlica + * + * DTS file for the Vivax TPC-9150 tablet + */ + +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include +#include + +/ { + model = "Vivax TPC-9150 tablet"; + compatible = "vivax,tpc-9150", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 5 PWM_POLARITY_INVERTED>; + brightness-levels = <0 1 2 4 6 8 11 14 18 + 23 30 38 48 61 78 100>; + default-brightness-level = <16>; + enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ + power-supply = <®_vcc3v3>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; +}; + +&i2c0 { + status = "okay"; + + axp209: pmic@34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; +}; + +&i2c1 { + status = "okay"; + + // you need to manually probe this sensor, the kernel fails to do it on its own + stk8312@3d { + compatible = "STK8312", "stk8312"; + reg = <0x3d>; + interrupt-parent = <&pio>; + interrupts = <7 0 IRQ_TYPE_EDGE_RISING>; /* PH0 / EINT0 */ + }; +}; + +&i2c2 { + status = "okay"; + + ft5x: touchscreen@38 { + compatible = "edt,edt-ft5406"; + reg = <0x38>; + interrupt-parent = <&pio>; + interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>; /* PH21 */ + + touchscreen-size-x = <800>; + touchscreen-size-y = <480>; + + bias-pull-up; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&mmc0 { + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + cd-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>; /* PH1 */ + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&otg_sram { + status = "okay"; +}; + +®_usb0_vbus { + status = "okay"; +}; + +®_usb1_vbus { + status = "okay"; + gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */ +}; + +®_usb2_vbus { + status = "okay"; + gpio = <&pio 7 3 GPIO_ACTIVE_HIGH>; /* PH3 */ +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */ + usb0_vbus_power-supply = <&usb_power_supply>; + usb0_vbus-supply = <®_usb0_vbus>; + usb1_vbus-supply = <®_usb1_vbus>; + usb2_vbus-supply = <®_usb2_vbus>; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pb_pins>; + status = "okay"; +}; + +// display related +&be0 { + status = "okay"; +}; + +&hdmi { + status = "okay"; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +// PWM used for the backlight +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_
Re: [PATCH 2/5] serial: s5p: Add Apple M1 support
Hi Mark, On Sat, 2 Oct 2021 at 16:16, Mark Kettenis wrote: > > > From: Simon Glass > > Date: Sun, 19 Sep 2021 21:15:59 -0600 > > > > Hi Mark, > > > > On Sat, 18 Sept 2021 at 07:55, Mark Kettenis wrote: > > > > > > Apple M1 SoCs include an S5L UART which is a variant of the S5P > > > UART. Add support for this variant and enable it by default > > > on Apple SoCs. > > > > > > Signed-off-by: Mark Kettenis > > > --- > > > arch/arm/include/asm/arch-m1/clk.h | 11 > > > arch/arm/include/asm/arch-m1/uart.h | 41 + > > > arch/arm/mach-apple/board.c | 5 > > > drivers/serial/Kconfig | 2 +- > > > drivers/serial/serial_s5p.c | 22 > > > 5 files changed, 80 insertions(+), 1 deletion(-) > > > create mode 100644 arch/arm/include/asm/arch-m1/clk.h > > > create mode 100644 arch/arm/include/asm/arch-m1/uart.h > > > > > > diff --git a/arch/arm/include/asm/arch-m1/clk.h > > > b/arch/arm/include/asm/arch-m1/clk.h > > > new file mode 100644 > > > index 00..f4326d0c0f > > > --- /dev/null > > > +++ b/arch/arm/include/asm/arch-m1/clk.h > > > @@ -0,0 +1,11 @@ > > > +// SPDX-License-Identifier: GPL-2.0+ > > > +/* > > > + * Copyright (C) 2021 Mark Kettenis > > > + */ > > > + > > > +#ifndef __ASM_ARM_ARCH_CLK_H_ > > > +#define __ASM_ARM_ARCH_CLK_H_ > > > + > > > +unsigned long get_uart_clk(int dev_index); > > > > comment? But this should be in a clock driver, unless you are trying > > to get a debug UART up ASAP with minimal code? > > > > > + > > > +#endif > > > diff --git a/arch/arm/include/asm/arch-m1/uart.h > > > b/arch/arm/include/asm/arch-m1/uart.h > > > new file mode 100644 > > > index 00..d2a17a221e > > > --- /dev/null > > > +++ b/arch/arm/include/asm/arch-m1/uart.h > > > @@ -0,0 +1,41 @@ > > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > > +/* > > > + * (C) Copyright 2009 Samsung Electronics > > > + * Minkyu Kang > > > + * Heungjun Kim > > > + */ > > > + > > > +#ifndef __ASM_ARCH_UART_H_ > > > +#define __ASM_ARCH_UART_H_ > > > + > > > +#ifndef __ASSEMBLY__ > > > +/* baudrate rest value */ > > > +union br_rest { > > > + unsigned short slot; /* udivslot */ > > > + unsigned char value; /* ufracval */ > > > +}; > > > + > > > +struct s5p_uart { > > > + unsigned intulcon; > > > + unsigned intucon; > > > + unsigned intufcon; > > > + unsigned intumcon; > > > + unsigned intutrstat; > > > + unsigned intuerstat; > > > + unsigned intufstat; > > > + unsigned intumstat; > > > + unsigned intutxh; > > > + unsigned inturxh; > > > + unsigned intubrdiv; > > > + union br_rest rest; > > > + unsigned char res3[0x3fd0]; > > > +}; > > > + > > > +static inline int s5p_uart_divslot(void) > > > +{ > > > + return 0; > > > +} > > > + > > > +#endif /* __ASSEMBLY__ */ > > > + > > > +#endif > > > diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c > > > index 0c8b35292e..8bc5c2f69e 100644 > > > --- a/arch/arm/mach-apple/board.c > > > +++ b/arch/arm/mach-apple/board.c > > > @@ -156,3 +156,8 @@ ulong board_get_usable_ram_top(ulong total_size) > > > */ > > > return 0x98000; > > > } > > > + > > > +unsigned long get_uart_clk(int dev_index) > > > +{ > > > + return 2400; > > > > Should add to devicetree for the driver > > > > > +} > > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig > > > index 93348c0929..c3ac773929 100644 > > > --- a/drivers/serial/Kconfig > > > +++ b/drivers/serial/Kconfig > > > @@ -719,7 +719,7 @@ config ROCKCHIP_SERIAL > > > > > > config S5P_SERIAL > > > bool "Support for Samsung S5P UART" > > > - depends on ARCH_EXYNOS || ARCH_S5PC1XX > > > + depends on ARCH_APPLE || ARCH_EXYNOS || ARCH_S5PC1XX > > > default y > > > help > > > Select this to enable Samsung S5P UART support. > > > diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c > > > index 6d09952a5d..eb770d9b62 100644 > > > --- a/drivers/serial/serial_s5p.c > > > +++ b/drivers/serial/serial_s5p.c > > > @@ -21,12 +21,21 @@ > > > > > > DECLARE_GLOBAL_DATA_PTR; > > > > > > +#ifdef CONFIG_ARCH_APPLE > > > > This should use the compatible string to decide which variant it is, > > then the checks happen at runtime. We should never have arch-specific > > #ifdefs in drivers. > > > > > +#define RX_FIFO_COUNT_SHIFT0 > > > +#define RX_FIFO_COUNT_MASK (0xf << RX_FIFO_COUNT_SHIFT) > > > +#define RX_FIFO_FULL (1 << 8) > > > +#define TX_FIFO_COUNT_SHIFT4 > > > +#define TX_FIFO_COUNT_MASK (0xf << TX_FIFO_COUNT_SHIFT) > > > +#define TX_FIFO_FULL (1 << 9) > > > +#else > > > #define RX_FIFO_COUNT_SHIFT0 > > > #define RX_FIFO_COUNT_MASK (0xff << RX_FIFO_COUNT_SHIFT) > > > #define RX_FIFO_FULL (1 << 8) > > > #define TX_FIFO_COUNT_SHIFT