summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/arch-tangier/acpi/southcluster.asl61
-rw-r--r--arch/x86/lib/Makefile1
-rw-r--r--arch/x86/lib/fsp/Makefile1
-rw-r--r--board/theobroma-systems/lion_rk3368/Kconfig6
-rw-r--r--cmd/Makefile2
-rw-r--r--cmd/x86/Makefile6
-rw-r--r--cmd/x86/fsp.c (renamed from arch/x86/lib/fsp/cmd_fsp.c)0
-rw-r--r--cmd/x86/mtrr.c (renamed from arch/x86/lib/cmd_mtrr.c)0
-rw-r--r--common/spl/Kconfig18
-rw-r--r--common/spl/spl_atf.c12
-rw-r--r--configs/firefly-rk3399_defconfig1
-rw-r--r--drivers/crypto/fsl/fsl_blob.c103
-rw-r--r--drivers/video/cfb_console.c30
-rw-r--r--drivers/video/ipu_common.c6
-rw-r--r--include/fsl_sec.h4
15 files changed, 217 insertions, 34 deletions
diff --git a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
index 288b57cb808..2b3b897c5bb 100644
--- a/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
+++ b/arch/x86/include/asm/arch-tangier/acpi/southcluster.asl
@@ -173,13 +173,13 @@ Device (PCI0)
Name (RBUF, ResourceTemplate()
{
GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
- "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 91 }
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 110 }
GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
- "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 92 }
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 111 }
GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
- "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 93 }
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 112 }
GpioIo(Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
- "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 94 }
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 113 }
})
Method (_CRS, 0, NotSerialized)
@@ -245,7 +245,7 @@ Device (PCI0)
{
Connection (
GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
- "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 56 }
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 96 }
),
WFD3, 1,
}
@@ -260,6 +260,57 @@ Device (PCI0)
Return (STA_VISIBLE)
}
}
+
+ Device (HSU0)
+ {
+ Name (_ADR, 0x00040001)
+
+ Method (_STA, 0, NotSerialized)
+ {
+ Return (STA_VISIBLE)
+ }
+
+ Device (BTH0)
+ {
+ Name (_HID, "BCM2E95")
+ Name (_DEP, Package ()
+ {
+ GPIO,
+ HSU0
+ })
+
+ Method (_STA, 0, NotSerialized)
+ {
+ Return (STA_VISIBLE)
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (RBUF, ResourceTemplate ()
+ {
+ UartSerialBus (0x0001C200, DataBitsEight, StopBitsOne,
+ 0xFC, LittleEndian, ParityTypeNone, FlowControlHardware,
+ 0x20, 0x20, "\\_SB.PCI0.HSU0", 0, ResourceConsumer, , )
+ GpioInt (Level, ActiveHigh, Exclusive, PullNone, 0,
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 185 }
+ GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 184 }
+ GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
+ "\\_SB.PCI0.GPIO", 0, ResourceConsumer, , ) { 71 }
+ })
+ Return (RBUF)
+ }
+
+ Name (_DSD, Package () {
+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package () {
+ Package () { "host-wakeup-gpios", Package () { ^BTH0, 0, 0, 0 } },
+ Package () { "device-wakeup-gpios", Package () { ^BTH0, 1, 0, 0 } },
+ Package () { "shutdown-gpios", Package () { ^BTH0, 2, 0, 0 } },
+ }
+ })
+ }
+ }
}
Device (FLIS)
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 7d729ea0f7d..f6be13fe949 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -23,7 +23,6 @@ obj-y += interrupts.o
obj-y += lpc-uclass.o
obj-y += mpspec.o
obj-$(CONFIG_ENABLE_MRC_CACHE) += mrccache.o
-obj-y += cmd_mtrr.o
obj-y += northbridge-uclass.o
obj-$(CONFIG_I8259_PIC) += i8259.o
obj-$(CONFIG_I8254_TIMER) += i8254.o
diff --git a/arch/x86/lib/fsp/Makefile b/arch/x86/lib/fsp/Makefile
index afe83dd3243..c7a248f7f2e 100644
--- a/arch/x86/lib/fsp/Makefile
+++ b/arch/x86/lib/fsp/Makefile
@@ -4,7 +4,6 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += cmd_fsp.o
obj-y += fsp_car.o
obj-y += fsp_common.o
obj-y += fsp_dram.o
diff --git a/board/theobroma-systems/lion_rk3368/Kconfig b/board/theobroma-systems/lion_rk3368/Kconfig
index d7aa487abd4..fddbf826df1 100644
--- a/board/theobroma-systems/lion_rk3368/Kconfig
+++ b/board/theobroma-systems/lion_rk3368/Kconfig
@@ -12,4 +12,10 @@ config SYS_CONFIG_NAME
config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
+config ENV_SIZE
+ default 0x2000
+
+config ENV_OFFSET
+ default 0x3c000 if ENV_IS_IN_SPI_FLASH
+
endif
diff --git a/cmd/Makefile b/cmd/Makefile
index 00e38696daa..ab45bf434a9 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -150,6 +150,8 @@ obj-$(CONFIG_CMD_PMIC) += pmic.o
obj-$(CONFIG_CMD_REGULATOR) += regulator.o
obj-$(CONFIG_CMD_BLOB) += blob.o
+
+obj-$(CONFIG_X86) += x86/
endif # !CONFIG_SPL_BUILD
# core command
diff --git a/cmd/x86/Makefile b/cmd/x86/Makefile
new file mode 100644
index 00000000000..d4c690b0551
--- /dev/null
+++ b/cmd/x86/Makefile
@@ -0,0 +1,6 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += mtrr.o
+obj-$(CONFIG_HAVE_FSP) += fsp.o
diff --git a/arch/x86/lib/fsp/cmd_fsp.c b/cmd/x86/fsp.c
index 2a99cfe0d03..2a99cfe0d03 100644
--- a/arch/x86/lib/fsp/cmd_fsp.c
+++ b/cmd/x86/fsp.c
diff --git a/arch/x86/lib/cmd_mtrr.c b/cmd/x86/mtrr.c
index f632f495ede..f632f495ede 100644
--- a/arch/x86/lib/cmd_mtrr.c
+++ b/cmd/x86/mtrr.c
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index aef0034b335..9d35f412336 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -721,10 +721,24 @@ config SPL_ATF
bool "Support ARM Trusted Firmware"
depends on ARM64
help
- ATF(ARM Trusted Firmware) is a component for ARM arch64 which
- is loaded by SPL(which is considered as BL2 in ATF terminology).
+ ATF(ARM Trusted Firmware) is a component for ARM AArch64 which
+ is loaded by SPL (which is considered as BL2 in ATF terminology).
More detail at: https://github.com/ARM-software/arm-trusted-firmware
+config SPL_ATF_NO_PLATFORM_PARAM
+ bool "Pass no platform parameter"
+ depends on SPL_ATF
+ help
+ While we expect to call a pointer to a valid FDT (or NULL)
+ as the platform parameter to an ATF, some ATF versions are
+ not U-Boot aware and have an insufficiently robust parameter
+ validation to gracefully reject a FDT being passed.
+
+ If this option is enabled, the spl_atf os-type handler will
+ always pass NULL for the platform parameter.
+
+ If your ATF is affected, say Y.
+
config TPL
bool
depends on SUPPORT_TPL
diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
index 63557c01e8c..a942de9964a 100644
--- a/common/spl/spl_atf.c
+++ b/common/spl/spl_atf.c
@@ -144,6 +144,7 @@ void spl_invoke_atf(struct spl_image_info *spl_image)
{
uintptr_t bl33_entry = CONFIG_SYS_TEXT_BASE;
void *blob = spl_image->fdt_addr;
+ uintptr_t platform_param = (uintptr_t)blob;
int node;
/*
@@ -158,8 +159,17 @@ void spl_invoke_atf(struct spl_image_info *spl_image)
bl33_entry = spl_fit_images_get_entry(blob, node);
/*
+ * If ATF_NO_PLATFORM_PARAM is set, we override the platform
+ * parameter and always pass 0. This is a workaround for
+ * older ATF versions that have insufficiently robust (or
+ * overzealous) argument validation.
+ */
+ if (CONFIG_IS_ENABLED(ATF_NO_PLATFORM_PARAM))
+ platform_param = 0;
+
+ /*
* We don't provide a BL3-2 entry yet, but this will be possible
* using similar logic.
*/
- bl31_entry(spl_image->entry_point, bl33_entry, (uintptr_t)blob);
+ bl31_entry(spl_image->entry_point, bl33_entry, platform_param);
}
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index ab2501528fb..4071fea9339 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -15,6 +15,7 @@ CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
CONFIG_SPL_STACK_R=y
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
diff --git a/drivers/crypto/fsl/fsl_blob.c b/drivers/crypto/fsl/fsl_blob.c
index 38c6f9486bf..cb315dfd89d 100644
--- a/drivers/crypto/fsl/fsl_blob.c
+++ b/drivers/crypto/fsl/fsl_blob.c
@@ -7,63 +7,138 @@
#include <common.h>
#include <malloc.h>
+#include <memalign.h>
#include <fsl_sec.h>
#include <linux/errno.h>
#include "jobdesc.h"
#include "desc.h"
#include "jr.h"
+/**
+ * blob_decap() - Decapsulate the data from a blob
+ * @key_mod: - Key modifier address
+ * @src: - Source address (blob)
+ * @dst: - Destination address (data)
+ * @len: - Size of decapsulated data
+ *
+ * Note: Start and end of the key_mod, src and dst buffers have to be aligned to
+ * the cache line size (ARCH_DMA_MINALIGN) for the CAAM operation to succeed.
+ *
+ * Returns zero on success, negative on error.
+ */
int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
{
- int ret, i = 0;
+ int ret, size, i = 0;
u32 *desc;
+ if (!IS_ALIGNED((uintptr_t)key_mod, ARCH_DMA_MINALIGN) ||
+ !IS_ALIGNED((uintptr_t)src, ARCH_DMA_MINALIGN) ||
+ !IS_ALIGNED((uintptr_t)dst, ARCH_DMA_MINALIGN)) {
+ puts("Error: blob_decap: Address arguments are not aligned!\n");
+ return -EINVAL;
+ }
+
printf("\nDecapsulating blob to get data\n");
- desc = malloc(sizeof(int) * MAX_CAAM_DESCSIZE);
+ desc = malloc_cache_aligned(sizeof(int) * MAX_CAAM_DESCSIZE);
if (!desc) {
debug("Not enough memory for descriptor allocation\n");
- return -1;
+ return -ENOMEM;
}
+ size = ALIGN(16, ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)key_mod,
+ (unsigned long)key_mod + size);
+
+ size = ALIGN(BLOB_SIZE(len), ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)src,
+ (unsigned long)src + size);
+
inline_cnstr_jobdesc_blob_decap(desc, key_mod, src, dst, len);
debug("Descriptor dump:\n");
for (i = 0; i < 14; i++)
debug("Word[%d]: %08x\n", i, *(desc + i));
+
+ size = ALIGN(sizeof(int) * MAX_CAAM_DESCSIZE, ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)desc,
+ (unsigned long)desc + size);
+
ret = run_descriptor_jr(desc);
- if (ret)
- printf("Error in Decapsulation %d\n", ret);
- else
- printf("Decapsulation Success\n");
+ if (ret) {
+ printf("Error in blob decapsulation: %d\n", ret);
+ } else {
+ size = ALIGN(len, ARCH_DMA_MINALIGN);
+ invalidate_dcache_range((unsigned long)dst,
+ (unsigned long)dst + size);
+
+ puts("Blob decapsulation successful.\n");
+ }
free(desc);
return ret;
}
+/**
+ * blob_encap() - Encapsulate the data as a blob
+ * @key_mod: - Key modifier address
+ * @src: - Source address (data)
+ * @dst: - Destination address (blob)
+ * @len: - Size of data to be encapsulated
+ *
+ * Note: Start and end of the key_mod, src and dst buffers have to be aligned to
+ * the cache line size (ARCH_DMA_MINALIGN) for the CAAM operation to succeed.
+ *
+ * Returns zero on success, negative on error.
+ */
int blob_encap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
{
- int ret, i = 0;
+ int ret, size, i = 0;
u32 *desc;
+ if (!IS_ALIGNED((uintptr_t)key_mod, ARCH_DMA_MINALIGN) ||
+ !IS_ALIGNED((uintptr_t)src, ARCH_DMA_MINALIGN) ||
+ !IS_ALIGNED((uintptr_t)dst, ARCH_DMA_MINALIGN)) {
+ puts("Error: blob_encap: Address arguments are not aligned!\n");
+ return -EINVAL;
+ }
+
printf("\nEncapsulating data to form blob\n");
- desc = malloc(sizeof(int) * MAX_CAAM_DESCSIZE);
+ desc = malloc_cache_aligned(sizeof(int) * MAX_CAAM_DESCSIZE);
if (!desc) {
debug("Not enough memory for descriptor allocation\n");
- return -1;
+ return -ENOMEM;
}
+ size = ALIGN(16, ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)key_mod,
+ (unsigned long)key_mod + size);
+
+ size = ALIGN(len, ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)src,
+ (unsigned long)src + size);
+
inline_cnstr_jobdesc_blob_encap(desc, key_mod, src, dst, len);
debug("Descriptor dump:\n");
for (i = 0; i < 14; i++)
debug("Word[%d]: %08x\n", i, *(desc + i));
+
+ size = ALIGN(sizeof(int) * MAX_CAAM_DESCSIZE, ARCH_DMA_MINALIGN);
+ flush_dcache_range((unsigned long)desc,
+ (unsigned long)desc + size);
+
ret = run_descriptor_jr(desc);
- if (ret)
- printf("Error in Encapsulation %d\n", ret);
- else
- printf("Encapsulation Success\n");
+ if (ret) {
+ printf("Error in blob encapsulation: %d\n", ret);
+ } else {
+ size = ALIGN(BLOB_SIZE(len), ARCH_DMA_MINALIGN);
+ invalidate_dcache_range((unsigned long)dst,
+ (unsigned long)dst + size);
+
+ puts("Blob encapsulation successful.\n");
+ }
free(desc);
return ret;
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 74cc20d6532..0b258970620 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1900,16 +1900,32 @@ static void *video_logo(void)
sprintf(info, " %s", version_string);
#ifndef CONFIG_HIDE_LOGO_VERSION
- space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
+ space = (VIDEO_COLS - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
len = strlen(info);
if (len > space) {
- video_drawchars(VIDEO_INFO_X, VIDEO_INFO_Y,
- (uchar *) info, space);
- video_drawchars(VIDEO_INFO_X + VIDEO_FONT_WIDTH,
- VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
- (uchar *) info + space, len - space);
- y_off = 1;
+ int xx = VIDEO_INFO_X, yy = VIDEO_INFO_Y;
+ uchar *p = (uchar *) info;
+
+ while (len) {
+ if (len > space) {
+ video_drawchars(xx, yy, p, space);
+ len -= space;
+
+ p = (uchar *)p + space;
+
+ if (!y_off) {
+ xx += VIDEO_FONT_WIDTH;
+ space--;
+ }
+ yy += VIDEO_FONT_HEIGHT;
+
+ y_off++;
+ } else {
+ video_drawchars(xx, yy, p, len);
+ len = 0;
+ }
+ }
} else
video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 96229da502b..889085aa767 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -132,8 +132,12 @@ struct clk *clk_get_parent(struct clk *clk)
int clk_set_rate(struct clk *clk, unsigned long rate)
{
- if (clk && clk->set_rate)
+ if (!clk)
+ return 0;
+
+ if (clk->set_rate)
clk->set_rate(clk, rate);
+
return clk->rate;
}
diff --git a/include/fsl_sec.h b/include/fsl_sec.h
index 61c671d6c73..a2f5f5a5f1a 100644
--- a/include/fsl_sec.h
+++ b/include/fsl_sec.h
@@ -215,6 +215,8 @@ struct sg_entry {
#define SG_ENTRY_OFFSET_SHIFT 0
};
+#define BLOB_SIZE(x) ((x) + 32 + 16) /* Blob buffer size */
+
#if defined(CONFIG_MX6) || defined(CONFIG_MX7)
/* Job Ring Base Address */
#define JR_BASE_ADDR(x) (CONFIG_SYS_FSL_SEC_ADDR + 0x1000 * (x + 1))
@@ -274,8 +276,6 @@ struct sg_entry {
#define PERM 0x0000B008 /* Clear on release, lock SMAP
* lock SMAG group 1 Blob */
-#define BLOB_SIZE(x) (x + 32 + 16) /* Blob buffer size */
-
/* HAB WRAPPED KEY header */
#define WRP_HDR_SIZE 0x08
#define HDR_TAG 0x81