020-ssb_update.patch 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808
  1. --- a/drivers/ssb/driver_chipcommon.c
  2. +++ b/drivers/ssb/driver_chipcommon.c
  3. @@ -3,7 +3,7 @@
  4. * Broadcom ChipCommon core driver
  5. *
  6. * Copyright 2005, Broadcom Corporation
  7. - * Copyright 2006, 2007, Michael Buesch <[email protected]>
  8. + * Copyright 2006, 2007, Michael Buesch <[email protected]>
  9. *
  10. * Licensed under the GNU/GPL. See COPYING for details.
  11. */
  12. @@ -46,40 +46,66 @@ void ssb_chipco_set_clockmode(struct ssb
  13. if (!ccdev)
  14. return;
  15. bus = ccdev->bus;
  16. +
  17. + /* We support SLOW only on 6..9 */
  18. + if (ccdev->id.revision >= 10 && mode == SSB_CLKMODE_SLOW)
  19. + mode = SSB_CLKMODE_DYNAMIC;
  20. +
  21. + if (cc->capabilities & SSB_CHIPCO_CAP_PMU)
  22. + return; /* PMU controls clockmode, separated function needed */
  23. + SSB_WARN_ON(ccdev->id.revision >= 20);
  24. +
  25. /* chipcommon cores prior to rev6 don't support dynamic clock control */
  26. if (ccdev->id.revision < 6)
  27. return;
  28. - /* chipcommon cores rev10 are a whole new ball game */
  29. +
  30. + /* ChipCommon cores rev10+ need testing */
  31. if (ccdev->id.revision >= 10)
  32. return;
  33. +
  34. if (!(cc->capabilities & SSB_CHIPCO_CAP_PCTL))
  35. return;
  36. switch (mode) {
  37. - case SSB_CLKMODE_SLOW:
  38. + case SSB_CLKMODE_SLOW: /* For revs 6..9 only */
  39. tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
  40. tmp |= SSB_CHIPCO_SLOWCLKCTL_FSLOW;
  41. chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
  42. break;
  43. case SSB_CLKMODE_FAST:
  44. - ssb_pci_xtal(bus, SSB_GPIO_XTAL, 1); /* Force crystal on */
  45. - tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
  46. - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
  47. - tmp |= SSB_CHIPCO_SLOWCLKCTL_IPLL;
  48. - chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
  49. + if (ccdev->id.revision < 10) {
  50. + ssb_pci_xtal(bus, SSB_GPIO_XTAL, 1); /* Force crystal on */
  51. + tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
  52. + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
  53. + tmp |= SSB_CHIPCO_SLOWCLKCTL_IPLL;
  54. + chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
  55. + } else {
  56. + chipco_write32(cc, SSB_CHIPCO_SYSCLKCTL,
  57. + (chipco_read32(cc, SSB_CHIPCO_SYSCLKCTL) |
  58. + SSB_CHIPCO_SYSCLKCTL_FORCEHT));
  59. + /* udelay(150); TODO: not available in early init */
  60. + }
  61. break;
  62. case SSB_CLKMODE_DYNAMIC:
  63. - tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
  64. - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
  65. - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_IPLL;
  66. - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
  67. - if ((tmp & SSB_CHIPCO_SLOWCLKCTL_SRC) != SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL)
  68. - tmp |= SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
  69. - chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
  70. -
  71. - /* for dynamic control, we have to release our xtal_pu "force on" */
  72. - if (tmp & SSB_CHIPCO_SLOWCLKCTL_ENXTAL)
  73. - ssb_pci_xtal(bus, SSB_GPIO_XTAL, 0);
  74. + if (ccdev->id.revision < 10) {
  75. + tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
  76. + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
  77. + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_IPLL;
  78. + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
  79. + if ((tmp & SSB_CHIPCO_SLOWCLKCTL_SRC) !=
  80. + SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL)
  81. + tmp |= SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
  82. + chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
  83. +
  84. + /* For dynamic control, we have to release our xtal_pu
  85. + * "force on" */
  86. + if (tmp & SSB_CHIPCO_SLOWCLKCTL_ENXTAL)
  87. + ssb_pci_xtal(bus, SSB_GPIO_XTAL, 0);
  88. + } else {
  89. + chipco_write32(cc, SSB_CHIPCO_SYSCLKCTL,
  90. + (chipco_read32(cc, SSB_CHIPCO_SYSCLKCTL) &
  91. + ~SSB_CHIPCO_SYSCLKCTL_FORCEHT));
  92. + }
  93. break;
  94. default:
  95. SSB_WARN_ON(1);
  96. @@ -260,6 +286,12 @@ void ssb_chipcommon_init(struct ssb_chip
  97. if (cc->dev->id.revision >= 11)
  98. cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
  99. ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status);
  100. +
  101. + if (cc->dev->id.revision >= 20) {
  102. + chipco_write32(cc, SSB_CHIPCO_GPIOPULLUP, 0);
  103. + chipco_write32(cc, SSB_CHIPCO_GPIOPULLDOWN, 0);
  104. + }
  105. +
  106. ssb_pmu_init(cc);
  107. chipco_powercontrol_init(cc);
  108. ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
  109. --- a/drivers/ssb/driver_chipcommon_pmu.c
  110. +++ b/drivers/ssb/driver_chipcommon_pmu.c
  111. @@ -2,7 +2,7 @@
  112. * Sonics Silicon Backplane
  113. * Broadcom ChipCommon Power Management Unit driver
  114. *
  115. - * Copyright 2009, Michael Buesch <[email protected]>
  116. + * Copyright 2009, Michael Buesch <[email protected]>
  117. * Copyright 2007, Broadcom Corporation
  118. *
  119. * Licensed under the GNU/GPL. See COPYING for details.
  120. @@ -12,6 +12,9 @@
  121. #include <linux/ssb/ssb_regs.h>
  122. #include <linux/ssb/ssb_driver_chipcommon.h>
  123. #include <linux/delay.h>
  124. +#ifdef CONFIG_BCM47XX
  125. +#include <asm/mach-bcm47xx/nvram.h>
  126. +#endif
  127. #include "ssb_private.h"
  128. @@ -91,10 +94,6 @@ static void ssb_pmu0_pllinit_r0(struct s
  129. u32 pmuctl, tmp, pllctl;
  130. unsigned int i;
  131. - if ((bus->chip_id == 0x5354) && !crystalfreq) {
  132. - /* The 5354 crystal freq is 25MHz */
  133. - crystalfreq = 25000;
  134. - }
  135. if (crystalfreq)
  136. e = pmu0_plltab_find_entry(crystalfreq);
  137. if (!e)
  138. @@ -320,7 +319,11 @@ static void ssb_pmu_pll_init(struct ssb_
  139. u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */
  140. if (bus->bustype == SSB_BUSTYPE_SSB) {
  141. - /* TODO: The user may override the crystal frequency. */
  142. +#ifdef CONFIG_BCM47XX
  143. + char buf[20];
  144. + if (nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0)
  145. + crystalfreq = simple_strtoul(buf, NULL, 0);
  146. +#endif
  147. }
  148. switch (bus->chip_id) {
  149. @@ -329,7 +332,11 @@ static void ssb_pmu_pll_init(struct ssb_
  150. ssb_pmu1_pllinit_r0(cc, crystalfreq);
  151. break;
  152. case 0x4328:
  153. + ssb_pmu0_pllinit_r0(cc, crystalfreq);
  154. + break;
  155. case 0x5354:
  156. + if (crystalfreq == 0)
  157. + crystalfreq = 25000;
  158. ssb_pmu0_pllinit_r0(cc, crystalfreq);
  159. break;
  160. case 0x4322:
  161. @@ -417,12 +424,14 @@ static void ssb_pmu_resources_init(struc
  162. u32 min_msk = 0, max_msk = 0;
  163. unsigned int i;
  164. const struct pmu_res_updown_tab_entry *updown_tab = NULL;
  165. - unsigned int updown_tab_size;
  166. + unsigned int updown_tab_size = 0;
  167. const struct pmu_res_depend_tab_entry *depend_tab = NULL;
  168. - unsigned int depend_tab_size;
  169. + unsigned int depend_tab_size = 0;
  170. switch (bus->chip_id) {
  171. case 0x4312:
  172. + min_msk = 0xCBB;
  173. + break;
  174. case 0x4322:
  175. /* We keep the default settings:
  176. * min_msk = 0xCBB
  177. @@ -604,3 +613,34 @@ void ssb_pmu_set_ldo_paref(struct ssb_ch
  178. EXPORT_SYMBOL(ssb_pmu_set_ldo_voltage);
  179. EXPORT_SYMBOL(ssb_pmu_set_ldo_paref);
  180. +
  181. +u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc)
  182. +{
  183. + struct ssb_bus *bus = cc->dev->bus;
  184. +
  185. + switch (bus->chip_id) {
  186. + case 0x5354:
  187. + /* 5354 chip uses a non programmable PLL of frequency 240MHz */
  188. + return 240000000;
  189. + default:
  190. + ssb_printk(KERN_ERR PFX
  191. + "ERROR: PMU cpu clock unknown for device %04X\n",
  192. + bus->chip_id);
  193. + return 0;
  194. + }
  195. +}
  196. +
  197. +u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc)
  198. +{
  199. + struct ssb_bus *bus = cc->dev->bus;
  200. +
  201. + switch (bus->chip_id) {
  202. + case 0x5354:
  203. + return 120000000;
  204. + default:
  205. + ssb_printk(KERN_ERR PFX
  206. + "ERROR: PMU controlclock unknown for device %04X\n",
  207. + bus->chip_id);
  208. + return 0;
  209. + }
  210. +}
  211. --- a/drivers/ssb/driver_gige.c
  212. +++ b/drivers/ssb/driver_gige.c
  213. @@ -3,7 +3,7 @@
  214. * Broadcom Gigabit Ethernet core driver
  215. *
  216. * Copyright 2008, Broadcom Corporation
  217. - * Copyright 2008, Michael Buesch <[email protected]>
  218. + * Copyright 2008, Michael Buesch <[email protected]>
  219. *
  220. * Licensed under the GNU/GPL. See COPYING for details.
  221. */
  222. @@ -106,8 +106,9 @@ void gige_pcicfg_write32(struct ssb_gige
  223. gige_write32(dev, SSB_GIGE_PCICFG + offset, value);
  224. }
  225. -static int ssb_gige_pci_read_config(struct pci_bus *bus, unsigned int devfn,
  226. - int reg, int size, u32 *val)
  227. +static int __devinit ssb_gige_pci_read_config(struct pci_bus *bus,
  228. + unsigned int devfn, int reg,
  229. + int size, u32 *val)
  230. {
  231. struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
  232. unsigned long flags;
  233. @@ -136,8 +137,9 @@ static int ssb_gige_pci_read_config(stru
  234. return PCIBIOS_SUCCESSFUL;
  235. }
  236. -static int ssb_gige_pci_write_config(struct pci_bus *bus, unsigned int devfn,
  237. - int reg, int size, u32 val)
  238. +static int __devinit ssb_gige_pci_write_config(struct pci_bus *bus,
  239. + unsigned int devfn, int reg,
  240. + int size, u32 val)
  241. {
  242. struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
  243. unsigned long flags;
  244. @@ -166,7 +168,8 @@ static int ssb_gige_pci_write_config(str
  245. return PCIBIOS_SUCCESSFUL;
  246. }
  247. -static int ssb_gige_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
  248. +static int __devinit ssb_gige_probe(struct ssb_device *sdev,
  249. + const struct ssb_device_id *id)
  250. {
  251. struct ssb_gige *dev;
  252. u32 base, tmslow, tmshigh;
  253. --- a/drivers/ssb/driver_pcicore.c
  254. +++ b/drivers/ssb/driver_pcicore.c
  255. @@ -3,7 +3,7 @@
  256. * Broadcom PCI-core driver
  257. *
  258. * Copyright 2005, Broadcom Corporation
  259. - * Copyright 2006, 2007, Michael Buesch <[email protected]>
  260. + * Copyright 2006, 2007, Michael Buesch <[email protected]>
  261. *
  262. * Licensed under the GNU/GPL. See COPYING for details.
  263. */
  264. @@ -15,6 +15,11 @@
  265. #include "ssb_private.h"
  266. +static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address);
  267. +static void ssb_pcie_write(struct ssb_pcicore *pc, u32 address, u32 data);
  268. +static u16 ssb_pcie_mdio_read(struct ssb_pcicore *pc, u8 device, u8 address);
  269. +static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
  270. + u8 address, u16 data);
  271. static inline
  272. u32 pcicore_read32(struct ssb_pcicore *pc, u16 offset)
  273. @@ -69,7 +74,7 @@ static u32 get_cfgspace_addr(struct ssb_
  274. u32 tmp;
  275. /* We do only have one cardbus device behind the bridge. */
  276. - if (pc->cardbusmode && (dev >= 1))
  277. + if (pc->cardbusmode && (dev > 1))
  278. goto out;
  279. if (bus == 0) {
  280. @@ -309,7 +314,7 @@ int ssb_pcicore_pcibios_map_irq(const st
  281. return ssb_mips_irq(extpci_core->dev) + 2;
  282. }
  283. -static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
  284. +static void __devinit ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
  285. {
  286. u32 val;
  287. @@ -374,7 +379,7 @@ static void ssb_pcicore_init_hostmode(st
  288. register_pci_controller(&ssb_pcicore_controller);
  289. }
  290. -static int pcicore_is_in_hostmode(struct ssb_pcicore *pc)
  291. +static int __devinit pcicore_is_in_hostmode(struct ssb_pcicore *pc)
  292. {
  293. struct ssb_bus *bus = pc->dev->bus;
  294. u16 chipid_top;
  295. @@ -403,25 +408,137 @@ static int pcicore_is_in_hostmode(struct
  296. }
  297. #endif /* CONFIG_SSB_PCICORE_HOSTMODE */
  298. +/**************************************************
  299. + * Workarounds.
  300. + **************************************************/
  301. +
  302. +static void __devinit ssb_pcicore_fix_sprom_core_index(struct ssb_pcicore *pc)
  303. +{
  304. + u16 tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(0));
  305. + if (((tmp & 0xF000) >> 12) != pc->dev->core_index) {
  306. + tmp &= ~0xF000;
  307. + tmp |= (pc->dev->core_index << 12);
  308. + pcicore_write16(pc, SSB_PCICORE_SPROM(0), tmp);
  309. + }
  310. +}
  311. +
  312. +static u8 ssb_pcicore_polarity_workaround(struct ssb_pcicore *pc)
  313. +{
  314. + return (ssb_pcie_read(pc, 0x204) & 0x10) ? 0xC0 : 0x80;
  315. +}
  316. +
  317. +static void ssb_pcicore_serdes_workaround(struct ssb_pcicore *pc)
  318. +{
  319. + const u8 serdes_pll_device = 0x1D;
  320. + const u8 serdes_rx_device = 0x1F;
  321. + u16 tmp;
  322. +
  323. + ssb_pcie_mdio_write(pc, serdes_rx_device, 1 /* Control */,
  324. + ssb_pcicore_polarity_workaround(pc));
  325. + tmp = ssb_pcie_mdio_read(pc, serdes_pll_device, 1 /* Control */);
  326. + if (tmp & 0x4000)
  327. + ssb_pcie_mdio_write(pc, serdes_pll_device, 1, tmp & ~0x4000);
  328. +}
  329. +
  330. +static void ssb_pcicore_pci_setup_workarounds(struct ssb_pcicore *pc)
  331. +{
  332. + struct ssb_device *pdev = pc->dev;
  333. + struct ssb_bus *bus = pdev->bus;
  334. + u32 tmp;
  335. +
  336. + tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  337. + tmp |= SSB_PCICORE_SBTOPCI_PREF;
  338. + tmp |= SSB_PCICORE_SBTOPCI_BURST;
  339. + pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  340. +
  341. + if (pdev->id.revision < 5) {
  342. + tmp = ssb_read32(pdev, SSB_IMCFGLO);
  343. + tmp &= ~SSB_IMCFGLO_SERTO;
  344. + tmp |= 2;
  345. + tmp &= ~SSB_IMCFGLO_REQTO;
  346. + tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
  347. + ssb_write32(pdev, SSB_IMCFGLO, tmp);
  348. + ssb_commit_settings(bus);
  349. + } else if (pdev->id.revision >= 11) {
  350. + tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  351. + tmp |= SSB_PCICORE_SBTOPCI_MRM;
  352. + pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  353. + }
  354. +}
  355. +
  356. +static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc)
  357. +{
  358. + u32 tmp;
  359. + u8 rev = pc->dev->id.revision;
  360. +
  361. + if (rev == 0 || rev == 1) {
  362. + /* TLP Workaround register. */
  363. + tmp = ssb_pcie_read(pc, 0x4);
  364. + tmp |= 0x8;
  365. + ssb_pcie_write(pc, 0x4, tmp);
  366. + }
  367. + if (rev == 1) {
  368. + /* DLLP Link Control register. */
  369. + tmp = ssb_pcie_read(pc, 0x100);
  370. + tmp |= 0x40;
  371. + ssb_pcie_write(pc, 0x100, tmp);
  372. + }
  373. +
  374. + if (rev == 0) {
  375. + const u8 serdes_rx_device = 0x1F;
  376. +
  377. + ssb_pcie_mdio_write(pc, serdes_rx_device,
  378. + 2 /* Timer */, 0x8128);
  379. + ssb_pcie_mdio_write(pc, serdes_rx_device,
  380. + 6 /* CDR */, 0x0100);
  381. + ssb_pcie_mdio_write(pc, serdes_rx_device,
  382. + 7 /* CDR BW */, 0x1466);
  383. + } else if (rev == 3 || rev == 4 || rev == 5) {
  384. + /* TODO: DLLP Power Management Threshold */
  385. + ssb_pcicore_serdes_workaround(pc);
  386. + /* TODO: ASPM */
  387. + } else if (rev == 7) {
  388. + /* TODO: No PLL down */
  389. + }
  390. +
  391. + if (rev >= 6) {
  392. + /* Miscellaneous Configuration Fixup */
  393. + tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(5));
  394. + if (!(tmp & 0x8000))
  395. + pcicore_write16(pc, SSB_PCICORE_SPROM(5),
  396. + tmp | 0x8000);
  397. + }
  398. +}
  399. /**************************************************
  400. * Generic and Clientmode operation code.
  401. **************************************************/
  402. -static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
  403. +static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
  404. {
  405. + struct ssb_device *pdev = pc->dev;
  406. + struct ssb_bus *bus = pdev->bus;
  407. +
  408. + if (bus->bustype == SSB_BUSTYPE_PCI)
  409. + ssb_pcicore_fix_sprom_core_index(pc);
  410. +
  411. /* Disable PCI interrupts. */
  412. - ssb_write32(pc->dev, SSB_INTVEC, 0);
  413. + ssb_write32(pdev, SSB_INTVEC, 0);
  414. +
  415. + /* Additional PCIe always once-executed workarounds */
  416. + if (pc->dev->id.coreid == SSB_DEV_PCIE) {
  417. + ssb_pcicore_serdes_workaround(pc);
  418. + /* TODO: ASPM */
  419. + /* TODO: Clock Request Update */
  420. + }
  421. }
  422. -void ssb_pcicore_init(struct ssb_pcicore *pc)
  423. +void __devinit ssb_pcicore_init(struct ssb_pcicore *pc)
  424. {
  425. struct ssb_device *dev = pc->dev;
  426. - struct ssb_bus *bus;
  427. if (!dev)
  428. return;
  429. - bus = dev->bus;
  430. if (!ssb_device_is_enabled(dev))
  431. ssb_device_enable(dev, 0);
  432. @@ -446,11 +563,35 @@ static void ssb_pcie_write(struct ssb_pc
  433. pcicore_write32(pc, 0x134, data);
  434. }
  435. -static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
  436. - u8 address, u16 data)
  437. +static void ssb_pcie_mdio_set_phy(struct ssb_pcicore *pc, u8 phy)
  438. +{
  439. + const u16 mdio_control = 0x128;
  440. + const u16 mdio_data = 0x12C;
  441. + u32 v;
  442. + int i;
  443. +
  444. + v = (1 << 30); /* Start of Transaction */
  445. + v |= (1 << 28); /* Write Transaction */
  446. + v |= (1 << 17); /* Turnaround */
  447. + v |= (0x1F << 18);
  448. + v |= (phy << 4);
  449. + pcicore_write32(pc, mdio_data, v);
  450. +
  451. + udelay(10);
  452. + for (i = 0; i < 200; i++) {
  453. + v = pcicore_read32(pc, mdio_control);
  454. + if (v & 0x100 /* Trans complete */)
  455. + break;
  456. + msleep(1);
  457. + }
  458. +}
  459. +
  460. +static u16 ssb_pcie_mdio_read(struct ssb_pcicore *pc, u8 device, u8 address)
  461. {
  462. const u16 mdio_control = 0x128;
  463. const u16 mdio_data = 0x12C;
  464. + int max_retries = 10;
  465. + u16 ret = 0;
  466. u32 v;
  467. int i;
  468. @@ -458,46 +599,68 @@ static void ssb_pcie_mdio_write(struct s
  469. v |= 0x2; /* MDIO Clock Divisor */
  470. pcicore_write32(pc, mdio_control, v);
  471. + if (pc->dev->id.revision >= 10) {
  472. + max_retries = 200;
  473. + ssb_pcie_mdio_set_phy(pc, device);
  474. + }
  475. +
  476. v = (1 << 30); /* Start of Transaction */
  477. - v |= (1 << 28); /* Write Transaction */
  478. + v |= (1 << 29); /* Read Transaction */
  479. v |= (1 << 17); /* Turnaround */
  480. - v |= (u32)device << 22;
  481. + if (pc->dev->id.revision < 10)
  482. + v |= (u32)device << 22;
  483. v |= (u32)address << 18;
  484. - v |= data;
  485. pcicore_write32(pc, mdio_data, v);
  486. /* Wait for the device to complete the transaction */
  487. udelay(10);
  488. - for (i = 0; i < 10; i++) {
  489. + for (i = 0; i < max_retries; i++) {
  490. v = pcicore_read32(pc, mdio_control);
  491. - if (v & 0x100 /* Trans complete */)
  492. + if (v & 0x100 /* Trans complete */) {
  493. + udelay(10);
  494. + ret = pcicore_read32(pc, mdio_data);
  495. break;
  496. + }
  497. msleep(1);
  498. }
  499. pcicore_write32(pc, mdio_control, 0);
  500. + return ret;
  501. }
  502. -static void ssb_broadcast_value(struct ssb_device *dev,
  503. - u32 address, u32 data)
  504. +static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
  505. + u8 address, u16 data)
  506. {
  507. - /* This is used for both, PCI and ChipCommon core, so be careful. */
  508. - BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
  509. - BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
  510. + const u16 mdio_control = 0x128;
  511. + const u16 mdio_data = 0x12C;
  512. + int max_retries = 10;
  513. + u32 v;
  514. + int i;
  515. - ssb_write32(dev, SSB_PCICORE_BCAST_ADDR, address);
  516. - ssb_read32(dev, SSB_PCICORE_BCAST_ADDR); /* flush */
  517. - ssb_write32(dev, SSB_PCICORE_BCAST_DATA, data);
  518. - ssb_read32(dev, SSB_PCICORE_BCAST_DATA); /* flush */
  519. -}
  520. + v = 0x80; /* Enable Preamble Sequence */
  521. + v |= 0x2; /* MDIO Clock Divisor */
  522. + pcicore_write32(pc, mdio_control, v);
  523. -static void ssb_commit_settings(struct ssb_bus *bus)
  524. -{
  525. - struct ssb_device *dev;
  526. + if (pc->dev->id.revision >= 10) {
  527. + max_retries = 200;
  528. + ssb_pcie_mdio_set_phy(pc, device);
  529. + }
  530. - dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
  531. - if (WARN_ON(!dev))
  532. - return;
  533. - /* This forces an update of the cached registers. */
  534. - ssb_broadcast_value(dev, 0xFD8, 0);
  535. + v = (1 << 30); /* Start of Transaction */
  536. + v |= (1 << 28); /* Write Transaction */
  537. + v |= (1 << 17); /* Turnaround */
  538. + if (pc->dev->id.revision < 10)
  539. + v |= (u32)device << 22;
  540. + v |= (u32)address << 18;
  541. + v |= data;
  542. + pcicore_write32(pc, mdio_data, v);
  543. + /* Wait for the device to complete the transaction */
  544. + udelay(10);
  545. + for (i = 0; i < max_retries; i++) {
  546. + v = pcicore_read32(pc, mdio_control);
  547. + if (v & 0x100 /* Trans complete */)
  548. + break;
  549. + msleep(1);
  550. + }
  551. + pcicore_write32(pc, mdio_control, 0);
  552. }
  553. int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
  554. @@ -550,48 +713,10 @@ int ssb_pcicore_dev_irqvecs_enable(struc
  555. if (pc->setup_done)
  556. goto out;
  557. if (pdev->id.coreid == SSB_DEV_PCI) {
  558. - tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  559. - tmp |= SSB_PCICORE_SBTOPCI_PREF;
  560. - tmp |= SSB_PCICORE_SBTOPCI_BURST;
  561. - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  562. -
  563. - if (pdev->id.revision < 5) {
  564. - tmp = ssb_read32(pdev, SSB_IMCFGLO);
  565. - tmp &= ~SSB_IMCFGLO_SERTO;
  566. - tmp |= 2;
  567. - tmp &= ~SSB_IMCFGLO_REQTO;
  568. - tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
  569. - ssb_write32(pdev, SSB_IMCFGLO, tmp);
  570. - ssb_commit_settings(bus);
  571. - } else if (pdev->id.revision >= 11) {
  572. - tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  573. - tmp |= SSB_PCICORE_SBTOPCI_MRM;
  574. - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  575. - }
  576. + ssb_pcicore_pci_setup_workarounds(pc);
  577. } else {
  578. WARN_ON(pdev->id.coreid != SSB_DEV_PCIE);
  579. - //TODO: Better make defines for all these magic PCIE values.
  580. - if ((pdev->id.revision == 0) || (pdev->id.revision == 1)) {
  581. - /* TLP Workaround register. */
  582. - tmp = ssb_pcie_read(pc, 0x4);
  583. - tmp |= 0x8;
  584. - ssb_pcie_write(pc, 0x4, tmp);
  585. - }
  586. - if (pdev->id.revision == 0) {
  587. - const u8 serdes_rx_device = 0x1F;
  588. -
  589. - ssb_pcie_mdio_write(pc, serdes_rx_device,
  590. - 2 /* Timer */, 0x8128);
  591. - ssb_pcie_mdio_write(pc, serdes_rx_device,
  592. - 6 /* CDR */, 0x0100);
  593. - ssb_pcie_mdio_write(pc, serdes_rx_device,
  594. - 7 /* CDR BW */, 0x1466);
  595. - } else if (pdev->id.revision == 1) {
  596. - /* DLLP Link Control register. */
  597. - tmp = ssb_pcie_read(pc, 0x100);
  598. - tmp |= 0x40;
  599. - ssb_pcie_write(pc, 0x100, tmp);
  600. - }
  601. + ssb_pcicore_pcie_setup_workarounds(pc);
  602. }
  603. pc->setup_done = 1;
  604. out:
  605. --- a/drivers/ssb/main.c
  606. +++ b/drivers/ssb/main.c
  607. @@ -3,7 +3,7 @@
  608. * Subsystem core
  609. *
  610. * Copyright 2005, Broadcom Corporation
  611. - * Copyright 2006, 2007, Michael Buesch <[email protected]>
  612. + * Copyright 2006, 2007, Michael Buesch <[email protected]>
  613. *
  614. * Licensed under the GNU/GPL. See COPYING for details.
  615. */
  616. @@ -12,6 +12,7 @@
  617. #include <linux/delay.h>
  618. #include <linux/io.h>
  619. +#include <linux/module.h>
  620. #include <linux/ssb/ssb.h>
  621. #include <linux/ssb/ssb_regs.h>
  622. #include <linux/ssb/ssb_driver_gige.h>
  623. @@ -139,19 +140,6 @@ static void ssb_device_put(struct ssb_de
  624. put_device(dev->dev);
  625. }
  626. -static inline struct ssb_driver *ssb_driver_get(struct ssb_driver *drv)
  627. -{
  628. - if (drv)
  629. - get_driver(&drv->drv);
  630. - return drv;
  631. -}
  632. -
  633. -static inline void ssb_driver_put(struct ssb_driver *drv)
  634. -{
  635. - if (drv)
  636. - put_driver(&drv->drv);
  637. -}
  638. -
  639. static int ssb_device_resume(struct device *dev)
  640. {
  641. struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
  642. @@ -249,11 +237,9 @@ int ssb_devices_freeze(struct ssb_bus *b
  643. ssb_device_put(sdev);
  644. continue;
  645. }
  646. - sdrv = ssb_driver_get(drv_to_ssb_drv(sdev->dev->driver));
  647. - if (!sdrv || SSB_WARN_ON(!sdrv->remove)) {
  648. - ssb_device_put(sdev);
  649. + sdrv = drv_to_ssb_drv(sdev->dev->driver);
  650. + if (SSB_WARN_ON(!sdrv->remove))
  651. continue;
  652. - }
  653. sdrv->remove(sdev);
  654. ctx->device_frozen[i] = 1;
  655. }
  656. @@ -292,7 +278,6 @@ int ssb_devices_thaw(struct ssb_freeze_c
  657. dev_name(sdev->dev));
  658. result = err;
  659. }
  660. - ssb_driver_put(sdrv);
  661. ssb_device_put(sdev);
  662. }
  663. @@ -557,7 +542,7 @@ error:
  664. }
  665. /* Needs ssb_buses_lock() */
  666. -static int ssb_attach_queued_buses(void)
  667. +static int __devinit ssb_attach_queued_buses(void)
  668. {
  669. struct ssb_bus *bus, *n;
  670. int err = 0;
  671. @@ -768,9 +753,9 @@ out:
  672. return err;
  673. }
  674. -static int ssb_bus_register(struct ssb_bus *bus,
  675. - ssb_invariants_func_t get_invariants,
  676. - unsigned long baseaddr)
  677. +static int __devinit ssb_bus_register(struct ssb_bus *bus,
  678. + ssb_invariants_func_t get_invariants,
  679. + unsigned long baseaddr)
  680. {
  681. int err;
  682. @@ -851,8 +836,8 @@ err_disable_xtal:
  683. }
  684. #ifdef CONFIG_SSB_PCIHOST
  685. -int ssb_bus_pcibus_register(struct ssb_bus *bus,
  686. - struct pci_dev *host_pci)
  687. +int __devinit ssb_bus_pcibus_register(struct ssb_bus *bus,
  688. + struct pci_dev *host_pci)
  689. {
  690. int err;
  691. @@ -875,9 +860,9 @@ EXPORT_SYMBOL(ssb_bus_pcibus_register);
  692. #endif /* CONFIG_SSB_PCIHOST */
  693. #ifdef CONFIG_SSB_PCMCIAHOST
  694. -int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
  695. - struct pcmcia_device *pcmcia_dev,
  696. - unsigned long baseaddr)
  697. +int __devinit ssb_bus_pcmciabus_register(struct ssb_bus *bus,
  698. + struct pcmcia_device *pcmcia_dev,
  699. + unsigned long baseaddr)
  700. {
  701. int err;
  702. @@ -897,8 +882,9 @@ EXPORT_SYMBOL(ssb_bus_pcmciabus_register
  703. #endif /* CONFIG_SSB_PCMCIAHOST */
  704. #ifdef CONFIG_SSB_SDIOHOST
  705. -int ssb_bus_sdiobus_register(struct ssb_bus *bus, struct sdio_func *func,
  706. - unsigned int quirks)
  707. +int __devinit ssb_bus_sdiobus_register(struct ssb_bus *bus,
  708. + struct sdio_func *func,
  709. + unsigned int quirks)
  710. {
  711. int err;
  712. @@ -918,9 +904,9 @@ int ssb_bus_sdiobus_register(struct ssb_
  713. EXPORT_SYMBOL(ssb_bus_sdiobus_register);
  714. #endif /* CONFIG_SSB_PCMCIAHOST */
  715. -int ssb_bus_ssbbus_register(struct ssb_bus *bus,
  716. - unsigned long baseaddr,
  717. - ssb_invariants_func_t get_invariants)
  718. +int __devinit ssb_bus_ssbbus_register(struct ssb_bus *bus,
  719. + unsigned long baseaddr,
  720. + ssb_invariants_func_t get_invariants)
  721. {
  722. int err;
  723. @@ -1001,8 +987,8 @@ u32 ssb_calc_clock_rate(u32 plltype, u32
  724. switch (plltype) {
  725. case SSB_PLLTYPE_6: /* 100/200 or 120/240 only */
  726. if (m & SSB_CHIPCO_CLK_T6_MMASK)
  727. - return SSB_CHIPCO_CLK_T6_M0;
  728. - return SSB_CHIPCO_CLK_T6_M1;
  729. + return SSB_CHIPCO_CLK_T6_M1;
  730. + return SSB_CHIPCO_CLK_T6_M0;
  731. case SSB_PLLTYPE_1: /* 48Mhz base, 3 dividers */
  732. case SSB_PLLTYPE_3: /* 25Mhz, 2 dividers */
  733. case SSB_PLLTYPE_4: /* 48Mhz, 4 dividers */
  734. @@ -1092,6 +1078,9 @@ u32 ssb_clockspeed(struct ssb_bus *bus)
  735. u32 plltype;
  736. u32 clkctl_n, clkctl_m;
  737. + if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)
  738. + return ssb_pmu_get_controlclock(&bus->chipco);
  739. +
  740. if (ssb_extif_available(&bus->extif))
  741. ssb_extif_get_clockcontrol(&bus->extif, &plltype,
  742. &clkctl_n, &clkctl_m);
  743. @@ -1117,23 +1106,22 @@ static u32 ssb_tmslow_reject_bitmask(str
  744. {
  745. u32 rev = ssb_read32(dev, SSB_IDLOW) & SSB_IDLOW_SSBREV;
  746. - /* The REJECT bit changed position in TMSLOW between
  747. - * Backplane revisions. */
  748. + /* The REJECT bit seems to be different for Backplane rev 2.3 */
  749. switch (rev) {
  750. case SSB_IDLOW_SSBREV_22:
  751. - return SSB_TMSLOW_REJECT_22;
  752. + case SSB_IDLOW_SSBREV_24:
  753. + case SSB_IDLOW_SSBREV_26:
  754. + return SSB_TMSLOW_REJECT;
  755. case SSB_IDLOW_SSBREV_23:
  756. return SSB_TMSLOW_REJECT_23;
  757. - case SSB_IDLOW_SSBREV_24: /* TODO - find the proper REJECT bits */
  758. - case SSB_IDLOW_SSBREV_25: /* same here */
  759. - case SSB_IDLOW_SSBREV_26: /* same here */
  760. + case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */
  761. case SSB_IDLOW_SSBREV_27: /* same here */
  762. - return SSB_TMSLOW_REJECT_23; /* this is a guess */
  763. + return SSB_TMSLOW_REJECT; /* this is a guess */
  764. default:
  765. printk(KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev);
  766. WARN_ON(1);
  767. }
  768. - return (SSB_TMSLOW_REJECT_22 | SSB_TMSLOW_REJECT_23);
  769. + return (SSB_TMSLOW_REJECT | SSB_TMSLOW_REJECT_23);
  770. }
  771. int ssb_device_is_enabled(struct ssb_device *dev)
  772. @@ -1260,13 +1248,34 @@ void ssb_device_disable(struct ssb_devic
  773. }
  774. EXPORT_SYMBOL(ssb_device_disable);
  775. +/* Some chipsets need routing known for PCIe and 64-bit DMA */
  776. +static bool ssb_dma_translation_special_bit(struct ssb_device *dev)
  777. +{
  778. + u16 chip_id = dev->bus->chip_id;
  779. +
  780. + if (dev->id.coreid == SSB_DEV_80211) {
  781. + return (chip_id == 0x4322 || chip_id == 43221 ||
  782. + chip_id == 43231 || chip_id == 43222);
  783. + }
  784. +
  785. + return 0;
  786. +}
  787. +
  788. u32 ssb_dma_translation(struct ssb_device *dev)
  789. {
  790. switch (dev->bus->bustype) {
  791. case SSB_BUSTYPE_SSB:
  792. return 0;
  793. case SSB_BUSTYPE_PCI:
  794. - return SSB_PCI_DMA;
  795. + if (pci_is_pcie(dev->bus->host_pci) &&
  796. + ssb_read32(dev, SSB_TMSHIGH) & SSB_TMSHIGH_DMA64) {
  797. + return SSB_PCIE_DMA_H32;
  798. + } else {
  799. + if (ssb_dma_translation_special_bit(dev))
  800. + return SSB_PCIE_DMA_H32;
  801. + else
  802. + return SSB_PCI_DMA;
  803. + }
  804. default:
  805. __ssb_dma_not_implemented(dev);
  806. }
  807. @@ -1309,20 +1318,20 @@ EXPORT_SYMBOL(ssb_bus_may_powerdown);
  808. int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl)
  809. {
  810. - struct ssb_chipcommon *cc;
  811. int err;
  812. enum ssb_clkmode mode;
  813. err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);
  814. if (err)
  815. goto error;
  816. - cc = &bus->chipco;
  817. - mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
  818. - ssb_chipco_set_clockmode(cc, mode);
  819. #ifdef CONFIG_SSB_DEBUG
  820. bus->powered_up = 1;
  821. #endif
  822. +
  823. + mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
  824. + ssb_chipco_set_clockmode(&bus->chipco, mode);
  825. +
  826. return 0;
  827. error:
  828. ssb_printk(KERN_ERR PFX "Bus powerup failed\n");
  829. @@ -1330,6 +1339,37 @@ error:
  830. }
  831. EXPORT_SYMBOL(ssb_bus_powerup);
  832. +static void ssb_broadcast_value(struct ssb_device *dev,
  833. + u32 address, u32 data)
  834. +{
  835. +#ifdef CONFIG_SSB_DRIVER_PCICORE
  836. + /* This is used for both, PCI and ChipCommon core, so be careful. */
  837. + BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
  838. + BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
  839. +#endif
  840. +
  841. + ssb_write32(dev, SSB_CHIPCO_BCAST_ADDR, address);
  842. + ssb_read32(dev, SSB_CHIPCO_BCAST_ADDR); /* flush */
  843. + ssb_write32(dev, SSB_CHIPCO_BCAST_DATA, data);
  844. + ssb_read32(dev, SSB_CHIPCO_BCAST_DATA); /* flush */
  845. +}
  846. +
  847. +void ssb_commit_settings(struct ssb_bus *bus)
  848. +{
  849. + struct ssb_device *dev;
  850. +
  851. +#ifdef CONFIG_SSB_DRIVER_PCICORE
  852. + dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
  853. +#else
  854. + dev = bus->chipco.dev;
  855. +#endif
  856. + if (WARN_ON(!dev))
  857. + return;
  858. + /* This forces an update of the cached registers. */
  859. + ssb_broadcast_value(dev, 0xFD8, 0);
  860. +}
  861. +EXPORT_SYMBOL(ssb_commit_settings);
  862. +
  863. u32 ssb_admatch_base(u32 adm)
  864. {
  865. u32 base = 0;
  866. --- a/drivers/ssb/pci.c
  867. +++ b/drivers/ssb/pci.c
  868. @@ -1,7 +1,7 @@
  869. /*
  870. * Sonics Silicon Backplane PCI-Hostbus related functions.
  871. *
  872. - * Copyright (C) 2005-2006 Michael Buesch <[email protected]>
  873. + * Copyright (C) 2005-2006 Michael Buesch <[email protected]>
  874. * Copyright (C) 2005 Martin Langer <[email protected]>
  875. * Copyright (C) 2005 Stefano Brivio <[email protected]>
  876. * Copyright (C) 2005 Danny van Dyk <[email protected]>
  877. @@ -331,7 +331,6 @@ static void sprom_extract_r123(struct ss
  878. {
  879. int i;
  880. u16 v;
  881. - s8 gain;
  882. u16 loc[3];
  883. if (out->revision == 3) /* rev 3 moved MAC */
  884. @@ -390,20 +389,12 @@ static void sprom_extract_r123(struct ss
  885. SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
  886. /* Extract the antenna gain values. */
  887. - gain = r123_extract_antgain(out->revision, in,
  888. - SSB_SPROM1_AGAIN_BG,
  889. - SSB_SPROM1_AGAIN_BG_SHIFT);
  890. - out->antenna_gain.ghz24.a0 = gain;
  891. - out->antenna_gain.ghz24.a1 = gain;
  892. - out->antenna_gain.ghz24.a2 = gain;
  893. - out->antenna_gain.ghz24.a3 = gain;
  894. - gain = r123_extract_antgain(out->revision, in,
  895. - SSB_SPROM1_AGAIN_A,
  896. - SSB_SPROM1_AGAIN_A_SHIFT);
  897. - out->antenna_gain.ghz5.a0 = gain;
  898. - out->antenna_gain.ghz5.a1 = gain;
  899. - out->antenna_gain.ghz5.a2 = gain;
  900. - out->antenna_gain.ghz5.a3 = gain;
  901. + out->antenna_gain.a0 = r123_extract_antgain(out->revision, in,
  902. + SSB_SPROM1_AGAIN_BG,
  903. + SSB_SPROM1_AGAIN_BG_SHIFT);
  904. + out->antenna_gain.a1 = r123_extract_antgain(out->revision, in,
  905. + SSB_SPROM1_AGAIN_A,
  906. + SSB_SPROM1_AGAIN_A_SHIFT);
  907. }
  908. /* Revs 4 5 and 8 have partially shared layout */
  909. @@ -504,16 +495,14 @@ static void sprom_extract_r45(struct ssb
  910. }
  911. /* Extract the antenna gain values. */
  912. - SPEX(antenna_gain.ghz24.a0, SSB_SPROM4_AGAIN01,
  913. + SPEX(antenna_gain.a0, SSB_SPROM4_AGAIN01,
  914. SSB_SPROM4_AGAIN0, SSB_SPROM4_AGAIN0_SHIFT);
  915. - SPEX(antenna_gain.ghz24.a1, SSB_SPROM4_AGAIN01,
  916. + SPEX(antenna_gain.a1, SSB_SPROM4_AGAIN01,
  917. SSB_SPROM4_AGAIN1, SSB_SPROM4_AGAIN1_SHIFT);
  918. - SPEX(antenna_gain.ghz24.a2, SSB_SPROM4_AGAIN23,
  919. + SPEX(antenna_gain.a2, SSB_SPROM4_AGAIN23,
  920. SSB_SPROM4_AGAIN2, SSB_SPROM4_AGAIN2_SHIFT);
  921. - SPEX(antenna_gain.ghz24.a3, SSB_SPROM4_AGAIN23,
  922. + SPEX(antenna_gain.a3, SSB_SPROM4_AGAIN23,
  923. SSB_SPROM4_AGAIN3, SSB_SPROM4_AGAIN3_SHIFT);
  924. - memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
  925. - sizeof(out->antenna_gain.ghz5));
  926. sprom_extract_r458(out, in);
  927. @@ -523,7 +512,13 @@ static void sprom_extract_r45(struct ssb
  928. static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
  929. {
  930. int i;
  931. - u16 v;
  932. + u16 v, o;
  933. + u16 pwr_info_offset[] = {
  934. + SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1,
  935. + SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3
  936. + };
  937. + BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
  938. + ARRAY_SIZE(out->core_pwr_info));
  939. /* extract the MAC address */
  940. for (i = 0; i < 3; i++) {
  941. @@ -596,16 +591,69 @@ static void sprom_extract_r8(struct ssb_
  942. SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0);
  943. /* Extract the antenna gain values. */
  944. - SPEX(antenna_gain.ghz24.a0, SSB_SPROM8_AGAIN01,
  945. + SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01,
  946. SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT);
  947. - SPEX(antenna_gain.ghz24.a1, SSB_SPROM8_AGAIN01,
  948. + SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01,
  949. SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT);
  950. - SPEX(antenna_gain.ghz24.a2, SSB_SPROM8_AGAIN23,
  951. + SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23,
  952. SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT);
  953. - SPEX(antenna_gain.ghz24.a3, SSB_SPROM8_AGAIN23,
  954. + SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23,
  955. SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT);
  956. - memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
  957. - sizeof(out->antenna_gain.ghz5));
  958. +
  959. + /* Extract cores power info info */
  960. + for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) {
  961. + o = pwr_info_offset[i];
  962. + SPEX(core_pwr_info[i].itssi_2g, o + SSB_SROM8_2G_MAXP_ITSSI,
  963. + SSB_SPROM8_2G_ITSSI, SSB_SPROM8_2G_ITSSI_SHIFT);
  964. + SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SROM8_2G_MAXP_ITSSI,
  965. + SSB_SPROM8_2G_MAXP, 0);
  966. +
  967. + SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SROM8_2G_PA_0, ~0, 0);
  968. + SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SROM8_2G_PA_1, ~0, 0);
  969. + SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SROM8_2G_PA_2, ~0, 0);
  970. +
  971. + SPEX(core_pwr_info[i].itssi_5g, o + SSB_SROM8_5G_MAXP_ITSSI,
  972. + SSB_SPROM8_5G_ITSSI, SSB_SPROM8_5G_ITSSI_SHIFT);
  973. + SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SROM8_5G_MAXP_ITSSI,
  974. + SSB_SPROM8_5G_MAXP, 0);
  975. + SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM8_5GHL_MAXP,
  976. + SSB_SPROM8_5GH_MAXP, 0);
  977. + SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM8_5GHL_MAXP,
  978. + SSB_SPROM8_5GL_MAXP, SSB_SPROM8_5GL_MAXP_SHIFT);
  979. +
  980. + SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SROM8_5GL_PA_0, ~0, 0);
  981. + SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SROM8_5GL_PA_1, ~0, 0);
  982. + SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SROM8_5GL_PA_2, ~0, 0);
  983. + SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SROM8_5G_PA_0, ~0, 0);
  984. + SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SROM8_5G_PA_1, ~0, 0);
  985. + SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SROM8_5G_PA_2, ~0, 0);
  986. + SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SROM8_5GH_PA_0, ~0, 0);
  987. + SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SROM8_5GH_PA_1, ~0, 0);
  988. + SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SROM8_5GH_PA_2, ~0, 0);
  989. + }
  990. +
  991. + /* Extract FEM info */
  992. + SPEX(fem.ghz2.tssipos, SSB_SPROM8_FEM2G,
  993. + SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT);
  994. + SPEX(fem.ghz2.extpa_gain, SSB_SPROM8_FEM2G,
  995. + SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT);
  996. + SPEX(fem.ghz2.pdet_range, SSB_SPROM8_FEM2G,
  997. + SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT);
  998. + SPEX(fem.ghz2.tr_iso, SSB_SPROM8_FEM2G,
  999. + SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT);
  1000. + SPEX(fem.ghz2.antswlut, SSB_SPROM8_FEM2G,
  1001. + SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT);
  1002. +
  1003. + SPEX(fem.ghz5.tssipos, SSB_SPROM8_FEM5G,
  1004. + SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT);
  1005. + SPEX(fem.ghz5.extpa_gain, SSB_SPROM8_FEM5G,
  1006. + SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT);
  1007. + SPEX(fem.ghz5.pdet_range, SSB_SPROM8_FEM5G,
  1008. + SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT);
  1009. + SPEX(fem.ghz5.tr_iso, SSB_SPROM8_FEM5G,
  1010. + SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT);
  1011. + SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G,
  1012. + SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT);
  1013. sprom_extract_r458(out, in);
  1014. @@ -662,7 +710,6 @@ static int sprom_extract(struct ssb_bus
  1015. static int ssb_pci_sprom_get(struct ssb_bus *bus,
  1016. struct ssb_sprom *sprom)
  1017. {
  1018. - const struct ssb_sprom *fallback;
  1019. int err;
  1020. u16 *buf;
  1021. @@ -707,10 +754,17 @@ static int ssb_pci_sprom_get(struct ssb_
  1022. if (err) {
  1023. /* All CRC attempts failed.
  1024. * Maybe there is no SPROM on the device?
  1025. - * If we have a fallback, use that. */
  1026. - fallback = ssb_get_fallback_sprom();
  1027. - if (fallback) {
  1028. - memcpy(sprom, fallback, sizeof(*sprom));
  1029. + * Now we ask the arch code if there is some sprom
  1030. + * available for this device in some other storage */
  1031. + err = ssb_fill_sprom_with_fallback(bus, sprom);
  1032. + if (err) {
  1033. + ssb_printk(KERN_WARNING PFX "WARNING: Using"
  1034. + " fallback SPROM failed (err %d)\n",
  1035. + err);
  1036. + } else {
  1037. + ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
  1038. + " revision %d provided by"
  1039. + " platform.\n", sprom->revision);
  1040. err = 0;
  1041. goto out_free;
  1042. }
  1043. @@ -728,12 +782,9 @@ out_free:
  1044. static void ssb_pci_get_boardinfo(struct ssb_bus *bus,
  1045. struct ssb_boardinfo *bi)
  1046. {
  1047. - pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_VENDOR_ID,
  1048. - &bi->vendor);
  1049. - pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
  1050. - &bi->type);
  1051. - pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
  1052. - &bi->rev);
  1053. + bi->vendor = bus->host_pci->subsystem_vendor;
  1054. + bi->type = bus->host_pci->subsystem_device;
  1055. + bi->rev = bus->host_pci->revision;
  1056. }
  1057. int ssb_pci_get_invariants(struct ssb_bus *bus,
  1058. --- a/drivers/ssb/pcihost_wrapper.c
  1059. +++ b/drivers/ssb/pcihost_wrapper.c
  1060. @@ -6,7 +6,7 @@
  1061. * Copyright (c) 2005 Stefano Brivio <[email protected]>
  1062. * Copyright (c) 2005 Danny van Dyk <[email protected]>
  1063. * Copyright (c) 2005 Andreas Jaggi <[email protected]>
  1064. - * Copyright (c) 2005-2007 Michael Buesch <[email protected]>
  1065. + * Copyright (c) 2005-2007 Michael Buesch <[email protected]>
  1066. *
  1067. * Licensed under the GNU/GPL. See COPYING for details.
  1068. */
  1069. @@ -53,8 +53,8 @@ static int ssb_pcihost_resume(struct pci
  1070. # define ssb_pcihost_resume NULL
  1071. #endif /* CONFIG_PM */
  1072. -static int ssb_pcihost_probe(struct pci_dev *dev,
  1073. - const struct pci_device_id *id)
  1074. +static int __devinit ssb_pcihost_probe(struct pci_dev *dev,
  1075. + const struct pci_device_id *id)
  1076. {
  1077. struct ssb_bus *ssb;
  1078. int err = -ENOMEM;
  1079. @@ -110,7 +110,7 @@ static void ssb_pcihost_remove(struct pc
  1080. pci_set_drvdata(dev, NULL);
  1081. }
  1082. -int ssb_pcihost_register(struct pci_driver *driver)
  1083. +int __devinit ssb_pcihost_register(struct pci_driver *driver)
  1084. {
  1085. driver->probe = ssb_pcihost_probe;
  1086. driver->remove = ssb_pcihost_remove;
  1087. --- a/drivers/ssb/scan.c
  1088. +++ b/drivers/ssb/scan.c
  1089. @@ -2,7 +2,7 @@
  1090. * Sonics Silicon Backplane
  1091. * Bus scanning
  1092. *
  1093. - * Copyright (C) 2005-2007 Michael Buesch <[email protected]>
  1094. + * Copyright (C) 2005-2007 Michael Buesch <[email protected]>
  1095. * Copyright (C) 2005 Martin Langer <[email protected]>
  1096. * Copyright (C) 2005 Stefano Brivio <[email protected]>
  1097. * Copyright (C) 2005 Danny van Dyk <[email protected]>
  1098. @@ -258,7 +258,10 @@ static int we_support_multiple_80211_cor
  1099. #ifdef CONFIG_SSB_PCIHOST
  1100. if (bus->bustype == SSB_BUSTYPE_PCI) {
  1101. if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
  1102. - bus->host_pci->device == 0x4324)
  1103. + ((bus->host_pci->device == 0x4313) ||
  1104. + (bus->host_pci->device == 0x431A) ||
  1105. + (bus->host_pci->device == 0x4321) ||
  1106. + (bus->host_pci->device == 0x4324)))
  1107. return 1;
  1108. }
  1109. #endif /* CONFIG_SSB_PCIHOST */
  1110. @@ -307,8 +310,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1111. } else {
  1112. if (bus->bustype == SSB_BUSTYPE_PCI) {
  1113. bus->chip_id = pcidev_to_chipid(bus->host_pci);
  1114. - pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
  1115. - &bus->chip_rev);
  1116. + bus->chip_rev = bus->host_pci->revision;
  1117. bus->chip_package = 0;
  1118. } else {
  1119. bus->chip_id = 0x4710;
  1120. @@ -316,6 +318,9 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1121. bus->chip_package = 0;
  1122. }
  1123. }
  1124. + ssb_printk(KERN_INFO PFX "Found chip with id 0x%04X, rev 0x%02X and "
  1125. + "package 0x%02X\n", bus->chip_id, bus->chip_rev,
  1126. + bus->chip_package);
  1127. if (!bus->nr_devices)
  1128. bus->nr_devices = chipid_to_nrcores(bus->chip_id);
  1129. if (bus->nr_devices > ARRAY_SIZE(bus->devices)) {
  1130. --- a/drivers/ssb/sprom.c
  1131. +++ b/drivers/ssb/sprom.c
  1132. @@ -2,7 +2,7 @@
  1133. * Sonics Silicon Backplane
  1134. * Common SPROM support routines
  1135. *
  1136. - * Copyright (C) 2005-2008 Michael Buesch <[email protected]>
  1137. + * Copyright (C) 2005-2008 Michael Buesch <[email protected]>
  1138. * Copyright (C) 2005 Martin Langer <[email protected]>
  1139. * Copyright (C) 2005 Stefano Brivio <[email protected]>
  1140. * Copyright (C) 2005 Danny van Dyk <[email protected]>
  1141. @@ -17,7 +17,7 @@
  1142. #include <linux/slab.h>
  1143. -static const struct ssb_sprom *fallback_sprom;
  1144. +static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out);
  1145. static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
  1146. @@ -145,36 +145,43 @@ out:
  1147. }
  1148. /**
  1149. - * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
  1150. + * ssb_arch_register_fallback_sprom - Registers a method providing a
  1151. + * fallback SPROM if no SPROM is found.
  1152. *
  1153. - * @sprom: The SPROM data structure to register.
  1154. + * @sprom_callback: The callback function.
  1155. *
  1156. - * With this function the architecture implementation may register a fallback
  1157. - * SPROM data structure. The fallback is only used for PCI based SSB devices,
  1158. - * where no valid SPROM can be found in the shadow registers.
  1159. + * With this function the architecture implementation may register a
  1160. + * callback handler which fills the SPROM data structure. The fallback is
  1161. + * only used for PCI based SSB devices, where no valid SPROM can be found
  1162. + * in the shadow registers.
  1163. + *
  1164. + * This function is useful for weird architectures that have a half-assed
  1165. + * SSB device hardwired to their PCI bus.
  1166. + *
  1167. + * Note that it does only work with PCI attached SSB devices. PCMCIA
  1168. + * devices currently don't use this fallback.
  1169. + * Architectures must provide the SPROM for native SSB devices anyway, so
  1170. + * the fallback also isn't used for native devices.
  1171. *
  1172. - * This function is useful for weird architectures that have a half-assed SSB device
  1173. - * hardwired to their PCI bus.
  1174. - *
  1175. - * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
  1176. - * don't use this fallback.
  1177. - * Architectures must provide the SPROM for native SSB devices anyway,
  1178. - * so the fallback also isn't used for native devices.
  1179. - *
  1180. - * This function is available for architecture code, only. So it is not exported.
  1181. + * This function is available for architecture code, only. So it is not
  1182. + * exported.
  1183. */
  1184. -int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
  1185. +int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus,
  1186. + struct ssb_sprom *out))
  1187. {
  1188. - if (fallback_sprom)
  1189. + if (get_fallback_sprom)
  1190. return -EEXIST;
  1191. - fallback_sprom = sprom;
  1192. + get_fallback_sprom = sprom_callback;
  1193. return 0;
  1194. }
  1195. -const struct ssb_sprom *ssb_get_fallback_sprom(void)
  1196. +int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
  1197. {
  1198. - return fallback_sprom;
  1199. + if (!get_fallback_sprom)
  1200. + return -ENOENT;
  1201. +
  1202. + return get_fallback_sprom(bus, out);
  1203. }
  1204. /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
  1205. --- a/drivers/ssb/ssb_private.h
  1206. +++ b/drivers/ssb/ssb_private.h
  1207. @@ -171,7 +171,8 @@ ssize_t ssb_attr_sprom_store(struct ssb_
  1208. const char *buf, size_t count,
  1209. int (*sprom_check_crc)(const u16 *sprom, size_t size),
  1210. int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
  1211. -extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
  1212. +extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
  1213. + struct ssb_sprom *out);
  1214. /* core.c */
  1215. @@ -206,4 +207,8 @@ static inline void b43_pci_ssb_bridge_ex
  1216. }
  1217. #endif /* CONFIG_SSB_B43_PCI_BRIDGE */
  1218. +/* driver_chipcommon_pmu.c */
  1219. +extern u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc);
  1220. +extern u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc);
  1221. +
  1222. #endif /* LINUX_SSB_PRIVATE_H_ */
  1223. --- a/include/linux/ssb/ssb.h
  1224. +++ b/include/linux/ssb/ssb.h
  1225. @@ -16,6 +16,12 @@ struct pcmcia_device;
  1226. struct ssb_bus;
  1227. struct ssb_driver;
  1228. +struct ssb_sprom_core_pwr_info {
  1229. + u8 itssi_2g, itssi_5g;
  1230. + u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh;
  1231. + u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4];
  1232. +};
  1233. +
  1234. struct ssb_sprom {
  1235. u8 revision;
  1236. u8 il0mac[6]; /* MAC address for 802.11b/g */
  1237. @@ -25,8 +31,13 @@ struct ssb_sprom {
  1238. u8 et1phyaddr; /* MII address for enet1 */
  1239. u8 et0mdcport; /* MDIO for enet0 */
  1240. u8 et1mdcport; /* MDIO for enet1 */
  1241. - u8 board_rev; /* Board revision number from SPROM. */
  1242. + u16 board_rev; /* Board revision number from SPROM. */
  1243. + u16 board_num; /* Board number from SPROM. */
  1244. + u16 board_type; /* Board type from SPROM. */
  1245. u8 country_code; /* Country Code */
  1246. + char alpha2[2]; /* Country Code as two chars like EU or US */
  1247. + u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */
  1248. + u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */
  1249. u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
  1250. u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
  1251. u16 pa0b0;
  1252. @@ -45,10 +56,10 @@ struct ssb_sprom {
  1253. u8 gpio1; /* GPIO pin 1 */
  1254. u8 gpio2; /* GPIO pin 2 */
  1255. u8 gpio3; /* GPIO pin 3 */
  1256. - u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
  1257. - u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
  1258. - u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
  1259. - u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
  1260. + u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
  1261. + u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
  1262. + u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
  1263. + u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
  1264. u8 itssi_a; /* Idle TSSI Target for A-PHY */
  1265. u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
  1266. u8 tri2g; /* 2.4GHz TX isolation */
  1267. @@ -59,8 +70,8 @@ struct ssb_sprom {
  1268. u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
  1269. u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
  1270. u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
  1271. - u8 rxpo2g; /* 2GHz RX power offset */
  1272. - u8 rxpo5g; /* 5GHz RX power offset */
  1273. + s8 rxpo2g; /* 2GHz RX power offset */
  1274. + s8 rxpo5g; /* 5GHz RX power offset */
  1275. u8 rssisav2g; /* 2GHz RSSI params */
  1276. u8 rssismc2g;
  1277. u8 rssismf2g;
  1278. @@ -80,26 +91,104 @@ struct ssb_sprom {
  1279. u16 boardflags2_hi; /* Board flags (bits 48-63) */
  1280. /* TODO store board flags in a single u64 */
  1281. + struct ssb_sprom_core_pwr_info core_pwr_info[4];
  1282. +
  1283. /* Antenna gain values for up to 4 antennas
  1284. * on each band. Values in dBm/4 (Q5.2). Negative gain means the
  1285. * loss in the connectors is bigger than the gain. */
  1286. struct {
  1287. - struct {
  1288. - s8 a0, a1, a2, a3;
  1289. - } ghz24; /* 2.4GHz band */
  1290. - struct {
  1291. - s8 a0, a1, a2, a3;
  1292. - } ghz5; /* 5GHz band */
  1293. + s8 a0, a1, a2, a3;
  1294. } antenna_gain;
  1295. - /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
  1296. + struct {
  1297. + struct {
  1298. + u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
  1299. + } ghz2;
  1300. + struct {
  1301. + u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut;
  1302. + } ghz5;
  1303. + } fem;
  1304. +
  1305. + u16 mcs2gpo[8];
  1306. + u16 mcs5gpo[8];
  1307. + u16 mcs5glpo[8];
  1308. + u16 mcs5ghpo[8];
  1309. + u8 opo;
  1310. +
  1311. + u8 rxgainerr2ga[3];
  1312. + u8 rxgainerr5gla[3];
  1313. + u8 rxgainerr5gma[3];
  1314. + u8 rxgainerr5gha[3];
  1315. + u8 rxgainerr5gua[3];
  1316. +
  1317. + u8 noiselvl2ga[3];
  1318. + u8 noiselvl5gla[3];
  1319. + u8 noiselvl5gma[3];
  1320. + u8 noiselvl5gha[3];
  1321. + u8 noiselvl5gua[3];
  1322. +
  1323. + u8 regrev;
  1324. + u8 txchain;
  1325. + u8 rxchain;
  1326. + u8 antswitch;
  1327. + u16 cddpo;
  1328. + u16 stbcpo;
  1329. + u16 bw40po;
  1330. + u16 bwduppo;
  1331. +
  1332. + u8 tempthresh;
  1333. + u8 tempoffset;
  1334. + u16 rawtempsense;
  1335. + u8 measpower;
  1336. + u8 tempsense_slope;
  1337. + u8 tempcorrx;
  1338. + u8 tempsense_option;
  1339. + u8 freqoffset_corr;
  1340. + u8 iqcal_swp_dis;
  1341. + u8 hw_iqcal_en;
  1342. + u8 elna2g;
  1343. + u8 elna5g;
  1344. + u8 phycal_tempdelta;
  1345. + u8 temps_period;
  1346. + u8 temps_hysteresis;
  1347. + u8 measpower1;
  1348. + u8 measpower2;
  1349. + u8 pcieingress_war;
  1350. +
  1351. + /* power per rate from sromrev 9 */
  1352. + u16 cckbw202gpo;
  1353. + u16 cckbw20ul2gpo;
  1354. + u32 legofdmbw202gpo;
  1355. + u32 legofdmbw20ul2gpo;
  1356. + u32 legofdmbw205glpo;
  1357. + u32 legofdmbw20ul5glpo;
  1358. + u32 legofdmbw205gmpo;
  1359. + u32 legofdmbw20ul5gmpo;
  1360. + u32 legofdmbw205ghpo;
  1361. + u32 legofdmbw20ul5ghpo;
  1362. + u32 mcsbw202gpo;
  1363. + u32 mcsbw20ul2gpo;
  1364. + u32 mcsbw402gpo;
  1365. + u32 mcsbw205glpo;
  1366. + u32 mcsbw20ul5glpo;
  1367. + u32 mcsbw405glpo;
  1368. + u32 mcsbw205gmpo;
  1369. + u32 mcsbw20ul5gmpo;
  1370. + u32 mcsbw405gmpo;
  1371. + u32 mcsbw205ghpo;
  1372. + u32 mcsbw20ul5ghpo;
  1373. + u32 mcsbw405ghpo;
  1374. + u16 mcs32po;
  1375. + u16 legofdm40duppo;
  1376. + u8 sar2g;
  1377. + u8 sar5g;
  1378. };
  1379. /* Information about the PCB the circuitry is soldered on. */
  1380. struct ssb_boardinfo {
  1381. u16 vendor;
  1382. u16 type;
  1383. - u16 rev;
  1384. + u8 rev;
  1385. };
  1386. @@ -229,10 +318,9 @@ struct ssb_driver {
  1387. #define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv)
  1388. extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner);
  1389. -static inline int ssb_driver_register(struct ssb_driver *drv)
  1390. -{
  1391. - return __ssb_driver_register(drv, THIS_MODULE);
  1392. -}
  1393. +#define ssb_driver_register(drv) \
  1394. + __ssb_driver_register(drv, THIS_MODULE)
  1395. +
  1396. extern void ssb_driver_unregister(struct ssb_driver *drv);
  1397. @@ -308,7 +396,7 @@ struct ssb_bus {
  1398. /* ID information about the Chip. */
  1399. u16 chip_id;
  1400. - u16 chip_rev;
  1401. + u8 chip_rev;
  1402. u16 sprom_offset;
  1403. u16 sprom_size; /* number of words in sprom */
  1404. u8 chip_package;
  1405. @@ -404,7 +492,9 @@ extern bool ssb_is_sprom_available(struc
  1406. /* Set a fallback SPROM.
  1407. * See kdoc at the function definition for complete documentation. */
  1408. -extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
  1409. +extern int ssb_arch_register_fallback_sprom(
  1410. + int (*sprom_callback)(struct ssb_bus *bus,
  1411. + struct ssb_sprom *out));
  1412. /* Suspend a SSB bus.
  1413. * Call this from the parent bus suspend routine. */
  1414. @@ -518,6 +608,7 @@ extern int ssb_bus_may_powerdown(struct
  1415. * Otherwise static always-on powercontrol will be used. */
  1416. extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
  1417. +extern void ssb_commit_settings(struct ssb_bus *bus);
  1418. /* Various helper functions */
  1419. extern u32 ssb_admatch_base(u32 adm);
  1420. --- a/include/linux/ssb/ssb_driver_chipcommon.h
  1421. +++ b/include/linux/ssb/ssb_driver_chipcommon.h
  1422. @@ -8,7 +8,7 @@
  1423. * gpio interface, extbus, and support for serial and parallel flashes.
  1424. *
  1425. * Copyright 2005, Broadcom Corporation
  1426. - * Copyright 2006, Michael Buesch <[email protected]>
  1427. + * Copyright 2006, Michael Buesch <[email protected]>
  1428. *
  1429. * Licensed under the GPL version 2. See COPYING for details.
  1430. */
  1431. @@ -123,6 +123,8 @@
  1432. #define SSB_CHIPCO_FLASHDATA 0x0048
  1433. #define SSB_CHIPCO_BCAST_ADDR 0x0050
  1434. #define SSB_CHIPCO_BCAST_DATA 0x0054
  1435. +#define SSB_CHIPCO_GPIOPULLUP 0x0058 /* Rev >= 20 only */
  1436. +#define SSB_CHIPCO_GPIOPULLDOWN 0x005C /* Rev >= 20 only */
  1437. #define SSB_CHIPCO_GPIOIN 0x0060
  1438. #define SSB_CHIPCO_GPIOOUT 0x0064
  1439. #define SSB_CHIPCO_GPIOOUTEN 0x0068
  1440. @@ -131,6 +133,9 @@
  1441. #define SSB_CHIPCO_GPIOIRQ 0x0074
  1442. #define SSB_CHIPCO_WATCHDOG 0x0080
  1443. #define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
  1444. +#define SSB_CHIPCO_GPIOTIMER_OFFTIME 0x0000FFFF
  1445. +#define SSB_CHIPCO_GPIOTIMER_OFFTIME_SHIFT 0
  1446. +#define SSB_CHIPCO_GPIOTIMER_ONTIME 0xFFFF0000
  1447. #define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16
  1448. #define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
  1449. #define SSB_CHIPCO_CLOCK_N 0x0090
  1450. @@ -189,8 +194,10 @@
  1451. #define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
  1452. #define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
  1453. #define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
  1454. -#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */
  1455. -#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */
  1456. +#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
  1457. +#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00020000 /* HT available */
  1458. +#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
  1459. +#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
  1460. #define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
  1461. #define SSB_CHIPCO_UART0_DATA 0x0300
  1462. #define SSB_CHIPCO_UART0_IMR 0x0304
  1463. --- a/include/linux/ssb/ssb_regs.h
  1464. +++ b/include/linux/ssb/ssb_regs.h
  1465. @@ -97,7 +97,7 @@
  1466. #define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */
  1467. #define SSB_TMSLOW 0x0F98 /* SB Target State Low */
  1468. #define SSB_TMSLOW_RESET 0x00000001 /* Reset */
  1469. -#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */
  1470. +#define SSB_TMSLOW_REJECT 0x00000002 /* Reject (Standard Backplane) */
  1471. #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */
  1472. #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */
  1473. #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
  1474. @@ -432,6 +432,56 @@
  1475. #define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
  1476. #define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
  1477. #define SSB_SPROM8_RXPO5G_SHIFT 8
  1478. +#define SSB_SPROM8_FEM2G 0x00AE
  1479. +#define SSB_SPROM8_FEM5G 0x00B0
  1480. +#define SSB_SROM8_FEM_TSSIPOS 0x0001
  1481. +#define SSB_SROM8_FEM_TSSIPOS_SHIFT 0
  1482. +#define SSB_SROM8_FEM_EXTPA_GAIN 0x0006
  1483. +#define SSB_SROM8_FEM_EXTPA_GAIN_SHIFT 1
  1484. +#define SSB_SROM8_FEM_PDET_RANGE 0x00F8
  1485. +#define SSB_SROM8_FEM_PDET_RANGE_SHIFT 3
  1486. +#define SSB_SROM8_FEM_TR_ISO 0x0700
  1487. +#define SSB_SROM8_FEM_TR_ISO_SHIFT 8
  1488. +#define SSB_SROM8_FEM_ANTSWLUT 0xF800
  1489. +#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
  1490. +#define SSB_SPROM8_THERMAL 0x00B2
  1491. +#define SSB_SPROM8_MPWR_RAWTS 0x00B4
  1492. +#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
  1493. +#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
  1494. +#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
  1495. +
  1496. +/* There are 4 blocks with power info sharing the same layout */
  1497. +#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
  1498. +#define SSB_SROM8_PWR_INFO_CORE1 0x00E0
  1499. +#define SSB_SROM8_PWR_INFO_CORE2 0x0100
  1500. +#define SSB_SROM8_PWR_INFO_CORE3 0x0120
  1501. +
  1502. +#define SSB_SROM8_2G_MAXP_ITSSI 0x00
  1503. +#define SSB_SPROM8_2G_MAXP 0x00FF
  1504. +#define SSB_SPROM8_2G_ITSSI 0xFF00
  1505. +#define SSB_SPROM8_2G_ITSSI_SHIFT 8
  1506. +#define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */
  1507. +#define SSB_SROM8_2G_PA_1 0x04
  1508. +#define SSB_SROM8_2G_PA_2 0x06
  1509. +#define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */
  1510. +#define SSB_SPROM8_5G_MAXP 0x00FF
  1511. +#define SSB_SPROM8_5G_ITSSI 0xFF00
  1512. +#define SSB_SPROM8_5G_ITSSI_SHIFT 8
  1513. +#define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */
  1514. +#define SSB_SPROM8_5GH_MAXP 0x00FF
  1515. +#define SSB_SPROM8_5GL_MAXP 0xFF00
  1516. +#define SSB_SPROM8_5GL_MAXP_SHIFT 8
  1517. +#define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */
  1518. +#define SSB_SROM8_5G_PA_1 0x0E
  1519. +#define SSB_SROM8_5G_PA_2 0x10
  1520. +#define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */
  1521. +#define SSB_SROM8_5GL_PA_1 0x14
  1522. +#define SSB_SROM8_5GL_PA_2 0x16
  1523. +#define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */
  1524. +#define SSB_SROM8_5GH_PA_1 0x1A
  1525. +#define SSB_SROM8_5GH_PA_2 0x1C
  1526. +
  1527. +/* TODO: Make it deprecated */
  1528. #define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
  1529. #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
  1530. #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
  1531. @@ -456,12 +506,53 @@
  1532. #define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
  1533. #define SSB_SPROM8_PA1HIB1 0x00DA
  1534. #define SSB_SPROM8_PA1HIB2 0x00DC
  1535. +
  1536. #define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
  1537. #define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
  1538. #define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
  1539. #define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
  1540. #define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
  1541. +/* Values for boardflags_lo read from SPROM */
  1542. +#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */
  1543. +#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */
  1544. +#define SSB_BFL_AIRLINEMODE 0x0004 /* implements GPIO 13 radio disable indication */
  1545. +#define SSB_BFL_RSSI 0x0008 /* software calculates nrssi slope. */
  1546. +#define SSB_BFL_ENETSPI 0x0010 /* has ephy roboswitch spi */
  1547. +#define SSB_BFL_XTAL_NOSLOW 0x0020 /* no slow clock available */
  1548. +#define SSB_BFL_CCKHIPWR 0x0040 /* can do high power CCK transmission */
  1549. +#define SSB_BFL_ENETADM 0x0080 /* has ADMtek switch */
  1550. +#define SSB_BFL_ENETVLAN 0x0100 /* can do vlan */
  1551. +#define SSB_BFL_AFTERBURNER 0x0200 /* supports Afterburner mode */
  1552. +#define SSB_BFL_NOPCI 0x0400 /* board leaves PCI floating */
  1553. +#define SSB_BFL_FEM 0x0800 /* supports the Front End Module */
  1554. +#define SSB_BFL_EXTLNA 0x1000 /* has an external LNA */
  1555. +#define SSB_BFL_HGPA 0x2000 /* had high gain PA */
  1556. +#define SSB_BFL_BTCMOD 0x4000 /* BFL_BTCOEXIST is given in alternate GPIOs */
  1557. +#define SSB_BFL_ALTIQ 0x8000 /* alternate I/Q settings */
  1558. +
  1559. +/* Values for boardflags_hi read from SPROM */
  1560. +#define SSB_BFH_NOPA 0x0001 /* has no PA */
  1561. +#define SSB_BFH_RSSIINV 0x0002 /* RSSI uses positive slope (not TSSI) */
  1562. +#define SSB_BFH_PAREF 0x0004 /* uses the PARef LDO */
  1563. +#define SSB_BFH_3TSWITCH 0x0008 /* uses a triple throw switch shared with bluetooth */
  1564. +#define SSB_BFH_PHASESHIFT 0x0010 /* can support phase shifter */
  1565. +#define SSB_BFH_BUCKBOOST 0x0020 /* has buck/booster */
  1566. +#define SSB_BFH_FEM_BT 0x0040 /* has FEM and switch to share antenna with bluetooth */
  1567. +
  1568. +/* Values for boardflags2_lo read from SPROM */
  1569. +#define SSB_BFL2_RXBB_INT_REG_DIS 0x0001 /* external RX BB regulator present */
  1570. +#define SSB_BFL2_APLL_WAR 0x0002 /* alternative A-band PLL settings implemented */
  1571. +#define SSB_BFL2_TXPWRCTRL_EN 0x0004 /* permits enabling TX Power Control */
  1572. +#define SSB_BFL2_2X4_DIV 0x0008 /* 2x4 diversity switch */
  1573. +#define SSB_BFL2_5G_PWRGAIN 0x0010 /* supports 5G band power gain */
  1574. +#define SSB_BFL2_PCIEWAR_OVR 0x0020 /* overrides ASPM and Clkreq settings */
  1575. +#define SSB_BFL2_CAESERS_BRD 0x0040 /* is Caesers board (unused) */
  1576. +#define SSB_BFL2_BTC3WIRE 0x0080 /* used 3-wire bluetooth coexist */
  1577. +#define SSB_BFL2_SKWRKFEM_BRD 0x0100 /* 4321mcm93 uses Skyworks FEM */
  1578. +#define SSB_BFL2_SPUR_WAR 0x0200 /* has a workaround for clock-harmonic spurs */
  1579. +#define SSB_BFL2_GPLL_WAR 0x0400 /* altenative G-band PLL settings implemented */
  1580. +
  1581. /* Values for SSB_SPROM1_BINF_CCODE */
  1582. enum {
  1583. SSB_SPROM1CCODE_WORLD = 0,
  1584. --- a/drivers/ssb/b43_pci_bridge.c
  1585. +++ b/drivers/ssb/b43_pci_bridge.c
  1586. @@ -5,12 +5,13 @@
  1587. * because of its small size we include it in the SSB core
  1588. * instead of creating a standalone module.
  1589. *
  1590. - * Copyright 2007 Michael Buesch <[email protected]>
  1591. + * Copyright 2007 Michael Buesch <[email protected]>
  1592. *
  1593. * Licensed under the GNU/GPL. See COPYING for details.
  1594. */
  1595. #include <linux/pci.h>
  1596. +#include <linux/module.h>
  1597. #include <linux/ssb/ssb.h>
  1598. #include "ssb_private.h"
  1599. --- a/drivers/ssb/driver_extif.c
  1600. +++ b/drivers/ssb/driver_extif.c
  1601. @@ -3,7 +3,7 @@
  1602. * Broadcom EXTIF core driver
  1603. *
  1604. * Copyright 2005, Broadcom Corporation
  1605. - * Copyright 2006, 2007, Michael Buesch <[email protected]>
  1606. + * Copyright 2006, 2007, Michael Buesch <[email protected]>
  1607. * Copyright 2006, 2007, Felix Fietkau <[email protected]>
  1608. * Copyright 2007, Aurelien Jarno <[email protected]>
  1609. *
  1610. --- a/drivers/ssb/driver_mipscore.c
  1611. +++ b/drivers/ssb/driver_mipscore.c
  1612. @@ -3,7 +3,7 @@
  1613. * Broadcom MIPS core driver
  1614. *
  1615. * Copyright 2005, Broadcom Corporation
  1616. - * Copyright 2006, 2007, Michael Buesch <[email protected]>
  1617. + * Copyright 2006, 2007, Michael Buesch <[email protected]>
  1618. *
  1619. * Licensed under the GNU/GPL. See COPYING for details.
  1620. */
  1621. @@ -208,6 +208,9 @@ u32 ssb_cpu_clock(struct ssb_mipscore *m
  1622. struct ssb_bus *bus = mcore->dev->bus;
  1623. u32 pll_type, n, m, rate = 0;
  1624. + if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)
  1625. + return ssb_pmu_get_cpu_clock(&bus->chipco);
  1626. +
  1627. if (bus->extif.dev) {
  1628. ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m);
  1629. } else if (bus->chipco.dev) {
  1630. --- a/drivers/ssb/embedded.c
  1631. +++ b/drivers/ssb/embedded.c
  1632. @@ -3,7 +3,7 @@
  1633. * Embedded systems support code
  1634. *
  1635. * Copyright 2005-2008, Broadcom Corporation
  1636. - * Copyright 2006-2008, Michael Buesch <[email protected]>
  1637. + * Copyright 2006-2008, Michael Buesch <[email protected]>
  1638. *
  1639. * Licensed under the GNU/GPL. See COPYING for details.
  1640. */
  1641. --- a/drivers/ssb/pcmcia.c
  1642. +++ b/drivers/ssb/pcmcia.c
  1643. @@ -3,7 +3,7 @@
  1644. * PCMCIA-Hostbus related functions
  1645. *
  1646. * Copyright 2006 Johannes Berg <[email protected]>
  1647. - * Copyright 2007-2008 Michael Buesch <[email protected]>
  1648. + * Copyright 2007-2008 Michael Buesch <[email protected]>
  1649. *
  1650. * Licensed under the GNU/GPL. See COPYING for details.
  1651. */
  1652. @@ -676,14 +676,10 @@ static int ssb_pcmcia_do_get_invariants(
  1653. case SSB_PCMCIA_CIS_ANTGAIN:
  1654. GOTO_ERROR_ON(tuple->TupleDataLen != 2,
  1655. "antg tpl size");
  1656. - sprom->antenna_gain.ghz24.a0 = tuple->TupleData[1];
  1657. - sprom->antenna_gain.ghz24.a1 = tuple->TupleData[1];
  1658. - sprom->antenna_gain.ghz24.a2 = tuple->TupleData[1];
  1659. - sprom->antenna_gain.ghz24.a3 = tuple->TupleData[1];
  1660. - sprom->antenna_gain.ghz5.a0 = tuple->TupleData[1];
  1661. - sprom->antenna_gain.ghz5.a1 = tuple->TupleData[1];
  1662. - sprom->antenna_gain.ghz5.a2 = tuple->TupleData[1];
  1663. - sprom->antenna_gain.ghz5.a3 = tuple->TupleData[1];
  1664. + sprom->antenna_gain.a0 = tuple->TupleData[1];
  1665. + sprom->antenna_gain.a1 = tuple->TupleData[1];
  1666. + sprom->antenna_gain.a2 = tuple->TupleData[1];
  1667. + sprom->antenna_gain.a3 = tuple->TupleData[1];
  1668. break;
  1669. case SSB_PCMCIA_CIS_BFLAGS:
  1670. GOTO_ERROR_ON((tuple->TupleDataLen != 3) &&
  1671. --- a/drivers/ssb/sdio.c
  1672. +++ b/drivers/ssb/sdio.c
  1673. @@ -6,7 +6,7 @@
  1674. *
  1675. * Based on drivers/ssb/pcmcia.c
  1676. * Copyright 2006 Johannes Berg <[email protected]>
  1677. - * Copyright 2007-2008 Michael Buesch <[email protected]>
  1678. + * Copyright 2007-2008 Michael Buesch <[email protected]>
  1679. *
  1680. * Licensed under the GNU/GPL. See COPYING for details.
  1681. *
  1682. @@ -551,14 +551,10 @@ int ssb_sdio_get_invariants(struct ssb_b
  1683. case SSB_SDIO_CIS_ANTGAIN:
  1684. GOTO_ERROR_ON(tuple->size != 2,
  1685. "antg tpl size");
  1686. - sprom->antenna_gain.ghz24.a0 = tuple->data[1];
  1687. - sprom->antenna_gain.ghz24.a1 = tuple->data[1];
  1688. - sprom->antenna_gain.ghz24.a2 = tuple->data[1];
  1689. - sprom->antenna_gain.ghz24.a3 = tuple->data[1];
  1690. - sprom->antenna_gain.ghz5.a0 = tuple->data[1];
  1691. - sprom->antenna_gain.ghz5.a1 = tuple->data[1];
  1692. - sprom->antenna_gain.ghz5.a2 = tuple->data[1];
  1693. - sprom->antenna_gain.ghz5.a3 = tuple->data[1];
  1694. + sprom->antenna_gain.a0 = tuple->data[1];
  1695. + sprom->antenna_gain.a1 = tuple->data[1];
  1696. + sprom->antenna_gain.a2 = tuple->data[1];
  1697. + sprom->antenna_gain.a3 = tuple->data[1];
  1698. break;
  1699. case SSB_SDIO_CIS_BFLAGS:
  1700. GOTO_ERROR_ON((tuple->size != 3) &&
  1701. --- a/include/linux/ssb/ssb_driver_gige.h
  1702. +++ b/include/linux/ssb/ssb_driver_gige.h
  1703. @@ -2,6 +2,7 @@
  1704. #define LINUX_SSB_DRIVER_GIGE_H_
  1705. #include <linux/ssb/ssb.h>
  1706. +#include <linux/bug.h>
  1707. #include <linux/pci.h>
  1708. #include <linux/spinlock.h>