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 
14 static const char * const part_probes[] = { "bcm47xxpart", NULL };
15 
16 static struct physmap_flash_data bcma_pflash_data = {
17 	.part_probe_types	= part_probes,
18 };
19 
20 static struct resource bcma_pflash_resource = {
21 	.name	= "bcma_pflash",
22 	.flags  = IORESOURCE_MEM,
23 };
24 
25 struct 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 
34 int 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 }
50