Skip to content

Commit 73ae97e

Browse files
potinlaibroonie
authored andcommitted
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 Tested-by: Jae Hyun Yoo <[email protected]> Signed-off-by: Potin Lai <[email protected]> [ clg : Ported on new spi-mem driver ] Signed-off-by: Cédric Le Goater <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent eeaec1e commit 73ae97e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/spi/spi-aspeed-smc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ static int aspeed_spi_set_window(struct aspeed_spi *aspi,
474474
* is correct.
475475
*/
476476
static const struct aspeed_spi_data ast2500_spi_data;
477+
static const struct aspeed_spi_data ast2600_spi_data;
478+
static const struct aspeed_spi_data ast2600_fmc_data;
477479

478480
static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
479481
u32 local_offset, u32 size)
@@ -497,6 +499,17 @@ static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
497499
chip->cs, size >> 20);
498500
}
499501

502+
/*
503+
* The decoding size of AST2600 SPI controller should set at
504+
* least 2MB.
505+
*/
506+
if ((aspi->data == &ast2600_spi_data || aspi->data == &ast2600_fmc_data) &&
507+
size < SZ_2M) {
508+
size = SZ_2M;
509+
dev_info(aspi->dev, "CE%d window resized to %dMB (AST2600 Decoding)",
510+
chip->cs, size >> 20);
511+
}
512+
500513
aspeed_spi_get_windows(aspi, windows);
501514

502515
/* Adjust this chip window */

0 commit comments

Comments
 (0)