Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5959564pxb; Mon, 14 Feb 2022 11:43:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjDr6ryT9jsTa7PoWU94FFM+pSQuwAoFBtLCWM4XqB1OkbuSAjBzJznnzxg5fhKU7m/gQ0 X-Received: by 2002:a63:4e0e:: with SMTP id c14mr513586pgb.490.1644867822863; Mon, 14 Feb 2022 11:43:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644867822; cv=none; d=google.com; s=arc-20160816; b=gGVAWCRq2PsiZIIzNlYSXOuFf/cqsQgMBkV6oaqHmMEhLXonFSjDR5hgK1aDQHpFJe jp3WsJsLrQl0DD1ASt+6Y/G1YeVjXugE8IqzBj6j7zoJ+SwrbJHOt0e0U+GNHeLFFMjm NKtvdpbgRQbOr/yD58Bu9VunHZmRqfjhZwEeJ3rCJJs9as//dPzNTJ+rravp4Hm2OneO XqsenHuXvCNCPLnbP0zXOeyzB+cgYWyQEYhy1aPTaKvVm0Tzrnc9ixQ5ZdPmwAQpS7Oi mhN48COtwibZF97wPuy81EPnrwpNW4vrH3d2vLbBknhqjMyH2BMmq8ldt9sciE3m9riK M7HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=LG+IJLs7wXPNVT0z8T3hEBLLhY2SXKYod9h5f+Peeys=; b=Lr5BLXVZ4eVIaxcLeCUCH9A/ocrezaME+FPpYMehv7XMy7R5ujQ++OrxKc4UM5DW4X GWfnkvnaaclqa/m3d8BWbSNRuMforbL/N6eGKt0jkDiTyDZjVjfOIhCCiV9YukHcJS3i 3pWFurYHkjLOgJXBB7QfKurAjp56DlvhvWnPFiWGyTmFxlaueX4sWlDrQFS4OTP0pb1q aKShCL14VULdWmJ4iAfSoIh02WL904v1lTs9n7Bk7tmPpXrlHpJXWqHskIw5twkjgJjS 3wTir6rdgOYhut8nacU00493kt5VYtDrl/hm6JarysbxCKAtGf5SZkh1W7LZbGVOMnBt qXrA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d16si24689264pfj.154.2022.02.14.11.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:43:42 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E15FCA1454; Mon, 14 Feb 2022 11:28:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343957AbiBNJ5p convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 Feb 2022 04:57:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344949AbiBNJwI (ORCPT ); Mon, 14 Feb 2022 04:52:08 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E157B56C; Mon, 14 Feb 2022 01:43:30 -0800 (PST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21E8mjCI031709; Mon, 14 Feb 2022 09:42:43 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e7aveu7wu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 09:42:43 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21E9dnqC001473; Mon, 14 Feb 2022 09:42:41 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 3e64h9kgj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 09:42:41 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21E9gc8v38273394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Feb 2022 09:42:39 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C24D14C040; Mon, 14 Feb 2022 09:42:38 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 274A94C05A; Mon, 14 Feb 2022 09:42:38 +0000 (GMT) Received: from smtp.tlslab.ibm.com (unknown [9.101.4.1]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Mon, 14 Feb 2022 09:42:38 +0000 (GMT) Received: from yukon.ibmuc.com (unknown [9.171.60.190]) by smtp.tlslab.ibm.com (Postfix) with ESMTP id 74F062201DE; Mon, 14 Feb 2022 10:42:36 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= 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=20Le=20Goater?= Subject: [PATCH 00/10] spi: spi-mem: Add driver for Aspeed SMC controllers Date: Mon, 14 Feb 2022 10:42:21 +0100 Message-Id: <20220214094231.3753686-1-clg@kaod.org> X-Mailer: git-send-email 2.34.1 Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vREdrqhFBBnJcVUIFbWv2MHoqDOlP0nz X-Proofpoint-ORIG-GUID: vREdrqhFBBnJcVUIFbWv2MHoqDOlP0nz Content-Transfer-Encoding: 8BIT 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.62.513 definitions=2022-02-14_01,2022-02-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1034 priorityscore=1501 suspectscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 spamscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202140058 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 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. This needs more tests. 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) * Evaluation board (AST2500) * OpenPOWER Witherspoon (AST2500) * Evaluation board (AST2600 A0) * 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. Cédric Le Goater (10): mtd: spi-nor: aspeed: Rename Kconfig option 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 spi: aspeed: Activate new spi-mem driver drivers/spi/spi-aspeed-smc.c | 1241 +++++++++++++++++ .../bindings/spi/aspeed,ast2600-fmc.yaml | 92 ++ arch/arm/boot/dts/aspeed-g4.dtsi | 6 + arch/arm/boot/dts/aspeed-g5.dtsi | 7 + arch/arm/boot/dts/aspeed-g6.dtsi | 8 + drivers/mtd/spi-nor/controllers/Kconfig | 4 +- drivers/mtd/spi-nor/controllers/Makefile | 2 +- drivers/spi/Kconfig | 11 + drivers/spi/Makefile | 1 + 9 files changed, 1369 insertions(+), 3 deletions(-) create mode 100644 drivers/spi/spi-aspeed-smc.c create mode 100644 Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml -- 2.34.1