integration/soc: Wire up the sdirq to the CPU

I am working on testing out the patches from:
 https://github.com/litex-hub/linux/pull/8

These linux patches take advantage of the sdcard interrupt to track when
transfers finish.  However, it seems the interrupt is not being
connected to the CPU.

This patch does that by allowing us to directly register and
EventManager module with the irq handler.
This commit is contained in:
Stafford Horne 2021-04-29 17:18:40 +09:00
parent 2f96cf021c
commit dc1a4c5380
1 changed files with 9 additions and 2 deletions

View File

@ -1070,12 +1070,17 @@ class SoC(Module):
continue continue
if hasattr(self, name): if hasattr(self, name):
module = getattr(self, name) module = getattr(self, name)
if not hasattr(module, "ev"): ev = None
if hasattr(module, "ev"):
ev = module.ev
elif isinstance(module, EventManager):
ev = module
else:
self.logger.error("EventManager {} in {} SubModule.".format( self.logger.error("EventManager {} in {} SubModule.".format(
colorer("not found", color="red"), colorer("not found", color="red"),
colorer(name))) colorer(name)))
raise raise
self.comb += self.cpu.interrupt[loc].eq(module.ev.irq) self.comb += self.cpu.interrupt[loc].eq(ev.irq)
self.add_constant(name + "_INTERRUPT", loc) self.add_constant(name + "_INTERRUPT", loc)
# SoC Infos -------------------------------------------------------------------------------- # SoC Infos --------------------------------------------------------------------------------
@ -1558,6 +1563,8 @@ class LiteXSoC(SoC):
self.sdirq.mem2block_dma.trigger.eq(self.sdmem2block.irq), self.sdirq.mem2block_dma.trigger.eq(self.sdmem2block.irq),
self.sdirq.cmd_done.trigger.eq(self.sdcore.cmd_event.fields.done) self.sdirq.cmd_done.trigger.eq(self.sdcore.cmd_event.fields.done)
] ]
if self.irq.enabled:
self.irq.add("sdirq", use_loc_if_exists=True)
# Debug. # Debug.
if software_debug: if software_debug: