From: Florent Kermarrec Date: Fri, 29 May 2020 18:15:02 +0000 (+0200) Subject: soc/software/litesdcard: use new send register to send command and remove CSR8_CMD_FIX. X-Git-Tag: 24jan2021_ls180~254 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b1ec092e8884cb7d2da84e3499672dfc89b91045;p=litex.git soc/software/litesdcard: use new send register to send command and remove CSR8_CMD_FIX. --- diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 192f7b20..84ec63d7 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1274,7 +1274,7 @@ class LiteXSoC(SoC): 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, csr_data_width=self.csr_data_width) + self.submodules.sdcore = SDCore(self.sdphy) self.submodules.sdtimer = Timer() self.add_csr("sdclk") self.add_csr("sdphy") diff --git a/litex/soc/software/liblitesdcard/sdcard.c b/litex/soc/software/liblitesdcard/sdcard.c index fe4e8af0..96587b94 100644 --- a/litex/soc/software/liblitesdcard/sdcard.c +++ b/litex/soc/software/liblitesdcard/sdcard.c @@ -280,11 +280,6 @@ int sdcard_wait_response(void) { } /* commands */ -#if CONFIG_CSR_DATA_WIDTH == 8 -#define CSR8_CMD_FIX sdcore_issue_cmd_write(1) -#else -#define CSR8_CMD_FIX -#endif void sdcard_go_idle(void) { #ifdef SDCARD_DEBUG @@ -292,7 +287,7 @@ void sdcard_go_idle(void) { #endif sdcore_argument_write(0x00000000); sdcore_command_write((0 << 8) | SDCARD_CTRL_RESPONSE_NONE); - CSR8_CMD_FIX; + sdcore_send_write(1); } int sdcard_send_ext_csd(void) { @@ -303,7 +298,7 @@ int sdcard_send_ext_csd(void) { #endif sdcore_argument_write(arg); sdcore_command_write((8 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -313,7 +308,7 @@ int sdcard_app_cmd(int rca) { #endif sdcore_argument_write(rca << 16); sdcore_command_write((55 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -329,7 +324,7 @@ int sdcard_app_send_op_cond(int hcs, int s18r) { #endif sdcore_argument_write(arg); sdcore_command_write((41 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -339,7 +334,7 @@ int sdcard_all_send_cid(void) { #endif sdcore_argument_write(0x00000000); sdcore_command_write((2 << 8) | SDCARD_CTRL_RESPONSE_LONG); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -349,7 +344,7 @@ int sdcard_set_relative_address(void) { #endif sdcore_argument_write(0x00000000); sdcore_command_write((3 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -359,7 +354,7 @@ int sdcard_send_cid(unsigned int rca) { #endif sdcore_argument_write(rca << 16); sdcore_command_write((10 << 8) | SDCARD_CTRL_RESPONSE_LONG); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -369,7 +364,7 @@ int sdcard_send_csd(unsigned int rca) { #endif sdcore_argument_write(rca << 16); sdcore_command_write((9 << 8) | SDCARD_CTRL_RESPONSE_LONG); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -379,7 +374,7 @@ int sdcard_select_card(unsigned int rca) { #endif sdcore_argument_write(rca << 16); sdcore_command_write((7 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -389,7 +384,7 @@ int sdcard_app_set_bus_width(void) { #endif sdcore_argument_write(0x00000002); sdcore_command_write((6 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -408,7 +403,7 @@ int sdcard_switch(unsigned int mode, unsigned int group, unsigned int value, uns sdcore_blockcount_write(1); sdcore_command_write((6 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_READ << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); sdcard_wait_response(); return sdcard_wait_data_done(); } @@ -422,7 +417,7 @@ int sdcard_app_send_scr(void) { sdcore_blockcount_write(1); sdcore_command_write((51 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_READ << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); sdcard_wait_response(); return sdcard_wait_data_done(); } @@ -434,7 +429,7 @@ int sdcard_app_set_blocklen(unsigned int blocklen) { #endif sdcore_argument_write(blocklen); sdcore_command_write((16 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -449,7 +444,7 @@ int sdcard_write_single_block(unsigned int blockaddr) { sdcore_blockcount_write(1); sdcore_command_write((24 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_WRITE << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); cmd_response = sdcard_wait_response(); } return cmd_response; @@ -466,7 +461,7 @@ int sdcard_write_multiple_block(unsigned int blockaddr, unsigned int blockcnt) { sdcore_blockcount_write(blockcnt); sdcore_command_write((25 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_WRITE << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); cmd_response = sdcard_wait_response(); } return cmd_response; @@ -483,7 +478,7 @@ int cmd_response = -1; sdcore_blockcount_write(1); sdcore_command_write((17 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_READ << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); cmd_response = sdcard_wait_response(); } return sdcard_wait_data_done(); @@ -500,7 +495,7 @@ int cmd_response = -1; sdcore_blockcount_write(blockcnt); sdcore_command_write((18 << 8) | SDCARD_CTRL_RESPONSE_SHORT | (SDCARD_CTRL_DATA_TRANSFER_READ << 5)); - CSR8_CMD_FIX; + sdcore_send_write(1); cmd_response = sdcard_wait_response(); } return cmd_response; @@ -512,7 +507,7 @@ int sdcard_stop_transmission(void) { #endif sdcore_argument_write(0x0000000); sdcore_command_write((12 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -522,7 +517,7 @@ int sdcard_send_status(unsigned int rca) { #endif sdcore_argument_write(rca << 16); sdcore_command_write((13 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); } @@ -532,7 +527,7 @@ int sdcard_set_block_count(unsigned int blockcnt) { #endif sdcore_argument_write(blockcnt); sdcore_command_write((23 << 8) | SDCARD_CTRL_RESPONSE_SHORT); - CSR8_CMD_FIX; + sdcore_send_write(1); return sdcard_wait_response(); }