Skip to content

Commit 5785eed

Browse files
legoaterbroonie
authored andcommitted
spi: aspeed: Workaround AST2500 limitations
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 <[email protected]> Tested-by: Joel Stanley <[email protected]> Tested-by: Tao Ren <[email protected]> Tested-by: Jae Hyun Yoo <[email protected]> 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 bb084f9 commit 5785eed

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/spi/spi-aspeed-smc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ static int aspeed_spi_set_window(struct aspeed_spi *aspi,
451451
* - ioremap each window, not strictly necessary since the overall window
452452
* is correct.
453453
*/
454+
static const struct aspeed_spi_data ast2500_spi_data;
455+
454456
static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
455457
u32 local_offset, u32 size)
456458
{
@@ -459,6 +461,16 @@ static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
459461
struct aspeed_spi_window *win = &windows[chip->cs];
460462
int ret;
461463

464+
/*
465+
* Due to an HW issue on the AST2500 SPI controller, the CE0
466+
* window size should be smaller than the maximum 128MB.
467+
*/
468+
if (aspi->data == &ast2500_spi_data && chip->cs == 0 && size == SZ_128M) {
469+
size = 120 << 20;
470+
dev_info(aspi->dev, "CE%d window resized to %dMB (AST2500 HW quirk)",
471+
chip->cs, size >> 20);
472+
}
473+
462474
aspeed_spi_get_windows(aspi, windows);
463475

464476
/* Adjust this chip window */

0 commit comments

Comments
 (0)