adiv6: add dap flags -adiv5 and -adiv6 56/6456/5
authorKevin Burke <kevinb@os.amperecomputing.com>
Fri, 6 Aug 2021 13:01:34 +0000 (15:01 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 24 Jun 2022 21:34:30 +0000 (21:34 +0000)
Add flags to 'dap create' command and set the field adi_version
in struct adiv5_dap.

Actually only ADIv5 is functional. Other patches are needed to get
ADIv6 working.

Split from change https://review.openocd.org/6077/

Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6456
Tested-by: jenkins
doc/openocd.texi
src/target/arm_adi_v5.h
src/target/arm_dap.c

index 85be06ea676d47f0d2b86ac5d94fe9c4ea34572a..e8535b7a14fef97ef60f48305986fd63e96bfe32 100644 (file)
@@ -4646,8 +4646,12 @@ There can only be one DAP for each JTAG tap in the system.
 A DAP may also provide optional @var{configparams}:
 
 @itemize @bullet
 A DAP may also provide optional @var{configparams}:
 
 @itemize @bullet
+@item @code{-adiv5}
+Specify that it's an ADIv5 DAP. This is the default if not specified.
+@item @code{-adiv6}
+Specify that it's an ADIv6 DAP.
 @item @code{-ignore-syspwrupack}
 @item @code{-ignore-syspwrupack}
-@*Specify this to ignore the CSYSPWRUPACK bit in the ARM DAP DP CTRL/STAT
+Specify this to ignore the CSYSPWRUPACK bit in the ARM DAP DP CTRL/STAT
 register during initial examination and when checking the sticky error bit.
 This bit is normally checked after setting the CSYSPWRUPREQ bit, but some
 devices do not set the ack bit until sometime later.
 register during initial examination and when checking the sticky error bit.
 This bit is normally checked after setting the CSYSPWRUPREQ bit, but some
 devices do not set the ack bit until sometime later.
index c7ffe7b31347f5c6a891934995b6fad856f1b401..d7824cedf30950e125811120f9e68c801555e8e9 100644 (file)
@@ -353,6 +353,9 @@ struct adiv5_dap {
         * Record if enter in SWD required passing through DORMANT
         */
        bool switch_through_dormant;
         * Record if enter in SWD required passing through DORMANT
         */
        bool switch_through_dormant;
+
+       /** Indicates ADI version (5, 6 or 0 for unknown) being used */
+       unsigned int adi_version;
 };
 
 /**
 };
 
 /**
@@ -426,6 +429,18 @@ static inline bool is_64bit_ap(struct adiv5_ap *ap)
        return (ap->cfg_reg & MEM_AP_REG_CFG_LA) != 0;
 }
 
        return (ap->cfg_reg & MEM_AP_REG_CFG_LA) != 0;
 }
 
+/**
+ * Check if DAP is ADIv6
+ *
+ * @param dap The DAP to test
+ *
+ * @return true for ADIv6, false for either ADIv5 or unknown version
+ */
+static inline bool is_adiv6(const struct adiv5_dap *dap)
+{
+       return dap->adi_version == 6;
+}
+
 /**
  * Send an adi-v5 sequence to the DAP.
  *
 /**
  * Send an adi-v5 sequence to the DAP.
  *
index 46e054e69578745a30d30d66d57322ce328583ad..59d577e7f0407cfe2b8a45a80950ad3936dc723f 100644 (file)
@@ -129,6 +129,14 @@ static int dap_init_all(void)
                } else
                        dap->ops = &jtag_dp_ops;
 
                } else
                        dap->ops = &jtag_dp_ops;
 
+               if (dap->adi_version == 0) {
+                       LOG_DEBUG("DAP %s configured by default to use ADIv5 protocol", jtag_tap_name(dap->tap));
+                       dap->adi_version = 5;
+               } else {
+                       LOG_DEBUG("DAP %s configured to use %s protocol by user cfg file", jtag_tap_name(dap->tap),
+                               is_adiv6(dap) ? "ADIv6" : "ADIv5");
+               }
+
                retval = dap->ops->connect(dap);
                if (retval != ERROR_OK)
                        return retval;
                retval = dap->ops->connect(dap);
                if (retval != ERROR_OK)
                        return retval;
@@ -163,6 +171,8 @@ enum dap_cfg_param {
        CFG_IGNORE_SYSPWRUPACK,
        CFG_DP_ID,
        CFG_INSTANCE_ID,
        CFG_IGNORE_SYSPWRUPACK,
        CFG_DP_ID,
        CFG_INSTANCE_ID,
+       CFG_ADIV6,
+       CFG_ADIV5,
 };
 
 static const struct jim_nvp nvp_config_opts[] = {
 };
 
 static const struct jim_nvp nvp_config_opts[] = {
@@ -170,6 +180,8 @@ static const struct jim_nvp nvp_config_opts[] = {
        { .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
        { .name = "-dp-id",              .value = CFG_DP_ID },
        { .name = "-instance-id",        .value = CFG_INSTANCE_ID },
        { .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
        { .name = "-dp-id",              .value = CFG_DP_ID },
        { .name = "-instance-id",        .value = CFG_INSTANCE_ID },
+       { .name = "-adiv6",              .value = CFG_ADIV6 },
+       { .name = "-adiv5",              .value = CFG_ADIV5 },
        { .name = NULL, .value = -1 }
 };
 
        { .name = NULL, .value = -1 }
 };
 
@@ -249,6 +261,12 @@ static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap
                        dap->dap.multidrop_instance_id_valid = true;
                        break;
                }
                        dap->dap.multidrop_instance_id_valid = true;
                        break;
                }
+               case CFG_ADIV6:
+                       dap->dap.adi_version = 6;
+                       break;
+               case CFG_ADIV5:
+                       dap->dap.adi_version = 5;
+                       break;
                default:
                        break;
                }
                default:
                        break;
                }

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)