Skip to content

Commit 2c8602e

Browse files
Joakim NohlgårdFreddieChopin
authored andcommitted
flash Kinetis: Add support for newer KW series
Add support for flashing newer members of the NXP Kinetis KW family Supported devices: - KW20Z - KW30Z - KW40Z - KW21Z - KW31Z - KW41Z The earlier KW2xD and KW01Z devices are already supported by the code for the older K-series. Verified working on the FRDM-KW41Z development board. Tested flashing both via GDB `load` and directly via OpenOCD flash write commands. Change-Id: I73eae477127a8b54a33005b3b526b5439450a808 Signed-off-by: Joakim Nohlgård <[email protected]> Reviewed-on: http://openocd.zylin.com/4104 Tested-by: jenkins Reviewed-by: Johann Fischer <[email protected]> Reviewed-by: Tomas Vanek <[email protected]>
1 parent 8dcb91f commit 2c8602e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/flash/nor/kinetis.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,45 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
22102210
familyid, subfamid, cpu_mhz / 10);
22112211
break;
22122212

2213+
case KINETIS_SDID_SERIESID_KW:
2214+
/* Newer KW-series (all KW series except KW2xD, KW01Z) */
2215+
cpu_mhz = 48;
2216+
switch (k_chip->sim_sdid & (KINETIS_SDID_FAMILYID_MASK | KINETIS_SDID_SUBFAMID_MASK)) {
2217+
case KINETIS_SDID_FAMILYID_K4X | KINETIS_SDID_SUBFAMID_KX0:
2218+
/* KW40Z */
2219+
case KINETIS_SDID_FAMILYID_K3X | KINETIS_SDID_SUBFAMID_KX0:
2220+
/* KW30Z */
2221+
case KINETIS_SDID_FAMILYID_K2X | KINETIS_SDID_SUBFAMID_KX0:
2222+
/* KW20Z */
2223+
/* FTFA, 1kB sectors */
2224+
k_chip->pflash_sector_size = 1<<10;
2225+
k_chip->nvm_sector_size = 1<<10;
2226+
/* autodetect 1 or 2 blocks */
2227+
k_chip->flash_support = FS_PROGRAM_LONGWORD;
2228+
k_chip->cache_type = KINETIS_CACHE_L;
2229+
k_chip->watchdog_type = KINETIS_WDOG_COP;
2230+
break;
2231+
case KINETIS_SDID_FAMILYID_K4X | KINETIS_SDID_SUBFAMID_KX1:
2232+
/* KW41Z */
2233+
case KINETIS_SDID_FAMILYID_K3X | KINETIS_SDID_SUBFAMID_KX1:
2234+
/* KW31Z */
2235+
case KINETIS_SDID_FAMILYID_K2X | KINETIS_SDID_SUBFAMID_KX1:
2236+
/* KW21Z */
2237+
/* FTFA, 2kB sectors */
2238+
k_chip->pflash_sector_size = 2<<10;
2239+
k_chip->nvm_sector_size = 2<<10;
2240+
/* autodetect 1 or 2 blocks */
2241+
k_chip->flash_support = FS_PROGRAM_LONGWORD;
2242+
k_chip->cache_type = KINETIS_CACHE_L;
2243+
k_chip->watchdog_type = KINETIS_WDOG_COP;
2244+
break;
2245+
default:
2246+
LOG_ERROR("Unsupported KW FAMILYID SUBFAMID");
2247+
}
2248+
snprintf(name, sizeof(name), "MKW%u%uZ%%s%u",
2249+
familyid, subfamid, cpu_mhz / 10);
2250+
break;
2251+
22132252
case KINETIS_SDID_SERIESID_KV:
22142253
/* KV-series */
22152254
k_chip->watchdog_type = KINETIS_WDOG_K;

0 commit comments

Comments
 (0)