Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1515949 > unrolled thread

Re: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573

Started byBoris Brezillon <boris.brezillon@free-electrons.com>
First post2016-11-07 10:50 +0100
Last post2016-11-07 10:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for  BCM53573 Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-11-07 10:50 +0100

#1515949 — Re: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-11-07 10:50 +0100
SubjectRe: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573
Message-ID<sAOIV-1iM-3@gated-at.bofh.it>
On Mon, 15 Aug 2016 14:21:28 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and uses
> this old ChipCommon-based flash access. Early tests resulted in flash
> corruptions that were tracked down to using cached MMIO for flash read
> access. Switch to ioremap_nocache conditionally to support BCM53573 and
> don't break performance on old MIPS devices.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/mtd/devices/bcm47xxsflash.c | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
> index 1c65c15..514be04 100644
> --- a/drivers/mtd/devices/bcm47xxsflash.c
> +++ b/drivers/mtd/devices/bcm47xxsflash.c
> @@ -296,16 +296,30 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  		dev_err(dev, "can't request region for resource %pR\n", res);
>  		return -EBUSY;
>  	}
> -	b47s->window = ioremap_cache(res->start, resource_size(res));
> -	if (!b47s->window) {
> -		dev_err(dev, "ioremap failed for resource %pR\n", res);
> -		return -ENOMEM;
> -	}
>  
>  	b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
>  	b47s->cc_read = bcm47xxsflash_bcma_cc_read;
>  	b47s->cc_write = bcm47xxsflash_bcma_cc_write;
>  
> +	/*
> +	 * On old MIPS devices cache was magically invalidated when needed,
> +	 * allowing us to use cached access and gain some performance. Trying
> +	 * the same on ARM based BCM53573 results in flash corruptions, we need
> +	 * to use uncached access for it.
> +	 *
> +	 * It may be arch specific, but right now there is only 1 ARM SoC using
> +	 * this driver, so let's follow Broadcom's reference code and check
> +	 * ChipCommon revision.
> +	 */
> +	if (b47s->bcma_cc->core->id.rev == 54)
> +		b47s->window = ioremap_nocache(res->start, resource_size(res));
> +	else
> +		b47s->window = ioremap_cache(res->start, resource_size(res));
> +	if (!b47s->window) {
> +		dev_err(dev, "ioremap failed for resource %pR\n", res);
> +		return -ENOMEM;
> +	}
> +
>  	switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) {
>  	case BCMA_CC_FLASHT_STSER:
>  		b47s->type = BCM47XXSFLASH_TYPE_ST;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web