From: Sean Anderson Date: Fri, 16 Oct 2020 18:57:42 -0400 Subject: [PATCH v4 00/13] riscv: Add SPI support for Kendryte K210 Message-ID: <20201016225755.302659-1-seanga2@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This series adds support for SPI on the Kendryte K210. This covers the MMC slot and SPI flash on the Sipeed Maix Bit. This series makes significant changes to the designware SPI driver. I would really appreciate if the maintainers I CC'd could test this series and ensure that SPI still works on all their devices. I have tried my best not to affect existing devices, but I'd rather find out if this breaks stuff now rather than later. In particular, the method of detecting SSI_MAX_XFER_SIZE has changed since the last revision, and will need to be re-tested. This series was previously part of https://patchwork.ozlabs.org/project/uboot/list/?series=161576 Changes in v4: - Auto-detect SSI_MAX_XFER_SIZE - Consolidate log messages in dw_spi_xfer. We don't need to print twice in such short succession. - Convert most log_xxx messages to dev_xxx. Since ceb70bb870 ("dm: Print device name in dev_xxx like Linux"), dev_xxx can be controlled at runtime in the same way as log_xxx. The log messages in dw_reader/dw_writer are not converted to reduce the amount of instructions in those loops, even with logging enabled. - Enable booting from MMC - Fix MMC transfer errors - Place env in spi flash - Rearrange headers in designware_spi.c - Remove spi_enable_chip - Update documentation Changes in v3: - Lower the log level of some messages - Prefix user-facing logs with SPI@
- 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. - Reword error messages as "message (error %d)" - Synchronize compatible strings between docs and driver - Use constant 0x10000 instead of SZ_64K. The latter is not included on some platforms and I'm too lazy to figure out what the correct header is. Changes in v2: - Add Gigadevice SPI chips to dependencies - Add external gpio cs support - Clean up exec_op - Configure ctrlr0 register layout based on compatible string - Convert debug calls to log_ instead of removing the ones which affect timing - Document new compatible strings - Limit data transfers to 64k - Remove broken-wp property (implicit due to no wp gpio) - Remove ctrl0 field offsets from device tree - Switch to new compatible strings - Switch to new pinmux binding style Sean Anderson (13): spi: dw: Fix driving MOSI low while recieving spi: dw: Convert calls to debug to dev_* spi: dw: Rename "cs-gpio" to "cs-gpios" spi: dw: Use generic function to read reg address spi: dw: Rename registers to match datasheet spi: dw: Remove spi_enable_chip spi: dw: Rearrange struct dw_spi_priv spi: dw: Add SoC-specific compatible strings spi: dw: Add support for multiple CTRLR0 layouts spi: dw: Document devicetree binding spi: dw: Add mem_ops riscv: Add device tree bindings for SPI riscv: Add support for SPI on Kendryte K210 arch/arc/dts/axs10x_mb.dtsi | 5 +- arch/arc/dts/hsdk-common.dtsi | 5 +- arch/arm/dts/socfpga.dtsi | 6 +- arch/arm/dts/socfpga_agilex.dtsi | 6 +- arch/arm/dts/socfpga_arria10.dtsi | 6 +- arch/arm/dts/socfpga_stratix10.dtsi | 6 +- arch/mips/dts/mscc,jr2.dtsi | 2 +- arch/mips/dts/mscc,ocelot.dtsi | 2 +- arch/riscv/dts/k210-maix-bit.dts | 46 +- arch/riscv/dts/k210.dtsi | 15 +- board/sipeed/maix/Kconfig | 16 + configs/sipeed_maix_bitm_defconfig | 10 + doc/board/sipeed/maix.rst | 319 +++++++++++--- .../spi/snps,dw-apb-ssi.txt | 56 +++ drivers/spi/designware_spi.c | 401 ++++++++++++++---- include/configs/sipeed-maix.h | 7 +- 16 files changed, 743 insertions(+), 165 deletions(-) create mode 100644 doc/device-tree-bindings/spi/snps,dw-apb-ssi.txt -- 2.28.0