Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp804490pxb; Tue, 12 Apr 2022 13:56:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxffqQ/XILkUCQuDOJh/ZooKOhvcS7gL9mcd1XgX8xkbsIIGrQcuWOrq1jIMpG0hAw23Yqf X-Received: by 2002:a17:902:d051:b0:158:5910:d67a with SMTP id l17-20020a170902d05100b001585910d67amr13261410pll.15.1649797009309; Tue, 12 Apr 2022 13:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649797009; cv=none; d=google.com; s=arc-20160816; b=xwEZkZYAf6Z8pTMV1dXo7ryIPTzH6rXIkz68Vpesk823A+XI2uxbiW/okGB2m92m9s IF8CKK4mGRY96cDGIs16dtev2af3UEvABOw8oaLdoerPXheeJefyebTAjY2vqKr9nhKX LyBl2HZvc76gfUdJcoTMIdUxPzsKYViTs50j5akiBmT0rPkz/S61Bob684npdm7CkcXM mEcvyydJutH1Jur3wXXkOUGfQL6w1hXElko8W3dpZON0/ordkFfRx8qlrFmjKm0VU/0v wgaEa1wQSgB2BYpo/AC7s7qdstv0OG7sFBIwyqaM489KdkxXNq1JsEZzlomKd5GMzMsU 0aDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1j0gO9uErjvVk6RFrnXJ0zAPni0/cjOQMUjki6bRDRg=; b=jf8XcPHPymn6M8LnLOdmlyVBCcjOUNpwF8wA4Cpuf4Ye6G1BeO5FNsVkeF6WxlJKd1 iJkVIsRS+pzRobZiua+TeOKEpl39hpPb1Jm8Y2amyhotxcznyPCSjC3q4XDe2uNXGkZw zTo3LwPTaBtX9OJA4tLHLaqfA1jgabb+jSXykYIIqxE+/OcgJW1RCer/872jBavrLJEM LV21ZoLXVD7Sz/ol4QxA2SClfyf+TGC3S23fgr+5MmEJXTalqctxssNUKfH/+F55WwdD Ym1mLC6xqMriwkHnvQ19hyXRTlBYXj87+1NSN8aTmGLO91Lh2+Nsdm2LFODitmOsfd0S 22Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mCSJBLn4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c22-20020a170902b69600b001571cc04889si11634349pls.106.2022.04.12.13.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mCSJBLn4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05CCB403C1; Tue, 12 Apr 2022 13:20:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241037AbiDIMLE (ORCPT + 99 others); Sat, 9 Apr 2022 08:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235545AbiDIMLA (ORCPT ); Sat, 9 Apr 2022 08:11:00 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A3F26565; Sat, 9 Apr 2022 05:08:52 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id r66so10068669pgr.3; Sat, 09 Apr 2022 05:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1j0gO9uErjvVk6RFrnXJ0zAPni0/cjOQMUjki6bRDRg=; b=mCSJBLn4hULqdHwXSIn5cP9LqjNa2EQaAWPHDXyuE/W5KN/qe9UZ8gHmIu5GOVhTsy m3JP12oNdzMTZ1H1J+Nz2QxCRy9Z4faoeMefncI2RN/BQmzLKekRz8jwNaGh25PfQcqO nZValEQj20WCFkP9dU5FRzjDwrXthMLFrsxmuLMACSToOXfXuRpIBjwkq0N8RZd2OB7q KMuslyp//ga4sGAJOMWbqU4rebSj+HhA2vfCHG7KPqwpHitCvc3QGCO4/gB85Xg1I+2j R0ZN64N7TMIm4eUpuomUlk/aKFWtUPlnlmydmCKUULDaLLxho3M/k8HREp0jBGJj4+4v B5QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1j0gO9uErjvVk6RFrnXJ0zAPni0/cjOQMUjki6bRDRg=; b=Tatca7HmjdYnkuQhnUgkqUt4LOWPE8fbpn6CfAHftNoFqRDabJ2EIgjh53fiemfo8q t8x489iga7eRAndV04YS2wIdqm+0GFGyjF1R4urbDdr7Ef36iCV+iWEZz7CCDWpSY+ws EUxQaoFp6cEKOi3ZhzJFiIP5mMx4mRo+YQ/9bgPvIc3tV6obw88a/+DXTAYvC/S+daLV AUoqveFKnQMbgvvPG+KgydM87HD8IPK6KUGIq07BwnREMCsaxNMi4rKrSOXZUgvWXwKn qIPnMI6+fabQTR+Kr7A3EzgPhor24JZZQigATvFJEdPf/i75OrONnYkWomjvefh4xCbm iBeQ== X-Gm-Message-State: AOAM533wtycA3VDxwxw3sIt1vEmTDkharxsVVZ9OZNBqLg1COao2I4/s oYG99I2Jy+W5/rF1yHTQY2DZ5ZgB1o3CdJMJ+DDxSw== X-Received: by 2002:a63:3e0c:0:b0:398:2829:58cd with SMTP id l12-20020a633e0c000000b00398282958cdmr19434793pga.464.1649506131992; Sat, 09 Apr 2022 05:08:51 -0700 (PDT) Received: from guoguo-omen.lan ([2401:c080:1400:4da2:b701:47d5:9291:4cf9]) by smtp.gmail.com with ESMTPSA id a85-20020a621a58000000b0050569a135besm8307357pfa.201.2022.04.09.05.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Apr 2022 05:08:51 -0700 (PDT) From: Chuanhong Guo To: linux-spi@vger.kernel.org Cc: Chuanhong Guo , Mark Brown , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Roger Quadros , Thomas Bogendoerfer , Cai Huoqing , Florian Fainelli , Colin Ian King , Wolfram Sang , Paul Cercueil , Pratyush Yadav , Yu Kuai , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-kernel@vger.kernel.org (open list), linux-mtd@lists.infradead.org (open list:NAND FLASH SUBSYSTEM) Subject: [PATCH v5 0/5] spi: add support for Mediatek SPI-NAND controller Date: Sat, 9 Apr 2022 20:08:14 +0800 Message-Id: <20220409120819.3124209-1-gch981213@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mediatek has an extended version of their NAND Flash Interface which has a SPI-NAND mode. In this mode, the controller can perform 1-bit spi-mem ops for up-to 0xa0 bytes and typical SPI-NAND single, dual and quad IO page cache ops with 2-byte address. Additionally, the page cache ops can be performed with ECC and auto data formatting using the ECC engine of the controller. This patchset implements support of this mode as a separated SPI-MEM driver with pipelined ECC engine. Changes since v1: add a blank line between properties in dt binding doc rename ecc-engine to nand-ecc-engine for the generic properties fix warnings/errors from the CI Changes since v2: use streamed DMA api to avoid an extra memory copy during read make ECC engine config a per-nand context take user-requested ECC strength into account Change since v3: fix a missed ecc-engine rename in doc from v1 Changes since v4: fix typo: piplined -> pipelined fix missing OOB write in snfi driver print page format with dev_dbg instead replace uint*_t copied from vendor driver with u* Chuanhong Guo (5): mtd: nand: make mtk_ecc.c a separated module spi: add driver for MTK SPI NAND Flash Interface mtd: nand: mtk-ecc: also parse nand-ecc-engine if available spi: dt-bindings: add binding doc for spi-mtk-snfi arm64: dts: mediatek: add mtk-snfi for mt7622 .../bindings/spi/mediatek,spi-mtk-snfi.yaml | 88 + arch/arm64/boot/dts/mediatek/mt7622.dtsi | 12 + drivers/mtd/nand/Kconfig | 7 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} | 8 +- drivers/mtd/nand/raw/Kconfig | 1 + drivers/mtd/nand/raw/Makefile | 2 +- drivers/mtd/nand/raw/mtk_nand.c | 2 +- drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-mtk-snfi.c | 1467 +++++++++++++++++ .../linux/mtd/nand-ecc-mtk.h | 0 12 files changed, 1594 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml rename drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} (98%) create mode 100644 drivers/spi/spi-mtk-snfi.c rename drivers/mtd/nand/raw/mtk_ecc.h => include/linux/mtd/nand-ecc-mtk.h (100%) -- 2.35.1