1 --- a/drivers/mtd/devices/bcm47xxsflash.c
2 +++ b/drivers/mtd/devices/bcm47xxsflash.c
4 #include <linux/platform_device.h>
5 #include <linux/bcma/bcma.h>
7 +#include "bcm47xxsflash.h"
10 MODULE_DESCRIPTION("Serial flash driver for BCMA bus");
12 @@ -13,26 +15,27 @@ static const char *probes[] = { "bcm47xx
13 static int bcm47xxsflash_read(struct mtd_info *mtd, loff_t from, size_t len,
14 size_t *retlen, u_char *buf)
16 - struct bcma_sflash *sflash = mtd->priv;
17 + struct bcm47xxsflash *b47s = mtd->priv;
19 /* Check address range */
20 if ((from + len) > mtd->size)
23 - memcpy_fromio(buf, (void __iomem *)KSEG0ADDR(sflash->window + from),
24 + memcpy_fromio(buf, (void __iomem *)KSEG0ADDR(b47s->window + from),
30 -static void bcm47xxsflash_fill_mtd(struct bcma_sflash *sflash,
31 - struct mtd_info *mtd)
32 +static void bcm47xxsflash_fill_mtd(struct bcm47xxsflash *b47s)
35 + struct mtd_info *mtd = &b47s->mtd;
38 mtd->name = "bcm47xxsflash";
39 mtd->owner = THIS_MODULE;
41 - mtd->size = sflash->size;
42 + mtd->size = b47s->size;
43 mtd->_read = bcm47xxsflash_read;
45 /* TODO: implement writing support and verify/change following code */
46 @@ -43,16 +46,23 @@ static void bcm47xxsflash_fill_mtd(struc
47 static int bcm47xxsflash_probe(struct platform_device *pdev)
49 struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
50 + struct bcm47xxsflash *b47s;
53 - sflash->mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
55 + b47s = kzalloc(sizeof(*b47s), GFP_KERNEL);
60 - bcm47xxsflash_fill_mtd(sflash, sflash->mtd);
61 + sflash->priv = b47s;
63 + b47s->window = sflash->window;
64 + b47s->blocksize = sflash->blocksize;
65 + b47s->numblocks = sflash->numblocks;
66 + b47s->size = sflash->size;
67 + bcm47xxsflash_fill_mtd(b47s);
69 - err = mtd_device_parse_register(sflash->mtd, probes, NULL, NULL, 0);
70 + err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
72 pr_err("Failed to register MTD device: %d\n", err);
74 @@ -61,7 +71,7 @@ static int bcm47xxsflash_probe(struct pl
83 @@ -69,9 +79,10 @@ out:
84 static int bcm47xxsflash_remove(struct platform_device *pdev)
86 struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
87 + struct bcm47xxsflash *b47s = sflash->priv;
89 - mtd_device_unregister(sflash->mtd);
91 + mtd_device_unregister(&b47s->mtd);
97 +++ b/drivers/mtd/devices/bcm47xxsflash.h
99 +#ifndef __BCM47XXSFLASH_H
100 +#define __BCM47XXSFLASH_H
102 +#include <linux/mtd/mtd.h>
104 +struct bcm47xxsflash {
110 + struct mtd_info mtd;
113 +#endif /* BCM47XXSFLASH */
114 --- a/include/linux/bcma/bcma_driver_chipcommon.h
115 +++ b/include/linux/bcma/bcma_driver_chipcommon.h
116 @@ -544,6 +544,7 @@ struct bcma_nflash {
117 bool boot; /* This is the flash the SoC boots from */
119 struct mtd_info *mtd;