mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
Merge git://git.denx.de/u-boot-dm
This commit is contained in:
commit
d5c6144fe3
21 changed files with 138 additions and 43 deletions
|
@ -43,7 +43,7 @@ static int create_func_list(int argc, char * const argv[])
|
||||||
err = trace_list_functions(buff + buff_ptr, avail, &needed);
|
err = trace_list_functions(buff + buff_ptr, avail, &needed);
|
||||||
if (err)
|
if (err)
|
||||||
printf("Error: truncated (%#x bytes needed)\n", needed);
|
printf("Error: truncated (%#x bytes needed)\n", needed);
|
||||||
used = min(avail, needed);
|
used = min(avail, (size_t)needed);
|
||||||
printf("Function trace dumped to %08lx, size %#zx\n",
|
printf("Function trace dumped to %08lx, size %#zx\n",
|
||||||
(ulong)map_to_sysmem(buff + buff_ptr), used);
|
(ulong)map_to_sysmem(buff + buff_ptr), used);
|
||||||
setenv_hex("profbase", map_to_sysmem(buff));
|
setenv_hex("profbase", map_to_sysmem(buff));
|
||||||
|
@ -67,7 +67,7 @@ static int create_call_list(int argc, char * const argv[])
|
||||||
err = trace_list_calls(buff + buff_ptr, avail, &needed);
|
err = trace_list_calls(buff + buff_ptr, avail, &needed);
|
||||||
if (err)
|
if (err)
|
||||||
printf("Error: truncated (%#x bytes needed)\n", needed);
|
printf("Error: truncated (%#x bytes needed)\n", needed);
|
||||||
used = min(avail, needed);
|
used = min(avail, (size_t)needed);
|
||||||
printf("Call list dumped to %08lx, size %#zx\n",
|
printf("Call list dumped to %08lx, size %#zx\n",
|
||||||
(ulong)map_to_sysmem(buff + buff_ptr), used);
|
(ulong)map_to_sysmem(buff + buff_ptr), used);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include <post.h>
|
#include <post.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#include <status_led.h>
|
#include <status_led.h>
|
||||||
|
#include <timer.h>
|
||||||
#include <trace.h>
|
#include <trace.h>
|
||||||
#include <video.h>
|
#include <video.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
|
@ -805,6 +806,11 @@ static int initf_dm(void)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_TIMER_EARLY
|
||||||
|
ret = dm_timer_init();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#include <stdio_dev.h>
|
#include <stdio_dev.h>
|
||||||
|
#include <timer.h>
|
||||||
#include <trace.h>
|
#include <trace.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#ifdef CONFIG_CMD_AMBAPP
|
#ifdef CONFIG_CMD_AMBAPP
|
||||||
|
@ -312,13 +313,22 @@ static int initr_noncached(void)
|
||||||
#ifdef CONFIG_DM
|
#ifdef CONFIG_DM
|
||||||
static int initr_dm(void)
|
static int initr_dm(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Save the pre-reloc driver model and start a new one */
|
/* Save the pre-reloc driver model and start a new one */
|
||||||
gd->dm_root_f = gd->dm_root;
|
gd->dm_root_f = gd->dm_root;
|
||||||
gd->dm_root = NULL;
|
gd->dm_root = NULL;
|
||||||
#ifdef CONFIG_TIMER
|
ret = dm_init_and_scan(false);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
#ifdef CONFIG_TIMER_EARLY
|
||||||
gd->timer = NULL;
|
gd->timer = NULL;
|
||||||
|
ret = dm_timer_init();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
return dm_init_and_scan(false);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||||
images.ep += images.os.load;
|
images.ep += images.os.load;
|
||||||
}
|
}
|
||||||
|
|
||||||
images.os.start = (ulong)os_hdr;
|
images.os.start = map_to_sysmem(os_hdr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,6 +851,11 @@ static int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulong fit_get_end(const void *fit)
|
||||||
|
{
|
||||||
|
return map_to_sysmem((void *)(fit + fdt_totalsize(fit)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fit_set_timestamp - set node timestamp property
|
* fit_set_timestamp - set node timestamp property
|
||||||
* @fit: pointer to the FIT format image header
|
* @fit: pointer to the FIT format image header
|
||||||
|
@ -1030,10 +1035,15 @@ int fit_image_verify(const void *fit, int image_noffset)
|
||||||
strlen(FIT_SIG_NODENAME))) {
|
strlen(FIT_SIG_NODENAME))) {
|
||||||
ret = fit_image_check_sig(fit, noffset, data,
|
ret = fit_image_check_sig(fit, noffset, data,
|
||||||
size, -1, &err_msg);
|
size, -1, &err_msg);
|
||||||
if (ret) {
|
|
||||||
|
/*
|
||||||
|
* Show an indication on failure, but do not return
|
||||||
|
* an error. Only keys marked 'required' can cause
|
||||||
|
* an image validation failure. See the call to
|
||||||
|
* fit_image_verify_required_sigs() above.
|
||||||
|
*/
|
||||||
|
if (ret)
|
||||||
puts("- ");
|
puts("- ");
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
puts("+ ");
|
puts("+ ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
CONFIG_SYS_MALLOC_F_LEN=0x2000
|
CONFIG_SYS_MALLOC_F_LEN=0x2000
|
||||||
CONFIG_PCI=y
|
CONFIG_PCI=y
|
||||||
CONFIG_DEFAULT_DEVICE_TREE="sandbox"
|
CONFIG_DEFAULT_DEVICE_TREE="sandbox"
|
||||||
CONFIG_DM_PCI_COMPAT=y
|
|
||||||
CONFIG_FIT=y
|
CONFIG_FIT=y
|
||||||
CONFIG_FIT_VERBOSE=y
|
CONFIG_FIT_VERBOSE=y
|
||||||
CONFIG_FIT_SIGNATURE=y
|
CONFIG_FIT_SIGNATURE=y
|
||||||
|
CONFIG_BOOTSTAGE=y
|
||||||
|
CONFIG_BOOTSTAGE_REPORT=y
|
||||||
|
CONFIG_CONSOLE_RECORD=y
|
||||||
|
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
||||||
# CONFIG_CMD_ELF is not set
|
# CONFIG_CMD_ELF is not set
|
||||||
# CONFIG_CMD_IMLS is not set
|
# CONFIG_CMD_IMLS is not set
|
||||||
# CONFIG_CMD_FLASH is not set
|
# CONFIG_CMD_FLASH is not set
|
||||||
|
@ -12,14 +15,10 @@ CONFIG_CMD_REMOTEPROC=y
|
||||||
CONFIG_CMD_GPIO=y
|
CONFIG_CMD_GPIO=y
|
||||||
# CONFIG_CMD_SETEXPR is not set
|
# CONFIG_CMD_SETEXPR is not set
|
||||||
CONFIG_CMD_SOUND=y
|
CONFIG_CMD_SOUND=y
|
||||||
CONFIG_BOOTSTAGE=y
|
|
||||||
CONFIG_BOOTSTAGE_REPORT=y
|
|
||||||
CONFIG_CMD_PMIC=y
|
CONFIG_CMD_PMIC=y
|
||||||
CONFIG_CMD_REGULATOR=y
|
CONFIG_CMD_REGULATOR=y
|
||||||
CONFIG_CMD_TPM=y
|
CONFIG_CMD_TPM=y
|
||||||
CONFIG_CMD_TPM_TEST=y
|
CONFIG_CMD_TPM_TEST=y
|
||||||
CONFIG_CONSOLE_RECORD=y
|
|
||||||
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
|
|
||||||
CONFIG_OF_CONTROL=y
|
CONFIG_OF_CONTROL=y
|
||||||
CONFIG_OF_HOSTFILE=y
|
CONFIG_OF_HOSTFILE=y
|
||||||
CONFIG_REGMAP=y
|
CONFIG_REGMAP=y
|
||||||
|
@ -52,6 +51,7 @@ CONFIG_SPI_FLASH_SST=y
|
||||||
CONFIG_SPI_FLASH_WINBOND=y
|
CONFIG_SPI_FLASH_WINBOND=y
|
||||||
CONFIG_DM_ETH=y
|
CONFIG_DM_ETH=y
|
||||||
CONFIG_DM_PCI=y
|
CONFIG_DM_PCI=y
|
||||||
|
CONFIG_DM_PCI_COMPAT=y
|
||||||
CONFIG_PCI_SANDBOX=y
|
CONFIG_PCI_SANDBOX=y
|
||||||
CONFIG_PINCTRL=y
|
CONFIG_PINCTRL=y
|
||||||
CONFIG_PINCONF=y
|
CONFIG_PINCONF=y
|
||||||
|
@ -68,6 +68,7 @@ CONFIG_SOUND=y
|
||||||
CONFIG_SOUND_SANDBOX=y
|
CONFIG_SOUND_SANDBOX=y
|
||||||
CONFIG_SANDBOX_SPI=y
|
CONFIG_SANDBOX_SPI=y
|
||||||
CONFIG_TIMER=y
|
CONFIG_TIMER=y
|
||||||
|
CONFIG_TIMER_EARLY=y
|
||||||
CONFIG_SANDBOX_TIMER=y
|
CONFIG_SANDBOX_TIMER=y
|
||||||
CONFIG_TPM_TIS_SANDBOX=y
|
CONFIG_TPM_TIS_SANDBOX=y
|
||||||
CONFIG_USB=y
|
CONFIG_USB=y
|
||||||
|
|
|
@ -142,13 +142,15 @@ static int sandbox_sf_probe(struct udevice *dev)
|
||||||
if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
|
if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
|
||||||
spec = state->spi[bus->seq][cs].spec;
|
spec = state->spi[bus->seq][cs].spec;
|
||||||
if (!spec) {
|
if (!spec) {
|
||||||
|
debug("%s: No spec found for bus %d, cs %d\n",
|
||||||
|
__func__, bus->seq, cs);
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = strchr(spec, ':');
|
file = strchr(spec, ':');
|
||||||
if (!file) {
|
if (!file) {
|
||||||
printf("sandbox_sf: unable to parse file\n");
|
printf("%s: unable to parse file\n", __func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +176,7 @@ static int sandbox_sf_probe(struct udevice *dev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!data->name) {
|
if (!data->name) {
|
||||||
printf("sandbox_sf: unknown flash '%*s'\n", (int)idname_len,
|
printf("%s: unknown flash '%*s'\n", __func__, (int)idname_len,
|
||||||
spec);
|
spec);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -185,8 +187,7 @@ static int sandbox_sf_probe(struct udevice *dev)
|
||||||
|
|
||||||
sbsf->fd = os_open(pdata->filename, 02);
|
sbsf->fd = os_open(pdata->filename, 02);
|
||||||
if (sbsf->fd == -1) {
|
if (sbsf->fd == -1) {
|
||||||
free(sbsf);
|
printf("%s: unable to open file '%s'\n", __func__,
|
||||||
printf("sandbox_sf: unable to open file '%s'\n",
|
|
||||||
pdata->filename);
|
pdata->filename);
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -553,6 +554,9 @@ static int sandbox_cmdline_cb_spi_sf(struct sandbox_state *state,
|
||||||
* yet. Perhaps we can figure something out.
|
* yet. Perhaps we can figure something out.
|
||||||
*/
|
*/
|
||||||
state->spi[bus][cs].spec = spec;
|
state->spi[bus][cs].spec = spec;
|
||||||
|
debug("%s: Setting up spec '%s' for bus %ld, cs %ld\n", __func__,
|
||||||
|
spec, bus, cs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SANDBOX_CMDLINE_OPT(spi_sf, 1, "connect a SPI flash: <bus>:<cs>:<id>:<file>");
|
SANDBOX_CMDLINE_OPT(spi_sf, 1, "connect a SPI flash: <bus>:<cs>:<id>:<file>");
|
||||||
|
@ -671,6 +675,8 @@ int dm_scan_other(bool pre_reloc_only)
|
||||||
__func__, busnum, cs);
|
__func__, busnum, cs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
debug("%s: Setting up spec '%s' for bus %d, cs %d\n",
|
||||||
|
__func__, spec, busnum, cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,8 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = spi_flash_scan(flash);
|
ret = spi_flash_scan(flash);
|
||||||
if (ret) {
|
if (ret)
|
||||||
ret = -EINVAL;
|
|
||||||
goto err_read_id;
|
goto err_read_id;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_SPI_FLASH_MTD
|
#ifdef CONFIG_SPI_FLASH_MTD
|
||||||
ret = spi_flash_mtd_register(flash);
|
ret = spi_flash_mtd_register(flash);
|
||||||
|
|
|
@ -989,7 +989,7 @@ int spi_flash_scan(struct spi_flash *flash)
|
||||||
ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
|
ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("SF: Failed to get idcodes\n");
|
printf("SF: Failed to get idcodes\n");
|
||||||
return -EINVAL;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -30,7 +30,7 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
|
||||||
u8 header_type;
|
u8 header_type;
|
||||||
int rom_addr;
|
int rom_addr;
|
||||||
pci_addr_t bar_value;
|
pci_addr_t bar_value;
|
||||||
struct pci_region *bar_res;
|
struct pci_region *bar_res = NULL;
|
||||||
int found_mem64 = 0;
|
int found_mem64 = 0;
|
||||||
u16 class;
|
u16 class;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,16 @@ config TIMER
|
||||||
will be used. The timer is usually a 32 bits free-running up
|
will be used. The timer is usually a 32 bits free-running up
|
||||||
counter. There may be no real tick, and no timer interrupt.
|
counter. There may be no real tick, and no timer interrupt.
|
||||||
|
|
||||||
|
config TIMER_EARLY
|
||||||
|
bool "Allow timer to be used early in U-Boot"
|
||||||
|
depends on TIMER
|
||||||
|
help
|
||||||
|
In some cases the timer must be accessible before driver model is
|
||||||
|
active. Examples include when using CONFIG_TRACE to trace U-Boot's
|
||||||
|
execution before driver model is set up. Enable this option to
|
||||||
|
use an early timer. These functions must be supported by your timer
|
||||||
|
driver: timer_early_get_count() and timer_early_get_rate().
|
||||||
|
|
||||||
config ALTERA_TIMER
|
config ALTERA_TIMER
|
||||||
bool "Altera timer support"
|
bool "Altera timer support"
|
||||||
depends on TIMER
|
depends on TIMER
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include <os.h>
|
#include <os.h>
|
||||||
|
|
||||||
|
#define SANDBOX_TIMER_RATE 1000000
|
||||||
|
|
||||||
/* system timer offset in ms */
|
/* system timer offset in ms */
|
||||||
static unsigned long sandbox_timer_offset;
|
static unsigned long sandbox_timer_offset;
|
||||||
|
|
||||||
|
@ -18,9 +20,19 @@ void sandbox_timer_add_offset(unsigned long offset)
|
||||||
sandbox_timer_offset += offset;
|
sandbox_timer_offset += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sandbox_timer_get_count(struct udevice *dev, u64 *count)
|
u64 notrace timer_early_get_count(void)
|
||||||
{
|
{
|
||||||
*count = os_get_nsec() / 1000 + sandbox_timer_offset * 1000;
|
return os_get_nsec() / 1000 + sandbox_timer_offset * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long notrace timer_early_get_rate(void)
|
||||||
|
{
|
||||||
|
return SANDBOX_TIMER_RATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static notrace int sandbox_timer_get_count(struct udevice *dev, u64 *count)
|
||||||
|
{
|
||||||
|
*count = timer_early_get_count();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +42,7 @@ static int sandbox_timer_probe(struct udevice *dev)
|
||||||
struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||||
|
|
||||||
if (!uc_priv->clock_rate)
|
if (!uc_priv->clock_rate)
|
||||||
uc_priv->clock_rate = 1000000;
|
uc_priv->clock_rate = SANDBOX_TIMER_RATE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
* tick, and no timer interrupt.
|
* tick, and no timer interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int timer_get_count(struct udevice *dev, u64 *count)
|
int notrace timer_get_count(struct udevice *dev, u64 *count)
|
||||||
{
|
{
|
||||||
const struct timer_ops *ops = device_get_ops(dev);
|
const struct timer_ops *ops = device_get_ops(dev);
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ int timer_get_count(struct udevice *dev, u64 *count)
|
||||||
return ops->get_count(dev, count);
|
return ops->get_count(dev, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long timer_get_rate(struct udevice *dev)
|
unsigned long notrace timer_get_rate(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
struct timer_dev_priv *uc_priv = dev->uclass_priv;
|
||||||
|
|
||||||
return uc_priv->clock_rate;
|
return uc_priv->clock_rate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -818,10 +818,7 @@ static inline ulong fit_get_size(const void *fit)
|
||||||
* returns:
|
* returns:
|
||||||
* end address of the FIT image (blob) in memory
|
* end address of the FIT image (blob) in memory
|
||||||
*/
|
*/
|
||||||
static inline ulong fit_get_end(const void *fit)
|
ulong fit_get_end(const void *fit);
|
||||||
{
|
|
||||||
return (ulong)fit + fdt_totalsize(fit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fit_get_name - get FIT node name
|
* fit_get_name - get FIT node name
|
||||||
|
|
|
@ -67,4 +67,25 @@ struct timer_dev_priv {
|
||||||
unsigned long clock_rate;
|
unsigned long clock_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timer_early_get_count() - Implement timer_get_count() before driver model
|
||||||
|
*
|
||||||
|
* If CONFIG_TIMER_EARLY is enabled, this function wil be called to return
|
||||||
|
* the current timer value before the proper driver model timer is ready.
|
||||||
|
* It should be implemented by one of the timer values. This is mostly useful
|
||||||
|
* for tracing.
|
||||||
|
*/
|
||||||
|
u64 timer_early_get_count(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timer_early_get_rate() - Get the timer rate before driver model
|
||||||
|
*
|
||||||
|
* If CONFIG_TIMER_EARLY is enabled, this function wil be called to return
|
||||||
|
* the current timer rate in Hz before the proper driver model timer is ready.
|
||||||
|
* It should be implemented by one of the timer values. This is mostly useful
|
||||||
|
* for tracing. This corresponds to the clock_rate value in struct
|
||||||
|
* timer_dev_priv.
|
||||||
|
*/
|
||||||
|
unsigned long timer_early_get_rate(void);
|
||||||
|
|
||||||
#endif /* _TIMER_H_ */
|
#endif /* _TIMER_H_ */
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
|
|
||||||
#include <div64.h>
|
#include <div64.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/compiler.h>
|
||||||
|
|
||||||
uint32_t __div64_32(uint64_t *n, uint32_t base)
|
uint32_t notrace __div64_32(uint64_t *n, uint32_t base)
|
||||||
{
|
{
|
||||||
uint64_t rem = *n;
|
uint64_t rem = *n;
|
||||||
uint64_t b = base;
|
uint64_t b = base;
|
||||||
|
|
28
lib/time.c
28
lib/time.c
|
@ -43,11 +43,17 @@ extern unsigned long __weak timer_read_counter(void);
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
ulong notrace get_tbclk(void)
|
ulong notrace get_tbclk(void)
|
||||||
{
|
{
|
||||||
int ret;
|
if (!gd->timer) {
|
||||||
|
#ifdef CONFIG_TIMER_EARLY
|
||||||
|
return timer_early_get_rate();
|
||||||
|
#else
|
||||||
|
int ret;
|
||||||
|
|
||||||
ret = dm_timer_init();
|
ret = dm_timer_init();
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return timer_get_rate(gd->timer);
|
return timer_get_rate(gd->timer);
|
||||||
}
|
}
|
||||||
|
@ -57,9 +63,17 @@ uint64_t notrace get_ticks(void)
|
||||||
u64 count;
|
u64 count;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = dm_timer_init();
|
if (!gd->timer) {
|
||||||
if (ret)
|
#ifdef CONFIG_TIMER_EARLY
|
||||||
return ret;
|
return timer_early_get_count();
|
||||||
|
#else
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = dm_timer_init();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ret = timer_get_count(gd->timer, &count);
|
ret = timer_get_count(gd->timer, &count);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -27,8 +27,8 @@ obj-y += regmap.o
|
||||||
obj-$(CONFIG_REMOTEPROC) += remoteproc.o
|
obj-$(CONFIG_REMOTEPROC) += remoteproc.o
|
||||||
obj-$(CONFIG_RESET) += reset.o
|
obj-$(CONFIG_RESET) += reset.o
|
||||||
obj-$(CONFIG_DM_RTC) += rtc.o
|
obj-$(CONFIG_DM_RTC) += rtc.o
|
||||||
#obj-$(CONFIG_DM_SPI_FLASH) += sf.o
|
obj-$(CONFIG_DM_SPI_FLASH) += sf.o
|
||||||
#obj-$(CONFIG_DM_SPI) += spi.o
|
obj-$(CONFIG_DM_SPI) += spi.o
|
||||||
obj-y += syscon.o
|
obj-y += syscon.o
|
||||||
obj-$(CONFIG_DM_USB) += usb.o
|
obj-$(CONFIG_DM_USB) += usb.o
|
||||||
obj-$(CONFIG_DM_PMIC) += pmic.o
|
obj-$(CONFIG_DM_PMIC) += pmic.o
|
||||||
|
|
|
@ -108,6 +108,10 @@ base_fdt = '''
|
||||||
model = "Sandbox Verified Boot Test";
|
model = "Sandbox Verified Boot Test";
|
||||||
compatible = "sandbox";
|
compatible = "sandbox";
|
||||||
|
|
||||||
|
reset@0 {
|
||||||
|
compatible = "sandbox,reset";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,9 @@ check_results() {
|
||||||
# between calls 2 and 3, where tracing is paused.
|
# between calls 2 and 3, where tracing is paused.
|
||||||
# This code gets the sign of the difference between each number and
|
# This code gets the sign of the difference between each number and
|
||||||
# its predecessor.
|
# its predecessor.
|
||||||
counts="$(tr -d , <${tmp} | awk '/traced function calls/ { diff = $1 - upto; upto = $1; printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
|
counts="$(tr -d ',\r' <${tmp} | awk \
|
||||||
|
'/traced function calls/ { diff = $1 - upto; upto = $1; \
|
||||||
|
printf "%d ", diff < 0 ? -1 : (diff > 0 ? 1 : 0)}')"
|
||||||
|
|
||||||
if [ "${counts}" != "1 1 0 1 " ]; then
|
if [ "${counts}" != "1 1 0 1 " ]; then
|
||||||
fail "trace collection error: ${counts}"
|
fail "trace collection error: ${counts}"
|
||||||
|
|
|
@ -4,4 +4,7 @@
|
||||||
model = "Sandbox Verified Boot Test";
|
model = "Sandbox Verified Boot Test";
|
||||||
compatible = "sandbox";
|
compatible = "sandbox";
|
||||||
|
|
||||||
|
reset@0 {
|
||||||
|
compatible = "sandbox,reset";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue