From 9c2975e8b4b50ec6c6a32a9e3172620276be9e39 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 16 Sep 2020 11:22:15 +0200 Subject: [PATCH] software/liblitedram/sdram: remove low level manual controls of the DFI interface. This was too low level and unused. --- litex/soc/software/bios/cmds/cmd_litedram.c | 162 -------------------- litex/soc/software/liblitedram/sdram.c | 113 -------------- litex/soc/software/liblitedram/sdram.h | 10 -- 3 files changed, 285 deletions(-) diff --git a/litex/soc/software/bios/cmds/cmd_litedram.c b/litex/soc/software/bios/cmds/cmd_litedram.c index d07cf750e..461adc92f 100644 --- a/litex/soc/software/bios/cmds/cmd_litedram.c +++ b/litex/soc/software/bios/cmds/cmd_litedram.c @@ -14,168 +14,6 @@ #include "../command.h" #include "../helpers.h" -/** - * Command "sdrrow" - * - * Precharge/Activate row - * - */ -#ifdef CSR_SDRAM_BASE -static void sdrrow_handler(int nb_params, char **params) -{ - char *c; - unsigned int row; - - if (nb_params < 1) { - sdrrow(0); - printf("Precharged"); - } - - row = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect row"); - return; - } - - sdrrow(row); - printf("Activated row %d", row); -} -define_command(sdrrow, sdrrow_handler, "Precharge/Activate row", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrsw" - * - * Gives SDRAM control to SW - * - */ -#ifdef CSR_SDRAM_BASE -define_command(sdrsw, sdrsw, "Gives SDRAM control to SW", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrhw" - * - * Gives SDRAM control to HW - * - */ -#ifdef CSR_SDRAM_BASE -define_command(sdrhw, sdrhw, "Gives SDRAM control to HW", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrrdbuf" - * - * Dump SDRAM read buffer - * - */ -#ifdef CSR_SDRAM_BASE -static void sdrrdbuf_handler(int nb_params, char **params) -{ - sdrrdbuf(-1); -} - -define_command(sdrrdbuf, sdrrdbuf_handler, "Dump SDRAM read buffer", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrrd" - * - * Read SDRAM data - * - */ -#ifdef CSR_SDRAM_BASE -static void sdrrd_handler(int nb_params, char **params) -{ - unsigned int addr; - int dq; - char *c; - - if (nb_params < 1) { - printf("sdrrd
"); - return; - } - - addr = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect address"); - return; - } - - if (nb_params < 2) - dq = -1; - else { - dq = strtoul(params[1], &c, 0); - if (*c != 0) { - printf("Incorrect DQ"); - return; - } - } - - sdrrd(addr, dq); -} - -define_command(sdrrd, sdrrd_handler, "Read SDRAM data", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrrderr" - * - * Print SDRAM read errors - * - */ -#ifdef CSR_SDRAM_BASE -static void sdrrderr_handler(int nb_params, char **params) -{ - int count; - char *c; - - if (nb_params < 1) { - printf("sdrrderr "); - return; - } - - count = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect count"); - return; - } - - sdrrderr(count); -} - -define_command(sdrrderr, sdrrderr_handler, "Print SDRAM read errors", LITEDRAM_CMDS); -#endif - -/** - * Command "sdrwr" - * - * Write SDRAM test data - * - */ -#ifdef CSR_SDRAM_BASE -static void sdrwr_handler(int nb_params, char **params) -{ - unsigned int addr; - char *c; - - if (nb_params < 1) { - printf("sdrwr
"); - return; - } - - addr = strtoul(params[0], &c, 0); - if (*c != 0) { - printf("Incorrect address"); - return; - } - - sdrwr(addr); -} - -define_command(sdrwr, sdrwr_handler, "Write SDRAM test data", LITEDRAM_CMDS); -#endif - /** * Command "sdrinit" * diff --git a/litex/soc/software/liblitedram/sdram.c b/litex/soc/software/liblitedram/sdram.c index 81711d557..125d29d77 100644 --- a/litex/soc/software/liblitedram/sdram.c +++ b/litex/soc/software/liblitedram/sdram.c @@ -81,119 +81,6 @@ void sdrhw(void) } } -/*-----------------------------------------------------------------------*/ -/* Manual Control */ -/*-----------------------------------------------------------------------*/ - -void sdrrow(unsigned int row) -{ - if(row == 0) { - sdram_dfii_pi0_address_write(0x0000); - sdram_dfii_pi0_baddress_write(0); - command_p0(DFII_COMMAND_RAS|DFII_COMMAND_WE|DFII_COMMAND_CS); - cdelay(15); - } else { - sdram_dfii_pi0_address_write(row); - sdram_dfii_pi0_baddress_write(0); - command_p0(DFII_COMMAND_RAS|DFII_COMMAND_CS); - cdelay(15); - } -} - -void sdrrdbuf(int dq) -{ - int i, p; - int first_byte, step; - unsigned char buf[DFII_PIX_DATA_BYTES]; - - if(dq < 0) { - first_byte = 0; - step = 1; - } else { - first_byte = DFII_PIX_DATA_BYTES/2 - 1 - dq; - step = DFII_PIX_DATA_BYTES/2; - } - - for(p=0;p