diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2016-08-15 08:21:28 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2016-11-07 21:17:37 -0500 |
commit | 64ad46379fcf14f437553f654d1adcd3d0e0d7f9 (patch) | |
tree | c36430fc2ec91a9b6d7fb07148552de48e88cf9e | |
parent | 0e2ce9d3fcba5f92dd6c2b27d82690e49d0c0854 (diff) |
mtd: bcm47xxsflash: use uncached MMIO access for BCM53573
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>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/devices/bcm47xxsflash.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index 1c65c15b31a1..514be04c0b6c 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) | |||
296 | dev_err(dev, "can't request region for resource %pR\n", res); | 296 | dev_err(dev, "can't request region for resource %pR\n", res); |
297 | return -EBUSY; | 297 | return -EBUSY; |
298 | } | 298 | } |
299 | b47s->window = ioremap_cache(res->start, resource_size(res)); | ||
300 | if (!b47s->window) { | ||
301 | dev_err(dev, "ioremap failed for resource %pR\n", res); | ||
302 | return -ENOMEM; | ||
303 | } | ||
304 | 299 | ||
305 | b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); | 300 | b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); |
306 | b47s->cc_read = bcm47xxsflash_bcma_cc_read; | 301 | b47s->cc_read = bcm47xxsflash_bcma_cc_read; |
307 | b47s->cc_write = bcm47xxsflash_bcma_cc_write; | 302 | b47s->cc_write = bcm47xxsflash_bcma_cc_write; |
308 | 303 | ||
304 | /* | ||
305 | * On old MIPS devices cache was magically invalidated when needed, | ||
306 | * allowing us to use cached access and gain some performance. Trying | ||
307 | * the same on ARM based BCM53573 results in flash corruptions, we need | ||
308 | * to use uncached access for it. | ||
309 | * | ||
310 | * It may be arch specific, but right now there is only 1 ARM SoC using | ||
311 | * this driver, so let's follow Broadcom's reference code and check | ||
312 | * ChipCommon revision. | ||
313 | */ | ||
314 | if (b47s->bcma_cc->core->id.rev == 54) | ||
315 | b47s->window = ioremap_nocache(res->start, resource_size(res)); | ||
316 | else | ||
317 | b47s->window = ioremap_cache(res->start, resource_size(res)); | ||
318 | if (!b47s->window) { | ||
319 | dev_err(dev, "ioremap failed for resource %pR\n", res); | ||
320 | return -ENOMEM; | ||
321 | } | ||
322 | |||
309 | switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) { | 323 | switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) { |
310 | case BCMA_CC_FLASHT_STSER: | 324 | case BCMA_CC_FLASHT_STSER: |
311 | b47s->type = BCM47XXSFLASH_TYPE_ST; | 325 | b47s->type = BCM47XXSFLASH_TYPE_ST; |