Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp264228pxm; Wed, 2 Mar 2022 14:56:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzh6QEr5BvMOPBQALzPFVXj5jjrEI3CFMm1THIIgxiq33zFZlk1WBdqo3SrDnaulQdGqJk8 X-Received: by 2002:a17:903:11c7:b0:151:9769:3505 with SMTP id q7-20020a17090311c700b0015197693505mr4882642plh.72.1646261799779; Wed, 02 Mar 2022 14:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646261799; cv=none; d=google.com; s=arc-20160816; b=V45v4681lahF91LgogZ+XEdumqeSNxximZDoQcy7SGlhuWd9XuMbgCFYuUujAxyl7E uE2coGbctg0wklNMWetIYOas6+doUVzwCqmpr5aSPR7XgKySOOIxVh44tx0K1NA0qPY1 6nyzSQX5EzOUrCI7N7sfiFmu71K+2I8LnwptX1jib0zXwnM+NBfMKH3AR0Jqv9Enj4BF A4T6x4SZ0FJcPVu//p/4f5OoWAxZ5DWDY+etIlbK63nW8AAw39Pm/cOI1wzSgHj24TVJ e12TuGrSBMQcVuIMwGH4XvJdpT/DMWh1dyQAn42qTb952w4yywrEdVGpoDC2SkasBOlj JaJw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zXL4K8YRisPgUhlriDHZ1L5AuiiXeh05FLYaCnyVKjQ=; b=qhKJfi+AqnwHF/VchRx4FlM54uYn72N6KExWPI9PhZ3N40PB6kooRmjXFurilApHHA LY2dUsxvsIou8LNIHCgQp2h/rAGtgMhGY6J+zsoX0sbeuhKYqWwXjiqJIe6QDrOJc1zj GhiGptdjVIArOJyN1znuxSoqJb4X6JSH3pPmuzQvXQLTrsA1mR8/gc1N/K54dJmViwVi iG+VYGKo1qKOt/8p1yM2FfFZfjGyubZpOc1Hilo4c+fz/jAUd690i3o/hzQ+shBpIkJo CQjVzzIRSN9Zp5NzkcRPX25zz3LAnKyqXvvKh1cD9fwbXe/5VbZKbR6DzpQxQAkuaS/8 nPsw== 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 c22-20020a63d516000000b003729cb7f0e9si331801pgg.476.2022.03.02.14.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:56:39 -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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DB666113AD0; Wed, 2 Mar 2022 14:43:29 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244191AbiCBReA convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Mar 2022 12:34:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244109AbiCBRd3 (ORCPT ); Wed, 2 Mar 2022 12:33:29 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BE2AD4CBF; Wed, 2 Mar 2022 09:32:13 -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 222FZXnq014209; Wed, 2 Mar 2022 17:31:31 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ej9std0jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Mar 2022 17:31:31 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 222HDFCL008067; Wed, 2 Mar 2022 17:31:29 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3egbj1amg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Mar 2022 17:31:29 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 222HVRLc44040468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Mar 2022 17:31:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AE5C11C04A; Wed, 2 Mar 2022 17:31:27 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 963FD11C058; Wed, 2 Mar 2022 17:31:26 +0000 (GMT) Received: from smtp.tlslab.ibm.com (unknown [9.101.4.1]) by d06av25.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 2 Mar 2022 17:31:26 +0000 (GMT) Received: from yukon.ibmuc.com (unknown [9.171.58.125]) by smtp.tlslab.ibm.com (Postfix) with ESMTP id 30E86220294; Wed, 2 Mar 2022 18:31:25 +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 v2 07/10] spi: aspeed: Workaround AST2500 limitations Date: Wed, 2 Mar 2022 18:31:11 +0100 Message-Id: <20220302173114.927476-8-clg@kaod.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220302173114.927476-1-clg@kaod.org> References: <20220302173114.927476-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _AMFfnzclLOC_eCBQBlvvVvoGvjYPZ4c X-Proofpoint-ORIG-GUID: _AMFfnzclLOC_eCBQBlvvVvoGvjYPZ4c 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-02_12,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 clxscore=1034 impostorscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=972 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203020076 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 It is not possible to configure a full 128MB window for a chip of the same size on the AST2500 SPI controller. For his case, the maximum window size is restricted to 120MB for CE0. Signed-off-by: Cédric Le Goater --- drivers/spi/spi-aspeed-smc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index 974ab215ec34..e133984d3c95 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -445,6 +445,8 @@ static int aspeed_spi_set_window(struct aspeed_spi *aspi, * - ioremap each window, not strictly necessary since the overall window * is correct. */ +static const struct aspeed_spi_data ast2500_spi_data; + static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip, u32 local_offset, u32 size) { @@ -453,6 +455,16 @@ static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip, struct aspeed_spi_window *win = &windows[chip->cs]; int ret; + /* + * Due to an HW issue on the AST2500 SPI controller, the CE0 + * window size should be smaller than the maximum 128MB. + */ + if (aspi->data == &ast2500_spi_data && chip->cs == 0 && size == SZ_128M) { + size = 120 << 20; + dev_info(aspi->dev, "CE%d window resized to %dMB (AST2500 HW quirk)", + chip->cs, size >> 20); + } + aspeed_spi_get_windows(aspi, windows); /* Adjust this chip window */ -- 2.34.1