summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPotin Lai <potin.lai@quantatw.com>2022-03-31 03:29:14 +0300
committerJoel Stanley <joel@jms.id.au>2022-03-31 09:12:58 +0300
commit191d5d420258a7c849d61e21f780124641caca0a (patch)
tree9dec164e850a10143268252f4b2cb0ae5ed4946c /drivers/mtd
parent45fe1d1ce867089ae95556c154abb0bcabf52a78 (diff)
downloadlinux-191d5d420258a7c849d61e21f780124641caca0a.tar.xz
mtd: spi-nor: aspeed: Set the decoding size to at least 2MB for AST2600
In AST2600, the unit of SPI CEx decoding range register is 1MB, and end address offset is set to the acctual offset - 1MB. If the flash only has 1MB, the end address will has same value as start address, which will causing unexpected errors. This patch set the decoding size to at least 2MB to avoid decoding errors. Tested: root@bletchley:~# dmesg | grep "aspeed-smc 1e631000.spi: CE0 window" [ 59.328134] aspeed-smc 1e631000.spi: CE0 window resized to 2MB (AST2600 Decoding) [ 59.343001] aspeed-smc 1e631000.spi: CE0 window [ 0x50000000 - 0x50200000 ] 2MB root@bletchley:~# devmem 0x1e631030 0x00100000 OpenBMC-Staging-Count: 1 Signed-off-by: Potin Lai <potin.lai@quantatw.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Link: https://lore.kernel.org/r/20220331002914.30495-1-potin.lai@quantatw.com Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/controllers/aspeed-smc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
index 416ea247f843..74fa46439246 100644
--- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
@@ -781,6 +781,18 @@ static u32 aspeed_smc_chip_set_segment(struct aspeed_smc_chip *chip)
chip->cs, size >> 20);
}
+ /*
+ * The decoding size of AST2600 SPI controller should set at
+ * least 2MB.
+ */
+ if ((controller->info == &spi_2600_info ||
+ controller->info == &fmc_2600_info) && size < SZ_2M) {
+ size = SZ_2M;
+ dev_info(chip->nor.dev,
+ "CE%d window resized to %dMB (AST2600 Decoding)",
+ chip->cs, size >> 20);
+ }
+
ahb_base_phy = controller->ahb_base_phy;
/*