Message ID | 20221016155722.3520802-1-clg@kaod.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1075073wrs; Sun, 16 Oct 2022 09:15:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7L+zbcr4c3+9UF92jALT5qnWrLXeBMvbUQOyCzEzKHVcTB4mWnl6l+gj5YUiddojSQooy4 X-Received: by 2002:a17:906:5a44:b0:78d:4c17:9856 with SMTP id my4-20020a1709065a4400b0078d4c179856mr5749047ejc.477.1665936936588; Sun, 16 Oct 2022 09:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665936936; cv=none; d=google.com; s=arc-20160816; b=idI4kxd3pO95o/+mZRHS7nf7AgRFlHm7VNcCZgNkUDpsbLOG0YMp8tW/qcMSlw4SQr vGOpg5tvIxPlQiMKENcev2Znz1STEVumng4tLbHbYZKISS8CCWLAh/kRQMp0OdlEX60J M+bj+vo0D66AQ1O3pOCANnejZeczuKsx4UTNQoy/l9f1t75g5zUzvyUcKI1lLRzUhEMM rs/ewd9ioS5Q7GLFCtcuix9VxC1umHjnFrOHVwnz8AGMxZW88GUuPDnNTA+OhLYFlJkb ZIpM/9XF/iBs6PaSvbjFLwaWA9qOn3bGYRozQ29D0L7KTQxRs5kRg6hzmPuXPpjdjme+ YdrA== 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 :message-id:date:subject:cc:to:from; bh=x6hvisZz0oOmfJJB1YPmFVSUsvgJiRO2KrN0sPmP33E=; b=Kc5Sy4Tg2J/0LeVg7Ed2Xovb/+1isF7+1WRvwwrxgzIc3Sg/+4bOzrKRJbCe+s/DgZ H8b0uHHk4bHoIeH5FbkblvBgl6Zqwbwsg26n7SwncjnEKk4i5L5URJm8N6tuSRhS3mMm qs7PSZ3yDTsyetawgY15IU5/B8JWEa+PVMthv/+oTVC7LDeyROuR3RfeXeaNbWcLrFVY XZ1WSjbIpskD7IH3Ad8oxD3ywv1STzgRQFhkKmxaSp/fXAQZLhCdsCfVZdtHJjLwWcvZ U9IgIE4WHPTbauDmwxrQ32gVgrArikpB0sH/EC5Mds53YP/vtuVwsSjdDlXKns9e3LWY Z4ww== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm4-20020a170907948400b0078de8d119d8si5940309ejc.853.2022.10.16.09.15.10; Sun, 16 Oct 2022 09:15:36 -0700 (PDT) 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 S229811AbiJPP5k (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Sun, 16 Oct 2022 11:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbiJPP5i (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 16 Oct 2022 11:57:38 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 762002E9C4; Sun, 16 Oct 2022 08:57:37 -0700 (PDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Mr4Ww3Gvfz4xGp; Mon, 17 Oct 2022 02:57:32 +1100 (AEDT) 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 4Mr4Wq65Brz4xGG; Mon, 17 Oct 2022 02:57:27 +1100 (AEDT) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org> To: linux-spi@vger.kernel.org Cc: Mark Brown <broonie@kernel.org>, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org>, Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> Subject: [PATCH] spi: aspeed: Fix window offset of CE1 Date: Sun, 16 Oct 2022 17:57:22 +0200 Message-Id: <20221016155722.3520802-1-clg@kaod.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746861489339084169?= X-GMAIL-MSGID: =?utf-8?q?1746861489339084169?= |
Series |
spi: aspeed: Fix window offset of CE1
|
|
Commit Message
Cédric Le Goater
Oct. 16, 2022, 3:57 p.m. UTC
The offset value of the mapping window in the kernel structure is
calculated using the value of the previous window offset. This doesn't
reflect how the HW is configured and can lead to erroneous setting of
the second flash device (CE1).
Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
drivers/spi/spi-aspeed-smc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sun, 16 Oct 2022 at 15:57, Cédric Le Goater <clg@kaod.org> wrote: > > The offset value of the mapping window in the kernel structure is > calculated using the value of the previous window offset. This doesn't > reflect how the HW is configured and can lead to erroneous setting of > the second flash device (CE1). So .offset is expected to be the absolute address of the window, and this was okay for the 2400/2500 but was broken on the 2600? Reviewed-by: Joel Stanley <joel@jms.id.au> > > Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> > Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem") > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > drivers/spi/spi-aspeed-smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c > index 33cefcf18392..b90571396a60 100644 > --- a/drivers/spi/spi-aspeed-smc.c > +++ b/drivers/spi/spi-aspeed-smc.c > @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, > windows[cs].cs = cs; > windows[cs].size = data->segment_end(aspi, reg_val) - > data->segment_start(aspi, reg_val); > - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; > + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; > dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, > windows[cs].offset, windows[cs].size); > } > -- > 2.37.3 >
On 10/17/22 00:43, Joel Stanley wrote: > On Sun, 16 Oct 2022 at 15:57, Cédric Le Goater <clg@kaod.org> wrote: >> >> The offset value of the mapping window in the kernel structure is >> calculated using the value of the previous window offset. This doesn't >> reflect how the HW is configured and can lead to erroneous setting of >> the second flash device (CE1). > > So .offset is expected to be the absolute address of the window, and > this was okay for the 2400/2500 but was broken on the 2600? the aspeed_spi_get_windows() routine collects in an array the window/decoding range setting for each CS, and the offset for CS1 and above is computed from the offset/size of the previous CS. But this makes an assumption on the fact ranges are contiguous, which is not necessarily how the HW is configured. C. > Reviewed-by: Joel Stanley <joel@jms.id.au> > > >> >> Cc: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> >> Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem") >> Signed-off-by: Cédric Le Goater <clg@kaod.org> >> --- >> drivers/spi/spi-aspeed-smc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c >> index 33cefcf18392..b90571396a60 100644 >> --- a/drivers/spi/spi-aspeed-smc.c >> +++ b/drivers/spi/spi-aspeed-smc.c >> @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, >> windows[cs].cs = cs; >> windows[cs].size = data->segment_end(aspi, reg_val) - >> data->segment_start(aspi, reg_val); >> - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; >> + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; >> dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, >> windows[cs].offset, windows[cs].size); >> } >> -- >> 2.37.3 >>
diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index 33cefcf18392..b90571396a60 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -398,7 +398,7 @@ static void aspeed_spi_get_windows(struct aspeed_spi *aspi, windows[cs].cs = cs; windows[cs].size = data->segment_end(aspi, reg_val) - data->segment_start(aspi, reg_val); - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, windows[cs].offset, windows[cs].size); }