Merge pull request #901 from stffrdhrn/litex-sdcard-irq
integration/soc: Wire up the sdirq to the CPU
This commit is contained in:
commit
fb8f45be73
|
@ -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:
|
||||||
|
|
|
@ -283,8 +283,10 @@ def generate_dts(d, initrd_start=None, initrd_size=None, polling=False):
|
||||||
reg = <0x{sdphy_csr_base:x} 0x100>,
|
reg = <0x{sdphy_csr_base:x} 0x100>,
|
||||||
<0x{sdcore_csr_base:x} 0x100>,
|
<0x{sdcore_csr_base:x} 0x100>,
|
||||||
<0x{sdblock2mem:x} 0x100>,
|
<0x{sdblock2mem:x} 0x100>,
|
||||||
<0x{sdmem2block:x} 0x100>;
|
<0x{sdmem2block:x} 0x100>,
|
||||||
|
<0x{sdirq:x} 0x100>;
|
||||||
bus-width = <0x04>;
|
bus-width = <0x04>;
|
||||||
|
{sdirq_interrupt}
|
||||||
status = "okay";
|
status = "okay";
|
||||||
}};
|
}};
|
||||||
""".format(
|
""".format(
|
||||||
|
@ -292,7 +294,9 @@ def generate_dts(d, initrd_start=None, initrd_size=None, polling=False):
|
||||||
sdphy_csr_base = d["csr_bases"]["sdphy"],
|
sdphy_csr_base = d["csr_bases"]["sdphy"],
|
||||||
sdcore_csr_base = d["csr_bases"]["sdcore"],
|
sdcore_csr_base = d["csr_bases"]["sdcore"],
|
||||||
sdblock2mem = d["csr_bases"]["sdblock2mem"],
|
sdblock2mem = d["csr_bases"]["sdblock2mem"],
|
||||||
sdmem2block = d["csr_bases"]["sdmem2block"]
|
sdmem2block = d["csr_bases"]["sdmem2block"],
|
||||||
|
sdirq = d["csr_bases"]["sdirq"],
|
||||||
|
sdirq_interrupt = "" if polling else "interrupts = <{}>;".format(d["constants"]["sdirq_interrupt"])
|
||||||
)
|
)
|
||||||
# Leds -----------------------------------------------------------------------------------------
|
# Leds -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue