diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2012-07-17 10:26:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-17 15:11:40 -0400 |
commit | 23cb3b2121323443834296a8ecb582b8aeb78d75 (patch) | |
tree | fbe5e71832ef74b049fc68ac5de159d8c60b2ff1 /drivers/bcma | |
parent | 124b979baeb2d7a0593be8d392f43725578478c1 (diff) |
bcma: add place for flash memory support
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/Kconfig | 10 | ||||
-rw-r--r-- | drivers/bcma/Makefile | 2 | ||||
-rw-r--r-- | drivers/bcma/bcma_private.h | 22 | ||||
-rw-r--r-- | drivers/bcma/driver_chipcommon_nflash.c | 19 | ||||
-rw-r--r-- | drivers/bcma/driver_chipcommon_sflash.c | 19 | ||||
-rw-r--r-- | drivers/bcma/driver_mips.c | 15 |
6 files changed, 84 insertions, 3 deletions
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index 9319cde8d751..06b3207adebd 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -46,6 +46,16 @@ config BCMA_DRIVER_MIPS | |||
46 | 46 | ||
47 | If unsure, say N | 47 | If unsure, say N |
48 | 48 | ||
49 | config BCMA_SFLASH | ||
50 | bool | ||
51 | depends on BCMA_DRIVER_MIPS && BROKEN | ||
52 | default y | ||
53 | |||
54 | config BCMA_NFLASH | ||
55 | bool | ||
56 | depends on BCMA_DRIVER_MIPS && BROKEN | ||
57 | default y | ||
58 | |||
49 | config BCMA_DRIVER_GMAC_CMN | 59 | config BCMA_DRIVER_GMAC_CMN |
50 | bool "BCMA Broadcom GBIT MAC COMMON core driver" | 60 | bool "BCMA Broadcom GBIT MAC COMMON core driver" |
51 | depends on BCMA | 61 | depends on BCMA |
diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile index d13803faf1d6..8ad42d41b2f2 100644 --- a/drivers/bcma/Makefile +++ b/drivers/bcma/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | bcma-y += main.o scan.o core.o sprom.o | 1 | bcma-y += main.o scan.o core.o sprom.o |
2 | bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o | 2 | bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o |
3 | bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o | ||
4 | bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o | ||
3 | bcma-y += driver_pci.o | 5 | bcma-y += driver_pci.o |
4 | bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o | 6 | bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o |
5 | bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o | 7 | bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o |
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index f6589eb7c45f..3cf9cc923cd2 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -51,6 +51,28 @@ void bcma_chipco_serial_init(struct bcma_drv_cc *cc); | |||
51 | u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc); | 51 | u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc); |
52 | u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); | 52 | u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); |
53 | 53 | ||
54 | #ifdef CONFIG_BCMA_SFLASH | ||
55 | /* driver_chipcommon_sflash.c */ | ||
56 | int bcma_sflash_init(struct bcma_drv_cc *cc); | ||
57 | #else | ||
58 | static inline int bcma_sflash_init(struct bcma_drv_cc *cc) | ||
59 | { | ||
60 | bcma_err(cc->core->bus, "Serial flash not supported\n"); | ||
61 | return 0; | ||
62 | } | ||
63 | #endif /* CONFIG_BCMA_SFLASH */ | ||
64 | |||
65 | #ifdef CONFIG_BCMA_NFLASH | ||
66 | /* driver_chipcommon_nflash.c */ | ||
67 | int bcma_nflash_init(struct bcma_drv_cc *cc); | ||
68 | #else | ||
69 | static inline int bcma_nflash_init(struct bcma_drv_cc *cc) | ||
70 | { | ||
71 | bcma_err(cc->core->bus, "NAND flash not supported\n"); | ||
72 | return 0; | ||
73 | } | ||
74 | #endif /* CONFIG_BCMA_NFLASH */ | ||
75 | |||
54 | #ifdef CONFIG_BCMA_HOST_PCI | 76 | #ifdef CONFIG_BCMA_HOST_PCI |
55 | /* host_pci.c */ | 77 | /* host_pci.c */ |
56 | extern int __init bcma_host_pci_init(void); | 78 | extern int __init bcma_host_pci_init(void); |
diff --git a/drivers/bcma/driver_chipcommon_nflash.c b/drivers/bcma/driver_chipcommon_nflash.c new file mode 100644 index 000000000000..574d62435bc2 --- /dev/null +++ b/drivers/bcma/driver_chipcommon_nflash.c | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Broadcom specific AMBA | ||
3 | * ChipCommon NAND flash interface | ||
4 | * | ||
5 | * Licensed under the GNU/GPL. See COPYING for details. | ||
6 | */ | ||
7 | |||
8 | #include <linux/bcma/bcma.h> | ||
9 | #include <linux/bcma/bcma_driver_chipcommon.h> | ||
10 | #include <linux/delay.h> | ||
11 | |||
12 | #include "bcma_private.h" | ||
13 | |||
14 | /* Initialize NAND flash access */ | ||
15 | int bcma_nflash_init(struct bcma_drv_cc *cc) | ||
16 | { | ||
17 | bcma_err(cc->core->bus, "NAND flash support is broken\n"); | ||
18 | return 0; | ||
19 | } | ||
diff --git a/drivers/bcma/driver_chipcommon_sflash.c b/drivers/bcma/driver_chipcommon_sflash.c new file mode 100644 index 000000000000..6e157a58a1d7 --- /dev/null +++ b/drivers/bcma/driver_chipcommon_sflash.c | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Broadcom specific AMBA | ||
3 | * ChipCommon serial flash interface | ||
4 | * | ||
5 | * Licensed under the GNU/GPL. See COPYING for details. | ||
6 | */ | ||
7 | |||
8 | #include <linux/bcma/bcma.h> | ||
9 | #include <linux/bcma/bcma_driver_chipcommon.h> | ||
10 | #include <linux/delay.h> | ||
11 | |||
12 | #include "bcma_private.h" | ||
13 | |||
14 | /* Initialize serial flash access */ | ||
15 | int bcma_sflash_init(struct bcma_drv_cc *cc) | ||
16 | { | ||
17 | bcma_err(cc->core->bus, "Serial flash support is broken\n"); | ||
18 | return 0; | ||
19 | } | ||
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c index ef34ed25bf00..b013b049476d 100644 --- a/drivers/bcma/driver_mips.c +++ b/drivers/bcma/driver_mips.c | |||
@@ -185,10 +185,11 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) | |||
185 | switch (bus->drv_cc.capabilities & BCMA_CC_CAP_FLASHT) { | 185 | switch (bus->drv_cc.capabilities & BCMA_CC_CAP_FLASHT) { |
186 | case BCMA_CC_FLASHT_STSER: | 186 | case BCMA_CC_FLASHT_STSER: |
187 | case BCMA_CC_FLASHT_ATSER: | 187 | case BCMA_CC_FLASHT_ATSER: |
188 | bcma_err(bus, "Serial flash not supported.\n"); | 188 | bcma_debug(bus, "Found serial flash\n"); |
189 | bcma_sflash_init(&bus->drv_cc); | ||
189 | break; | 190 | break; |
190 | case BCMA_CC_FLASHT_PARA: | 191 | case BCMA_CC_FLASHT_PARA: |
191 | bcma_info(bus, "found parallel flash.\n"); | 192 | bcma_debug(bus, "Found parallel flash\n"); |
192 | bus->drv_cc.pflash.window = 0x1c000000; | 193 | bus->drv_cc.pflash.window = 0x1c000000; |
193 | bus->drv_cc.pflash.window_size = 0x02000000; | 194 | bus->drv_cc.pflash.window_size = 0x02000000; |
194 | 195 | ||
@@ -199,7 +200,15 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) | |||
199 | bus->drv_cc.pflash.buswidth = 2; | 200 | bus->drv_cc.pflash.buswidth = 2; |
200 | break; | 201 | break; |
201 | default: | 202 | default: |
202 | bcma_err(bus, "flash not supported.\n"); | 203 | bcma_err(bus, "Flash type not supported\n"); |
204 | } | ||
205 | |||
206 | if (bus->drv_cc.core->id.rev == 38 || | ||
207 | bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { | ||
208 | if (bus->drv_cc.capabilities & BCMA_CC_CAP_NFLASH) { | ||
209 | bcma_debug(bus, "Found NAND flash\n"); | ||
210 | bcma_nflash_init(&bus->drv_cc); | ||
211 | } | ||
203 | } | 212 | } |
204 | } | 213 | } |
205 | 214 | ||