Enabling JTAG on Beaglebone Classic (White) with newer kernels


I’ve been trying to get JTAG working on the Beaglebone classic. It works using the 2012 Angstrom distribution [1], but not on the newer Debian-based distributions. I eventually managed to track this down to the fact the kernel sets the lowest two bits of the CM_WKUP_DEBUGSS_CLKCTRL [2] register (located at 0x44e00414) to 0, which powers off the debug hardware on the AM335x.

I was able to get JTAG working again by writing a small kernel module that sets the register to the value it has when the board is reset (though I think it would be sufficient to just set the last two bits to 0b10):

void __iomem *io = ioremap(0x44e00000, SZ_4K);

iowrite32(0x52580002, io + 0x414);


My question is: is there any way to stop the Linux kernel from disabling JTAG automatically on startup? I know it happens sometime during the boot process (if I stop during U-Boot, JTAG works and the CM_WKUP_DEBUGSS_CLKCTRL has its default value), but I can’t figure out what to change in the DTB or the kernel source to prevent this.


[1] I think this is because the kernel used there has this patch https://github.com/beagleboard/kernel/blob/3.8/patches/dma/0002-ARM-OMAP-Hack-AM33xx-clock-data-to-allow-JTAG-use.patch
[2] As found in the AM335x TRM: https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf

Jtag is disabled by default, just un-comment:


you'll find your matching device-tree's under /opt/source/dtb*