aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-07-22 17:51:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-07-22 17:51:16 -0400
commit41bf37117b47fc5ce2aae91f6a108e7e42e0b046 (patch)
treed5c8f24075313edfe548256dd931527f1569921e /drivers/bcma
parent415b3334a21aa67806c52d1acf4e72e14f7f402f (diff)
parent6e6e8c510a84fe3237ef02b954e58cca6a3f4b1a (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/core.c72
-rw-r--r--drivers/bcma/driver_chipcommon.c14
-rw-r--r--drivers/bcma/driver_pci.c2
-rw-r--r--drivers/bcma/sprom.c14
4 files changed, 98 insertions, 4 deletions
diff --git a/drivers/bcma/core.c b/drivers/bcma/core.c
index 1ec7d4528dd0..4a04a49cc06d 100644
--- a/drivers/bcma/core.c
+++ b/drivers/bcma/core.c
@@ -50,3 +50,75 @@ int bcma_core_enable(struct bcma_device *core, u32 flags)
50 return 0; 50 return 0;
51} 51}
52EXPORT_SYMBOL_GPL(bcma_core_enable); 52EXPORT_SYMBOL_GPL(bcma_core_enable);
53
54void bcma_core_set_clockmode(struct bcma_device *core,
55 enum bcma_clkmode clkmode)
56{
57 u16 i;
58
59 WARN_ON(core->id.id != BCMA_CORE_CHIPCOMMON &&
60 core->id.id != BCMA_CORE_PCIE &&
61 core->id.id != BCMA_CORE_80211);
62
63 switch (clkmode) {
64 case BCMA_CLKMODE_FAST:
65 bcma_set32(core, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
66 udelay(64);
67 for (i = 0; i < 1500; i++) {
68 if (bcma_read32(core, BCMA_CLKCTLST) &
69 BCMA_CLKCTLST_HAVEHT) {
70 i = 0;
71 break;
72 }
73 udelay(10);
74 }
75 if (i)
76 pr_err("HT force timeout\n");
77 break;
78 case BCMA_CLKMODE_DYNAMIC:
79 pr_warn("Dynamic clockmode not supported yet!\n");
80 break;
81 }
82}
83EXPORT_SYMBOL_GPL(bcma_core_set_clockmode);
84
85void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, bool on)
86{
87 u16 i;
88
89 WARN_ON(req & ~BCMA_CLKCTLST_EXTRESREQ);
90 WARN_ON(status & ~BCMA_CLKCTLST_EXTRESST);
91
92 if (on) {
93 bcma_set32(core, BCMA_CLKCTLST, req);
94 for (i = 0; i < 10000; i++) {
95 if ((bcma_read32(core, BCMA_CLKCTLST) & status) ==
96 status) {
97 i = 0;
98 break;
99 }
100 udelay(10);
101 }
102 if (i)
103 pr_err("PLL enable timeout\n");
104 } else {
105 pr_warn("Disabling PLL not supported yet!\n");
106 }
107}
108EXPORT_SYMBOL_GPL(bcma_core_pll_ctl);
109
110u32 bcma_core_dma_translation(struct bcma_device *core)
111{
112 switch (core->bus->hosttype) {
113 case BCMA_HOSTTYPE_PCI:
114 if (bcma_aread32(core, BCMA_IOST) & BCMA_IOST_DMA64)
115 return BCMA_DMA_TRANSLATION_DMA64_CMT;
116 else
117 return BCMA_DMA_TRANSLATION_DMA32_CMT;
118 default:
119 pr_err("DMA translation unknown for host %d\n",
120 core->bus->hosttype);
121 }
122 return BCMA_DMA_TRANSLATION_NONE;
123}
124EXPORT_SYMBOL(bcma_core_dma_translation);
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index 606102256b44..fb543024df2f 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -23,6 +23,9 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
23 23
24void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) 24void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
25{ 25{
26 u32 leddc_on = 10;
27 u32 leddc_off = 90;
28
26 if (cc->core->id.rev >= 11) 29 if (cc->core->id.rev >= 11)
27 cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT); 30 cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
28 cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP); 31 cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP);
@@ -38,6 +41,17 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
38 bcma_pmu_init(cc); 41 bcma_pmu_init(cc);
39 if (cc->capabilities & BCMA_CC_CAP_PCTL) 42 if (cc->capabilities & BCMA_CC_CAP_PCTL)
40 pr_err("Power control not implemented!\n"); 43 pr_err("Power control not implemented!\n");
44
45 if (cc->core->id.rev >= 16) {
46 if (cc->core->bus->sprom.leddc_on_time &&
47 cc->core->bus->sprom.leddc_off_time) {
48 leddc_on = cc->core->bus->sprom.leddc_on_time;
49 leddc_off = cc->core->bus->sprom.leddc_off_time;
50 }
51 bcma_cc_write32(cc, BCMA_CC_GPIOTIMER,
52 ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) |
53 (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT)));
54 }
41} 55}
42 56
43/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ 57/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index dc6f34ac96a0..745d26491291 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -172,8 +172,10 @@ static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
172 chipid_top != 0x5300) 172 chipid_top != 0x5300)
173 return false; 173 return false;
174 174
175#ifdef CONFIG_SSB_DRIVER_PCICORE
175 if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) 176 if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI)
176 return false; 177 return false;
178#endif /* CONFIG_SSB_DRIVER_PCICORE */
177 179
178#if 0 180#if 0
179 /* TODO: on BCMA we use address from EROM instead of magic formula */ 181 /* TODO: on BCMA we use address from EROM instead of magic formula */
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 8e8d5cf32e12..8b5b7856abe3 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
@@ -20,12 +20,12 @@
20 * R/W ops. 20 * R/W ops.
21 **************************************************/ 21 **************************************************/
22 22
23static void bcma_sprom_read(struct bcma_bus *bus, u16 *sprom) 23static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom)
24{ 24{
25 int i; 25 int i;
26 for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++) 26 for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++)
27 sprom[i] = bcma_read16(bus->drv_cc.core, 27 sprom[i] = bcma_read16(bus->drv_cc.core,
28 BCMA_CC_SPROM + (i * 2)); 28 offset + (i * 2));
29} 29}
30 30
31/************************************************** 31/**************************************************
@@ -112,7 +112,7 @@ static int bcma_sprom_valid(const u16 *sprom)
112 return err; 112 return err;
113 113
114 revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV; 114 revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV;
115 if (revision != 8) { 115 if (revision != 8 && revision != 9) {
116 pr_err("Unsupported SPROM revision: %d\n", revision); 116 pr_err("Unsupported SPROM revision: %d\n", revision);
117 return -ENOENT; 117 return -ENOENT;
118 } 118 }
@@ -137,6 +137,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
137 137
138int bcma_sprom_get(struct bcma_bus *bus) 138int bcma_sprom_get(struct bcma_bus *bus)
139{ 139{
140 u16 offset;
140 u16 *sprom; 141 u16 *sprom;
141 int err = 0; 142 int err = 0;
142 143
@@ -151,7 +152,12 @@ int bcma_sprom_get(struct bcma_bus *bus)
151 if (!sprom) 152 if (!sprom)
152 return -ENOMEM; 153 return -ENOMEM;
153 154
154 bcma_sprom_read(bus, sprom); 155 /* Most cards have SPROM moved by additional offset 0x30 (48 dwords).
156 * According to brcm80211 this applies to cards with PCIe rev >= 6
157 * TODO: understand this condition and use it */
158 offset = (bus->chipinfo.id == 0x4331) ? BCMA_CC_SPROM :
159 BCMA_CC_SPROM_PCIE6;
160 bcma_sprom_read(bus, offset, sprom);
155 161
156 err = bcma_sprom_valid(sprom); 162 err = bcma_sprom_valid(sprom);
157 if (err) 163 if (err)