soc/add_sdcard: remove limitation to 7-Series but only add clocker for it.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 3 Jun 2020 11:47:39 +0000 (13:47 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 3 Jun 2020 11:47:39 +0000 (13:47 +0200)
litex/soc/integration/soc.py

index e4db1e5084b49acce2b45229486730a0e989af3f..303d67f773a0a63acbc8bbf89e0dfd1f3e46c5bf 100644 (file)
@@ -1251,31 +1251,29 @@ class LiteXSoC(SoC):
     def add_sdcard(self, name="sdcard", with_emulator=False):
         # Imports
         from litesdcard.phy import SDPHY
-        from litesdcard.clocker import SDClockerS7
         from litesdcard.core import SDCore
-        from litesdcard.bist import BISTBlockGenerator, BISTBlockChecker
         from litesdcard.data import SDDataReader, SDDataWriter
 
-        # Emulator
+        # Emulator / Pads
         if with_emulator:
             from litesdcard.emulator import SDEmulator, _sdemulator_pads
             sdcard_pads = _sdemulator_pads()
             self.submodules.sdemulator = SDEmulator(self.platform, sdcard_pads)
             self.add_csr("sdemulator")
         else:
-            assert self.platform.device[:3] == "xc7" # FIXME: Only supports 7-Series for now.
             sdcard_pads = self.platform.request(name)
 
+        # Clocking
+        if self.platform.device[:3] == "xc7":
+            from litesdcard.clocker import SDClockerS7
+            self.submodules.sdclk = SDClockerS7(sys_clk_freq=self.sys_clk_freq)
+            self.add_csr("sdclk")
+
         # Core
         if hasattr(sdcard_pads, "rst"):
             self.comb += sdcard_pads.rst.eq(0)
-        if with_emulator:
-            pass
-        else:
-            self.submodules.sdclk = SDClockerS7(sys_clk_freq=self.sys_clk_freq)
         self.submodules.sdphy   = SDPHY(sdcard_pads, self.platform.device)
         self.submodules.sdcore  = SDCore(self.sdphy)
-        self.add_csr("sdclk")
         self.add_csr("sdphy")
         self.add_csr("sdcore")