summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-10-14 09:28:07 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2019-10-31 12:12:31 +0100
commit067c13c70bfb99d25979b989870ed39eab34659a (patch)
treeac28778dda9f3b986f8cbc227d519d9df1d9b5cd /drivers
parentec44cace4b8d23556924550fe76bf2744eb91144 (diff)
downloadu-boot-067c13c70bfb99d25979b989870ed39eab34659a.tar.gz
dfu: add callback for flush and initiated operation
Add weak callback to allow board specific behavior - flush - initiated This patch prepare usage of DFU back end for communication with STM32CubeProgrammer on stm32mp1 platform with stm32prog command. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dfu/dfu.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 2697235c24..38aecd3a05 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -23,6 +23,22 @@ static int alt_num_cnt;
static struct hash_algo *dfu_hash_algo;
/*
+ * The purpose of the dfu_flush_callback() function is to
+ * provide callback for dfu user
+ */
+__weak void dfu_flush_callback(struct dfu_entity *dfu)
+{
+}
+
+/*
+ * The purpose of the dfu_initiated_callback() function is to
+ * provide callback for dfu user
+ */
+__weak void dfu_initiated_callback(struct dfu_entity *dfu)
+{
+}
+
+/*
* The purpose of the dfu_usb_get_reset() function is to
* provide information if after USB_DETACH request
* being sent the dfu-util performed reset of USB
@@ -263,6 +279,7 @@ int dfu_transaction_initiate(struct dfu_entity *dfu, bool read)
}
dfu->inited = 1;
+ dfu_initiated_callback(dfu);
return 0;
}
@@ -282,6 +299,8 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
printf("\nDFU complete %s: 0x%08x\n", dfu_hash_algo->name,
dfu->crc);
+ dfu_flush_callback(dfu);
+
dfu_transaction_cleanup(dfu);
return ret;