Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4722367B5 for ; Mon, 13 Oct 2025 12:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760358796; cv=none; b=mmOnh74OXQC9CJxkPFEtqfQl+bfknbKIwkMHQsiNW14LtI7kT7dDZAKqtY4wHocEBIss15LzMOi+JjGhBnCbFcQicnGfqe5JQSlGqrT6phjbdr96aCvr4GZ6GWUGc9v8CbMVVuGgiCy40IxAuJTYY8HuOYzhWL97Hu0VelEphZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760358796; c=relaxed/simple; bh=h8CFdd79v4VO3bij5qSEzeUJyA91RQMRi53bza5wKho=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nU/mc3ZrvXK+Cp8WD5sZCvBckMTNCXO2G7RLHn9n8eazuwuNgkr/uhPeTanhpQqcdN4t6293QsLGXdVzZtzqxZpdorbGOoBygms6zWgPlqguM6+254WXv5q9ENZf7zwSOlQLQdsjmYlQv97Y+716rVa+4CnTSFb/NefdCfSmGq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=1yj0+DN0; arc=none smtp.client-ip=209.85.166.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="1yj0+DN0" Received: by mail-il1-f195.google.com with SMTP id e9e14a558f8ab-42f6100475aso18471925ab.1 for ; Mon, 13 Oct 2025 05:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1760358794; x=1760963594; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tLrx3aJ85cahSgBHalujwwLYoL+tJ6ZOd2UYi1030U0=; b=1yj0+DN0dBHUrnOnY/XHtFcCsa+zNYCymF3jYaGkACIC0KbZvws4jFClaxI4MDK+gd CMnqQhu30XHqRAAyyyyxS1b2I/0tamCCcelFEwNqBMq19pj6fq7uiqVcTfH/SekoxfCn ChWzJT71+fb+w5sLJR36CI7KPaDDrJhaACWGz2CUz5h+8njdjJ+2EvA5K2A3UyJbNjIc GzaGyGQwHCoFFxvQWhcBFCyFFxqTluNFXKWWmXTMV2KF1HuhFYoWLr30lGV8Mu2pM3LG ld1uvYw/jxOtJvPD0bc0JX93cvIJfBcNM0H+db/QVYOyhvlSDwzKfGkf6Ku5QyZ9wo42 IYGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760358794; x=1760963594; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tLrx3aJ85cahSgBHalujwwLYoL+tJ6ZOd2UYi1030U0=; b=YC7eP3Ja80W1BBA+7p1N4lkvATxgelR2pbd1QGLxBZquzStZAopHXqHvXy4GlzTvJX vWbJmRw2JLGjl4L9Oa69pKLAS5tvG5up8elBDTzb1r7HQjjitWrgh+TQMxwIO5+nOMkt ky4YaN6Q48Rt+g5DVPbPh2iF+RfTA3dASP4vFpoky1I0Z3h9NO/WIVPDX69aNKUT7K5D onDNmMYnqIkBaZ+a0rShHnDlQo+W5DnxOtsNTPj9m1PsFn0daLejNqkTTAU4x8H3O4Mu d2J+oAceKQ8KdQB3ITZ6WkVXFWOTP0PvF6miiGdZZf/ApKIEm6nWb1ShwwGh9w5vWYXx npmg== X-Forwarded-Encrypted: i=1; AJvYcCXPlhvzO5liiSiw2mTcCkWFmeGmbNG6uBnIbNNh43DLZmM3BYBIwbxgznwsrfY1DXMSlRw6sUePCNiO@vger.kernel.org X-Gm-Message-State: AOJu0YykHGMz+c0iQRdWmoGovow8AiBxZce7OIcfcXRmCR5ffuLWZIR0 lrpQhZ9n4dXsgqzOCwdqeYcFo8ps0hgkqjuZMIQEuAGQ83C5Vq8jm51uGZUvG1jr1ds= X-Gm-Gg: ASbGncuEsJ/mxXUGfAymmjJGNNGPOuDFKq6iE+w06MI7XmBSbv1SesO1uBK3qPWF6kL cflzsFbgH2pixZMmvIp+RCTYcrWUhunsQr+AS1o1yLc0xQrQYvM0xGXAUtszhV09YJEgseKU5wm SxqwOnFYfZ5ysUWAX5JFcOtxU8QdZZ1+/t9vvlPYepN8d/mAaEyGN8pCFl9DrK9rXa2vBcuwakk GaMzt3i4OrpLYl/19xCIEwYejihm6ELlfvlP/W6LS9EUC3gJh4IXPgZaQA2JQdkgGnsx2xV3uYT uVArkBYBmE3kGtsdDn5rLmlZBAjJHkhL84AkHan/c+UCrNOJhBPv5UD2QgGMLvYzVRsZTcuk28B CjWLl+5L4h9G+C+y1CqiUe1Sx3OsloHf/cgreFby5iCc97w1oF34upe7y2fehBowy1N7s5c9P5+ z4Zgsv0W/lOGonhGso8QA= X-Google-Smtp-Source: AGHT+IFg0DwI3pqrI0r0Isbt8WNPInul2Q08ViVQNFGip0noHZxRDTL9hoja3a4mal6MKLFRgicfyg== X-Received: by 2002:a05:6e02:4713:b0:42f:8eeb:49a1 with SMTP id e9e14a558f8ab-42f8eeb4a2fmr172406555ab.13.1760358793820; Mon, 13 Oct 2025 05:33:13 -0700 (PDT) Received: from zippy.localdomain (c-75-72-117-212.hsd1.mn.comcast.net. [75.72.117.212]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-42f9037e344sm51529815ab.34.2025.10.13.05.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Oct 2025 05:33:13 -0700 (PDT) From: Alex Elder To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: dlan@gentoo.org, guodong@riscstar.com, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, p.zabel@pengutronix.de, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, spacemit@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/3] spi: support the SpacemiT K1 SPI controller Date: Mon, 13 Oct 2025 07:33:05 -0500 Message-ID: <20251013123309.2252042-1-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series adds support for the SPI controller found in the SpacemiT K1 SoC. The driver currently supports only master mode. The controller has two 32-entry FIFOs and supports PIO and DMA for transfers. Version 5 adds Yixun's Reviewed-by tag on patch 3, and is based on Linux v6.18-rc1. -Alex This series is available here: https://github.com/riscstar/linux/tree/outgoing/spi-v5 Between version 4 and version 5: - Added Yixun's Reviewed-by tag on patch 3 Here is version 4 of this series: https://lore.kernel.org/lkml/20250925121714.2514932-1-elder@riscstar.com/ Between version 3 and version 4 (all suggested by Yixun): - Fixed an underrun/overrun comment error - Renamed a pinctrl node - Formatted dmas and dma-names properties on one line Here is version 3 of this series: https://lore.kernel.org/lkml/20250922161717.1590690-1-elder@riscstar.com/ Between version 2 and version 3: - Add Conor's Acked-by to patch 1 - Add Rob's Reviewed-by to patch 1 - Added imply_PDMA to the SPI_SPACEMIT_K1 Kconfig option - Fixed a bug pointed out by Vivian (and Troy) in word-sized reads - Added a comment stating we use 1, 2, or 4 bytes per word - Cleaned up DMA channels properly in case of failure setting up - No longer use devm_*() for allocating DMA channels or buffer - Moved the SPI controller into the dma-bus memory region Here is version 2 of this series: https://lore.kernel.org/lkml/20250919155914.935608-1-elder@riscstar.com/ Between version 1 and version 2: - Use enum rather than const for the binding compatible string - Omit the label and status property in the binding example - The spi-spacemit-k1.o make target is now added in sorted order - The SPI_SPACEMIT_K1 config option is added in sorted order - The SPI_SPACEMIT_K1 config does *not* depend on MMP_PDMA, however MMP_PDMA is checked at runtime, and if not enabled, DMA will not be used - Read/modify/writes of registers no longer use an additional "virt" variable to hold the address accessed - The k1_spi_driver_data->ioaddr field has been renamed base - The DMA address for the base address is maintained, rather than saving the DMA address of the data register - The spi-max-frequency property value is now bounds checked - A local variable is now initialized to 0 in k1_spi_write_word() - The driver name is now "k1-spi" - DT aliases are used rather than spacemit,k1-ssp-id for bus number - The order of two pin control properties was changed as requested - Clock names and DMA names are now on one line in the "k1.dtsi" - The interrupts property is used rather than interrupts-extended - The order of two pin control properties was changed as requested - Clock names and DMA names are now on one line in the "k1.dtsi" - The interrupts property is used rather than interrupts-extended Here is version 1 of this series: https://lore.kernel.org/lkml/20250917220724.288127-1-elder@riscstar.com/ Alex Elder (3): dt-bindings: spi: add SpacemiT K1 SPI support spi: spacemit: introduce SpacemiT K1 SPI controller driver riscv: dts: spacemit: define a SPI controller node .../bindings/spi/spacemit,k1-spi.yaml | 84 ++ .../boot/dts/spacemit/k1-bananapi-f3.dts | 7 + arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 20 + arch/riscv/boot/dts/spacemit/k1.dtsi | 15 + drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-spacemit-k1.c | 965 ++++++++++++++++++ 7 files changed, 1101 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml create mode 100644 drivers/spi/spi-spacemit-k1.c base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787 -- 2.48.1