Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1867756pxm; Fri, 4 Mar 2022 05:14:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwlrBkWedWAX9ORjNuVGRWB9dO1ttKmm9NdY54NTNTeLDkZSj6wXZWA8F7NeyvlpyNHbBA X-Received: by 2002:a05:6402:424c:b0:415:bdf8:9710 with SMTP id g12-20020a056402424c00b00415bdf89710mr12453912edb.145.1646399669640; Fri, 04 Mar 2022 05:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646399669; cv=none; d=google.com; s=arc-20160816; b=WCUvoLC6JYk0PTUuO8SW0GY3oorb3/372fERzSHZF3fjzuCJkHeHujmRQ2f6FWF1hj Urno3tq0U6b1ZUvUCbVAzrvQp9BsnZh/F5qaAczqrP3ts7pwzNpzceoOn2OgjvNv4nAw 4/Us3hjhhISQ3tLeSIiRpHjUFReXK6S38a+LKyVK3MABWe1bYnoHqbtWeZ8DvN+T2zCg qb0iTK9CkR+oeoN06Uux7l2hg22OONjw2XEX35qJPZsFpfZwbfjzKexknx0wImflTwye kfQ6/IVUaL0UBX5z+g1veH8oWcBI1u6nU9GuJrBJb8JyJ0CqqUbmvXnjc0FFaiyuHjGd OP6w== 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=Ru2YPbWPUAAt4ClXo7aC9YM8oB+j807IqXGl/uaJuds=; b=I0iQDIP2uLfFfrUzy5ckPPdyhhq4mSK6Me5VMVN3biimq8tb6Xjz/LoYW5HxJ6D4uQ mjq3nlKeSrxGRQFp4ZyHhbeyRu1k8tM3UD7WppQNKbgm+qiBMUxNYsqxOy3SJqRl7LcR 6fuifJsKnMgvnr2md91PyplCryKoOJY+xieorvRIyav/9B7rFOLNPLKCi3NYWuQfn1LD gfsrWxVFz1neWlPVITJ2/NEDfoib0GHgqPtJYPc08L9oEoUK7P5NrAA+fh8Jjgx93Lyu trdc/EGs7op6T8LlNwJAKgvRBu/gmClaHX8NWj7CjQTfEZ0OxtZXea4i5Q6c3HPQdpHv 8AOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc24-20020a1709071c1800b006da825b1354si3819627ejc.766.2022.03.04.05.14.06; Fri, 04 Mar 2022 05:14:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234246AbiCDIi6 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 4 Mar 2022 03:38:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233767AbiCDIia (ORCPT ); Fri, 4 Mar 2022 03:38:30 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F6B41D9; Fri, 4 Mar 2022 00:37:40 -0800 (PST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2246t3Qk010730; Fri, 4 Mar 2022 08:37:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ekacwn01x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 08:37:05 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 2248ZvoD002239; Fri, 4 Mar 2022 08:37:04 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ekacwn01c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 08:37:04 +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 2248X5ku013656; Fri, 4 Mar 2022 08:37:02 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 3ek4k417hd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Mar 2022 08:37:01 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2248Q0An49545702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Mar 2022 08:26:00 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 918B5A4051; Fri, 4 Mar 2022 08:36:59 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3DF3A404D; Fri, 4 Mar 2022 08:36:58 +0000 (GMT) Received: from smtp.tlslab.ibm.com (unknown [9.101.4.1]) by d06av23.portsmouth.uk.ibm.com (Postfix) with SMTP; Fri, 4 Mar 2022 08:36:58 +0000 (GMT) Received: from yukon.home (unknown [9.171.91.16]) by smtp.tlslab.ibm.com (Postfix) with ESMTP id 4C6BE2201B4; Fri, 4 Mar 2022 09:36:57 +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?= , Tao Ren Subject: [PATCH v3 07/11] spi: aspeed: Workaround AST2500 limitations Date: Fri, 4 Mar 2022 09:36:39 +0100 Message-Id: <20220304083643.1079142-8-clg@kaod.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220304083643.1079142-1-clg@kaod.org> References: <20220304083643.1079142-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: k1vTTo0hq93LL-BmrUlUX3196LLTUrXh X-Proofpoint-ORIG-GUID: ttx03KY3t1k4gjwnjRKXY2yhH00I1i6i 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 phishscore=0 adultscore=0 mlxlogscore=999 clxscore=1034 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203040044 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL,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 this case, the maximum window size is restricted to 120MB for CE0. Reviewed-by: Joel Stanley Tested-by: Joel Stanley Tested-by: Tao Ren 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 9f7910e79ae8..ab6fa5cfad9c 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -443,6 +443,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) { @@ -451,6 +453,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