From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796006018; b=PUlMjhy74gjYhWnsGYR5Jw7AhPZKwle1iTFFJScDbadHFS6Dnw2egs0P+/0tPwCKMFUW evF8MLIpf2QnTVS1Wtp/aM5ja5dNQ6nZfg5nxlPmxO7GxTVJ9bITzIc0H67ENqQPadji5 s4LNG8U5eFfQcard9/5soMTeDfxtU/V9vBXoVlaDO83PPagaBuGCHMZ5CG5C+HX9Ndmw6 UUVdCyaB4R6YTocxO13XAxnz6EhIsZYfL4UeQ087Rg+zQDqvRbSQ4J4pps8RwofBK0AXu WCH5I9O/vR/5sqvKax9kw6+hq/7vTaHBpgRy01hmarrLekxfSX3tEwpuTw1jHlzuFZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796006018; h=DMARC-Filter:Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Type:Content-Transfer-Encoding: X-CM-TRANSID:X-CM-SenderInfo:X-Coremail-Antispam; bh=OaFy7nB9YYfCMwviJLy54YQvqAbO52I/N6EVtQpPPWw=; b=MFDfxwqth2AJIdRTyAxP5Hc92iBsUYWck/PYP0p1mE0eMy2IW33TI8SHL+EjJiSJxb2+ aEjRL702++FFCDQnGhx4Os9jRjVDUYGQpLiM4phicUJW47FVbrjRoALJZV65vK1kSbryg f9xvgE1L+75XpWwhWdquYJ28LpMWuTaRHX8yibiTBdMS7KGWR/8QkqEOymTpRk42OZn7A IhSTQWxRBkCQbD4CG/dEwXaAm0tfZL4UjLo5T1H6Btr2zGSLmeoxZ6XhhMMD5esbbpyZl LreJP0l9J078NmOdDAoU2y/LumA7GqvWogwEtmrBBMy47S4QX9ZnU884gOwjAA/lt4Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.remote-ip=114.242.206.163 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ECA8606A33E; Mon, 30 Nov 2026 02:33:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2ECA8606A33E Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.69.66]) by gateway (Coremail) with SMTP id _____8AxZ7V34AxrLSEkAA--.8391S3; Mon, 30 Nov 2026 10:33:27 +0800 (CST) Received: from kernelserver (unknown [223.64.69.66]) by front1 (Coremail) with SMTP id qMiowJBx5cxz4AxrOSk4AA--.18519S2; Mon, 30 Nov 2026 10:33:24 +0800 (CST) From: Binbin Zhou To: Binbin Zhou , Huacai Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Yinbo Zhu , Mark Brown Cc: Huacai Chen , Xuerui Wang , loongarch@lists.linux.dev, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, Bingxiong Li , Binbin Zhou Subject: [PATCH v2 0/5] spi: loongson: SPI-IO driver for Loongson-2K0300 Date: Mon, 30 Nov 2026 10:32:59 +0800 Message-ID: X-Mailer: git-send-email 2.52.0 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID:qMiowJBx5cxz4AxrOSk4AA--.18519S2 X-CM-SenderInfo: p2kr3uplqex0o6or00hjvr0hdfq/1tbiAgEHCGsLmAAJRAACs7 X-Coremail-Antispam: 1Uk129KBj93XoW7uFykAr1DJryrWFy8Kw1fZrc_yoW5JrWrpa y5W39akr4ktFyayrsxAa409Fy5Z34fCrnrGay2yw1xXFZ8Ga4UXryUt3Z0van7CF1xXa4j vFykCF4UWay5WrXCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07URa0PUUUUU= Hi all: This series adds a new SPI controller driver for the Loongson-2K0300 SPI-IO blocks (SPI2 / SPI3). On the Loongson-2K0300 these blocks reside in the chip IO address space (0x1610,c000 – 0x1610,ffff) and only support IO-space access; a separate QSPI controller handles the main SPI pins on the same SoC, so this driver uses the dedicated compatible "loongson,ls2k0300-spi-io". Test results SPI NOR flash on SPI2, spi-max-frequency = 28000000: DMA: read: ~3.1 MB/s write: ~401 kB/s Intterupt: read: ~750 KB/s write: ~300 kB/s Thanks. Binbin ======== V2: Issues from sashiko. Patch (2/5): - Add Acked-by tag from Conor, thanks. Patch (3/5): - Drop SPI_3WIRE support; - Add optimize_message()/prepare_message()/unprepare_message() callbacks; - Split transfer_one() into setup_transfer()/transfer_one_irq()/ transfer_one_dma(), and share the idle restore via reset_state() between handle_err() and unprepare_message(). - Enable the OVR/UDR/CRC/MODF interrupts (new IER_ERR_MASK); in the IRQ handler clear the W1C status first and ignore errors while idle. - Use DIV64_U64_ROUND_UP() for the timeout math (fixes 32-bit builds) and derive max/min_speed_hz from the CFG2_BRINT limits. - Request the IRQ without IRQF_SHARED, use a fixed "loongson-spi-io" name, and initialize the controller before requesting the IRQ. Patch (4/5): - Tighten can_dma(): require both tx_buf and rx_buf, non-zero length, 4-byte aligned length and buffers. - Return PTR_ERR()/-ENOMEM on dmaengine_prep_slave_sg() failure instead of a fixed -EINVAL, so the fallback to interrupt mode is taken correctly. Link to V1: https://lore.kernel.org/all/cover.1795425389.git.zhoubinbin@loongson.cn/ Binbin Zhou (5): spi: dt-bindings: loongson,ls2k-spi: Document loongson,ls2k0300-spi compatible spi: dt-bindings: loongson,ls2k-spi: Document loongson,ls2k0300-spi-io compatible spi: loongson: Add spi-io interrupt-driven driver spi: loongson: Add DMA support to SPI-IO driver MAINTAINERS: Add myself as Loongson SPI maintainer .../bindings/spi/loongson,ls2k-spi.yaml | 45 + MAINTAINERS | 2 + drivers/spi/Kconfig | 16 + drivers/spi/Makefile | 1 + drivers/spi/spi-loongson-io.c | 1206 +++++++++++++++++ 5 files changed, 1270 insertions(+) create mode 100644 drivers/spi/spi-loongson-io.c base-commit: 543bc7b4337302ae75119059bdeff6df8eb34b56 -- 2.52.0