I have an Atmel ICE and I wrote my own programmer for SAMD21, among others.
I don't know the SAMD4.
For some STM32F you can just pull reset down, get your IDR, put your DHCSR in debug/halt and release reset.
The SAMD21 won't even tell you the IDR if the reset is held.
You need to electrically release reset.
If you reset with SWDCLK low that is a "cold reset", with it high it is a "warm reset".
I do a cold reset first, program, then a warm reset to finish off.
I'm not saying that I understand this all, but it works for me.
Then there is the "release reset" that you can send to the DSU too.
I'm not using that right now.