- Fix devicetree address determination seen on QEMU ARM64 - Use DMA for reads is available
This commit is contained in:
commit
a58d86db46
@ -219,8 +219,8 @@ int dma_get_device(u32 transfer_type, struct udevice **devp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
pr_err("No DMA device found that supports %x type\n",
|
pr_debug("No DMA device found that supports %x type\n",
|
||||||
transfer_type);
|
transfer_type);
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2468,29 +2468,17 @@ unsigned long flash_init(void)
|
|||||||
#ifdef CONFIG_CFI_FLASH /* for driver model */
|
#ifdef CONFIG_CFI_FLASH /* for driver model */
|
||||||
static int cfi_flash_probe(struct udevice *dev)
|
static int cfi_flash_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
const fdt32_t *cell;
|
fdt_addr_t addr;
|
||||||
int addrc, sizec;
|
int idx;
|
||||||
int len, idx;
|
|
||||||
|
|
||||||
addrc = dev_read_addr_cells(dev);
|
for (idx = 0; idx < CFI_MAX_FLASH_BANKS; idx++) {
|
||||||
sizec = dev_read_size_cells(dev);
|
addr = dev_read_addr_index(dev, idx);
|
||||||
|
if (addr == FDT_ADDR_T_NONE)
|
||||||
/* decode regs; there may be multiple reg tuples. */
|
break;
|
||||||
cell = dev_read_prop(dev, "reg", &len);
|
|
||||||
if (!cell)
|
|
||||||
return -ENOENT;
|
|
||||||
idx = 0;
|
|
||||||
len /= sizeof(fdt32_t);
|
|
||||||
while (idx < len) {
|
|
||||||
phys_addr_t addr;
|
|
||||||
|
|
||||||
addr = dev_translate_address(dev, cell + idx);
|
|
||||||
|
|
||||||
flash_info[cfi_flash_num_flash_banks].dev = dev;
|
flash_info[cfi_flash_num_flash_banks].dev = dev;
|
||||||
flash_info[cfi_flash_num_flash_banks].base = addr;
|
flash_info[cfi_flash_num_flash_banks].base = addr;
|
||||||
cfi_flash_num_flash_banks++;
|
cfi_flash_num_flash_banks++;
|
||||||
|
|
||||||
idx += addrc + sizec;
|
|
||||||
}
|
}
|
||||||
gd->bd->bi_flashstart = flash_info[0].base;
|
gd->bd->bi_flashstart = flash_info[0].base;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <dma.h>
|
||||||
#include <flash.h>
|
#include <flash.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
|
|||||||
flash_info_t *fi = mtd->priv;
|
flash_info_t *fi = mtd->priv;
|
||||||
u_char *f = (u_char*)(fi->start[0]) + from;
|
u_char *f = (u_char*)(fi->start[0]) + from;
|
||||||
|
|
||||||
memcpy(buf, f, len);
|
if (dma_memcpy(buf, f, len) < 0)
|
||||||
|
memcpy(buf, f, len);
|
||||||
*retlen = len;
|
*retlen = len;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user