openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
@ 2022-03-31  0:29 Potin Lai
  2022-03-31  1:07 ` Joel Stanley
  0 siblings, 1 reply; 4+ messages in thread
From: Potin Lai @ 2022-03-31  0:29 UTC (permalink / raw)
  To: joel, clg, linux-aspeed, openbmc; +Cc: 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@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

Signed-off-by: Potin Lai <potin.lai@quantatw.com>

---
[v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai@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(+)

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;
 
 	/*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
  2022-03-31  0:29 [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600 Potin Lai
@ 2022-03-31  1:07 ` Joel Stanley
  2022-03-31  5:50   ` Cédric Le Goater
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2022-03-31  1:07 UTC (permalink / raw)
  To: Potin Lai; +Cc: OpenBMC Maillist, Cédric Le Goater, linux-aspeed

On Thu, 31 Mar 2022 at 00:29, Potin Lai <potin.lai@quantatw.com> wrote:
>
> 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
>
> Signed-off-by: Potin Lai <potin.lai@quantatw.com>
>
> ---
> [v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai@quantatw.com/

Cédric, can I get an ack from you before I put this in the openbmc tree?

>
> 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(+)
>
> 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;
>
>         /*
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
  2022-03-31  1:07 ` Joel Stanley
@ 2022-03-31  5:50   ` Cédric Le Goater
  2022-03-31  6:16     ` Joel Stanley
  0 siblings, 1 reply; 4+ messages in thread
From: Cédric Le Goater @ 2022-03-31  5:50 UTC (permalink / raw)
  To: Joel Stanley, Potin Lai; +Cc: OpenBMC Maillist, linux-aspeed

On 3/31/22 03:07, Joel Stanley wrote:
> On Thu, 31 Mar 2022 at 00:29, Potin Lai <potin.lai@quantatw.com> wrote:
>>
>> 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
>>
>> Signed-off-by: Potin Lai <potin.lai@quantatw.com>
>>
>> ---
>> [v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai@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 <clg@kaod.org>

Thanks,

C.

>>
>> 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(+)
>>
>> 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;
>>
>>          /*
>> --
>> 2.17.1
>>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
  2022-03-31  5:50   ` Cédric Le Goater
@ 2022-03-31  6:16     ` Joel Stanley
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Stanley @ 2022-03-31  6:16 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: Potin Lai, OpenBMC Maillist, linux-aspeed

On Thu, 31 Mar 2022 at 05:51, Cédric Le Goater <clg@kaod.org> wrote:
>
> On 3/31/22 03:07, Joel Stanley wrote:
> > On Thu, 31 Mar 2022 at 00:29, Potin Lai <potin.lai@quantatw.com> wrote:
> >>
> >> 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
> >>
> >> Signed-off-by: Potin Lai <potin.lai@quantatw.com>
> >>
> >> ---
> >> [v1]: https://lore.kernel.org/all/20220304170757.16924-1-potin.lai@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 <clg@kaod.org>

Thanks, I've applied this to dev-5.15.

>
> Thanks,
>
> C.
>
> >>
> >> 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(+)
> >>
> >> 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;
> >>
> >>          /*
> >> --
> >> 2.17.1
> >>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-31  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31  0:29 [RESEND][PATCH linux dev-5.15 v2 1/1] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600 Potin Lai
2022-03-31  1:07 ` Joel Stanley
2022-03-31  5:50   ` Cédric Le Goater
2022-03-31  6:16     ` Joel Stanley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).