targets: netv2: add LiteSPI
This commit is contained in:
parent
946cb16429
commit
81be74a7b1
|
@ -13,12 +13,16 @@ from litex.soc.cores.clock import *
|
||||||
from litex.soc.integration.soc_core import *
|
from litex.soc.integration.soc_core import *
|
||||||
from litex.soc.integration.soc_sdram import *
|
from litex.soc.integration.soc_sdram import *
|
||||||
from litex.soc.integration.builder import *
|
from litex.soc.integration.builder import *
|
||||||
|
from litex.soc.integration.soc import *
|
||||||
|
|
||||||
from litedram.modules import K4B2G1646F
|
from litedram.modules import K4B2G1646F
|
||||||
from litedram.phy import s7ddrphy
|
from litedram.phy import s7ddrphy
|
||||||
|
|
||||||
from liteeth.phy.rmii import LiteEthPHYRMII
|
from liteeth.phy.rmii import LiteEthPHYRMII
|
||||||
|
|
||||||
|
from litespi import LiteSPI
|
||||||
|
from litespi.phy.generic import LiteSPIPHY
|
||||||
|
|
||||||
# CRG ----------------------------------------------------------------------------------------------
|
# CRG ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class _CRG(Module):
|
class _CRG(Module):
|
||||||
|
@ -46,7 +50,7 @@ class _CRG(Module):
|
||||||
# BaseSoC ------------------------------------------------------------------------------------------
|
# BaseSoC ------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class BaseSoC(SoCCore):
|
class BaseSoC(SoCCore):
|
||||||
def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, **kwargs):
|
def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, with_spi_xip=False, **kwargs):
|
||||||
platform = netv2.Platform()
|
platform = netv2.Platform()
|
||||||
|
|
||||||
# SoCCore ----------------------------------------------------------------------------------
|
# SoCCore ----------------------------------------------------------------------------------
|
||||||
|
@ -72,6 +76,14 @@ class BaseSoC(SoCCore):
|
||||||
l2_cache_reverse = True
|
l2_cache_reverse = True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# SPI XIP ----------------------------------------------------------------------------------
|
||||||
|
if with_spi_xip:
|
||||||
|
spi_xip_size = 1024*1024*8
|
||||||
|
self.submodules.spiphy = LiteSPIPHY(platform.request("spiflash4x"))
|
||||||
|
self.submodules.spictl = LiteSPI(phy=self.spiphy, endianness=self.cpu.endianness)
|
||||||
|
spi_xip_region = SoCRegion(origin=self.mem_map.get("spixip", None), size=spi_xip_size, cached=False)
|
||||||
|
self.bus.add_slave(name="spixip", slave=self.spictl.bus, region=spi_xip_region)
|
||||||
|
|
||||||
# Ethernet ---------------------------------------------------------------------------------
|
# Ethernet ---------------------------------------------------------------------------------
|
||||||
if with_ethernet:
|
if with_ethernet:
|
||||||
self.submodules.ethphy = LiteEthPHYRMII(
|
self.submodules.ethphy = LiteEthPHYRMII(
|
||||||
|
@ -88,9 +100,11 @@ def main():
|
||||||
soc_sdram_args(parser)
|
soc_sdram_args(parser)
|
||||||
parser.add_argument("--with-ethernet", action="store_true",
|
parser.add_argument("--with-ethernet", action="store_true",
|
||||||
help="enable Ethernet support")
|
help="enable Ethernet support")
|
||||||
|
parser.add_argument("--with-spi-xip", action="store_true",
|
||||||
|
help="enable SPI XIP support")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
soc = BaseSoC(with_ethernet=args.with_ethernet, **soc_sdram_argdict(args))
|
soc = BaseSoC(with_ethernet=args.with_ethernet, with_spi_xip=args.with_spi_xip, **soc_sdram_argdict(args))
|
||||||
builder = Builder(soc, **builder_argdict(args))
|
builder = Builder(soc, **builder_argdict(args))
|
||||||
builder.build()
|
builder.build()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue