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: 1236165 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=MfTh85ZA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Gsgg2TW8z9sRN for ; Tue, 11 Feb 2020 17:05:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A35A180720; Tue, 11 Feb 2020 07:05:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MfTh85ZA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 216968065B; Tue, 11 Feb 2020 07:04:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ACDC280367 for ; Tue, 11 Feb 2020 07:04:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qv1-xf44.google.com with SMTP id y8so4462777qvk.6 for ; Mon, 10 Feb 2020 22:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vp0nBbYPTJ8dgDOtMSMNT3PItZnOG/KL3hdmpVJ7EME=; b=MfTh85ZAstZsj3SWz4PQt1pC8Ob1w8T7QbfnMoa6lAp9pGQJExfG4cQd8tiozM3MVT 7SkxVea/JPeU26UnTe1W8QRcIijwetuXrN7CEjuN+9Zav2/HlFostJAGUWSzJQovrCZ5 QARYikH3yq7ipd0WBd9AEWqU0YxMiXl0zv/CYoklGeNffCvp1u010AqxYN84WXMNQaXK homKVJpXu/S14eb/CmrSzHdCBkuIiJBRb/fOCcKlI/u9xiJOxIcOfnKpyj+WoAXnPunz vm0hZpnKQiYsMesDcavQPLPDfGIu6qHg0qyykKFdOAqdYfCMOjDnJvi28foCHkbN+ipR DMKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vp0nBbYPTJ8dgDOtMSMNT3PItZnOG/KL3hdmpVJ7EME=; b=MbokOMtMSfB3yVMP5NLGY3Q0riEgcwWGSNQryIMrzpHD1n9j9hGyzqFI4XHTS6BpSZ bJMLzc0xJRwCRb3tvdcuIGSnZTDTh/pvPXQtVJyfzu7CYfhUa8wxcF789TjwK/w+Gv9P AJvFbCbMRQTsk/TColQXXKm44eyi0Eadp21It3ZipX2RvM+roCxoAb8+xXL+6LQGRpOI 8lDXa3X86+loaaDHvuHzg99MCwzdxOZx7rE/FiD6tde5eRPt/tyh+mBiNzNe0HXgnDDo WoMcTszRX+436vmuTmuDCzXZzPvtADdf3R0sqhK3IiUHtLxTLImNO1gqScItsuSaxOIu xt3w== X-Gm-Message-State: APjAAAVt0k2u/XGVZ9ob48Xx82hAVTKHX8l6tVZ8oJhHMe7Ll2YdJW+E C0gj70WYSDfvxixKaPS1346zEsTk7Zvcxg== X-Google-Smtp-Source: APXvYqxaSYocB+DH4XYXGli10EUkNifKlWfwlZcHNCzZ/7d8tucfoUx3Yil/yM4tzTNY2FGwote1wA== X-Received: by 2002:ad4:4e09:: with SMTP id dl9mr1493509qvb.137.1581401093788; Mon, 10 Feb 2020 22:04:53 -0800 (PST) Received: from localhost.localdomain ([75.102.135.197]) by smtp.gmail.com with ESMTPSA id n4sm1497608qti.55.2020.02.10.22.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 22:04:53 -0800 (PST) From: Sean Anderson To: u-boot@lists.denx.de Subject: [PATCH v4 00/17] riscv: Add Sipeed Maix support Date: Tue, 11 Feb 2020 01:04:08 -0500 Message-Id: <20200211060425.1619471-1-seanga2@gmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rick Chen , Eugeniy Paltsev Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean 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@38000000 Out: serial@38000000 Err: serial@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