Open mithro opened 7 years ago
See also the QEMU issue at https://github.com/timvideos/qemu-litex/issues/17
Bit Banging SPI SD Card support
mmcflash_bitbang_out: gpio-controller@e0015000 {
compatible = "basic-mmio-gpio", "wd,mbl-gpio";
reg = <0xe0015000 0x4>;
#gpio-cells = <2>;
ngpios = <3>;
gpio-line-names = "SPI MOSI", "SPI SCLK", "SPI CS_N";
gpio-controller;
reg-names = "dat";
big-endian;
};
mmcflash_bitbang_in: gpio-controller@e0015004 {
compatible = "basic-mmio-gpio", "wd,mbl-gpio";
reg = <0xe0015004 0x4>;
#gpio-cells = <2>;
ngpios = <1>;
gpio-line-names = "SPI MISO";
gpio-controller;
reg-names = "dat";
no-output;
big-endian;
};
mmcflash_bitbang_en: gpio-controller@e0015008 {
compatible = "basic-mmio-gpio", "wd,mbl-gpio";
reg = <0xe0015008 0x4>;
#gpio-cells = <2>;
ngpios = <1>;
gpio-line-names = "SPI BitBang EN";
gpio-controller;
reg-names = "dat";
big-endian;
mmc_bitbang_en {
gpio-hog;
gpios = <0 0>;
output-high;
};
};
mmc-spi {
compatible = "spi-gpio";
#address-cells = <0x1>;
ranges;
gpio-mosi = <&mmcflash_bitbang_out 0 0>; // 0x01 on reg0
gpio-sck = <&mmcflash_bitbang_out 1 0>; // 0x02 on reg0
cs-gpios = <&mmcflash_bitbang_out 2 0>; // 0x03 on reg0
gpio-miso = <&mmcflash_bitbang_in 0 0>; // 0x01 on reg1
num-chipselects = <1>;
/* clients */
mmc-slot@0 {
compatible = "fsl,mpc8323rdb-mmc-slot",
"mmc-spi-slot";
reg = <0>;
//gpios = <&qe_pio_d 14 1
// &qe_pio_d 15 0>; // card detect, write protect
voltage-ranges = <3300 3300>;
spi-max-frequency = <50000000>;
no-sdio;
no-sd;
//interrupts = <42>;
//interrupt-parent = <&PIC>;
mmccard: mmccard@0 {
reg = <0>;
compatible = "mmc-card";
};
};
};
mmc_spi spi32765.0: spi_bitbang_setup, 2500 nsec/bit
mmc_spi spi32765.0: setup mode 0, 8 bits/w, 400000 Hz max --> 0
mmc0: req done (CMD9): 0: 00000000 00000000 00000000 00000000
mmc0: 16 bytes transferred: 0
mmc0: clock 50000000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0
mmc_spi spi32765.0: spi_bitbang_setup, 20 nsec/bit
mmc_spi spi32765.0: setup mode 0, 8 bits/w, 50000000 Hz max --> 0
mmc_spi spi32765.0: mmc_spi: clock to 50000000 Hz, 0
mmc0: new MMC card on SPI
mmcblk0: mmc0:0001 QEMU!32.0 MiB
drivers/tty/serial/uart-litex.c litex_uart_start_tx
mmc0: starting CMD13 arg 00000000 flags 00000195
mmc_spi spi32765.0: mmc_spi: CMD13, resp R2/R5
ssi_sd: NULL command
bitbang_ssi: transfer(ff) -> ff
bitbang_ssi: transfer(4d) -> ff
As Linux really needs storage, so we need to figure out the storages stuff.
Most of the boards have microsd card slots. However, we don't have any gateware which works with the sdcard slot yet.
However, we don't have any gateware on the FPGA side at the moment. There is a SPI master core in MiSoC -- maybe that could be used? There was the sdcard test stuff @enjoy-digital published at https://github.com/enjoy-digital/sdcard_test