From 73b4347587d24ac625632f95b5145d799db8cd80 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 26 Mar 2020 07:46:32 +0100 Subject: [PATCH] software/libbase/spisdcard: add USE_SPISDCARD_RECLOCKING define to easily disable reclocking. --- litex/soc/software/libbase/spisdcard.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/libbase/spisdcard.c b/litex/soc/software/libbase/spisdcard.c index fd5b327f..2027a0a2 100644 --- a/litex/soc/software/libbase/spisdcard.c +++ b/litex/soc/software/libbase/spisdcard.c @@ -21,6 +21,8 @@ #include #include +#define USE_SPISCARD_RECLOCKING + #ifdef CSR_SPISDCARD_BASE // Import prototypes for the functions #include @@ -138,7 +140,7 @@ uint8_t spi_setspimode(void) { uint32_t r; int i, timeout=32; - + // Initialise SPI mode // set CS to HIGH // Send pulses @@ -444,6 +446,7 @@ uint8_t spi_sdcard_readMBR(void) return FAILURE; } +#ifdef USE_SPISCARD_RECLOCKING // Reclock the card // Calculate 16MHz as an integer divider from the CONFIG_CLOCK_FREQUENCY // Add 1 as will be rounded down @@ -454,7 +457,7 @@ uint8_t spi_sdcard_readMBR(void) divider=2; printf("Reclocking from %dKHz to %dKHz\n\n", CONFIG_CLOCK_FREQUENCY/(int)spisdcard_clk_divider_read()/1000, CONFIG_CLOCK_FREQUENCY/divider/1000); spisdcard_clk_divider_write(divider); - + // Read in FAT16 File Allocation Table, array of 16bit unsinged integers // Calculate Storage from TOP of MAIN RAM sdCardFatTable = (uint16_t *)(MAIN_RAM_BASE+MAIN_RAM_SIZE-sdCardFatBootSector.sector_size*sdCardFatBootSector.fat_size_sectors); @@ -468,6 +471,7 @@ uint8_t spi_sdcard_readMBR(void) return FAILURE; } } +#endif // Read in FAT16 Root Directory // Calculate Storage from TOP of MAIN RAM -- 2.30.2