Linux 4.19.133
[linux/fpc-iii.git] / drivers / bcma / driver_chipcommon_pflash.c
blob3b497c9ee0d4cad59d768dc53394152cda4dacfa
1 /*
2 * Broadcom specific AMBA
3 * ChipCommon parallel flash
5 * Licensed under the GNU/GPL. See COPYING for details.
6 */
8 #include "bcma_private.h"
10 #include <linux/bcma/bcma.h>
11 #include <linux/mtd/physmap.h>
12 #include <linux/platform_device.h>
14 static const char * const part_probes[] = { "bcm47xxpart", NULL };
16 static struct physmap_flash_data bcma_pflash_data = {
17 .part_probe_types = part_probes,
20 static struct resource bcma_pflash_resource = {
21 .name = "bcma_pflash",
22 .flags = IORESOURCE_MEM,
25 struct platform_device bcma_pflash_dev = {
26 .name = "physmap-flash",
27 .dev = {
28 .platform_data = &bcma_pflash_data,
30 .resource = &bcma_pflash_resource,
31 .num_resources = 1,
34 int bcma_pflash_init(struct bcma_drv_cc *cc)
36 struct bcma_pflash *pflash = &cc->pflash;
38 pflash->present = true;
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;
45 bcma_pflash_resource.start = BCMA_SOC_FLASH2;
46 bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ;
48 return 0;