aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/driver_chipcommon_pflash.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-02-12 04:15:44 -0500
committerKalle Valo <kvalo@codeaurora.org>2016-03-07 07:41:08 -0500
commitd6a3b51ada68c2bd3e184f4729ce626a1721cf74 (patch)
treea328a3f4e2101ba5748ce468c3a622fcd2bbc79e /drivers/bcma/driver_chipcommon_pflash.c
parent2e62f9b2a41e4ade1a0bb3c1bbda4defe4c67243 (diff)
bcma: move parallel flash support to separated file
This follows the way of handling other flashes and cleans code a bit. As next task we will want to move flash code to ChipCommon driver as: 1) Flash controllers are accesible using ChipCommon registers 2) This code isn't MIPS specific This change prepares bcma for that. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/bcma/driver_chipcommon_pflash.c')
-rw-r--r--drivers/bcma/driver_chipcommon_pflash.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/bcma/driver_chipcommon_pflash.c b/drivers/bcma/driver_chipcommon_pflash.c
new file mode 100644
index 000000000000..3b497c9ee0d4
--- /dev/null
+++ b/drivers/bcma/driver_chipcommon_pflash.c
@@ -0,0 +1,49 @@
1/*
2 * Broadcom specific AMBA
3 * ChipCommon parallel flash
4 *
5 * Licensed under the GNU/GPL. See COPYING for details.
6 */
7
8#include "bcma_private.h"
9
10#include <linux/bcma/bcma.h>
11#include <linux/mtd/physmap.h>
12#include <linux/platform_device.h>
13
14static const char * const part_probes[] = { "bcm47xxpart", NULL };
15
16static struct physmap_flash_data bcma_pflash_data = {
17 .part_probe_types = part_probes,
18};
19
20static struct resource bcma_pflash_resource = {
21 .name = "bcma_pflash",
22 .flags = IORESOURCE_MEM,
23};
24
25struct platform_device bcma_pflash_dev = {
26 .name = "physmap-flash",
27 .dev = {
28 .platform_data = &bcma_pflash_data,
29 },
30 .resource = &bcma_pflash_resource,
31 .num_resources = 1,
32};
33
34int bcma_pflash_init(struct bcma_drv_cc *cc)
35{
36 struct bcma_pflash *pflash = &cc->pflash;
37
38 pflash->present = true;
39
40 if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS))
41 bcma_pflash_data.width = 1;
42 else
43 bcma_pflash_data.width = 2;
44
45 bcma_pflash_resource.start = BCMA_SOC_FLASH2;
46 bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ;
47
48 return 0;
49}