diff --git a/boards/xtensa/intel_adsp_cavs15/tools/cavs-fw.py b/boards/xtensa/intel_adsp_cavs15/tools/cavs-fw.py index f36deb755fc..cdc0478ee2b 100755 --- a/boards/xtensa/intel_adsp_cavs15/tools/cavs-fw.py +++ b/boards/xtensa/intel_adsp_cavs15/tools/cavs-fw.py @@ -30,6 +30,10 @@ def main(): with open(FW_FILE, "rb") as f: fw_bytes = f.read() + (magic, sz) = struct.unpack("4sI", fw_bytes[0:8]) + if magic == b'XMan': + fw_bytes = fw_bytes[sz:len(fw_bytes)] + (hda, sd, dsp) = map_regs() # Device register mappings # Turn on HDA "global processing enable" first, which actually @@ -121,6 +125,16 @@ def map_regs(): pcidir = os.path.dirname(p) break + # Disengage runtime power management so the kernel doesn't put it to sleep + with open(pcidir + b"/power/control", "w") as ctrl: + ctrl.write("on") + + # Make sure PCI memory space access and busmastering are enabled. + # Also disable interrupts so as not to confuse the kernel. + with open(pcidir + b"/config", "wb+") as cfg: + cfg.seek(4) + cfg.write(b'\x06\x04') + hdamem = bar_map(pcidir, 0) # Standard HD Audio Registers