helpers.o \
cmd_bios.o \
cmd_boot.o \
- cmd_dram.o \
+ cmd_litedram.o \
cmd_liteeth.o \
cmd_mem.o \
- cmd_sdcard.o \
- cmd_spi_flash.o \
+ cmd_litesdcard.o \
+ cmd_spiflash.o \
ifneq "$(or $(TERM_NO_COMPLETE),$(TERM_MINI))" ""
CFLAGS += -DTERM_NO_COMPLETE
+++ /dev/null
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "../command.h"
-#include "../helpers.h"
-#include "../sdram.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", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrsw"
- *
- * Gives SDRAM control to SW
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(sdrsw, sdrsw, "Gives SDRAM control to SW", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrhw"
- *
- * Gives SDRAM control to HW
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(sdrhw, sdrhw, "Gives SDRAM control to HW", DRAM_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", DRAM_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 <address>");
- 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", DRAM_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 <count>");
- 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", DRAM_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 <address>");
- 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", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrinit"
- *
- * Start SDRAM initialisation
- *
- */
-#if defined(CSR_SDRAM_BASE) && defined(CSR_DDRPHY_BASE)
-define_command(sdrinit, sdrinit, "Start SDRAM initialisation", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrwlon"
- *
- * Write leveling ON
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
-define_command(sdrwlon, sdrwlon, "Enable write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrwloff"
- *
- * Write leveling OFF
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
-define_command(sdrwloff, sdrwloff, "Disable write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "sdrlevel"
- *
- * Perform read/write leveling
- *
- */
-#if defined(CSR_DDRPHY_BASE) && defined(CSR_SDRAM_BASE)
-define_command(sdrlevel, sdrlevel, "Perform read/write leveling", DRAM_CMDS);
-#endif
-
-/**
- * Command "memtest"
- *
- * Run a memory test
- *
- */
-#ifdef CSR_SDRAM_BASE
-define_command(memtest, memtest, "Run a memory test", DRAM_CMDS);
-#endif
--- /dev/null
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "../command.h"
+#include "../helpers.h"
+#include "../sdram.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", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrsw"
+ *
+ * Gives SDRAM control to SW
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(sdrsw, sdrsw, "Gives SDRAM control to SW", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrhw"
+ *
+ * Gives SDRAM control to HW
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(sdrhw, sdrhw, "Gives SDRAM control to HW", DRAM_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", DRAM_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 <address>");
+ 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", DRAM_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 <count>");
+ 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", DRAM_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 <address>");
+ 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", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrinit"
+ *
+ * Start SDRAM initialisation
+ *
+ */
+#if defined(CSR_SDRAM_BASE) && defined(CSR_DDRPHY_BASE)
+define_command(sdrinit, sdrinit, "Start SDRAM initialisation", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrwlon"
+ *
+ * Write leveling ON
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
+define_command(sdrwlon, sdrwlon, "Enable write leveling", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrwloff"
+ *
+ * Write leveling OFF
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) && defined(CSR_SDRAM_BASE)
+define_command(sdrwloff, sdrwloff, "Disable write leveling", DRAM_CMDS);
+#endif
+
+/**
+ * Command "sdrlevel"
+ *
+ * Perform read/write leveling
+ *
+ */
+#if defined(CSR_DDRPHY_BASE) && defined(CSR_SDRAM_BASE)
+define_command(sdrlevel, sdrlevel, "Perform read/write leveling", DRAM_CMDS);
+#endif
+
+/**
+ * Command "memtest"
+ *
+ * Run a memory test
+ *
+ */
+#ifdef CSR_SDRAM_BASE
+define_command(memtest, memtest, "Run a memory test", DRAM_CMDS);
+#endif
--- /dev/null
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "../command.h"
+#include "../helpers.h"
+#include "../sdcard.h"
+
+/**
+ * Command "sdclk"
+ *
+ * Configure SDcard clock frequency
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdclk(int nb_params, char **params)
+{
+ unsigned int frequ;
+ char *c;
+
+ if (nb_params < 1) {
+ printf("sdclk <frequ>");
+ return;
+ }
+
+ frequ = strtoul(params[0], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect frequency");
+ return;
+ }
+
+ sdclk_set_clk(frequ);
+}
+
+struct command_struct cmd_sdclk =
+{
+ .func = sdclk,
+ .name = "sdclk",
+ .help = "SDCard set clk frequency (Mhz)",
+};
+
+define_command(sdclk, sdclk, "SDCard set clk frequency (Mhz)", SD_CMDS);
+#endif
+
+/**
+ * Command "sdinit"
+ *
+ * Initialize SDcard
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+define_command(sdinit, sdcard_init, "SDCard initialization", SD_CMDS);
+#endif
+
+/**
+ * Command "sdtest"
+ *
+ * Perform SDcard read/write tests
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtest(int nb_params, char **params)
+{
+ unsigned int blocks;
+ char *c;
+
+ if (nb_params < 1) {
+ printf("sdtest <number of blocks>");
+ return;
+ }
+
+ blocks = strtoul(params[0], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect number of blocks to write");
+ return;
+ }
+
+ sdcard_test(blocks);
+}
+
+define_command(sdtest, sdtest, "SDCard test", SD_CMDS);
+#endif
+
+/**
+ * Command "sdtestread"
+ *
+ * Perform SDcard read test
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtestread(int nb_params, char **params)
+{
+ unsigned int block;
+ char *c;
+
+ if (nb_params < 1) {
+ printf("sdtestread <block number>");
+ return;
+ }
+
+ block = strtoul(params[0], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect number of block to read");
+ return;
+ }
+
+ sdcard_test_read(block);
+}
+
+define_command(sdtestread, sdtestread, "SDCard test read", SD_CMDS);
+#endif
+
+/**
+ * Command "sdtestwrite"
+ *
+ * Perform SDcard write test
+ *
+ */
+#ifdef CSR_SDCORE_BASE
+static void sdtestwrite(int nb_params, char **params)
+{
+ unsigned int block;
+ char *c;
+
+ if (nb_params < 2) {
+ printf("sdtestread <block number> <str to write>");
+ return;
+ }
+
+ block = strtoul(params[0], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect number of block to write");
+ return;
+ }
+
+ sdcard_test_write(block, params[1]);
+}
+
+define_command(sdtestwrite, sdtestwrite, "SDCard test write", SD_CMDS);
+#endif
+++ /dev/null
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "../command.h"
-#include "../helpers.h"
-#include "../sdcard.h"
-
-/**
- * Command "sdclk"
- *
- * Configure SDcard clock frequency
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdclk(int nb_params, char **params)
-{
- unsigned int frequ;
- char *c;
-
- if (nb_params < 1) {
- printf("sdclk <frequ>");
- return;
- }
-
- frequ = strtoul(params[0], &c, 0);
- if (*c != 0) {
- printf("Incorrect frequency");
- return;
- }
-
- sdclk_set_clk(frequ);
-}
-
-struct command_struct cmd_sdclk =
-{
- .func = sdclk,
- .name = "sdclk",
- .help = "SDCard set clk frequency (Mhz)",
-};
-
-define_command(sdclk, sdclk, "SDCard set clk frequency (Mhz)", SD_CMDS);
-#endif
-
-/**
- * Command "sdinit"
- *
- * Initialize SDcard
- *
- */
-#ifdef CSR_SDCORE_BASE
-define_command(sdinit, sdcard_init, "SDCard initialization", SD_CMDS);
-#endif
-
-/**
- * Command "sdtest"
- *
- * Perform SDcard read/write tests
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtest(int nb_params, char **params)
-{
- unsigned int blocks;
- char *c;
-
- if (nb_params < 1) {
- printf("sdtest <number of blocks>");
- return;
- }
-
- blocks = strtoul(params[0], &c, 0);
- if (*c != 0) {
- printf("Incorrect number of blocks to write");
- return;
- }
-
- sdcard_test(blocks);
-}
-
-define_command(sdtest, sdtest, "SDCard test", SD_CMDS);
-#endif
-
-/**
- * Command "sdtestread"
- *
- * Perform SDcard read test
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtestread(int nb_params, char **params)
-{
- unsigned int block;
- char *c;
-
- if (nb_params < 1) {
- printf("sdtestread <block number>");
- return;
- }
-
- block = strtoul(params[0], &c, 0);
- if (*c != 0) {
- printf("Incorrect number of block to read");
- return;
- }
-
- sdcard_test_read(block);
-}
-
-define_command(sdtestread, sdtestread, "SDCard test read", SD_CMDS);
-#endif
-
-/**
- * Command "sdtestwrite"
- *
- * Perform SDcard write test
- *
- */
-#ifdef CSR_SDCORE_BASE
-static void sdtestwrite(int nb_params, char **params)
-{
- unsigned int block;
- char *c;
-
- if (nb_params < 2) {
- printf("sdtestread <block number> <str to write>");
- return;
- }
-
- block = strtoul(params[0], &c, 0);
- if (*c != 0) {
- printf("Incorrect number of block to write");
- return;
- }
-
- sdcard_test_write(block, params[1]);
-}
-
-define_command(sdtestwrite, sdtestwrite, "SDCard test write", SD_CMDS);
-#endif
+++ /dev/null
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <generated/csr.h>
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "fw"
- *
- * Write data from a memory buffer to SPI flash
- *
- */
-#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
-static void fw(int nb_params, char **params)
-{
- char *c;
- unsigned int addr;
- unsigned int value;
- unsigned int count;
- unsigned int i;
-
- if (nb_params < 2) {
- printf("fw <offset> <value> [count]");
- return;
- }
-
- addr = strtoul(params[0], &c, 0);
- if (*c != 0) {
- printf("Incorrect offset");
- return;
- }
-
- value = strtoul(params[1], &c, 0);
- if (*c != 0) {
- printf("Incorrect value");
- return;
- }
-
- if (nb_params == 2) {
- count = 1;
- } else {
- count = strtoul(params[2], &c, 0);
- if (*c != 0) {
- printf("Incorrect count");
- return;
- }
- }
-
- for (i = 0; i < count; i++)
- write_to_flash(addr + i * 4, (unsigned char *)&value, 4);
-}
-
-define_command(fw, fw, "Write to flash", SPIFLASH_CMDS);
-#endif
-
-/**
- * Command "fe"
- *
- * Flash erase
- *
- */
-#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
-static void fe(int nb_params, char **params)
-{
- erase_flash();
- printf("Flash erased\n");
-}
-
-define_command(fe, fe, "Erase whole flash", SPIFLASH_CMDS);
-#endif
-
--- /dev/null
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <generated/csr.h>
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "fw"
+ *
+ * Write data from a memory buffer to SPI flash
+ *
+ */
+#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
+static void fw(int nb_params, char **params)
+{
+ char *c;
+ unsigned int addr;
+ unsigned int value;
+ unsigned int count;
+ unsigned int i;
+
+ if (nb_params < 2) {
+ printf("fw <offset> <value> [count]");
+ return;
+ }
+
+ addr = strtoul(params[0], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect offset");
+ return;
+ }
+
+ value = strtoul(params[1], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect value");
+ return;
+ }
+
+ if (nb_params == 2) {
+ count = 1;
+ } else {
+ count = strtoul(params[2], &c, 0);
+ if (*c != 0) {
+ printf("Incorrect count");
+ return;
+ }
+ }
+
+ for (i = 0; i < count; i++)
+ write_to_flash(addr + i * 4, (unsigned char *)&value, 4);
+}
+
+define_command(fw, fw, "Write to flash", SPIFLASH_CMDS);
+#endif
+
+/**
+ * Command "fe"
+ *
+ * Flash erase
+ *
+ */
+#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
+static void fe(int nb_params, char **params)
+{
+ erase_flash();
+ printf("Flash erased\n");
+}
+
+define_command(fe, fe, "Erase whole flash", SPIFLASH_CMDS);
+#endif
+