From: Cédric Le Goater Date: Sun, 16 Oct 2022 15:57:22 +0000 (+0200) Subject: spi: aspeed: Fix window offset of CE1 X-Git-Tag: v6.0.7~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9f0e9b43574f653e93e310aa2aa3ef96f51bcac;p=thirdparty%2Fkernel%2Fstable.git spi: aspeed: Fix window offset of CE1 [ Upstream commit f8aa6c895d482847c9b799dcdac8bbdb56cb8e04 ] 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 Fixes: e3228ed92893 ("spi: spi-mem: Convert Aspeed SMC driver to spi-mem") Signed-off-by: Cédric Le Goater Reviewed-by: Joel Stanley Link: https://lore.kernel.org/r/20221016155722.3520802-1-clg@kaod.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index 3e891bf22470e..5a995b5653f1b 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); }