Skip to content
Snippets Groups Projects
Commit 596f4303 authored by Florent Kermarrec's avatar Florent Kermarrec
Browse files

gsd_butterstick: Add SPI Flash support.

parent 1bbbf5b3
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,14 @@ _io_r1_0 = [ ...@@ -29,6 +29,14 @@ _io_r1_0 = [
("user_btn", 0, Pins("U16"), IOStandard("SSTL135_I")), ("user_btn", 0, Pins("U16"), IOStandard("SSTL135_I")),
("user_btn", 1, Pins("T17"), IOStandard("SSTL135_I")), ("user_btn", 1, Pins("T17"), IOStandard("SSTL135_I")),
# SPIFlash
("spiflash4x", 0,
Subsignal("cs_n", Pins("R2")),
#Subsignal("clk", Pins("U3")),
Subsignal("dq", Pins("W2 V2 Y2 W1")),
IOStandard("LVCMOS33")
),
# DDR3 SDRAM # DDR3 SDRAM
("ddram", 0, ("ddram", 0,
Subsignal("a", Pins( Subsignal("a", Pins(
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# Build/Use: # Build/Use:
# ./gsd_butterstick.py --uart-name=crossover --with-etherbone --csr-csv=csr.csv --build --load # ./gsd_butterstick.py --uart-name=crossover --with-etherbone --with-spi-flash --csr-csv=csr.csv --build --load
# litex_server --udp # litex_server --udp
# litex_term bridge # litex_term bridge
...@@ -90,8 +90,10 @@ class _CRG(Module): ...@@ -90,8 +90,10 @@ class _CRG(Module):
# BaseSoC ------------------------------------------------------------------------------------------ # BaseSoC ------------------------------------------------------------------------------------------
class BaseSoC(SoCCore): class BaseSoC(SoCCore):
mem_map = {**SoCCore.mem_map, **{"spiflash": 0x80000000}}
def __init__(self, revision="1.0", device="25F", sys_clk_freq=int(60e6), toolchain="trellis", def __init__(self, revision="1.0", device="25F", sys_clk_freq=int(60e6), toolchain="trellis",
with_ethernet=False, with_etherbone=False, eth_ip="192.168.1.50", eth_dynamic_ip=False, with_ethernet=False, with_etherbone=False, eth_ip="192.168.1.50", eth_dynamic_ip=False,
with_spi_flash=False,
with_led_chaser=True, with_led_chaser=True,
**kwargs) : **kwargs) :
platform = butterstick.Platform(revision=revision, device=device ,toolchain=toolchain) platform = butterstick.Platform(revision=revision, device=device ,toolchain=toolchain)
...@@ -128,6 +130,12 @@ class BaseSoC(SoCCore): ...@@ -128,6 +130,12 @@ class BaseSoC(SoCCore):
if with_etherbone: if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip) self.add_etherbone(phy=self.ethphy, ip_address=eth_ip)
# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
from litespi.modules import W25Q128JV
from litespi.opcodes import SpiNorFlashOpCodes as Codes
self.add_spi_flash(mode="4x", module=W25Q128JV(Codes.READ_1_1_4), with_master=False)
# Leds ------------------------------------------------------------------------------------- # Leds -------------------------------------------------------------------------------------
if with_led_chaser: if with_led_chaser:
self.comb += platform.request("user_led_color").eq(0b010) # Blue. self.comb += platform.request("user_led_color").eq(0b010) # Blue.
...@@ -135,7 +143,6 @@ class BaseSoC(SoCCore): ...@@ -135,7 +143,6 @@ class BaseSoC(SoCCore):
pads = platform.request_all("user_led"), pads = platform.request_all("user_led"),
sys_clk_freq = sys_clk_freq) sys_clk_freq = sys_clk_freq)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------
def main(): def main():
...@@ -151,6 +158,7 @@ def main(): ...@@ -151,6 +158,7 @@ def main():
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone") ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone")
parser.add_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address") parser.add_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address")
parser.add_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting") parser.add_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting")
parser.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed)")
builder_args(parser) builder_args(parser)
soc_core_args(parser) soc_core_args(parser)
trellis_args(parser) trellis_args(parser)
...@@ -167,6 +175,7 @@ def main(): ...@@ -167,6 +175,7 @@ def main():
with_etherbone = args.with_etherbone, with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip, eth_ip = args.eth_ip,
eth_dynamic_ip = args.eth_dynamic_ip, eth_dynamic_ip = args.eth_dynamic_ip,
with_spi_flash = args.with_spi_flash,
**soc_core_argdict(args)) **soc_core_argdict(args))
builder = Builder(soc, **builder_argdict(args)) builder = Builder(soc, **builder_argdict(args))
builder_kargs = trellis_argdict(args) if args.toolchain == "trellis" else {} builder_kargs = trellis_argdict(args) if args.toolchain == "trellis" else {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment