Merge branch 'next' of git://git.denx.de/u-boot-usb into next
This commit is contained in:
commit
2b18b89156
21
MAINTAINERS
21
MAINTAINERS
@ -329,8 +329,21 @@ F: drivers/usb/host/ehci-msm.c
|
||||
ARM STI
|
||||
M: Patrice Chotard <patrice.chotard@st.com>
|
||||
S: Maintained
|
||||
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
|
||||
F: arch/arm/mach-sti/
|
||||
F: arch/arm/include/asm/arch-sti*/
|
||||
F: drivers/phy/sti_usb_phy.c
|
||||
F: drivers/pinctrl/pinctrl-sti.c
|
||||
F: drivers/mmc/sti_sdhci.c
|
||||
F: drivers/reset/sti-reset.c
|
||||
F: drivers/serial/serial_sti_asc.c
|
||||
F: drivers/sysreset/sysreset_sti.c
|
||||
F: drivers/timer/sti-timer.c
|
||||
F: drivers/usb/host/dwc3-sti-glue.c
|
||||
F: include/dwc3-sti-glue.h
|
||||
F: include/dt-bindings/clock/stih407-clks.h
|
||||
F: include/dt-bindings/clock/stih410-clks.h
|
||||
F: include/dt-bindings/reset/stih407-resets.h
|
||||
|
||||
ARM STM SPEAR
|
||||
#M: Vipin Kumar <vipin.kumar@st.com>
|
||||
@ -514,6 +527,13 @@ M: Simon Glass <sjg@chromium.org>
|
||||
S: Maintained
|
||||
F: tools/binman/
|
||||
|
||||
BTRFS
|
||||
M: Marek Behun <marek.behun@nic.cz>
|
||||
S: Maintained
|
||||
F: cmd/btrfs.c
|
||||
F: fs/btrfs/
|
||||
F: include/btrfs.h
|
||||
|
||||
BUILDMAN
|
||||
M: Simon Glass <sjg@chromium.org>
|
||||
S: Maintained
|
||||
@ -924,6 +944,7 @@ T: git https://gitlab.denx.de/u-boot/custodians/u-boot-usb.git
|
||||
F: drivers/usb/
|
||||
F: common/usb.c
|
||||
F: common/usb_kbd.c
|
||||
F: include/usb.h
|
||||
|
||||
USB xHCI
|
||||
M: Bin Meng <bmeng.cn@gmail.com>
|
||||
|
4
Makefile
4
Makefile
@ -904,7 +904,7 @@ ifneq ($(CONFIG_BUILD_TARGET),)
|
||||
ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_INIT_SP_RELATIVE
|
||||
ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
|
||||
ALL-y += init_sp_bss_offset_check
|
||||
endif
|
||||
|
||||
@ -1215,7 +1215,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
|
||||
fi \
|
||||
fi
|
||||
|
||||
ifdef CONFIG_INIT_SP_RELATIVE
|
||||
ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
|
||||
ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
|
||||
subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN)))
|
||||
else
|
||||
|
@ -75,7 +75,7 @@ static void __secure __mdelay(u32 ms)
|
||||
isb();
|
||||
}
|
||||
|
||||
static void __secure clamp_release(void __maybe_unused *clamp)
|
||||
static void __secure clamp_release(u32 __maybe_unused *clamp)
|
||||
{
|
||||
#if defined(CONFIG_MACH_SUN6I) || defined(CONFIG_MACH_SUN7I) || \
|
||||
defined(CONFIG_MACH_SUN8I_H3) || \
|
||||
@ -90,7 +90,7 @@ static void __secure clamp_release(void __maybe_unused *clamp)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __secure clamp_set(void __maybe_unused *clamp)
|
||||
static void __secure clamp_set(u32 __maybe_unused *clamp)
|
||||
{
|
||||
#if defined(CONFIG_MACH_SUN6I) || defined(CONFIG_MACH_SUN7I) || \
|
||||
defined(CONFIG_MACH_SUN8I_H3) || \
|
||||
@ -99,28 +99,22 @@ static void __secure clamp_set(void __maybe_unused *clamp)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void __secure sunxi_power_switch(void *clamp, void *pwroff_ptr, bool on,
|
||||
static void __secure sunxi_power_switch(u32 *clamp, u32 *pwroff, bool on,
|
||||
int cpu)
|
||||
{
|
||||
u32 pwroff;
|
||||
|
||||
memcpy(&pwroff, pwroff_ptr, sizeof(u32));
|
||||
|
||||
if (on) {
|
||||
/* Release power clamp */
|
||||
clamp_release(clamp);
|
||||
|
||||
/* Clear power gating */
|
||||
clrbits_le32(&pwroff, BIT(cpu));
|
||||
clrbits_le32(pwroff, BIT(cpu));
|
||||
} else {
|
||||
/* Set power gating */
|
||||
setbits_le32(&pwroff, BIT(cpu));
|
||||
setbits_le32(pwroff, BIT(cpu));
|
||||
|
||||
/* Activate power clamp */
|
||||
clamp_set(clamp);
|
||||
}
|
||||
|
||||
memcpy(pwroff_ptr, &pwroff, sizeof(u32));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MACH_SUN8I_R40
|
||||
|
@ -40,9 +40,20 @@
|
||||
};
|
||||
|
||||
&uart2 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart2m0_xfer_pullup>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb20_otg {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
uart2m0 {
|
||||
uart2m0_xfer_pullup: uart2m0-xfer-pullup {
|
||||
rockchip,pins = <2 RK_PD2 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
|
||||
<2 RK_PD1 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
6
arch/arm/dts/rv1108-u-boot.dtsi
Normal file
6
arch/arm/dts/rv1108-u-boot.dtsi
Normal file
@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
|
||||
*/
|
||||
|
||||
#include "rockchip-u-boot.dtsi"
|
@ -119,7 +119,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
|
||||
|
||||
config STM32_ETZPC
|
||||
bool "STM32 Extended TrustZone Protection"
|
||||
depends on TARGET_STM32MP1
|
||||
depends on STM32MP15x
|
||||
default y
|
||||
help
|
||||
Say y to enable STM32 Extended TrustZone Protection
|
||||
|
@ -210,8 +210,21 @@ config NR_CPUS
|
||||
Stack memory is pre-allocated. U-Boot must therefore know the
|
||||
maximum number of CPUs that may be present.
|
||||
|
||||
config SBI
|
||||
bool
|
||||
default y if RISCV_SMODE || SPL_RISCV_SMODE
|
||||
|
||||
config SBI_V01
|
||||
bool "SBI v0.1 support"
|
||||
default y
|
||||
depends on SBI
|
||||
help
|
||||
This config allows kernel to use SBI v0.1 APIs. This will be
|
||||
deprecated in future once legacy M-mode software are no longer in use.
|
||||
|
||||
config SBI_IPI
|
||||
bool
|
||||
depends on SBI
|
||||
default y if RISCV_SMODE || SPL_RISCV_SMODE
|
||||
depends on SMP
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2015 Regents of the University of California
|
||||
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
||||
*
|
||||
* Taken from Linux arch/riscv/include/asm/sbi.h
|
||||
*/
|
||||
@ -10,85 +11,113 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define SBI_SET_TIMER 0
|
||||
#define SBI_CONSOLE_PUTCHAR 1
|
||||
#define SBI_CONSOLE_GETCHAR 2
|
||||
#define SBI_CLEAR_IPI 3
|
||||
#define SBI_SEND_IPI 4
|
||||
#define SBI_REMOTE_FENCE_I 5
|
||||
#define SBI_REMOTE_SFENCE_VMA 6
|
||||
#define SBI_REMOTE_SFENCE_VMA_ASID 7
|
||||
#define SBI_SHUTDOWN 8
|
||||
enum sbi_ext_id {
|
||||
#ifdef CONFIG_SBI_V01
|
||||
SBI_EXT_0_1_SET_TIMER = 0x0,
|
||||
SBI_EXT_0_1_CONSOLE_PUTCHAR = 0x1,
|
||||
SBI_EXT_0_1_CONSOLE_GETCHAR = 0x2,
|
||||
SBI_EXT_0_1_CLEAR_IPI = 0x3,
|
||||
SBI_EXT_0_1_SEND_IPI = 0x4,
|
||||
SBI_EXT_0_1_REMOTE_FENCE_I = 0x5,
|
||||
SBI_EXT_0_1_REMOTE_SFENCE_VMA = 0x6,
|
||||
SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID = 0x7,
|
||||
SBI_EXT_0_1_SHUTDOWN = 0x8,
|
||||
#endif
|
||||
SBI_EXT_BASE = 0x10,
|
||||
SBI_EXT_TIME = 0x54494D45,
|
||||
SBI_EXT_IPI = 0x735049,
|
||||
SBI_EXT_RFENCE = 0x52464E43,
|
||||
};
|
||||
|
||||
#define SBI_CALL(which, arg0, arg1, arg2) ({ \
|
||||
register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0); \
|
||||
register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1); \
|
||||
register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2); \
|
||||
register uintptr_t a7 asm ("a7") = (uintptr_t)(which); \
|
||||
asm volatile ("ecall" \
|
||||
: "+r" (a0) \
|
||||
: "r" (a1), "r" (a2), "r" (a7) \
|
||||
: "memory"); \
|
||||
a0; \
|
||||
})
|
||||
enum sbi_ext_base_fid {
|
||||
SBI_EXT_BASE_GET_SPEC_VERSION = 0,
|
||||
SBI_EXT_BASE_GET_IMP_ID,
|
||||
SBI_EXT_BASE_GET_IMP_VERSION,
|
||||
SBI_EXT_BASE_PROBE_EXT,
|
||||
SBI_EXT_BASE_GET_MVENDORID,
|
||||
SBI_EXT_BASE_GET_MARCHID,
|
||||
SBI_EXT_BASE_GET_MIMPID,
|
||||
};
|
||||
|
||||
/* Lazy implementations until SBI is finalized */
|
||||
#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0)
|
||||
#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0)
|
||||
#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0)
|
||||
enum sbi_ext_time_fid {
|
||||
SBI_EXT_TIME_SET_TIMER = 0,
|
||||
};
|
||||
|
||||
static inline void sbi_console_putchar(int ch)
|
||||
{
|
||||
SBI_CALL_1(SBI_CONSOLE_PUTCHAR, ch);
|
||||
}
|
||||
enum sbi_ext_ipi_fid {
|
||||
SBI_EXT_IPI_SEND_IPI = 0,
|
||||
};
|
||||
|
||||
static inline int sbi_console_getchar(void)
|
||||
{
|
||||
return SBI_CALL_0(SBI_CONSOLE_GETCHAR);
|
||||
}
|
||||
enum sbi_ext_rfence_fid {
|
||||
SBI_EXT_RFENCE_REMOTE_FENCE_I = 0,
|
||||
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
|
||||
SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
|
||||
};
|
||||
|
||||
static inline void sbi_set_timer(uint64_t stime_value)
|
||||
{
|
||||
#if __riscv_xlen == 32
|
||||
SBI_CALL_2(SBI_SET_TIMER, stime_value, stime_value >> 32);
|
||||
#ifdef CONFIG_SBI_V01
|
||||
#define SBI_EXT_SET_TIMER SBI_EXT_0_1_SET_TIMER
|
||||
#define SBI_FID_SET_TIMER 0
|
||||
#define SBI_EXT_SEND_IPI SBI_EXT_0_1_SEND_IPI
|
||||
#define SBI_FID_SEND_IPI 0
|
||||
#define SBI_EXT_REMOTE_FENCE_I SBI_EXT_0_1_REMOTE_FENCE_I
|
||||
#define SBI_FID_REMOTE_FENCE_I 0
|
||||
#define SBI_EXT_REMOTE_SFENCE_VMA SBI_EXT_0_1_REMOTE_SFENCE_VMA
|
||||
#define SBI_FID_REMOTE_SFENCE_VMA 0
|
||||
#define SBI_EXT_REMOTE_SFENCE_VMA_ASID SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID
|
||||
#define SBI_FID_REMOTE_SFENCE_VMA_ASID 0
|
||||
#else
|
||||
SBI_CALL_1(SBI_SET_TIMER, stime_value);
|
||||
#define SBI_EXT_SET_TIMER SBI_EXT_TIME
|
||||
#define SBI_FID_SET_TIMER SBI_EXT_TIME_SET_TIMER
|
||||
#define SBI_EXT_SEND_IPI SBI_EXT_IPI
|
||||
#define SBI_FID_SEND_IPI SBI_EXT_IPI_SEND_IPI
|
||||
#define SBI_EXT_REMOTE_FENCE_I SBI_EXT_RFENCE
|
||||
#define SBI_FID_REMOTE_FENCE_I SBI_EXT_RFENCE_REMOTE_FENCE_I
|
||||
#define SBI_EXT_REMOTE_SFENCE_VMA SBI_EXT_RFENCE
|
||||
#define SBI_FID_REMOTE_SFENCE_VMA SBI_EXT_RFENCE_REMOTE_SFENCE_VMA
|
||||
#define SBI_EXT_REMOTE_SFENCE_VMA_ASID SBI_EXT_RFENCE
|
||||
#define SBI_FID_REMOTE_SFENCE_VMA_ASID SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void sbi_shutdown(void)
|
||||
{
|
||||
SBI_CALL_0(SBI_SHUTDOWN);
|
||||
}
|
||||
#define SBI_SPEC_VERSION_DEFAULT 0x1
|
||||
#define SBI_SPEC_VERSION_MAJOR_SHIFT 24
|
||||
#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
|
||||
#define SBI_SPEC_VERSION_MINOR_MASK 0xffffff
|
||||
|
||||
static inline void sbi_clear_ipi(void)
|
||||
{
|
||||
SBI_CALL_0(SBI_CLEAR_IPI);
|
||||
}
|
||||
/* SBI return error codes */
|
||||
#define SBI_SUCCESS 0
|
||||
#define SBI_ERR_FAILURE -1
|
||||
#define SBI_ERR_NOT_SUPPORTED -2
|
||||
#define SBI_ERR_INVALID_PARAM -3
|
||||
#define SBI_ERR_DENIED -4
|
||||
#define SBI_ERR_INVALID_ADDRESS -5
|
||||
|
||||
static inline void sbi_send_ipi(const unsigned long *hart_mask)
|
||||
{
|
||||
SBI_CALL_1(SBI_SEND_IPI, hart_mask);
|
||||
}
|
||||
extern unsigned long sbi_spec_version;
|
||||
struct sbiret {
|
||||
long error;
|
||||
long value;
|
||||
};
|
||||
|
||||
static inline void sbi_remote_fence_i(const unsigned long *hart_mask)
|
||||
{
|
||||
SBI_CALL_1(SBI_REMOTE_FENCE_I, hart_mask);
|
||||
}
|
||||
struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
|
||||
unsigned long arg1, unsigned long arg2,
|
||||
unsigned long arg3, unsigned long arg4,
|
||||
unsigned long arg5);
|
||||
|
||||
static inline void sbi_remote_sfence_vma(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size)
|
||||
{
|
||||
SBI_CALL_1(SBI_REMOTE_SFENCE_VMA, hart_mask);
|
||||
}
|
||||
#ifdef CONFIG_SBI_V01
|
||||
void sbi_console_putchar(int ch);
|
||||
int sbi_console_getchar(void);
|
||||
void sbi_clear_ipi(void);
|
||||
void sbi_shutdown(void);
|
||||
#endif
|
||||
void sbi_set_timer(uint64_t stime_value);
|
||||
void sbi_send_ipi(const unsigned long *hart_mask);
|
||||
void sbi_remote_fence_i(const unsigned long *hart_mask);
|
||||
void sbi_remote_sfence_vma(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size);
|
||||
void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size,
|
||||
unsigned long asid);
|
||||
|
||||
static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size,
|
||||
unsigned long asid)
|
||||
{
|
||||
SBI_CALL_1(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask);
|
||||
}
|
||||
int sbi_probe_extension(int ext);
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@ obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
|
||||
obj-$(CONFIG_ANDES_PLMT) += andes_plmt.o
|
||||
else
|
||||
obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
|
||||
obj-$(CONFIG_SBI) += sbi.o
|
||||
obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
|
||||
endif
|
||||
obj-y += interrupts.o
|
||||
|
187
arch/riscv/lib/sbi.c
Normal file
187
arch/riscv/lib/sbi.c
Normal file
@ -0,0 +1,187 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* SBI initialilization and all extension implementation.
|
||||
*
|
||||
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
||||
*
|
||||
* Taken from Linux arch/riscv/kernel/sbi.c
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/encoding.h>
|
||||
#include <asm/sbi.h>
|
||||
|
||||
/* default SBI version is 0.1 */
|
||||
unsigned long sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;
|
||||
|
||||
struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
|
||||
unsigned long arg1, unsigned long arg2,
|
||||
unsigned long arg3, unsigned long arg4,
|
||||
unsigned long arg5)
|
||||
{
|
||||
struct sbiret ret;
|
||||
|
||||
register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);
|
||||
register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);
|
||||
register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);
|
||||
register uintptr_t a3 asm ("a3") = (uintptr_t)(arg3);
|
||||
register uintptr_t a4 asm ("a4") = (uintptr_t)(arg4);
|
||||
register uintptr_t a5 asm ("a5") = (uintptr_t)(arg5);
|
||||
register uintptr_t a6 asm ("a6") = (uintptr_t)(fid);
|
||||
register uintptr_t a7 asm ("a7") = (uintptr_t)(ext);
|
||||
asm volatile ("ecall"
|
||||
: "+r" (a0), "+r" (a1)
|
||||
: "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7)
|
||||
: "memory");
|
||||
ret.error = a0;
|
||||
ret.value = a1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SBI_V01
|
||||
|
||||
/**
|
||||
* sbi_console_putchar() - Writes given character to the console device.
|
||||
* @ch: The data to be written to the console.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_console_putchar(int ch)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_console_getchar() - Reads a byte from console device.
|
||||
*
|
||||
* Returns the value read from console.
|
||||
*/
|
||||
int sbi_console_getchar(void)
|
||||
{
|
||||
struct sbiret ret;
|
||||
|
||||
ret = sbi_ecall(SBI_EXT_0_1_CONSOLE_GETCHAR, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
return ret.error;
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_clear_ipi(void)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_shutdown() - Remove all the harts from executing supervisor code.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_shutdown(void)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SBI_V01 */
|
||||
|
||||
/**
|
||||
* sbi_set_timer() - Program the timer for next timer event.
|
||||
* @stime_value: The value after which next timer event should fire.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_set_timer(uint64_t stime_value)
|
||||
{
|
||||
#if __riscv_xlen == 32
|
||||
sbi_ecall(SBI_EXT_SET_TIMER, SBI_FID_SET_TIMER, stime_value,
|
||||
stime_value >> 32, 0, 0, 0, 0);
|
||||
#else
|
||||
sbi_ecall(SBI_EXT_SET_TIMER, SBI_FID_SET_TIMER, stime_value,
|
||||
0, 0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_send_ipi() - Send an IPI to any hart.
|
||||
* @hart_mask: A cpu mask containing all the target harts.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_send_ipi(const unsigned long *hart_mask)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_SEND_IPI, SBI_FID_SEND_IPI, (unsigned long)hart_mask,
|
||||
0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_remote_fence_i() - Execute FENCE.I instruction on given remote harts.
|
||||
* @hart_mask: A cpu mask containing all the target harts.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_remote_fence_i(const unsigned long *hart_mask)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_REMOTE_FENCE_I, SBI_FID_REMOTE_FENCE_I,
|
||||
(unsigned long)hart_mask, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_remote_sfence_vma() - Execute SFENCE.VMA instructions on given remote
|
||||
* harts for the specified virtual address range.
|
||||
* @hart_mask: A cpu mask containing all the target harts.
|
||||
* @start: Start of the virtual address
|
||||
* @size: Total size of the virtual address range.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_remote_sfence_vma(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_REMOTE_SFENCE_VMA, SBI_FID_REMOTE_SFENCE_VMA,
|
||||
(unsigned long)hart_mask, start, size, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_remote_sfence_vma_asid() - Execute SFENCE.VMA instructions on given
|
||||
* remote harts for a virtual address range belonging to a specific ASID.
|
||||
*
|
||||
* @hart_mask: A cpu mask containing all the target harts.
|
||||
* @start: Start of the virtual address
|
||||
* @size: Total size of the virtual address range.
|
||||
* @asid: The value of address space identifier (ASID).
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
|
||||
unsigned long start,
|
||||
unsigned long size,
|
||||
unsigned long asid)
|
||||
{
|
||||
sbi_ecall(SBI_EXT_REMOTE_SFENCE_VMA_ASID,
|
||||
SBI_FID_REMOTE_SFENCE_VMA_ASID,
|
||||
(unsigned long)hart_mask, start, size, asid, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sbi_probe_extension() - Check if an SBI extension ID is supported or not.
|
||||
* @extid: The extension ID to be probed.
|
||||
*
|
||||
* Return: Extension specific nonzero value f yes, -ENOTSUPP otherwise.
|
||||
*/
|
||||
int sbi_probe_extension(int extid)
|
||||
{
|
||||
struct sbiret ret;
|
||||
|
||||
ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, extid,
|
||||
0, 0, 0, 0, 0);
|
||||
if (!ret.error)
|
||||
if (ret.value)
|
||||
return ret.value;
|
||||
|
||||
return -ENOTSUPP;
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/encoding.h>
|
||||
#include <asm/sbi.h>
|
||||
|
||||
int riscv_send_ipi(int hart)
|
||||
@ -19,7 +20,7 @@ int riscv_send_ipi(int hart)
|
||||
|
||||
int riscv_clear_ipi(int hart)
|
||||
{
|
||||
sbi_clear_ipi();
|
||||
csr_clear(CSR_SIP, SIP_SSIP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <syscon.h>
|
||||
#include <asm/io.h>
|
||||
#include <fdtdec.h>
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/grf_rv1108.h>
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
#include <asm/gpio.h>
|
||||
@ -15,7 +16,6 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int mach_cpu_init(void)
|
||||
{
|
||||
int node;
|
||||
struct rv1108_grf *grf;
|
||||
enum {
|
||||
GPIO3C3_SHIFT = 6,
|
||||
@ -35,8 +35,7 @@ int mach_cpu_init(void)
|
||||
GPIO2D1_UART2_SIN_M0,
|
||||
};
|
||||
|
||||
node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "rockchip,rv1108-grf");
|
||||
grf = (struct rv1108_grf *)fdtdec_get_addr(gd->fdt_blob, node, "reg");
|
||||
grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
|
||||
|
||||
/* Elgin board use UART2 m0 for debug*/
|
||||
rk_clrsetreg(&grf->gpio2d_iomux,
|
||||
@ -50,7 +49,7 @@ int mach_cpu_init(void)
|
||||
|
||||
#define MODEM_ENABLE_GPIO 111
|
||||
|
||||
int board_early_init_f(void)
|
||||
int rk_board_late_init(void)
|
||||
{
|
||||
gpio_request(MODEM_ENABLE_GPIO, "modem_enable");
|
||||
gpio_direction_output(MODEM_ENABLE_GPIO, 0);
|
||||
|
@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <syscon.h>
|
||||
#include <asm/io.h>
|
||||
#include <fdtdec.h>
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/grf_rv1108.h>
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
|
||||
@ -14,7 +15,6 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int mach_cpu_init(void)
|
||||
{
|
||||
int node;
|
||||
struct rv1108_grf *grf;
|
||||
enum {
|
||||
GPIO3C3_SHIFT = 6,
|
||||
@ -34,8 +34,7 @@ int mach_cpu_init(void)
|
||||
GPIO2D1_UART2_SIN_M0,
|
||||
};
|
||||
|
||||
node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "rockchip,rv1108-grf");
|
||||
grf = (struct rv1108_grf *)fdtdec_get_addr(gd->fdt_blob, node, "reg");
|
||||
grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
|
||||
|
||||
/*evb board use UART2 m0 for debug*/
|
||||
rk_clrsetreg(&grf->gpio2d_iomux,
|
||||
|
@ -149,6 +149,20 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void efi_reserve_memory(u64 addr, u64 size)
|
||||
{
|
||||
u64 pages;
|
||||
|
||||
/* Convert from sandbox address space. */
|
||||
addr = (uintptr_t)map_sysmem(addr, 0);
|
||||
pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
|
||||
addr &= ~EFI_PAGE_MASK;
|
||||
if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
|
||||
false) != EFI_SUCCESS)
|
||||
printf("Reserved memory mapping failed addr %llx size %llx\n",
|
||||
addr, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_carve_out_dt_rsv() - Carve out DT reserved memory ranges
|
||||
*
|
||||
@ -161,7 +175,8 @@ done:
|
||||
static void efi_carve_out_dt_rsv(void *fdt)
|
||||
{
|
||||
int nr_rsv, i;
|
||||
uint64_t addr, size, pages;
|
||||
u64 addr, size;
|
||||
int nodeoffset, subnode;
|
||||
|
||||
nr_rsv = fdt_num_mem_rsv(fdt);
|
||||
|
||||
@ -169,15 +184,25 @@ static void efi_carve_out_dt_rsv(void *fdt)
|
||||
for (i = 0; i < nr_rsv; i++) {
|
||||
if (fdt_get_mem_rsv(fdt, i, &addr, &size) != 0)
|
||||
continue;
|
||||
efi_reserve_memory(addr, size);
|
||||
}
|
||||
|
||||
/* Convert from sandbox address space. */
|
||||
addr = (uintptr_t)map_sysmem(addr, 0);
|
||||
|
||||
pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
|
||||
addr &= ~EFI_PAGE_MASK;
|
||||
if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
|
||||
false) != EFI_SUCCESS)
|
||||
printf("FDT memrsv map %d: Failed to add to map\n", i);
|
||||
/* process reserved-memory */
|
||||
nodeoffset = fdt_subnode_offset(fdt, 0, "reserved-memory");
|
||||
if (nodeoffset >= 0) {
|
||||
subnode = fdt_first_subnode(fdt, nodeoffset);
|
||||
while (subnode >= 0) {
|
||||
/* check if this subnode has a reg property */
|
||||
addr = fdtdec_get_addr_size(fdt, subnode, "reg",
|
||||
(fdt_size_t *)&size);
|
||||
/*
|
||||
* The /reserved-memory node may have children with
|
||||
* a size instead of a reg property.
|
||||
*/
|
||||
if (addr != FDT_ADDR_T_NONE)
|
||||
efi_reserve_memory(addr, size);
|
||||
subnode = fdt_next_subnode(fdt, subnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,9 +288,6 @@ efi_status_t efi_install_fdt(void *fdt)
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
/* Create memory reservations as indicated by the device tree */
|
||||
efi_carve_out_dt_rsv(fdt);
|
||||
|
||||
/* Prepare device tree for payload */
|
||||
ret = copy_fdt(&fdt);
|
||||
if (ret) {
|
||||
@ -278,6 +300,9 @@ efi_status_t efi_install_fdt(void *fdt)
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
/* Create memory reservations as indicated by the device tree */
|
||||
efi_carve_out_dt_rsv(fdt);
|
||||
|
||||
/* Install device tree as UEFI table */
|
||||
ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <exports.h>
|
||||
#include <hexdump.h>
|
||||
#include <malloc.h>
|
||||
#include <mapmem.h>
|
||||
#include <search.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
@ -488,9 +489,10 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
|
||||
|
||||
printf("%-16s %.*llx-%.*llx", type,
|
||||
EFI_PHYS_ADDR_WIDTH,
|
||||
map->physical_start,
|
||||
(u64)map_to_sysmem((void *)map->physical_start),
|
||||
EFI_PHYS_ADDR_WIDTH,
|
||||
map->physical_start + map->num_pages * EFI_PAGE_SIZE);
|
||||
(u64)map_to_sysmem((void *)map->physical_start +
|
||||
map->num_pages * EFI_PAGE_SIZE));
|
||||
|
||||
print_memory_attributes(map->attribute);
|
||||
putc('\n');
|
||||
@ -649,7 +651,7 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
|
||||
int id, i;
|
||||
char *endp;
|
||||
char var_name[9];
|
||||
u16 var_name16[9];
|
||||
u16 var_name16[9], *p;
|
||||
efi_status_t ret;
|
||||
|
||||
if (argc == 1)
|
||||
@ -662,11 +664,12 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
sprintf(var_name, "Boot%04X", id);
|
||||
utf8_utf16_strncpy((u16 **)&var_name16, var_name, 9);
|
||||
p = var_name16;
|
||||
utf8_utf16_strncpy(&p, var_name, 9);
|
||||
|
||||
ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL));
|
||||
if (ret) {
|
||||
printf("Cannot remove Boot%04X", id);
|
||||
printf("Cannot remove %ls\n", var_name16);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,12 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
if (ret != -EBUSY)
|
||||
gpio_free(gpio);
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
/*
|
||||
* Whilst wrong, the legacy gpio input command returns the pin
|
||||
* value, or CMD_RET_FAILURE (which is indistinguishable from a
|
||||
* valid pin value).
|
||||
*/
|
||||
return (sub_cmd == GPIOC_INPUT) ? value : CMD_RET_SUCCESS;
|
||||
|
||||
err:
|
||||
if (ret != -EBUSY)
|
||||
|
@ -1011,8 +1011,10 @@ int fit_image_get_data_and_size(const void *fit, int noffset,
|
||||
if (external_data) {
|
||||
debug("External Data\n");
|
||||
ret = fit_image_get_data_size(fit, noffset, &len);
|
||||
*data = fit + offset;
|
||||
*size = len;
|
||||
if (!ret) {
|
||||
*data = fit + offset;
|
||||
*size = len;
|
||||
}
|
||||
} else {
|
||||
ret = fit_image_get_data(fit, noffset, data, size);
|
||||
}
|
||||
|
@ -4,12 +4,14 @@ CONFIG_SYS_TEXT_BASE=0x60000000
|
||||
CONFIG_ENV_OFFSET=0x3F8000
|
||||
CONFIG_ROCKCHIP_RV1108=y
|
||||
CONFIG_TARGET_ELGIN_RV1108=y
|
||||
CONFIG_ROCKCHIP_BOOT_MODE_REG=0
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_DEBUG_UART_BASE=0x10210000
|
||||
CONFIG_DEBUG_UART_CLOCK=24000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
# CONFIG_USE_BOOTCOMMAND is not set
|
||||
CONFIG_DEFAULT_FDT_FILE="rv1108-elgin-r1.dtb"
|
||||
CONFIG_BOARD_LATE_INIT=y
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
|
@ -75,6 +75,7 @@ CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
CONFIG_USB_ETHER_SMSC95XX=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
# CONFIG_VIDEO_BPP8 is not set
|
||||
CONFIG_DISPLAY=y
|
||||
|
@ -56,5 +56,6 @@ CONFIG_USB_ETHER_ASIX88179=y
|
||||
CONFIG_USB_ETHER_MCS7830=y
|
||||
CONFIG_USB_ETHER_RTL8152=y
|
||||
CONFIG_USB_ETHER_SMSC95XX=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_SPL_TINY_MEMSET=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
|
@ -74,6 +74,7 @@ CONFIG_USB_DWC2=y
|
||||
CONFIG_ROCKCHIP_USB2_PHY=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
# CONFIG_VIDEO_BPP8 is not set
|
||||
CONFIG_DISPLAY=y
|
||||
|
@ -169,7 +169,6 @@ CONFIG_REMOTEPROC_SANDBOX=y
|
||||
CONFIG_DM_RESET=y
|
||||
CONFIG_SANDBOX_RESET=y
|
||||
CONFIG_DM_RNG=y
|
||||
CONFIG_RNG_SANDBOX=y
|
||||
CONFIG_DM_RTC=y
|
||||
CONFIG_RTC_RV8803=y
|
||||
CONFIG_SANDBOX_SERIAL=y
|
||||
|
@ -189,7 +189,6 @@ CONFIG_REMOTEPROC_SANDBOX=y
|
||||
CONFIG_DM_RESET=y
|
||||
CONFIG_SANDBOX_RESET=y
|
||||
CONFIG_DM_RNG=y
|
||||
CONFIG_RNG_SANDBOX=y
|
||||
CONFIG_DM_RTC=y
|
||||
CONFIG_RTC_RV8803=y
|
||||
CONFIG_DEBUG_UART_SANDBOX=y
|
||||
|
@ -80,6 +80,7 @@ CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
CONFIG_USB_ETHER_SMSC95XX=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_DISPLAY=y
|
||||
CONFIG_VIDEO_ROCKCHIP=y
|
||||
|
@ -80,6 +80,7 @@ CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
CONFIG_USB_ETHER_SMSC95XX=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
# CONFIG_VIDEO_BPP8 is not set
|
||||
CONFIG_DISPLAY=y
|
||||
|
@ -6,16 +6,29 @@ config DM_RNG
|
||||
This interface is used to initialise the rng device and to
|
||||
read the random seed from the device.
|
||||
|
||||
if DM_RNG
|
||||
|
||||
config RNG_MESON
|
||||
bool "Amlogic Meson Random Number Generator support"
|
||||
depends on ARCH_MESON
|
||||
default y
|
||||
help
|
||||
Enable support for hardware random number generator
|
||||
of Amlogic Meson SoCs.
|
||||
|
||||
config RNG_SANDBOX
|
||||
bool "Sandbox random number generator"
|
||||
depends on SANDBOX && DM_RNG
|
||||
depends on SANDBOX
|
||||
default y
|
||||
help
|
||||
Enable random number generator for sandbox. This is an
|
||||
emulation of a rng device.
|
||||
|
||||
config RNG_STM32MP1
|
||||
bool "Enable random number generator for STM32MP1"
|
||||
depends on ARCH_STM32MP && DM_RNG
|
||||
depends on ARCH_STM32MP
|
||||
default n
|
||||
help
|
||||
Enable STM32MP1 rng driver.
|
||||
|
||||
endif
|
||||
|
@ -4,5 +4,6 @@
|
||||
#
|
||||
|
||||
obj-$(CONFIG_DM_RNG) += rng-uclass.o
|
||||
obj-$(CONFIG_RNG_MESON) += meson-rng.o
|
||||
obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o
|
||||
obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o
|
||||
|
120
drivers/rng/meson-rng.c
Normal file
120
drivers/rng/meson-rng.c
Normal file
@ -0,0 +1,120 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
*
|
||||
* Driver for Amlogic hardware random number generator
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <clk.h>
|
||||
#include <dm.h>
|
||||
#include <rng.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
struct meson_rng_platdata {
|
||||
fdt_addr_t base;
|
||||
struct clk clk;
|
||||
};
|
||||
|
||||
/**
|
||||
* meson_rng_read() - fill buffer with random bytes
|
||||
*
|
||||
* @buffer: buffer to receive data
|
||||
* @size: size of buffer
|
||||
*
|
||||
* Return: 0
|
||||
*/
|
||||
static int meson_rng_read(struct udevice *dev, void *data, size_t len)
|
||||
{
|
||||
struct meson_rng_platdata *pdata = dev_get_platdata(dev);
|
||||
char *buffer = (char *)data;
|
||||
|
||||
while (len) {
|
||||
u32 rand = readl(pdata->base);
|
||||
size_t step;
|
||||
|
||||
if (len >= 4)
|
||||
step = 4;
|
||||
else
|
||||
step = len;
|
||||
memcpy(buffer, &rand, step);
|
||||
buffer += step;
|
||||
len -= step;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* meson_rng_probe() - probe rng device
|
||||
*
|
||||
* @dev: device
|
||||
* Return: 0 if ok
|
||||
*/
|
||||
static int meson_rng_probe(struct udevice *dev)
|
||||
{
|
||||
struct meson_rng_platdata *pdata = dev_get_platdata(dev);
|
||||
int err;
|
||||
|
||||
err = clk_enable(&pdata->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* meson_rng_remove() - deinitialize rng device
|
||||
*
|
||||
* @dev: device
|
||||
* Return: 0 if ok
|
||||
*/
|
||||
static int meson_rng_remove(struct udevice *dev)
|
||||
{
|
||||
struct meson_rng_platdata *pdata = dev_get_platdata(dev);
|
||||
|
||||
return clk_disable(&pdata->clk);
|
||||
}
|
||||
|
||||
/**
|
||||
* meson_rng_ofdata_to_platdata() - transfer device tree data to plaform data
|
||||
*
|
||||
* @dev: device
|
||||
* Return: 0 if ok
|
||||
*/
|
||||
static int meson_rng_ofdata_to_platdata(struct udevice *dev)
|
||||
{
|
||||
struct meson_rng_platdata *pdata = dev_get_platdata(dev);
|
||||
int err;
|
||||
|
||||
pdata->base = dev_read_addr(dev);
|
||||
if (!pdata->base)
|
||||
return -ENODEV;
|
||||
|
||||
err = clk_get_by_name(dev, "core", &pdata->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dm_rng_ops meson_rng_ops = {
|
||||
.read = meson_rng_read,
|
||||
};
|
||||
|
||||
static const struct udevice_id meson_rng_match[] = {
|
||||
{
|
||||
.compatible = "amlogic,meson-rng",
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(meson_rng) = {
|
||||
.name = "meson-rng",
|
||||
.id = UCLASS_RNG,
|
||||
.of_match = meson_rng_match,
|
||||
.ops = &meson_rng_ops,
|
||||
.probe = meson_rng_probe,
|
||||
.remove = meson_rng_remove,
|
||||
.platdata_auto_alloc_size = sizeof(struct meson_rng_platdata),
|
||||
.ofdata_to_platdata = meson_rng_ofdata_to_platdata,
|
||||
};
|
@ -39,7 +39,7 @@ obj-$(CONFIG_COREBOOT_SERIAL) += serial_coreboot.o
|
||||
obj-$(CONFIG_CORTINA_UART) += serial_cortina.o
|
||||
obj-$(CONFIG_EFI_APP) += serial_efi.o
|
||||
obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
|
||||
obj-$(CONFIG_MCFUART) += mcfuart.o
|
||||
obj-$(CONFIG_MCFUART) += serial_mcf.o
|
||||
obj-$(CONFIG_SYS_NS16550) += ns16550.o
|
||||
obj-$(CONFIG_S5P) += serial_s5p.o
|
||||
obj-$(CONFIG_MXC_UART) += serial_mxc.o
|
||||
|
@ -85,6 +85,8 @@ static int coldfire_serial_probe(struct udevice *dev)
|
||||
{
|
||||
struct coldfire_serial_platdata *plat = dev->platdata;
|
||||
|
||||
plat->port = dev->seq;
|
||||
|
||||
return mcf_serial_init_common((uart_t *)plat->base,
|
||||
plat->port, plat->baudrate);
|
||||
}
|
||||
@ -148,8 +150,6 @@ static int coldfire_ofdata_to_platdata(struct udevice *dev)
|
||||
return -ENODEV;
|
||||
|
||||
plat->base = (uint32_t)addr_base;
|
||||
|
||||
plat->port = dev->seq;
|
||||
plat->baudrate = gd->baudrate;
|
||||
|
||||
return 0;
|
@ -108,7 +108,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
|
||||
enum usb_dr_mode dr_mode;
|
||||
int ret = 0;
|
||||
|
||||
dr_mode = usb_get_dr_mode(dev_of_offset(dev));
|
||||
dr_mode = usb_get_dr_mode(dev->node);
|
||||
cdns->role = USB_ROLE_NONE;
|
||||
|
||||
/*
|
||||
@ -384,22 +384,20 @@ static const struct udevice_id cdns3_ids[] = {
|
||||
|
||||
int cdns3_bind(struct udevice *parent)
|
||||
{
|
||||
int from = dev_of_offset(parent);
|
||||
const void *fdt = gd->fdt_blob;
|
||||
enum usb_dr_mode dr_mode;
|
||||
struct udevice *dev;
|
||||
const char *driver;
|
||||
const char *name;
|
||||
int node;
|
||||
ofnode node;
|
||||
int ret;
|
||||
|
||||
node = fdt_node_offset_by_compatible(fdt, from, "cdns,usb3");
|
||||
if (node < 0) {
|
||||
node = ofnode_by_compatible(parent->node, "cdns,usb3");
|
||||
if (!ofnode_valid(node)) {
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
name = fdt_get_name(fdt, node, NULL);
|
||||
name = ofnode_get_name(node);
|
||||
dr_mode = usb_get_dr_mode(node);
|
||||
|
||||
switch (dr_mode) {
|
||||
@ -422,8 +420,7 @@ int cdns3_bind(struct udevice *parent)
|
||||
goto fail;
|
||||
};
|
||||
|
||||
ret = device_bind_driver_to_node(parent, driver, name,
|
||||
offset_to_ofnode(node), &dev);
|
||||
ret = device_bind_driver_to_node(parent, driver, name, node, &dev);
|
||||
if (ret) {
|
||||
printf("%s: not able to bind usb device mode\n",
|
||||
__func__);
|
||||
|
@ -2579,7 +2579,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
|
||||
if (!priv_dev->onchip_buffers)
|
||||
priv_dev->onchip_buffers = 256;
|
||||
|
||||
max_speed = usb_get_maximum_speed(dev_of_offset(cdns->dev));
|
||||
max_speed = usb_get_maximum_speed(dev_ofnode(cdns->dev));
|
||||
|
||||
/* Check the maximum_speed parameter */
|
||||
switch (max_speed) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <linux/libfdt.h>
|
||||
#include <dm.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
|
||||
@ -20,13 +20,12 @@ static const char *const usb_dr_modes[] = {
|
||||
[USB_DR_MODE_OTG] = "otg",
|
||||
};
|
||||
|
||||
enum usb_dr_mode usb_get_dr_mode(int node)
|
||||
enum usb_dr_mode usb_get_dr_mode(ofnode node)
|
||||
{
|
||||
const void *fdt = gd->fdt_blob;
|
||||
const char *dr_mode;
|
||||
int i;
|
||||
|
||||
dr_mode = fdt_getprop(fdt, node, "dr_mode", NULL);
|
||||
dr_mode = ofnode_read_string(node, "dr_mode");
|
||||
if (!dr_mode) {
|
||||
pr_err("usb dr_mode not found\n");
|
||||
return USB_DR_MODE_UNKNOWN;
|
||||
@ -48,13 +47,12 @@ static const char *const speed_names[] = {
|
||||
[USB_SPEED_SUPER] = "super-speed",
|
||||
};
|
||||
|
||||
enum usb_device_speed usb_get_maximum_speed(int node)
|
||||
enum usb_device_speed usb_get_maximum_speed(ofnode node)
|
||||
{
|
||||
const void *fdt = gd->fdt_blob;
|
||||
const char *max_speed;
|
||||
int i;
|
||||
|
||||
max_speed = fdt_getprop(fdt, node, "maximum-speed", NULL);
|
||||
max_speed = ofnode_read_string(node, "maximum-speed");
|
||||
if (!max_speed) {
|
||||
pr_err("usb maximum-speed not found\n");
|
||||
return USB_SPEED_UNKNOWN;
|
||||
|
@ -88,9 +88,9 @@ static int dwc3_generic_remove(struct udevice *dev,
|
||||
static int dwc3_generic_ofdata_to_platdata(struct udevice *dev)
|
||||
{
|
||||
struct dwc3_generic_plat *plat = dev_get_platdata(dev);
|
||||
int node = dev_of_offset(dev);
|
||||
ofnode node = dev->node;
|
||||
|
||||
plat->base = devfdt_get_addr(dev);
|
||||
plat->base = dev_read_addr(dev);
|
||||
|
||||
plat->maximum_speed = usb_get_maximum_speed(node);
|
||||
if (plat->maximum_speed == USB_SPEED_UNKNOWN) {
|
||||
@ -284,13 +284,11 @@ struct dwc3_glue_ops ti_ops = {
|
||||
|
||||
static int dwc3_glue_bind(struct udevice *parent)
|
||||
{
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node;
|
||||
ofnode node;
|
||||
int ret;
|
||||
|
||||
for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
|
||||
node = fdt_next_subnode(fdt, node)) {
|
||||
const char *name = fdt_get_name(fdt, node, NULL);
|
||||
ofnode_for_each_subnode(node, parent->node) {
|
||||
const char *name = ofnode_get_name(node);
|
||||
enum usb_dr_mode dr_mode;
|
||||
struct udevice *dev;
|
||||
const char *driver = NULL;
|
||||
@ -322,7 +320,7 @@ static int dwc3_glue_bind(struct udevice *parent)
|
||||
continue;
|
||||
|
||||
ret = device_bind_driver_to_node(parent, driver, name,
|
||||
offset_to_ofnode(node), &dev);
|
||||
node, &dev);
|
||||
if (ret) {
|
||||
debug("%s: not able to bind usb device mode\n",
|
||||
__func__);
|
||||
@ -400,7 +398,7 @@ static int dwc3_glue_probe(struct udevice *dev)
|
||||
while (child) {
|
||||
enum usb_dr_mode dr_mode;
|
||||
|
||||
dr_mode = usb_get_dr_mode(dev_of_offset(child));
|
||||
dr_mode = usb_get_dr_mode(child->node);
|
||||
device_find_next_child(&child);
|
||||
if (ops && ops->select_dr_mode)
|
||||
ops->select_dr_mode(dev, index, dr_mode);
|
||||
|
@ -393,7 +393,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->otg_mode = usb_get_dr_mode(dev_of_offset(dev));
|
||||
priv->otg_mode = usb_get_dr_mode(dev->node);
|
||||
|
||||
ret = dwc3_meson_g12a_usb_init(priv);
|
||||
if (ret)
|
||||
|
@ -1039,13 +1039,12 @@ void dwc2_phy_shutdown(struct udevice *dev, struct phy *usb_phys, int num_phys)
|
||||
static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
|
||||
{
|
||||
struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev);
|
||||
int node = dev_of_offset(dev);
|
||||
ulong drvdata;
|
||||
void (*set_params)(struct dwc2_plat_otg_data *data);
|
||||
int ret;
|
||||
|
||||
if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL &&
|
||||
usb_get_dr_mode(node) != USB_DR_MODE_OTG) {
|
||||
if (usb_get_dr_mode(dev->node) != USB_DR_MODE_PERIPHERAL &&
|
||||
usb_get_dr_mode(dev->node) != USB_DR_MODE_OTG) {
|
||||
dev_dbg(dev, "Invalid mode\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <fdtdec.h>
|
||||
#include <reset.h>
|
||||
#include <clk.h>
|
||||
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include <asm/io.h>
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <fdtdec.h>
|
||||
#include <linux/libfdt.h>
|
||||
#include <dm/lists.h>
|
||||
#include <regmap.h>
|
||||
#include <reset-uclass.h>
|
||||
@ -109,8 +107,7 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
|
||||
int ret;
|
||||
u32 reg[4];
|
||||
|
||||
ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
|
||||
"reg", reg, ARRAY_SIZE(reg));
|
||||
ret = ofnode_read_u32_array(dev->node, "reg", reg, ARRAY_SIZE(reg));
|
||||
if (ret) {
|
||||
pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
|
||||
return ret;
|
||||
@ -153,18 +150,15 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
|
||||
static int sti_dwc3_glue_bind(struct udevice *dev)
|
||||
{
|
||||
struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev);
|
||||
int dwc3_node;
|
||||
ofnode node, dwc3_node;
|
||||
|
||||
/* check if one subnode is present */
|
||||
dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
|
||||
if (dwc3_node <= 0) {
|
||||
pr_err("Can't find subnode for %s\n", dev->name);
|
||||
return -ENODEV;
|
||||
/* Find snps,dwc3 node from subnode */
|
||||
ofnode_for_each_subnode(node, dev->node) {
|
||||
if (ofnode_device_is_compatible(node, "snps,dwc3"))
|
||||
dwc3_node = node;
|
||||
}
|
||||
|
||||
/* check if the subnode compatible string is the dwc3 one*/
|
||||
if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node,
|
||||
"snps,dwc3") != 0) {
|
||||
if (!ofnode_valid(node)) {
|
||||
pr_err("Can't find dwc3 subnode for %s\n", dev->name);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <fdtdec.h>
|
||||
#include <linux/libfdt.h>
|
||||
#include <usb.h>
|
||||
#include <usb/ehci-ci.h>
|
||||
#include <usb/ulpi.h>
|
||||
@ -108,7 +106,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
|
||||
struct msm_ehci_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->ulpi_vp.port_num = 0;
|
||||
priv->ehci = (void *)devfdt_get_addr(dev);
|
||||
priv->ehci = dev_read_addr_ptr(dev);
|
||||
|
||||
if (priv->ehci == (void *)FDT_ADDR_T_NONE)
|
||||
return -EINVAL;
|
||||
|
@ -513,7 +513,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
|
||||
struct usb_platdata *plat = dev_get_platdata(dev);
|
||||
enum usb_dr_mode dr_mode;
|
||||
|
||||
dr_mode = usb_get_dr_mode(dev_of_offset(dev));
|
||||
dr_mode = usb_get_dr_mode(dev->node);
|
||||
|
||||
switch (dr_mode) {
|
||||
case USB_DR_MODE_HOST:
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <fdtdec.h>
|
||||
#include <generic-phy.h>
|
||||
#include <usb.h>
|
||||
#include <dwc3-uboot.h>
|
||||
@ -155,7 +154,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
|
||||
|
||||
writel(reg, &dwc3_reg->g_usb2phycfg[0]);
|
||||
|
||||
dr_mode = usb_get_dr_mode(dev_of_offset(dev));
|
||||
dr_mode = usb_get_dr_mode(dev->node);
|
||||
if (dr_mode == USB_DR_MODE_UNKNOWN)
|
||||
/* by default set dual role mode to HOST */
|
||||
dr_mode = USB_DR_MODE_HOST;
|
||||
|
@ -285,14 +285,12 @@ U_BOOT_DRIVER(ti_musb_peripheral) = {
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
static int ti_musb_wrapper_bind(struct udevice *parent)
|
||||
{
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node;
|
||||
ofnode node;
|
||||
int ret;
|
||||
|
||||
for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
|
||||
node = fdt_next_subnode(fdt, node)) {
|
||||
ofnode_for_each_subnode(node, parent->node) {
|
||||
struct udevice *dev;
|
||||
const char *name = fdt_get_name(fdt, node, NULL);
|
||||
const char *name = ofnode_get_name(node);
|
||||
enum usb_dr_mode dr_mode;
|
||||
struct driver *drv;
|
||||
|
||||
@ -306,7 +304,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
|
||||
ret = device_bind_driver_to_node(parent,
|
||||
"ti-musb-peripheral",
|
||||
name,
|
||||
offset_to_ofnode(node),
|
||||
node,
|
||||
&dev);
|
||||
if (ret)
|
||||
pr_err("musb - not able to bind usb peripheral node\n");
|
||||
@ -316,7 +314,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
|
||||
ret = device_bind_driver_to_node(parent,
|
||||
"ti-musb-host",
|
||||
name,
|
||||
offset_to_ofnode(node),
|
||||
node,
|
||||
&dev);
|
||||
if (ret)
|
||||
pr_err("musb - not able to bind usb host node\n");
|
||||
|
@ -24,15 +24,15 @@ config HW_WATCHDOG
|
||||
config WATCHDOG_RESET_DISABLE
|
||||
bool "Disable reset watchdog"
|
||||
help
|
||||
Disable reset watchdog, which can let WATCHDOG_RESET invalid, so
|
||||
that the watchdog will not be fed in u-boot.
|
||||
Disable reset watchdog, which can let WATCHDOG_RESET invalid, so
|
||||
that the watchdog will not be fed in u-boot.
|
||||
|
||||
config IMX_WATCHDOG
|
||||
bool "Enable Watchdog Timer support for IMX and LSCH2 of NXP"
|
||||
select HW_WATCHDOG if !WDT
|
||||
help
|
||||
Select this to enable the IMX and LSCH2 of Layerscape watchdog
|
||||
driver.
|
||||
Select this to enable the IMX and LSCH2 of Layerscape watchdog
|
||||
driver.
|
||||
|
||||
config OMAP_WATCHDOG
|
||||
bool "TI OMAP watchdog driver"
|
||||
@ -50,8 +50,8 @@ config DESIGNWARE_WATCHDOG
|
||||
bool "Designware watchdog timer support"
|
||||
select HW_WATCHDOG if !WDT
|
||||
help
|
||||
Enable this to support Designware Watchdog Timer IP, present e.g.
|
||||
on Altera SoCFPGA SoCs.
|
||||
Enable this to support Designware Watchdog Timer IP, present e.g.
|
||||
on Altera SoCFPGA SoCs.
|
||||
|
||||
config WDT
|
||||
bool "Enable driver model for watchdog timer drivers"
|
||||
@ -68,10 +68,10 @@ config WDT_ARMADA_37XX
|
||||
bool "Marvell Armada 37xx watchdog timer support"
|
||||
depends on WDT && ARMADA_3700
|
||||
help
|
||||
Enable this to support Watchdog Timer on Marvell Armada 37xx SoC.
|
||||
There are 4 possible clocks which can be used on these SoCs. This
|
||||
driver uses the second clock (ID 1), assuming that so will also
|
||||
Linux's driver.
|
||||
Enable this to support Watchdog Timer on Marvell Armada 37xx SoC.
|
||||
There are 4 possible clocks which can be used on these SoCs. This
|
||||
driver uses the second clock (ID 1), assuming that so will also
|
||||
Linux's driver.
|
||||
|
||||
config WDT_ASPEED
|
||||
bool "Aspeed ast2400/ast2500 watchdog timer support"
|
||||
@ -88,8 +88,8 @@ config WDT_AT91
|
||||
bool "AT91 watchdog timer support"
|
||||
depends on WDT
|
||||
help
|
||||
Select this to enable Microchip watchdog timer, which can be found on
|
||||
some AT91 devices.
|
||||
Select this to enable Microchip watchdog timer, which can be found on
|
||||
some AT91 devices.
|
||||
|
||||
config WDT_BCM6345
|
||||
bool "BCM6345 watchdog timer support"
|
||||
@ -105,8 +105,8 @@ config WDT_CDNS
|
||||
depends on WDT
|
||||
imply WATCHDOG
|
||||
help
|
||||
Select this to enable Cadence watchdog timer, which can be found on some
|
||||
Xilinx Microzed Platform.
|
||||
Select this to enable Cadence watchdog timer, which can be found on some
|
||||
Xilinx Microzed Platform.
|
||||
|
||||
config WDT_CORTINA
|
||||
bool "Cortina Access CAxxxx watchdog timer support"
|
||||
@ -114,21 +114,21 @@ config WDT_CORTINA
|
||||
help
|
||||
Cortina Access CAxxxx watchdog timer support.
|
||||
This driver support all CPU ISAs supported by Cortina
|
||||
Access CAxxxx SoCs.
|
||||
Access CAxxxx SoCs.
|
||||
|
||||
config WDT_MPC8xx
|
||||
bool "MPC8xx watchdog timer support"
|
||||
depends on WDT && MPC8xx
|
||||
select HW_WATCHDOG
|
||||
help
|
||||
Select this to enable mpc8xx watchdog timer
|
||||
Select this to enable mpc8xx watchdog timer
|
||||
|
||||
config WDT_MT7621
|
||||
bool "MediaTek MT7621 watchdog timer support"
|
||||
depends on WDT && SOC_MT7628
|
||||
help
|
||||
Select this to enable Ralink / Mediatek watchdog timer,
|
||||
which can be found on some MediaTek chips.
|
||||
Select this to enable Ralink / Mediatek watchdog timer,
|
||||
which can be found on some MediaTek chips.
|
||||
|
||||
config WDT_MTK
|
||||
bool "MediaTek watchdog timer support"
|
||||
@ -139,10 +139,10 @@ config WDT_MTK
|
||||
It performs full SoC reset.
|
||||
|
||||
config WDT_OMAP3
|
||||
bool "TI OMAP watchdog timer support"
|
||||
depends on WDT && ARCH_OMAP2PLUS
|
||||
default y if AM33XX
|
||||
help
|
||||
bool "TI OMAP watchdog timer support"
|
||||
depends on WDT && ARCH_OMAP2PLUS
|
||||
default y if AM33XX
|
||||
help
|
||||
This enables OMAP3+ watchdog timer driver, which can be
|
||||
found on some TI chipsets and inline with driver model.
|
||||
|
||||
@ -151,8 +151,8 @@ config WDT_ORION
|
||||
depends on WDT
|
||||
select CLK
|
||||
help
|
||||
Select this to enable Orion watchdog timer, which can be found on some
|
||||
Marvell Armada chips.
|
||||
Select this to enable Orion watchdog timer, which can be found on some
|
||||
Marvell Armada chips.
|
||||
|
||||
config WDT_SANDBOX
|
||||
bool "Enable Watchdog Timer support for Sandbox"
|
||||
@ -166,8 +166,8 @@ config WDT_SP805
|
||||
bool "SP805 watchdog timer support"
|
||||
depends on WDT
|
||||
help
|
||||
Select this to enable SP805 watchdog timer, which can be found on some
|
||||
nxp layerscape chips.
|
||||
Select this to enable SP805 watchdog timer, which can be found on some
|
||||
nxp layerscape chips.
|
||||
|
||||
config WDT_STM32MP
|
||||
bool "IWDG watchdog driver for STM32 MP's family"
|
||||
@ -182,8 +182,8 @@ config XILINX_TB_WATCHDOG
|
||||
depends on WDT
|
||||
imply WATCHDOG
|
||||
help
|
||||
Select this to enable Xilinx Axi watchdog timer, which can be found on some
|
||||
Xilinx Microblaze Platforms.
|
||||
Select this to enable Xilinx Axi watchdog timer, which can be found on some
|
||||
Xilinx Microblaze Platforms.
|
||||
|
||||
config WDT_TANGIER
|
||||
bool "Intel Tangier watchdog timer support"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <hang.h>
|
||||
#include <time.h>
|
||||
#include <wdt.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include <dm/lists.h>
|
||||
@ -83,7 +84,7 @@ void watchdog_reset(void)
|
||||
|
||||
/* Do not reset the watchdog too often */
|
||||
now = get_timer(0);
|
||||
if (now > next_reset) {
|
||||
if (time_after(now, next_reset)) {
|
||||
next_reset = now + 1000; /* reset every 1000ms */
|
||||
wdt_reset(gd->watchdog_dev);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ int ext_cache_read(struct ext_block_cache *cache, lbaint_t block, int size)
|
||||
if (cache->buf && cache->block == block && cache->size == size)
|
||||
return 1;
|
||||
ext_cache_fini(cache);
|
||||
cache->buf = malloc(size);
|
||||
cache->buf = memalign(ARCH_DMA_MINALIGN, size);
|
||||
if (!cache->buf)
|
||||
return 0;
|
||||
if (!ext4fs_devread(block, 0, size, cache->buf)) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define __CONFIG_H
|
||||
|
||||
#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
"stdin=serial,cros-ec-keyb\0" \
|
||||
"stdin=serial,usbkbd\0" \
|
||||
"stdout=serial,vidconsole\0" \
|
||||
"stderr=serial,vidconsole\0"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define __ROC_PC_RK3399_H
|
||||
|
||||
#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
"stdin=serial,cros-ec-keyb\0" \
|
||||
"stdin=serial,usbkbd\0" \
|
||||
"stdout=serial,vidconsole\0" \
|
||||
"stderr=serial,vidconsole\0"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define __CONFIG_H
|
||||
|
||||
#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
"stdin=serial,cros-ec-keyb\0" \
|
||||
"stdin=serial,usbkbd\0" \
|
||||
"stdout=serial,vidconsole\0" \
|
||||
"stderr=serial,vidconsole\0"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define __CONFIG_H
|
||||
|
||||
#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
"stdin=serial,cros-ec-keyb\0" \
|
||||
"stdin=serial,usbkbd\0" \
|
||||
"stdout=serial,vidconsole\0" \
|
||||
"stderr=serial,vidconsole\0"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define __CONFIG_H
|
||||
|
||||
#define ROCKCHIP_DEVICE_SETTINGS \
|
||||
"stdin=serial,cros-ec-keyb\0" \
|
||||
"stdin=serial,usbkbd\0" \
|
||||
"stdout=serial,vidconsole\0" \
|
||||
"stderr=serial,vidconsole\0"
|
||||
|
||||
|
@ -57,6 +57,16 @@ typedef u16 efi_form_id_t;
|
||||
|
||||
struct efi_event;
|
||||
|
||||
/* OsIndicationsSupported flags */
|
||||
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
|
||||
#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
|
||||
#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
|
||||
#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
|
||||
#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
|
||||
#define EFI_OS_INDICATIONS_START_OS_RECOVERY 0x0000000000000020
|
||||
#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
|
||||
#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080
|
||||
|
||||
/* EFI Boot Services table */
|
||||
#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
|
||||
struct efi_boot_services {
|
||||
@ -207,11 +217,11 @@ enum efi_reset_type {
|
||||
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
|
||||
|
||||
struct efi_capsule_header {
|
||||
efi_guid_t *capsule_guid;
|
||||
efi_guid_t capsule_guid;
|
||||
u32 header_size;
|
||||
u32 flags;
|
||||
u32 capsule_image_size;
|
||||
};
|
||||
} __packed;
|
||||
|
||||
#define EFI_RT_SUPPORTED_GET_TIME 0x0001
|
||||
#define EFI_RT_SUPPORTED_SET_TIME 0x0002
|
||||
@ -262,7 +272,7 @@ struct efi_runtime_services {
|
||||
efi_uintn_t *data_size, void *data);
|
||||
efi_status_t (EFIAPI *get_next_variable_name)(
|
||||
efi_uintn_t *variable_name_size,
|
||||
u16 *variable_name, const efi_guid_t *vendor);
|
||||
u16 *variable_name, efi_guid_t *vendor);
|
||||
efi_status_t (EFIAPI *set_variable)(u16 *variable_name,
|
||||
const efi_guid_t *vendor,
|
||||
u32 attributes,
|
||||
@ -1645,4 +1655,31 @@ struct efi_load_file_protocol {
|
||||
#define LOAD_OPTION_CATEGORY_BOOT 0x00000000
|
||||
#define LOAD_OPTION_CATEGORY_APP 0x00000100
|
||||
|
||||
/*
|
||||
* System Resource Table
|
||||
*/
|
||||
/* Firmware Type Definitions */
|
||||
#define ESRT_FW_TYPE_UNKNOWN 0x00000000
|
||||
#define ESRT_FW_TYPE_SYSTEMFIRMWARE 0x00000001
|
||||
#define ESRT_FW_TYPE_DEVICEFIRMWARE 0x00000002
|
||||
#define ESRT_FW_TYPE_UEFIDRIVER 0x00000003
|
||||
|
||||
/* Last Attempt Status Values */
|
||||
#define LAST_ATTEMPT_STATUS_SUCCESS 0x00000000
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL 0x00000001
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES 0x00000002
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION 0x00000003
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT 0x00000004
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR 0x00000005
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC 0x00000006
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT 0x00000007
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_UNSATISFIED_DEPENDENCIES 0x00000008
|
||||
|
||||
/*
|
||||
* The LastAttemptStatus values of 0x1000 - 0x4000 are reserved for vendor
|
||||
* usage.
|
||||
*/
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MIN 0x00001000
|
||||
#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX 0x00004000
|
||||
|
||||
#endif
|
||||
|
@ -457,6 +457,20 @@ efi_status_t efi_remove_all_protocols(const efi_handle_t handle);
|
||||
/* Install multiple protocol interfaces */
|
||||
efi_status_t EFIAPI efi_install_multiple_protocol_interfaces
|
||||
(efi_handle_t *handle, ...);
|
||||
/* Get handles that support a given protocol */
|
||||
efi_status_t EFIAPI efi_locate_handle_buffer(
|
||||
enum efi_locate_search_type search_type,
|
||||
const efi_guid_t *protocol, void *search_key,
|
||||
efi_uintn_t *no_handles, efi_handle_t **buffer);
|
||||
/* Close an previously opened protocol interface */
|
||||
efi_status_t EFIAPI efi_close_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
efi_handle_t agent_handle,
|
||||
efi_handle_t controller_handle);
|
||||
/* Open a protocol interface */
|
||||
efi_status_t EFIAPI efi_handle_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
void **protocol_interface);
|
||||
/* Call this to create an event */
|
||||
efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
|
||||
void (EFIAPI *notify_function) (
|
||||
@ -631,7 +645,7 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
|
||||
efi_uintn_t *data_size, void *data);
|
||||
efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
|
||||
u16 *variable_name,
|
||||
const efi_guid_t *vendor);
|
||||
efi_guid_t *vendor);
|
||||
efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
|
||||
const efi_guid_t *vendor, u32 attributes,
|
||||
efi_uintn_t data_size, const void *data);
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef __LINUX_USB_OTG_H
|
||||
#define __LINUX_USB_OTG_H
|
||||
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
enum usb_dr_mode {
|
||||
USB_DR_MODE_UNKNOWN,
|
||||
USB_DR_MODE_HOST,
|
||||
@ -18,20 +20,20 @@ enum usb_dr_mode {
|
||||
|
||||
/**
|
||||
* usb_get_dr_mode() - Get dual role mode for given device
|
||||
* @node: Node offset to the given device
|
||||
* @node: ofnode of the given device
|
||||
*
|
||||
* The function gets phy interface string from property 'dr_mode',
|
||||
* and returns the correspondig enum usb_dr_mode
|
||||
*/
|
||||
enum usb_dr_mode usb_get_dr_mode(int node);
|
||||
enum usb_dr_mode usb_get_dr_mode(ofnode node);
|
||||
|
||||
/**
|
||||
* usb_get_maximum_speed() - Get maximum speed for given device
|
||||
* @node: Node offset to the given device
|
||||
* @node: ofnode of the given device
|
||||
*
|
||||
* The function gets phy interface string from property 'maximum-speed',
|
||||
* and returns the correspondig enum usb_device_speed
|
||||
*/
|
||||
enum usb_device_speed usb_get_maximum_speed(int node);
|
||||
enum usb_device_speed usb_get_maximum_speed(ofnode node);
|
||||
|
||||
#endif /* __LINUX_USB_OTG_H */
|
||||
|
@ -130,11 +130,10 @@ static inline int initr_watchdog(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL)) {
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
|
||||
timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
|
||||
WATCHDOG_TIMEOUT_SECS);
|
||||
}
|
||||
|
||||
wdt_start(gd->watchdog_dev, timeout * 1000, 0);
|
||||
gd->flags |= GD_FLG_WDT_READY;
|
||||
printf("WDT: Started with%s servicing (%ds timeout)\n",
|
||||
|
@ -208,7 +208,7 @@ static void efi_process_event_queue(void)
|
||||
*/
|
||||
static void efi_queue_event(struct efi_event *event)
|
||||
{
|
||||
struct efi_event *item = NULL;
|
||||
struct efi_event *item;
|
||||
|
||||
if (!event->notify_function)
|
||||
return;
|
||||
@ -2106,10 +2106,10 @@ static efi_status_t EFIAPI efi_set_watchdog_timer(unsigned long timeout,
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t EFIAPI efi_close_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
efi_handle_t agent_handle,
|
||||
efi_handle_t controller_handle)
|
||||
efi_status_t EFIAPI efi_close_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
efi_handle_t agent_handle,
|
||||
efi_handle_t controller_handle)
|
||||
{
|
||||
struct efi_handler *handler;
|
||||
struct efi_open_protocol_info_item *item;
|
||||
@ -2282,7 +2282,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle(
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t EFIAPI efi_locate_handle_buffer(
|
||||
efi_status_t EFIAPI efi_locate_handle_buffer(
|
||||
enum efi_locate_search_type search_type,
|
||||
const efi_guid_t *protocol, void *search_key,
|
||||
efi_uintn_t *no_handles, efi_handle_t **buffer)
|
||||
@ -3182,9 +3182,9 @@ out:
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t EFIAPI efi_handle_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
void **protocol_interface)
|
||||
efi_status_t EFIAPI efi_handle_protocol(efi_handle_t handle,
|
||||
const efi_guid_t *protocol,
|
||||
void **protocol_interface)
|
||||
{
|
||||
return efi_open_protocol(handle, protocol, protocol_interface, efi_root,
|
||||
NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
|
||||
|
@ -222,15 +222,17 @@ static const struct efi_block_io block_io_disk_template = {
|
||||
.flush_blocks = &efi_disk_flush_blocks,
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the simple file system protocol for a file device path.
|
||||
/**
|
||||
* efi_fs_from_path() - retrieve simple file system protocol
|
||||
*
|
||||
* Gets the simple file system protocol for a file device path.
|
||||
*
|
||||
* The full path provided is split into device part and into a file
|
||||
* part. The device part is used to find the handle on which the
|
||||
* simple file system protocol is installed.
|
||||
*
|
||||
* @full_path device path including device and file
|
||||
* @return simple file system protocol
|
||||
* @full_path: device path including device and file
|
||||
* Return: simple file system protocol
|
||||
*/
|
||||
struct efi_simple_file_system_protocol *
|
||||
efi_fs_from_path(struct efi_device_path *full_path)
|
||||
@ -285,15 +287,15 @@ static int efi_fs_exists(struct blk_desc *desc, int part)
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a handle for a partition or disk
|
||||
* efi_disk_add_dev() - create a handle for a partition or disk
|
||||
*
|
||||
* @parent parent handle
|
||||
* @dp_parent parent device path
|
||||
* @if_typename interface name for block device
|
||||
* @desc internal block device
|
||||
* @dev_index device index for block device
|
||||
* @offset offset into disk for simple partitions
|
||||
* @return disk object
|
||||
* @parent: parent handle
|
||||
* @dp_parent: parent device path
|
||||
* @if_typename: interface name for block device
|
||||
* @desc: internal block device
|
||||
* @dev_index: device index for block device
|
||||
* @offset: offset into disk for simple partitions
|
||||
* Return: disk object
|
||||
*/
|
||||
static efi_status_t efi_disk_add_dev(
|
||||
efi_handle_t parent,
|
||||
@ -365,7 +367,7 @@ static efi_status_t efi_disk_add_dev(
|
||||
diskobj->media.block_size = desc->blksz;
|
||||
diskobj->media.io_align = desc->blksz;
|
||||
diskobj->media.last_block = desc->lba - offset;
|
||||
if (part != 0)
|
||||
if (part)
|
||||
diskobj->media.logical_partition = 1;
|
||||
diskobj->ops.media = &diskobj->media;
|
||||
if (disk)
|
||||
@ -373,15 +375,17 @@ static efi_status_t efi_disk_add_dev(
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create handles and protocols for the partitions of a block device
|
||||
/**
|
||||
* efi_disk_create_partitions() - create handles and protocols for partitions
|
||||
*
|
||||
* @parent handle of the parent disk
|
||||
* @blk_desc block device
|
||||
* @if_typename interface type
|
||||
* @diskid device number
|
||||
* @pdevname device name
|
||||
* @return number of partitions created
|
||||
* Create handles and protocols for the partitions of a block device.
|
||||
*
|
||||
* @parent: handle of the parent disk
|
||||
* @blk_desc: block device
|
||||
* @if_typename: interface type
|
||||
* @diskid: device number
|
||||
* @pdevname: device name
|
||||
* Return: number of partitions created
|
||||
*/
|
||||
int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
||||
const char *if_typename, int diskid,
|
||||
@ -418,16 +422,20 @@ int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
||||
return disks;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* efi_disk_register() - register block devices
|
||||
*
|
||||
* U-Boot doesn't have a list of all online disk devices. So when running our
|
||||
* EFI payload, we scan through all of the potentially available ones and
|
||||
* store them in our object pool.
|
||||
*
|
||||
* This function is called in efi_init_obj_list().
|
||||
*
|
||||
* TODO(sjg@chromium.org): Actually with CONFIG_BLK, U-Boot does have this.
|
||||
* Consider converting the code to look up devices as needed. The EFI device
|
||||
* could be a child of the UCLASS_BLK block device, perhaps.
|
||||
*
|
||||
* This gets called from do_bootefi_exec().
|
||||
* Return: status code
|
||||
*/
|
||||
efi_status_t efi_disk_register(void)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ void *memmove(void *dest, const void *src, size_t n)
|
||||
u8 *d = dest;
|
||||
const u8 *s = src;
|
||||
|
||||
if (d >= s) {
|
||||
if (d <= s) {
|
||||
for (; n; --n)
|
||||
*d++ = *s++;
|
||||
} else {
|
||||
|
@ -627,18 +627,18 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
||||
|
||||
*memory_map_size = map_size;
|
||||
|
||||
if (provided_map_size < map_size)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
|
||||
if (!memory_map)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
if (descriptor_size)
|
||||
*descriptor_size = sizeof(struct efi_mem_desc);
|
||||
|
||||
if (descriptor_version)
|
||||
*descriptor_version = EFI_MEMORY_DESCRIPTOR_VERSION;
|
||||
|
||||
if (provided_map_size < map_size)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
|
||||
if (!memory_map)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
/* Copy list into array */
|
||||
/* Return the list in ascending order */
|
||||
memory_map = &memory_map[map_entries - 1];
|
||||
|
@ -483,7 +483,7 @@ static __efi_runtime efi_status_t EFIAPI efi_convert_pointer_runtime(
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_convert_pointer_runtime() - convert from physical to virtual pointer
|
||||
* efi_convert_pointer() - convert from physical to virtual pointer
|
||||
*
|
||||
* This function implements the ConvertPointer() runtime service until
|
||||
* the first call to SetVirtualAddressMap().
|
||||
@ -493,7 +493,7 @@ static __efi_runtime efi_status_t EFIAPI efi_convert_pointer_runtime(
|
||||
*
|
||||
* @debug_disposition: indicates if pointer may be converted to NULL
|
||||
* @address: pointer to be converted
|
||||
* Return: status code EFI_UNSUPPORTED
|
||||
* Return: status code
|
||||
*/
|
||||
static __efi_runtime efi_status_t EFIAPI efi_convert_pointer(
|
||||
efi_uintn_t debug_disposition, void **address)
|
||||
|
@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* EFI utils
|
||||
* UEFI runtime variable services
|
||||
*
|
||||
* Copyright (c) 2017 Rob Clark
|
||||
* Copyright (c) 2017 Rob Clark
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@ -273,7 +273,8 @@ static efi_status_t parse_uboot_variable(char *variable,
|
||||
u32 *attributes)
|
||||
{
|
||||
char *guid, *name, *end, c;
|
||||
unsigned long name_len;
|
||||
size_t name_len;
|
||||
efi_uintn_t old_variable_name_size;
|
||||
u16 *p;
|
||||
|
||||
guid = strchr(variable, '_');
|
||||
@ -289,17 +290,17 @@ static efi_status_t parse_uboot_variable(char *variable,
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
name_len = end - name;
|
||||
if (*variable_name_size < (name_len + 1)) {
|
||||
*variable_name_size = name_len + 1;
|
||||
old_variable_name_size = *variable_name_size;
|
||||
*variable_name_size = sizeof(u16) * (name_len + 1);
|
||||
if (old_variable_name_size < *variable_name_size)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
end++; /* point to value */
|
||||
|
||||
/* variable name */
|
||||
p = variable_name;
|
||||
utf8_utf16_strncpy(&p, name, name_len);
|
||||
variable_name[name_len] = 0;
|
||||
*variable_name_size = name_len + 1;
|
||||
|
||||
/* guid */
|
||||
c = *(name - 1);
|
||||
@ -329,7 +330,7 @@ static efi_status_t parse_uboot_variable(char *variable,
|
||||
*/
|
||||
efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
|
||||
u16 *variable_name,
|
||||
const efi_guid_t *vendor)
|
||||
efi_guid_t *vendor)
|
||||
{
|
||||
char *native_name, *variable;
|
||||
ssize_t name_len, list_len;
|
||||
@ -597,7 +598,7 @@ efi_get_variable_runtime(u16 *variable_name, const efi_guid_t *vendor,
|
||||
*/
|
||||
static efi_status_t __efi_runtime EFIAPI
|
||||
efi_get_next_variable_name_runtime(efi_uintn_t *variable_name_size,
|
||||
u16 *variable_name, const efi_guid_t *vendor)
|
||||
u16 *variable_name, efi_guid_t *vendor)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ efi_selftest_exitbootservices.o \
|
||||
efi_selftest_gop.o \
|
||||
efi_selftest_loaded_image.o \
|
||||
efi_selftest_manageprotocols.o \
|
||||
efi_selftest_mem.o \
|
||||
efi_selftest_memory.o \
|
||||
efi_selftest_open_protocol.o \
|
||||
efi_selftest_register_notify.o \
|
||||
|
77
lib/efi_selftest/efi_selftest_mem.c
Normal file
77
lib/efi_selftest/efi_selftest_mem.c
Normal file
@ -0,0 +1,77 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* efi_selftest_memory
|
||||
*
|
||||
* Copyright (c) 2018 Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
*
|
||||
* This unit test checks the following boottime services:
|
||||
* CopyMem, SetMem, CalculateCrc32
|
||||
*
|
||||
* The memory type used for the device tree is checked.
|
||||
*/
|
||||
|
||||
#include <efi_selftest.h>
|
||||
|
||||
static struct efi_boot_services *boottime;
|
||||
|
||||
/**
|
||||
* setup() - setup unit test
|
||||
*
|
||||
* @handle: handle of the loaded image
|
||||
* @systable: system table
|
||||
* Return: EFI_ST_SUCCESS for success
|
||||
*/
|
||||
static int setup(const efi_handle_t handle,
|
||||
const struct efi_system_table *systable)
|
||||
{
|
||||
boottime = systable->boottime;
|
||||
|
||||
return EFI_ST_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* execute() - execute unit test
|
||||
*
|
||||
* Return: EFI_ST_SUCCESS for success
|
||||
*/
|
||||
static int execute(void)
|
||||
{
|
||||
u8 c1[] = "abcdefghijklmnop";
|
||||
u8 c2[] = "abcdefghijklmnop";
|
||||
u32 crc32;
|
||||
efi_status_t ret;
|
||||
|
||||
ret = boottime->calculate_crc32(c1, 16, &crc32);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("CalculateCrc32 failed\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
if (crc32 != 0x943ac093) {
|
||||
efi_st_error("CalculateCrc32 returned wrong value\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
boottime->copy_mem(&c1[5], &c1[3], 8);
|
||||
if (memcmp(c1, "abcdedefghijknop", 16)) {
|
||||
efi_st_error("CopyMem forward copy failed: %s\n", c1);
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
boottime->copy_mem(&c2[3], &c2[5], 8);
|
||||
if (memcmp(c2, "abcfghijklmlmnop", 16)) {
|
||||
efi_st_error("CopyMem backward copy failed: %s\n", c2);
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
boottime->set_mem(&c1[3], 8, 'x');
|
||||
if (memcmp(c1, "abcxxxxxxxxjknop", 16)) {
|
||||
efi_st_error("SetMem failed: %s\n", c1);
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
|
||||
return EFI_ST_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_UNIT_TEST(mem) = {
|
||||
.name = "mem",
|
||||
.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
|
||||
.setup = setup,
|
||||
.execute = execute,
|
||||
};
|
@ -11,7 +11,7 @@
|
||||
#include <efi_selftest.h>
|
||||
|
||||
#define EFI_ST_MAX_DATA_SIZE 16
|
||||
#define EFI_ST_MAX_VARNAME_SIZE 40
|
||||
#define EFI_ST_MAX_VARNAME_SIZE 80
|
||||
|
||||
static struct efi_boot_services *boottime;
|
||||
static struct efi_runtime_services *runtime;
|
||||
@ -155,8 +155,14 @@ static int execute(void)
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
if (!memcmp(&guid, &guid_vendor0, sizeof(efi_guid_t)) &&
|
||||
!efi_st_strcmp_16_8(varname, "efi_st_var0"))
|
||||
!efi_st_strcmp_16_8(varname, "efi_st_var0")) {
|
||||
flag |= 1;
|
||||
if (len != 24) {
|
||||
efi_st_error("GetNextVariableName report wrong length %u, expected 24\n",
|
||||
(unsigned int)len);
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
}
|
||||
if (!memcmp(&guid, &guid_vendor1, sizeof(efi_guid_t)) &&
|
||||
!efi_st_strcmp_16_8(varname, "efi_st_var1"))
|
||||
flag |= 2;
|
||||
|
@ -451,7 +451,7 @@ static int compress_using_none(struct unit_test_state *uts,
|
||||
}
|
||||
|
||||
/**
|
||||
* run_bootm_test() - Run tests on the bootm decopmression function
|
||||
* run_bootm_test() - Run tests on the bootm decompression function
|
||||
*
|
||||
* @comp_type: Compression type to test
|
||||
* @compress: Our function to compress data
|
||||
|
37
test/py/tests/test_gpio.py
Normal file
37
test/py/tests/test_gpio.py
Normal file
@ -0,0 +1,37 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.mark.boardspec('sandbox')
|
||||
@pytest.mark.buildconfigspec('cmd_gpio')
|
||||
def test_gpio_input(u_boot_console):
|
||||
"""Test that gpio input correctly returns the value of a gpio pin."""
|
||||
|
||||
response = u_boot_console.run_command('gpio input 0; echo rc:$?')
|
||||
expected_response = 'rc:0'
|
||||
assert(expected_response in response)
|
||||
response = u_boot_console.run_command('gpio toggle 0; gpio input 0; echo rc:$?')
|
||||
expected_response = 'rc:1'
|
||||
assert(expected_response in response)
|
||||
|
||||
@pytest.mark.boardspec('sandbox')
|
||||
@pytest.mark.buildconfigspec('cmd_gpio')
|
||||
def test_gpio_exit_statuses(u_boot_console):
|
||||
"""Test that non-input gpio commands correctly return the command
|
||||
success/failure status."""
|
||||
|
||||
expected_response = 'rc:0'
|
||||
response = u_boot_console.run_command('gpio clear 0; echo rc:$?')
|
||||
assert(expected_response in response)
|
||||
response = u_boot_console.run_command('gpio set 0; echo rc:$?')
|
||||
assert(expected_response in response)
|
||||
response = u_boot_console.run_command('gpio toggle 0; echo rc:$?')
|
||||
assert(expected_response in response)
|
||||
response = u_boot_console.run_command('gpio status -a; echo rc:$?')
|
||||
assert(expected_response in response)
|
||||
|
||||
expected_response = 'rc:1'
|
||||
response = u_boot_console.run_command('gpio nonexistent-command; echo rc:$?')
|
||||
assert(expected_response in response)
|
||||
response = u_boot_console.run_command('gpio input 200; echo rc:$?')
|
||||
assert(expected_response in response)
|
@ -56,7 +56,7 @@ env__mmc_dev_configs = (
|
||||
'info_mode': ???,
|
||||
'info_buswidth': ???.
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
# Configuration data for test_mmc_rd; defines regions of the MMC (entire
|
||||
# devices, or ranges of sectors) which can be read:
|
||||
@ -210,7 +210,7 @@ def test_mmc_info(u_boot_console, env__mmc_dev_config):
|
||||
assert good_response in response
|
||||
good_response = "Bus Speed: %s" % info_speed
|
||||
assert good_response in response
|
||||
good_response = "Mode : %s" % info_mode
|
||||
good_response = "Mode: %s" % info_mode
|
||||
assert good_response in response
|
||||
good_response = "Bus Width: %s" % info_buswidth
|
||||
assert good_response in response
|
||||
|
@ -307,11 +307,13 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0,
|
||||
rkcommon_offset_to_spi(hdr1_offset));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(spl_infos); i++) {
|
||||
if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr, 4)) {
|
||||
if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr,
|
||||
RK_SPL_HDR_SIZE)) {
|
||||
if (spl_info)
|
||||
*spl_info = &spl_infos[i];
|
||||
return IH_TYPE_RKSD;
|
||||
} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr, 4)) {
|
||||
} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr,
|
||||
RK_SPL_HDR_SIZE)) {
|
||||
if (spl_info)
|
||||
*spl_info = &spl_infos[i];
|
||||
return IH_TYPE_RKSPI;
|
||||
|
Loading…
Reference in New Issue
Block a user