From patchwork Fri Mar 4 08:36:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 1600893 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=jqqMhE6o; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=cZsWrY/B; 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 4K922230Q6z9sG9 for ; Fri, 4 Mar 2022 20:03:06 +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=IcZk2OBlRHGBsCmkSmqWobewwpc+qzjxQXWIlMzD0+U=; b=jqqMhE6oKaTz3+ gAX+kx8b84oLwmIfy2n9CBkqicOoJo4s6fvJR1vwwD7+bjd0NyMIQHomw33lxi13suG3Nh8EdNtW/ D/pjqyT1Nx1ClOB3VNplDMHTF+fUYbrvOuKmUZV9fmFlMKBhbSw5TOdr0vmr7uV3WNfaKK+xfNPRt RDgnhiVxtHNJl4exXGBYeQro+/uwukLkwU7tcGp5ZkeeVfWvTi6+2cNDX5XS1/XocNYIykk3HWViY MotTKYIZ5NqjIlfpbXjzVuV5nnodvhQlvP3yJqaxp3GZnxNr7tMszE5CUzIf5dR+nV72o+baN2dsU c133DKD7cZoYrzB2VURw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQ3pK-009Ast-Mu; Fri, 04 Mar 2022 09:02:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQ3Re-00947z-Se; Fri, 04 Mar 2022 08:37:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=xSb9867Aq8yhJfUQ3X0yBgbAM+G1jeY9Iy1cP6eWkoE=; b=cZsWrY/B1Dzv0H4zBkBNQ3ukwe LTnaNwcInMsNoll4ILOY+L/wrUgS732bQFf2H74uZmLBQ8HrdbcWz++CeI2pipHnf7WbpC8DKVl/m +GEQKcyttHz85JBBPullhxHrn0zeFKvVjMgiHcwK4D8qkosNXSOdbaaRqpdLrcnWoh3k17UvvWKGc dwJ30IeKa8ZVCzwELFOqvhOzjApKDkoM7ALVCHZG3gnGQczPGCcxf8Vgi7d8uFZBR2B1oTb1D6+L6 hesRGHnqddOSy+ZRbfUCeRoimIbX9OGfFm5HHGR+oV2zPbIX0JiX6dNcqZqK+SRQdW04tiGiicOkN udCsN0IA==; Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQ3Rb-00CS1T-Bq; Fri, 04 Mar 2022 08:37:49 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2245JNOH021192; Fri, 4 Mar 2022 08:36:52 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ek8mxpp6e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 08:36:52 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2248XJ2V027393; Fri, 4 Mar 2022 08:36:50 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma01fra.de.ibm.com with ESMTP id 3ek4k8124g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 08:36:50 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2248amEB47186186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Mar 2022 08:36:48 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AEAD42042; Fri, 4 Mar 2022 08:36:48 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73D0D42045; Fri, 4 Mar 2022 08:36:47 +0000 (GMT) Received: from smtp.tlslab.ibm.com (unknown [9.101.4.1]) by d06av24.portsmouth.uk.ibm.com (Postfix) with SMTP; Fri, 4 Mar 2022 08:36:47 +0000 (GMT) Received: from yukon.home (unknown [9.171.91.16]) by smtp.tlslab.ibm.com (Postfix) with ESMTP id 89B872200FD; Fri, 4 Mar 2022 09:36:45 +0100 (CET) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org Cc: Mark Brown , Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-aspeed@lists.ozlabs.org, Joel Stanley , Andrew Jeffery , Chin-Ting Kuo , devicetree@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH v3 00/11] spi: spi-mem: Add driver for Aspeed SMC controllers Date: Fri, 4 Mar 2022 09:36:32 +0100 Message-Id: <20220304083643.1079142-1-clg@kaod.org> X-Mailer: git-send-email 2.34.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: RFuuLzC8JejxWrm4oynsn6-IAqVUMeMt X-Proofpoint-ORIG-GUID: RFuuLzC8JejxWrm4oynsn6-IAqVUMeMt X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-04_02,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 impostorscore=0 adultscore=0 spamscore=0 priorityscore=1501 phishscore=0 suspectscore=0 bulkscore=0 clxscore=1034 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203040044 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220304_083747_631160_D82E2814 X-CRM114-Status: GOOD ( 30.57 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.6 on casper.infradead.org summary: Content analysis details: (-1.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_MSPIKE_H5 RBL: Excellent reputation (+5) [148.163.158.5 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. 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, This series adds a new SPI driver using the spi-mem interface for the Aspeed static memory controllers of the AST2600, AST2500 and AST2400 SoCs. * AST2600 Firmware SPI Memory Controller (FMC) * AST2600 SPI Flash Controller (SPI1 and SPI2) * AST2500 Firmware SPI Memory Controller (FMC) * AST2500 SPI Flash Controller (SPI1 and SPI2) * AST2400 New Static Memory Controller (also referred as FMC) * AST2400 SPI Flash Controller (SPI) It is based on the current OpenBMC kernel driver [1], using directly the MTD SPI-NOR interface and on a patchset [2] previously proposed adding support for the AST2600 only. This driver takes a slightly different approach to cover all 6 controllers. It does not make use of the controller register disabling Address and Data byte lanes because is not available on the AST2400 SoC. We could introduce a specific handler for new features available on recent SoCs if needed. As there is not much difference on performance, the driver chooses the common denominator: "User mode" which has been heavily tested in [1]. "User mode" is also used as a fall back method when flash device mapping window is too small. Problems to address with spi-mem were the configuration of the mapping windows and the calibration of the read timings. The driver handles them in the direct mapping handler when some knowledge on the size of the flash device is know. It is not perfect but not incorrect either. The algorithm is one from [1] because it doesn't require the DMA registers which are not available on all controllers. Direct mapping for writes is not supported (yet). I have seen some corruption with writes and I preferred to use the safer and proven method of the initial driver [1]. We can improve that later. The driver supports Quad SPI RX transfers on the AST2600 SoC but it didn't have the expected results. Therefore it is not activated yet. There are some issues on the pinctrl to investigate first. The series does not remove the current Aspeed SMC driver but prepares ground for its removal by changing its CONFIG option. This last step can be addressed as a followup when the new driver using the spi-mem interface has been sufficiently exposed. Tested on: * OpenPOWER Palmetto (AST2400) * Facebook Wedge 100 BMC (AST2400) by Tao Ren * Evaluation board (AST2500) * Inspur FP5280G2 BMC (AST2500) by John Wang * Facebook Backpack CMM BMC (AST2500) by Tao Ren * OpenPOWER Witherspoon (AST2500) * Evaluation board (AST2600 A0 and A3) * Rainier board (AST2600) [1] https://github.com/openbmc/linux/blob/dev-5.15/drivers/mtd/spi-nor/controllers/aspeed-smc.c [2] https://patchwork.ozlabs.org/project/linux-aspeed/list/?series=212394 Thanks, C. Changes in v3: - Fixed compile warning on aspeed_spi_dirmap_read() prototype reported by kernel test robot - Removed unnecessary entry in ast2600-fmc.yaml - New patch from Tao to set spi-max-frequency on all FMC devices Changes in v2: - Fixed dt_binding_check warnings (Rob) - New entry in MAINTAINERS - Addressed Lukas comments regarding the SPI controller registration and device removal. Checked with driver bind/unbind - Introduced setup and cleanup handlers and removed routine looping on the DT children properties (Pratyush) - Clarified in commit log requirements for training. - Removed defconfig changes of patch 1 since they were reverted in the last patch (Joel) Cédric Le Goater (10): mtd: spi-nor: aspeed: Rename Kconfig option ARM: dts: aspeed: Adjust "reg" property of FMC/SPI controllers dt-bindings: spi: Add Aspeed SMC controllers device tree binding spi: spi-mem: Add driver for Aspeed SMC controllers spi: aspeed: Add support for direct mapping spi: aspeed: Adjust direct mapping to device size spi: aspeed: Workaround AST2500 limitations spi: aspeed: Add support for the AST2400 SPI controller spi: aspeed: Calibrate read timings ARM: dts: aspeed: Enable Dual SPI RX transfers Tao Ren (1): ARM: dts: aspeed-g4: Set spi-max-frequency for all flashes drivers/spi/spi-aspeed-smc.c | 1184 +++++++++++++++++ .../bindings/spi/aspeed,ast2600-fmc.yaml | 87 ++ MAINTAINERS | 10 + arch/arm/boot/dts/aspeed-g4.dtsi | 16 +- arch/arm/boot/dts/aspeed-g5.dtsi | 16 +- arch/arm/boot/dts/aspeed-g6.dtsi | 17 +- drivers/mtd/spi-nor/controllers/Kconfig | 4 +- drivers/mtd/spi-nor/controllers/Makefile | 2 +- drivers/spi/Kconfig | 11 + drivers/spi/Makefile | 1 + 10 files changed, 1329 insertions(+), 19 deletions(-) create mode 100644 drivers/spi/spi-aspeed-smc.c create mode 100644 Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml