Merge pull request #820 from gsomlo/gls-sdcard-fixes

fixes for boot and (single-block, cmd17-only) Linux driver
This commit is contained in:
enjoy-digital 2021-02-15 15:44:18 +01:00 committed by GitHub
commit 5291a646d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -1480,7 +1480,7 @@ class LiteXSoC(SoC):
sdcard_pads = self.platform.request(name)
# Core
self.submodules.sdphy = SDPHY(sdcard_pads, self.platform.device, self.clk_freq)
self.submodules.sdphy = SDPHY(sdcard_pads, self.platform.device, self.clk_freq, cmd_timeout=10e-1, data_timeout=10e-1)
self.submodules.sdcore = SDCore(self.sdphy)
self.csr.add("sdphy", use_loc_if_exists=True)
self.csr.add("sdcore", use_loc_if_exists=True)

View File

@ -106,6 +106,7 @@ void sdcard_set_clk_freq(uint32_t clk_freq, int show) {
uint32_t divider;
divider = clk_freq ? CONFIG_CLOCK_FREQUENCY/clk_freq : 256;
divider = pow2_round_up(divider);
divider <<= 1; /* NOTE: workaround for occasional sdcardboot failure */
divider = min(max(divider, 2), 256);
#ifdef SDCARD_DEBUG
show = 1;