Merge pull request #1904 from machdyne/master
litex_json2dts_linux: Add support for multiple Ethernet interfaces
This commit is contained in:
commit
a891b2dd11
|
@ -416,11 +416,14 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
|
||||||
uart_interrupt = "" if polling else "interrupts = <{}>;".format(int(d["constants"]["uart_interrupt"]) + it_incr))
|
uart_interrupt = "" if polling else "interrupts = <{}>;".format(int(d["constants"]["uart_interrupt"]) + it_incr))
|
||||||
|
|
||||||
# Ethernet -------------------------------------------------------------------------------------
|
# Ethernet -------------------------------------------------------------------------------------
|
||||||
|
for i in [''] + list(range(0, 10)):
|
||||||
if "ethphy" in d["csr_bases"] and "ethmac" in d["csr_bases"]:
|
idx = (0 if i == '' else i)
|
||||||
|
ethphy_name = "ethphy" + str(i)
|
||||||
|
ethmac_name = "ethmac" + str(i)
|
||||||
it_incr = {True: 1, False: 0}["rocket" in cpu_name]
|
it_incr = {True: 1, False: 0}["rocket" in cpu_name]
|
||||||
|
if ethphy_name in d["csr_bases"] and ethmac_name in d["csr_bases"]:
|
||||||
dts += """
|
dts += """
|
||||||
mac0: mac@{ethmac_csr_base:x} {{
|
mac{idx}: mac@{ethmac_csr_base:x} {{
|
||||||
compatible = "litex,liteeth";
|
compatible = "litex,liteeth";
|
||||||
reg = <0x{ethmac_csr_base:x} 0x7c>,
|
reg = <0x{ethmac_csr_base:x} 0x7c>,
|
||||||
<0x{ethphy_csr_base:x} 0x0a>,
|
<0x{ethphy_csr_base:x} 0x0a>,
|
||||||
|
@ -433,14 +436,15 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
|
||||||
status = "okay";
|
status = "okay";
|
||||||
}};
|
}};
|
||||||
""".format(
|
""".format(
|
||||||
ethphy_csr_base = d["csr_bases"]["ethphy"],
|
idx = idx,
|
||||||
ethmac_csr_base = d["csr_bases"]["ethmac"],
|
ethphy_csr_base = d["csr_bases"][ethphy_name],
|
||||||
ethmac_mem_base = d["memories"]["ethmac"]["base"],
|
ethmac_csr_base = d["csr_bases"][ethmac_name],
|
||||||
ethmac_mem_size = d["memories"]["ethmac"]["size"],
|
ethmac_mem_base = d["memories"][ethmac_name]["base"],
|
||||||
ethmac_rx_slots = d["constants"]["ethmac_rx_slots"],
|
ethmac_mem_size = d["memories"][ethmac_name]["size"],
|
||||||
ethmac_tx_slots = d["constants"]["ethmac_tx_slots"],
|
ethmac_rx_slots = d["constants"][ethmac_name + "_rx_slots"],
|
||||||
ethmac_slot_size = d["constants"]["ethmac_slot_size"],
|
ethmac_tx_slots = d["constants"][ethmac_name + "_tx_slots"],
|
||||||
ethmac_interrupt = "" if polling else "interrupts = <{}>;".format(int(d["constants"]["ethmac_interrupt"]) + it_incr))
|
ethmac_slot_size = d["constants"][ethmac_name + "_slot_size"],
|
||||||
|
ethmac_interrupt = "" if polling else "interrupts = <{}>;".format(int(d["constants"][ethmac_name + "_interrupt"]) + it_incr))
|
||||||
|
|
||||||
# USB OHCI -------------------------------------------------------------------------------------
|
# USB OHCI -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue