diff options
author | Tom Rini <trini@konsulko.com> | 2016-02-26 16:22:28 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-02-26 16:22:28 -0500 |
commit | d5c6144fe326e255e42ec273fc5d88f45cd61548 (patch) | |
tree | 470446ad6c9d5580b0ff778d5adc77ee05f6e1b8 /drivers | |
parent | 38e65aeb70b72132c0d2ec0ed389f7fc8b7bdf4c (diff) | |
parent | 6796704b0dfb4f98cb4a026988e9739884812b5c (diff) | |
download | u-boot-imx-d5c6144fe326e255e42ec273fc5d88f45cd61548.zip u-boot-imx-d5c6144fe326e255e42ec273fc5d88f45cd61548.tar.gz u-boot-imx-d5c6144fe326e255e42ec273fc5d88f45cd61548.tar.bz2 |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/spi/sandbox.c | 14 | ||||
-rw-r--r-- | drivers/mtd/spi/sf_probe.c | 4 | ||||
-rw-r--r-- | drivers/mtd/spi/spi_flash.c | 2 | ||||
-rw-r--r-- | drivers/pci/pci_auto.c | 2 | ||||
-rw-r--r-- | drivers/timer/Kconfig | 10 | ||||
-rw-r--r-- | drivers/timer/sandbox_timer.c | 18 | ||||
-rw-r--r-- | drivers/timer/timer-uclass.c | 6 |
7 files changed, 41 insertions, 15 deletions
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 895604d..53470b9 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -142,13 +142,15 @@ static int sandbox_sf_probe(struct udevice *dev) if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS) spec = state->spi[bus->seq][cs].spec; if (!spec) { + debug("%s: No spec found for bus %d, cs %d\n", + __func__, bus->seq, cs); ret = -ENOENT; goto error; } file = strchr(spec, ':'); if (!file) { - printf("sandbox_sf: unable to parse file\n"); + printf("%s: unable to parse file\n", __func__); ret = -EINVAL; goto error; } @@ -174,7 +176,7 @@ static int sandbox_sf_probe(struct udevice *dev) break; } if (!data->name) { - printf("sandbox_sf: unknown flash '%*s'\n", (int)idname_len, + printf("%s: unknown flash '%*s'\n", __func__, (int)idname_len, spec); ret = -EINVAL; goto error; @@ -185,8 +187,7 @@ static int sandbox_sf_probe(struct udevice *dev) sbsf->fd = os_open(pdata->filename, 02); if (sbsf->fd == -1) { - free(sbsf); - printf("sandbox_sf: unable to open file '%s'\n", + printf("%s: unable to open file '%s'\n", __func__, pdata->filename); ret = -EIO; goto error; @@ -553,6 +554,9 @@ static int sandbox_cmdline_cb_spi_sf(struct sandbox_state *state, * yet. Perhaps we can figure something out. */ state->spi[bus][cs].spec = spec; + debug("%s: Setting up spec '%s' for bus %ld, cs %ld\n", __func__, + spec, bus, cs); + return 0; } 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); return ret; } + debug("%s: Setting up spec '%s' for bus %d, cs %d\n", + __func__, spec, busnum, cs); } } } diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index daa1d5b..7b29637 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -42,10 +42,8 @@ static int spi_flash_probe_slave(struct spi_flash *flash) } ret = spi_flash_scan(flash); - if (ret) { - ret = -EINVAL; + if (ret) goto err_read_id; - } #ifdef CONFIG_SPI_FLASH_MTD ret = spi_flash_mtd_register(flash); diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 3c365d5..2ae2e3c 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -989,7 +989,7 @@ int spi_flash_scan(struct spi_flash *flash) ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode)); if (ret) { printf("SF: Failed to get idcodes\n"); - return -EINVAL; + return ret; } #ifdef DEBUG diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 88bc416..ee9a854 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -30,7 +30,7 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num, u8 header_type; int rom_addr; pci_addr_t bar_value; - struct pci_region *bar_res; + struct pci_region *bar_res = NULL; int found_mem64 = 0; u16 class; diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index ff65a73..cb18f12 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -9,6 +9,16 @@ config TIMER will be used. The timer is usually a 32 bits free-running up 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 bool "Altera timer support" depends on TIMER diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c index a8da936..6a6411a 100644 --- a/drivers/timer/sandbox_timer.c +++ b/drivers/timer/sandbox_timer.c @@ -10,6 +10,8 @@ #include <timer.h> #include <os.h> +#define SANDBOX_TIMER_RATE 1000000 + /* system timer offset in ms */ static unsigned long sandbox_timer_offset; @@ -18,9 +20,19 @@ void sandbox_timer_add_offset(unsigned long offset) sandbox_timer_offset += offset; } -static int sandbox_timer_get_count(struct udevice *dev, u64 *count) +u64 notrace timer_early_get_count(void) +{ + 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 = os_get_nsec() / 1000 + sandbox_timer_offset * 1000; + *count = timer_early_get_count(); 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); if (!uc_priv->clock_rate) - uc_priv->clock_rate = 1000000; + uc_priv->clock_rate = SANDBOX_TIMER_RATE; return 0; } diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 83d1a35..382c0f2 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; * 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); @@ -32,9 +32,9 @@ int timer_get_count(struct udevice *dev, u64 *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; } |