1414
1515#include <linux/bcma/bcma.h>
1616
17+ #include <linux/mtd/physmap.h>
18+ #include <linux/platform_device.h>
1719#include <linux/serial.h>
1820#include <linux/serial_core.h>
1921#include <linux/serial_reg.h>
2022#include <linux/time.h>
2123
24+ static const char * part_probes [] = { "bcm47xxpart" , NULL };
25+
26+ static struct physmap_flash_data bcma_pflash_data = {
27+ .part_probe_types = part_probes ,
28+ };
29+
30+ static struct resource bcma_pflash_resource = {
31+ .name = "bcma_pflash" ,
32+ .flags = IORESOURCE_MEM ,
33+ };
34+
35+ struct platform_device bcma_pflash_dev = {
36+ .name = "physmap-flash" ,
37+ .dev = {
38+ .platform_data = & bcma_pflash_data ,
39+ },
40+ .resource = & bcma_pflash_resource ,
41+ .num_resources = 1 ,
42+ };
43+
2244/* The 47162a0 hangs when reading MIPS DMP registers registers */
2345static inline bool bcma_core_mips_bcm47162a0_quirk (struct bcma_device * dev )
2446{
@@ -211,6 +233,7 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
211233{
212234 struct bcma_bus * bus = mcore -> core -> bus ;
213235 struct bcma_drv_cc * cc = & bus -> drv_cc ;
236+ struct bcma_pflash * pflash = & cc -> pflash ;
214237
215238 switch (cc -> capabilities & BCMA_CC_CAP_FLASHT ) {
216239 case BCMA_CC_FLASHT_STSER :
@@ -220,15 +243,20 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
220243 break ;
221244 case BCMA_CC_FLASHT_PARA :
222245 bcma_debug (bus , "Found parallel flash\n" );
223- cc -> pflash . present = true;
224- cc -> pflash . window = BCMA_SOC_FLASH2 ;
225- cc -> pflash . window_size = BCMA_SOC_FLASH2_SZ ;
246+ pflash -> present = true;
247+ pflash -> window = BCMA_SOC_FLASH2 ;
248+ pflash -> window_size = BCMA_SOC_FLASH2_SZ ;
226249
227250 if ((bcma_read32 (cc -> core , BCMA_CC_FLASH_CFG ) &
228251 BCMA_CC_FLASH_CFG_DS ) == 0 )
229- cc -> pflash . buswidth = 1 ;
252+ pflash -> buswidth = 1 ;
230253 else
231- cc -> pflash .buswidth = 2 ;
254+ pflash -> buswidth = 2 ;
255+
256+ bcma_pflash_data .width = pflash -> buswidth ;
257+ bcma_pflash_resource .start = pflash -> window ;
258+ bcma_pflash_resource .end = pflash -> window + pflash -> window_size ;
259+
232260 break ;
233261 default :
234262 bcma_err (bus , "Flash type not supported\n" );
0 commit comments