Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: fix vcu118 sd card frequency #1685

Merged
merged 5 commits into from
Dec 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions fpga/src/main/resources/vcu118/sdboot/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#error Must define TL_CLK
#endif

#define F_CLK TL_CLK
#define F_CLK (TL_CLK)

static volatile uint32_t * const spi = (void *)(SPI_CTRL_ADDR);

Expand Down Expand Up @@ -79,7 +79,9 @@ static inline void sd_cmd_end(void)
static void sd_poweron(void)
{
long i;
REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 300000UL);
// HACK: frequency change
// REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 300000UL);
REG32(spi, SPI_REG_SCKDIV) = (F_CLK * 2.5);
REG32(spi, SPI_REG_CSMODE) = SPI_CSMODE_OFF;
for (i = 10; i > 0; i--) {
sd_dummy();
Expand Down Expand Up @@ -176,7 +178,9 @@ static int copy(void)

// TODO: Speed up SPI freq. (breaks between these two values)
//REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 16666666UL);
REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 5000000UL);
// HACK: frequency change
// REG32(spi, SPI_REG_SCKDIV) = (F_CLK / 5000000UL);
REG32(spi, SPI_REG_SCKDIV) = (F_CLK * 2); // / 0.5
if (sd_cmd(0x52, BBL_PARTITION_START_SECTOR, 0xE1) != 0x00) {
sd_cmd_end();
return 1;
Expand Down