025-bcma_backport.patch 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. --- a/drivers/bcma/Kconfig
  2. +++ b/drivers/bcma/Kconfig
  3. @@ -65,6 +65,14 @@ config BCMA_DRIVER_GMAC_CMN
  4. If unsure, say N
  5. +config BCMA_DRIVER_GPIO
  6. + bool "BCMA GPIO driver"
  7. + depends on BCMA && GPIOLIB
  8. + help
  9. + Driver to provide access to the GPIO pins of the bcma bus.
  10. +
  11. + If unsure, say N
  12. +
  13. config BCMA_DEBUG
  14. bool "BCMA debugging"
  15. depends on BCMA
  16. --- a/drivers/bcma/Makefile
  17. +++ b/drivers/bcma/Makefile
  18. @@ -6,6 +6,7 @@ bcma-y += driver_pci.o
  19. bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o
  20. bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
  21. bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
  22. +bcma-$(CONFIG_BCMA_DRIVER_GPIO) += driver_gpio.o
  23. bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
  24. bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o
  25. obj-$(CONFIG_BCMA) += bcma.o
  26. --- a/drivers/bcma/bcma_private.h
  27. +++ b/drivers/bcma/bcma_private.h
  28. @@ -31,6 +31,8 @@ int __init bcma_bus_early_register(struc
  29. int bcma_bus_suspend(struct bcma_bus *bus);
  30. int bcma_bus_resume(struct bcma_bus *bus);
  31. #endif
  32. +struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
  33. + u8 unit);
  34. /* scan.c */
  35. int bcma_bus_scan(struct bcma_bus *bus);
  36. @@ -48,8 +50,8 @@ void bcma_chipco_serial_init(struct bcma
  37. #endif /* CONFIG_BCMA_DRIVER_MIPS */
  38. /* driver_chipcommon_pmu.c */
  39. -u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc);
  40. -u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc);
  41. +u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
  42. +u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
  43. #ifdef CONFIG_BCMA_SFLASH
  44. /* driver_chipcommon_sflash.c */
  45. @@ -84,9 +86,21 @@ extern void __exit bcma_host_pci_exit(vo
  46. /* driver_pci.c */
  47. u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
  48. +extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
  49. +
  50. #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
  51. bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
  52. void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
  53. #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
  54. +#ifdef CONFIG_BCMA_DRIVER_GPIO
  55. +/* driver_gpio.c */
  56. +int bcma_gpio_init(struct bcma_drv_cc *cc);
  57. +#else
  58. +static inline int bcma_gpio_init(struct bcma_drv_cc *cc)
  59. +{
  60. + return -ENOTSUPP;
  61. +}
  62. +#endif /* CONFIG_BCMA_DRIVER_GPIO */
  63. +
  64. #endif
  65. --- a/drivers/bcma/driver_chipcommon.c
  66. +++ b/drivers/bcma/driver_chipcommon.c
  67. @@ -4,12 +4,15 @@
  68. *
  69. * Copyright 2005, Broadcom Corporation
  70. * Copyright 2006, 2007, Michael Buesch <[email protected]>
  71. + * Copyright 2012, Hauke Mehrtens <[email protected]>
  72. *
  73. * Licensed under the GNU/GPL. See COPYING for details.
  74. */
  75. #include "bcma_private.h"
  76. +#include <linux/bcm47xx_wdt.h>
  77. #include <linux/export.h>
  78. +#include <linux/platform_device.h>
  79. #include <linux/bcma/bcma.h>
  80. static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
  81. @@ -22,20 +25,120 @@ static inline u32 bcma_cc_write32_masked
  82. return value;
  83. }
  84. -void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
  85. +u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc)
  86. {
  87. - u32 leddc_on = 10;
  88. - u32 leddc_off = 90;
  89. + if (cc->capabilities & BCMA_CC_CAP_PMU)
  90. + return bcma_pmu_get_alp_clock(cc);
  91. - if (cc->setup_done)
  92. + return 20000000;
  93. +}
  94. +EXPORT_SYMBOL_GPL(bcma_chipco_get_alp_clock);
  95. +
  96. +static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
  97. +{
  98. + struct bcma_bus *bus = cc->core->bus;
  99. + u32 nb;
  100. +
  101. + if (cc->capabilities & BCMA_CC_CAP_PMU) {
  102. + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
  103. + nb = 32;
  104. + else if (cc->core->id.rev < 26)
  105. + nb = 16;
  106. + else
  107. + nb = (cc->core->id.rev >= 37) ? 32 : 24;
  108. + } else {
  109. + nb = 28;
  110. + }
  111. + if (nb == 32)
  112. + return 0xffffffff;
  113. + else
  114. + return (1 << nb) - 1;
  115. +}
  116. +
  117. +static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
  118. + u32 ticks)
  119. +{
  120. + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
  121. +
  122. + return bcma_chipco_watchdog_timer_set(cc, ticks);
  123. +}
  124. +
  125. +static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt,
  126. + u32 ms)
  127. +{
  128. + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
  129. + u32 ticks;
  130. +
  131. + ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms);
  132. + return ticks / cc->ticks_per_ms;
  133. +}
  134. +
  135. +static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
  136. +{
  137. + struct bcma_bus *bus = cc->core->bus;
  138. +
  139. + if (cc->capabilities & BCMA_CC_CAP_PMU) {
  140. + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
  141. + /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */
  142. + return bcma_chipco_get_alp_clock(cc) / 4000;
  143. + else
  144. + /* based on 32KHz ILP clock */
  145. + return 32;
  146. + } else {
  147. + return bcma_chipco_get_alp_clock(cc) / 1000;
  148. + }
  149. +}
  150. +
  151. +int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)
  152. +{
  153. + struct bcm47xx_wdt wdt = {};
  154. + struct platform_device *pdev;
  155. +
  156. + wdt.driver_data = cc;
  157. + wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
  158. + wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
  159. + wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
  160. +
  161. + pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
  162. + cc->core->bus->num, &wdt,
  163. + sizeof(wdt));
  164. + if (IS_ERR(pdev))
  165. + return PTR_ERR(pdev);
  166. +
  167. + cc->watchdog = pdev;
  168. +
  169. + return 0;
  170. +}
  171. +
  172. +void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
  173. +{
  174. + if (cc->early_setup_done)
  175. return;
  176. + spin_lock_init(&cc->gpio_lock);
  177. +
  178. if (cc->core->id.rev >= 11)
  179. cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
  180. cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP);
  181. if (cc->core->id.rev >= 35)
  182. cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
  183. + if (cc->capabilities & BCMA_CC_CAP_PMU)
  184. + bcma_pmu_early_init(cc);
  185. +
  186. + cc->early_setup_done = true;
  187. +}
  188. +
  189. +void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
  190. +{
  191. + u32 leddc_on = 10;
  192. + u32 leddc_off = 90;
  193. +
  194. + if (cc->setup_done)
  195. + return;
  196. +
  197. + bcma_core_chipcommon_early_init(cc);
  198. +
  199. if (cc->core->id.rev >= 20) {
  200. bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
  201. bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
  202. @@ -56,15 +159,33 @@ void bcma_core_chipcommon_init(struct bc
  203. ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) |
  204. (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT)));
  205. }
  206. + cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc);
  207. cc->setup_done = true;
  208. }
  209. /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
  210. -void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
  211. +u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
  212. {
  213. - /* instant NMI */
  214. - bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks);
  215. + u32 maxt;
  216. + enum bcma_clkmode clkmode;
  217. +
  218. + maxt = bcma_chipco_watchdog_get_max_timer(cc);
  219. + if (cc->capabilities & BCMA_CC_CAP_PMU) {
  220. + if (ticks == 1)
  221. + ticks = 2;
  222. + else if (ticks > maxt)
  223. + ticks = maxt;
  224. + bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
  225. + } else {
  226. + clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC;
  227. + bcma_core_set_clockmode(cc->core, clkmode);
  228. + if (ticks > maxt)
  229. + ticks = maxt;
  230. + /* instant NMI */
  231. + bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks);
  232. + }
  233. + return ticks;
  234. }
  235. void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value)
  236. @@ -84,28 +205,99 @@ u32 bcma_chipco_gpio_in(struct bcma_drv_
  237. u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value)
  238. {
  239. - return bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUT, mask, value);
  240. + unsigned long flags;
  241. + u32 res;
  242. +
  243. + spin_lock_irqsave(&cc->gpio_lock, flags);
  244. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUT, mask, value);
  245. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  246. +
  247. + return res;
  248. }
  249. +EXPORT_SYMBOL_GPL(bcma_chipco_gpio_out);
  250. u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value)
  251. {
  252. - return bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUTEN, mask, value);
  253. + unsigned long flags;
  254. + u32 res;
  255. +
  256. + spin_lock_irqsave(&cc->gpio_lock, flags);
  257. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOOUTEN, mask, value);
  258. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  259. +
  260. + return res;
  261. }
  262. +EXPORT_SYMBOL_GPL(bcma_chipco_gpio_outen);
  263. +/*
  264. + * If the bit is set to 0, chipcommon controlls this GPIO,
  265. + * if the bit is set to 1, it is used by some part of the chip and not our code.
  266. + */
  267. u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value)
  268. {
  269. - return bcma_cc_write32_masked(cc, BCMA_CC_GPIOCTL, mask, value);
  270. + unsigned long flags;
  271. + u32 res;
  272. +
  273. + spin_lock_irqsave(&cc->gpio_lock, flags);
  274. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOCTL, mask, value);
  275. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  276. +
  277. + return res;
  278. }
  279. EXPORT_SYMBOL_GPL(bcma_chipco_gpio_control);
  280. u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value)
  281. {
  282. - return bcma_cc_write32_masked(cc, BCMA_CC_GPIOIRQ, mask, value);
  283. + unsigned long flags;
  284. + u32 res;
  285. +
  286. + spin_lock_irqsave(&cc->gpio_lock, flags);
  287. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOIRQ, mask, value);
  288. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  289. +
  290. + return res;
  291. }
  292. u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value)
  293. {
  294. - return bcma_cc_write32_masked(cc, BCMA_CC_GPIOPOL, mask, value);
  295. + unsigned long flags;
  296. + u32 res;
  297. +
  298. + spin_lock_irqsave(&cc->gpio_lock, flags);
  299. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOPOL, mask, value);
  300. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  301. +
  302. + return res;
  303. +}
  304. +
  305. +u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value)
  306. +{
  307. + unsigned long flags;
  308. + u32 res;
  309. +
  310. + if (cc->core->id.rev < 20)
  311. + return 0;
  312. +
  313. + spin_lock_irqsave(&cc->gpio_lock, flags);
  314. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOPULLUP, mask, value);
  315. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  316. +
  317. + return res;
  318. +}
  319. +
  320. +u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value)
  321. +{
  322. + unsigned long flags;
  323. + u32 res;
  324. +
  325. + if (cc->core->id.rev < 20)
  326. + return 0;
  327. +
  328. + spin_lock_irqsave(&cc->gpio_lock, flags);
  329. + res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOPULLDOWN, mask, value);
  330. + spin_unlock_irqrestore(&cc->gpio_lock, flags);
  331. +
  332. + return res;
  333. }
  334. #ifdef CONFIG_BCMA_DRIVER_MIPS
  335. @@ -118,8 +310,7 @@ void bcma_chipco_serial_init(struct bcma
  336. struct bcma_serial_port *ports = cc->serial_ports;
  337. if (ccrev >= 11 && ccrev != 15) {
  338. - /* Fixed ALP clock */
  339. - baud_base = bcma_pmu_alp_clock(cc);
  340. + baud_base = bcma_chipco_get_alp_clock(cc);
  341. if (ccrev >= 21) {
  342. /* Turn off UART clock before switching clocksource. */
  343. bcma_cc_write32(cc, BCMA_CC_CORECTL,
  344. --- a/drivers/bcma/driver_chipcommon_nflash.c
  345. +++ b/drivers/bcma/driver_chipcommon_nflash.c
  346. @@ -32,6 +32,9 @@ int bcma_nflash_init(struct bcma_drv_cc
  347. }
  348. cc->nflash.present = true;
  349. + if (cc->core->id.rev == 38 &&
  350. + (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT))
  351. + cc->nflash.boot = true;
  352. /* Prepare platform device, but don't register it yet. It's too early,
  353. * malloc (required by device_private_init) is not available yet. */
  354. --- a/drivers/bcma/driver_chipcommon_pmu.c
  355. +++ b/drivers/bcma/driver_chipcommon_pmu.c
  356. @@ -13,12 +13,13 @@
  357. #include <linux/export.h>
  358. #include <linux/bcma/bcma.h>
  359. -static u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
  360. +u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
  361. {
  362. bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  363. bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  364. return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  365. }
  366. +EXPORT_SYMBOL_GPL(bcma_chipco_pll_read);
  367. void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value)
  368. {
  369. @@ -144,7 +145,7 @@ static void bcma_pmu_workarounds(struct
  370. }
  371. }
  372. -void bcma_pmu_init(struct bcma_drv_cc *cc)
  373. +void bcma_pmu_early_init(struct bcma_drv_cc *cc)
  374. {
  375. u32 pmucap;
  376. @@ -153,7 +154,10 @@ void bcma_pmu_init(struct bcma_drv_cc *c
  377. bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
  378. cc->pmu.rev, pmucap);
  379. +}
  380. +void bcma_pmu_init(struct bcma_drv_cc *cc)
  381. +{
  382. if (cc->pmu.rev == 1)
  383. bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
  384. ~BCMA_CC_PMU_CTL_NOILPONW);
  385. @@ -165,24 +169,40 @@ void bcma_pmu_init(struct bcma_drv_cc *c
  386. bcma_pmu_workarounds(cc);
  387. }
  388. -u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc)
  389. +u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc)
  390. {
  391. struct bcma_bus *bus = cc->core->bus;
  392. switch (bus->chipinfo.id) {
  393. + case BCMA_CHIP_ID_BCM4313:
  394. + case BCMA_CHIP_ID_BCM43224:
  395. + case BCMA_CHIP_ID_BCM43225:
  396. + case BCMA_CHIP_ID_BCM43227:
  397. + case BCMA_CHIP_ID_BCM43228:
  398. + case BCMA_CHIP_ID_BCM4331:
  399. + case BCMA_CHIP_ID_BCM43421:
  400. + case BCMA_CHIP_ID_BCM43428:
  401. + case BCMA_CHIP_ID_BCM43431:
  402. case BCMA_CHIP_ID_BCM4716:
  403. - case BCMA_CHIP_ID_BCM4748:
  404. case BCMA_CHIP_ID_BCM47162:
  405. - case BCMA_CHIP_ID_BCM4313:
  406. - case BCMA_CHIP_ID_BCM5357:
  407. + case BCMA_CHIP_ID_BCM4748:
  408. case BCMA_CHIP_ID_BCM4749:
  409. + case BCMA_CHIP_ID_BCM5357:
  410. case BCMA_CHIP_ID_BCM53572:
  411. + case BCMA_CHIP_ID_BCM6362:
  412. /* always 20Mhz */
  413. return 20000 * 1000;
  414. - case BCMA_CHIP_ID_BCM5356:
  415. case BCMA_CHIP_ID_BCM4706:
  416. + case BCMA_CHIP_ID_BCM5356:
  417. /* always 25Mhz */
  418. return 25000 * 1000;
  419. + case BCMA_CHIP_ID_BCM43460:
  420. + case BCMA_CHIP_ID_BCM4352:
  421. + case BCMA_CHIP_ID_BCM4360:
  422. + if (cc->status & BCMA_CC_CHIPST_4360_XTAL_40MZ)
  423. + return 40000 * 1000;
  424. + else
  425. + return 20000 * 1000;
  426. default:
  427. bcma_warn(bus, "No ALP clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
  428. bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK);
  429. @@ -193,7 +213,7 @@ u32 bcma_pmu_alp_clock(struct bcma_drv_c
  430. /* Find the output of the "m" pll divider given pll controls that start with
  431. * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc.
  432. */
  433. -static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
  434. +static u32 bcma_pmu_pll_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
  435. {
  436. u32 tmp, div, ndiv, p1, p2, fc;
  437. struct bcma_bus *bus = cc->core->bus;
  438. @@ -222,14 +242,14 @@ static u32 bcma_pmu_clock(struct bcma_dr
  439. ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT;
  440. /* Do calculation in Mhz */
  441. - fc = bcma_pmu_alp_clock(cc) / 1000000;
  442. + fc = bcma_pmu_get_alp_clock(cc) / 1000000;
  443. fc = (p1 * ndiv * fc) / p2;
  444. /* Return clock in Hertz */
  445. return (fc / div) * 1000000;
  446. }
  447. -static u32 bcma_pmu_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m)
  448. +static u32 bcma_pmu_pll_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m)
  449. {
  450. u32 tmp, ndiv, p1div, p2div;
  451. u32 clock;
  452. @@ -260,7 +280,7 @@ static u32 bcma_pmu_clock_bcm4706(struct
  453. }
  454. /* query bus clock frequency for PMU-enabled chipcommon */
  455. -static u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
  456. +static u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc)
  457. {
  458. struct bcma_bus *bus = cc->core->bus;
  459. @@ -268,40 +288,42 @@ static u32 bcma_pmu_get_clockcontrol(str
  460. case BCMA_CHIP_ID_BCM4716:
  461. case BCMA_CHIP_ID_BCM4748:
  462. case BCMA_CHIP_ID_BCM47162:
  463. - return bcma_pmu_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
  464. - BCMA_CC_PMU5_MAINPLL_SSB);
  465. + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
  466. + BCMA_CC_PMU5_MAINPLL_SSB);
  467. case BCMA_CHIP_ID_BCM5356:
  468. - return bcma_pmu_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
  469. - BCMA_CC_PMU5_MAINPLL_SSB);
  470. + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
  471. + BCMA_CC_PMU5_MAINPLL_SSB);
  472. case BCMA_CHIP_ID_BCM5357:
  473. case BCMA_CHIP_ID_BCM4749:
  474. - return bcma_pmu_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
  475. - BCMA_CC_PMU5_MAINPLL_SSB);
  476. + return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
  477. + BCMA_CC_PMU5_MAINPLL_SSB);
  478. case BCMA_CHIP_ID_BCM4706:
  479. - return bcma_pmu_clock_bcm4706(cc, BCMA_CC_PMU4706_MAINPLL_PLL0,
  480. - BCMA_CC_PMU5_MAINPLL_SSB);
  481. + return bcma_pmu_pll_clock_bcm4706(cc,
  482. + BCMA_CC_PMU4706_MAINPLL_PLL0,
  483. + BCMA_CC_PMU5_MAINPLL_SSB);
  484. case BCMA_CHIP_ID_BCM53572:
  485. return 75000000;
  486. default:
  487. - bcma_warn(bus, "No backplane clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
  488. + bcma_warn(bus, "No bus clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
  489. bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK);
  490. }
  491. return BCMA_CC_PMU_HT_CLOCK;
  492. }
  493. /* query cpu clock frequency for PMU-enabled chipcommon */
  494. -u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)
  495. +u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc)
  496. {
  497. struct bcma_bus *bus = cc->core->bus;
  498. if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572)
  499. return 300000000;
  500. + /* New PMUs can have different clock for bus and CPU */
  501. if (cc->pmu.rev >= 5) {
  502. u32 pll;
  503. switch (bus->chipinfo.id) {
  504. case BCMA_CHIP_ID_BCM4706:
  505. - return bcma_pmu_clock_bcm4706(cc,
  506. + return bcma_pmu_pll_clock_bcm4706(cc,
  507. BCMA_CC_PMU4706_MAINPLL_PLL0,
  508. BCMA_CC_PMU5_MAINPLL_CPU);
  509. case BCMA_CHIP_ID_BCM5356:
  510. @@ -316,10 +338,11 @@ u32 bcma_pmu_get_clockcpu(struct bcma_dr
  511. break;
  512. }
  513. - return bcma_pmu_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
  514. + return bcma_pmu_pll_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
  515. }
  516. - return bcma_pmu_get_clockcontrol(cc);
  517. + /* On old PMUs CPU has the same clock as the bus */
  518. + return bcma_pmu_get_bus_clock(cc);
  519. }
  520. static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset,
  521. @@ -365,7 +388,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  522. tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT;
  523. bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
  524. - tmp = 1 << 10;
  525. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  526. break;
  527. case BCMA_CHIP_ID_BCM4331:
  528. @@ -386,7 +409,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  529. bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
  530. 0x03000a08);
  531. }
  532. - tmp = 1 << 10;
  533. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  534. break;
  535. case BCMA_CHIP_ID_BCM43224:
  536. @@ -419,7 +442,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  537. bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
  538. 0x88888815);
  539. }
  540. - tmp = 1 << 10;
  541. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  542. break;
  543. case BCMA_CHIP_ID_BCM4716:
  544. @@ -453,7 +476,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  545. 0x88888815);
  546. }
  547. - tmp = 3 << 9;
  548. + tmp = BCMA_CC_PMU_CTL_PLL_UPD | BCMA_CC_PMU_CTL_NOILPONW;
  549. break;
  550. case BCMA_CHIP_ID_BCM43227:
  551. @@ -489,7 +512,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  552. bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
  553. 0x88888815);
  554. }
  555. - tmp = 1 << 10;
  556. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  557. break;
  558. default:
  559. bcma_err(bus, "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n",
  560. --- a/drivers/bcma/driver_chipcommon_sflash.c
  561. +++ b/drivers/bcma/driver_chipcommon_sflash.c
  562. @@ -12,7 +12,7 @@
  563. static struct resource bcma_sflash_resource = {
  564. .name = "bcma_sflash",
  565. - .start = BCMA_SFLASH,
  566. + .start = BCMA_SOC_FLASH2,
  567. .end = 0,
  568. .flags = IORESOURCE_MEM | IORESOURCE_READONLY,
  569. };
  570. @@ -31,15 +31,42 @@ struct bcma_sflash_tbl_e {
  571. };
  572. static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
  573. - { "", 0x14, 0x10000, 32, },
  574. + { "M25P20", 0x11, 0x10000, 4, },
  575. + { "M25P40", 0x12, 0x10000, 8, },
  576. +
  577. + { "M25P16", 0x14, 0x10000, 32, },
  578. + { "M25P32", 0x15, 0x10000, 64, },
  579. + { "M25P64", 0x16, 0x10000, 128, },
  580. + { "M25FL128", 0x17, 0x10000, 256, },
  581. { 0 },
  582. };
  583. static struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = {
  584. + { "SST25WF512", 1, 0x1000, 16, },
  585. + { "SST25VF512", 0x48, 0x1000, 16, },
  586. + { "SST25WF010", 2, 0x1000, 32, },
  587. + { "SST25VF010", 0x49, 0x1000, 32, },
  588. + { "SST25WF020", 3, 0x1000, 64, },
  589. + { "SST25VF020", 0x43, 0x1000, 64, },
  590. + { "SST25WF040", 4, 0x1000, 128, },
  591. + { "SST25VF040", 0x44, 0x1000, 128, },
  592. + { "SST25VF040B", 0x8d, 0x1000, 128, },
  593. + { "SST25WF080", 5, 0x1000, 256, },
  594. + { "SST25VF080B", 0x8e, 0x1000, 256, },
  595. + { "SST25VF016", 0x41, 0x1000, 512, },
  596. + { "SST25VF032", 0x4a, 0x1000, 1024, },
  597. + { "SST25VF064", 0x4b, 0x1000, 2048, },
  598. { 0 },
  599. };
  600. static struct bcma_sflash_tbl_e bcma_sflash_at_tbl[] = {
  601. + { "AT45DB011", 0xc, 256, 512, },
  602. + { "AT45DB021", 0x14, 256, 1024, },
  603. + { "AT45DB041", 0x1c, 256, 2048, },
  604. + { "AT45DB081", 0x24, 256, 4096, },
  605. + { "AT45DB161", 0x2c, 512, 4096, },
  606. + { "AT45DB321", 0x34, 512, 8192, },
  607. + { "AT45DB642", 0x3c, 1024, 8192, },
  608. { 0 },
  609. };
  610. @@ -84,6 +111,8 @@ int bcma_sflash_init(struct bcma_drv_cc
  611. break;
  612. }
  613. break;
  614. + case 0x13:
  615. + return -ENOTSUPP;
  616. default:
  617. for (e = bcma_sflash_st_tbl; e->name; e++) {
  618. if (e->id == id)
  619. @@ -116,7 +145,7 @@ int bcma_sflash_init(struct bcma_drv_cc
  620. return -ENOTSUPP;
  621. }
  622. - sflash->window = BCMA_SFLASH;
  623. + sflash->window = BCMA_SOC_FLASH2;
  624. sflash->blocksize = e->blocksize;
  625. sflash->numblocks = e->numblocks;
  626. sflash->size = sflash->blocksize * sflash->numblocks;
  627. --- /dev/null
  628. +++ b/drivers/bcma/driver_gpio.c
  629. @@ -0,0 +1,98 @@
  630. +/*
  631. + * Broadcom specific AMBA
  632. + * GPIO driver
  633. + *
  634. + * Copyright 2011, Broadcom Corporation
  635. + * Copyright 2012, Hauke Mehrtens <[email protected]>
  636. + *
  637. + * Licensed under the GNU/GPL. See COPYING for details.
  638. + */
  639. +
  640. +#include <linux/gpio.h>
  641. +#include <linux/export.h>
  642. +#include <linux/bcma/bcma.h>
  643. +
  644. +#include "bcma_private.h"
  645. +
  646. +static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip)
  647. +{
  648. + return container_of(chip, struct bcma_drv_cc, gpio);
  649. +}
  650. +
  651. +static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
  652. +{
  653. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  654. +
  655. + return !!bcma_chipco_gpio_in(cc, 1 << gpio);
  656. +}
  657. +
  658. +static void bcma_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
  659. + int value)
  660. +{
  661. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  662. +
  663. + bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0);
  664. +}
  665. +
  666. +static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
  667. +{
  668. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  669. +
  670. + bcma_chipco_gpio_outen(cc, 1 << gpio, 0);
  671. + return 0;
  672. +}
  673. +
  674. +static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
  675. + int value)
  676. +{
  677. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  678. +
  679. + bcma_chipco_gpio_outen(cc, 1 << gpio, 1 << gpio);
  680. + bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0);
  681. + return 0;
  682. +}
  683. +
  684. +static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio)
  685. +{
  686. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  687. +
  688. + bcma_chipco_gpio_control(cc, 1 << gpio, 0);
  689. + /* clear pulldown */
  690. + bcma_chipco_gpio_pulldown(cc, 1 << gpio, 0);
  691. + /* Set pullup */
  692. + bcma_chipco_gpio_pullup(cc, 1 << gpio, 1 << gpio);
  693. +
  694. + return 0;
  695. +}
  696. +
  697. +static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio)
  698. +{
  699. + struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
  700. +
  701. + /* clear pullup */
  702. + bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
  703. +}
  704. +
  705. +int bcma_gpio_init(struct bcma_drv_cc *cc)
  706. +{
  707. + struct gpio_chip *chip = &cc->gpio;
  708. +
  709. + chip->label = "bcma_gpio";
  710. + chip->owner = THIS_MODULE;
  711. + chip->request = bcma_gpio_request;
  712. + chip->free = bcma_gpio_free;
  713. + chip->get = bcma_gpio_get_value;
  714. + chip->set = bcma_gpio_set_value;
  715. + chip->direction_input = bcma_gpio_direction_input;
  716. + chip->direction_output = bcma_gpio_direction_output;
  717. + chip->ngpio = 16;
  718. + /* There is just one SoC in one device and its GPIO addresses should be
  719. + * deterministic to address them more easily. The other buses could get
  720. + * a random base number. */
  721. + if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
  722. + chip->base = 0;
  723. + else
  724. + chip->base = -1;
  725. +
  726. + return gpiochip_add(chip);
  727. +}
  728. --- a/drivers/bcma/driver_mips.c
  729. +++ b/drivers/bcma/driver_mips.c
  730. @@ -74,11 +74,16 @@ static u32 bcma_core_mips_irqflag(struct
  731. return dev->core_index;
  732. flag = bcma_aread32(dev, BCMA_MIPS_OOBSELOUTA30);
  733. - return flag & 0x1F;
  734. + if (flag)
  735. + return flag & 0x1F;
  736. + else
  737. + return 0x3f;
  738. }
  739. /* Get the MIPS IRQ assignment for a specified device.
  740. * If unassigned, 0 is returned.
  741. + * If disabled, 5 is returned.
  742. + * If not supported, 6 is returned.
  743. */
  744. unsigned int bcma_core_mips_irq(struct bcma_device *dev)
  745. {
  746. @@ -87,13 +92,15 @@ unsigned int bcma_core_mips_irq(struct b
  747. unsigned int irq;
  748. irqflag = bcma_core_mips_irqflag(dev);
  749. + if (irqflag == 0x3f)
  750. + return 6;
  751. - for (irq = 1; irq <= 4; irq++)
  752. + for (irq = 0; irq <= 4; irq++)
  753. if (bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq)) &
  754. (1 << irqflag))
  755. return irq;
  756. - return 0;
  757. + return 5;
  758. }
  759. EXPORT_SYMBOL(bcma_core_mips_irq);
  760. @@ -114,7 +121,7 @@ static void bcma_core_mips_set_irq(struc
  761. bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0),
  762. bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) &
  763. ~(1 << irqflag));
  764. - else
  765. + else if (oldirq != 5)
  766. bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0);
  767. /* assign the new one */
  768. @@ -123,9 +130,9 @@ static void bcma_core_mips_set_irq(struc
  769. bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) |
  770. (1 << irqflag));
  771. } else {
  772. - u32 oldirqflag = bcma_read32(mdev,
  773. - BCMA_MIPS_MIPS74K_INTMASK(irq));
  774. - if (oldirqflag) {
  775. + u32 irqinitmask = bcma_read32(mdev,
  776. + BCMA_MIPS_MIPS74K_INTMASK(irq));
  777. + if (irqinitmask) {
  778. struct bcma_device *core;
  779. /* backplane irq line is in use, find out who uses
  780. @@ -133,7 +140,7 @@ static void bcma_core_mips_set_irq(struc
  781. */
  782. list_for_each_entry(core, &bus->cores, list) {
  783. if ((1 << bcma_core_mips_irqflag(core)) ==
  784. - oldirqflag) {
  785. + irqinitmask) {
  786. bcma_core_mips_set_irq(core, 0);
  787. break;
  788. }
  789. @@ -143,15 +150,31 @@ static void bcma_core_mips_set_irq(struc
  790. 1 << irqflag);
  791. }
  792. - bcma_info(bus, "set_irq: core 0x%04x, irq %d => %d\n",
  793. - dev->id.id, oldirq + 2, irq + 2);
  794. + bcma_debug(bus, "set_irq: core 0x%04x, irq %d => %d\n",
  795. + dev->id.id, oldirq <= 4 ? oldirq + 2 : 0, irq + 2);
  796. +}
  797. +
  798. +static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
  799. + u16 coreid, u8 unit)
  800. +{
  801. + struct bcma_device *core;
  802. +
  803. + core = bcma_find_core_unit(bus, coreid, unit);
  804. + if (!core) {
  805. + bcma_warn(bus,
  806. + "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
  807. + coreid, unit);
  808. + return;
  809. + }
  810. +
  811. + bcma_core_mips_set_irq(core, irq);
  812. }
  813. static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
  814. {
  815. int i;
  816. static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
  817. - printk(KERN_INFO KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
  818. + printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
  819. for (i = 0; i <= 6; i++)
  820. printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
  821. printk("\n");
  822. @@ -171,7 +194,7 @@ u32 bcma_cpu_clock(struct bcma_drv_mips
  823. struct bcma_bus *bus = mcore->core->bus;
  824. if (bus->drv_cc.capabilities & BCMA_CC_CAP_PMU)
  825. - return bcma_pmu_get_clockcpu(&bus->drv_cc);
  826. + return bcma_pmu_get_cpu_clock(&bus->drv_cc);
  827. bcma_err(bus, "No PMU available, need this to get the cpu clock\n");
  828. return 0;
  829. @@ -181,85 +204,109 @@ EXPORT_SYMBOL(bcma_cpu_clock);
  830. static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
  831. {
  832. struct bcma_bus *bus = mcore->core->bus;
  833. + struct bcma_drv_cc *cc = &bus->drv_cc;
  834. - switch (bus->drv_cc.capabilities & BCMA_CC_CAP_FLASHT) {
  835. + switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
  836. case BCMA_CC_FLASHT_STSER:
  837. case BCMA_CC_FLASHT_ATSER:
  838. bcma_debug(bus, "Found serial flash\n");
  839. - bcma_sflash_init(&bus->drv_cc);
  840. + bcma_sflash_init(cc);
  841. break;
  842. case BCMA_CC_FLASHT_PARA:
  843. bcma_debug(bus, "Found parallel flash\n");
  844. - bus->drv_cc.pflash.window = 0x1c000000;
  845. - bus->drv_cc.pflash.window_size = 0x02000000;
  846. + cc->pflash.present = true;
  847. + cc->pflash.window = BCMA_SOC_FLASH2;
  848. + cc->pflash.window_size = BCMA_SOC_FLASH2_SZ;
  849. - if ((bcma_read32(bus->drv_cc.core, BCMA_CC_FLASH_CFG) &
  850. + if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) &
  851. BCMA_CC_FLASH_CFG_DS) == 0)
  852. - bus->drv_cc.pflash.buswidth = 1;
  853. + cc->pflash.buswidth = 1;
  854. else
  855. - bus->drv_cc.pflash.buswidth = 2;
  856. + cc->pflash.buswidth = 2;
  857. break;
  858. default:
  859. bcma_err(bus, "Flash type not supported\n");
  860. }
  861. - if (bus->drv_cc.core->id.rev == 38 ||
  862. + if (cc->core->id.rev == 38 ||
  863. bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
  864. - if (bus->drv_cc.capabilities & BCMA_CC_CAP_NFLASH) {
  865. + if (cc->capabilities & BCMA_CC_CAP_NFLASH) {
  866. bcma_debug(bus, "Found NAND flash\n");
  867. - bcma_nflash_init(&bus->drv_cc);
  868. + bcma_nflash_init(cc);
  869. }
  870. }
  871. }
  872. +void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  873. +{
  874. + struct bcma_bus *bus = mcore->core->bus;
  875. +
  876. + if (mcore->early_setup_done)
  877. + return;
  878. +
  879. + bcma_chipco_serial_init(&bus->drv_cc);
  880. + bcma_core_mips_flash_detect(mcore);
  881. +
  882. + mcore->early_setup_done = true;
  883. +}
  884. +
  885. void bcma_core_mips_init(struct bcma_drv_mips *mcore)
  886. {
  887. struct bcma_bus *bus;
  888. struct bcma_device *core;
  889. bus = mcore->core->bus;
  890. - bcma_info(bus, "Initializing MIPS core...\n");
  891. + if (mcore->setup_done)
  892. + return;
  893. - if (!mcore->setup_done)
  894. - mcore->assigned_irqs = 1;
  895. + bcma_debug(bus, "Initializing MIPS core...\n");
  896. - /* Assign IRQs to all cores on the bus */
  897. - list_for_each_entry(core, &bus->cores, list) {
  898. - int mips_irq;
  899. - if (core->irq)
  900. - continue;
  901. -
  902. - mips_irq = bcma_core_mips_irq(core);
  903. - if (mips_irq > 4)
  904. - core->irq = 0;
  905. - else
  906. - core->irq = mips_irq + 2;
  907. - if (core->irq > 5)
  908. - continue;
  909. - switch (core->id.id) {
  910. - case BCMA_CORE_PCI:
  911. - case BCMA_CORE_PCIE:
  912. - case BCMA_CORE_ETHERNET:
  913. - case BCMA_CORE_ETHERNET_GBIT:
  914. - case BCMA_CORE_MAC_GBIT:
  915. - case BCMA_CORE_80211:
  916. - case BCMA_CORE_USB20_HOST:
  917. - /* These devices get their own IRQ line if available,
  918. - * the rest goes on IRQ0
  919. - */
  920. - if (mcore->assigned_irqs <= 4)
  921. - bcma_core_mips_set_irq(core,
  922. - mcore->assigned_irqs++);
  923. - break;
  924. + bcma_core_mips_early_init(mcore);
  925. +
  926. + switch (bus->chipinfo.id) {
  927. + case BCMA_CHIP_ID_BCM4716:
  928. + case BCMA_CHIP_ID_BCM4748:
  929. + bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
  930. + bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
  931. + bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
  932. + bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_PCIE, 0);
  933. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
  934. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
  935. + break;
  936. + case BCMA_CHIP_ID_BCM5356:
  937. + case BCMA_CHIP_ID_BCM47162:
  938. + case BCMA_CHIP_ID_BCM53572:
  939. + bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
  940. + bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
  941. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
  942. + break;
  943. + case BCMA_CHIP_ID_BCM5357:
  944. + case BCMA_CHIP_ID_BCM4749:
  945. + bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0);
  946. + bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0);
  947. + bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0);
  948. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0);
  949. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0);
  950. + break;
  951. + case BCMA_CHIP_ID_BCM4706:
  952. + bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_PCIE, 0);
  953. + bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_4706_MAC_GBIT,
  954. + 0);
  955. + bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1);
  956. + bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0);
  957. + bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON,
  958. + 0);
  959. + break;
  960. + default:
  961. + list_for_each_entry(core, &bus->cores, list) {
  962. + core->irq = bcma_core_mips_irq(core) + 2;
  963. }
  964. + bcma_err(bus,
  965. + "Unknown device (0x%x) found, can not configure IRQs\n",
  966. + bus->chipinfo.id);
  967. }
  968. - bcma_info(bus, "IRQ reconfiguration done\n");
  969. + bcma_debug(bus, "IRQ reconfiguration done\n");
  970. bcma_core_mips_dump_irq(bus);
  971. - if (mcore->setup_done)
  972. - return;
  973. -
  974. - bcma_chipco_serial_init(&bus->drv_cc);
  975. - bcma_core_mips_flash_detect(mcore);
  976. mcore->setup_done = true;
  977. }
  978. --- a/drivers/bcma/driver_pci_host.c
  979. +++ b/drivers/bcma/driver_pci_host.c
  980. @@ -35,11 +35,6 @@ bool __devinit bcma_core_pci_is_in_hostm
  981. chipid_top != 0x5300)
  982. return false;
  983. - if (bus->sprom.boardflags_lo & BCMA_CORE_PCI_BFL_NOPCI) {
  984. - bcma_info(bus, "This PCI core is disabled and not working\n");
  985. - return false;
  986. - }
  987. -
  988. bcma_core_enable(pc->core, 0);
  989. return !mips_busprobe32(tmp, pc->core->io_addr);
  990. @@ -396,6 +391,11 @@ void __devinit bcma_core_pci_hostmode_in
  991. bcma_info(bus, "PCIEcore in host mode found\n");
  992. + if (bus->sprom.boardflags_lo & BCMA_CORE_PCI_BFL_NOPCI) {
  993. + bcma_info(bus, "This PCIE core is disabled and not working\n");
  994. + return;
  995. + }
  996. +
  997. pc_host = kzalloc(sizeof(*pc_host), GFP_KERNEL);
  998. if (!pc_host) {
  999. bcma_err(bus, "can not allocate memory");
  1000. @@ -452,6 +452,8 @@ void __devinit bcma_core_pci_hostmode_in
  1001. pc_host->mem_resource.start = BCMA_SOC_PCI_MEM;
  1002. pc_host->mem_resource.end = BCMA_SOC_PCI_MEM +
  1003. BCMA_SOC_PCI_MEM_SZ - 1;
  1004. + pc_host->io_resource.start = 0x100;
  1005. + pc_host->io_resource.end = 0x47F;
  1006. pci_membase_1G = BCMA_SOC_PCIE_DMA_H32;
  1007. pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0,
  1008. tmp | BCMA_SOC_PCI_MEM);
  1009. @@ -459,6 +461,8 @@ void __devinit bcma_core_pci_hostmode_in
  1010. pc_host->mem_resource.start = BCMA_SOC_PCI1_MEM;
  1011. pc_host->mem_resource.end = BCMA_SOC_PCI1_MEM +
  1012. BCMA_SOC_PCI_MEM_SZ - 1;
  1013. + pc_host->io_resource.start = 0x480;
  1014. + pc_host->io_resource.end = 0x7FF;
  1015. pci_membase_1G = BCMA_SOC_PCIE1_DMA_H32;
  1016. pc_host->host_cfg_addr = BCMA_SOC_PCI1_CFG;
  1017. pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0,
  1018. @@ -534,7 +538,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_
  1019. static void bcma_core_pci_fixup_addresses(struct pci_dev *dev)
  1020. {
  1021. struct resource *res;
  1022. - int pos;
  1023. + int pos, err;
  1024. if (dev->bus->ops->read != bcma_core_pci_hostmode_read_config) {
  1025. /* This is not a device on the PCI-core bridge. */
  1026. @@ -547,8 +551,12 @@ static void bcma_core_pci_fixup_addresse
  1027. for (pos = 0; pos < 6; pos++) {
  1028. res = &dev->resource[pos];
  1029. - if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM))
  1030. - pci_assign_resource(dev, pos);
  1031. + if (res->flags & (IORESOURCE_IO | IORESOURCE_MEM)) {
  1032. + err = pci_assign_resource(dev, pos);
  1033. + if (err)
  1034. + pr_err("PCI: Problem fixing up the addresses on %s\n",
  1035. + pci_name(dev));
  1036. + }
  1037. }
  1038. }
  1039. DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, bcma_core_pci_fixup_addresses);
  1040. --- a/drivers/bcma/host_pci.c
  1041. +++ b/drivers/bcma/host_pci.c
  1042. @@ -238,7 +238,7 @@ static void __devexit bcma_host_pci_remo
  1043. pci_set_drvdata(dev, NULL);
  1044. }
  1045. -#ifdef CONFIG_PM
  1046. +#ifdef CONFIG_PM_SLEEP
  1047. static int bcma_host_pci_suspend(struct device *dev)
  1048. {
  1049. struct pci_dev *pdev = to_pci_dev(dev);
  1050. @@ -261,11 +261,11 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bc
  1051. bcma_host_pci_resume);
  1052. #define BCMA_PM_OPS (&bcma_pm_ops)
  1053. -#else /* CONFIG_PM */
  1054. +#else /* CONFIG_PM_SLEEP */
  1055. #define BCMA_PM_OPS NULL
  1056. -#endif /* CONFIG_PM */
  1057. +#endif /* CONFIG_PM_SLEEP */
  1058. static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
  1059. { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) },
  1060. --- a/drivers/bcma/main.c
  1061. +++ b/drivers/bcma/main.c
  1062. @@ -81,6 +81,18 @@ struct bcma_device *bcma_find_core(struc
  1063. }
  1064. EXPORT_SYMBOL_GPL(bcma_find_core);
  1065. +struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
  1066. + u8 unit)
  1067. +{
  1068. + struct bcma_device *core;
  1069. +
  1070. + list_for_each_entry(core, &bus->cores, list) {
  1071. + if (core->id.id == coreid && core->core_unit == unit)
  1072. + return core;
  1073. + }
  1074. + return NULL;
  1075. +}
  1076. +
  1077. static void bcma_release_core_dev(struct device *dev)
  1078. {
  1079. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  1080. @@ -152,6 +164,17 @@ static int bcma_register_cores(struct bc
  1081. bcma_err(bus, "Error registering NAND flash\n");
  1082. }
  1083. #endif
  1084. + err = bcma_gpio_init(&bus->drv_cc);
  1085. + if (err == -ENOTSUPP)
  1086. + bcma_debug(bus, "GPIO driver not activated\n");
  1087. + else if (err)
  1088. + bcma_err(bus, "Error registering GPIO driver: %i\n", err);
  1089. +
  1090. + if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
  1091. + err = bcma_chipco_watchdog_register(&bus->drv_cc);
  1092. + if (err)
  1093. + bcma_err(bus, "Error registering watchdog driver\n");
  1094. + }
  1095. return 0;
  1096. }
  1097. @@ -165,6 +188,8 @@ static void bcma_unregister_cores(struct
  1098. if (core->dev_registered)
  1099. device_unregister(&core->dev);
  1100. }
  1101. + if (bus->hosttype == BCMA_HOSTTYPE_SOC)
  1102. + platform_device_unregister(bus->drv_cc.watchdog);
  1103. }
  1104. int __devinit bcma_bus_register(struct bcma_bus *bus)
  1105. @@ -183,6 +208,20 @@ int __devinit bcma_bus_register(struct b
  1106. return -1;
  1107. }
  1108. + /* Early init CC core */
  1109. + core = bcma_find_core(bus, bcma_cc_core_id(bus));
  1110. + if (core) {
  1111. + bus->drv_cc.core = core;
  1112. + bcma_core_chipcommon_early_init(&bus->drv_cc);
  1113. + }
  1114. +
  1115. + /* Try to get SPROM */
  1116. + err = bcma_sprom_get(bus);
  1117. + if (err == -ENOENT) {
  1118. + bcma_err(bus, "No SPROM available\n");
  1119. + } else if (err)
  1120. + bcma_err(bus, "Failed to get SPROM: %d\n", err);
  1121. +
  1122. /* Init CC core */
  1123. core = bcma_find_core(bus, bcma_cc_core_id(bus));
  1124. if (core) {
  1125. @@ -198,10 +237,17 @@ int __devinit bcma_bus_register(struct b
  1126. }
  1127. /* Init PCIE core */
  1128. - core = bcma_find_core(bus, BCMA_CORE_PCIE);
  1129. + core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
  1130. if (core) {
  1131. - bus->drv_pci.core = core;
  1132. - bcma_core_pci_init(&bus->drv_pci);
  1133. + bus->drv_pci[0].core = core;
  1134. + bcma_core_pci_init(&bus->drv_pci[0]);
  1135. + }
  1136. +
  1137. + /* Init PCIE core */
  1138. + core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1);
  1139. + if (core) {
  1140. + bus->drv_pci[1].core = core;
  1141. + bcma_core_pci_init(&bus->drv_pci[1]);
  1142. }
  1143. /* Init GBIT MAC COMMON core */
  1144. @@ -211,13 +257,6 @@ int __devinit bcma_bus_register(struct b
  1145. bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
  1146. }
  1147. - /* Try to get SPROM */
  1148. - err = bcma_sprom_get(bus);
  1149. - if (err == -ENOENT) {
  1150. - bcma_err(bus, "No SPROM available\n");
  1151. - } else if (err)
  1152. - bcma_err(bus, "Failed to get SPROM: %d\n", err);
  1153. -
  1154. /* Register found cores */
  1155. bcma_register_cores(bus);
  1156. @@ -275,18 +314,18 @@ int __init bcma_bus_early_register(struc
  1157. return -1;
  1158. }
  1159. - /* Init CC core */
  1160. + /* Early init CC core */
  1161. core = bcma_find_core(bus, bcma_cc_core_id(bus));
  1162. if (core) {
  1163. bus->drv_cc.core = core;
  1164. - bcma_core_chipcommon_init(&bus->drv_cc);
  1165. + bcma_core_chipcommon_early_init(&bus->drv_cc);
  1166. }
  1167. - /* Init MIPS core */
  1168. + /* Early init MIPS core */
  1169. core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
  1170. if (core) {
  1171. bus->drv_mips.core = core;
  1172. - bcma_core_mips_init(&bus->drv_mips);
  1173. + bcma_core_mips_early_init(&bus->drv_mips);
  1174. }
  1175. bcma_info(bus, "Early bus registered\n");
  1176. --- a/drivers/bcma/sprom.c
  1177. +++ b/drivers/bcma/sprom.c
  1178. @@ -595,8 +595,11 @@ int bcma_sprom_get(struct bcma_bus *bus)
  1179. bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
  1180. err = bcma_sprom_valid(sprom);
  1181. - if (err)
  1182. + if (err) {
  1183. + bcma_warn(bus, "invalid sprom read from the PCIe card, try to use fallback sprom\n");
  1184. + err = bcma_fill_sprom_with_fallback(bus, &bus->sprom);
  1185. goto out;
  1186. + }
  1187. bcma_sprom_extract_r8(bus, sprom);
  1188. --- a/include/linux/bcma/bcma.h
  1189. +++ b/include/linux/bcma/bcma.h
  1190. @@ -157,6 +157,7 @@ struct bcma_host_ops {
  1191. /* Chip IDs of SoCs */
  1192. #define BCMA_CHIP_ID_BCM4706 0x5300
  1193. +#define BCMA_PKG_ID_BCM4706L 1
  1194. #define BCMA_CHIP_ID_BCM4716 0x4716
  1195. #define BCMA_PKG_ID_BCM4716 8
  1196. #define BCMA_PKG_ID_BCM4717 9
  1197. @@ -166,7 +167,11 @@ struct bcma_host_ops {
  1198. #define BCMA_CHIP_ID_BCM4749 0x4749
  1199. #define BCMA_CHIP_ID_BCM5356 0x5356
  1200. #define BCMA_CHIP_ID_BCM5357 0x5357
  1201. +#define BCMA_PKG_ID_BCM5358 9
  1202. +#define BCMA_PKG_ID_BCM47186 10
  1203. +#define BCMA_PKG_ID_BCM5357 11
  1204. #define BCMA_CHIP_ID_BCM53572 53572
  1205. +#define BCMA_PKG_ID_BCM47188 9
  1206. struct bcma_device {
  1207. struct bcma_bus *bus;
  1208. @@ -251,7 +256,7 @@ struct bcma_bus {
  1209. u8 num;
  1210. struct bcma_drv_cc drv_cc;
  1211. - struct bcma_drv_pci drv_pci;
  1212. + struct bcma_drv_pci drv_pci[2];
  1213. struct bcma_drv_mips drv_mips;
  1214. struct bcma_drv_gmac_cmn drv_gmac_cmn;
  1215. @@ -345,6 +350,7 @@ extern void bcma_core_set_clockmode(stru
  1216. enum bcma_clkmode clkmode);
  1217. extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
  1218. bool on);
  1219. +extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
  1220. #define BCMA_DMA_TRANSLATION_MASK 0xC0000000
  1221. #define BCMA_DMA_TRANSLATION_NONE 0x00000000
  1222. #define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
  1223. --- a/include/linux/bcma/bcma_driver_chipcommon.h
  1224. +++ b/include/linux/bcma/bcma_driver_chipcommon.h
  1225. @@ -1,6 +1,9 @@
  1226. #ifndef LINUX_BCMA_DRIVER_CC_H_
  1227. #define LINUX_BCMA_DRIVER_CC_H_
  1228. +#include <linux/platform_device.h>
  1229. +#include <linux/gpio.h>
  1230. +
  1231. /** ChipCommon core registers. **/
  1232. #define BCMA_CC_ID 0x0000
  1233. #define BCMA_CC_ID_ID 0x0000FFFF
  1234. @@ -101,6 +104,7 @@
  1235. #define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */
  1236. #define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */
  1237. #define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
  1238. +#define BCMA_CC_CHIPST_4360_XTAL_40MZ 0x00000001
  1239. #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
  1240. #define BCMA_CC_JCMD_START 0x80000000
  1241. #define BCMA_CC_JCMD_BUSY 0x80000000
  1242. @@ -510,6 +514,7 @@ struct bcma_chipcommon_pmu {
  1243. #ifdef CONFIG_BCMA_DRIVER_MIPS
  1244. struct bcma_pflash {
  1245. + bool present;
  1246. u8 buswidth;
  1247. u32 window;
  1248. u32 window_size;
  1249. @@ -532,6 +537,7 @@ struct mtd_info;
  1250. struct bcma_nflash {
  1251. bool present;
  1252. + bool boot; /* This is the flash the SoC boots from */
  1253. struct mtd_info *mtd;
  1254. };
  1255. @@ -552,6 +558,7 @@ struct bcma_drv_cc {
  1256. u32 capabilities;
  1257. u32 capabilities_ext;
  1258. u8 setup_done:1;
  1259. + u8 early_setup_done:1;
  1260. /* Fast Powerup Delay constant */
  1261. u16 fast_pwrup_delay;
  1262. struct bcma_chipcommon_pmu pmu;
  1263. @@ -567,6 +574,14 @@ struct bcma_drv_cc {
  1264. int nr_serial_ports;
  1265. struct bcma_serial_port serial_ports[4];
  1266. #endif /* CONFIG_BCMA_DRIVER_MIPS */
  1267. + u32 ticks_per_ms;
  1268. + struct platform_device *watchdog;
  1269. +
  1270. + /* Lock for GPIO register access. */
  1271. + spinlock_t gpio_lock;
  1272. +#ifdef CONFIG_BCMA_DRIVER_GPIO
  1273. + struct gpio_chip gpio;
  1274. +#endif
  1275. };
  1276. /* Register access */
  1277. @@ -583,14 +598,16 @@ struct bcma_drv_cc {
  1278. bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
  1279. extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  1280. +extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
  1281. extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
  1282. extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
  1283. void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
  1284. -extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc,
  1285. - u32 ticks);
  1286. +extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
  1287. +
  1288. +extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
  1289. void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1290. @@ -603,9 +620,12 @@ u32 bcma_chipco_gpio_outen(struct bcma_d
  1291. u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1292. u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1293. u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1294. +u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1295. +u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
  1296. /* PMU support */
  1297. extern void bcma_pmu_init(struct bcma_drv_cc *cc);
  1298. +extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
  1299. extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
  1300. u32 value);
  1301. --- a/include/linux/bcma/bcma_driver_mips.h
  1302. +++ b/include/linux/bcma/bcma_driver_mips.h
  1303. @@ -35,13 +35,15 @@ struct bcma_device;
  1304. struct bcma_drv_mips {
  1305. struct bcma_device *core;
  1306. u8 setup_done:1;
  1307. - unsigned int assigned_irqs;
  1308. + u8 early_setup_done:1;
  1309. };
  1310. #ifdef CONFIG_BCMA_DRIVER_MIPS
  1311. extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
  1312. +extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
  1313. #else
  1314. static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
  1315. +static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
  1316. #endif
  1317. extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
  1318. --- a/include/linux/bcma/bcma_regs.h
  1319. +++ b/include/linux/bcma/bcma_regs.h
  1320. @@ -85,6 +85,9 @@
  1321. * (2 ZettaBytes), high 32 bits
  1322. */
  1323. -#define BCMA_SFLASH 0x1c000000
  1324. +#define BCMA_SOC_FLASH1 0x1fc00000 /* MIPS Flash Region 1 */
  1325. +#define BCMA_SOC_FLASH1_SZ 0x00400000 /* MIPS Size of Flash Region 1 */
  1326. +#define BCMA_SOC_FLASH2 0x1c000000 /* Flash Region 2 (region 1 shadowed here) */
  1327. +#define BCMA_SOC_FLASH2_SZ 0x02000000 /* Size of Flash Region 2 */
  1328. #endif /* LINUX_BCMA_REGS_H_ */
  1329. --- a/drivers/net/wireless/b43/main.c
  1330. +++ b/drivers/net/wireless/b43/main.c
  1331. @@ -4684,7 +4684,7 @@ static int b43_wireless_core_init(struct
  1332. switch (dev->dev->bus_type) {
  1333. #ifdef CONFIG_B43_BCMA
  1334. case B43_BUS_BCMA:
  1335. - bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci,
  1336. + bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
  1337. dev->dev->bdev, true);
  1338. break;
  1339. #endif
  1340. --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
  1341. +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
  1342. @@ -692,7 +692,7 @@ void ai_pci_up(struct si_pub *sih)
  1343. sii = container_of(sih, struct si_info, pub);
  1344. if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
  1345. - bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true);
  1346. + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true);
  1347. }
  1348. /* Unconfigure and/or apply various WARs when going down */
  1349. @@ -703,7 +703,7 @@ void ai_pci_down(struct si_pub *sih)
  1350. sii = container_of(sih, struct si_info, pub);
  1351. if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
  1352. - bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false);
  1353. + bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false);
  1354. }
  1355. /* Enable BT-COEX & Ex-PA for 4313 */
  1356. --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  1357. +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  1358. @@ -5077,7 +5077,7 @@ static int brcms_b_up_prep(struct brcms_
  1359. * Configure pci/pcmcia here instead of in brcms_c_attach()
  1360. * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  1361. */
  1362. - bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci, wlc_hw->d11core,
  1363. + bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core,
  1364. true);
  1365. /*