mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
Merge branch '2019-08-07-master-imports'
- Misc Android / AVB bugfixes (including updating the header from Android). - MediaTek updates - Other assorted bugfixes.
This commit is contained in:
commit
db857dcbbf
18 changed files with 274 additions and 86 deletions
|
@ -196,6 +196,7 @@ F: arch/arm/include/asm/arch-pxa/
|
||||||
ARM MEDIATEK
|
ARM MEDIATEK
|
||||||
M: Ryder Lee <ryder.lee@mediatek.com>
|
M: Ryder Lee <ryder.lee@mediatek.com>
|
||||||
M: Weijie Gao <weijie.gao@mediatek.com>
|
M: Weijie Gao <weijie.gao@mediatek.com>
|
||||||
|
R: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: arch/arm/mach-mediatek/
|
F: arch/arm/mach-mediatek/
|
||||||
F: arch/arm/include/asm/arch-mediatek/
|
F: arch/arm/include/asm/arch-mediatek/
|
||||||
|
|
|
@ -248,6 +248,13 @@
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hifsys: syscon@1a000000 {
|
||||||
|
compatible = "mediatek,mt7623-hifsys", "syscon";
|
||||||
|
reg = <0x1a000000 0x1000>;
|
||||||
|
#clock-cells = <1>;
|
||||||
|
#reset-cells = <1>;
|
||||||
|
};
|
||||||
|
|
||||||
ethsys: syscon@1b000000 {
|
ethsys: syscon@1b000000 {
|
||||||
compatible = "mediatek,mt7623-ethsys", "syscon";
|
compatible = "mediatek,mt7623-ethsys", "syscon";
|
||||||
reg = <0x1b000000 0x1000>;
|
reg = <0x1b000000 0x1000>;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
compatible = "mediatek,mt7629-rfb", "mediatek,mt7629";
|
compatible = "mediatek,mt7629-rfb", "mediatek,mt7629";
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
spi0 = &qspi;
|
spi0 = &snfi;
|
||||||
};
|
};
|
||||||
|
|
||||||
chosen {
|
chosen {
|
||||||
|
@ -33,7 +33,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
&pinctrl {
|
&pinctrl {
|
||||||
qspi_pins: qspi-pins {
|
snfi_pins: snfi-pins {
|
||||||
|
mux {
|
||||||
|
function = "flash";
|
||||||
|
groups = "snfi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
snor_pins: snor-pins {
|
||||||
mux {
|
mux {
|
||||||
function = "flash";
|
function = "flash";
|
||||||
groups = "spi_nor";
|
groups = "spi_nor";
|
||||||
|
@ -55,9 +62,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&qspi {
|
&snfi {
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default", "snfi";
|
||||||
pinctrl-0 = <&qspi_pins>;
|
pinctrl-0 = <&snor_pins>;
|
||||||
|
pinctrl-1 = <&snfi_pins>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
|
|
||||||
spi-flash@0{
|
spi-flash@0{
|
||||||
|
|
|
@ -215,10 +215,16 @@
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
qspi: qspi@11014000 {
|
snfi: snfi@1100d000 {
|
||||||
compatible = "mediatek,mt7629-qspi";
|
compatible = "mediatek,mtk-snfi-spi";
|
||||||
reg = <0x11014000 0xe0>, <0x30000000 0x10000000>;
|
reg = <0x1100d000 0x2000>;
|
||||||
reg-names = "reg_base", "mem_base";
|
clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||||
|
<&pericfg CLK_PERI_SNFI_PD>;
|
||||||
|
clock-names = "nfi_clk", "pad_clk";
|
||||||
|
assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||||
|
<&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||||
|
assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||||
|
<&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <0>;
|
#size-cells = <0>;
|
||||||
|
|
|
@ -368,7 +368,7 @@ int do_avb_read_pvalue(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||||
|
|
||||||
if (avb_ops->read_persistent_value(avb_ops, name, bytes, buffer,
|
if (avb_ops->read_persistent_value(avb_ops, name, bytes, buffer,
|
||||||
&bytes_read) == AVB_IO_RESULT_OK) {
|
&bytes_read) == AVB_IO_RESULT_OK) {
|
||||||
printf("Read %ld bytes, value = %s\n", bytes_read,
|
printf("Read %zu bytes, value = %s\n", bytes_read,
|
||||||
(char *)buffer);
|
(char *)buffer);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
|
@ -401,7 +401,7 @@ int do_avb_write_pvalue(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||||
if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1,
|
if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1,
|
||||||
(const uint8_t *)value) ==
|
(const uint8_t *)value) ==
|
||||||
AVB_IO_RESULT_OK) {
|
AVB_IO_RESULT_OK) {
|
||||||
printf("Wrote %ld bytes\n", strlen(value) + 1);
|
printf("Wrote %zu bytes\n", strlen(value) + 1);
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <fdtdec.h>
|
#include <fdtdec.h>
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
|
#include <memalign.h>
|
||||||
#include <menu.h>
|
#include <menu.h>
|
||||||
#include <post.h>
|
#include <post.h>
|
||||||
#include <u-boot/sha256.h>
|
#include <u-boot/sha256.h>
|
||||||
|
@ -71,8 +72,8 @@ static int passwd_abort_sha256(uint64_t etime)
|
||||||
{
|
{
|
||||||
const char *sha_env_str = env_get("bootstopkeysha256");
|
const char *sha_env_str = env_get("bootstopkeysha256");
|
||||||
u8 sha_env[SHA256_SUM_LEN];
|
u8 sha_env[SHA256_SUM_LEN];
|
||||||
u8 sha[SHA256_SUM_LEN];
|
u8 *sha;
|
||||||
char presskey[MAX_DELAY_STOP_STR];
|
char *presskey;
|
||||||
const char *algo_name = "sha256";
|
const char *algo_name = "sha256";
|
||||||
u_int presskey_len = 0;
|
u_int presskey_len = 0;
|
||||||
int abort = 0;
|
int abort = 0;
|
||||||
|
@ -93,6 +94,9 @@ static int passwd_abort_sha256(uint64_t etime)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
presskey = malloc_cache_aligned(MAX_DELAY_STOP_STR);
|
||||||
|
sha = malloc_cache_aligned(SHA256_SUM_LEN);
|
||||||
|
size = SHA256_SUM_LEN;
|
||||||
/*
|
/*
|
||||||
* We don't know how long the stop-string is, so we need to
|
* We don't know how long the stop-string is, so we need to
|
||||||
* generate the sha256 hash upon each input character and
|
* generate the sha256 hash upon each input character and
|
||||||
|
@ -101,8 +105,11 @@ static int passwd_abort_sha256(uint64_t etime)
|
||||||
do {
|
do {
|
||||||
if (tstc()) {
|
if (tstc()) {
|
||||||
/* Check for input string overflow */
|
/* Check for input string overflow */
|
||||||
if (presskey_len >= MAX_DELAY_STOP_STR)
|
if (presskey_len >= MAX_DELAY_STOP_STR) {
|
||||||
|
free(presskey);
|
||||||
|
free(sha);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
presskey[presskey_len++] = getc();
|
presskey[presskey_len++] = getc();
|
||||||
|
|
||||||
|
@ -116,6 +123,8 @@ static int passwd_abort_sha256(uint64_t etime)
|
||||||
}
|
}
|
||||||
} while (!abort && get_ticks() <= etime);
|
} while (!abort && get_ticks() <= etime);
|
||||||
|
|
||||||
|
free(presskey);
|
||||||
|
free(sha);
|
||||||
return abort;
|
return abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -851,6 +851,7 @@ static AvbIOResult get_size_of_partition(AvbOps *ops,
|
||||||
return AVB_IO_RESULT_OK;
|
return AVB_IO_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_OPTEE_TA_AVB
|
||||||
static AvbIOResult read_persistent_value(AvbOps *ops,
|
static AvbIOResult read_persistent_value(AvbOps *ops,
|
||||||
const char *name,
|
const char *name,
|
||||||
size_t buffer_size,
|
size_t buffer_size,
|
||||||
|
@ -968,6 +969,8 @@ free_name:
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* AVB2.0 AvbOps alloc/initialisation/free
|
* AVB2.0 AvbOps alloc/initialisation/free
|
||||||
|
|
|
@ -463,6 +463,11 @@ static void print_pre_console_buffer(int flushpoint)
|
||||||
char buf_out[CONFIG_PRE_CON_BUF_SZ + 1];
|
char buf_out[CONFIG_PRE_CON_BUF_SZ + 1];
|
||||||
char *buf_in;
|
char *buf_in;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
|
if (gd->flags & GD_FLG_SILENT)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
|
buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
|
||||||
if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ)
|
if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ)
|
||||||
in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
|
in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
|
||||||
|
@ -511,8 +516,11 @@ void putc(const char c)
|
||||||
membuff_putbyte(&gd->console_out, c);
|
membuff_putbyte(&gd->console_out, c);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SILENT_CONSOLE
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
if (gd->flags & GD_FLG_SILENT)
|
if (gd->flags & GD_FLG_SILENT) {
|
||||||
|
if (!(gd->flags & GD_FLG_DEVINIT))
|
||||||
|
pre_console_putc(c);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DISABLE_CONSOLE
|
#ifdef CONFIG_DISABLE_CONSOLE
|
||||||
|
@ -559,8 +567,11 @@ void puts(const char *s)
|
||||||
membuff_put(&gd->console_out, s, strlen(s));
|
membuff_put(&gd->console_out, s, strlen(s));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SILENT_CONSOLE
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
if (gd->flags & GD_FLG_SILENT)
|
if (gd->flags & GD_FLG_SILENT) {
|
||||||
|
if (!(gd->flags & GD_FLG_DEVINIT))
|
||||||
|
pre_console_puts(s);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DISABLE_CONSOLE
|
#ifdef CONFIG_DISABLE_CONSOLE
|
||||||
|
@ -720,14 +731,22 @@ int console_assign(int file, const char *devname)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void console_update_silent(void)
|
/* return true if the 'silent' flag is removed */
|
||||||
|
static bool console_update_silent(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SILENT_CONSOLE
|
#ifdef CONFIG_SILENT_CONSOLE
|
||||||
if (env_get("silent") != NULL)
|
if (env_get("silent")) {
|
||||||
gd->flags |= GD_FLG_SILENT;
|
gd->flags |= GD_FLG_SILENT;
|
||||||
else
|
} else {
|
||||||
|
unsigned long flags = gd->flags;
|
||||||
|
|
||||||
gd->flags &= ~GD_FLG_SILENT;
|
gd->flags &= ~GD_FLG_SILENT;
|
||||||
|
|
||||||
|
return !!(flags & GD_FLG_SILENT);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int console_announce_r(void)
|
int console_announce_r(void)
|
||||||
|
@ -792,6 +811,13 @@ int console_init_r(void)
|
||||||
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
int iomux_err = 0;
|
int iomux_err = 0;
|
||||||
#endif
|
#endif
|
||||||
|
int flushpoint;
|
||||||
|
|
||||||
|
/* update silent for env loaded from flash (initr_env) */
|
||||||
|
if (console_update_silent())
|
||||||
|
flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
|
||||||
|
else
|
||||||
|
flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
|
||||||
|
|
||||||
/* set default handlers at first */
|
/* set default handlers at first */
|
||||||
gd->jt->getc = serial_getc;
|
gd->jt->getc = serial_getc;
|
||||||
|
@ -869,7 +895,7 @@ done:
|
||||||
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
|
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
|
print_pre_console_buffer(flushpoint);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,8 +909,13 @@ int console_init_r(void)
|
||||||
struct list_head *list = stdio_get_list();
|
struct list_head *list = stdio_get_list();
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
struct stdio_dev *dev;
|
struct stdio_dev *dev;
|
||||||
|
int flushpoint;
|
||||||
|
|
||||||
console_update_silent();
|
/* update silent for env loaded from flash (initr_env) */
|
||||||
|
if (console_update_silent())
|
||||||
|
flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
|
||||||
|
else
|
||||||
|
flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
|
||||||
|
|
||||||
#ifdef CONFIG_SPLASH_SCREEN
|
#ifdef CONFIG_SPLASH_SCREEN
|
||||||
/*
|
/*
|
||||||
|
@ -947,7 +978,7 @@ int console_init_r(void)
|
||||||
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
|
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
|
print_pre_console_buffer(flushpoint);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,17 +78,18 @@ static void android_dt_print_fdt_info(const struct fdt_header *fdt)
|
||||||
{
|
{
|
||||||
u32 fdt_size;
|
u32 fdt_size;
|
||||||
int root_node_off;
|
int root_node_off;
|
||||||
const char *compatible = NULL;
|
const char *compatible;
|
||||||
|
|
||||||
fdt_size = fdt_totalsize(fdt);
|
|
||||||
root_node_off = fdt_path_offset(fdt, "/");
|
root_node_off = fdt_path_offset(fdt, "/");
|
||||||
if (root_node_off < 0) {
|
if (root_node_off < 0) {
|
||||||
printf("Error: Root node not found\n");
|
printf("Error: Root node not found\n");
|
||||||
} else {
|
return;
|
||||||
compatible = fdt_getprop(fdt, root_node_off, "compatible",
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fdt_size = fdt_totalsize(fdt);
|
||||||
|
compatible = fdt_getprop(fdt, root_node_off, "compatible",
|
||||||
|
NULL);
|
||||||
|
|
||||||
printf(" (FDT)size = %d\n", fdt_size);
|
printf(" (FDT)size = %d\n", fdt_size);
|
||||||
printf(" (FDT)compatible = %s\n",
|
printf(" (FDT)compatible = %s\n",
|
||||||
compatible ? compatible : "(unknown)");
|
compatible ? compatible : "(unknown)");
|
||||||
|
|
|
@ -1998,10 +1998,11 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||||
comp = IH_COMP_NONE;
|
comp = IH_COMP_NONE;
|
||||||
loadbuf = buf;
|
loadbuf = buf;
|
||||||
/* Kernel images get decompressed later in bootm_load_os(). */
|
/* Kernel images get decompressed later in bootm_load_os(). */
|
||||||
if (!(image_type == IH_TYPE_KERNEL ||
|
if (!fit_image_get_comp(fit, noffset, &comp) &&
|
||||||
image_type == IH_TYPE_KERNEL_NOLOAD) &&
|
comp != IH_COMP_NONE &&
|
||||||
!fit_image_get_comp(fit, noffset, &comp) &&
|
!(image_type == IH_TYPE_KERNEL ||
|
||||||
comp != IH_COMP_NONE) {
|
image_type == IH_TYPE_KERNEL_NOLOAD ||
|
||||||
|
image_type == IH_TYPE_RAMDISK)) {
|
||||||
ulong max_decomp_len = len * 20;
|
ulong max_decomp_len = len * 20;
|
||||||
if (load == data) {
|
if (load == data) {
|
||||||
loadbuf = malloc(max_decomp_len);
|
loadbuf = malloc(max_decomp_len);
|
||||||
|
@ -2021,6 +2022,10 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||||
memcpy(loadbuf, buf, len);
|
memcpy(loadbuf, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (image_type == IH_TYPE_RAMDISK && comp != IH_COMP_NONE)
|
||||||
|
puts("WARNING: 'compression' nodes for ramdisks are deprecated,"
|
||||||
|
" please fix your .its file!\n");
|
||||||
|
|
||||||
/* verify that image data is a proper FDT blob */
|
/* verify that image data is a proper FDT blob */
|
||||||
if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) {
|
if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) {
|
||||||
puts("Subimage data is not a FDT");
|
puts("Subimage data is not a FDT");
|
||||||
|
|
|
@ -691,34 +691,42 @@ static const struct mtk_gate peri_cgs[] = {
|
||||||
GATE_PERI1(CLK_PERI_FCI, CLK_TOP_MS_CARD_SEL, 11),
|
GATE_PERI1(CLK_PERI_FCI, CLK_TOP_MS_CARD_SEL, 11),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ethsys */
|
/* ethsys and hifsys */
|
||||||
static const struct mtk_gate_regs eth_cg_regs = {
|
static const struct mtk_gate_regs eth_hif_cg_regs = {
|
||||||
.sta_ofs = 0x30,
|
.sta_ofs = 0x30,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GATE_ETH(_id, _parent, _shift, _flag) { \
|
#define GATE_ETH_HIF(_id, _parent, _shift, _flag) { \
|
||||||
.id = _id, \
|
.id = _id, \
|
||||||
.parent = _parent, \
|
.parent = _parent, \
|
||||||
.regs = ð_cg_regs, \
|
.regs = ð_hif_cg_regs, \
|
||||||
.shift = _shift, \
|
.shift = _shift, \
|
||||||
.flags = CLK_GATE_NO_SETCLR_INV | (_flag), \
|
.flags = CLK_GATE_NO_SETCLR_INV | (_flag), \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GATE_ETH0(_id, _parent, _shift) \
|
#define GATE_ETH_HIF0(_id, _parent, _shift) \
|
||||||
GATE_ETH(_id, _parent, _shift, CLK_PARENT_APMIXED)
|
GATE_ETH_HIF(_id, _parent, _shift, CLK_PARENT_APMIXED)
|
||||||
|
|
||||||
#define GATE_ETH1(_id, _parent, _shift) \
|
#define GATE_ETH_HIF1(_id, _parent, _shift) \
|
||||||
GATE_ETH(_id, _parent, _shift, CLK_PARENT_TOPCKGEN)
|
GATE_ETH_HIF(_id, _parent, _shift, CLK_PARENT_TOPCKGEN)
|
||||||
|
|
||||||
static const struct mtk_gate eth_cgs[] = {
|
static const struct mtk_gate eth_cgs[] = {
|
||||||
GATE_ETH1(CLK_ETHSYS_HSDMA, CLK_TOP_ETHIF_SEL, 5),
|
GATE_ETH_HIF1(CLK_ETHSYS_HSDMA, CLK_TOP_ETHIF_SEL, 5),
|
||||||
GATE_ETH1(CLK_ETHSYS_ESW, CLK_TOP_ETHPLL_500M, 6),
|
GATE_ETH_HIF1(CLK_ETHSYS_ESW, CLK_TOP_ETHPLL_500M, 6),
|
||||||
GATE_ETH0(CLK_ETHSYS_GP2, CLK_APMIXED_TRGPLL, 7),
|
GATE_ETH_HIF0(CLK_ETHSYS_GP2, CLK_APMIXED_TRGPLL, 7),
|
||||||
GATE_ETH1(CLK_ETHSYS_GP1, CLK_TOP_ETHPLL_500M, 8),
|
GATE_ETH_HIF1(CLK_ETHSYS_GP1, CLK_TOP_ETHPLL_500M, 8),
|
||||||
GATE_ETH1(CLK_ETHSYS_PCM, CLK_TOP_ETHIF_SEL, 11),
|
GATE_ETH_HIF1(CLK_ETHSYS_PCM, CLK_TOP_ETHIF_SEL, 11),
|
||||||
GATE_ETH1(CLK_ETHSYS_GDMA, CLK_TOP_ETHIF_SEL, 14),
|
GATE_ETH_HIF1(CLK_ETHSYS_GDMA, CLK_TOP_ETHIF_SEL, 14),
|
||||||
GATE_ETH1(CLK_ETHSYS_I2S, CLK_TOP_ETHIF_SEL, 17),
|
GATE_ETH_HIF1(CLK_ETHSYS_I2S, CLK_TOP_ETHIF_SEL, 17),
|
||||||
GATE_ETH1(CLK_ETHSYS_CRYPTO, CLK_TOP_ETHIF_SEL, 29),
|
GATE_ETH_HIF1(CLK_ETHSYS_CRYPTO, CLK_TOP_ETHIF_SEL, 29),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct mtk_gate hif_cgs[] = {
|
||||||
|
GATE_ETH_HIF1(CLK_HIFSYS_USB0PHY, CLK_TOP_ETHPLL_500M, 21),
|
||||||
|
GATE_ETH_HIF1(CLK_HIFSYS_USB1PHY, CLK_TOP_ETHPLL_500M, 22),
|
||||||
|
GATE_ETH_HIF1(CLK_HIFSYS_PCIE0, CLK_TOP_ETHPLL_500M, 24),
|
||||||
|
GATE_ETH_HIF1(CLK_HIFSYS_PCIE1, CLK_TOP_ETHPLL_500M, 25),
|
||||||
|
GATE_ETH_HIF1(CLK_HIFSYS_PCIE2, CLK_TOP_ETHPLL_500M, 26),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct mtk_clk_tree mt7623_clk_tree = {
|
static const struct mtk_clk_tree mt7623_clk_tree = {
|
||||||
|
@ -778,19 +786,24 @@ static int mt7623_pericfg_probe(struct udevice *dev)
|
||||||
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, peri_cgs);
|
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, peri_cgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mt7623_hifsys_probe(struct udevice *dev)
|
||||||
|
{
|
||||||
|
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, hif_cgs);
|
||||||
|
}
|
||||||
|
|
||||||
static int mt7623_ethsys_probe(struct udevice *dev)
|
static int mt7623_ethsys_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, eth_cgs);
|
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, eth_cgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mt7623_ethsys_bind(struct udevice *dev)
|
static int mt7623_ethsys_hifsys_bind(struct udevice *dev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
||||||
ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
|
ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
debug("Warning: failed to bind ethsys reset controller\n");
|
debug("Warning: failed to bind reset controller\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -821,6 +834,11 @@ static const struct udevice_id mt7623_ethsys_compat[] = {
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct udevice_id mt7623_hifsys_compat[] = {
|
||||||
|
{ .compatible = "mediatek,mt7623-hifsys" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
static const struct udevice_id mt7623_mcucfg_compat[] = {
|
static const struct udevice_id mt7623_mcucfg_compat[] = {
|
||||||
{ .compatible = "mediatek,mt7623-mcucfg" },
|
{ .compatible = "mediatek,mt7623-mcucfg" },
|
||||||
{ }
|
{ }
|
||||||
|
@ -874,12 +892,22 @@ U_BOOT_DRIVER(mtk_clk_pericfg) = {
|
||||||
.flags = DM_FLAG_PRE_RELOC,
|
.flags = DM_FLAG_PRE_RELOC,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
U_BOOT_DRIVER(mtk_clk_hifsys) = {
|
||||||
|
.name = "mt7623-clock-hifsys",
|
||||||
|
.id = UCLASS_CLK,
|
||||||
|
.of_match = mt7623_hifsys_compat,
|
||||||
|
.probe = mt7623_hifsys_probe,
|
||||||
|
.bind = mt7623_ethsys_hifsys_bind,
|
||||||
|
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
|
||||||
|
.ops = &mtk_clk_gate_ops,
|
||||||
|
};
|
||||||
|
|
||||||
U_BOOT_DRIVER(mtk_clk_ethsys) = {
|
U_BOOT_DRIVER(mtk_clk_ethsys) = {
|
||||||
.name = "mt7623-clock-ethsys",
|
.name = "mt7623-clock-ethsys",
|
||||||
.id = UCLASS_CLK,
|
.id = UCLASS_CLK,
|
||||||
.of_match = mt7623_ethsys_compat,
|
.of_match = mt7623_ethsys_compat,
|
||||||
.probe = mt7623_ethsys_probe,
|
.probe = mt7623_ethsys_probe,
|
||||||
.bind = mt7623_ethsys_bind,
|
.bind = mt7623_ethsys_hifsys_bind,
|
||||||
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
|
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
|
||||||
.ops = &mtk_clk_gate_ops,
|
.ops = &mtk_clk_gate_ops,
|
||||||
};
|
};
|
||||||
|
|
|
@ -608,9 +608,9 @@ static int mt7629_ethsys_bind(struct udevice *dev)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
||||||
ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
|
ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
debug("Warning: failed to bind ethsys reset controller\n");
|
debug("Warning: failed to bind reset controller\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define CLK_PARENT_TOPCKGEN BIT(5)
|
#define CLK_PARENT_TOPCKGEN BIT(5)
|
||||||
#define CLK_PARENT_MASK GENMASK(5, 4)
|
#define CLK_PARENT_MASK GENMASK(5, 4)
|
||||||
|
|
||||||
#define ETHSYS_RST_CTRL_OFS 0x34
|
#define ETHSYS_HIFSYS_RST_CTRL_OFS 0x34
|
||||||
|
|
||||||
/* struct mtk_pll_data - hardware-specific PLLs data */
|
/* struct mtk_pll_data - hardware-specific PLLs data */
|
||||||
struct mtk_pll_data {
|
struct mtk_pll_data {
|
||||||
|
|
|
@ -43,7 +43,7 @@ int pci_ep_set_bar(struct udevice *dev, uint func_no, struct pci_bar *ep_bar)
|
||||||
int flags = ep_bar->flags;
|
int flags = ep_bar->flags;
|
||||||
|
|
||||||
/* Some basic bar validity checks */
|
/* Some basic bar validity checks */
|
||||||
if (ep_bar->barno > BAR_5 || ep_bar < BAR_0)
|
if (ep_bar->barno > BAR_5 || ep_bar->barno < BAR_0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if ((ep_bar->barno == BAR_5 &&
|
if ((ep_bar->barno == BAR_5 &&
|
||||||
|
|
|
@ -1,59 +1,78 @@
|
||||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||||
/*
|
/*
|
||||||
* This is from the Android Project,
|
* This is from the Android Project,
|
||||||
* Repository: https://android.googlesource.com/platform/system/core/
|
* Repository: https://android.googlesource.com/platform/system/tools/mkbootimg
|
||||||
* File: mkbootimg/bootimg.h
|
* File: include/bootimg/bootimg.h
|
||||||
* Commit: d162828814b08ada310846a33205befb69ef5799
|
* Commit: e55998a0f2b61b685d5eb4a486ca3a0c680b1a2f
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 The Android Open Source Project
|
* Copyright (C) 2007 The Android Open Source Project
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ANDROID_IMAGE_H_
|
#ifndef _ANDROID_IMAGE_H_
|
||||||
#define _ANDROID_IMAGE_H_
|
#define _ANDROID_IMAGE_H_
|
||||||
|
|
||||||
typedef struct andr_img_hdr andr_img_hdr;
|
|
||||||
|
|
||||||
#define ANDR_BOOT_MAGIC "ANDROID!"
|
#define ANDR_BOOT_MAGIC "ANDROID!"
|
||||||
#define ANDR_BOOT_MAGIC_SIZE 8
|
#define ANDR_BOOT_MAGIC_SIZE 8
|
||||||
#define ANDR_BOOT_NAME_SIZE 16
|
#define ANDR_BOOT_NAME_SIZE 16
|
||||||
#define ANDR_BOOT_ARGS_SIZE 512
|
#define ANDR_BOOT_ARGS_SIZE 512
|
||||||
#define ANDR_BOOT_EXTRA_ARGS_SIZE 1024
|
#define ANDR_BOOT_EXTRA_ARGS_SIZE 1024
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It is expected that callers would explicitly specify which version of the
|
||||||
|
* boot image header they need to use.
|
||||||
|
*/
|
||||||
|
typedef struct andr_img_hdr andr_img_hdr;
|
||||||
|
|
||||||
|
/* The bootloader expects the structure of andr_img_hdr with header
|
||||||
|
* version 0 to be as follows: */
|
||||||
struct andr_img_hdr {
|
struct andr_img_hdr {
|
||||||
char magic[ANDR_BOOT_MAGIC_SIZE];
|
/* Must be ANDR_BOOT_MAGIC. */
|
||||||
|
char magic[ANDR_BOOT_MAGIC_SIZE];
|
||||||
|
|
||||||
u32 kernel_size; /* size in bytes */
|
u32 kernel_size; /* size in bytes */
|
||||||
u32 kernel_addr; /* physical load addr */
|
u32 kernel_addr; /* physical load addr */
|
||||||
|
|
||||||
u32 ramdisk_size; /* size in bytes */
|
u32 ramdisk_size; /* size in bytes */
|
||||||
u32 ramdisk_addr; /* physical load addr */
|
u32 ramdisk_addr; /* physical load addr */
|
||||||
|
|
||||||
u32 second_size; /* size in bytes */
|
u32 second_size; /* size in bytes */
|
||||||
u32 second_addr; /* physical load addr */
|
u32 second_addr; /* physical load addr */
|
||||||
|
|
||||||
u32 tags_addr; /* physical addr for kernel tags */
|
u32 tags_addr; /* physical addr for kernel tags */
|
||||||
u32 page_size; /* flash page size we assume */
|
u32 page_size; /* flash page size we assume */
|
||||||
u32 unused; /* reserved for future expansion: MUST be 0 */
|
|
||||||
|
|
||||||
/* operating system version and security patch level; for
|
/* Version of the boot image header. */
|
||||||
* version "A.B.C" and patch level "Y-M-D":
|
u32 header_version;
|
||||||
* ver = A << 14 | B << 7 | C (7 bits for each of A, B, C)
|
|
||||||
* lvl = ((Y - 2000) & 127) << 4 | M (7 bits for Y, 4 bits for M)
|
|
||||||
* os_version = ver << 11 | lvl */
|
|
||||||
u32 os_version;
|
|
||||||
|
|
||||||
char name[ANDR_BOOT_NAME_SIZE]; /* asciiz product name */
|
/* Operating system version and security patch level.
|
||||||
|
* For version "A.B.C" and patch level "Y-M-D":
|
||||||
|
* (7 bits for each of A, B, C; 7 bits for (Y-2000), 4 bits for M)
|
||||||
|
* os_version = A[31:25] B[24:18] C[17:11] (Y-2000)[10:4] M[3:0] */
|
||||||
|
u32 os_version;
|
||||||
|
|
||||||
char cmdline[ANDR_BOOT_ARGS_SIZE];
|
char name[ANDR_BOOT_NAME_SIZE]; /* asciiz product name */
|
||||||
|
|
||||||
u32 id[8]; /* timestamp / checksum / sha1 / etc */
|
char cmdline[ANDR_BOOT_ARGS_SIZE];
|
||||||
|
|
||||||
/* Supplemental command line data; kept here to maintain
|
u32 id[8]; /* timestamp / checksum / sha1 / etc */
|
||||||
* binary compatibility with older versions of mkbootimg */
|
|
||||||
char extra_cmdline[ANDR_BOOT_EXTRA_ARGS_SIZE];
|
/* Supplemental command line data; kept here to maintain
|
||||||
|
* binary compatibility with older versions of mkbootimg. */
|
||||||
|
char extra_cmdline[ANDR_BOOT_EXTRA_ARGS_SIZE];
|
||||||
|
|
||||||
|
/* Fields in boot_img_hdr_v1 and newer. */
|
||||||
|
u32 recovery_dtbo_size; /* size in bytes for recovery DTBO/ACPIO image */
|
||||||
|
u64 recovery_dtbo_offset; /* offset to recovery dtbo/acpio in boot image */
|
||||||
|
u32 header_size;
|
||||||
|
|
||||||
|
/* Fields in boot_img_hdr_v2 and newer. */
|
||||||
|
u32 dtb_size; /* size in bytes for DTB image */
|
||||||
|
u64 dtb_addr; /* physical load address for DTB image */
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
/*
|
/* When a boot header is of version 0, the structure of boot image is as
|
||||||
|
* follows:
|
||||||
|
*
|
||||||
* +-----------------+
|
* +-----------------+
|
||||||
* | boot header | 1 page
|
* | boot header | 1 page
|
||||||
* +-----------------+
|
* +-----------------+
|
||||||
|
@ -79,4 +98,45 @@ struct andr_img_hdr {
|
||||||
* 6. if second_size != 0: jump to second_addr
|
* 6. if second_size != 0: jump to second_addr
|
||||||
* else: jump to kernel_addr
|
* else: jump to kernel_addr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* When the boot image header has a version of 2, the structure of the boot
|
||||||
|
* image is as follows:
|
||||||
|
*
|
||||||
|
* +---------------------+
|
||||||
|
* | boot header | 1 page
|
||||||
|
* +---------------------+
|
||||||
|
* | kernel | n pages
|
||||||
|
* +---------------------+
|
||||||
|
* | ramdisk | m pages
|
||||||
|
* +---------------------+
|
||||||
|
* | second stage | o pages
|
||||||
|
* +---------------------+
|
||||||
|
* | recovery dtbo/acpio | p pages
|
||||||
|
* +---------------------+
|
||||||
|
* | dtb | q pages
|
||||||
|
* +---------------------+
|
||||||
|
|
||||||
|
* n = (kernel_size + page_size - 1) / page_size
|
||||||
|
* m = (ramdisk_size + page_size - 1) / page_size
|
||||||
|
* o = (second_size + page_size - 1) / page_size
|
||||||
|
* p = (recovery_dtbo_size + page_size - 1) / page_size
|
||||||
|
* q = (dtb_size + page_size - 1) / page_size
|
||||||
|
*
|
||||||
|
* 0. all entities are page_size aligned in flash
|
||||||
|
* 1. kernel, ramdisk and DTB are required (size != 0)
|
||||||
|
* 2. recovery_dtbo/recovery_acpio is required for recovery.img in non-A/B
|
||||||
|
* devices(recovery_dtbo_size != 0)
|
||||||
|
* 3. second is optional (second_size == 0 -> no second)
|
||||||
|
* 4. load each element (kernel, ramdisk, second, dtb) at
|
||||||
|
* the specified physical address (kernel_addr, etc)
|
||||||
|
* 5. If booting to recovery mode in a non-A/B device, extract recovery
|
||||||
|
* dtbo/acpio and apply the correct set of overlays on the base device tree
|
||||||
|
* depending on the hardware/product revision.
|
||||||
|
* 6. prepare tags at tag_addr. kernel_args[] is
|
||||||
|
* appended to the kernel commandline in the tags.
|
||||||
|
* 7. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
|
||||||
|
* 8. if second_size != 0: jump to second_addr
|
||||||
|
* else: jump to kernel_addr
|
||||||
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,4 +15,13 @@
|
||||||
#define ETHSYS_MCM_RST 2
|
#define ETHSYS_MCM_RST 2
|
||||||
#define ETHSYS_SYS_RST 0
|
#define ETHSYS_SYS_RST 0
|
||||||
|
|
||||||
|
/* HIFSYS resets */
|
||||||
|
#define HIFSYS_PCIE2_RST 26
|
||||||
|
#define HIFSYS_PCIE1_RST 25
|
||||||
|
#define HIFSYS_PCIE0_RST 24
|
||||||
|
#define HIFSYS_UPHY1_RST 22
|
||||||
|
#define HIFSYS_UPHY0_RST 21
|
||||||
|
#define HIFSYS_UHOST1_RST 4
|
||||||
|
#define HIFSYS_UHOST0_RST 3
|
||||||
|
|
||||||
#endif /* _DT_BINDINGS_MTK_RESET_H_ */
|
#endif /* _DT_BINDINGS_MTK_RESET_H_ */
|
||||||
|
|
|
@ -183,6 +183,18 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
|
||||||
*/
|
*/
|
||||||
void __assert_fail(const char *assertion, const char *file, unsigned int line,
|
void __assert_fail(const char *assertion, const char *file, unsigned int line,
|
||||||
const char *function);
|
const char *function);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assert() - assert expression is true
|
||||||
|
*
|
||||||
|
* If the expression x evaluates to false and _DEBUG evaluates to true, a panic
|
||||||
|
* message is written and the system stalls. The value of _DEBUG is set to true
|
||||||
|
* if DEBUG is defined before including common.h.
|
||||||
|
*
|
||||||
|
* The expression x is always executed irrespective of the value of _DEBUG.
|
||||||
|
*
|
||||||
|
* @x: expression to test
|
||||||
|
*/
|
||||||
#define assert(x) \
|
#define assert(x) \
|
||||||
({ if (!(x) && _DEBUG) \
|
({ if (!(x) && _DEBUG) \
|
||||||
__assert_fail(#x, __FILE__, __LINE__, __func__); })
|
__assert_fail(#x, __FILE__, __LINE__, __func__); })
|
||||||
|
|
|
@ -269,6 +269,11 @@ def test_fit(u_boot_console):
|
||||||
def check_equal(expected_fname, actual_fname, failure_msg):
|
def check_equal(expected_fname, actual_fname, failure_msg):
|
||||||
"""Check that a file matches its expected contents
|
"""Check that a file matches its expected contents
|
||||||
|
|
||||||
|
This is always used on out-buffers whose size is decided by the test
|
||||||
|
script anyway, which in some cases may be larger than what we're
|
||||||
|
actually looking for. So it's safe to truncate it to the size of the
|
||||||
|
expected data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
expected_fname: Filename containing expected contents
|
expected_fname: Filename containing expected contents
|
||||||
actual_fname: Filename containing actual contents
|
actual_fname: Filename containing actual contents
|
||||||
|
@ -276,6 +281,8 @@ def test_fit(u_boot_console):
|
||||||
"""
|
"""
|
||||||
expected_data = read_file(expected_fname)
|
expected_data = read_file(expected_fname)
|
||||||
actual_data = read_file(actual_fname)
|
actual_data = read_file(actual_fname)
|
||||||
|
if len(expected_data) < len(actual_data):
|
||||||
|
actual_data = actual_data[:len(expected_data)]
|
||||||
assert expected_data == actual_data, failure_msg
|
assert expected_data == actual_data, failure_msg
|
||||||
|
|
||||||
def check_not_equal(expected_fname, actual_fname, failure_msg):
|
def check_not_equal(expected_fname, actual_fname, failure_msg):
|
||||||
|
@ -435,7 +442,8 @@ def test_fit(u_boot_console):
|
||||||
output = cons.run_command_list(cmd.splitlines())
|
output = cons.run_command_list(cmd.splitlines())
|
||||||
check_equal(kernel, kernel_out, 'Kernel not loaded')
|
check_equal(kernel, kernel_out, 'Kernel not loaded')
|
||||||
check_equal(control_dtb, fdt_out, 'FDT not loaded')
|
check_equal(control_dtb, fdt_out, 'FDT not loaded')
|
||||||
check_equal(ramdisk, ramdisk_out, 'Ramdisk not loaded')
|
check_not_equal(ramdisk, ramdisk_out, 'Ramdisk got decompressed?')
|
||||||
|
check_equal(ramdisk + '.gz', ramdisk_out, 'Ramdist not loaded')
|
||||||
|
|
||||||
|
|
||||||
cons = u_boot_console
|
cons = u_boot_console
|
||||||
|
|
Loading…
Add table
Reference in a new issue