From patchwork Tue Feb 11 06:04:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 236113 List-Id: U-Boot discussion From: seanga2 at gmail.com (Sean Anderson) Date: Tue, 11 Feb 2020 01:04:08 -0500 Subject: [PATCH v4 00/17] riscv: Add Sipeed Maix support Message-ID: <20200211060425.1619471-1-seanga2@gmail.com> This patch series adds support for Sipeed Maix boards and the Kendryte K210 CPU. Currently, only the Maix Bit V2.0 is supported, however other models are similar. This series depends on (clk: Include missing headers for linux/clk-provider.h). In addition, there are optional dependencies on and (wdt: Add DM support for Designware WDT) (riscv: Try to get cpu frequency from device tree) (serial: Set baudrate on boot) To flash u-boot to a maix bit, run kflash -tp /dev/ -B bit_mic u-boot-dtb.bin Boot output should look like the following: U-Boot 2020.01-00465-g1da52c6c9a (Feb 10 2020 - 20:26:50 -0500) DRAM: 8 MiB MMC: In: serial at 38000000 Out: serial at 38000000 Err: serial at 38000000 => The MMC (SD-card reader) does not work yet (see the second spi patch for details). I'm not sure how to set up autoboot. Should I arbitrarily assign partitions? Should I use MTD/UBI? Changes for v4: - Linted several patches - Updated the copyright year for several files - Added tests for syscon-reset, simple-pm-bus, and the pll calc_rate function - Added/updated documentation - Fixed SPI for the nor flash - Fixed PLLs not enabling/setting rate properly - RISCV_PRIV_1_9_1 now (un)defines all deferring CSRs, and also disables VM - More devicetree changes Changes for v3: - Remove patch to set RV64I as default - Remove patch for a separate sysctl driver - Split off cpu frequency patch into its own series - Reorder support/devicetree patches to come last - Add patch for reset driver - Add simple-pm-bus for busses with their own clocks - Add additional documentation - Reword mcounteren patch to refer to the RISC-V priv spec 1.9.1 - Many devicetree changes - Switch to "make savedefconfig" to generate the config Changes for v2: - Many bugfixes for the device tree - Modify the config to build without errors - Add support for keeping internal PLL frequencies in-range - Fix several rebase-induced artifacts Sean Anderson (17): clk: Always use the supplied struct clk clk: Check that ops of composite clock components exist before calling clk: Unconditionally recursively en-/dis-able clocks reset: Add generic reset driver dm: Add support for simple-pm-bus spi: dw: Add device tree properties for fields in CTRL1 spi: dw: Add mem_ops riscv: Add headers for asm/global_data.h riscv: Add option to support RISC-V privileged spec 1.9.1 riscv: Allow use of reset drivers riscv: Add K210 pll support riscv: Add a bypass clock for K210 riscv: Add K210 clock support riscv: Try to get cpu frequency from device tree riscv: Enable cpu clock if it is present riscv: Add device tree for K210 riscv: Add Sipeed Maix support MAINTAINERS | 6 + arch/riscv/Kconfig | 14 + arch/riscv/cpu/cpu.c | 9 + arch/riscv/dts/Makefile | 1 + arch/riscv/dts/k210-maix-bit.dts | 41 ++ arch/riscv/dts/k210.dtsi | 568 ++++++++++++++++ arch/riscv/include/asm/csr.h | 40 ++ arch/riscv/include/asm/global_data.h | 2 + arch/riscv/lib/reset.c | 2 + arch/sandbox/dts/test.dts | 21 + arch/sandbox/include/asm/clk.h | 1 + board/sipeed/maix/Kconfig | 56 ++ board/sipeed/maix/MAINTAINERS | 11 + board/sipeed/maix/Makefile | 5 + board/sipeed/maix/maix.c | 9 + configs/sandbox_defconfig | 2 + configs/sipeed_maix_bitm_defconfig | 10 + doc/board/index.rst | 1 + doc/board/sipeed/index.rst | 9 + doc/board/sipeed/maix.rst | 94 +++ .../bus/simple-pm-bus.txt | 44 ++ .../reset/syscon-reset.txt | 36 ++ .../spi/snps,dw-apb-ssi.txt | 43 ++ doc/imx/clk/ccf.txt | 63 +- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/clk-composite.c | 64 +- drivers/clk/clk-divider.c | 6 +- drivers/clk/clk-fixed-factor.c | 3 +- drivers/clk/clk-gate.c | 6 +- drivers/clk/clk-mux.c | 12 +- drivers/clk/clk-uclass.c | 59 +- drivers/clk/imx/clk-gate2.c | 4 +- drivers/clk/kendryte/Kconfig | 12 + drivers/clk/kendryte/Makefile | 1 + drivers/clk/kendryte/bypass.c | 268 ++++++++ drivers/clk/kendryte/clk.c | 409 ++++++++++++ drivers/clk/kendryte/pll.c | 604 ++++++++++++++++++ drivers/core/Kconfig | 7 + drivers/core/Makefile | 1 + drivers/core/simple-pm-bus.c | 55 ++ drivers/cpu/riscv_cpu.c | 38 +- drivers/reset/Kconfig | 5 + drivers/reset/Makefile | 1 + drivers/reset/reset-syscon.c | 79 +++ drivers/spi/designware_spi.c | 163 ++++- include/configs/sipeed-maix.h | 17 + include/dt-bindings/clock/k210-sysctl.h | 53 ++ include/dt-bindings/mfd/k210-sysctl.h | 38 ++ include/dt-bindings/reset/k210-sysctl.h | 38 ++ include/kendryte/bypass.h | 28 + include/kendryte/clk.h | 27 + include/kendryte/pll.h | 57 ++ include/test/export.h | 16 + test/dm/Makefile | 3 + test/dm/k210_pll.c | 95 +++ test/dm/simple-pm-bus.c | 44 ++ test/dm/syscon-reset.c | 58 ++ 58 files changed, 3235 insertions(+), 126 deletions(-) create mode 100644 arch/riscv/dts/k210-maix-bit.dts create mode 100644 arch/riscv/dts/k210.dtsi 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 doc/board/sipeed/index.rst create mode 100644 doc/board/sipeed/maix.rst create mode 100644 doc/device-tree-bindings/bus/simple-pm-bus.txt create mode 100644 doc/device-tree-bindings/reset/syscon-reset.txt create mode 100644 doc/device-tree-bindings/spi/snps,dw-apb-ssi.txt create mode 100644 drivers/clk/kendryte/Kconfig create mode 100644 drivers/clk/kendryte/Makefile create mode 100644 drivers/clk/kendryte/bypass.c create mode 100644 drivers/clk/kendryte/clk.c create mode 100644 drivers/clk/kendryte/pll.c create mode 100644 drivers/core/simple-pm-bus.c create mode 100644 drivers/reset/reset-syscon.c create mode 100644 include/configs/sipeed-maix.h create mode 100644 include/dt-bindings/clock/k210-sysctl.h create mode 100644 include/dt-bindings/mfd/k210-sysctl.h create mode 100644 include/dt-bindings/reset/k210-sysctl.h create mode 100644 include/kendryte/bypass.h create mode 100644 include/kendryte/clk.h create mode 100644 include/kendryte/pll.h create mode 100644 include/test/export.h create mode 100644 test/dm/k210_pll.c create mode 100644 test/dm/simple-pm-bus.c create mode 100644 test/dm/syscon-reset.c