aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/stm32f1x.c7
-rw-r--r--src/flash/nor/stm32f2x.c7
-rw-r--r--src/flash/nor/stm32lx.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 17df121b..13affcda 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -956,6 +956,13 @@ static int stm32x_probe(struct flash_bank *bank)
}
}
+ /* if the user sets the size manually then ignore the probed value
+ * this allows us to work around devices that have a invalid flash size register value */
+ if (bank->size) {
+ LOG_INFO("ignoring flash probed value, using configured bank size");
+ flash_size_in_kb = bank->size / 1024;
+ }
+
LOG_INFO("flash size = %dkbytes", flash_size_in_kb);
/* did we assign flash size? */
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index 7a4352fd..1d59e3c0 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -791,6 +791,13 @@ static int stm32x_probe(struct flash_bank *bank)
flash_size_in_kb = max_flash_size_in_kb;
}
+ /* if the user sets the size manually then ignore the probed value
+ * this allows us to work around devices that have a invalid flash size register value */
+ if (bank->size) {
+ LOG_INFO("ignoring flash probed value, using configured bank size");
+ flash_size_in_kb = bank->size / 1024;
+ }
+
LOG_INFO("flash size = %dkbytes", flash_size_in_kb);
/* did we assign flash size? */
diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index ebc7534e..f871a361 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -552,6 +552,13 @@ static int stm32lx_probe(struct flash_bank *bank)
flash_size_in_kb = max_flash_size_in_kb;
}
+ /* if the user sets the size manually then ignore the probed value
+ * this allows us to work around devices that have a invalid flash size register value */
+ if (bank->size) {
+ LOG_INFO("ignoring flash probed value, using configured bank size");
+ flash_size_in_kb = bank->size / 1024;
+ }
+
/* STM32L - we have 32 sectors, 16 pages per sector -> 512 pages
* 16 pages for a protection area */