-#define KINETIS_SDID_FAMID_MASK 0x00000070
-#define KINETIS_SDID_FAMID_K10 0x00000000
-#define KINETIS_SDID_FAMID_K12 0x00000000
-#define KINETIS_SDID_FAMID_K20 0x00000010
-#define KINETIS_SDID_FAMID_K22 0x00000010
-#define KINETIS_SDID_FAMID_K30 0x00000020
-#define KINETIS_SDID_FAMID_K11 0x00000020
-#define KINETIS_SDID_FAMID_K61 0x00000020
-#define KINETIS_SDID_FAMID_K40 0x00000030
-#define KINETIS_SDID_FAMID_K21 0x00000030
-#define KINETIS_SDID_FAMID_K60 0x00000040
-#define KINETIS_SDID_FAMID_K62 0x00000040
-#define KINETIS_SDID_FAMID_K70 0x00000050
-#define KINETIS_SDID_FAMID_KW24 0x00000060
+/* The Kinetis K series uses the following SDID layout :
+ * Bit 31-16 : 0
+ * Bit 15-12 : REVID
+ * Bit 11-7 : DIEID
+ * Bit 6-4 : FAMID
+ * Bit 3-0 : PINID
+ *
+ * The Kinetis KL series uses the following SDID layout :
+ * Bit 31-28 : FAMID
+ * Bit 27-24 : SUBFAMID
+ * Bit 23-20 : SERIESID
+ * Bit 19-16 : SRAMSIZE
+ * Bit 15-12 : REVID
+ * Bit 6-4 : Reserved (0)
+ * Bit 3-0 : PINID
+ *
+ * SERIESID should be 1 for the KL-series so we assume that if
+ * bits 31-16 are 0 then it's a K-series MCU.
+ */
+
+#define KINETIS_SDID_K_SERIES_MASK 0x0000FFFF
+
+#define KINETIS_SDID_DIEID_MASK 0x00000F80
+#define KINETIS_SDID_DIEID_K_A 0x00000100
+#define KINETIS_SDID_DIEID_K_B 0x00000200
+#define KINETIS_SDID_DIEID_KL 0x00000000
+
+/* We can't rely solely on the FAMID field to determine the MCU
+ * type since some FAMID values identify multiple MCUs with
+ * different flash sector sizes (K20 and K22 for instance).
+ * Therefore we combine it with the DIEID bits which may possibly
+ * break if Freescale bumps the DIEID for a particular MCU. */
+#define KINETIS_K_SDID_TYPE_MASK 0x00000FF0
+#define KINETIS_K_SDID_K10 0x00000000
+#define KINETIS_K_SDID_K11 0x00000220
+#define KINETIS_K_SDID_K12 0x00000200
+#define KINETIS_K_SDID_K20 0x00000290
+#define KINETIS_K_SDID_K21 0x00000230
+#define KINETIS_K_SDID_K22 0x00000210
+#define KINETIS_K_SDID_K30 0x00000120
+#define KINETIS_K_SDID_K40 0x00000130
+#define KINETIS_K_SDID_K50 0x000000E0
+#define KINETIS_K_SDID_K51 0x000000F0
+#define KINETIS_K_SDID_K53 0x00000170
+#define KINETIS_K_SDID_K60 0x000001C0
+#define KINETIS_K_SDID_K70 0x000001D0
+
+#define KINETIS_KL_SDID_SERIESID_MASK 0x00F00000
+#define KINETIS_KL_SDID_SERIESID_KL 0x00100000