mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-11 21:53:29 +08:00
Merge branch '2019-07-29-master-imports'
- Assorted bug fixes
This commit is contained in:
commit
2d64a0f7e9
2
README
2
README
@ -212,7 +212,7 @@ board. This allows feature development which is not board- or architecture-
|
||||
specific to be undertaken on a native platform. The sandbox is also used to
|
||||
run some of U-Boot's tests.
|
||||
|
||||
See board/sandbox/README.sandbox for more details.
|
||||
See doc/arch/index.rst for more details.
|
||||
|
||||
|
||||
Board Initialisation Flow:
|
||||
|
@ -778,7 +778,8 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \
|
||||
|
||||
dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb
|
||||
mt7629-rfb.dtb \
|
||||
mt8516-pumpkin.dtb
|
||||
|
||||
dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
|
||||
dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
|
||||
|
110
arch/arm/dts/mt8516-pumpkin.dts
Normal file
110
arch/arm/dts/mt8516-pumpkin.dts
Normal file
@ -0,0 +1,110 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR MIT
|
||||
/*
|
||||
* Copyright (C) 2019 BayLibre SAS.
|
||||
* Author: Fabien Parent <fparent@baylibre.com>
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include <config.h>
|
||||
#include "mt8516.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Pumpkin MT8516";
|
||||
|
||||
chosen {
|
||||
stdout-path = &uart0;
|
||||
};
|
||||
|
||||
memory@40000000 {
|
||||
device_type = "memory";
|
||||
reg = <0x40000000 0x20000000>;
|
||||
};
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
/* 128 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
bl31_secmon_reserved: secmon@43000000 {
|
||||
no-map;
|
||||
reg = <0 0x43000000 0 0x20000>;
|
||||
};
|
||||
};
|
||||
|
||||
reg_1p8v: regulator-1p8v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "fixed-1.8V";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
reg_3p3v: regulator-3p3v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "fixed-3.3V";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins_default>;
|
||||
bus-width = <4>;
|
||||
max-frequency = <200000000>;
|
||||
cap-mmc-highspeed;
|
||||
mmc-hs200-1_8v;
|
||||
cap-mmc-hw-reset;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
vqmmc-supply = <®_1p8v>;
|
||||
non-removable;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
mmc0_pins_default: mmc0default {
|
||||
mux {
|
||||
function = "msdc";
|
||||
groups = "msdc0";
|
||||
};
|
||||
|
||||
conf-cmd-data {
|
||||
pins = "MSDC0_CMD", "MSDC0_DAT0", "MSDC0_DAT1",
|
||||
"MSDC0_DAT2", "MSDC0_DAT3", "MSDC0_DAT4",
|
||||
"MSDC0_DAT5", "MSDC0_DAT6", "MSDC0_DAT7";
|
||||
input-enable;
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
conf-clk {
|
||||
pins = "MSDC0_CLK";
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
conf-rst {
|
||||
pins = "MSDC0_RSTB";
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
|
||||
uart0_pins: uart0 {
|
||||
mux {
|
||||
function = "uart";
|
||||
groups = "uart0_0_rxd_txd";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&watchdog {
|
||||
status = "okay";
|
||||
};
|
@ -42,5 +42,6 @@ endchoice
|
||||
|
||||
source "board/mediatek/mt7623/Kconfig"
|
||||
source "board/mediatek/mt7629/Kconfig"
|
||||
source "board/mediatek/pumpkin/Kconfig"
|
||||
|
||||
endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Simulate a SPI port and clients (see README.sandbox for details)
|
||||
* Simulate a SPI port and clients (see doc/arch/sandbox.rst for details)
|
||||
*
|
||||
* Copyright (c) 2011-2013 The Chromium OS Authors.
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
|
13
board/mediatek/pumpkin/Kconfig
Normal file
13
board/mediatek/pumpkin/Kconfig
Normal file
@ -0,0 +1,13 @@
|
||||
if TARGET_MT8516
|
||||
|
||||
config SYS_BOARD
|
||||
default "pumpkin"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "pumpkin"
|
||||
|
||||
config MTK_BROM_HEADER_INFO
|
||||
string
|
||||
default "media=emmc"
|
||||
|
||||
endif
|
6
board/mediatek/pumpkin/MAINTAINERS
Normal file
6
board/mediatek/pumpkin/MAINTAINERS
Normal file
@ -0,0 +1,6 @@
|
||||
Pumpkin
|
||||
M: Fabien Parent <fparent@baylibre.com>
|
||||
S: Maintained
|
||||
F: board/mediatek/pumpkin
|
||||
F: include/configs/pumpkin.h
|
||||
F: configs/pumpkin_defconfig
|
3
board/mediatek/pumpkin/Makefile
Normal file
3
board/mediatek/pumpkin/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-y += pumpkin.o
|
11
board/mediatek/pumpkin/pumpkin.c
Normal file
11
board/mediatek/pumpkin/pumpkin.c
Normal file
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2019 BayLibre SAS
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -22,7 +22,7 @@ void __weak invalidate_icache_all(void)
|
||||
static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
switch (argc) {
|
||||
case 2: /* on / off */
|
||||
case 2: /* on / off / flush */
|
||||
switch (parse_argv(argv[1])) {
|
||||
case 0:
|
||||
icache_disable();
|
||||
@ -33,6 +33,8 @@ static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
case 2:
|
||||
invalidate_icache_all();
|
||||
break;
|
||||
default:
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
break;
|
||||
case 1: /* get status */
|
||||
@ -54,7 +56,7 @@ void __weak flush_dcache_all(void)
|
||||
static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
switch (argc) {
|
||||
case 2: /* on / off */
|
||||
case 2: /* on / off / flush */
|
||||
switch (parse_argv(argv[1])) {
|
||||
case 0:
|
||||
dcache_disable();
|
||||
@ -65,6 +67,8 @@ static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
case 2:
|
||||
flush_dcache_all();
|
||||
break;
|
||||
default:
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
break;
|
||||
case 1: /* get status */
|
||||
|
@ -27,6 +27,7 @@ U_BOOT_CMD(
|
||||
" - print detailed usage of 'command'"
|
||||
);
|
||||
|
||||
#ifdef CONFIG_CMDLINE
|
||||
/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
|
||||
ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
|
||||
"?", CONFIG_SYS_MAXARGS, cmd_always_repeatable, do_help,
|
||||
@ -35,3 +36,4 @@ ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
|
||||
""
|
||||
#endif /* CONFIG_SYS_LONGHELP */
|
||||
};
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <efi_loader.h>
|
||||
#include <wdt.h>
|
||||
#if defined(CONFIG_DM_GPIO_HOG)
|
||||
#if defined(CONFIG_GPIO_HOG)
|
||||
#include <asm/gpio.h>
|
||||
#endif
|
||||
|
||||
@ -799,7 +799,7 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_CMD_NET
|
||||
initr_ethaddr,
|
||||
#endif
|
||||
#if defined(CONFIG_DM_GPIO_HOG)
|
||||
#if defined(CONFIG_GPIO_HOG)
|
||||
gpio_hog_probe_all,
|
||||
#endif
|
||||
#ifdef CONFIG_BOARD_LATE_INIT
|
||||
|
150
common/bootm.c
150
common/bootm.c
@ -7,17 +7,12 @@
|
||||
#ifndef USE_HOSTCC
|
||||
#include <common.h>
|
||||
#include <bootstage.h>
|
||||
#include <bzlib.h>
|
||||
#include <errno.h>
|
||||
#include <fdt_support.h>
|
||||
#include <lmb.h>
|
||||
#include <malloc.h>
|
||||
#include <mapmem.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/lzo.h>
|
||||
#include <lzma/LzmaTypes.h>
|
||||
#include <lzma/LzmaDec.h>
|
||||
#include <lzma/LzmaTools.h>
|
||||
#if defined(CONFIG_CMD_USB)
|
||||
#include <usb.h>
|
||||
#endif
|
||||
@ -299,23 +294,7 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
}
|
||||
#endif /* USE_HOSTC */
|
||||
|
||||
/**
|
||||
* print_decomp_msg() - Print a suitable decompression/loading message
|
||||
*
|
||||
* @type: OS type (IH_OS_...)
|
||||
* @comp_type: Compression type being used (IH_COMP_...)
|
||||
* @is_xip: true if the load address matches the image start
|
||||
*/
|
||||
static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
||||
{
|
||||
const char *name = genimg_get_type_name(type);
|
||||
|
||||
if (comp_type == IH_COMP_NONE)
|
||||
printf(" %s %s ... ", is_xip ? "XIP" : "Loading", name);
|
||||
else
|
||||
printf(" Uncompressing %s ... ", name);
|
||||
}
|
||||
|
||||
#if !defined(USE_HOSTCC) || defined(CONFIG_FIT_SIGNATURE)
|
||||
/**
|
||||
* handle_decomp_error() - display a decompression error
|
||||
*
|
||||
@ -325,16 +304,18 @@ static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
||||
*
|
||||
* @comp_type: Compression type being used (IH_COMP_...)
|
||||
* @uncomp_size: Number of bytes uncompressed
|
||||
* @unc_len: Amount of space available for decompression
|
||||
* @ret: Error code to report
|
||||
* @return BOOTM_ERR_RESET, indicating that the board must be reset
|
||||
* @ret: errno error code received from compression library
|
||||
* @return Appropriate BOOTM_ERR_ error code
|
||||
*/
|
||||
static int handle_decomp_error(int comp_type, size_t uncomp_size,
|
||||
size_t unc_len, int ret)
|
||||
static int handle_decomp_error(int comp_type, size_t uncomp_size, int ret)
|
||||
{
|
||||
const char *name = genimg_get_comp_name(comp_type);
|
||||
|
||||
if (uncomp_size >= unc_len)
|
||||
/* ENOSYS means unimplemented compression type, don't reset. */
|
||||
if (ret == -ENOSYS)
|
||||
return BOOTM_ERR_UNIMPLEMENTED;
|
||||
|
||||
if (uncomp_size >= CONFIG_SYS_BOOTM_LEN)
|
||||
printf("Image too large: increase CONFIG_SYS_BOOTM_LEN\n");
|
||||
else
|
||||
printf("%s: uncompress error %d\n", name, ret);
|
||||
@ -351,93 +332,7 @@ static int handle_decomp_error(int comp_type, size_t uncomp_size,
|
||||
|
||||
return BOOTM_ERR_RESET;
|
||||
}
|
||||
|
||||
int bootm_decomp_image(int comp, ulong load, ulong image_start, int type,
|
||||
void *load_buf, void *image_buf, ulong image_len,
|
||||
uint unc_len, ulong *load_end)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
*load_end = load;
|
||||
print_decomp_msg(comp, type, load == image_start);
|
||||
|
||||
/*
|
||||
* Load the image to the right place, decompressing if needed. After
|
||||
* this, image_len will be set to the number of uncompressed bytes
|
||||
* loaded, ret will be non-zero on error.
|
||||
*/
|
||||
switch (comp) {
|
||||
case IH_COMP_NONE:
|
||||
if (load == image_start)
|
||||
break;
|
||||
if (image_len <= unc_len)
|
||||
memmove_wd(load_buf, image_buf, image_len, CHUNKSZ);
|
||||
else
|
||||
ret = 1;
|
||||
break;
|
||||
#ifdef CONFIG_GZIP
|
||||
case IH_COMP_GZIP: {
|
||||
ret = gunzip(load_buf, unc_len, image_buf, &image_len);
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_GZIP */
|
||||
#ifdef CONFIG_BZIP2
|
||||
case IH_COMP_BZIP2: {
|
||||
uint size = unc_len;
|
||||
|
||||
/*
|
||||
* If we've got less than 4 MB of malloc() space,
|
||||
* use slower decompression algorithm which requires
|
||||
* at most 2300 KB of memory.
|
||||
*/
|
||||
ret = BZ2_bzBuffToBuffDecompress(load_buf, &size,
|
||||
image_buf, image_len,
|
||||
CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_BZIP2 */
|
||||
#ifdef CONFIG_LZMA
|
||||
case IH_COMP_LZMA: {
|
||||
SizeT lzma_len = unc_len;
|
||||
|
||||
ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len,
|
||||
image_buf, image_len);
|
||||
image_len = lzma_len;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZMA */
|
||||
#ifdef CONFIG_LZO
|
||||
case IH_COMP_LZO: {
|
||||
size_t size = unc_len;
|
||||
|
||||
ret = lzop_decompress(image_buf, image_len, load_buf, &size);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZO */
|
||||
#ifdef CONFIG_LZ4
|
||||
case IH_COMP_LZ4: {
|
||||
size_t size = unc_len;
|
||||
|
||||
ret = ulz4fn(image_buf, image_len, load_buf, &size);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZ4 */
|
||||
default:
|
||||
printf("Unimplemented compression type %d\n", comp);
|
||||
return BOOTM_ERR_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return handle_decomp_error(comp, image_len, unc_len, ret);
|
||||
*load_end = load + image_len;
|
||||
|
||||
puts("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef USE_HOSTCC
|
||||
static int bootm_load_os(bootm_headers_t *images, int boot_progress)
|
||||
@ -456,10 +351,11 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress)
|
||||
|
||||
load_buf = map_sysmem(load, 0);
|
||||
image_buf = map_sysmem(os.image_start, image_len);
|
||||
err = bootm_decomp_image(os.comp, load, os.image_start, os.type,
|
||||
load_buf, image_buf, image_len,
|
||||
CONFIG_SYS_BOOTM_LEN, &load_end);
|
||||
err = image_decomp(os.comp, load, os.image_start, os.type,
|
||||
load_buf, image_buf, image_len,
|
||||
CONFIG_SYS_BOOTM_LEN, &load_end);
|
||||
if (err) {
|
||||
err = handle_decomp_error(os.comp, load_end - load, err);
|
||||
bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
|
||||
return err;
|
||||
}
|
||||
@ -919,11 +815,6 @@ void __weak switch_to_non_secure_mode(void)
|
||||
|
||||
#else /* USE_HOSTCC */
|
||||
|
||||
void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
|
||||
{
|
||||
memmove(to, from, len);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_FIT_SIGNATURE)
|
||||
static int bootm_host_load_image(const void *fit, int req_image_type)
|
||||
{
|
||||
@ -957,13 +848,16 @@ static int bootm_host_load_image(const void *fit, int req_image_type)
|
||||
|
||||
/* Allow the image to expand by a factor of 4, should be safe */
|
||||
load_buf = malloc((1 << 20) + len * 4);
|
||||
ret = bootm_decomp_image(imape_comp, 0, data, image_type, load_buf,
|
||||
(void *)data, len, CONFIG_SYS_BOOTM_LEN,
|
||||
&load_end);
|
||||
ret = image_decomp(imape_comp, 0, data, image_type, load_buf,
|
||||
(void *)data, len, CONFIG_SYS_BOOTM_LEN,
|
||||
&load_end);
|
||||
free(load_buf);
|
||||
|
||||
if (ret && ret != BOOTM_ERR_UNIMPLEMENTED)
|
||||
return ret;
|
||||
if (ret) {
|
||||
ret = handle_decomp_error(imape_comp, load_end - 0, ret);
|
||||
if (ret != BOOTM_ERR_UNIMPLEMENTED)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#endif /* !USE_HOSTCC*/
|
||||
|
||||
#include <bootm.h>
|
||||
#include <image.h>
|
||||
#include <bootstage.h>
|
||||
#include <u-boot/crc.h>
|
||||
@ -1521,6 +1522,10 @@ int fit_check_format(const void *fit)
|
||||
* compatible list, "foo,bar", matches a compatible string in the root of fdt1.
|
||||
* "bim,bam" in fdt2 matches the second string which isn't as good as fdt1.
|
||||
*
|
||||
* As an optimization, the compatible property from the FDT's root node can be
|
||||
* copied into the configuration node in the FIT image. This is required to
|
||||
* match configurations with compressed FDTs.
|
||||
*
|
||||
* returns:
|
||||
* offset to the configuration to use if one was found
|
||||
* -1 otherwise
|
||||
@ -1553,48 +1558,62 @@ int fit_conf_find_compat(const void *fit, const void *fdt)
|
||||
for (noffset = fdt_next_node(fit, confs_noffset, &ndepth);
|
||||
(noffset >= 0) && (ndepth > 0);
|
||||
noffset = fdt_next_node(fit, noffset, &ndepth)) {
|
||||
const void *kfdt;
|
||||
const void *fdt;
|
||||
const char *kfdt_name;
|
||||
int kfdt_noffset;
|
||||
int kfdt_noffset, compat_noffset;
|
||||
const char *cur_fdt_compat;
|
||||
int len;
|
||||
size_t size;
|
||||
size_t sz;
|
||||
int i;
|
||||
|
||||
if (ndepth > 1)
|
||||
continue;
|
||||
|
||||
kfdt_name = fdt_getprop(fit, noffset, "fdt", &len);
|
||||
if (!kfdt_name) {
|
||||
debug("No fdt property found.\n");
|
||||
continue;
|
||||
}
|
||||
kfdt_noffset = fdt_subnode_offset(fit, images_noffset,
|
||||
kfdt_name);
|
||||
if (kfdt_noffset < 0) {
|
||||
debug("No image node named \"%s\" found.\n",
|
||||
kfdt_name);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Get a pointer to this configuration's fdt.
|
||||
*/
|
||||
if (fit_image_get_data(fit, kfdt_noffset, &kfdt, &size)) {
|
||||
debug("Failed to get fdt \"%s\".\n", kfdt_name);
|
||||
continue;
|
||||
/* If there's a compat property in the config node, use that. */
|
||||
if (fdt_getprop(fit, noffset, "compatible", NULL)) {
|
||||
fdt = fit; /* search in FIT image */
|
||||
compat_noffset = noffset; /* search under config node */
|
||||
} else { /* Otherwise extract it from the kernel FDT. */
|
||||
kfdt_name = fdt_getprop(fit, noffset, "fdt", &len);
|
||||
if (!kfdt_name) {
|
||||
debug("No fdt property found.\n");
|
||||
continue;
|
||||
}
|
||||
kfdt_noffset = fdt_subnode_offset(fit, images_noffset,
|
||||
kfdt_name);
|
||||
if (kfdt_noffset < 0) {
|
||||
debug("No image node named \"%s\" found.\n",
|
||||
kfdt_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fit_image_check_comp(fit, kfdt_noffset,
|
||||
IH_COMP_NONE)) {
|
||||
debug("Can't extract compat from \"%s\" "
|
||||
"(compressed)\n", kfdt_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* search in this config's kernel FDT */
|
||||
if (fit_image_get_data(fit, kfdt_noffset, &fdt, &sz)) {
|
||||
debug("Failed to get fdt \"%s\".\n", kfdt_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
compat_noffset = 0; /* search kFDT under root node */
|
||||
}
|
||||
|
||||
len = fdt_compat_len;
|
||||
cur_fdt_compat = fdt_compat;
|
||||
/*
|
||||
* Look for a match for each U-Boot compatibility string in
|
||||
* turn in this configuration's fdt.
|
||||
* turn in the compat string property.
|
||||
*/
|
||||
for (i = 0; len > 0 &&
|
||||
(!best_match_offset || best_match_pos > i); i++) {
|
||||
int cur_len = strlen(cur_fdt_compat) + 1;
|
||||
|
||||
if (!fdt_node_check_compatible(kfdt, 0,
|
||||
if (!fdt_node_check_compatible(fdt, compat_noffset,
|
||||
cur_fdt_compat)) {
|
||||
best_match_offset = noffset;
|
||||
best_match_pos = i;
|
||||
@ -1795,11 +1814,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
const char *fit_uname_config;
|
||||
const char *fit_base_uname_config;
|
||||
const void *fit;
|
||||
const void *buf;
|
||||
void *buf;
|
||||
void *loadbuf;
|
||||
size_t size;
|
||||
int type_ok, os_ok;
|
||||
ulong load, data, len;
|
||||
uint8_t os;
|
||||
ulong load, load_end, data, len;
|
||||
uint8_t os, comp;
|
||||
#ifndef USE_HOSTCC
|
||||
uint8_t os_arch;
|
||||
#endif
|
||||
@ -1895,12 +1915,6 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
images->os.arch = os_arch;
|
||||
#endif
|
||||
|
||||
if (image_type == IH_TYPE_FLATDT &&
|
||||
!fit_image_check_comp(fit, noffset, IH_COMP_NONE)) {
|
||||
puts("FDT image is compressed");
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
|
||||
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);
|
||||
type_ok = fit_image_check_type(fit, noffset, image_type) ||
|
||||
fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE) ||
|
||||
@ -1931,7 +1945,8 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL_OK);
|
||||
|
||||
/* get image data address and length */
|
||||
if (fit_image_get_data_and_size(fit, noffset, &buf, &size)) {
|
||||
if (fit_image_get_data_and_size(fit, noffset,
|
||||
(const void **)&buf, &size)) {
|
||||
printf("Could not find %s subimage data!\n", prop_name);
|
||||
bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA);
|
||||
return -ENOENT;
|
||||
@ -1939,30 +1954,15 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
|
||||
#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
|
||||
/* perform any post-processing on the image data */
|
||||
board_fit_image_post_process((void **)&buf, &size);
|
||||
board_fit_image_post_process(&buf, &size);
|
||||
#endif
|
||||
|
||||
len = (ulong)size;
|
||||
|
||||
/* verify that image data is a proper FDT blob */
|
||||
if (image_type == IH_TYPE_FLATDT && fdt_check_header(buf)) {
|
||||
puts("Subimage data is not a FDT");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_GET_DATA_OK);
|
||||
|
||||
/*
|
||||
* Work-around for eldk-4.2 which gives this warning if we try to
|
||||
* cast in the unmap_sysmem() call:
|
||||
* warning: initialization discards qualifiers from pointer target type
|
||||
*/
|
||||
{
|
||||
void *vbuf = (void *)buf;
|
||||
|
||||
data = map_to_sysmem(vbuf);
|
||||
}
|
||||
|
||||
data = map_to_sysmem(buf);
|
||||
load = data;
|
||||
if (load_op == FIT_LOAD_IGNORED) {
|
||||
/* Don't load */
|
||||
} else if (fit_image_get_load(fit, noffset, &load)) {
|
||||
@ -1974,8 +1974,6 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
}
|
||||
} else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {
|
||||
ulong image_start, image_end;
|
||||
ulong load_end;
|
||||
void *dst;
|
||||
|
||||
/*
|
||||
* move image data to the load address,
|
||||
@ -1993,14 +1991,45 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
|
||||
|
||||
printf(" Loading %s from 0x%08lx to 0x%08lx\n",
|
||||
prop_name, data, load);
|
||||
|
||||
dst = map_sysmem(load, len);
|
||||
memmove(dst, buf, len);
|
||||
data = load;
|
||||
} else {
|
||||
load = data; /* No load address specified */
|
||||
}
|
||||
|
||||
comp = IH_COMP_NONE;
|
||||
loadbuf = buf;
|
||||
/* Kernel images get decompressed later in bootm_load_os(). */
|
||||
if (!(image_type == IH_TYPE_KERNEL ||
|
||||
image_type == IH_TYPE_KERNEL_NOLOAD) &&
|
||||
!fit_image_get_comp(fit, noffset, &comp) &&
|
||||
comp != IH_COMP_NONE) {
|
||||
ulong max_decomp_len = len * 20;
|
||||
if (load == data) {
|
||||
loadbuf = malloc(max_decomp_len);
|
||||
load = map_to_sysmem(loadbuf);
|
||||
} else {
|
||||
loadbuf = map_sysmem(load, max_decomp_len);
|
||||
}
|
||||
if (image_decomp(comp, load, data, image_type,
|
||||
loadbuf, buf, len, max_decomp_len, &load_end)) {
|
||||
printf("Error decompressing %s\n", prop_name);
|
||||
|
||||
return -ENOEXEC;
|
||||
}
|
||||
len = load_end - load;
|
||||
} else if (load != data) {
|
||||
loadbuf = map_sysmem(load, len);
|
||||
memcpy(loadbuf, buf, len);
|
||||
}
|
||||
|
||||
/* verify that image data is a proper FDT blob */
|
||||
if (image_type == IH_TYPE_FLATDT && fdt_check_header(loadbuf)) {
|
||||
puts("Subimage data is not a FDT");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_LOAD);
|
||||
|
||||
*datap = data;
|
||||
*datap = load;
|
||||
*lenp = len;
|
||||
if (fit_unamep)
|
||||
*fit_unamep = (char *)fit_uname;
|
||||
|
111
common/image.c
111
common/image.c
@ -32,6 +32,12 @@
|
||||
#include <linux/errno.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include <bzlib.h>
|
||||
#include <linux/lzo.h>
|
||||
#include <lzma/LzmaTypes.h>
|
||||
#include <lzma/LzmaDec.h>
|
||||
#include <lzma/LzmaTools.h>
|
||||
|
||||
#ifdef CONFIG_CMD_BDI
|
||||
extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
|
||||
#endif
|
||||
@ -375,6 +381,106 @@ void image_print_contents(const void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* print_decomp_msg() - Print a suitable decompression/loading message
|
||||
*
|
||||
* @type: OS type (IH_OS_...)
|
||||
* @comp_type: Compression type being used (IH_COMP_...)
|
||||
* @is_xip: true if the load address matches the image start
|
||||
*/
|
||||
static void print_decomp_msg(int comp_type, int type, bool is_xip)
|
||||
{
|
||||
const char *name = genimg_get_type_name(type);
|
||||
|
||||
if (comp_type == IH_COMP_NONE)
|
||||
printf(" %s %s\n", is_xip ? "XIP" : "Loading", name);
|
||||
else
|
||||
printf(" Uncompressing %s\n", name);
|
||||
}
|
||||
|
||||
int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||
void *load_buf, void *image_buf, ulong image_len,
|
||||
uint unc_len, ulong *load_end)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
*load_end = load;
|
||||
print_decomp_msg(comp, type, load == image_start);
|
||||
|
||||
/*
|
||||
* Load the image to the right place, decompressing if needed. After
|
||||
* this, image_len will be set to the number of uncompressed bytes
|
||||
* loaded, ret will be non-zero on error.
|
||||
*/
|
||||
switch (comp) {
|
||||
case IH_COMP_NONE:
|
||||
if (load == image_start)
|
||||
break;
|
||||
if (image_len <= unc_len)
|
||||
memmove_wd(load_buf, image_buf, image_len, CHUNKSZ);
|
||||
else
|
||||
ret = -ENOSPC;
|
||||
break;
|
||||
#ifdef CONFIG_GZIP
|
||||
case IH_COMP_GZIP: {
|
||||
ret = gunzip(load_buf, unc_len, image_buf, &image_len);
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_GZIP */
|
||||
#ifdef CONFIG_BZIP2
|
||||
case IH_COMP_BZIP2: {
|
||||
uint size = unc_len;
|
||||
|
||||
/*
|
||||
* If we've got less than 4 MB of malloc() space,
|
||||
* use slower decompression algorithm which requires
|
||||
* at most 2300 KB of memory.
|
||||
*/
|
||||
ret = BZ2_bzBuffToBuffDecompress(load_buf, &size,
|
||||
image_buf, image_len,
|
||||
CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_BZIP2 */
|
||||
#ifdef CONFIG_LZMA
|
||||
case IH_COMP_LZMA: {
|
||||
SizeT lzma_len = unc_len;
|
||||
|
||||
ret = lzmaBuffToBuffDecompress(load_buf, &lzma_len,
|
||||
image_buf, image_len);
|
||||
image_len = lzma_len;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZMA */
|
||||
#ifdef CONFIG_LZO
|
||||
case IH_COMP_LZO: {
|
||||
size_t size = unc_len;
|
||||
|
||||
ret = lzop_decompress(image_buf, image_len, load_buf, &size);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZO */
|
||||
#ifdef CONFIG_LZ4
|
||||
case IH_COMP_LZ4: {
|
||||
size_t size = unc_len;
|
||||
|
||||
ret = ulz4fn(image_buf, image_len, load_buf, &size);
|
||||
image_len = size;
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_LZ4 */
|
||||
default:
|
||||
printf("Unimplemented compression type %d\n", comp);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
*load_end = load + image_len;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_HOSTCC
|
||||
#if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
|
||||
@ -551,6 +657,11 @@ void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
|
||||
memmove(to, from, len);
|
||||
#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
|
||||
}
|
||||
#else /* USE_HOSTCC */
|
||||
void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
|
||||
{
|
||||
memmove(to, from, len);
|
||||
}
|
||||
#endif /* !USE_HOSTCC */
|
||||
|
||||
void genimg_print_size(uint32_t size)
|
||||
|
@ -111,6 +111,7 @@ CONFIG_MTD_NOR_FLASH=y
|
||||
CONFIG_FLASH_CFI_DRIVER=y
|
||||
CONFIG_SYS_FLASH_CFI=y
|
||||
CONFIG_E1000=y
|
||||
CONFIG_RTC_RX8025=y
|
||||
CONFIG_BAUDRATE=9600
|
||||
CONFIG_SYS_NS16550=y
|
||||
CONFIG_OF_LIBFDT=y
|
||||
|
65
configs/pumpkin_defconfig
Normal file
65
configs/pumpkin_defconfig
Normal file
@ -0,0 +1,65 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_POSITION_INDEPENDENT=y
|
||||
CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x4C000000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_TARGET_MT8516=y
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_DEBUG_UART_BASE=0x11005000
|
||||
CONFIG_DEBUG_UART_CLOCK=26000000
|
||||
# CONFIG_PSCI_RESET is not set
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_FIT=y
|
||||
# CONFIG_FIT_ENABLE_SHA256_SUPPORT is not set
|
||||
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
|
||||
CONFIG_DEFAULT_FDT_FILE="mt8516-pumpkin"
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_HUSH_PARSER=y
|
||||
# CONFIG_CMD_BDI is not set
|
||||
# CONFIG_CMD_CONSOLE is not set
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
# CONFIG_CMD_BOOTI is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_GO is not set
|
||||
# CONFIG_CMD_IMI is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
# CONFIG_CMD_EXPORTENV is not set
|
||||
# CONFIG_CMD_IMPORTENV is not set
|
||||
# CONFIG_CMD_EDITENV is not set
|
||||
# CONFIG_CMD_ENV_EXISTS is not set
|
||||
# CONFIG_CMD_CRC32 is not set
|
||||
# CONFIG_CMD_MEMORY is not set
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_GPT=y
|
||||
# CONFIG_RANDOM_UUID is not set
|
||||
# CONFIG_CMD_LOADB is not set
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_PART=y
|
||||
# CONFIG_CMD_ITEST is not set
|
||||
# CONFIG_CMD_SOURCE is not set
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
# CONFIG_CMD_BLOCK_CACHE is not set
|
||||
# CONFIG_CMD_MISC is not set
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt8516-pumpkin"
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
# CONFIG_NET is not set
|
||||
CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
CONFIG_CLK=y
|
||||
CONFIG_DM_GPIO=y
|
||||
# CONFIG_INPUT is not set
|
||||
CONFIG_DM_MMC=y
|
||||
# CONFIG_MMC_QUIRKS is not set
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_MT8516=y
|
||||
CONFIG_RAM=y
|
||||
CONFIG_BAUDRATE=921600
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_DEBUG_UART_MTK=y
|
||||
CONFIG_DEBUG_UART_ANNOUNCE=y
|
||||
CONFIG_MTK_SERIAL=y
|
||||
CONFIG_WDT=y
|
||||
CONFIG_WDT_MTK=y
|
||||
# CONFIG_EFI_LOADER is not set
|
@ -37,6 +37,7 @@ CONFIG_SYS_FLASH_CFI=y
|
||||
CONFIG_PHY_MARVELL=y
|
||||
CONFIG_MII=y
|
||||
CONFIG_TSEC_ENET=y
|
||||
CONFIG_RTC_RX8025=y
|
||||
CONFIG_SYS_NS16550=y
|
||||
CONFIG_USB=y
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
|
@ -114,6 +114,7 @@ CONFIG_FLASH_CFI_DRIVER=y
|
||||
CONFIG_SYS_FLASH_CFI=y
|
||||
CONFIG_PHY_MARVELL=y
|
||||
CONFIG_TSEC_ENET=y
|
||||
CONFIG_RTC_RX8025=y
|
||||
CONFIG_BAUDRATE=9600
|
||||
CONFIG_SYS_NS16550=y
|
||||
CONFIG_OF_LIBFDT=y
|
||||
|
@ -229,7 +229,7 @@ U-BOOT> gpt rename mmc 0 1 primary
|
||||
|
||||
The GPT functionality may be tested with the 'sandbox' board by
|
||||
creating a disk image as described under 'Block Device Emulation' in
|
||||
board/sandbox/README.sandbox:
|
||||
doc/arch/index.rst:
|
||||
|
||||
=>host bind 0 ./disk.raw
|
||||
=> gpt read host 0
|
||||
|
10
doc/board/AndesTech/index.rst
Normal file
10
doc/board/AndesTech/index.rst
Normal file
@ -0,0 +1,10 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
Andes Tech
|
||||
==========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
adp-ag101p
|
||||
ax25-ae350
|
9
doc/board/atmel/index.rst
Normal file
9
doc/board/atmel/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
Atmel
|
||||
=====
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
at91ek
|
9
doc/board/freescale/index.rst
Normal file
9
doc/board/freescale/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
Freescale
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
b4860qds
|
10
doc/board/renesas/index.rst
Normal file
10
doc/board/renesas/index.rst
Normal file
@ -0,0 +1,10 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
Renesas
|
||||
=======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
sh7752evb
|
||||
sh7753evb
|
9
doc/board/sifive/index.rst
Normal file
9
doc/board/sifive/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
SiFive
|
||||
======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
fu540
|
9
doc/board/xilinx/index.rst
Normal file
9
doc/board/xilinx/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
Xilinx
|
||||
======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
zynq
|
@ -252,6 +252,7 @@ Example:
|
||||
boot_rescue {
|
||||
gpio-hog;
|
||||
input;
|
||||
line-name = "foo-bar-gpio";
|
||||
gpios = <7 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
@ -259,9 +260,13 @@ Example:
|
||||
For the above Example you can than access the gpio in your boardcode
|
||||
with:
|
||||
|
||||
desc = gpio_hog_lookup_name("boot_rescue.gpio-hog");
|
||||
if (desc) {
|
||||
if (dm_gpio_get_value(desc))
|
||||
printf("\nBooting into Rescue System\n");
|
||||
else
|
||||
printf("\nBoot normal\n");
|
||||
struct gpio_desc *desc;
|
||||
int ret;
|
||||
|
||||
ret = gpio_hog_lookup_name("boot_rescue", &desc);
|
||||
if (ret)
|
||||
return;
|
||||
if (dm_gpio_get_value(desc) == 1)
|
||||
printf("\nBooting into Rescue System\n");
|
||||
else if (dm_gpio_get_value(desc) == 0)
|
||||
printf("\nBoot normal\n");
|
||||
|
73
doc/uImage.FIT/kernel_fdts_compressed.its
Normal file
73
doc/uImage.FIT/kernel_fdts_compressed.its
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* U-Boot uImage source file with a kernel and multiple compressed FDT blobs.
|
||||
* Since the FDTs are compressed, configurations must provide a compatible
|
||||
* string to match directly.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "Image with single Linux kernel and compressed FDT blobs";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
kernel {
|
||||
description = "Vanilla Linux kernel";
|
||||
data = /incbin/("./vmlinux.bin.gz");
|
||||
type = "kernel";
|
||||
arch = "ppc";
|
||||
os = "linux";
|
||||
compression = "gzip";
|
||||
load = <00000000>;
|
||||
entry = <00000000>;
|
||||
hash-1 {
|
||||
algo = "crc32";
|
||||
};
|
||||
hash-2 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
fdt@1 {
|
||||
description = "Flattened Device Tree blob 1";
|
||||
data = /incbin/("./myboard-var1.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "ppc";
|
||||
compression = "gzip";
|
||||
hash-1 {
|
||||
algo = "crc32";
|
||||
};
|
||||
hash-2 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
fdt@2 {
|
||||
description = "Flattened Device Tree blob 2";
|
||||
data = /incbin/("./myboard-var2.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "ppc";
|
||||
compression = "lzma";
|
||||
hash-1 {
|
||||
algo = "crc32";
|
||||
};
|
||||
hash-2 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "conf@1";
|
||||
conf@1 {
|
||||
description = "Boot Linux kernel with FDT blob 1";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt@1";
|
||||
compatible = "myvendor,myboard-variant1";
|
||||
};
|
||||
conf@2 {
|
||||
description = "Boot Linux kernel with FDT blob 2";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt@2";
|
||||
compatible = "myvendor,myboard-variant2";
|
||||
};
|
||||
};
|
||||
};
|
@ -240,6 +240,7 @@ o config-1
|
||||
|- fdt = "fdt sub-node unit-name" [, "fdt overlay sub-node unit-name", ...]
|
||||
|- fpga = "fpga sub-node unit-name"
|
||||
|- loadables = "loadables sub-node unit-name"
|
||||
|- compatible = "vendor,board-style device tree compatible string"
|
||||
|
||||
|
||||
Mandatory properties:
|
||||
@ -263,6 +264,12 @@ o config-1
|
||||
of strings. U-Boot will load each binary at its given start-address and
|
||||
may optionaly invoke additional post-processing steps on this binary based
|
||||
on its component image node type.
|
||||
- compatible : The root compatible string of the U-Boot device tree that
|
||||
this configuration shall automatically match when CONFIG_FIT_BEST_MATCH is
|
||||
enabled. If this property is not provided, the compatible string will be
|
||||
extracted from the fdt blob instead. This is only possible if the fdt is
|
||||
not compressed, so images with compressed fdts that want to use compatible
|
||||
string matching must always provide this property.
|
||||
|
||||
The FDT blob is required to properly boot FDT based kernel, so the minimal
|
||||
configuration for 2.6 FDT kernel is (kernel, fdt) pair.
|
||||
|
@ -14,7 +14,7 @@ config DM_GPIO
|
||||
particular GPIOs that they provide. The uclass interface
|
||||
is defined in include/asm-generic/gpio.h.
|
||||
|
||||
config DM_GPIO_HOG
|
||||
config GPIO_HOG
|
||||
bool "Enable GPIO hog support"
|
||||
depends on DM_GPIO
|
||||
default n
|
||||
|
@ -144,7 +144,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc,
|
||||
return gpio_xlate_offs_flags(desc->dev, desc, args);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DM_GPIO_HOG)
|
||||
#if defined(CONFIG_GPIO_HOG)
|
||||
|
||||
struct gpio_hog_priv {
|
||||
struct gpio_desc gpiod;
|
||||
@ -181,9 +181,8 @@ static int gpio_hog_ofdata_to_platdata(struct udevice *dev)
|
||||
return ret;
|
||||
}
|
||||
nodename = dev_read_string(dev, "line-name");
|
||||
if (!nodename)
|
||||
nodename = dev_read_name(dev);
|
||||
device_set_name(dev, nodename);
|
||||
if (nodename)
|
||||
device_set_name(dev, nodename);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -202,9 +201,15 @@ static int gpio_hog_probe(struct udevice *dev)
|
||||
dev->name);
|
||||
return ret;
|
||||
}
|
||||
dm_gpio_set_dir(&priv->gpiod);
|
||||
if (plat->gpiod_flags == GPIOD_IS_OUT)
|
||||
dm_gpio_set_value(&priv->gpiod, plat->value);
|
||||
|
||||
if (plat->gpiod_flags == GPIOD_IS_OUT) {
|
||||
ret = dm_gpio_set_value(&priv->gpiod, plat->value);
|
||||
if (ret < 0) {
|
||||
debug("%s: node %s could not set gpio.\n", __func__,
|
||||
dev->name);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -213,32 +218,38 @@ int gpio_hog_probe_all(void)
|
||||
{
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
int retval = 0;
|
||||
|
||||
for (uclass_first_device(UCLASS_NOP, &dev);
|
||||
dev;
|
||||
uclass_find_next_device(&dev)) {
|
||||
if (dev->driver == DM_GET_DRIVER(gpio_hog)) {
|
||||
ret = device_probe(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (ret) {
|
||||
printf("Failed to probe device %s err: %d\n",
|
||||
dev->name, ret);
|
||||
retval = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
struct gpio_desc *gpio_hog_lookup_name(const char *name)
|
||||
int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
*desc = NULL;
|
||||
gpio_hog_probe_all();
|
||||
if (!uclass_get_device_by_name(UCLASS_NOP, name, &dev)) {
|
||||
struct gpio_hog_priv *priv = dev_get_priv(dev);
|
||||
|
||||
return &priv->gpiod;
|
||||
*desc = &priv->gpiod;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
U_BOOT_DRIVER(gpio_hog) = {
|
||||
@ -250,9 +261,9 @@ U_BOOT_DRIVER(gpio_hog) = {
|
||||
.platdata_auto_alloc_size = sizeof(struct gpio_hog_data),
|
||||
};
|
||||
#else
|
||||
struct gpio_desc *gpio_hog_lookup_name(const char *name)
|
||||
int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc)
|
||||
{
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -755,13 +766,45 @@ int dm_gpio_get_values_as_int(const struct gpio_desc *desc_list, int count)
|
||||
return vector;
|
||||
}
|
||||
|
||||
/**
|
||||
* gpio_request_tail: common work for requesting a gpio.
|
||||
*
|
||||
* ret: return value from previous work in function which calls
|
||||
* this function.
|
||||
* This seems bogus (why calling this function instead not
|
||||
* calling it and end caller function instead?).
|
||||
* Because on error in caller function we want to set some
|
||||
* default values in gpio desc and have a common error
|
||||
* debug message, which provides this function.
|
||||
* nodename: Name of node for which gpio gets requested
|
||||
* used for gpio label name.
|
||||
* args: pointer to output arguments structure
|
||||
* list_name: Name of GPIO list
|
||||
* used for gpio label name.
|
||||
* index: gpio index in gpio list
|
||||
* used for gpio label name.
|
||||
* desc: pointer to gpio descriptor, filled from this
|
||||
* function.
|
||||
* flags: gpio flags to use.
|
||||
* add_index: should index added to gpio label name
|
||||
* gpio_dev: pointer to gpio device from which the gpio
|
||||
* will be requested. If NULL try to get the
|
||||
* gpio device with uclass_get_device_by_ofnode()
|
||||
*
|
||||
* return: In error case this function sets default values in
|
||||
* gpio descriptor, also emmits a debug message.
|
||||
* On success it returns 0 else the error code from
|
||||
* function calls, or the error code passed through
|
||||
* ret to this function.
|
||||
*
|
||||
*/
|
||||
static int gpio_request_tail(int ret, const char *nodename,
|
||||
struct ofnode_phandle_args *args,
|
||||
const char *list_name, int index,
|
||||
struct gpio_desc *desc, int flags,
|
||||
bool add_index, struct udevice *dev)
|
||||
bool add_index, struct udevice *gpio_dev)
|
||||
{
|
||||
desc->dev = dev;
|
||||
desc->dev = gpio_dev;
|
||||
desc->offset = 0;
|
||||
desc->flags = 0;
|
||||
if (ret)
|
||||
@ -771,7 +814,8 @@ static int gpio_request_tail(int ret, const char *nodename,
|
||||
ret = uclass_get_device_by_ofnode(UCLASS_GPIO, args->node,
|
||||
&desc->dev);
|
||||
if (ret) {
|
||||
debug("%s: uclass_get_device_by_ofnode failed\n", __func__);
|
||||
debug("%s: uclass_get_device_by_ofnode failed\n",
|
||||
__func__);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -989,10 +1033,8 @@ int gpio_dev_request_index(struct udevice *dev, const char *nodename,
|
||||
|
||||
static int gpio_post_bind(struct udevice *dev)
|
||||
{
|
||||
#if defined(CONFIG_DM_GPIO_HOG)
|
||||
struct udevice *child;
|
||||
ofnode node;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
|
||||
struct dm_gpio_ops *ops = (struct dm_gpio_ops *)device_get_ops(dev);
|
||||
@ -1024,16 +1066,21 @@ static int gpio_post_bind(struct udevice *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DM_GPIO_HOG)
|
||||
dev_for_each_subnode(node, dev) {
|
||||
if (ofnode_read_bool(node, "gpio-hog")) {
|
||||
const char *name = ofnode_get_name(node);
|
||||
if (IS_ENABLED(CONFIG_GPIO_HOG)) {
|
||||
dev_for_each_subnode(node, dev) {
|
||||
if (ofnode_read_bool(node, "gpio-hog")) {
|
||||
const char *name = ofnode_get_name(node);
|
||||
int ret;
|
||||
|
||||
device_bind_driver_to_node(dev, "gpio_hog", name,
|
||||
node, &child);
|
||||
ret = device_bind_driver_to_node(dev,
|
||||
"gpio_hog",
|
||||
name, node,
|
||||
&child);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ config ETH_SANDBOX_RAW
|
||||
This driver is a bridge from the bottom of the network stack
|
||||
in U-Boot to the RAW AF_PACKET API in Linux. This allows real
|
||||
network traffic to be tested from within sandbox. See
|
||||
board/sandbox/README.sandbox for more details.
|
||||
doc/arch/index.rst for more details.
|
||||
|
||||
config ETH_DESIGNWARE
|
||||
bool "Synopsys Designware Ethernet MAC"
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "pinctrl-mtk-common.h"
|
||||
|
||||
#if CONFIG_IS_ENABLED(PINCONF)
|
||||
/**
|
||||
* struct mtk_drive_desc - the structure that holds the information
|
||||
* of the driving current
|
||||
@ -39,6 +40,7 @@ static const struct mtk_drive_desc mtk_drive[] = {
|
||||
[DRV_GRP3] = { 2, 8, 2, 2 },
|
||||
[DRV_GRP4] = { 2, 16, 2, 1 },
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char *mtk_pinctrl_dummy_name = "_dummy";
|
||||
|
||||
|
@ -86,6 +86,11 @@ config RTC_RX8010SJ
|
||||
help
|
||||
Support for Epson RX8010SJ Real Time Clock devices.
|
||||
|
||||
config RTC_RX8025
|
||||
bool "Enable RX8025 driver"
|
||||
help
|
||||
Support for Epson RX8025 Real Time Clock devices.
|
||||
|
||||
config RTC_PL031
|
||||
bool "Enable ARM AMBA PL031 RTC driver"
|
||||
help
|
||||
|
@ -10,8 +10,9 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <rtc.h>
|
||||
#include <dm.h>
|
||||
#include <i2c.h>
|
||||
#include <rtc.h>
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#undef DEBUG_RTC
|
||||
@ -27,6 +28,18 @@
|
||||
# define CONFIG_SYS_I2C_RTC_ADDR 0x32
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DM_RTC
|
||||
#define DEV_TYPE struct udevice
|
||||
#else
|
||||
/* Local udevice */
|
||||
struct ludevice {
|
||||
u8 chip;
|
||||
};
|
||||
|
||||
#define DEV_TYPE struct ludevice
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RTC register addresses
|
||||
*/
|
||||
@ -68,21 +81,35 @@
|
||||
*/
|
||||
|
||||
/* static uchar rtc_read (uchar reg); */
|
||||
#ifdef CONFIG_DM_RTC
|
||||
/*
|
||||
* on mpc85xx based board with DM and offset len 1
|
||||
* accessing rtc works fine. May we can drop this ?
|
||||
*/
|
||||
#define rtc_read(reg) buf[(reg) & 0xf]
|
||||
#else
|
||||
#define rtc_read(reg) buf[((reg) + 1) & 0xf]
|
||||
#endif
|
||||
|
||||
static void rtc_write (uchar reg, uchar val);
|
||||
static int rtc_write(DEV_TYPE *dev, uchar reg, uchar val);
|
||||
|
||||
/*
|
||||
* Get the current time from the RTC
|
||||
*/
|
||||
int rtc_get (struct rtc_time *tmp)
|
||||
static int rx8025_rtc_get(DEV_TYPE *dev, struct rtc_time *tmp)
|
||||
{
|
||||
int rel = 0;
|
||||
uchar sec, min, hour, mday, wday, mon, year, ctl2;
|
||||
uchar buf[16];
|
||||
|
||||
if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 0, buf, 16))
|
||||
#ifdef CONFIG_DM_RTC
|
||||
if (dm_i2c_read(dev, 0, buf, sizeof(buf))) {
|
||||
#else
|
||||
if (i2c_read(dev->chip, 0, 0, buf, 16)) {
|
||||
#endif
|
||||
printf("Error reading from RTC\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
sec = rtc_read(RTC_SEC_REG_ADDR);
|
||||
min = rtc_read(RTC_MIN_REG_ADDR);
|
||||
@ -92,9 +119,9 @@ int rtc_get (struct rtc_time *tmp)
|
||||
mon = rtc_read(RTC_MON_REG_ADDR);
|
||||
year = rtc_read(RTC_YR_REG_ADDR);
|
||||
|
||||
DEBUGR ("Get RTC year: %02x mon: %02x mday: %02x wday: %02x "
|
||||
"hr: %02x min: %02x sec: %02x\n",
|
||||
year, mon, mday, wday, hour, min, sec);
|
||||
DEBUGR("Get RTC year: %02x mon: %02x mday: %02x wday: %02x "
|
||||
"hr: %02x min: %02x sec: %02x\n",
|
||||
year, mon, mday, wday, hour, min, sec);
|
||||
|
||||
/* dump status */
|
||||
ctl2 = rtc_read(RTC_CTL2_REG_ADDR);
|
||||
@ -113,13 +140,14 @@ int rtc_get (struct rtc_time *tmp)
|
||||
rel = -1;
|
||||
}
|
||||
|
||||
tmp->tm_sec = bcd2bin (sec & 0x7F);
|
||||
tmp->tm_min = bcd2bin (min & 0x7F);
|
||||
tmp->tm_sec = bcd2bin(sec & 0x7F);
|
||||
tmp->tm_min = bcd2bin(min & 0x7F);
|
||||
if (rtc_read(RTC_CTL1_REG_ADDR) & RTC_CTL1_BIT_2412)
|
||||
tmp->tm_hour = bcd2bin (hour & 0x3F);
|
||||
tmp->tm_hour = bcd2bin(hour & 0x3F);
|
||||
else
|
||||
tmp->tm_hour = bcd2bin (hour & 0x1F) % 12 +
|
||||
tmp->tm_hour = bcd2bin(hour & 0x1F) % 12 +
|
||||
((hour & 0x20) ? 12 : 0);
|
||||
|
||||
tmp->tm_mday = bcd2bin (mday & 0x3F);
|
||||
tmp->tm_mon = bcd2bin (mon & 0x1F);
|
||||
tmp->tm_year = bcd2bin (year) + ( bcd2bin (year) >= 70 ? 1900 : 2000);
|
||||
@ -127,9 +155,9 @@ int rtc_get (struct rtc_time *tmp)
|
||||
tmp->tm_yday = 0;
|
||||
tmp->tm_isdst= 0;
|
||||
|
||||
DEBUGR ("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
|
||||
DEBUGR("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
|
||||
|
||||
return rel;
|
||||
}
|
||||
@ -137,54 +165,142 @@ int rtc_get (struct rtc_time *tmp)
|
||||
/*
|
||||
* Set the RTC
|
||||
*/
|
||||
int rtc_set (struct rtc_time *tmp)
|
||||
static int rx8025_rtc_set(DEV_TYPE *dev, const struct rtc_time *tmp)
|
||||
{
|
||||
DEBUGR ("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
|
||||
DEBUGR("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
|
||||
|
||||
if (tmp->tm_year < 1970 || tmp->tm_year > 2069)
|
||||
printf("WARNING: year should be between 1970 and 2069!\n");
|
||||
|
||||
rtc_write (RTC_YR_REG_ADDR, bin2bcd (tmp->tm_year % 100));
|
||||
rtc_write (RTC_MON_REG_ADDR, bin2bcd (tmp->tm_mon));
|
||||
rtc_write (RTC_DAY_REG_ADDR, bin2bcd (tmp->tm_wday));
|
||||
rtc_write (RTC_DATE_REG_ADDR, bin2bcd (tmp->tm_mday));
|
||||
rtc_write (RTC_HR_REG_ADDR, bin2bcd (tmp->tm_hour));
|
||||
rtc_write (RTC_MIN_REG_ADDR, bin2bcd (tmp->tm_min));
|
||||
rtc_write (RTC_SEC_REG_ADDR, bin2bcd (tmp->tm_sec));
|
||||
if (rtc_write(dev, RTC_YR_REG_ADDR, bin2bcd(tmp->tm_year % 100)))
|
||||
return -EIO;
|
||||
|
||||
rtc_write (RTC_CTL1_REG_ADDR, RTC_CTL1_BIT_2412);
|
||||
if (rtc_write(dev, RTC_MON_REG_ADDR, bin2bcd(tmp->tm_mon)))
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
if (rtc_write(dev, RTC_DAY_REG_ADDR, bin2bcd(tmp->tm_wday)))
|
||||
return -EIO;
|
||||
|
||||
if (rtc_write(dev, RTC_DATE_REG_ADDR, bin2bcd(tmp->tm_mday)))
|
||||
return -EIO;
|
||||
|
||||
if (rtc_write(dev, RTC_HR_REG_ADDR, bin2bcd(tmp->tm_hour)))
|
||||
return -EIO;
|
||||
|
||||
if (rtc_write(dev, RTC_MIN_REG_ADDR, bin2bcd(tmp->tm_min)))
|
||||
return -EIO;
|
||||
|
||||
if (rtc_write(dev, RTC_SEC_REG_ADDR, bin2bcd(tmp->tm_sec)))
|
||||
return -EIO;
|
||||
|
||||
return rtc_write(dev, RTC_CTL1_REG_ADDR, RTC_CTL1_BIT_2412);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the RTC
|
||||
*/
|
||||
void rtc_reset (void)
|
||||
static int rx8025_rtc_reset(DEV_TYPE *dev)
|
||||
{
|
||||
uchar buf[16];
|
||||
uchar ctl2;
|
||||
|
||||
if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 0, buf, 16))
|
||||
#ifdef CONFIG_DM_RTC
|
||||
if (dm_i2c_read(dev, 0, buf, sizeof(buf))) {
|
||||
#else
|
||||
if (i2c_read(dev->chip, 0, 0, buf, 16)) {
|
||||
#endif
|
||||
printf("Error reading from RTC\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ctl2 = rtc_read(RTC_CTL2_REG_ADDR);
|
||||
ctl2 &= ~(RTC_CTL2_BIT_PON | RTC_CTL2_BIT_VDET);
|
||||
ctl2 |= RTC_CTL2_BIT_XST | RTC_CTL2_BIT_VDSL;
|
||||
rtc_write (RTC_CTL2_REG_ADDR, ctl2);
|
||||
|
||||
return rtc_write(dev, RTC_CTL2_REG_ADDR, ctl2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper functions
|
||||
*/
|
||||
static void rtc_write (uchar reg, uchar val)
|
||||
static int rtc_write(DEV_TYPE *dev, uchar reg, uchar val)
|
||||
{
|
||||
uchar buf[2];
|
||||
buf[0] = reg << 4;
|
||||
buf[1] = val;
|
||||
if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 0, buf, 2) != 0)
|
||||
printf("Error writing to RTC\n");
|
||||
|
||||
#ifdef CONFIG_DM_RTC
|
||||
if (dm_i2c_write(dev, 0, buf, 2)) {
|
||||
#else
|
||||
if (i2c_write(dev->chip, 0, 0, buf, 2) != 0) {
|
||||
#endif
|
||||
printf("Error writing to RTC\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DM_RTC
|
||||
static int rx8025_probe(struct udevice *dev)
|
||||
{
|
||||
uchar buf[16];
|
||||
int ret = 0;
|
||||
|
||||
if (i2c_get_chip_offset_len(dev) != 1)
|
||||
ret = i2c_set_chip_offset_len(dev, 1);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return dm_i2c_read(dev, 0, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
static const struct rtc_ops rx8025_rtc_ops = {
|
||||
.get = rx8025_rtc_get,
|
||||
.set = rx8025_rtc_set,
|
||||
.reset = rx8025_rtc_reset,
|
||||
};
|
||||
|
||||
static const struct udevice_id rx8025_rtc_ids[] = {
|
||||
{ .compatible = "epson,rx8025" },
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(rx8010sj_rtc) = {
|
||||
.name = "rx8025_rtc",
|
||||
.id = UCLASS_RTC,
|
||||
.probe = rx8025_probe,
|
||||
.of_match = rx8025_rtc_ids,
|
||||
.ops = &rx8025_rtc_ops,
|
||||
};
|
||||
#else
|
||||
int rtc_get(struct rtc_time *tm)
|
||||
{
|
||||
struct ludevice dev = {
|
||||
.chip = CONFIG_SYS_I2C_RTC_ADDR,
|
||||
};
|
||||
|
||||
return rx8025_rtc_get(&dev, tm);
|
||||
}
|
||||
|
||||
int rtc_set(struct rtc_time *tm)
|
||||
{
|
||||
struct ludevice dev = {
|
||||
.chip = CONFIG_SYS_I2C_RTC_ADDR,
|
||||
};
|
||||
|
||||
return rx8025_rtc_set(&dev, tm);
|
||||
}
|
||||
|
||||
void rtc_reset(void)
|
||||
{
|
||||
struct ludevice dev = {
|
||||
.chip = CONFIG_SYS_I2C_RTC_ADDR,
|
||||
};
|
||||
|
||||
rx8025_rtc_reset(&dev);
|
||||
}
|
||||
#endif
|
||||
|
@ -352,9 +352,10 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc);
|
||||
* gpio_hog_lookup_name() - Look up a named GPIO and return the gpio descr.
|
||||
*
|
||||
* @name: Name to look up
|
||||
* @return: Returns gpio_desc for gpio
|
||||
* @desc: Returns GPIO description, on success, else NULL
|
||||
* @return: Returns 0 if OK, else -ENODEV
|
||||
*/
|
||||
struct gpio_desc *gpio_hog_lookup_name(const char *name);
|
||||
int gpio_hog_lookup_name(const char *name, struct gpio_desc **desc);
|
||||
|
||||
/**
|
||||
* gpio_hog_probe_all() - probe all gpio devices with
|
||||
@ -523,12 +524,13 @@ int gpio_request_list_by_name_nodev(ofnode node, const char *list_name,
|
||||
* gpio_dev_request_index() - request single GPIO from gpio device
|
||||
*
|
||||
* @dev: GPIO device
|
||||
* @nodename: Name of node
|
||||
* @nodename: Name of node for which gpio gets requested, used
|
||||
* for the gpio label name
|
||||
* @list_name: Name of GPIO list (e.g. "board-id-gpios")
|
||||
* @index: Index number of the GPIO in that list use request (0=first)
|
||||
* @flags: GPIOD_* flags
|
||||
* @dtflags: GPIO flags read from DT
|
||||
* @desc: GPIO descriotor filled from this function
|
||||
* @dtflags: GPIO flags read from DT defined see GPIOD_*
|
||||
* @desc: returns GPIO descriptor filled from this function
|
||||
* @return: return value from gpio_request_tail()
|
||||
*/
|
||||
int gpio_dev_request_index(struct udevice *dev, const char *nodename,
|
||||
|
@ -59,23 +59,6 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
|
||||
|
||||
void arch_preboot_os(void);
|
||||
|
||||
/**
|
||||
* bootm_decomp_image() - decompress the operating system
|
||||
*
|
||||
* @comp: Compression algorithm that is used (IH_COMP_...)
|
||||
* @load: Destination load address in U-Boot memory
|
||||
* @image_start Image start address (where we are decompressing from)
|
||||
* @type: OS type (IH_OS_...)
|
||||
* @load_bug: Place to decompress to
|
||||
* @image_buf: Address to decompress from
|
||||
* @image_len: Number of bytes in @image_buf to decompress
|
||||
* @unc_len: Available space for decompression
|
||||
* @return 0 if OK, -ve on error (BOOTM_ERR_...)
|
||||
*/
|
||||
int bootm_decomp_image(int comp, ulong load, ulong image_start, int type,
|
||||
void *load_buf, void *image_buf, ulong image_len,
|
||||
uint unc_len, ulong *load_end);
|
||||
|
||||
/*
|
||||
* boards should define this to disable devices when EFI exits from boot
|
||||
* services.
|
||||
|
@ -225,7 +225,6 @@
|
||||
*/
|
||||
#define CONFIG_SYS_RTC_BUS_NUM 0x01
|
||||
#define CONFIG_SYS_I2C_RTC_ADDR 0x32
|
||||
#define CONFIG_RTC_RX8025
|
||||
|
||||
/* Pass Ethernet MAC to VxWorks */
|
||||
#define CONFIG_SYS_VXWORKS_MAC_PTR 0x000043f0
|
||||
|
55
include/configs/pumpkin.h
Normal file
55
include/configs/pumpkin.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* Configuration for Pumpkin board
|
||||
*
|
||||
* Copyright (C) 2019 BayLibre, SAS
|
||||
* Author: Fabien Parent <fparent@baylibre.com
|
||||
*/
|
||||
|
||||
#ifndef __PUMPKIN_H
|
||||
#define __PUMPKIN_H
|
||||
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#define CONFIG_ENV_SIZE SZ_4K
|
||||
#define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_SYS_MALLOC_LEN SZ_4M
|
||||
|
||||
#define CONFIG_CPU_ARMV8
|
||||
#define COUNTER_FREQUENCY 13000000
|
||||
|
||||
#define CONFIG_SYS_NS16550_SERIAL
|
||||
#define CONFIG_SYS_NS16550_REG_SIZE -4
|
||||
#define CONFIG_SYS_NS16550_MEM32
|
||||
#define CONFIG_SYS_NS16550_COM1 0x11005000
|
||||
#define CONFIG_SYS_NS16550_CLK 26000000
|
||||
|
||||
#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + SZ_2M - \
|
||||
GENERATED_GBL_DATA_SIZE)
|
||||
|
||||
#define CONFIG_SYS_BOOTM_LEN SZ_64M
|
||||
|
||||
/* Environment settings */
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
#define MMCBOOT \
|
||||
"mmcdev=0\0" \
|
||||
"kernel_partition=2\0" \
|
||||
"rootfs_partition=3\0" \
|
||||
"mmc_discover_partition=" \
|
||||
"part start mmc ${mmcdev} ${kernel_partition} kernel_part_addr;" \
|
||||
"part size mmc ${mmcdev} ${kernel_partition} kernel_part_size;\0" \
|
||||
"mmcboot=" \
|
||||
"mmc dev ${mmcdev};" \
|
||||
"run mmc_discover_partition;" \
|
||||
"mmc read ${kerneladdr} ${kernel_part_addr} ${kernel_part_size};" \
|
||||
"setenv bootargs ${bootargs} root=/dev/mmcblk${mmcdev}p${rootfs_partition} rootwait; " \
|
||||
"bootm ${kerneladdr}; \0"
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"kerneladdr=0x4A000000\0" \
|
||||
MMCBOOT \
|
||||
"bootcmd=run mmcboot;\0"
|
||||
|
||||
#endif
|
@ -187,7 +187,6 @@
|
||||
#define CONFIG_SYS_FSL_I2C2_OFFSET 0x3100
|
||||
|
||||
/* I2C RTC */
|
||||
#define CONFIG_RTC_RX8025 /* Use Epson rx8025 rtc via i2c */
|
||||
#define CONFIG_SYS_I2C_RTC_ADDR 0x32 /* at address 0x32 */
|
||||
|
||||
/* I2C W83782G HW-Monitoring IC */
|
||||
|
@ -225,7 +225,6 @@
|
||||
*/
|
||||
#define CONFIG_SYS_RTC_BUS_NUM 0x01
|
||||
#define CONFIG_SYS_I2C_RTC_ADDR 0x32
|
||||
#define CONFIG_RTC_RX8025
|
||||
|
||||
/* Pass Ethernet MAC to VxWorks */
|
||||
#define CONFIG_SYS_VXWORKS_MAC_PTR 0x000043f0
|
||||
|
@ -849,6 +849,23 @@ static inline int image_check_target_arch(const image_header_t *hdr)
|
||||
}
|
||||
#endif /* USE_HOSTCC */
|
||||
|
||||
/**
|
||||
* image_decomp() - decompress an image
|
||||
*
|
||||
* @comp: Compression algorithm that is used (IH_COMP_...)
|
||||
* @load: Destination load address in U-Boot memory
|
||||
* @image_start Image start address (where we are decompressing from)
|
||||
* @type: OS type (IH_OS_...)
|
||||
* @load_bug: Place to decompress to
|
||||
* @image_buf: Address to decompress from
|
||||
* @image_len: Number of bytes in @image_buf to decompress
|
||||
* @unc_len: Available space for decompression
|
||||
* @return 0 if OK, -ve on error (BOOTM_ERR_...)
|
||||
*/
|
||||
int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||
void *load_buf, void *image_buf, ulong image_len,
|
||||
uint unc_len, ulong *load_end);
|
||||
|
||||
/**
|
||||
* Set up properties in the FDT
|
||||
*
|
||||
|
14
lib/uuid.c
14
lib/uuid.c
@ -240,25 +240,25 @@ void uuid_bin_to_str(unsigned char *uuid_bin, char *uuid_str, int str_format)
|
||||
#if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID)
|
||||
void gen_rand_uuid(unsigned char *uuid_bin)
|
||||
{
|
||||
struct uuid uuid;
|
||||
unsigned int *ptr = (unsigned int *)&uuid;
|
||||
u32 ptr[4];
|
||||
struct uuid *uuid = (struct uuid *)ptr;
|
||||
int i;
|
||||
|
||||
srand(get_ticks() + rand());
|
||||
|
||||
/* Set all fields randomly */
|
||||
for (i = 0; i < sizeof(struct uuid) / sizeof(*ptr); i++)
|
||||
*(ptr + i) = cpu_to_be32(rand());
|
||||
for (i = 0; i < 4; i++)
|
||||
ptr[i] = rand();
|
||||
|
||||
clrsetbits_be16(&uuid.time_hi_and_version,
|
||||
clrsetbits_be16(&uuid->time_hi_and_version,
|
||||
UUID_VERSION_MASK,
|
||||
UUID_VERSION << UUID_VERSION_SHIFT);
|
||||
|
||||
clrsetbits_8(&uuid.clock_seq_hi_and_reserved,
|
||||
clrsetbits_8(&uuid->clock_seq_hi_and_reserved,
|
||||
UUID_VARIANT_MASK,
|
||||
UUID_VARIANT << UUID_VARIANT_SHIFT);
|
||||
|
||||
memcpy(uuid_bin, &uuid, sizeof(struct uuid));
|
||||
memcpy(uuid_bin, uuid, 16);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1552,7 +1552,6 @@ CONFIG_RTC_MCP79411
|
||||
CONFIG_RTC_MXS
|
||||
CONFIG_RTC_PCF8563
|
||||
CONFIG_RTC_PT7C4338
|
||||
CONFIG_RTC_RX8025
|
||||
CONFIG_RUN_FROM_DDR0
|
||||
CONFIG_RUN_FROM_DDR1
|
||||
CONFIG_RUN_FROM_IRAM_ONLY
|
||||
|
@ -471,15 +471,15 @@ static int run_bootm_test(struct unit_test_state *uts, int comp_type,
|
||||
unc_len = strlen(plain);
|
||||
compress(uts, (void *)plain, unc_len, compress_buff, compress_size,
|
||||
&compress_size);
|
||||
err = bootm_decomp_image(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, unc_len,
|
||||
&load_end);
|
||||
err = image_decomp(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, unc_len,
|
||||
&load_end);
|
||||
ut_assertok(err);
|
||||
err = bootm_decomp_image(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, unc_len - 1,
|
||||
&load_end);
|
||||
err = image_decomp(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, unc_len - 1,
|
||||
&load_end);
|
||||
ut_assert(err);
|
||||
|
||||
/* We can't detect corruption when not decompressing */
|
||||
@ -487,10 +487,10 @@ static int run_bootm_test(struct unit_test_state *uts, int comp_type,
|
||||
return 0;
|
||||
memset(compress_buff + compress_size / 2, '\x49',
|
||||
compress_size / 2);
|
||||
err = bootm_decomp_image(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, 0x10000,
|
||||
&load_end);
|
||||
err = image_decomp(comp_type, load_addr, image_start,
|
||||
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
|
||||
compress_buff, compress_size, 0x10000,
|
||||
&load_end);
|
||||
ut_assert(err);
|
||||
|
||||
return 0;
|
||||
|
@ -24,7 +24,7 @@ base_its = '''
|
||||
type = "kernel";
|
||||
arch = "sandbox";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
compression = "%(compression)s";
|
||||
load = <0x40000>;
|
||||
entry = <0x8>;
|
||||
};
|
||||
@ -39,11 +39,11 @@ base_its = '''
|
||||
};
|
||||
fdt@1 {
|
||||
description = "snow";
|
||||
data = /incbin/("u-boot.dtb");
|
||||
data = /incbin/("%(fdt)s");
|
||||
type = "flat_dt";
|
||||
arch = "sandbox";
|
||||
%(fdt_load)s
|
||||
compression = "none";
|
||||
compression = "%(compression)s";
|
||||
signature@1 {
|
||||
algo = "sha1,rsa2048";
|
||||
key-name-hint = "dev";
|
||||
@ -56,7 +56,7 @@ base_its = '''
|
||||
arch = "sandbox";
|
||||
os = "linux";
|
||||
%(ramdisk_load)s
|
||||
compression = "none";
|
||||
compression = "%(compression)s";
|
||||
};
|
||||
ramdisk@2 {
|
||||
description = "snow";
|
||||
@ -221,6 +221,10 @@ def test_fit(u_boot_console):
|
||||
print(data, file=fd)
|
||||
return fname
|
||||
|
||||
def make_compressed(filename):
|
||||
util.run_and_log(cons, ['gzip', '-f', '-k', filename])
|
||||
return filename + '.gz'
|
||||
|
||||
def find_matching(text, match):
|
||||
"""Find a match in a line of text, and return the unmatched line portion
|
||||
|
||||
@ -312,6 +316,7 @@ def test_fit(u_boot_console):
|
||||
loadables1 = make_kernel('test-loadables1.bin', 'lenrek')
|
||||
loadables2 = make_ramdisk('test-loadables2.bin', 'ksidmar')
|
||||
kernel_out = make_fname('kernel-out.bin')
|
||||
fdt = make_fname('u-boot.dtb')
|
||||
fdt_out = make_fname('fdt-out.dtb')
|
||||
ramdisk_out = make_fname('ramdisk-out.bin')
|
||||
loadables1_out = make_fname('loadables1-out.bin')
|
||||
@ -326,6 +331,7 @@ def test_fit(u_boot_console):
|
||||
'kernel_addr' : 0x40000,
|
||||
'kernel_size' : filesize(kernel),
|
||||
|
||||
'fdt' : fdt,
|
||||
'fdt_out' : fdt_out,
|
||||
'fdt_addr' : 0x80000,
|
||||
'fdt_size' : filesize(control_dtb),
|
||||
@ -351,6 +357,7 @@ def test_fit(u_boot_console):
|
||||
'loadables2_load' : '',
|
||||
|
||||
'loadables_config' : '',
|
||||
'compression' : 'none',
|
||||
}
|
||||
|
||||
# Make a basic FIT and a script to load it
|
||||
@ -417,6 +424,20 @@ def test_fit(u_boot_console):
|
||||
check_equal(loadables2, loadables2_out,
|
||||
'Loadables2 (ramdisk) not loaded')
|
||||
|
||||
# Kernel, FDT and Ramdisk all compressed
|
||||
with cons.log.section('(Kernel + FDT + Ramdisk) compressed'):
|
||||
params['compression'] = 'gzip'
|
||||
params['kernel'] = make_compressed(kernel)
|
||||
params['fdt'] = make_compressed(fdt)
|
||||
params['ramdisk'] = make_compressed(ramdisk)
|
||||
fit = make_fit(mkimage, params)
|
||||
cons.restart_uboot()
|
||||
output = cons.run_command_list(cmd.splitlines())
|
||||
check_equal(kernel, kernel_out, 'Kernel not loaded')
|
||||
check_equal(control_dtb, fdt_out, 'FDT not loaded')
|
||||
check_equal(ramdisk, ramdisk_out, 'Ramdisk not loaded')
|
||||
|
||||
|
||||
cons = u_boot_console
|
||||
try:
|
||||
# We need to use our own device tree file. Remember to restore it
|
||||
|
@ -85,13 +85,6 @@
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,0)">
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0"
|
||||
id="rect31"
|
||||
width="186"
|
||||
height="186"
|
||||
x="0"
|
||||
y="0" />
|
||||
<circle
|
||||
style="fill:#004466;fill-opacity:1;stroke-width:0;stroke:none"
|
||||
id="path835"
|
||||
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.8 KiB |
Loading…
Reference in New Issue
Block a user