gsd_butterstick: Add SDCard (SPI & SD modes) support.

This commit is contained in:
Florent Kermarrec 2021-09-02 11:51:07 +02:00
parent 596f430326
commit fddca1cd40
2 changed files with 27 additions and 1 deletions

View File

@ -37,6 +37,25 @@ _io_r1_0 = [
IOStandard("LVCMOS33") IOStandard("LVCMOS33")
), ),
# SDCard
("spisdcard", 0,
Subsignal("clk", Pins(f"B15")),
Subsignal("mosi", Pins(f"A13"), Misc("PULLMODE=UP")),
Subsignal("cs_n", Pins(f"A14"), Misc("PULLMODE=UP")),
Subsignal("miso", Pins(f"C12"), Misc("PULLMODE=UP")),
Misc("SLEWRATE=FAST"),
IOStandard("LVCMOS33"),
),
("sdcard", 0,
Subsignal("data", Pins("C12 A12 D14 A14"), Misc("PULLMODE=UP")),
Subsignal("cmd", Pins("A13"), Misc("PULLMODE=UP")),
Subsignal("clk", Pins("B13")),
Subsignal("cd", Pins("B15")),
Misc("SLEWRATE=FAST"),
IOStandard("LVCMOS33"),
),
# DDR3 SDRAM # DDR3 SDRAM
("ddram", 0, ("ddram", 0,
Subsignal("a", Pins( Subsignal("a", Pins(

View File

@ -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 --with-spi-flash --csr-csv=csr.csv --build --load # ./gsd_butterstick.py --uart-name=crossover --with-etherbone --csr-csv=csr.csv --build --load
# litex_server --udp # litex_server --udp
# litex_term bridge # litex_term bridge
@ -159,6 +159,9 @@ def main():
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)") parser.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed)")
sdopts = parser.add_mutually_exclusive_group()
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support")
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support")
builder_args(parser) builder_args(parser)
soc_core_args(parser) soc_core_args(parser)
trellis_args(parser) trellis_args(parser)
@ -177,6 +180,10 @@ def main():
eth_dynamic_ip = args.eth_dynamic_ip, eth_dynamic_ip = args.eth_dynamic_ip,
with_spi_flash = args.with_spi_flash, with_spi_flash = args.with_spi_flash,
**soc_core_argdict(args)) **soc_core_argdict(args))
if args.with_spi_sdcard:
soc.add_spi_sdcard()
if args.with_sdcard:
soc.add_sdcard()
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 {}
builder.build(**builder_kargs, run=args.build) builder.build(**builder_kargs, run=args.build)