diff options
| author | Tom Rini <[email protected]> | 2017-04-13 17:31:06 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2017-04-13 17:31:06 -0400 |
| commit | b7b24a7a3cd74bb165d28a2959ed9143e3648fbf (patch) | |
| tree | 062fd13092cee10dc8746a1339ecea18f08d21d6 /drivers/core | |
| parent | 1622559066d890f1b7622be0ede8a5d64de66ef3 (diff) | |
| parent | 22e10be456014400788f80d45fc5f5c0b9d4a81d (diff) | |
Merge git://git.denx.de/u-boot-dm
Here with some DM changes as well as the long-standing AT91 DM/DT
conversion patches which I have picked up via dm.
Diffstat (limited to 'drivers/core')
| -rw-r--r-- | drivers/core/device.c | 30 | ||||
| -rw-r--r-- | drivers/core/uclass.c | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index e1b0ebffc55..09a115f753d 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -255,8 +255,36 @@ static void *alloc_priv(int size, uint flags) if (flags & DM_FLAG_ALLOC_PRIV_DMA) { priv = memalign(ARCH_DMA_MINALIGN, size); - if (priv) + if (priv) { memset(priv, '\0', size); + + /* + * Ensure that the zero bytes are flushed to memory. + * This prevents problems if the driver uses this as + * both an input and an output buffer: + * + * 1. Zeroes written to buffer (here) and sit in the + * cache + * 2. Driver issues a read command to DMA + * 3. CPU runs out of cache space and evicts some cache + * data in the buffer, writing zeroes to RAM from + * the memset() above + * 4. DMA completes + * 5. Buffer now has some DMA data and some zeroes + * 6. Data being read is now incorrect + * + * To prevent this, ensure that the cache is clean + * within this range at the start. The driver can then + * use normal flush-after-write, invalidate-before-read + * procedures. + * + * TODO([email protected]): Drop this microblaze + * exception. + */ +#ifndef CONFIG_MICROBLAZE + flush_dcache_range((ulong)priv, (ulong)priv + size); +#endif + } } else { priv = calloc(1, size); } diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index d94d43a98d2..04fb45b01a5 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -250,7 +250,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq, return ret; list_for_each_entry(dev, &uc->dev_head, uclass_node) { - debug(" - %d %d\n", dev->req_seq, dev->seq); + debug(" - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name); if ((find_req_seq ? dev->req_seq : dev->seq) == seq_or_req_seq) { *devp = dev; |
