From patchwork Tue Jun 25 15:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Sroka X-Patchwork-Id: 1122124 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U78tpvIE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=cadence.com header.i=@cadence.com header.b="OraEtrIF"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=cadence.com header.i=@cadence.com header.b="H1g2TaIE"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45Y8wv6ylzz9s8m for ; Wed, 26 Jun 2019 01:20:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: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=flWTpDQGLR4q+7hNljbtASendqd+7ReWqybtqSWcqsk=; b=U78tpvIEsB38JY LkL9HJ9CqxmFECSQHOAmmFRcum1r4vRTfsgSQ1Kjvahh3Qbrlc4bo8eElRif4Av6jIoq3mXaGy6hS ZQGHaXNLH2A/nHY1la3caMhmzlwN6Ph+3OI3hOueEu4lAnRRUFGJeZHnRL7fG6dDriQFZxqb7lRkX Xy4yWjxHmEujcKUv2IIOzexgXnKdG9bay5jWCyxqRi2rCPsyFH8chrZrqNsaLKQ+zkpnUrvtt+mbn sifm811i7LyNdL/ayUFH5wOaHiZamVAQ0DuqLvW0J9K6KFm/nrwht3XnOAyey1XVjMPxLPfS1wjDv xaAtxmfw/XXXhGAm1bPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfnEw-0003bK-5r; Tue, 25 Jun 2019 15:20:10 +0000 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfnEs-0002wU-Ql for linux-mtd@lists.infradead.org; Tue, 25 Jun 2019 15:20:08 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5PFIMTk016751; Tue, 25 Jun 2019 08:19:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=proofpoint; bh=8j7BmmHW6DBHa+2mgobfd7aWkcdZyhbrBwu0MaW6p1M=; b=OraEtrIFDofYWUt/x7MFmZ8SDdmSTR57qtf7Zhr9WJ5XzBMxDtm50OH4Nmw/oPBaAyEo hVriMICcsnt+Mst6CJa20YMjiPJN0NzP/KAxc27vipf0z4tE+bta3mwV0gGz1BDGarqM zDTgj4JJh85lRFNYZuKhxjsNNzNEIOZrBu0BTMzbfh9eeXgsFsr5InZjU0NPYFP9nTm6 zEjTjPSGl1UQrT5iHJi7TlRPoEvZoUY5b3f/K4A9jG8hPRfAsPSFvzPp6PnPVlvLK/Hr K+s/8ye0A31vrahJpCdjQ6WV5pbbn6KQ/22Dpc7vE6zjo/KisIaP/7kWshRXcm9oP0p8 Yg== Authentication-Results: cadence.com; spf=pass smtp.mailfrom=piotrs@cadence.com Received: from nam02-cy1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2059.outbound.protection.outlook.com [104.47.37.59]) by mx0a-0014ca01.pphosted.com with ESMTP id 2t9gvsd5vk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jun 2019 08:19:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8j7BmmHW6DBHa+2mgobfd7aWkcdZyhbrBwu0MaW6p1M=; b=H1g2TaIEPHg6mueKL3VUoPpViHBHRz5BOiS3BHcu/anbOakw+XSPdAvNjCn5ki0KVyWfEy/DUw+Z1MKcYv7zZD39YOchZkbcpBTzPUKNZYmm74j2VsSpcZ+jWI7d2rQlNQj1RxksXlXkf63KZHHZkLKeTovtqPfJrAHhLWDBLx8= Received: from DM6PR07CA0026.namprd07.prod.outlook.com (20.176.74.39) by BYAPR07MB6821.namprd07.prod.outlook.com (20.179.89.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.17; Tue, 25 Jun 2019 15:19:34 +0000 Received: from CO1NAM05FT003.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::204) by DM6PR07CA0026.outlook.office365.com (2603:10b6:5:94::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2008.16 via Frontend Transport; Tue, 25 Jun 2019 15:19:34 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning cadence.com discourages use of 158.140.1.28 as permitted sender) Received: from sjmaillnx1.cadence.com (158.140.1.28) by CO1NAM05FT003.mail.protection.outlook.com (10.152.96.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2032.6 via Frontend Transport; Tue, 25 Jun 2019 15:19:33 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by sjmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id x5PFJShK000783 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Tue, 25 Jun 2019 08:19:30 -0700 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 25 Jun 2019 17:19:27 +0200 Received: from lvlogina.cadence.com (10.165.176.102) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 25 Jun 2019 17:19:27 +0200 Received: from lvlogina.cadence.com (localhost.localdomain [127.0.0.1]) by lvlogina.cadence.com (8.14.4/8.14.4) with ESMTP id x5PFJRoc018428; Tue, 25 Jun 2019 16:19:27 +0100 Received: (from piotrs@localhost) by lvlogina.cadence.com (8.14.4/8.14.4/Submit) id x5PFJLw9018275; Tue, 25 Jun 2019 16:19:21 +0100 From: Piotr Sroka To: Subject: [v4 0/2] mtd: nand: Add Cadence NAND controller driver Date: Tue, 25 Jun 2019 16:15:59 +0100 Message-ID: <20190625151559.15270-1-piotrs@cadence.com> X-Mailer: git-send-email 2.15.0 MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:158.140.1.28; IPV:CAL; SCL:-1; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39860400002)(136003)(2980300002)(199004)(189003)(36092001)(26826003)(50466002)(426003)(2906002)(70206006)(70586007)(336012)(48376002)(4326008)(47776003)(2351001)(76130400001)(36756003)(7416002)(246002)(6666004)(2616005)(356004)(86362001)(51416003)(316002)(8936002)(486006)(478600001)(50226002)(16586007)(6916009)(107886003)(87636003)(42186006)(26005)(186003)(476003)(7636002)(305945005)(5660300002)(8676002)(54906003)(1076003)(126002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB6821; H:sjmaillnx1.cadence.com; FPR:; SPF:SoftFail; LANG:en; PTR:corp.cadence.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77ee5bfb-e38c-467f-ead4-08d6f9808760 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BYAPR07MB6821; X-MS-TrafficTypeDiagnostic: BYAPR07MB6821: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0079056367 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: eBFzqGqJkGzQWE5yIWpOCHSgj7wSvHcJ5SYNYC/3vmgLGOn3FfbE/V40PDTlpfnQWWMHNxPbywNB7aezlmh0vQthnp1cf/j/aS/fFH84m3KuRHKK1SrpWLigtD5rMS2S2TM6y8+oDnlaJY0nub973FGw2Q8TAIkDCQXaypmSTCAQ+JhwtVhwhunrwclQPLOFvk9A1Yk0pxoDa//0P+XQjy+QnqN5yXt7C9FCLUBNgaRsr3mW35wfMUajly9u6C6oGtuTfj4tP9ObysdPhEPjj3XW7/lx8ZoMupDioqptj4mKH5xPHL/aNu7OUv/SVeb9GzzLZCDee/3nvYW3jP4KCLW9C5E4fZ9uk3A+YUN4CzgVHEO82A2nfFPTFDn7N8DJIpN0euIC3mWPIPnHOmkrpWN+TTxd453MTMS4Vu7xzU0= X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2019 15:19:33.7636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77ee5bfb-e38c-467f-ead4-08d6f9808760 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[158.140.1.28]; Helo=[sjmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB6821 X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 include:spf.smktg.jp include:_spf.salesforce.com include:mktomail.com include:spf-0014ca01.pphosted.com include:spf.protection.outlook.com include:auth.msgapp.com include:spf.mandrillapp.com ~all X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-25_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906250117 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190625_082007_252881_0CCB6A16 X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [208.84.65.235 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.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Boris Brezillon , Marcel Ziswiler , Richard Weinberger , Stefan Agner , Marek Vasut , Paul Burton , Geert Uytterhoeven , Miquel Raynal , linux-mtd@lists.infradead.org, Dmitry Osipenko , Brian Norris , David Woodhouse , Piotr Sroka Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Driver for Cadence HPNFC NAND flash controller. HW DMA interface Page write and page read operations are executed in Command DMA mode. Commands are defined by DMA descriptors. In CDMA mode controller own DMA engine is used (Master DMA mode). Other operations defined by nand_op_instr are executed in "Generic" mode. In that mode data can be transferred only in by Slave DMA interface. Slave DMA interface can be connected directly to AXI or to an external DMA engine. HW ECC support Cadence NAND controller supports HW BCH correction. ECC is transparent from SW point of view. It means that ECC codes are calculated and written to flash. In read operation ECC codes are removed from user data and correction is made if necessary. Controller data layout with ECC enabled: ------------------------------------------------------------------------- |Sec 1 | ECC | Sec 2 | ECC ...... | Sec n | OOB (32B) | ECC | unused data | ------------------------------------------------------------------------- Last sector is extended by a out-bound data. Tha maximum size of "extra data" is 32 bytes. The oob data are protected by ECC. If we need to read only oob data the whole last sector must be read. It is because oob data are part of last sector. Reading oob function always reads whole sector and writing oob function always writes whole last sector. Written data are interleaved with the ECC therefore part of the last sector is located on oob area and the BBM is overwritten. SKIP BYTES feature To protect BBM the "skip byte" HW feature is used. Write page function copies BBM value from first byte of oob data to BBM offset defined by manufacturer. Read page functions always takes BBM from flash manufacturer offset. It causes that for not written pages the proper value of BBM marker is used. ECC size calculation Information about supported ECC steps and ECC strengths are read from controller registers. ECC sector size and ECC strength can be configurable. Size of ECC depends on maximum supported sector size it not depends on selected sector size. Therefore there is a separate function for calculating ECC size for each of possible sector size/step size. Piotr Sroka (2): Add new Cadence NAND driver to MTD subsystem Add Cadence NAND controller driver .../bindings/mtd/cadence-nand-controller.txt | 51 + drivers/mtd/nand/raw/Kconfig | 7 + drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/cadence-nand-controller.c | 3109 ++++++++++++++++++++ 4 files changed, 3168 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/cadence-nand-controller.txt create mode 100644 drivers/mtd/nand/raw/cadence-nand-controller.c