mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
Subsystems (3)
PATCH RESEND v2 1/1 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 at 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 at bletchley:~# devmem 0x1e6310300x00100000
---
[v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai at quantatw.com/
Changes v1 --> v2:
- add fmc controller into decoding range resize checking
--- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/mtd/spi-nor/controllers/aspeed-smc.c +12 -0
@@ -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;/*
Signature · 1 line
2.17.1
Joel Stanley
maintainerPATCH RESEND v2 1/1 mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
Quoted 12 lines · Potin Lai
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 at 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
Quoted 7 lines
root at bletchley:~# devmem
0x1e6310300x00100000Signed-off-by Potin Lai <[email protected]>---
[v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai at quantatw.com/
C?dric, can I get an ack from you before I put this in the openbmc tree?
Quoted 33 lines
Changes v1 --> v2:
- add fmc controller into decoding range resize checking--- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/spi-nor/controllers/aspeed-smc.c +12
-1@@ -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;/* -- 2.17.1
PATCH RESEND v2 1/1 mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
Quoted 16 lines · Joel Stanley
Quoted 15 lines · Potin Lai
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 at 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 ] 2MBroot at bletchley:~# devmem
0x1e6310300x00100000
Quoted 6 lines
Quoted 4 lines
Signed-off-by Potin Lai <[email protected]>---
[v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai at quantatw.com/C?dric, can I get an ack from you before I put this in the openbmc tree?
Thanks,
C.
Quoted 33 lines
Quoted 33 lines
Changes v1 --> v2:
- add fmc controller into decoding range resize checking--- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/spi-nor/controllers/aspeed-smc.c +12
-1@@ -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;/* -- 2.17.1
Joel Stanley
maintainerPATCH RESEND v2 1/1 mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
Quoted 20 lines · C?dric Le Goater
Quoted 18 lines · Joel Stanley
Quoted 17 lines · Potin Lai
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 at 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 ] 2MBroot at bletchley:~# devmem
0x1e6310300x00100000Signed-off-by Potin Lai <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
---
[v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai at quantatw.com/C?dric, can I get an ack from you before I put this in the openbmc tree?
Reviewed-by C?dric Le Goater <[email protected]>
Thanks, I've applied this to dev-5.15.
Quoted 39 lines
Thanks,
C.
Quoted 33 lines
Quoted 33 lines
Changes v1 --> v2:
- add fmc controller into decoding range resize checking--- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/spi-nor/controllers/aspeed-smc.c +12
-1@@ -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;/* -- 2.17.1