stm32l flash: add another device ID90/1790/2
authorAndrey Yurovsky <yurovsky@gmail.com>
Fri, 1 Nov 2013 21:29:17 +0000 (1 14:29 -0700)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 6 Nov 2013 13:06:49 +0000 (6 13:06 +0000)
Add device ID 0x437, a dual-bank part with 512KB total.  This one used
the Medium+/HD flash size register to read the flash size in Kb rather
than the 0/1 code in the Medium+ parts.

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Change-Id: I870fe3bb1b473939b7211c3b2edb44b4b3643648
Reviewed-on: http://openocd.zylin.com/1790
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/flash/nor/stm32lx.c

index b1c8eca..b8b5306 100644 (file)
@@ -550,6 +550,12 @@ static int stm32lx_probe(struct flash_bank *bank)
                first_bank_size_in_kb = 192;
                stm32lx_info->has_dual_banks = true;
                break;
+       case 0x437:
+               /* Dual bank, high density */
+               max_flash_size_in_kb = 512;
+               first_bank_size_in_kb = 192;
+               stm32lx_info->has_dual_banks = true;
+               break;
        default:
                LOG_WARNING("Cannot identify target as a STM32L family.");
                return ERROR_FAIL;
@@ -558,7 +564,8 @@ static int stm32lx_probe(struct flash_bank *bank)
        /* Get the flash size from target.  0x427 and 0x436 devices use a
         * different location for the Flash Size register, please see RM0038 r8 or
         * newer. */
-       if ((device_id & 0xfff) == 0x427 || (device_id & 0xfff) == 0x436)
+       if ((device_id & 0xfff) == 0x427 || (device_id & 0xfff) == 0x436 ||
+               (device_id & 0xfff) == 0x437)
                        retval = target_read_u16(target, F_SIZE_MP, &flash_size_in_kb);
        else
                        retval = target_read_u16(target, F_SIZE, &flash_size_in_kb);
@@ -779,6 +786,10 @@ static int stm32lx_get_info(struct flash_bank *bank, char *buf, int buf_size)
                }
                break;
 
+       case 0x437:
+               device_str = "STM32L1xx (Medium+/High Density)";
+               break;
+
        default:
                snprintf(buf, buf_size, "Cannot identify target as a STM32L1");
                return ERROR_FAIL;