Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp213004iob; Mon, 2 May 2022 17:23:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9LI6Bi/o5wqf2DU6RVL94NFxaeNafTsZdzSvDpXSs4s91xl1YF6rBZDVSt6SezMBVoLNS X-Received: by 2002:a17:90a:7c04:b0:1d7:d7e6:2916 with SMTP id v4-20020a17090a7c0400b001d7d7e62916mr1907777pjf.25.1651537417414; Mon, 02 May 2022 17:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537417; cv=none; d=google.com; s=arc-20160816; b=ysKnkOy0tI5jRvVx+jMuy1UD03ekmXLIEXMPuKzRK9UHavla7COjTptmPbBP351mEw jsXcqBnlBwoA89yY/K2G0vxpXAtexa420gn+Cf/U1dgI4iUqNlqQuCRuJ87mqGxmf3xd Sr8q1Ifd7xVoukYtzTM+d7THddz8lHYC9k3brqXFqGHLMWM0jk1oNEf2bKP4kYWkN85I yWEp0D2fKJySQE/Edg35D1t/hQ8myDt6T2ru1gOs5uboK8AI+LblMTCRPhn6XlpNrL0z JxyOru15GjgUwXdVKNob8oNlpvY+SSHn5n1SqIPQRD5duVMshCzWWSxxlT/2+PNhdqD/ Y3LA== 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=XjlBh3RMfAGVm3s+S9X6XB+sz9T7sE4u7fYAO5p8U3s=; b=k+VMOyD0UOlVE5tjEuYC94MoC3WKaJNSSaRlBfAnwgpv8tFW6H5lw682CiAjcU5GZc goMQ3IHKZcuBrQDwILUA4WANIxQgMFbNiHPePULcuchUc7nRQONougavW4bqzZuiZGvY 8xGCExUKFTAa///W9SB/50BP7dj3lPdrjOtS6wd5uP0LxLZQwT5OmcwIbBhSQ5JBtc4K NQYLVpfPGr3ozqrFcOZNxm0oUjStrsTydihV2YxOOTV43uDuCFXCZrc1JoKzaX9X/1CY LTtKrv12oT8yVXCuaCa/9cf/uSkXJe2/ZQ4KheDDSn9WzUjs5BxUC0vuJIpOOk85n21I /QOg== 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 p33-20020a056a000a2100b005056ce10e70si17935643pfh.278.2022.05.02.17.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:23:37 -0700 (PDT) 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 6E1AB393E0; Mon, 2 May 2022 17:19:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383702AbiEBISR (ORCPT + 99 others); Mon, 2 May 2022 04:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383689AbiEBISM (ORCPT ); Mon, 2 May 2022 04:18:12 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970383F8B6; Mon, 2 May 2022 01:14:30 -0700 (PDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4KsG8j2ZGYz4xXk; Mon, 2 May 2022 18:14:29 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (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 mail.ozlabs.org (Postfix) with ESMTPSA id 4KsG8c0FS5z4x7Y; Mon, 2 May 2022 18:14:23 +1000 (AEST) 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 , Jae Hyun Yoo Subject: [PATCH v5 06/11] spi: aspeed: Workaround AST2500 limitations Date: Mon, 2 May 2022 10:13:36 +0200 Message-Id: <20220502081341.203369-7-clg@kaod.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502081341.203369-1-clg@kaod.org> References: <20220502081341.203369-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 this case, the maximum window size is restricted to 120MB for CE0. Reviewed-by: Joel Stanley Tested-by: Joel Stanley Tested-by: Tao Ren Tested-by: Jae Hyun Yoo 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 0aff42e20b8d..d2b3342c133e 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -451,6 +451,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) { @@ -459,6 +461,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.35.1