brcm47xx: bgmac: implement unaligned addressing for DMA rings that support it
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 050-mtd_bcm47xxsflash_implement_ChipCommon_RW_ops.patch
1 commit c8a1de474f49bd928f84e7a99b6f3d23a65b5637
2 Author: Rafał Miłecki <zajec5@gmail.com>
3 Date: Sun Mar 24 21:53:24 2013 +0100
4
5 mtd: bcm47xxsflash: implement ChipCommon R/W ops
6
7 They are needed for erasing/writing. Use a magic pointers and small
8 functions to preapre code for adding other buses support in the future
9 (like SSB).
10
11 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
12 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
13
14 --- a/drivers/mtd/devices/bcm47xxsflash.c
15 +++ b/drivers/mtd/devices/bcm47xxsflash.c
16 @@ -48,6 +48,17 @@ static void bcm47xxsflash_fill_mtd(struc
17 * BCMA
18 **************************************************/
19
20 +static int bcm47xxsflash_bcma_cc_read(struct bcm47xxsflash *b47s, u16 offset)
21 +{
22 + return bcma_cc_read32(b47s->bcma_cc, offset);
23 +}
24 +
25 +static void bcm47xxsflash_bcma_cc_write(struct bcm47xxsflash *b47s, u16 offset,
26 + u32 value)
27 +{
28 + bcma_cc_write32(b47s->bcma_cc, offset, value);
29 +}
30 +
31 static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
32 {
33 struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
34 @@ -62,6 +73,8 @@ static int bcm47xxsflash_bcma_probe(stru
35 sflash->priv = b47s;
36
37 b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash);
38 + b47s->cc_read = bcm47xxsflash_bcma_cc_read;
39 + b47s->cc_write = bcm47xxsflash_bcma_cc_write;
40
41 switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) {
42 case BCMA_CC_FLASHT_STSER:
43 --- a/drivers/mtd/devices/bcm47xxsflash.h
44 +++ b/drivers/mtd/devices/bcm47xxsflash.h
45 @@ -60,6 +60,8 @@ enum bcm47xxsflash_type {
46
47 struct bcm47xxsflash {
48 struct bcma_drv_cc *bcma_cc;
49 + int (*cc_read)(struct bcm47xxsflash *b47s, u16 offset);
50 + void (*cc_write)(struct bcm47xxsflash *b47s, u16 offset, u32 value);
51
52 enum bcm47xxsflash_type type;
53