From 18582739455c2d0ed7434fb27dbffdcf68ac3144 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 30 Sep 2021 18:01:54 +0200 Subject: [PATCH] mnt_rkx7: Add SPI SDCard support. --- litex_boards/platforms/mnt_rkx7.py | 8 ++++++++ litex_boards/targets/mnt_rkx7.py | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/litex_boards/platforms/mnt_rkx7.py b/litex_boards/platforms/mnt_rkx7.py index 4620e58..2bf5202 100644 --- a/litex_boards/platforms/mnt_rkx7.py +++ b/litex_boards/platforms/mnt_rkx7.py @@ -29,6 +29,14 @@ _io = [ ), # SDCard. + ("spisdcard", 0, + Subsignal("clk", Pins("C11")), + Subsignal("mosi", Pins("A15"), Misc("PULLUP True")), + Subsignal("cs_n", Pins("B15"), Misc("PULLUP True")), + Subsignal("miso", Pins("A14"), Misc("PULLUP True")), + Misc("SLEW=FAST"), + IOStandard("LVCMOS18"), + ), ("sdcard", 0, Subsignal("data", Pins("A14 B10 A12 B15"), Misc("PULLUP True")), Subsignal("cmd", Pins("A15"), Misc("PULLUP True")), diff --git a/litex_boards/targets/mnt_rkx7.py b/litex_boards/targets/mnt_rkx7.py index b1656d3..14336b2 100755 --- a/litex_boards/targets/mnt_rkx7.py +++ b/litex_boards/targets/mnt_rkx7.py @@ -90,7 +90,6 @@ class BaseSoC(SoCCore): if with_etherbone: self.add_etherbone(phy=self.ethphy) - # I2C -------------------------------------------------------------------------------------- self.submodules.i2c = I2CMaster(platform.request("i2c")) @@ -102,7 +101,9 @@ def main(): parser.add_argument("--load", action="store_true", help="Load bitstream") parser.add_argument("--sys-clk-freq", default=125e6, help="System clock frequency (default: 125MHz)") parser.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed)") - parser.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support") + 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") ethopts = parser.add_mutually_exclusive_group() ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support") ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support") @@ -117,6 +118,8 @@ def main(): with_spi_flash = args.with_spi_flash, **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))