Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Broadcom specific AMBA
0003  * ChipCommon parallel flash
0004  *
0005  * Licensed under the GNU/GPL. See COPYING for details.
0006  */
0007 
0008 #include "bcma_private.h"
0009 
0010 #include <linux/bcma/bcma.h>
0011 #include <linux/mtd/physmap.h>
0012 #include <linux/platform_device.h>
0013 
0014 static const char * const part_probes[] = { "bcm47xxpart", NULL };
0015 
0016 static struct physmap_flash_data bcma_pflash_data = {
0017     .part_probe_types   = part_probes,
0018 };
0019 
0020 static struct resource bcma_pflash_resource = {
0021     .name   = "bcma_pflash",
0022     .flags  = IORESOURCE_MEM,
0023 };
0024 
0025 struct platform_device bcma_pflash_dev = {
0026     .name       = "physmap-flash",
0027     .dev        = {
0028         .platform_data  = &bcma_pflash_data,
0029     },
0030     .resource   = &bcma_pflash_resource,
0031     .num_resources  = 1,
0032 };
0033 
0034 int bcma_pflash_init(struct bcma_drv_cc *cc)
0035 {
0036     struct bcma_pflash *pflash = &cc->pflash;
0037 
0038     pflash->present = true;
0039 
0040     if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS))
0041         bcma_pflash_data.width = 1;
0042     else
0043         bcma_pflash_data.width = 2;
0044 
0045     bcma_pflash_resource.start = BCMA_SOC_FLASH2;
0046     bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ;
0047 
0048     return 0;
0049 }