Re: [PATCH linux dev-5.3 09/13] mtd: spi-nor: aspeed: Check for disabled segments on the AST2600

Andrew Jeffery andrew at aj.id.au
Thu Sep 26 12:01:41 AEST 2019



On Wed, 25 Sep 2019, at 22:12, Cédric Le Goater wrote:
> The segments can be disabled on the AST2600 (zero register value).
> CS0 is open by default but not the other CS. This is closing the
> access to the flash device in user mode and forbids scanning. For
> multiple CS, we will need firmware or a DT property to reopen the
> flash AHB window.
> 
> Signed-off-by: Cédric Le Goater <clg at kaod.org>

Reviewed-by: Andrew Jeffery <andrew at aj.id.au>

> ---
>  drivers/mtd/spi-nor/aspeed-smc.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/aspeed-smc.c 
> b/drivers/mtd/spi-nor/aspeed-smc.c
> index 6c5ecea21882..ea9b4a157677 100644
> --- a/drivers/mtd/spi-nor/aspeed-smc.c
> +++ b/drivers/mtd/spi-nor/aspeed-smc.c
> @@ -659,8 +659,15 @@ static u32 chip_set_segment(struct aspeed_smc_chip 
> *chip, u32 cs, u32 start,
>  	 * size, but take into account the possible overlap with the
>  	 * previous segment
>  	 */
> -	if (!size)
> -		size = info->segment_end(controller, seg_oldval) - start;
> +	if (!size) {
> +		end = info->segment_end(controller, seg_oldval);
> +
> +		/*
> +		 * Check for disabled segment (AST2600).
> +		 */
> +		if (end != ahb_base_phy)
> +			size = end - start;
> +	}
>  
>  	/*
>  	 * The segment cannot exceed the maximum window size of the
> @@ -689,8 +696,8 @@ static u32 chip_set_segment(struct aspeed_smc_chip 
> *chip, u32 cs, u32 start,
>  		size = end - start;
>  	}
>  
> -	dev_info(chip->nor.dev, "CE%d window [ 0x%.8x - 0x%.8x ] %dMB",
> -		 cs, start, end, size >> 20);
> +	dev_info(chip->nor.dev, "CE%d window [ 0x%.8x - 0x%.8x ] %dMB%s",
> +		 cs, start, end, size >> 20, size ? "" : " (disabled)");
>  
>  	return size;
>  }
> -- 
> 2.21.0
> 
>


More information about the openbmc mailing list