[PATCH v3 10/10] riscv: Add support for SPI on Kendryte K210
Sean Anderson
seanga2 at gmail.com
Mon Sep 14 17:35:03 CEST 2020
This patch enables configs necessary for using SPI. It also adds some
documentation.
Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---
Changes in v3:
- Rebase onto U-Boot master
- Remove env and bootcmd configuration. I'm going to punt on those for now,
since I haven't worked out the best way to boot with SPI yet. Those
settings may be added back in a follow-up patch.
Changes in v2:
- Add Gigadevice SPI chips to dependencies
board/sipeed/maix/Kconfig | 11 +++++++
configs/sipeed_maix_bitm_defconfig | 1 +
doc/board/sipeed/maix.rst | 46 ++++++++++++++++++++++++++++++
3 files changed, 58 insertions(+)
diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
index 4c42dd2087..48a4e9dc1a 100644
--- a/board/sipeed/maix/Kconfig
+++ b/board/sipeed/maix/Kconfig
@@ -53,4 +53,15 @@ config BOARD_SPECIFIC_OPTIONS
imply CMD_GPIO
imply LED
imply LED_GPIO
+ imply SPI
+ imply DESIGNWARE_SPI
+ imply SPI_FLASH_GIGADEVICE
+ imply SPI_FLASH_WINBOND
+ imply DM_MTD
+ imply SPI_FLASH_MTD
+ imply CMD_MTD
+ imply ENV_IS_IN_SPI_FLASH
+ imply MMC
+ imply MMC_BROKEN_CD
+ imply MMC_SPI
endif
diff --git a/configs/sipeed_maix_bitm_defconfig b/configs/sipeed_maix_bitm_defconfig
index 459bf0d530..0ab88c4125 100644
--- a/configs/sipeed_maix_bitm_defconfig
+++ b/configs/sipeed_maix_bitm_defconfig
@@ -2,6 +2,7 @@ CONFIG_RISCV=y
CONFIG_TARGET_SIPEED_MAIX=y
CONFIG_ARCH_RV64I=y
CONFIG_STACK_SIZE=0x100000
+CONFIG_USE_BOOTCOMMAND=y
# CONFIG_NET is not set
# CONFIG_INPUT is not set
# CONFIG_DM_ETH is not set
diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst
index 90ef70b7cf..a831121ca1 100644
--- a/doc/board/sipeed/maix.rst
+++ b/doc/board/sipeed/maix.rst
@@ -70,6 +70,7 @@ console shall be opened immediately. Boot output should look like the following:
U-Boot 2020.04-rc2-00087-g2221cc09c1-dirty (Feb 28 2020 - 13:53:09 -0500)
DRAM: 8 MiB
+ MMC: spi at 53000000:slot at 0: 0
In: serial at 38000000
Out: serial at 38000000
Err: serial at 38000000
@@ -230,6 +231,51 @@ To run legacy images, use the ``bootm`` command:
argv[0] = "<NULL>"
Hit any key to exit ...
+Flashing Images
+---------------
+
+To flash a kernel, transfer it over serial, then write it to the kernel
+partition.
+
+.. code-block:: none
+
+ => loady 80000000 1500000
+ ## Switch baudrate to 1500000 bps and press ENTER ...
+
+ *** baud: 1500000
+
+ *** baud: 1500000 ***
+ ## Ready for binary (ymodem) download to 0x80000000 at 1500000 bps...
+ C
+ *** file: loader.bin
+ $ sz -vv loader.bin
+ Sending: loader.bin
+ Bytes Sent:2478208 BPS:72937
+ Sending:
+ Ymodem sectors/kbytes sent: 0/ 0k
+ Transfer complete
+
+ *** exit status: 0 ***
+ ## Total Size = 0x0025d052 = 2478162 Bytes
+ ## Switch baudrate to 115200 bps and press ESC ...
+
+ *** baud: 115200
+
+ *** baud: 115200 ***
+ => sf probe
+ SF: Detected w25q128fw with page size 256 Bytes, erase size 4 KiB, total 16 MiB
+ => mtd write kernel 80000000 0 25d052
+ Writing 2478162 byte(s) at offset 0x00000000
+
+Partition Scheme
+^^^^^^^^^^^^^^^^
+
+There is no partition scheme specified by the manufacturer. The only requirement
+imposed by the firmware is that offset 0 will be loaded and ran. **NB:** kflash
+adds a 5-byte header to payloads (and a 32-byte trailer) to all payloads it
+flashes. If you use kflash to flash your payload, you will need to account for
+this header when specifying what offset in spi flash to load from.
+
Pin Assignment
--------------
--
2.28.0
More information about the U-Boot
mailing list