From patchwork Thu Dec 23 00:22:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1572430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0MzACLMl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=K/Ez51dK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JK9sd5hTgz9t55 for ; Thu, 23 Dec 2021 11:23:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2LeZhnhl6oyR9TqPCO4NLQAYybWJXBLVOFjBhVlp8G4=; b=0MzACLMlXz9yBP OQaO+pbmTaxdGvMlEO0Me7+g0MUoZRwdbJij+Mxe1f108ENPqOl8f/eB4QFay4wPt5f4UVysz4JeG fU3zAomrJng/rHC1PzxUBybaqphr82qSlQaWWz+38KwBpQEY3LP16vfN4nWUI9RWQm5+wcZZnKy1l 02BNbfGO61Nd1ad1WdNq67OHQTp52QfiLuCkknFCRhScF44Fc77RLKwS45vbiHoa/n5xqIOmyqJw6 wRo6a4WMnMs2MpSYKK7shcObSkES2hYVTqwM8CQNp0VB1V4H5egkHYQVa5M/+pDeioFEtU8SmEKE6 hgRYp4SX98SGqHrHtxgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0BsS-00BXfK-2N; Thu, 23 Dec 2021 00:22:36 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0BsP-00BXeV-M4 for linux-mtd@lists.infradead.org; Thu, 23 Dec 2021 00:22:35 +0000 Received: by mail-pl1-x631.google.com with SMTP id w7so2498070plp.13 for ; Wed, 22 Dec 2021 16:22:31 -0800 (PST) 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=P39LfhwxkLFrxQ44U3zppl8kfgBNoQrx/J3cE0xenlI=; b=K/Ez51dKunsJZ8vBNNFO3KebPxek8mDQ1hC0jf3nixqLPjV4dvpqWn8Iol3nWzoOzc pShPnKZ+mjHjBzTNuoKuH/4fto3jz7CtMOjb7vjU+BVTXHqBABOIIVAIlNjvSRngTsp7 urJ3FfAkuIdI7c5z3QGDDqKghSqfKuoBxaNBUFvTAkeybXsowoL9lbaI/6pjDM4zkaNO xRGPZhsUH8Hw5uFesA/7isf1GiZehjH5e9IFpDhlZ1CYfs5onhvwYbeJlQw2IV8/jZL/ bT7jvwTHYAhunzEdOVlqUcwG1iHuaa0uWeYTh4udQggFvrjcd4+t19ksmcyugT5wr9yu k0IQ== 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=P39LfhwxkLFrxQ44U3zppl8kfgBNoQrx/J3cE0xenlI=; b=CkaAlx0eFiKGA1x7jNbXf/lFz3fztx/0l8y8hXDsuFKvD4cLM6ujNWrsIXZ2MEvYMq +NcMM/ljG6OZp+cxVWNywDyNz/vtJvEadZ1bXXnoQL5WxohJ3qb8peA5Eu5UJ5Lv9wPq WDHAjZE6hCVW6TBVFnYkjhFaMbKiA34qiB03NUwrQRaKMWqmY9Qr8/M2w3UrNeapBiQT Vr7JAh7h1zn+Hs4m2BxfS91bTq6WwXtmbxjF1qVoCdjRSFIlnoN6dU98T4YlxB8fOJK6 8m/QwtekdyR6hyIKrXwtncYQ2gay8WwyCKcnnc5A/nOZG+GA5HtybVE7TVmROTs1qYA2 LGUw== X-Gm-Message-State: AOAM533aQmZq0lji9p/qYPn7rbYAwYUyPQY77TJRrKuQ5g2b5mWYiIaZ LMKOfQnoxjx5nQ2FKpAKwjWiVaoULEA= X-Google-Smtp-Source: ABdhPJzl57hPs6LxL73Za49Xak/ITCib73mzXMNU4QF6wDYyiYziBWC0LD2Xi3oGfVVURxLLs6ft+w== X-Received: by 2002:a17:90b:3e8c:: with SMTP id rj12mr66383pjb.152.1640218950843; Wed, 22 Dec 2021 16:22:30 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id e24sm6720703pjt.45.2021.12.22.16.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 16:22:30 -0800 (PST) From: Florian Fainelli To: linux-mtd@lists.infradead.org Cc: Florian Fainelli , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Brian Norris , Kamal Dasu , Arnd Bergmann , Cai Huoqing , Colin Ian King , linux-kernel@vger.kernel.org (open list), linux-wireless@vger.kernel.org (open list:BROADCOM SPECIFIC AMBA DRIVER (BCMA)), bcm-kernel-feedback-list@broadcom.com (open list:BROADCOM STB NAND FLASH DRIVER) Subject: [PATCH 0/9] BCMA support for brcmnand Date: Wed, 22 Dec 2021 16:22:16 -0800 Message-Id: <20211223002225.3738385-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_162233_790020_558AE4FE X-CRM114-Status: GOOD ( 18.77 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi all, This patch series adds support for the BRCMNAND controller revision 3.4 embedded in MIPS-based SoCs such as 5357, typically found in the Netgear WNR3500L v2 and other kinds of Wi-Fi routers. The upstr [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:631 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [f.fainelli[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi all, This patch series adds support for the BRCMNAND controller revision 3.4 embedded in MIPS-based SoCs such as 5357, typically found in the Netgear WNR3500L v2 and other kinds of Wi-Fi routers. The upstream platform that uses this controller is under arch/mips/bcm47xx/ and does not use Device Tree (and probably never will by now). BCMA (Broadcom AMBA) is a special kind of discoverable memory mapped interface which requires the use of special accessors to read from/write to the hardware block. The integration of brcmnand into that SoC is a bit quirky in that every register offering byte level data about the flash (OOB, device ID, etc.) requires byte swapping. The command shift should also have been 24, but is in fact 0, took me a while to understand why no reads were actually working because of that. This has been tested with Linux 5.10.82 and Linus' master with OpenWrt and confirmed that the squashfs + jffs2 overlay that OpenWrt creates is entirely functional and that written data is made persistent. There are a number of open questions: - the flash that is used is a s34ml01g100tf100 part which is said to be ONFI 1.0 compliant however the ONFI signature is not ONFI, but the device ID of the flash as if read with address 0, is that a known issue? - because no ONFI detection is taking place we fallback to the identification table matching, but there is no default ECC size/strength filed by the rawnand framework, probably made largely worse by the absence of a suitable Device Tree information? Florian Fainelli (9): mtd: rawnand: brcmnand: Allow SoC to provide I/O operations mtd: rawnand: brcmnand: Assign soc as early as possible mtd: rawnand: brcmnand: Avoid pdev in brcmnand_init_cs() mtd: rawnand: brcmnand: Move OF operations out of brcmnand_init_cs() mtd: rawnand: brcmnand: Allow working without interrupts mtd: rawnand: brcmnand: Add platform data structure for BCMA mtd: rawnand: brcmnand: Allow platform data instantation mtd: rawnand: brcmnand: BCMA controller uses command shift of 0 mtd: rawnand: brcmnand: Add BCMA shim MAINTAINERS | 1 + drivers/bcma/driver_chipcommon_nflash.c | 17 ++- drivers/mtd/nand/raw/Kconfig | 11 ++ drivers/mtd/nand/raw/brcmnand/Makefile | 2 + drivers/mtd/nand/raw/brcmnand/bcma_nand.c | 131 ++++++++++++++++++ drivers/mtd/nand/raw/brcmnand/brcmnand.c | 142 +++++++++++++------- drivers/mtd/nand/raw/brcmnand/brcmnand.h | 23 ++++ include/linux/bcma/bcma_driver_chipcommon.h | 5 + include/linux/platform_data/brcmnand.h | 12 ++ 9 files changed, 291 insertions(+), 53 deletions(-) create mode 100644 drivers/mtd/nand/raw/brcmnand/bcma_nand.c create mode 100644 include/linux/platform_data/brcmnand.h