]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/dfu/dfu_nand.c
armv8/fsl-lsch3: Add support to load and start MC Firmware
[karo-tx-uboot.git] / drivers / dfu / dfu_nand.c
index edbf5a97b9001a84cd93570884f6aee5372cdc96..ccdbef6b75f26fe78fe5fc52438d797bad5b3b46 100644 (file)
@@ -121,6 +121,7 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, u64 offset, void *buf,
 
        switch (dfu->layout) {
        case DFU_RAW_ADDR:
+               *len = dfu->data.nand.size;
                ret = nand_block_read(dfu, offset, buf, len);
                break;
        default:
@@ -162,6 +163,18 @@ static int dfu_flush_medium_nand(struct dfu_entity *dfu)
        return ret;
 }
 
+unsigned int dfu_polltimeout_nand(struct dfu_entity *dfu)
+{
+       /*
+        * Currently, Poll Timeout != 0 is only needed on nand
+        * ubi partition, as the not used sectors need an erase
+        */
+       if (dfu->data.nand.ubi)
+               return DFU_MANIFEST_POLL_TIMEOUT;
+
+       return DFU_DEFAULT_POLL_TIMEOUT;
+}
+
 int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
 {
        char *st;
@@ -210,6 +223,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
        dfu->read_medium = dfu_read_medium_nand;
        dfu->write_medium = dfu_write_medium_nand;
        dfu->flush_medium = dfu_flush_medium_nand;
+       dfu->poll_timeout = dfu_polltimeout_nand;
 
        /* initial state */
        dfu->inited = 0;