flash: at91samd: add SAML21 support, fix part ID issue 90/2690/2
authorAndrey Yurovsky <yurovsky@gmail.com>
Mon, 30 Mar 2015 19:50:13 +0000 (12:50 -0700)
committerPaul Fertser <fercerpav@gmail.com>
Thu, 16 Apr 2015 19:30:34 +0000 (20:30 +0100)
This adds support for the new Atmel SAML21 family of low-power Cortex
M0+ devices.  Their Flash controller is essentially the SAMDxx one so
the change consists of adding the new part IDs.  Unfortunately the
device ID logic had a couple of mistakes in it that did not affect
anything on SAMD2x devices (due to 0 values expected there) but that is
a problem on L21, it's therefore addressed here and things should now
match the datasheets.

Tested on Amtel SAML21 Xplained Pro development kit against the included
SAML21J18A there.  Also tested for regressions on a SAMD20 and SAMD21
using their dev kits.

Change-Id: I768f75e064b8656c15148730dacaa4c3acfc4101
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2690
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
src/flash/nor/at91samd.c
tcl/board/atmel_saml21_xplained_pro.cfg [new file with mode: 0644]

index e80cf92f76dba7aa82b160829c742aec678c68bc..ddca13755c901c16bdfd9a330d59c96145a6d88b 100644 (file)
@@ -63,6 +63,7 @@
 /* Known identifiers */
 #define SAMD_PROCESSOR_M0      0x01
 #define SAMD_FAMILY_D          0x00
+#define SAMD_FAMILY_L          0x01
 #define SAMD_SERIES_20         0x00
 #define SAMD_SERIES_21         0x01
 #define SAMD_SERIES_10         0x02
@@ -149,6 +150,19 @@ static const struct samd_part samr21_parts[] = {
        { 0x1E, "SAMR21E16A",  64, 32 },
 };
 
+/* Known SAML21 parts. */
+static const struct samd_part saml21_parts[] = {
+       { 0x00, "SAML21J18A", 256, 32 },
+       { 0x01, "SAML21J17A", 128, 16 },
+       { 0x02, "SAML21J16A", 64, 8 },
+       { 0x05, "SAML21G18A", 256, 32 },
+       { 0x06, "SAML21G17A", 128, 16 },
+       { 0x07, "SAML21G16A", 64, 8 },
+       { 0x0A, "SAML21E18A", 256, 32 },
+       { 0x0B, "SAML21E17A", 128, 16 },
+       { 0x0C, "SAML21E16A", 64, 8 },
+       { 0x0D, "SAML21E15A", 32, 4 },
+};
 
 /* Each family of parts contains a parts table in the DEVSEL field of DID.  The
  * processor ID, family ID, and series ID are used to determine which exact
@@ -173,6 +187,8 @@ static const struct samd_family samd_families[] = {
                samd10_parts, ARRAY_SIZE(samd10_parts) },
        { SAMD_PROCESSOR_M0, SAMD_FAMILY_D, SAMD_SERIES_11,
                samd11_parts, ARRAY_SIZE(samd11_parts) },
+       { SAMD_PROCESSOR_M0, SAMD_FAMILY_L, SAMD_SERIES_21,
+               saml21_parts, ARRAY_SIZE(saml21_parts) },
 };
 
 struct samd_info {
@@ -190,8 +206,8 @@ static struct samd_info *samd_chips;
 static const struct samd_part *samd_find_part(uint32_t id)
 {
        uint8_t processor = (id >> 28);
-       uint8_t family = (id >> 24) & 0x0F;
-       uint8_t series = (id >> 16) & 0xFF;
+       uint8_t family = (id >> 23) & 0x1F;
+       uint8_t series = (id >> 16) & 0x3F;
        uint8_t devsel = id & 0xFF;
 
        for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) {
diff --git a/tcl/board/atmel_saml21_xplained_pro.cfg b/tcl/board/atmel_saml21_xplained_pro.cfg
new file mode 100644 (file)
index 0000000..054bda4
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# Atmel SAML21 Xplained Pro evaluation kit.
+#
+
+source [find interface/cmsis-dap.cfg]
+
+# chip name
+set CHIPNAME at91saml21j18
+
+source [find target/at91samdXX.cfg]

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)