public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 07/11] riscv: Add initial Sipeed Maix support
Date: Sun, 26 Jan 2020 20:09:27 -0500	[thread overview]
Message-ID: <3e8a4fc6-0ef0-74da-593d-7c0f9e81ca31@gmail.com> (raw)
In-Reply-To: <a94e167b4b8fc82686031c11d91aa1722311e1c6.camel@auer.io>

On 1/26/20 5:17 PM, Lukas Auer wrote:
> Hi Sean,
> 
> 
> On Wed, 2020-01-15 at 18:04 -0500, Sean Anderson wrote:
>> The Sipeed Maix series is a collection of boards built around the RISC-V
>> Kendryte K210 processor. This processor contains several peripherals to
>> accelerate neural network processing and other "ai" tasks. This includes a "KPU"
>> neural network processor, an audio processor supporting beamforming reception,
>> and a digital video port supporting capture and output at VGA resolution. Other
>> peripherals include 8M of sram (accessible with and without caching);
>> remappable pins, including 40 GPIOs; AES, FFT, and SHA256 accelerators; a DMA
>> controller; and I2C, I2S, and SPI controllers. Maix peripherals vary, but
>> include spi flash; on-board usb-serial bridges; ports for cameras, displays, and
>> sd cards; and ESP32 chips. Currently, only the Sipeed Maix Bit V2.0 (bitm) is
>> supported, but the boards are fairly similar.
>>
>> Documentation for Maix boards is located at <http://dl.sipeed.com/MAIX/HDK/>;.
>> Documentation for the Kendryte K210 is located at
>> <https://kendryte.com/downloads/>;. However, hardware details are rather lacking,
>> so most technical reference has been taken from the standalone sdk located at
>> <https://github.com/kendryte/kendryte-standalone-sdk>;.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> 
> This patch should be the last in the patch series, because it requires
> all other patches in the series.

Ok, will reorder it for v3.

>> ---
>> Changes for v2:
>>   Select CONFIG_SYS_RISCV_NOCOUNTER.
>>   Imply CONFIG_CLK_K210.
>>   Remove spurious references to CONFIG_ARCH_K210.
>>   Remove many configs from defconfig where the defaults were fine.
>>   Add a few "not set" lines to suppress unneeded defaults.
>>   Reduce pre-reloc malloc space, now that clocks initialization happens
>>   later.
>>   
>>  arch/riscv/Kconfig                 |  4 ++
>>  board/sipeed/maix/Kconfig          | 41 +++++++++++++
>>  board/sipeed/maix/MAINTAINERS      | 13 +++++
>>  board/sipeed/maix/Makefile         |  5 ++
>>  board/sipeed/maix/maix.c           |  9 +++
>>  configs/sipeed_maix_bitm_defconfig | 93 ++++++++++++++++++++++++++++++
>>  include/configs/sipeed-maix.h      | 19 ++++++
>>  7 files changed, 184 insertions(+)
>>  create mode 100644 board/sipeed/maix/Kconfig
>>  create mode 100644 board/sipeed/maix/MAINTAINERS
>>  create mode 100644 board/sipeed/maix/Makefile
>>  create mode 100644 board/sipeed/maix/maix.c
>>  create mode 100644 configs/sipeed_maix_bitm_defconfig
>>  create mode 100644 include/configs/sipeed-maix.h
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 4f8c62dcff..4c62b8dd77 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -20,6 +20,9 @@ config TARGET_QEMU_VIRT
>>  config TARGET_SIFIVE_FU540
>>  	bool "Support SiFive FU540 Board"
>>  
>> +config TARGET_SIPEED_MAIX
>> +	bool "Support Sipeed Maix Board"
>> +
>>  endchoice
>>  
>>  config SYS_ICACHE_OFF
>> @@ -53,6 +56,7 @@ source "board/AndesTech/ax25-ae350/Kconfig"
>>  source "board/emulation/qemu-riscv/Kconfig"
>>  source "board/microchip/mpfs_icicle/Kconfig"
>>  source "board/sifive/fu540/Kconfig"
>> +source "board/sipeed/maix/Kconfig"
>>  
>>  # platform-specific options below
>>  source "arch/riscv/cpu/ax25/Kconfig"
>> diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
>> new file mode 100644
>> index 0000000000..9259eb34aa
>> --- /dev/null
>> +++ b/board/sipeed/maix/Kconfig
>> @@ -0,0 +1,41 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +# Copyright (C) 2019 Sean Anderson <seanga2@gmail.com>
>> +
>> +if TARGET_SIPEED_MAIX
>> +
>> +config SYS_BOARD
>> +	default "maix"
>> +
>> +config SYS_VENDOR
>> +	default "sipeed"
>> +
>> +config SYS_CPU
>> +	default "generic"
>> +
>> +config SYS_CONFIG_NAME
>> +	default "sipeed-maix"
>> +
>> +config SYS_TEXT_BASE
>> +	default 0x80000000
>> +
>> +config NR_CPUS
>> +	default 2
>> +
>> +config NR_DRAM_BANKS
>> +	default 2
>> +
>> +config BOARD_SPECIFIC_OPTIONS
>> +	def_bool y
>> +	select GENERIC_RISCV
>> +	select DM_SERIAL
>> +	select SIFIVE_SERIAL
>> +	select ARCH_DEFAULT_RV64I
>> +	select ENV_IS_NOWHERE
> 
> ENV_IS_NOWHERE is automatically selected if no other environment
> provider is available, so no need to include it here.

Ok, I will remove that in v3. As a general rule, what sort of things
should be in Kconfig vs in the default config? I initially thought that
all dependencies should be in Kconfig, but "imply" just seems to set the
default, which means it won't be changed if you pick another board and
then pick this one.

> Also, why are you not using the SD card to store the environment?

I haven't managed to get my SD card working yet. I think it may be too
big (it's 32G), so I am planning to find a smaller one. 

>> +	select SYS_RISCV_NOCOUNTER
>> +	imply SIFIVE_CLINT
>> +	imply SPI
>> +	imply DM_GPIO
>> +	imply CMD_GPIO
>> +	imply SYS_NS16550
>> +	imply SYS_MALLOC_F
>> +endif
>> diff --git a/board/sipeed/maix/MAINTAINERS b/board/sipeed/maix/MAINTAINERS
>> new file mode 100644
>> index 0000000000..217de45970
>> --- /dev/null
>> +++ b/board/sipeed/maix/MAINTAINERS
>> @@ -0,0 +1,13 @@
>> +Sipeed Maix BOARD
>> +M:	Sean Anderson <seanga2@gmail.com>
>> +S:	Maintained
>> +F:	arch/riscv/dts/k210.dtsi
>> +F:	arch/riscv/dts/k210-maix-bit.dts
>> +F:	arch/riscv/include/asm/k210_sysctl.h
>> +F:	arch/riscv/lib/k210_sysctl.c
>> +F:	board/sipeed/maix/
>> +F:	configs/sipeed_maix_defconfig
>> +F:	drivers/clk/kendryte/
>> +F:	include/configs/sipeed-maix.h
>> +F:	include/dt-bindings/clock/k210-sysctl.h
>> +F:	include/dt-bindings/reset/k210-sysctl.h
>> diff --git a/board/sipeed/maix/Makefile b/board/sipeed/maix/Makefile
>> new file mode 100644
>> index 0000000000..4acff5b31e
>> --- /dev/null
>> +++ b/board/sipeed/maix/Makefile
>> @@ -0,0 +1,5 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +# Copyright (c) 2019 Western Digital Corporation or its affiliates.
>> +
>> +obj-y += maix.o
>> diff --git a/board/sipeed/maix/maix.c b/board/sipeed/maix/maix.c
>> new file mode 100644
>> index 0000000000..f8e773acf7
>> --- /dev/null
>> +++ b/board/sipeed/maix/maix.c
>> @@ -0,0 +1,9 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2019 Sean Anderson <seanga2@gmail.com>
>> + */
>> +
>> +int board_init(void)
>> +{
>> +	return 0;
>> +}
>> diff --git a/configs/sipeed_maix_bitm_defconfig b/configs/sipeed_maix_bitm_defconfig
>> new file mode 100644
>> index 0000000000..f062cc8c58
>> --- /dev/null
>> +++ b/configs/sipeed_maix_bitm_defconfig
>> @@ -0,0 +1,93 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +# Copyright (C) 2019 Sean Anderson <seanga2@gmail.com>
>> +CONFIG_CREATE_ARCH_SYMLINK=y
>> +CONFIG_RISCV=y
>> +CONFIG_SYS_ARCH="riscv"
>> +CONFIG_SYS_CPU="generic"
>> +CONFIG_SYS_VENDOR="sipeed"
>> +CONFIG_SYS_BOARD="maix"
>> +CONFIG_SYS_CONFIG_NAME="sipeed-maix"
>> +CONFIG_SPL_LDSCRIPT="arch/riscv/cpu/u-boot-spl.lds"
>> +CONFIG_SYS_TEXT_BASE=0x80000000
>> +CONFIG_SYS_MALLOC_F_LEN=0x1000
>> +CONFIG_BOARD_SPECIFIC_OPTIONS=y
>> +CONFIG_NR_DRAM_BANKS=2
>> +CONFIG_BOOTSTAGE_STASH_ADDR=0
>> +CONFIG_64BIT=y
>> +CONFIG_TARGET_SIPEED_MAIX=y
>> +CONFIG_NR_CPUS=2
>> +CONFIG_GENERIC_RISCV=y
>> +CONFIG_ARCH_DEFAULT_RV64I=y
>> +CONFIG_ARCH_RV64I=y
>> +CONFIG_CMODEL_MEDLOW=y
>> +CONFIG_RISCV_MMODE=y
>> +CONFIG_RISCV_ISA_C=y
>> +CONFIG_RISCV_ISA_A=y
>> +CONFIG_SIFIVE_CLINT=y
>> +CONFIG_K210_SYSCTL=y
>> +CONFIG_SYS_RISCV_NOCOUNTER=y
>> +CONFIG_ARCH_K210=y
>> +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
>> +CONFIG_SYS_MALLOC_F=y
>> +CONFIG_PHYS_64BIT=y
>> +# CONFIG_ANDROID_BOOT_IMAGE is not set
>> +# CONFIG_FIT is not set
>> +# CONFIG_LEGACY_IMAGE_FORMAT is not set
>> +CONFIG_LOG=y
>> +CONFIG_ARCH_EARLY_INIT_R=y
>> +CONFIG_CMDLINE=y
>> +CONFIG_CMD_ENV_EXISTS=y
>> +CONFIG_CMD_FLASH=y
>> +CONFIG_CMD_SF=y
>> +CONFIG_CMD_LOG=y
>> +# CONFIG_AUTOBOOT is not set
>> +# CONFIG_CMD_BDI is not set
>> +# CONFIG_CMD_CONSOLE is not set
>> +# CONFIG_CMD_BOOTD is not set
>> +# CONFIG_CMD_BOOTM is not set
>> +# CONFIG_CMD_BOOTZ is not set
>> +CONFIG_CMD_BOOTI=y
>> +CONFIG_BOOTM_LINUX=y
>> +# CONFIG_CMD_ELF is not set
>> +CONFIG_CMD_FDT=y
>> +CONFIG_SUPPORT_OF_CONTROL=y
>> +CONFIG_DTC=y
>> +CONFIG_OF_CONTROL=y
>> +CONFIG_OF_SEPARATE=y
>> +CONFIG_ENV_IS_NOWHERE=y
>> +# CONFIG_NET is not set
>> +CONFIG_DM=y
>> +CONFIG_REGMAP=y
>> +CONFIG_SYSCON=y
>> +CONFIG_SIMPLE_BUS=y
>> +CONFIG_OF_TRANSLATE=y
>> +CONFIG_CLK=y
>> +CONFIG_CLK_CCF=y
>> +CONFIG_CLK_COMPOSITE_CCF=y
>> +CONFIG_CPU=y
>> +CONFIG_CPU_RISCV=y
>> +CONFIG_MMC=y
>> +# CONFIG_INPUT is not set
>> +CONFIG_DM_MMC=y
>> +CONFIG_MMC_SPI=y
>> +CONFIG_MMC_QUIRKS=y
>> +CONFIG_MTD=y
>> +CONFIG_DM_MTD=y
>> +CONFIG_DM_SPI_FLASH=y
>> +CONFIG_SPI_FLASH=y
>> +CONFIG_SPI_FLASH_GIGADEVICE=y
>> +# CONFIG_DM_ETH is not set
>> +# CONFIG_PCI is not set
>> +CONFIG_BAUDRATE=115200
>> +CONFIG_SERIAL_PRESENT=y
>> +CONFIG_DM_SERIAL=y
>> +CONFIG_SIFIVE_SERIAL=y
>> +CONFIG_SPI=y
>> +CONFIG_DM_SPI=y
>> +CONFIG_SPI_MEM=y
>> +CONFIG_DESIGNWARE_SPI=y
>> +CONFIG_TIMER=y
>> +CONFIG_RISCV_TIMER=y
>> +CONFIG_PANIC_HANG=y
>> +CONFIG_OF_LIBFDT=y
>> +# CONFIG_EFI_LOADER is not set
> 
> Please use make savedefconfig to generate the defconfig.

Ah, I wasn't aware that that was the preferred way.

>> diff --git a/include/configs/sipeed-maix.h b/include/configs/sipeed-maix.h
>> new file mode 100644
>> index 0000000000..598f7dfdd0
>> --- /dev/null
>> +++ b/include/configs/sipeed-maix.h
>> @@ -0,0 +1,19 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2019 Sean Anderson <seanga2@gmail.com>
>> + */
>> +
>> +#ifndef CONFIGS_SIPEED_MAIX_H
>> +#define CONFIGS_SIPEED_MAIX_H
>> +
>> +#include <linux/sizes.h>
>> +
>> +#define CONFIG_SYS_LOAD_ADDR 0x80000000
>> +#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_LOAD_ADDR
>> +#define CONFIG_SYS_SDRAM_SIZE SZ_8M
>> +/* Start just below AI memory */
>> +#define CONFIG_SYS_INIT_SP_ADDR 0x805FFFFF
>> +#define CONFIG_SYS_MALLOC_LEN SZ_1K
>> +#define CONFIG_SYS_CACHELINE_SIZE 64
>> +
>> +#endif /* CONFIGS_SIPEED_MAIX_H */
> 
> How are you booting images? It would be great to include a default boot
> command.

The board I am using has some serial issues which makes it difficult to
flash any large images. I can get u-boot to flash after several
attempts, but something like the linux kernel is far too unreliable to
test regularly. I'm going to see if I can get my hands on another k210
board which hopefully doesn't have these issues.

> Please also add a short description on the board and how to use U-Boot
> with it to the documentation.

Will something like the commit message work?

> 
> Thanks,
> Lukas
> 

  reply	other threads:[~2020-01-27  1:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 22:45 [PATCH v2 00/11] riscv: Add Sipeed Maix support Sean Anderson
2020-01-15 22:47 ` [PATCH v2 01/11] clk: Always use the supplied struct clk Sean Anderson
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46C88BE@ATCPCS16.andestech.com>
2020-01-21  1:54     ` Rick Chen
2020-01-21  2:02       ` Sean Anderson
2020-01-21  2:23         ` Rick Chen
2020-01-21  3:18           ` Sean Anderson
2020-01-23  5:53             ` Sean Anderson
2020-01-24 14:27             ` Lukasz Majewski
2020-01-24 23:22               ` Sean Anderson
2020-01-25 20:18                 ` Lukasz Majewski
2020-01-26 21:20   ` Lukasz Majewski
2020-01-26 22:07     ` Sean Anderson
2020-01-27 23:40       ` Lukasz Majewski
2020-01-28 16:11         ` Sean Anderson
2020-01-30  0:29           ` Lukasz Majewski
2020-01-30  5:47             ` Sean Anderson
2020-01-31  9:18               ` Lukasz Majewski
2020-01-15 22:49 ` [PATCH v2 02/11] clk: Check that ops of composite clock components, exist before calling Sean Anderson
2020-01-26 21:25   ` Lukasz Majewski
2020-01-15 22:50 ` [PATCH v2 03/11] riscv: Add headers for asm/global_data.h Sean Anderson
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46C88DF@ATCPCS16.andestech.com>
2020-01-21  2:07     ` Rick Chen
2020-01-21  2:17       ` Sean Anderson
2020-01-26 22:04   ` Lukas Auer
2020-01-26 22:12     ` Sean Anderson
2020-01-26 22:23       ` Lukas Auer
2020-01-15 22:51 ` [PATCH v2 04/11] riscv: Add an option to default to RV64I Sean Anderson
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA46C88FE@ATCPCS16.andestech.com>
2020-01-21  2:16     ` Rick Chen
2020-01-15 22:53 ` [PATCH v2 05/11] riscv: Add option to disable writes to mcounteren Sean Anderson
2020-01-26 22:09   ` Lukas Auer
2020-01-26 22:24     ` Sean Anderson
2020-01-30 22:13       ` Lukas Auer
2020-01-15 22:55 ` [PATCH v2 06/11] riscv: Fix incorrect cpu frequency on RV64 Sean Anderson
2020-01-26 22:04   ` Lukas Auer
2020-01-15 23:04 ` [PATCH v2 07/11] riscv: Add initial Sipeed Maix support Sean Anderson
2020-01-26 22:17   ` Lukas Auer
2020-01-27  1:09     ` Sean Anderson [this message]
2020-01-30 22:21       ` Lukas Auer
2020-02-02  6:06         ` Sean Anderson
2020-01-15 23:16 ` [PATCH v2 00/11] riscv: Add " Sean Anderson
2020-01-15 23:18   ` [PATCH v2 08/11] riscv: Add device tree for K210 Sean Anderson
     [not found]     ` <752D002CFF5D0F4FA35C0100F1D73F3FA46C8947@ATCPCS16.andestech.com>
2020-01-21  2:54       ` Rick Chen
2020-01-15 23:20 ` [PATCH v2 09/11] riscv: Add K210 sysctl support Sean Anderson
2020-01-15 23:24 ` [PATCH v2 10/11] riscv: Add K210 pll support Sean Anderson
2020-01-15 23:26 ` [PATCH v2 11/11] riscv: Add K210 clock support Sean Anderson
2020-01-21  3:46 ` [PATCH v2 08/11] riscv: Add device tree for K210 Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e8a4fc6-0ef0-74da-593d-7c0f9e81ca31@gmail.com \
    --to=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox