[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220330194916.olffkctxjhfqksvf@ti.com>
Date: Thu, 31 Mar 2022 01:19:16 +0530
From: Pratyush Yadav <p.yadav@...com>
To: Cédric Le Goater <clg@...d.org>
CC: <linux-spi@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
Mark Brown <broonie@...nel.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
<linux-aspeed@...ts.ozlabs.org>, Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...id.au>,
Chin-Ting Kuo <chin-ting_kuo@...eedtech.com>,
<devicetree@...r.kernel.org>, Rob Herring <robh+dt@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, Potin Lai <potin.lai@...ntatw.com>
Subject: Re: [PATCH v4 11/11] mtd: spi-nor: aspeed: set the decoding size to
at least 2MB for AST2600
> Subject: [PATCH v4 11/11] mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600
Nitpick: s/mtd: spi-nor: aspeed:/spi: aspeed:/
On 25/03/22 11:08AM, Cédric Le Goater wrote:
> From: Potin Lai <potin.lai@...ntatw.com>
>
> 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@...tchley:~# 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@...tchley:~# devmem 0x1e631030
> 0x00100000
>
> Signed-off-by: Potin Lai <potin.lai@...ntatw.com>
> [ clg : Ported on new spi-mem driver ]
> Signed-off-by: Cédric Le Goater <clg@...d.org>
> ---
> drivers/spi/spi-aspeed-smc.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c
> index 660451667a39..227797e13997 100644
> --- a/drivers/spi/spi-aspeed-smc.c
> +++ b/drivers/spi/spi-aspeed-smc.c
> @@ -466,6 +466,8 @@ static int aspeed_spi_set_window(struct aspeed_spi *aspi,
> * is correct.
> */
> static const struct aspeed_spi_data ast2500_spi_data;
> +static const struct aspeed_spi_data ast2600_spi_data;
> +static const struct aspeed_spi_data ast2600_fmc_data;
>
> static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
> u32 local_offset, u32 size)
> @@ -489,6 +491,17 @@ static int aspeed_spi_chip_adjust_window(struct aspeed_spi_chip *chip,
> chip->cs, size >> 20);
> }
>
> + /*
> + * The decoding size of AST2600 SPI controller should set at
> + * least 2MB.
> + */
> + if ((aspi->data == &ast2600_spi_data || aspi->data == &ast2600_fmc_data) &&
> + size < SZ_2M) {
> + size = SZ_2M;
> + dev_info(aspi->dev, "CE%d window resized to %dMB (AST2600 Decoding)",
> + chip->cs, size >> 20);
> + }
> +
> aspeed_spi_get_windows(aspi, windows);
>
> /* Adjust this chip window */
> --
> 2.34.1
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
Powered by blists - more mailing lists