linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-mtd@lists.infradead.org, "Rafał Miłecki" <rafal@milecki.pl>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Frans Klaver" <fransklaver@gmail.com>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573
Date: Mon, 7 Nov 2016 18:23:30 -0800	[thread overview]
Message-ID: <20161108022330.GA119161@google.com> (raw)
In-Reply-To: <1471263690-32512-1-git-send-email-zajec5@gmail.com>

Hi,

On Mon, Aug 15, 2016 at 02:21:28PM +0200, Rafał Miłecki 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>
> ---
>  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.

Is the word "magically" really used in the Broadcom reference code? I
wouldn't be too suprised actually :)

I'd prefer getting a better explanation on this point, but without that,
I think it's fair to leave the caching for the old (working) MIPS SoCs
and avoid caching on the new ARM one.

> +	 * 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.

Yeah, if we get any more ARM chips that behave similarly, I think we'll
just want to do 'if !MIPS'.

Applied to l2-mtd.git.

Brian

> +	 */
> +	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;
> -- 
> 1.8.4.5
> 

  parent reply	other threads:[~2016-11-08  2:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 12:21 [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573 Rafał Miłecki
2016-11-07  9:41 ` Boris Brezillon
2016-11-08  2:23 ` Brian Norris [this message]
2016-11-08 10:05   ` Rafał Miłecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161108022330.GA119161@google.com \
    --to=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=fransklaver@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=rafal@milecki.pl \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).