020-ssb_update.patch 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589
  1. --- a/drivers/ssb/Kconfig
  2. +++ b/drivers/ssb/Kconfig
  3. @@ -136,10 +136,15 @@ config SSB_DRIVER_MIPS
  4. If unsure, say N
  5. +config SSB_SFLASH
  6. + bool "SSB serial flash support"
  7. + depends on SSB_DRIVER_MIPS
  8. + default y
  9. +
  10. # Assumption: We are on embedded, if we compile the MIPS core.
  11. config SSB_EMBEDDED
  12. bool
  13. - depends on SSB_DRIVER_MIPS
  14. + depends on SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE
  15. default y
  16. config SSB_DRIVER_EXTIF
  17. --- a/drivers/ssb/Makefile
  18. +++ b/drivers/ssb/Makefile
  19. @@ -11,6 +11,7 @@ ssb-$(CONFIG_SSB_SDIOHOST) += sdio.o
  20. # built-in drivers
  21. ssb-y += driver_chipcommon.o
  22. ssb-y += driver_chipcommon_pmu.o
  23. +ssb-$(CONFIG_SSB_SFLASH) += driver_chipcommon_sflash.o
  24. ssb-$(CONFIG_SSB_DRIVER_MIPS) += driver_mipscore.o
  25. ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o
  26. ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o
  27. --- a/drivers/ssb/driver_chipcommon.c
  28. +++ b/drivers/ssb/driver_chipcommon.c
  29. @@ -354,7 +354,7 @@ void ssb_chipcommon_init(struct ssb_chip
  30. if (cc->dev->id.revision >= 11)
  31. cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
  32. - ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status);
  33. + ssb_dbg("chipcommon status is 0x%x\n", cc->status);
  34. if (cc->dev->id.revision >= 20) {
  35. chipco_write32(cc, SSB_CHIPCO_GPIOPULLUP, 0);
  36. --- a/drivers/ssb/driver_chipcommon_pmu.c
  37. +++ b/drivers/ssb/driver_chipcommon_pmu.c
  38. @@ -110,8 +110,8 @@ static void ssb_pmu0_pllinit_r0(struct s
  39. return;
  40. }
  41. - ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n",
  42. - (crystalfreq / 1000), (crystalfreq % 1000));
  43. + ssb_info("Programming PLL to %u.%03u MHz\n",
  44. + crystalfreq / 1000, crystalfreq % 1000);
  45. /* First turn the PLL off. */
  46. switch (bus->chip_id) {
  47. @@ -138,7 +138,7 @@ static void ssb_pmu0_pllinit_r0(struct s
  48. }
  49. tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
  50. if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
  51. - ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n");
  52. + ssb_emerg("Failed to turn the PLL off!\n");
  53. /* Set PDIV in PLL control 0. */
  54. pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0);
  55. @@ -249,8 +249,8 @@ static void ssb_pmu1_pllinit_r0(struct s
  56. return;
  57. }
  58. - ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n",
  59. - (crystalfreq / 1000), (crystalfreq % 1000));
  60. + ssb_info("Programming PLL to %u.%03u MHz\n",
  61. + crystalfreq / 1000, crystalfreq % 1000);
  62. /* First turn the PLL off. */
  63. switch (bus->chip_id) {
  64. @@ -275,7 +275,7 @@ static void ssb_pmu1_pllinit_r0(struct s
  65. }
  66. tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
  67. if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
  68. - ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n");
  69. + ssb_emerg("Failed to turn the PLL off!\n");
  70. /* Set p1div and p2div. */
  71. pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0);
  72. @@ -349,9 +349,8 @@ static void ssb_pmu_pll_init(struct ssb_
  73. case 43222:
  74. break;
  75. default:
  76. - ssb_printk(KERN_ERR PFX
  77. - "ERROR: PLL init unknown for device %04X\n",
  78. - bus->chip_id);
  79. + ssb_err("ERROR: PLL init unknown for device %04X\n",
  80. + bus->chip_id);
  81. }
  82. }
  83. @@ -472,9 +471,8 @@ static void ssb_pmu_resources_init(struc
  84. max_msk = 0xFFFFF;
  85. break;
  86. default:
  87. - ssb_printk(KERN_ERR PFX
  88. - "ERROR: PMU resource config unknown for device %04X\n",
  89. - bus->chip_id);
  90. + ssb_err("ERROR: PMU resource config unknown for device %04X\n",
  91. + bus->chip_id);
  92. }
  93. if (updown_tab) {
  94. @@ -526,8 +524,8 @@ void ssb_pmu_init(struct ssb_chipcommon
  95. pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP);
  96. cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION);
  97. - ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n",
  98. - cc->pmu.rev, pmucap);
  99. + ssb_dbg("Found rev %u PMU (capabilities 0x%08X)\n",
  100. + cc->pmu.rev, pmucap);
  101. if (cc->pmu.rev == 1)
  102. chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
  103. @@ -638,9 +636,8 @@ u32 ssb_pmu_get_alp_clock(struct ssb_chi
  104. case 0x5354:
  105. ssb_pmu_get_alp_clock_clk0(cc);
  106. default:
  107. - ssb_printk(KERN_ERR PFX
  108. - "ERROR: PMU alp clock unknown for device %04X\n",
  109. - bus->chip_id);
  110. + ssb_err("ERROR: PMU alp clock unknown for device %04X\n",
  111. + bus->chip_id);
  112. return 0;
  113. }
  114. }
  115. @@ -654,9 +651,8 @@ u32 ssb_pmu_get_cpu_clock(struct ssb_chi
  116. /* 5354 chip uses a non programmable PLL of frequency 240MHz */
  117. return 240000000;
  118. default:
  119. - ssb_printk(KERN_ERR PFX
  120. - "ERROR: PMU cpu clock unknown for device %04X\n",
  121. - bus->chip_id);
  122. + ssb_err("ERROR: PMU cpu clock unknown for device %04X\n",
  123. + bus->chip_id);
  124. return 0;
  125. }
  126. }
  127. @@ -669,9 +665,8 @@ u32 ssb_pmu_get_controlclock(struct ssb_
  128. case 0x5354:
  129. return 120000000;
  130. default:
  131. - ssb_printk(KERN_ERR PFX
  132. - "ERROR: PMU controlclock unknown for device %04X\n",
  133. - bus->chip_id);
  134. + ssb_err("ERROR: PMU controlclock unknown for device %04X\n",
  135. + bus->chip_id);
  136. return 0;
  137. }
  138. }
  139. @@ -692,8 +687,23 @@ void ssb_pmu_spuravoid_pllupdate(struct
  140. pmu_ctl = SSB_CHIPCO_PMU_CTL_PLL_UPD;
  141. break;
  142. case 43222:
  143. - /* TODO: BCM43222 requires updating PLLs too */
  144. - return;
  145. + if (spuravoid == 1) {
  146. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, 0x11500008);
  147. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL1, 0x0C000C06);
  148. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x0F600a08);
  149. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL3, 0x00000000);
  150. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL4, 0x2001E920);
  151. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, 0x88888815);
  152. + } else {
  153. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, 0x11100008);
  154. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL1, 0x0c000c06);
  155. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, 0x03000a08);
  156. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL3, 0x00000000);
  157. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL4, 0x200005c0);
  158. + ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, 0x88888855);
  159. + }
  160. + pmu_ctl = SSB_CHIPCO_PMU_CTL_PLL_UPD;
  161. + break;
  162. default:
  163. ssb_printk(KERN_ERR PFX
  164. "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n",
  165. --- /dev/null
  166. +++ b/drivers/ssb/driver_chipcommon_sflash.c
  167. @@ -0,0 +1,164 @@
  168. +/*
  169. + * Sonics Silicon Backplane
  170. + * ChipCommon serial flash interface
  171. + *
  172. + * Licensed under the GNU/GPL. See COPYING for details.
  173. + */
  174. +
  175. +#include <linux/ssb/ssb.h>
  176. +
  177. +#include "ssb_private.h"
  178. +
  179. +static struct resource ssb_sflash_resource = {
  180. + .name = "ssb_sflash",
  181. + .start = SSB_FLASH2,
  182. + .end = 0,
  183. + .flags = IORESOURCE_MEM | IORESOURCE_READONLY,
  184. +};
  185. +
  186. +struct platform_device ssb_sflash_dev = {
  187. + .name = "ssb_sflash",
  188. + .resource = &ssb_sflash_resource,
  189. + .num_resources = 1,
  190. +};
  191. +
  192. +struct ssb_sflash_tbl_e {
  193. + char *name;
  194. + u32 id;
  195. + u32 blocksize;
  196. + u16 numblocks;
  197. +};
  198. +
  199. +static const struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = {
  200. + { "M25P20", 0x11, 0x10000, 4, },
  201. + { "M25P40", 0x12, 0x10000, 8, },
  202. +
  203. + { "M25P16", 0x14, 0x10000, 32, },
  204. + { "M25P32", 0x15, 0x10000, 64, },
  205. + { "M25P64", 0x16, 0x10000, 128, },
  206. + { "M25FL128", 0x17, 0x10000, 256, },
  207. + { 0 },
  208. +};
  209. +
  210. +static const struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = {
  211. + { "SST25WF512", 1, 0x1000, 16, },
  212. + { "SST25VF512", 0x48, 0x1000, 16, },
  213. + { "SST25WF010", 2, 0x1000, 32, },
  214. + { "SST25VF010", 0x49, 0x1000, 32, },
  215. + { "SST25WF020", 3, 0x1000, 64, },
  216. + { "SST25VF020", 0x43, 0x1000, 64, },
  217. + { "SST25WF040", 4, 0x1000, 128, },
  218. + { "SST25VF040", 0x44, 0x1000, 128, },
  219. + { "SST25VF040B", 0x8d, 0x1000, 128, },
  220. + { "SST25WF080", 5, 0x1000, 256, },
  221. + { "SST25VF080B", 0x8e, 0x1000, 256, },
  222. + { "SST25VF016", 0x41, 0x1000, 512, },
  223. + { "SST25VF032", 0x4a, 0x1000, 1024, },
  224. + { "SST25VF064", 0x4b, 0x1000, 2048, },
  225. + { 0 },
  226. +};
  227. +
  228. +static const struct ssb_sflash_tbl_e ssb_sflash_at_tbl[] = {
  229. + { "AT45DB011", 0xc, 256, 512, },
  230. + { "AT45DB021", 0x14, 256, 1024, },
  231. + { "AT45DB041", 0x1c, 256, 2048, },
  232. + { "AT45DB081", 0x24, 256, 4096, },
  233. + { "AT45DB161", 0x2c, 512, 4096, },
  234. + { "AT45DB321", 0x34, 512, 8192, },
  235. + { "AT45DB642", 0x3c, 1024, 8192, },
  236. + { 0 },
  237. +};
  238. +
  239. +static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32 opcode)
  240. +{
  241. + int i;
  242. + chipco_write32(cc, SSB_CHIPCO_FLASHCTL,
  243. + SSB_CHIPCO_FLASHCTL_START | opcode);
  244. + for (i = 0; i < 1000; i++) {
  245. + if (!(chipco_read32(cc, SSB_CHIPCO_FLASHCTL) &
  246. + SSB_CHIPCO_FLASHCTL_BUSY))
  247. + return;
  248. + cpu_relax();
  249. + }
  250. + pr_err("SFLASH control command failed (timeout)!\n");
  251. +}
  252. +
  253. +/* Initialize serial flash access */
  254. +int ssb_sflash_init(struct ssb_chipcommon *cc)
  255. +{
  256. + struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash;
  257. + const struct ssb_sflash_tbl_e *e;
  258. + u32 id, id2;
  259. +
  260. + switch (cc->capabilities & SSB_CHIPCO_CAP_FLASHT) {
  261. + case SSB_CHIPCO_FLASHT_STSER:
  262. + ssb_sflash_cmd(cc, SSB_CHIPCO_FLASHCTL_ST_DP);
  263. +
  264. + chipco_write32(cc, SSB_CHIPCO_FLASHADDR, 0);
  265. + ssb_sflash_cmd(cc, SSB_CHIPCO_FLASHCTL_ST_RES);
  266. + id = chipco_read32(cc, SSB_CHIPCO_FLASHDATA);
  267. +
  268. + chipco_write32(cc, SSB_CHIPCO_FLASHADDR, 1);
  269. + ssb_sflash_cmd(cc, SSB_CHIPCO_FLASHCTL_ST_RES);
  270. + id2 = chipco_read32(cc, SSB_CHIPCO_FLASHDATA);
  271. +
  272. + switch (id) {
  273. + case 0xbf:
  274. + for (e = ssb_sflash_sst_tbl; e->name; e++) {
  275. + if (e->id == id2)
  276. + break;
  277. + }
  278. + break;
  279. + case 0x13:
  280. + return -ENOTSUPP;
  281. + default:
  282. + for (e = ssb_sflash_st_tbl; e->name; e++) {
  283. + if (e->id == id)
  284. + break;
  285. + }
  286. + break;
  287. + }
  288. + if (!e->name) {
  289. + pr_err("Unsupported ST serial flash (id: 0x%X, id2: 0x%X)\n",
  290. + id, id2);
  291. + return -ENOTSUPP;
  292. + }
  293. +
  294. + break;
  295. + case SSB_CHIPCO_FLASHT_ATSER:
  296. + ssb_sflash_cmd(cc, SSB_CHIPCO_FLASHCTL_AT_STATUS);
  297. + id = chipco_read32(cc, SSB_CHIPCO_FLASHDATA) & 0x3c;
  298. +
  299. + for (e = ssb_sflash_at_tbl; e->name; e++) {
  300. + if (e->id == id)
  301. + break;
  302. + }
  303. + if (!e->name) {
  304. + pr_err("Unsupported Atmel serial flash (id: 0x%X)\n",
  305. + id);
  306. + return -ENOTSUPP;
  307. + }
  308. +
  309. + break;
  310. + default:
  311. + pr_err("Unsupported flash type\n");
  312. + return -ENOTSUPP;
  313. + }
  314. +
  315. + sflash->window = SSB_FLASH2;
  316. + sflash->blocksize = e->blocksize;
  317. + sflash->numblocks = e->numblocks;
  318. + sflash->size = sflash->blocksize * sflash->numblocks;
  319. + sflash->present = true;
  320. +
  321. + pr_info("Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n",
  322. + e->name, sflash->size / 1024, e->blocksize, e->numblocks);
  323. +
  324. + /* Prepare platform device, but don't register it yet. It's too early,
  325. + * malloc (required by device_private_init) is not available yet. */
  326. + ssb_sflash_dev.resource[0].end = ssb_sflash_dev.resource[0].start +
  327. + sflash->size;
  328. + ssb_sflash_dev.dev.platform_data = sflash;
  329. +
  330. + return 0;
  331. +}
  332. --- a/drivers/ssb/driver_gpio.c
  333. +++ b/drivers/ssb/driver_gpio.c
  334. @@ -74,6 +74,16 @@ static void ssb_gpio_chipco_free(struct
  335. ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0);
  336. }
  337. +static int ssb_gpio_chipco_to_irq(struct gpio_chip *chip, unsigned gpio)
  338. +{
  339. + struct ssb_bus *bus = ssb_gpio_get_bus(chip);
  340. +
  341. + if (bus->bustype == SSB_BUSTYPE_SSB)
  342. + return ssb_mips_irq(bus->chipco.dev) + 2;
  343. + else
  344. + return -EINVAL;
  345. +}
  346. +
  347. static int ssb_gpio_chipco_init(struct ssb_bus *bus)
  348. {
  349. struct gpio_chip *chip = &bus->gpio;
  350. @@ -86,6 +96,7 @@ static int ssb_gpio_chipco_init(struct s
  351. chip->set = ssb_gpio_chipco_set_value;
  352. chip->direction_input = ssb_gpio_chipco_direction_input;
  353. chip->direction_output = ssb_gpio_chipco_direction_output;
  354. + chip->to_irq = ssb_gpio_chipco_to_irq;
  355. chip->ngpio = 16;
  356. /* There is just one SoC in one device and its GPIO addresses should be
  357. * deterministic to address them more easily. The other buses could get
  358. @@ -134,6 +145,16 @@ static int ssb_gpio_extif_direction_outp
  359. return 0;
  360. }
  361. +static int ssb_gpio_extif_to_irq(struct gpio_chip *chip, unsigned gpio)
  362. +{
  363. + struct ssb_bus *bus = ssb_gpio_get_bus(chip);
  364. +
  365. + if (bus->bustype == SSB_BUSTYPE_SSB)
  366. + return ssb_mips_irq(bus->extif.dev) + 2;
  367. + else
  368. + return -EINVAL;
  369. +}
  370. +
  371. static int ssb_gpio_extif_init(struct ssb_bus *bus)
  372. {
  373. struct gpio_chip *chip = &bus->gpio;
  374. @@ -144,6 +165,7 @@ static int ssb_gpio_extif_init(struct ss
  375. chip->set = ssb_gpio_extif_set_value;
  376. chip->direction_input = ssb_gpio_extif_direction_input;
  377. chip->direction_output = ssb_gpio_extif_direction_output;
  378. + chip->to_irq = ssb_gpio_extif_to_irq;
  379. chip->ngpio = 5;
  380. /* There is just one SoC in one device and its GPIO addresses should be
  381. * deterministic to address them more easily. The other buses could get
  382. --- a/drivers/ssb/driver_mipscore.c
  383. +++ b/drivers/ssb/driver_mipscore.c
  384. @@ -10,6 +10,7 @@
  385. #include <linux/ssb/ssb.h>
  386. +#include <linux/mtd/physmap.h>
  387. #include <linux/serial.h>
  388. #include <linux/serial_core.h>
  389. #include <linux/serial_reg.h>
  390. @@ -17,6 +18,25 @@
  391. #include "ssb_private.h"
  392. +static const char *part_probes[] = { "bcm47xxpart", NULL };
  393. +
  394. +static struct physmap_flash_data ssb_pflash_data = {
  395. + .part_probe_types = part_probes,
  396. +};
  397. +
  398. +static struct resource ssb_pflash_resource = {
  399. + .name = "ssb_pflash",
  400. + .flags = IORESOURCE_MEM,
  401. +};
  402. +
  403. +struct platform_device ssb_pflash_dev = {
  404. + .name = "physmap-flash",
  405. + .dev = {
  406. + .platform_data = &ssb_pflash_data,
  407. + },
  408. + .resource = &ssb_pflash_resource,
  409. + .num_resources = 1,
  410. +};
  411. static inline u32 mips_read32(struct ssb_mipscore *mcore,
  412. u16 offset)
  413. @@ -147,21 +167,22 @@ static void set_irq(struct ssb_device *d
  414. irqflag |= (ipsflag & ~ipsflag_irq_mask[irq]);
  415. ssb_write32(mdev, SSB_IPSFLAG, irqflag);
  416. }
  417. - ssb_dprintk(KERN_INFO PFX
  418. - "set_irq: core 0x%04x, irq %d => %d\n",
  419. - dev->id.coreid, oldirq+2, irq+2);
  420. + ssb_dbg("set_irq: core 0x%04x, irq %d => %d\n",
  421. + dev->id.coreid, oldirq+2, irq+2);
  422. }
  423. static void print_irq(struct ssb_device *dev, unsigned int irq)
  424. {
  425. - int i;
  426. static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
  427. - ssb_dprintk(KERN_INFO PFX
  428. - "core 0x%04x, irq :", dev->id.coreid);
  429. - for (i = 0; i <= 6; i++) {
  430. - ssb_dprintk(" %s%s", irq_name[i], i==irq?"*":" ");
  431. - }
  432. - ssb_dprintk("\n");
  433. + ssb_dbg("core 0x%04x, irq : %s%s %s%s %s%s %s%s %s%s %s%s %s%s\n",
  434. + dev->id.coreid,
  435. + irq_name[0], irq == 0 ? "*" : " ",
  436. + irq_name[1], irq == 1 ? "*" : " ",
  437. + irq_name[2], irq == 2 ? "*" : " ",
  438. + irq_name[3], irq == 3 ? "*" : " ",
  439. + irq_name[4], irq == 4 ? "*" : " ",
  440. + irq_name[5], irq == 5 ? "*" : " ",
  441. + irq_name[6], irq == 6 ? "*" : " ");
  442. }
  443. static void dump_irq(struct ssb_bus *bus)
  444. @@ -189,34 +210,43 @@ static void ssb_mips_serial_init(struct
  445. static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
  446. {
  447. struct ssb_bus *bus = mcore->dev->bus;
  448. + struct ssb_pflash *pflash = &mcore->pflash;
  449. /* When there is no chipcommon on the bus there is 4MB flash */
  450. if (!ssb_chipco_available(&bus->chipco)) {
  451. - mcore->pflash.present = true;
  452. - mcore->pflash.buswidth = 2;
  453. - mcore->pflash.window = SSB_FLASH1;
  454. - mcore->pflash.window_size = SSB_FLASH1_SZ;
  455. - return;
  456. + pflash->present = true;
  457. + pflash->buswidth = 2;
  458. + pflash->window = SSB_FLASH1;
  459. + pflash->window_size = SSB_FLASH1_SZ;
  460. + goto ssb_pflash;
  461. }
  462. /* There is ChipCommon, so use it to read info about flash */
  463. switch (bus->chipco.capabilities & SSB_CHIPCO_CAP_FLASHT) {
  464. case SSB_CHIPCO_FLASHT_STSER:
  465. case SSB_CHIPCO_FLASHT_ATSER:
  466. - pr_err("Serial flash not supported\n");
  467. + pr_debug("Found serial flash\n");
  468. + ssb_sflash_init(&bus->chipco);
  469. break;
  470. case SSB_CHIPCO_FLASHT_PARA:
  471. pr_debug("Found parallel flash\n");
  472. - mcore->pflash.present = true;
  473. - mcore->pflash.window = SSB_FLASH2;
  474. - mcore->pflash.window_size = SSB_FLASH2_SZ;
  475. + pflash->present = true;
  476. + pflash->window = SSB_FLASH2;
  477. + pflash->window_size = SSB_FLASH2_SZ;
  478. if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
  479. & SSB_CHIPCO_CFG_DS16) == 0)
  480. - mcore->pflash.buswidth = 1;
  481. + pflash->buswidth = 1;
  482. else
  483. - mcore->pflash.buswidth = 2;
  484. + pflash->buswidth = 2;
  485. break;
  486. }
  487. +
  488. +ssb_pflash:
  489. + if (pflash->present) {
  490. + ssb_pflash_data.width = pflash->buswidth;
  491. + ssb_pflash_resource.start = pflash->window;
  492. + ssb_pflash_resource.end = pflash->window + pflash->window_size;
  493. + }
  494. }
  495. u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
  496. @@ -257,7 +287,7 @@ void ssb_mipscore_init(struct ssb_mipsco
  497. if (!mcore->dev)
  498. return; /* We don't have a MIPS core */
  499. - ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n");
  500. + ssb_dbg("Initializing MIPS core...\n");
  501. bus = mcore->dev->bus;
  502. hz = ssb_clockspeed(bus);
  503. @@ -305,7 +335,7 @@ void ssb_mipscore_init(struct ssb_mipsco
  504. break;
  505. }
  506. }
  507. - ssb_dprintk(KERN_INFO PFX "after irq reconfiguration\n");
  508. + ssb_dbg("after irq reconfiguration\n");
  509. dump_irq(bus);
  510. ssb_mips_serial_init(mcore);
  511. --- a/drivers/ssb/driver_pcicore.c
  512. +++ b/drivers/ssb/driver_pcicore.c
  513. @@ -263,8 +263,7 @@ int ssb_pcicore_plat_dev_init(struct pci
  514. return -ENODEV;
  515. }
  516. - ssb_printk(KERN_INFO "PCI: Fixing up device %s\n",
  517. - pci_name(d));
  518. + ssb_info("PCI: Fixing up device %s\n", pci_name(d));
  519. /* Fix up interrupt lines */
  520. d->irq = ssb_mips_irq(extpci_core->dev) + 2;
  521. @@ -285,12 +284,12 @@ static void ssb_pcicore_fixup_pcibridge(
  522. if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
  523. return;
  524. - ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev));
  525. + ssb_info("PCI: Fixing up bridge %s\n", pci_name(dev));
  526. /* Enable PCI bridge bus mastering and memory space */
  527. pci_set_master(dev);
  528. if (pcibios_enable_device(dev, ~0) < 0) {
  529. - ssb_printk(KERN_ERR "PCI: SSB bridge enable failed\n");
  530. + ssb_err("PCI: SSB bridge enable failed\n");
  531. return;
  532. }
  533. @@ -299,8 +298,8 @@ static void ssb_pcicore_fixup_pcibridge(
  534. /* Make sure our latency is high enough to handle the devices behind us */
  535. lat = 168;
  536. - ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n",
  537. - pci_name(dev), lat);
  538. + ssb_info("PCI: Fixing latency timer of device %s to %u\n",
  539. + pci_name(dev), lat);
  540. pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
  541. }
  542. DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_pcicore_fixup_pcibridge);
  543. @@ -323,7 +322,7 @@ static void ssb_pcicore_init_hostmode(st
  544. return;
  545. extpci_core = pc;
  546. - ssb_dprintk(KERN_INFO PFX "PCIcore in host mode found\n");
  547. + ssb_dbg("PCIcore in host mode found\n");
  548. /* Reset devices on the external PCI bus */
  549. val = SSB_PCICORE_CTL_RST_OE;
  550. val |= SSB_PCICORE_CTL_CLK_OE;
  551. @@ -338,7 +337,7 @@ static void ssb_pcicore_init_hostmode(st
  552. udelay(1); /* Assertion time demanded by the PCI standard */
  553. if (pc->dev->bus->has_cardbus_slot) {
  554. - ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n");
  555. + ssb_dbg("CardBus slot detected\n");
  556. pc->cardbusmode = 1;
  557. /* GPIO 1 resets the bridge */
  558. ssb_gpio_out(pc->dev->bus, 1, 1);
  559. --- a/drivers/ssb/embedded.c
  560. +++ b/drivers/ssb/embedded.c
  561. @@ -57,9 +57,8 @@ int ssb_watchdog_register(struct ssb_bus
  562. bus->busnumber, &wdt,
  563. sizeof(wdt));
  564. if (IS_ERR(pdev)) {
  565. - ssb_dprintk(KERN_INFO PFX
  566. - "can not register watchdog device, err: %li\n",
  567. - PTR_ERR(pdev));
  568. + ssb_dbg("can not register watchdog device, err: %li\n",
  569. + PTR_ERR(pdev));
  570. return PTR_ERR(pdev);
  571. }
  572. --- a/drivers/ssb/main.c
  573. +++ b/drivers/ssb/main.c
  574. @@ -275,8 +275,8 @@ int ssb_devices_thaw(struct ssb_freeze_c
  575. err = sdrv->probe(sdev, &sdev->id);
  576. if (err) {
  577. - ssb_printk(KERN_ERR PFX "Failed to thaw device %s\n",
  578. - dev_name(sdev->dev));
  579. + ssb_err("Failed to thaw device %s\n",
  580. + dev_name(sdev->dev));
  581. result = err;
  582. }
  583. ssb_device_put(sdev);
  584. @@ -447,10 +447,9 @@ void ssb_bus_unregister(struct ssb_bus *
  585. err = ssb_gpio_unregister(bus);
  586. if (err == -EBUSY)
  587. - ssb_dprintk(KERN_ERR PFX "Some GPIOs are still in use.\n");
  588. + ssb_dbg("Some GPIOs are still in use\n");
  589. else if (err)
  590. - ssb_dprintk(KERN_ERR PFX
  591. - "Can not unregister GPIO driver: %i\n", err);
  592. + ssb_dbg("Can not unregister GPIO driver: %i\n", err);
  593. ssb_buses_lock();
  594. ssb_devices_unregister(bus);
  595. @@ -497,8 +496,7 @@ static int ssb_devices_register(struct s
  596. devwrap = kzalloc(sizeof(*devwrap), GFP_KERNEL);
  597. if (!devwrap) {
  598. - ssb_printk(KERN_ERR PFX
  599. - "Could not allocate device\n");
  600. + ssb_err("Could not allocate device\n");
  601. err = -ENOMEM;
  602. goto error;
  603. }
  604. @@ -537,9 +535,7 @@ static int ssb_devices_register(struct s
  605. sdev->dev = dev;
  606. err = device_register(dev);
  607. if (err) {
  608. - ssb_printk(KERN_ERR PFX
  609. - "Could not register %s\n",
  610. - dev_name(dev));
  611. + ssb_err("Could not register %s\n", dev_name(dev));
  612. /* Set dev to NULL to not unregister
  613. * dev on error unwinding. */
  614. sdev->dev = NULL;
  615. @@ -549,6 +545,22 @@ static int ssb_devices_register(struct s
  616. dev_idx++;
  617. }
  618. +#ifdef CONFIG_SSB_DRIVER_MIPS
  619. + if (bus->mipscore.pflash.present) {
  620. + err = platform_device_register(&ssb_pflash_dev);
  621. + if (err)
  622. + pr_err("Error registering parallel flash\n");
  623. + }
  624. +#endif
  625. +
  626. +#ifdef CONFIG_SSB_SFLASH
  627. + if (bus->mipscore.sflash.present) {
  628. + err = platform_device_register(&ssb_sflash_dev);
  629. + if (err)
  630. + pr_err("Error registering serial flash\n");
  631. + }
  632. +#endif
  633. +
  634. return 0;
  635. error:
  636. /* Unwind the already registered devices. */
  637. @@ -817,10 +829,9 @@ static int ssb_bus_register(struct ssb_b
  638. ssb_mipscore_init(&bus->mipscore);
  639. err = ssb_gpio_init(bus);
  640. if (err == -ENOTSUPP)
  641. - ssb_dprintk(KERN_DEBUG PFX "GPIO driver not activated\n");
  642. + ssb_dbg("GPIO driver not activated\n");
  643. else if (err)
  644. - ssb_dprintk(KERN_ERR PFX
  645. - "Error registering GPIO driver: %i\n", err);
  646. + ssb_dbg("Error registering GPIO driver: %i\n", err);
  647. err = ssb_fetch_invariants(bus, get_invariants);
  648. if (err) {
  649. ssb_bus_may_powerdown(bus);
  650. @@ -870,11 +881,11 @@ int ssb_bus_pcibus_register(struct ssb_b
  651. err = ssb_bus_register(bus, ssb_pci_get_invariants, 0);
  652. if (!err) {
  653. - ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
  654. - "PCI device %s\n", dev_name(&host_pci->dev));
  655. + ssb_info("Sonics Silicon Backplane found on PCI device %s\n",
  656. + dev_name(&host_pci->dev));
  657. } else {
  658. - ssb_printk(KERN_ERR PFX "Failed to register PCI version"
  659. - " of SSB with error %d\n", err);
  660. + ssb_err("Failed to register PCI version of SSB with error %d\n",
  661. + err);
  662. }
  663. return err;
  664. @@ -895,8 +906,8 @@ int ssb_bus_pcmciabus_register(struct ss
  665. err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr);
  666. if (!err) {
  667. - ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
  668. - "PCMCIA device %s\n", pcmcia_dev->devname);
  669. + ssb_info("Sonics Silicon Backplane found on PCMCIA device %s\n",
  670. + pcmcia_dev->devname);
  671. }
  672. return err;
  673. @@ -917,8 +928,8 @@ int ssb_bus_sdiobus_register(struct ssb_
  674. err = ssb_bus_register(bus, ssb_sdio_get_invariants, ~0);
  675. if (!err) {
  676. - ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
  677. - "SDIO device %s\n", sdio_func_id(func));
  678. + ssb_info("Sonics Silicon Backplane found on SDIO device %s\n",
  679. + sdio_func_id(func));
  680. }
  681. return err;
  682. @@ -936,8 +947,8 @@ int ssb_bus_ssbbus_register(struct ssb_b
  683. err = ssb_bus_register(bus, get_invariants, baseaddr);
  684. if (!err) {
  685. - ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found at "
  686. - "address 0x%08lX\n", baseaddr);
  687. + ssb_info("Sonics Silicon Backplane found at address 0x%08lX\n",
  688. + baseaddr);
  689. }
  690. return err;
  691. @@ -1331,7 +1342,7 @@ out:
  692. #endif
  693. return err;
  694. error:
  695. - ssb_printk(KERN_ERR PFX "Bus powerdown failed\n");
  696. + ssb_err("Bus powerdown failed\n");
  697. goto out;
  698. }
  699. EXPORT_SYMBOL(ssb_bus_may_powerdown);
  700. @@ -1354,7 +1365,7 @@ int ssb_bus_powerup(struct ssb_bus *bus,
  701. return 0;
  702. error:
  703. - ssb_printk(KERN_ERR PFX "Bus powerup failed\n");
  704. + ssb_err("Bus powerup failed\n");
  705. return err;
  706. }
  707. EXPORT_SYMBOL(ssb_bus_powerup);
  708. @@ -1462,15 +1473,13 @@ static int __init ssb_modinit(void)
  709. err = b43_pci_ssb_bridge_init();
  710. if (err) {
  711. - ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
  712. - "initialization failed\n");
  713. + ssb_err("Broadcom 43xx PCI-SSB-bridge initialization failed\n");
  714. /* don't fail SSB init because of this */
  715. err = 0;
  716. }
  717. err = ssb_gige_init();
  718. if (err) {
  719. - ssb_printk(KERN_ERR "SSB Broadcom Gigabit Ethernet "
  720. - "driver initialization failed\n");
  721. + ssb_err("SSB Broadcom Gigabit Ethernet driver initialization failed\n");
  722. /* don't fail SSB init because of this */
  723. err = 0;
  724. }
  725. --- a/drivers/ssb/pci.c
  726. +++ b/drivers/ssb/pci.c
  727. @@ -56,7 +56,7 @@ int ssb_pci_switch_coreidx(struct ssb_bu
  728. }
  729. return 0;
  730. error:
  731. - ssb_printk(KERN_ERR PFX "Failed to switch to core %u\n", coreidx);
  732. + ssb_err("Failed to switch to core %u\n", coreidx);
  733. return -ENODEV;
  734. }
  735. @@ -67,10 +67,9 @@ int ssb_pci_switch_core(struct ssb_bus *
  736. unsigned long flags;
  737. #if SSB_VERBOSE_PCICORESWITCH_DEBUG
  738. - ssb_printk(KERN_INFO PFX
  739. - "Switching to %s core, index %d\n",
  740. - ssb_core_name(dev->id.coreid),
  741. - dev->core_index);
  742. + ssb_info("Switching to %s core, index %d\n",
  743. + ssb_core_name(dev->id.coreid),
  744. + dev->core_index);
  745. #endif
  746. spin_lock_irqsave(&bus->bar_lock, flags);
  747. @@ -231,6 +230,15 @@ static inline u8 ssb_crc8(u8 crc, u8 dat
  748. return t[crc ^ data];
  749. }
  750. +static void sprom_get_mac(char *mac, const u16 *in)
  751. +{
  752. + int i;
  753. + for (i = 0; i < 3; i++) {
  754. + *mac++ = in[i] >> 8;
  755. + *mac++ = in[i];
  756. + }
  757. +}
  758. +
  759. static u8 ssb_sprom_crc(const u16 *sprom, u16 size)
  760. {
  761. int word;
  762. @@ -278,7 +286,7 @@ static int sprom_do_write(struct ssb_bus
  763. u32 spromctl;
  764. u16 size = bus->sprom_size;
  765. - ssb_printk(KERN_NOTICE PFX "Writing SPROM. Do NOT turn off the power! Please stand by...\n");
  766. + ssb_notice("Writing SPROM. Do NOT turn off the power! Please stand by...\n");
  767. err = pci_read_config_dword(pdev, SSB_SPROMCTL, &spromctl);
  768. if (err)
  769. goto err_ctlreg;
  770. @@ -286,17 +294,17 @@ static int sprom_do_write(struct ssb_bus
  771. err = pci_write_config_dword(pdev, SSB_SPROMCTL, spromctl);
  772. if (err)
  773. goto err_ctlreg;
  774. - ssb_printk(KERN_NOTICE PFX "[ 0%%");
  775. + ssb_notice("[ 0%%");
  776. msleep(500);
  777. for (i = 0; i < size; i++) {
  778. if (i == size / 4)
  779. - ssb_printk("25%%");
  780. + ssb_cont("25%%");
  781. else if (i == size / 2)
  782. - ssb_printk("50%%");
  783. + ssb_cont("50%%");
  784. else if (i == (size * 3) / 4)
  785. - ssb_printk("75%%");
  786. + ssb_cont("75%%");
  787. else if (i % 2)
  788. - ssb_printk(".");
  789. + ssb_cont(".");
  790. writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
  791. mmiowb();
  792. msleep(20);
  793. @@ -309,12 +317,12 @@ static int sprom_do_write(struct ssb_bus
  794. if (err)
  795. goto err_ctlreg;
  796. msleep(500);
  797. - ssb_printk("100%% ]\n");
  798. - ssb_printk(KERN_NOTICE PFX "SPROM written.\n");
  799. + ssb_cont("100%% ]\n");
  800. + ssb_notice("SPROM written\n");
  801. return 0;
  802. err_ctlreg:
  803. - ssb_printk(KERN_ERR PFX "Could not access SPROM control register.\n");
  804. + ssb_err("Could not access SPROM control register.\n");
  805. return err;
  806. }
  807. @@ -339,10 +347,23 @@ static s8 r123_extract_antgain(u8 sprom_
  808. return (s8)gain;
  809. }
  810. +static void sprom_extract_r23(struct ssb_sprom *out, const u16 *in)
  811. +{
  812. + SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
  813. + SPEX(opo, SSB_SPROM2_OPO, SSB_SPROM2_OPO_VALUE, 0);
  814. + SPEX(pa1lob0, SSB_SPROM2_PA1LOB0, 0xFFFF, 0);
  815. + SPEX(pa1lob1, SSB_SPROM2_PA1LOB1, 0xFFFF, 0);
  816. + SPEX(pa1lob2, SSB_SPROM2_PA1LOB2, 0xFFFF, 0);
  817. + SPEX(pa1hib0, SSB_SPROM2_PA1HIB0, 0xFFFF, 0);
  818. + SPEX(pa1hib1, SSB_SPROM2_PA1HIB1, 0xFFFF, 0);
  819. + SPEX(pa1hib2, SSB_SPROM2_PA1HIB2, 0xFFFF, 0);
  820. + SPEX(maxpwr_ah, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_HI, 0);
  821. + SPEX(maxpwr_al, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_LO,
  822. + SSB_SPROM2_MAXP_A_LO_SHIFT);
  823. +}
  824. +
  825. static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
  826. {
  827. - int i;
  828. - u16 v;
  829. u16 loc[3];
  830. if (out->revision == 3) /* rev 3 moved MAC */
  831. @@ -352,19 +373,10 @@ static void sprom_extract_r123(struct ss
  832. loc[1] = SSB_SPROM1_ET0MAC;
  833. loc[2] = SSB_SPROM1_ET1MAC;
  834. }
  835. - for (i = 0; i < 3; i++) {
  836. - v = in[SPOFF(loc[0]) + i];
  837. - *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
  838. - }
  839. + sprom_get_mac(out->il0mac, &in[SPOFF(loc[0])]);
  840. if (out->revision < 3) { /* only rev 1-2 have et0, et1 */
  841. - for (i = 0; i < 3; i++) {
  842. - v = in[SPOFF(loc[1]) + i];
  843. - *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v);
  844. - }
  845. - for (i = 0; i < 3; i++) {
  846. - v = in[SPOFF(loc[2]) + i];
  847. - *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v);
  848. - }
  849. + sprom_get_mac(out->et0mac, &in[SPOFF(loc[1])]);
  850. + sprom_get_mac(out->et1mac, &in[SPOFF(loc[2])]);
  851. }
  852. SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0);
  853. SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A,
  854. @@ -372,6 +384,7 @@ static void sprom_extract_r123(struct ss
  855. SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14);
  856. SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15);
  857. SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0);
  858. + SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
  859. if (out->revision == 1)
  860. SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE,
  861. SSB_SPROM1_BINF_CCODE_SHIFT);
  862. @@ -398,8 +411,7 @@ static void sprom_extract_r123(struct ss
  863. SSB_SPROM1_ITSSI_A_SHIFT);
  864. SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0);
  865. SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0);
  866. - if (out->revision >= 2)
  867. - SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
  868. +
  869. SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8);
  870. SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0);
  871. @@ -410,6 +422,8 @@ static void sprom_extract_r123(struct ss
  872. out->antenna_gain.a1 = r123_extract_antgain(out->revision, in,
  873. SSB_SPROM1_AGAIN_A,
  874. SSB_SPROM1_AGAIN_A_SHIFT);
  875. + if (out->revision >= 2)
  876. + sprom_extract_r23(out, in);
  877. }
  878. /* Revs 4 5 and 8 have partially shared layout */
  879. @@ -454,23 +468,20 @@ static void sprom_extract_r458(struct ss
  880. static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
  881. {
  882. - int i;
  883. - u16 v;
  884. u16 il0mac_offset;
  885. if (out->revision == 4)
  886. il0mac_offset = SSB_SPROM4_IL0MAC;
  887. else
  888. il0mac_offset = SSB_SPROM5_IL0MAC;
  889. - /* extract the MAC address */
  890. - for (i = 0; i < 3; i++) {
  891. - v = in[SPOFF(il0mac_offset) + i];
  892. - *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
  893. - }
  894. +
  895. + sprom_get_mac(out->il0mac, &in[SPOFF(il0mac_offset)]);
  896. +
  897. SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0);
  898. SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A,
  899. SSB_SPROM4_ETHPHY_ET1A_SHIFT);
  900. SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0);
  901. + SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
  902. if (out->revision == 4) {
  903. SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8);
  904. SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0);
  905. @@ -530,7 +541,7 @@ static void sprom_extract_r45(struct ssb
  906. static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
  907. {
  908. int i;
  909. - u16 v, o;
  910. + u16 o;
  911. u16 pwr_info_offset[] = {
  912. SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1,
  913. SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3
  914. @@ -539,11 +550,10 @@ static void sprom_extract_r8(struct ssb_
  915. ARRAY_SIZE(out->core_pwr_info));
  916. /* extract the MAC address */
  917. - for (i = 0; i < 3; i++) {
  918. - v = in[SPOFF(SSB_SPROM8_IL0MAC) + i];
  919. - *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
  920. - }
  921. + sprom_get_mac(out->il0mac, &in[SPOFF(SSB_SPROM8_IL0MAC)]);
  922. +
  923. SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0);
  924. + SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
  925. SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8);
  926. SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0);
  927. SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0);
  928. @@ -743,7 +753,7 @@ static int sprom_extract(struct ssb_bus
  929. memset(out, 0, sizeof(*out));
  930. out->revision = in[size - 1] & 0x00FF;
  931. - ssb_dprintk(KERN_DEBUG PFX "SPROM revision %d detected.\n", out->revision);
  932. + ssb_dbg("SPROM revision %d detected\n", out->revision);
  933. memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */
  934. memset(out->et1mac, 0xFF, 6);
  935. @@ -752,7 +762,7 @@ static int sprom_extract(struct ssb_bus
  936. * number stored in the SPROM.
  937. * Always extract r1. */
  938. out->revision = 1;
  939. - ssb_dprintk(KERN_DEBUG PFX "SPROM treated as revision %d\n", out->revision);
  940. + ssb_dbg("SPROM treated as revision %d\n", out->revision);
  941. }
  942. switch (out->revision) {
  943. @@ -769,9 +779,8 @@ static int sprom_extract(struct ssb_bus
  944. sprom_extract_r8(out, in);
  945. break;
  946. default:
  947. - ssb_printk(KERN_WARNING PFX "Unsupported SPROM"
  948. - " revision %d detected. Will extract"
  949. - " v1\n", out->revision);
  950. + ssb_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
  951. + out->revision);
  952. out->revision = 1;
  953. sprom_extract_r123(out, in);
  954. }
  955. @@ -791,7 +800,7 @@ static int ssb_pci_sprom_get(struct ssb_
  956. u16 *buf;
  957. if (!ssb_is_sprom_available(bus)) {
  958. - ssb_printk(KERN_ERR PFX "No SPROM available!\n");
  959. + ssb_err("No SPROM available!\n");
  960. return -ENODEV;
  961. }
  962. if (bus->chipco.dev) { /* can be unavailable! */
  963. @@ -810,7 +819,7 @@ static int ssb_pci_sprom_get(struct ssb_
  964. } else {
  965. bus->sprom_offset = SSB_SPROM_BASE1;
  966. }
  967. - ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset);
  968. + ssb_dbg("SPROM offset is 0x%x\n", bus->sprom_offset);
  969. buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
  970. if (!buf)
  971. @@ -835,18 +844,15 @@ static int ssb_pci_sprom_get(struct ssb_
  972. * available for this device in some other storage */
  973. err = ssb_fill_sprom_with_fallback(bus, sprom);
  974. if (err) {
  975. - ssb_printk(KERN_WARNING PFX "WARNING: Using"
  976. - " fallback SPROM failed (err %d)\n",
  977. - err);
  978. + ssb_warn("WARNING: Using fallback SPROM failed (err %d)\n",
  979. + err);
  980. } else {
  981. - ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
  982. - " revision %d provided by"
  983. - " platform.\n", sprom->revision);
  984. + ssb_dbg("Using SPROM revision %d provided by platform\n",
  985. + sprom->revision);
  986. err = 0;
  987. goto out_free;
  988. }
  989. - ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
  990. - " SPROM CRC (corrupt SPROM)\n");
  991. + ssb_warn("WARNING: Invalid SPROM CRC (corrupt SPROM)\n");
  992. }
  993. }
  994. err = sprom_extract(bus, sprom, buf, bus->sprom_size);
  995. --- a/drivers/ssb/pcihost_wrapper.c
  996. +++ b/drivers/ssb/pcihost_wrapper.c
  997. @@ -38,7 +38,7 @@ static int ssb_pcihost_resume(struct pci
  998. struct ssb_bus *ssb = pci_get_drvdata(dev);
  999. int err;
  1000. - pci_set_power_state(dev, 0);
  1001. + pci_set_power_state(dev, PCI_D0);
  1002. err = pci_enable_device(dev);
  1003. if (err)
  1004. return err;
  1005. --- a/drivers/ssb/pcmcia.c
  1006. +++ b/drivers/ssb/pcmcia.c
  1007. @@ -143,7 +143,7 @@ int ssb_pcmcia_switch_coreidx(struct ssb
  1008. return 0;
  1009. error:
  1010. - ssb_printk(KERN_ERR PFX "Failed to switch to core %u\n", coreidx);
  1011. + ssb_err("Failed to switch to core %u\n", coreidx);
  1012. return err;
  1013. }
  1014. @@ -153,10 +153,9 @@ int ssb_pcmcia_switch_core(struct ssb_bu
  1015. int err;
  1016. #if SSB_VERBOSE_PCMCIACORESWITCH_DEBUG
  1017. - ssb_printk(KERN_INFO PFX
  1018. - "Switching to %s core, index %d\n",
  1019. - ssb_core_name(dev->id.coreid),
  1020. - dev->core_index);
  1021. + ssb_info("Switching to %s core, index %d\n",
  1022. + ssb_core_name(dev->id.coreid),
  1023. + dev->core_index);
  1024. #endif
  1025. err = ssb_pcmcia_switch_coreidx(bus, dev->core_index);
  1026. @@ -192,7 +191,7 @@ int ssb_pcmcia_switch_segment(struct ssb
  1027. return 0;
  1028. error:
  1029. - ssb_printk(KERN_ERR PFX "Failed to switch pcmcia segment\n");
  1030. + ssb_err("Failed to switch pcmcia segment\n");
  1031. return err;
  1032. }
  1033. @@ -549,44 +548,39 @@ static int ssb_pcmcia_sprom_write_all(st
  1034. bool failed = 0;
  1035. size_t size = SSB_PCMCIA_SPROM_SIZE;
  1036. - ssb_printk(KERN_NOTICE PFX
  1037. - "Writing SPROM. Do NOT turn off the power! "
  1038. - "Please stand by...\n");
  1039. + ssb_notice("Writing SPROM. Do NOT turn off the power! Please stand by...\n");
  1040. err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEEN);
  1041. if (err) {
  1042. - ssb_printk(KERN_NOTICE PFX
  1043. - "Could not enable SPROM write access.\n");
  1044. + ssb_notice("Could not enable SPROM write access\n");
  1045. return -EBUSY;
  1046. }
  1047. - ssb_printk(KERN_NOTICE PFX "[ 0%%");
  1048. + ssb_notice("[ 0%%");
  1049. msleep(500);
  1050. for (i = 0; i < size; i++) {
  1051. if (i == size / 4)
  1052. - ssb_printk("25%%");
  1053. + ssb_cont("25%%");
  1054. else if (i == size / 2)
  1055. - ssb_printk("50%%");
  1056. + ssb_cont("50%%");
  1057. else if (i == (size * 3) / 4)
  1058. - ssb_printk("75%%");
  1059. + ssb_cont("75%%");
  1060. else if (i % 2)
  1061. - ssb_printk(".");
  1062. + ssb_cont(".");
  1063. err = ssb_pcmcia_sprom_write(bus, i, sprom[i]);
  1064. if (err) {
  1065. - ssb_printk(KERN_NOTICE PFX
  1066. - "Failed to write to SPROM.\n");
  1067. + ssb_notice("Failed to write to SPROM\n");
  1068. failed = 1;
  1069. break;
  1070. }
  1071. }
  1072. err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS);
  1073. if (err) {
  1074. - ssb_printk(KERN_NOTICE PFX
  1075. - "Could not disable SPROM write access.\n");
  1076. + ssb_notice("Could not disable SPROM write access\n");
  1077. failed = 1;
  1078. }
  1079. msleep(500);
  1080. if (!failed) {
  1081. - ssb_printk("100%% ]\n");
  1082. - ssb_printk(KERN_NOTICE PFX "SPROM written.\n");
  1083. + ssb_cont("100%% ]\n");
  1084. + ssb_notice("SPROM written\n");
  1085. }
  1086. return failed ? -EBUSY : 0;
  1087. @@ -700,7 +694,7 @@ static int ssb_pcmcia_do_get_invariants(
  1088. return -ENOSPC; /* continue with next entry */
  1089. error:
  1090. - ssb_printk(KERN_ERR PFX
  1091. + ssb_err(
  1092. "PCMCIA: Failed to fetch device invariants: %s\n",
  1093. error_description);
  1094. return -ENODEV;
  1095. @@ -722,7 +716,7 @@ int ssb_pcmcia_get_invariants(struct ssb
  1096. res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE,
  1097. ssb_pcmcia_get_mac, sprom);
  1098. if (res != 0) {
  1099. - ssb_printk(KERN_ERR PFX
  1100. + ssb_err(
  1101. "PCMCIA: Failed to fetch MAC address\n");
  1102. return -ENODEV;
  1103. }
  1104. @@ -733,7 +727,7 @@ int ssb_pcmcia_get_invariants(struct ssb
  1105. if ((res == 0) || (res == -ENOSPC))
  1106. return 0;
  1107. - ssb_printk(KERN_ERR PFX
  1108. + ssb_err(
  1109. "PCMCIA: Failed to fetch device invariants\n");
  1110. return -ENODEV;
  1111. }
  1112. @@ -843,6 +837,6 @@ int ssb_pcmcia_init(struct ssb_bus *bus)
  1113. return 0;
  1114. error:
  1115. - ssb_printk(KERN_ERR PFX "Failed to initialize PCMCIA host device\n");
  1116. + ssb_err("Failed to initialize PCMCIA host device\n");
  1117. return err;
  1118. }
  1119. --- a/drivers/ssb/scan.c
  1120. +++ b/drivers/ssb/scan.c
  1121. @@ -125,8 +125,7 @@ static u16 pcidev_to_chipid(struct pci_d
  1122. chipid_fallback = 0x4401;
  1123. break;
  1124. default:
  1125. - ssb_printk(KERN_ERR PFX
  1126. - "PCI-ID not in fallback list\n");
  1127. + ssb_err("PCI-ID not in fallback list\n");
  1128. }
  1129. return chipid_fallback;
  1130. @@ -152,8 +151,7 @@ static u8 chipid_to_nrcores(u16 chipid)
  1131. case 0x4704:
  1132. return 9;
  1133. default:
  1134. - ssb_printk(KERN_ERR PFX
  1135. - "CHIPID not in nrcores fallback list\n");
  1136. + ssb_err("CHIPID not in nrcores fallback list\n");
  1137. }
  1138. return 1;
  1139. @@ -320,15 +318,13 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1140. bus->chip_package = 0;
  1141. }
  1142. }
  1143. - ssb_printk(KERN_INFO PFX "Found chip with id 0x%04X, rev 0x%02X and "
  1144. - "package 0x%02X\n", bus->chip_id, bus->chip_rev,
  1145. - bus->chip_package);
  1146. + ssb_info("Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
  1147. + bus->chip_id, bus->chip_rev, bus->chip_package);
  1148. if (!bus->nr_devices)
  1149. bus->nr_devices = chipid_to_nrcores(bus->chip_id);
  1150. if (bus->nr_devices > ARRAY_SIZE(bus->devices)) {
  1151. - ssb_printk(KERN_ERR PFX
  1152. - "More than %d ssb cores found (%d)\n",
  1153. - SSB_MAX_NR_CORES, bus->nr_devices);
  1154. + ssb_err("More than %d ssb cores found (%d)\n",
  1155. + SSB_MAX_NR_CORES, bus->nr_devices);
  1156. goto err_unmap;
  1157. }
  1158. if (bus->bustype == SSB_BUSTYPE_SSB) {
  1159. @@ -370,8 +366,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1160. nr_80211_cores++;
  1161. if (nr_80211_cores > 1) {
  1162. if (!we_support_multiple_80211_cores(bus)) {
  1163. - ssb_dprintk(KERN_INFO PFX "Ignoring additional "
  1164. - "802.11 core\n");
  1165. + ssb_dbg("Ignoring additional 802.11 core\n");
  1166. continue;
  1167. }
  1168. }
  1169. @@ -379,8 +374,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1170. case SSB_DEV_EXTIF:
  1171. #ifdef CONFIG_SSB_DRIVER_EXTIF
  1172. if (bus->extif.dev) {
  1173. - ssb_printk(KERN_WARNING PFX
  1174. - "WARNING: Multiple EXTIFs found\n");
  1175. + ssb_warn("WARNING: Multiple EXTIFs found\n");
  1176. break;
  1177. }
  1178. bus->extif.dev = dev;
  1179. @@ -388,8 +382,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1180. break;
  1181. case SSB_DEV_CHIPCOMMON:
  1182. if (bus->chipco.dev) {
  1183. - ssb_printk(KERN_WARNING PFX
  1184. - "WARNING: Multiple ChipCommon found\n");
  1185. + ssb_warn("WARNING: Multiple ChipCommon found\n");
  1186. break;
  1187. }
  1188. bus->chipco.dev = dev;
  1189. @@ -398,8 +391,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1190. case SSB_DEV_MIPS_3302:
  1191. #ifdef CONFIG_SSB_DRIVER_MIPS
  1192. if (bus->mipscore.dev) {
  1193. - ssb_printk(KERN_WARNING PFX
  1194. - "WARNING: Multiple MIPS cores found\n");
  1195. + ssb_warn("WARNING: Multiple MIPS cores found\n");
  1196. break;
  1197. }
  1198. bus->mipscore.dev = dev;
  1199. @@ -420,8 +412,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
  1200. }
  1201. }
  1202. if (bus->pcicore.dev) {
  1203. - ssb_printk(KERN_WARNING PFX
  1204. - "WARNING: Multiple PCI(E) cores found\n");
  1205. + ssb_warn("WARNING: Multiple PCI(E) cores found\n");
  1206. break;
  1207. }
  1208. bus->pcicore.dev = dev;
  1209. --- a/drivers/ssb/sprom.c
  1210. +++ b/drivers/ssb/sprom.c
  1211. @@ -54,7 +54,7 @@ static int hex2sprom(u16 *sprom, const c
  1212. while (cnt < sprom_size_words) {
  1213. memcpy(tmp, dump, 4);
  1214. dump += 4;
  1215. - err = strict_strtoul(tmp, 16, &parsed);
  1216. + err = kstrtoul(tmp, 16, &parsed);
  1217. if (err)
  1218. return err;
  1219. sprom[cnt++] = swab16((u16)parsed);
  1220. @@ -127,13 +127,13 @@ ssize_t ssb_attr_sprom_store(struct ssb_
  1221. goto out_kfree;
  1222. err = ssb_devices_freeze(bus, &freeze);
  1223. if (err) {
  1224. - ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze all devices\n");
  1225. + ssb_err("SPROM write: Could not freeze all devices\n");
  1226. goto out_unlock;
  1227. }
  1228. res = sprom_write(bus, sprom);
  1229. err = ssb_devices_thaw(&freeze);
  1230. if (err)
  1231. - ssb_printk(KERN_ERR PFX "SPROM write: Could not thaw all devices\n");
  1232. + ssb_err("SPROM write: Could not thaw all devices\n");
  1233. out_unlock:
  1234. mutex_unlock(&bus->sprom_mutex);
  1235. out_kfree:
  1236. --- a/drivers/ssb/ssb_private.h
  1237. +++ b/drivers/ssb/ssb_private.h
  1238. @@ -9,16 +9,27 @@
  1239. #define PFX "ssb: "
  1240. #ifdef CONFIG_SSB_SILENT
  1241. -# define ssb_printk(fmt, x...) do { /* nothing */ } while (0)
  1242. +# define ssb_printk(fmt, ...) \
  1243. + do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
  1244. #else
  1245. -# define ssb_printk printk
  1246. +# define ssb_printk(fmt, ...) \
  1247. + printk(fmt, ##__VA_ARGS__)
  1248. #endif /* CONFIG_SSB_SILENT */
  1249. +#define ssb_emerg(fmt, ...) ssb_printk(KERN_EMERG PFX fmt, ##__VA_ARGS__)
  1250. +#define ssb_err(fmt, ...) ssb_printk(KERN_ERR PFX fmt, ##__VA_ARGS__)
  1251. +#define ssb_warn(fmt, ...) ssb_printk(KERN_WARNING PFX fmt, ##__VA_ARGS__)
  1252. +#define ssb_notice(fmt, ...) ssb_printk(KERN_NOTICE PFX fmt, ##__VA_ARGS__)
  1253. +#define ssb_info(fmt, ...) ssb_printk(KERN_INFO PFX fmt, ##__VA_ARGS__)
  1254. +#define ssb_cont(fmt, ...) ssb_printk(KERN_CONT fmt, ##__VA_ARGS__)
  1255. +
  1256. /* dprintk: Debugging printk; vanishes for non-debug compilation */
  1257. #ifdef CONFIG_SSB_DEBUG
  1258. -# define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x)
  1259. +# define ssb_dbg(fmt, ...) \
  1260. + ssb_printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__)
  1261. #else
  1262. -# define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0)
  1263. +# define ssb_dbg(fmt, ...) \
  1264. + do { if (0) printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__); } while (0)
  1265. #endif
  1266. #ifdef CONFIG_SSB_DEBUG
  1267. @@ -217,6 +228,25 @@ extern u32 ssb_chipco_watchdog_timer_set
  1268. u32 ticks);
  1269. extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
  1270. +/* driver_chipcommon_sflash.c */
  1271. +#ifdef CONFIG_SSB_SFLASH
  1272. +int ssb_sflash_init(struct ssb_chipcommon *cc);
  1273. +#else
  1274. +static inline int ssb_sflash_init(struct ssb_chipcommon *cc)
  1275. +{
  1276. + pr_err("Serial flash not supported\n");
  1277. + return 0;
  1278. +}
  1279. +#endif /* CONFIG_SSB_SFLASH */
  1280. +
  1281. +#ifdef CONFIG_SSB_DRIVER_MIPS
  1282. +extern struct platform_device ssb_pflash_dev;
  1283. +#endif
  1284. +
  1285. +#ifdef CONFIG_SSB_SFLASH
  1286. +extern struct platform_device ssb_sflash_dev;
  1287. +#endif
  1288. +
  1289. #ifdef CONFIG_SSB_DRIVER_EXTIF
  1290. extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks);
  1291. extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
  1292. --- a/include/linux/ssb/ssb.h
  1293. +++ b/include/linux/ssb/ssb.h
  1294. @@ -26,13 +26,14 @@ struct ssb_sprom_core_pwr_info {
  1295. struct ssb_sprom {
  1296. u8 revision;
  1297. - u8 il0mac[6]; /* MAC address for 802.11b/g */
  1298. - u8 et0mac[6]; /* MAC address for Ethernet */
  1299. - u8 et1mac[6]; /* MAC address for 802.11a */
  1300. + u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */
  1301. + u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */
  1302. + u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */
  1303. u8 et0phyaddr; /* MII address for enet0 */
  1304. u8 et1phyaddr; /* MII address for enet1 */
  1305. u8 et0mdcport; /* MDIO for enet0 */
  1306. u8 et1mdcport; /* MDIO for enet1 */
  1307. + u16 dev_id; /* Device ID overriding e.g. PCI ID */
  1308. u16 board_rev; /* Board revision number from SPROM. */
  1309. u16 board_num; /* Board number from SPROM. */
  1310. u16 board_type; /* Board type from SPROM. */
  1311. @@ -340,13 +341,61 @@ enum ssb_bustype {
  1312. #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */
  1313. #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */
  1314. /* board_type */
  1315. +#define SSB_BOARD_BCM94301CB 0x0406
  1316. +#define SSB_BOARD_BCM94301MP 0x0407
  1317. +#define SSB_BOARD_BU4309 0x040A
  1318. +#define SSB_BOARD_BCM94309CB 0x040B
  1319. +#define SSB_BOARD_BCM4309MP 0x040C
  1320. +#define SSB_BOARD_BU4306 0x0416
  1321. #define SSB_BOARD_BCM94306MP 0x0418
  1322. #define SSB_BOARD_BCM4309G 0x0421
  1323. #define SSB_BOARD_BCM4306CB 0x0417
  1324. -#define SSB_BOARD_BCM4309MP 0x040C
  1325. +#define SSB_BOARD_BCM94306PC 0x0425 /* pcmcia 3.3v 4306 card */
  1326. +#define SSB_BOARD_BCM94306CBSG 0x042B /* with SiGe PA */
  1327. +#define SSB_BOARD_PCSG94306 0x042D /* with SiGe PA */
  1328. +#define SSB_BOARD_BU4704SD 0x042E /* with sdram */
  1329. +#define SSB_BOARD_BCM94704AGR 0x042F /* dual 11a/11g Router */
  1330. +#define SSB_BOARD_BCM94308MP 0x0430 /* 11a-only minipci */
  1331. +#define SSB_BOARD_BU4318 0x0447
  1332. +#define SSB_BOARD_CB4318 0x0448
  1333. +#define SSB_BOARD_MPG4318 0x0449
  1334. #define SSB_BOARD_MP4318 0x044A
  1335. -#define SSB_BOARD_BU4306 0x0416
  1336. -#define SSB_BOARD_BU4309 0x040A
  1337. +#define SSB_BOARD_SD4318 0x044B
  1338. +#define SSB_BOARD_BCM94306P 0x044C /* with SiGe */
  1339. +#define SSB_BOARD_BCM94303MP 0x044E
  1340. +#define SSB_BOARD_BCM94306MPM 0x0450
  1341. +#define SSB_BOARD_BCM94306MPL 0x0453
  1342. +#define SSB_BOARD_PC4303 0x0454 /* pcmcia */
  1343. +#define SSB_BOARD_BCM94306MPLNA 0x0457
  1344. +#define SSB_BOARD_BCM94306MPH 0x045B
  1345. +#define SSB_BOARD_BCM94306PCIV 0x045C
  1346. +#define SSB_BOARD_BCM94318MPGH 0x0463
  1347. +#define SSB_BOARD_BU4311 0x0464
  1348. +#define SSB_BOARD_BCM94311MC 0x0465
  1349. +#define SSB_BOARD_BCM94311MCAG 0x0466
  1350. +/* 4321 boards */
  1351. +#define SSB_BOARD_BU4321 0x046B
  1352. +#define SSB_BOARD_BU4321E 0x047C
  1353. +#define SSB_BOARD_MP4321 0x046C
  1354. +#define SSB_BOARD_CB2_4321 0x046D
  1355. +#define SSB_BOARD_CB2_4321_AG 0x0066
  1356. +#define SSB_BOARD_MC4321 0x046E
  1357. +/* 4325 boards */
  1358. +#define SSB_BOARD_BCM94325DEVBU 0x0490
  1359. +#define SSB_BOARD_BCM94325BGABU 0x0491
  1360. +#define SSB_BOARD_BCM94325SDGWB 0x0492
  1361. +#define SSB_BOARD_BCM94325SDGMDL 0x04AA
  1362. +#define SSB_BOARD_BCM94325SDGMDL2 0x04C6
  1363. +#define SSB_BOARD_BCM94325SDGMDL3 0x04C9
  1364. +#define SSB_BOARD_BCM94325SDABGWBA 0x04E1
  1365. +/* 4322 boards */
  1366. +#define SSB_BOARD_BCM94322MC 0x04A4
  1367. +#define SSB_BOARD_BCM94322USB 0x04A8 /* dualband */
  1368. +#define SSB_BOARD_BCM94322HM 0x04B0
  1369. +#define SSB_BOARD_BCM94322USB2D 0x04Bf /* single band discrete front end */
  1370. +/* 4312 boards */
  1371. +#define SSB_BOARD_BU4312 0x048A
  1372. +#define SSB_BOARD_BCM4312MCGSG 0x04B5
  1373. /* chip_package */
  1374. #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */
  1375. #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */
  1376. --- a/include/linux/ssb/ssb_driver_gige.h
  1377. +++ b/include/linux/ssb/ssb_driver_gige.h
  1378. @@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_p
  1379. return 0;
  1380. }
  1381. -#ifdef CONFIG_BCM47XX
  1382. -#include <asm/mach-bcm47xx/nvram.h>
  1383. /* Get the device MAC address */
  1384. -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
  1385. -{
  1386. - char buf[20];
  1387. - if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
  1388. - return;
  1389. - nvram_parse_macaddr(buf, macaddr);
  1390. -}
  1391. -#else
  1392. -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
  1393. +static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
  1394. {
  1395. + struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
  1396. + if (!dev)
  1397. + return -ENODEV;
  1398. +
  1399. + memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6);
  1400. + return 0;
  1401. }
  1402. -#endif
  1403. extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
  1404. struct pci_dev *pdev);
  1405. @@ -175,6 +170,10 @@ static inline bool ssb_gige_must_flush_p
  1406. {
  1407. return 0;
  1408. }
  1409. +static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
  1410. +{
  1411. + return -ENODEV;
  1412. +}
  1413. #endif /* CONFIG_SSB_DRIVER_GIGE */
  1414. #endif /* LINUX_SSB_DRIVER_GIGE_H_ */
  1415. --- a/include/linux/ssb/ssb_driver_mips.h
  1416. +++ b/include/linux/ssb/ssb_driver_mips.h
  1417. @@ -20,6 +20,18 @@ struct ssb_pflash {
  1418. u32 window_size;
  1419. };
  1420. +#ifdef CONFIG_SSB_SFLASH
  1421. +struct ssb_sflash {
  1422. + bool present;
  1423. + u32 window;
  1424. + u32 blocksize;
  1425. + u16 numblocks;
  1426. + u32 size;
  1427. +
  1428. + void *priv;
  1429. +};
  1430. +#endif
  1431. +
  1432. struct ssb_mipscore {
  1433. struct ssb_device *dev;
  1434. @@ -27,6 +39,9 @@ struct ssb_mipscore {
  1435. struct ssb_serial_port serial_ports[4];
  1436. struct ssb_pflash pflash;
  1437. +#ifdef CONFIG_SSB_SFLASH
  1438. + struct ssb_sflash sflash;
  1439. +#endif
  1440. };
  1441. extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
  1442. @@ -45,6 +60,11 @@ void ssb_mipscore_init(struct ssb_mipsco
  1443. {
  1444. }
  1445. +static inline unsigned int ssb_mips_irq(struct ssb_device *dev)
  1446. +{
  1447. + return 0;
  1448. +}
  1449. +
  1450. #endif /* CONFIG_SSB_DRIVER_MIPS */
  1451. #endif /* LINUX_SSB_MIPSCORE_H_ */
  1452. --- a/include/linux/ssb/ssb_regs.h
  1453. +++ b/include/linux/ssb/ssb_regs.h
  1454. @@ -172,6 +172,7 @@
  1455. #define SSB_SPROMSIZE_WORDS_R4 220
  1456. #define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
  1457. #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
  1458. +#define SSB_SPROMSIZE_WORDS_R10 230
  1459. #define SSB_SPROM_BASE1 0x1000
  1460. #define SSB_SPROM_BASE31 0x0800
  1461. #define SSB_SPROM_REVISION 0x007E
  1462. @@ -289,11 +290,11 @@
  1463. #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
  1464. #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
  1465. #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
  1466. -#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */
  1467. -#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
  1468. -#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
  1469. -#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
  1470. -#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
  1471. +#define SSB_SPROM4_ANTAVAIL 0x005C /* Antenna available bitfields */
  1472. +#define SSB_SPROM4_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
  1473. +#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 0
  1474. +#define SSB_SPROM4_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
  1475. +#define SSB_SPROM4_ANTAVAIL_A_SHIFT 8
  1476. #define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
  1477. #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
  1478. #define SSB_SPROM4_AGAIN0_SHIFT 0
  1479. --- a/arch/mips/bcm47xx/sprom.c
  1480. +++ b/arch/mips/bcm47xx/sprom.c
  1481. @@ -168,6 +168,7 @@ static void nvram_read_alpha2(const char
  1482. static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
  1483. const char *prefix, bool fallback)
  1484. {
  1485. + nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback);
  1486. nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff, fallback);
  1487. nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff, fallback);
  1488. nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff, fallback);