da850.c 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364
  1. /*
  2. * TI DA850/OMAP-L138 chip specific setup
  3. *
  4. * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * Derived from: arch/arm/mach-davinci/da830.c
  7. * Original Copyrights follow:
  8. *
  9. * 2009 (c) MontaVista Software, Inc. This file is licensed under
  10. * the terms of the GNU General Public License version 2. This program
  11. * is licensed "as is" without any warranty of any kind, whether express
  12. * or implied.
  13. */
  14. #include <linux/clkdev.h>
  15. #include <linux/gpio.h>
  16. #include <linux/init.h>
  17. #include <linux/clk.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/cpufreq.h>
  20. #include <linux/regulator/consumer.h>
  21. #include <linux/platform_data/gpio-davinci.h>
  22. #include <asm/mach/map.h>
  23. #include "psc.h"
  24. #include <mach/irqs.h>
  25. #include <mach/cputype.h>
  26. #include <mach/common.h>
  27. #include <mach/time.h>
  28. #include <mach/da8xx.h>
  29. #include <mach/cpufreq.h>
  30. #include <mach/pm.h>
  31. #include "clock.h"
  32. #include "mux.h"
  33. #define DA850_PLL1_BASE 0x01e1a000
  34. #define DA850_TIMER64P2_BASE 0x01f0c000
  35. #define DA850_TIMER64P3_BASE 0x01f0d000
  36. #define DA850_REF_FREQ 24000000
  37. #define CFGCHIP3_ASYNC3_CLKSRC BIT(4)
  38. #define CFGCHIP3_PLL1_MASTER_LOCK BIT(5)
  39. #define CFGCHIP0_PLL_MASTER_LOCK BIT(4)
  40. static int da850_set_armrate(struct clk *clk, unsigned long rate);
  41. static int da850_round_armrate(struct clk *clk, unsigned long rate);
  42. static int da850_set_pll0rate(struct clk *clk, unsigned long armrate);
  43. static struct pll_data pll0_data = {
  44. .num = 1,
  45. .phys_base = DA8XX_PLL0_BASE,
  46. .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV,
  47. };
  48. static struct clk ref_clk = {
  49. .name = "ref_clk",
  50. .rate = DA850_REF_FREQ,
  51. .set_rate = davinci_simple_set_rate,
  52. };
  53. static struct clk pll0_clk = {
  54. .name = "pll0",
  55. .parent = &ref_clk,
  56. .pll_data = &pll0_data,
  57. .flags = CLK_PLL,
  58. .set_rate = da850_set_pll0rate,
  59. };
  60. static struct clk pll0_aux_clk = {
  61. .name = "pll0_aux_clk",
  62. .parent = &pll0_clk,
  63. .flags = CLK_PLL | PRE_PLL,
  64. };
  65. static struct clk pll0_sysclk1 = {
  66. .name = "pll0_sysclk1",
  67. .parent = &pll0_clk,
  68. .flags = CLK_PLL,
  69. .div_reg = PLLDIV1,
  70. };
  71. static struct clk pll0_sysclk2 = {
  72. .name = "pll0_sysclk2",
  73. .parent = &pll0_clk,
  74. .flags = CLK_PLL,
  75. .div_reg = PLLDIV2,
  76. };
  77. static struct clk pll0_sysclk3 = {
  78. .name = "pll0_sysclk3",
  79. .parent = &pll0_clk,
  80. .flags = CLK_PLL,
  81. .div_reg = PLLDIV3,
  82. .set_rate = davinci_set_sysclk_rate,
  83. .maxrate = 100000000,
  84. };
  85. static struct clk pll0_sysclk4 = {
  86. .name = "pll0_sysclk4",
  87. .parent = &pll0_clk,
  88. .flags = CLK_PLL,
  89. .div_reg = PLLDIV4,
  90. };
  91. static struct clk pll0_sysclk5 = {
  92. .name = "pll0_sysclk5",
  93. .parent = &pll0_clk,
  94. .flags = CLK_PLL,
  95. .div_reg = PLLDIV5,
  96. };
  97. static struct clk pll0_sysclk6 = {
  98. .name = "pll0_sysclk6",
  99. .parent = &pll0_clk,
  100. .flags = CLK_PLL,
  101. .div_reg = PLLDIV6,
  102. };
  103. static struct clk pll0_sysclk7 = {
  104. .name = "pll0_sysclk7",
  105. .parent = &pll0_clk,
  106. .flags = CLK_PLL,
  107. .div_reg = PLLDIV7,
  108. };
  109. static struct pll_data pll1_data = {
  110. .num = 2,
  111. .phys_base = DA850_PLL1_BASE,
  112. .flags = PLL_HAS_POSTDIV,
  113. };
  114. static struct clk pll1_clk = {
  115. .name = "pll1",
  116. .parent = &ref_clk,
  117. .pll_data = &pll1_data,
  118. .flags = CLK_PLL,
  119. };
  120. static struct clk pll1_aux_clk = {
  121. .name = "pll1_aux_clk",
  122. .parent = &pll1_clk,
  123. .flags = CLK_PLL | PRE_PLL,
  124. };
  125. static struct clk pll1_sysclk2 = {
  126. .name = "pll1_sysclk2",
  127. .parent = &pll1_clk,
  128. .flags = CLK_PLL,
  129. .div_reg = PLLDIV2,
  130. };
  131. static struct clk pll1_sysclk3 = {
  132. .name = "pll1_sysclk3",
  133. .parent = &pll1_clk,
  134. .flags = CLK_PLL,
  135. .div_reg = PLLDIV3,
  136. };
  137. static int da850_async3_set_parent(struct clk *clk, struct clk *parent)
  138. {
  139. u32 val;
  140. val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
  141. if (parent == &pll0_sysclk2) {
  142. val &= ~CFGCHIP3_ASYNC3_CLKSRC;
  143. } else if (parent == &pll1_sysclk2) {
  144. val |= CFGCHIP3_ASYNC3_CLKSRC;
  145. } else {
  146. pr_err("Bad parent on async3 clock mux\n");
  147. return -EINVAL;
  148. }
  149. writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
  150. return 0;
  151. }
  152. static struct clk async3_clk = {
  153. .name = "async3",
  154. .parent = &pll1_sysclk2,
  155. .set_parent = da850_async3_set_parent,
  156. };
  157. static struct clk i2c0_clk = {
  158. .name = "i2c0",
  159. .parent = &pll0_aux_clk,
  160. };
  161. static struct clk timerp64_0_clk = {
  162. .name = "timer0",
  163. .parent = &pll0_aux_clk,
  164. };
  165. static struct clk timerp64_1_clk = {
  166. .name = "timer1",
  167. .parent = &pll0_aux_clk,
  168. };
  169. static struct clk arm_rom_clk = {
  170. .name = "arm_rom",
  171. .parent = &pll0_sysclk2,
  172. .lpsc = DA8XX_LPSC0_ARM_RAM_ROM,
  173. .flags = ALWAYS_ENABLED,
  174. };
  175. static struct clk tpcc0_clk = {
  176. .name = "tpcc0",
  177. .parent = &pll0_sysclk2,
  178. .lpsc = DA8XX_LPSC0_TPCC,
  179. .flags = ALWAYS_ENABLED | CLK_PSC,
  180. };
  181. static struct clk tptc0_clk = {
  182. .name = "tptc0",
  183. .parent = &pll0_sysclk2,
  184. .lpsc = DA8XX_LPSC0_TPTC0,
  185. .flags = ALWAYS_ENABLED,
  186. };
  187. static struct clk tptc1_clk = {
  188. .name = "tptc1",
  189. .parent = &pll0_sysclk2,
  190. .lpsc = DA8XX_LPSC0_TPTC1,
  191. .flags = ALWAYS_ENABLED,
  192. };
  193. static struct clk tpcc1_clk = {
  194. .name = "tpcc1",
  195. .parent = &pll0_sysclk2,
  196. .lpsc = DA850_LPSC1_TPCC1,
  197. .gpsc = 1,
  198. .flags = CLK_PSC | ALWAYS_ENABLED,
  199. };
  200. static struct clk tptc2_clk = {
  201. .name = "tptc2",
  202. .parent = &pll0_sysclk2,
  203. .lpsc = DA850_LPSC1_TPTC2,
  204. .gpsc = 1,
  205. .flags = ALWAYS_ENABLED,
  206. };
  207. static struct clk pruss_clk = {
  208. .name = "pruss",
  209. .parent = &pll0_sysclk2,
  210. .lpsc = DA8XX_LPSC0_PRUSS,
  211. };
  212. static struct clk uart0_clk = {
  213. .name = "uart0",
  214. .parent = &pll0_sysclk2,
  215. .lpsc = DA8XX_LPSC0_UART0,
  216. };
  217. static struct clk uart1_clk = {
  218. .name = "uart1",
  219. .parent = &async3_clk,
  220. .lpsc = DA8XX_LPSC1_UART1,
  221. .gpsc = 1,
  222. };
  223. static struct clk uart2_clk = {
  224. .name = "uart2",
  225. .parent = &async3_clk,
  226. .lpsc = DA8XX_LPSC1_UART2,
  227. .gpsc = 1,
  228. };
  229. static struct clk aintc_clk = {
  230. .name = "aintc",
  231. .parent = &pll0_sysclk4,
  232. .lpsc = DA8XX_LPSC0_AINTC,
  233. .flags = ALWAYS_ENABLED,
  234. };
  235. static struct clk gpio_clk = {
  236. .name = "gpio",
  237. .parent = &pll0_sysclk4,
  238. .lpsc = DA8XX_LPSC1_GPIO,
  239. .gpsc = 1,
  240. };
  241. static struct clk i2c1_clk = {
  242. .name = "i2c1",
  243. .parent = &pll0_sysclk4,
  244. .lpsc = DA8XX_LPSC1_I2C,
  245. .gpsc = 1,
  246. };
  247. static struct clk emif3_clk = {
  248. .name = "emif3",
  249. .parent = &pll0_sysclk5,
  250. .lpsc = DA8XX_LPSC1_EMIF3C,
  251. .gpsc = 1,
  252. .flags = ALWAYS_ENABLED,
  253. };
  254. static struct clk arm_clk = {
  255. .name = "arm",
  256. .parent = &pll0_sysclk6,
  257. .lpsc = DA8XX_LPSC0_ARM,
  258. .flags = ALWAYS_ENABLED,
  259. .set_rate = da850_set_armrate,
  260. .round_rate = da850_round_armrate,
  261. };
  262. static struct clk rmii_clk = {
  263. .name = "rmii",
  264. .parent = &pll0_sysclk7,
  265. };
  266. static struct clk emac_clk = {
  267. .name = "emac",
  268. .parent = &pll0_sysclk4,
  269. .lpsc = DA8XX_LPSC1_CPGMAC,
  270. .gpsc = 1,
  271. };
  272. /*
  273. * In order to avoid adding the emac_clk to the clock lookup table twice (and
  274. * screwing up the linked list in the process) create a separate clock for
  275. * mdio inheriting the rate from emac_clk.
  276. */
  277. static struct clk mdio_clk = {
  278. .name = "mdio",
  279. .parent = &emac_clk,
  280. };
  281. static struct clk mcasp_clk = {
  282. .name = "mcasp",
  283. .parent = &async3_clk,
  284. .lpsc = DA8XX_LPSC1_McASP0,
  285. .gpsc = 1,
  286. };
  287. static struct clk mcbsp0_clk = {
  288. .name = "mcbsp0",
  289. .parent = &async3_clk,
  290. .lpsc = DA850_LPSC1_McBSP0,
  291. .gpsc = 1,
  292. };
  293. static struct clk mcbsp1_clk = {
  294. .name = "mcbsp1",
  295. .parent = &async3_clk,
  296. .lpsc = DA850_LPSC1_McBSP1,
  297. .gpsc = 1,
  298. };
  299. static struct clk lcdc_clk = {
  300. .name = "lcdc",
  301. .parent = &pll0_sysclk2,
  302. .lpsc = DA8XX_LPSC1_LCDC,
  303. .gpsc = 1,
  304. };
  305. static struct clk mmcsd0_clk = {
  306. .name = "mmcsd0",
  307. .parent = &pll0_sysclk2,
  308. .lpsc = DA8XX_LPSC0_MMC_SD,
  309. };
  310. static struct clk mmcsd1_clk = {
  311. .name = "mmcsd1",
  312. .parent = &pll0_sysclk2,
  313. .lpsc = DA850_LPSC1_MMC_SD1,
  314. .gpsc = 1,
  315. };
  316. static struct clk aemif_clk = {
  317. .name = "aemif",
  318. .parent = &pll0_sysclk3,
  319. .lpsc = DA8XX_LPSC0_EMIF25,
  320. .flags = ALWAYS_ENABLED,
  321. };
  322. static struct clk usb11_clk = {
  323. .name = "usb11",
  324. .parent = &pll0_sysclk4,
  325. .lpsc = DA8XX_LPSC1_USB11,
  326. .gpsc = 1,
  327. };
  328. static struct clk usb20_clk = {
  329. .name = "usb20",
  330. .parent = &pll0_sysclk2,
  331. .lpsc = DA8XX_LPSC1_USB20,
  332. .gpsc = 1,
  333. };
  334. static struct clk spi0_clk = {
  335. .name = "spi0",
  336. .parent = &pll0_sysclk2,
  337. .lpsc = DA8XX_LPSC0_SPI0,
  338. };
  339. static struct clk spi1_clk = {
  340. .name = "spi1",
  341. .parent = &async3_clk,
  342. .lpsc = DA8XX_LPSC1_SPI1,
  343. .gpsc = 1,
  344. };
  345. static struct clk vpif_clk = {
  346. .name = "vpif",
  347. .parent = &pll0_sysclk2,
  348. .lpsc = DA850_LPSC1_VPIF,
  349. .gpsc = 1,
  350. };
  351. static struct clk sata_clk = {
  352. .name = "sata",
  353. .parent = &pll0_sysclk2,
  354. .lpsc = DA850_LPSC1_SATA,
  355. .gpsc = 1,
  356. .flags = PSC_FORCE,
  357. };
  358. static struct clk dsp_clk = {
  359. .name = "dsp",
  360. .parent = &pll0_sysclk1,
  361. .domain = DAVINCI_GPSC_DSPDOMAIN,
  362. .lpsc = DA8XX_LPSC0_GEM,
  363. .flags = PSC_LRST | PSC_FORCE,
  364. };
  365. static struct clk ehrpwm_clk = {
  366. .name = "ehrpwm",
  367. .parent = &async3_clk,
  368. .lpsc = DA8XX_LPSC1_PWM,
  369. .gpsc = 1,
  370. };
  371. #define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
  372. static void ehrpwm_tblck_enable(struct clk *clk)
  373. {
  374. u32 val;
  375. val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
  376. val |= DA8XX_EHRPWM_TBCLKSYNC;
  377. writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
  378. }
  379. static void ehrpwm_tblck_disable(struct clk *clk)
  380. {
  381. u32 val;
  382. val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
  383. val &= ~DA8XX_EHRPWM_TBCLKSYNC;
  384. writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
  385. }
  386. static struct clk ehrpwm_tbclk = {
  387. .name = "ehrpwm_tbclk",
  388. .parent = &ehrpwm_clk,
  389. .clk_enable = ehrpwm_tblck_enable,
  390. .clk_disable = ehrpwm_tblck_disable,
  391. };
  392. static struct clk ecap_clk = {
  393. .name = "ecap",
  394. .parent = &async3_clk,
  395. .lpsc = DA8XX_LPSC1_ECAP,
  396. .gpsc = 1,
  397. };
  398. static struct clk_lookup da850_clks[] = {
  399. CLK(NULL, "ref", &ref_clk),
  400. CLK(NULL, "pll0", &pll0_clk),
  401. CLK(NULL, "pll0_aux", &pll0_aux_clk),
  402. CLK(NULL, "pll0_sysclk1", &pll0_sysclk1),
  403. CLK(NULL, "pll0_sysclk2", &pll0_sysclk2),
  404. CLK(NULL, "pll0_sysclk3", &pll0_sysclk3),
  405. CLK(NULL, "pll0_sysclk4", &pll0_sysclk4),
  406. CLK(NULL, "pll0_sysclk5", &pll0_sysclk5),
  407. CLK(NULL, "pll0_sysclk6", &pll0_sysclk6),
  408. CLK(NULL, "pll0_sysclk7", &pll0_sysclk7),
  409. CLK(NULL, "pll1", &pll1_clk),
  410. CLK(NULL, "pll1_aux", &pll1_aux_clk),
  411. CLK(NULL, "pll1_sysclk2", &pll1_sysclk2),
  412. CLK(NULL, "pll1_sysclk3", &pll1_sysclk3),
  413. CLK(NULL, "async3", &async3_clk),
  414. CLK("i2c_davinci.1", NULL, &i2c0_clk),
  415. CLK(NULL, "timer0", &timerp64_0_clk),
  416. CLK("davinci-wdt", NULL, &timerp64_1_clk),
  417. CLK(NULL, "arm_rom", &arm_rom_clk),
  418. CLK(NULL, "tpcc0", &tpcc0_clk),
  419. CLK(NULL, "tptc0", &tptc0_clk),
  420. CLK(NULL, "tptc1", &tptc1_clk),
  421. CLK(NULL, "tpcc1", &tpcc1_clk),
  422. CLK(NULL, "tptc2", &tptc2_clk),
  423. CLK("pruss_uio", "pruss", &pruss_clk),
  424. CLK("serial8250.0", NULL, &uart0_clk),
  425. CLK("serial8250.1", NULL, &uart1_clk),
  426. CLK("serial8250.2", NULL, &uart2_clk),
  427. CLK(NULL, "aintc", &aintc_clk),
  428. CLK(NULL, "gpio", &gpio_clk),
  429. CLK("i2c_davinci.2", NULL, &i2c1_clk),
  430. CLK(NULL, "emif3", &emif3_clk),
  431. CLK(NULL, "arm", &arm_clk),
  432. CLK(NULL, "rmii", &rmii_clk),
  433. CLK("davinci_emac.1", NULL, &emac_clk),
  434. CLK("davinci_mdio.0", "fck", &mdio_clk),
  435. CLK("davinci-mcasp.0", NULL, &mcasp_clk),
  436. CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk),
  437. CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk),
  438. CLK("da8xx_lcdc.0", "fck", &lcdc_clk),
  439. CLK("da830-mmc.0", NULL, &mmcsd0_clk),
  440. CLK("da830-mmc.1", NULL, &mmcsd1_clk),
  441. CLK("ti-aemif", NULL, &aemif_clk),
  442. CLK(NULL, "aemif", &aemif_clk),
  443. CLK(NULL, "usb11", &usb11_clk),
  444. CLK(NULL, "usb20", &usb20_clk),
  445. CLK("spi_davinci.0", NULL, &spi0_clk),
  446. CLK("spi_davinci.1", NULL, &spi1_clk),
  447. CLK("vpif", NULL, &vpif_clk),
  448. CLK("ahci_da850", NULL, &sata_clk),
  449. CLK("davinci-rproc.0", NULL, &dsp_clk),
  450. CLK("ehrpwm", "fck", &ehrpwm_clk),
  451. CLK("ehrpwm", "tbclk", &ehrpwm_tbclk),
  452. CLK("ecap", "fck", &ecap_clk),
  453. CLK(NULL, NULL, NULL),
  454. };
  455. /*
  456. * Device specific mux setup
  457. *
  458. * soc description mux mode mode mux dbg
  459. * reg offset mask mode
  460. */
  461. static const struct mux_config da850_pins[] = {
  462. #ifdef CONFIG_DAVINCI_MUX
  463. /* UART0 function */
  464. MUX_CFG(DA850, NUART0_CTS, 3, 24, 15, 2, false)
  465. MUX_CFG(DA850, NUART0_RTS, 3, 28, 15, 2, false)
  466. MUX_CFG(DA850, UART0_RXD, 3, 16, 15, 2, false)
  467. MUX_CFG(DA850, UART0_TXD, 3, 20, 15, 2, false)
  468. /* UART1 function */
  469. MUX_CFG(DA850, UART1_RXD, 4, 24, 15, 2, false)
  470. MUX_CFG(DA850, UART1_TXD, 4, 28, 15, 2, false)
  471. /* UART2 function */
  472. MUX_CFG(DA850, UART2_RXD, 4, 16, 15, 2, false)
  473. MUX_CFG(DA850, UART2_TXD, 4, 20, 15, 2, false)
  474. /* I2C1 function */
  475. MUX_CFG(DA850, I2C1_SCL, 4, 16, 15, 4, false)
  476. MUX_CFG(DA850, I2C1_SDA, 4, 20, 15, 4, false)
  477. /* I2C0 function */
  478. MUX_CFG(DA850, I2C0_SDA, 4, 12, 15, 2, false)
  479. MUX_CFG(DA850, I2C0_SCL, 4, 8, 15, 2, false)
  480. /* EMAC function */
  481. MUX_CFG(DA850, MII_TXEN, 2, 4, 15, 8, false)
  482. MUX_CFG(DA850, MII_TXCLK, 2, 8, 15, 8, false)
  483. MUX_CFG(DA850, MII_COL, 2, 12, 15, 8, false)
  484. MUX_CFG(DA850, MII_TXD_3, 2, 16, 15, 8, false)
  485. MUX_CFG(DA850, MII_TXD_2, 2, 20, 15, 8, false)
  486. MUX_CFG(DA850, MII_TXD_1, 2, 24, 15, 8, false)
  487. MUX_CFG(DA850, MII_TXD_0, 2, 28, 15, 8, false)
  488. MUX_CFG(DA850, MII_RXCLK, 3, 0, 15, 8, false)
  489. MUX_CFG(DA850, MII_RXDV, 3, 4, 15, 8, false)
  490. MUX_CFG(DA850, MII_RXER, 3, 8, 15, 8, false)
  491. MUX_CFG(DA850, MII_CRS, 3, 12, 15, 8, false)
  492. MUX_CFG(DA850, MII_RXD_3, 3, 16, 15, 8, false)
  493. MUX_CFG(DA850, MII_RXD_2, 3, 20, 15, 8, false)
  494. MUX_CFG(DA850, MII_RXD_1, 3, 24, 15, 8, false)
  495. MUX_CFG(DA850, MII_RXD_0, 3, 28, 15, 8, false)
  496. MUX_CFG(DA850, MDIO_CLK, 4, 0, 15, 8, false)
  497. MUX_CFG(DA850, MDIO_D, 4, 4, 15, 8, false)
  498. MUX_CFG(DA850, RMII_TXD_0, 14, 12, 15, 8, false)
  499. MUX_CFG(DA850, RMII_TXD_1, 14, 8, 15, 8, false)
  500. MUX_CFG(DA850, RMII_TXEN, 14, 16, 15, 8, false)
  501. MUX_CFG(DA850, RMII_CRS_DV, 15, 4, 15, 8, false)
  502. MUX_CFG(DA850, RMII_RXD_0, 14, 24, 15, 8, false)
  503. MUX_CFG(DA850, RMII_RXD_1, 14, 20, 15, 8, false)
  504. MUX_CFG(DA850, RMII_RXER, 14, 28, 15, 8, false)
  505. MUX_CFG(DA850, RMII_MHZ_50_CLK, 15, 0, 15, 0, false)
  506. /* McASP function */
  507. MUX_CFG(DA850, ACLKR, 0, 0, 15, 1, false)
  508. MUX_CFG(DA850, ACLKX, 0, 4, 15, 1, false)
  509. MUX_CFG(DA850, AFSR, 0, 8, 15, 1, false)
  510. MUX_CFG(DA850, AFSX, 0, 12, 15, 1, false)
  511. MUX_CFG(DA850, AHCLKR, 0, 16, 15, 1, false)
  512. MUX_CFG(DA850, AHCLKX, 0, 20, 15, 1, false)
  513. MUX_CFG(DA850, AMUTE, 0, 24, 15, 1, false)
  514. MUX_CFG(DA850, AXR_15, 1, 0, 15, 1, false)
  515. MUX_CFG(DA850, AXR_14, 1, 4, 15, 1, false)
  516. MUX_CFG(DA850, AXR_13, 1, 8, 15, 1, false)
  517. MUX_CFG(DA850, AXR_12, 1, 12, 15, 1, false)
  518. MUX_CFG(DA850, AXR_11, 1, 16, 15, 1, false)
  519. MUX_CFG(DA850, AXR_10, 1, 20, 15, 1, false)
  520. MUX_CFG(DA850, AXR_9, 1, 24, 15, 1, false)
  521. MUX_CFG(DA850, AXR_8, 1, 28, 15, 1, false)
  522. MUX_CFG(DA850, AXR_7, 2, 0, 15, 1, false)
  523. MUX_CFG(DA850, AXR_6, 2, 4, 15, 1, false)
  524. MUX_CFG(DA850, AXR_5, 2, 8, 15, 1, false)
  525. MUX_CFG(DA850, AXR_4, 2, 12, 15, 1, false)
  526. MUX_CFG(DA850, AXR_3, 2, 16, 15, 1, false)
  527. MUX_CFG(DA850, AXR_2, 2, 20, 15, 1, false)
  528. MUX_CFG(DA850, AXR_1, 2, 24, 15, 1, false)
  529. MUX_CFG(DA850, AXR_0, 2, 28, 15, 1, false)
  530. /* LCD function */
  531. MUX_CFG(DA850, LCD_D_7, 16, 8, 15, 2, false)
  532. MUX_CFG(DA850, LCD_D_6, 16, 12, 15, 2, false)
  533. MUX_CFG(DA850, LCD_D_5, 16, 16, 15, 2, false)
  534. MUX_CFG(DA850, LCD_D_4, 16, 20, 15, 2, false)
  535. MUX_CFG(DA850, LCD_D_3, 16, 24, 15, 2, false)
  536. MUX_CFG(DA850, LCD_D_2, 16, 28, 15, 2, false)
  537. MUX_CFG(DA850, LCD_D_1, 17, 0, 15, 2, false)
  538. MUX_CFG(DA850, LCD_D_0, 17, 4, 15, 2, false)
  539. MUX_CFG(DA850, LCD_D_15, 17, 8, 15, 2, false)
  540. MUX_CFG(DA850, LCD_D_14, 17, 12, 15, 2, false)
  541. MUX_CFG(DA850, LCD_D_13, 17, 16, 15, 2, false)
  542. MUX_CFG(DA850, LCD_D_12, 17, 20, 15, 2, false)
  543. MUX_CFG(DA850, LCD_D_11, 17, 24, 15, 2, false)
  544. MUX_CFG(DA850, LCD_D_10, 17, 28, 15, 2, false)
  545. MUX_CFG(DA850, LCD_D_9, 18, 0, 15, 2, false)
  546. MUX_CFG(DA850, LCD_D_8, 18, 4, 15, 2, false)
  547. MUX_CFG(DA850, LCD_PCLK, 18, 24, 15, 2, false)
  548. MUX_CFG(DA850, LCD_HSYNC, 19, 0, 15, 2, false)
  549. MUX_CFG(DA850, LCD_VSYNC, 19, 4, 15, 2, false)
  550. MUX_CFG(DA850, NLCD_AC_ENB_CS, 19, 24, 15, 2, false)
  551. /* MMC/SD0 function */
  552. MUX_CFG(DA850, MMCSD0_DAT_0, 10, 8, 15, 2, false)
  553. MUX_CFG(DA850, MMCSD0_DAT_1, 10, 12, 15, 2, false)
  554. MUX_CFG(DA850, MMCSD0_DAT_2, 10, 16, 15, 2, false)
  555. MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false)
  556. MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false)
  557. MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false)
  558. /* MMC/SD1 function */
  559. MUX_CFG(DA850, MMCSD1_DAT_0, 18, 8, 15, 2, false)
  560. MUX_CFG(DA850, MMCSD1_DAT_1, 19, 16, 15, 2, false)
  561. MUX_CFG(DA850, MMCSD1_DAT_2, 19, 12, 15, 2, false)
  562. MUX_CFG(DA850, MMCSD1_DAT_3, 19, 8, 15, 2, false)
  563. MUX_CFG(DA850, MMCSD1_CLK, 18, 12, 15, 2, false)
  564. MUX_CFG(DA850, MMCSD1_CMD, 18, 16, 15, 2, false)
  565. /* EMIF2.5/EMIFA function */
  566. MUX_CFG(DA850, EMA_D_7, 9, 0, 15, 1, false)
  567. MUX_CFG(DA850, EMA_D_6, 9, 4, 15, 1, false)
  568. MUX_CFG(DA850, EMA_D_5, 9, 8, 15, 1, false)
  569. MUX_CFG(DA850, EMA_D_4, 9, 12, 15, 1, false)
  570. MUX_CFG(DA850, EMA_D_3, 9, 16, 15, 1, false)
  571. MUX_CFG(DA850, EMA_D_2, 9, 20, 15, 1, false)
  572. MUX_CFG(DA850, EMA_D_1, 9, 24, 15, 1, false)
  573. MUX_CFG(DA850, EMA_D_0, 9, 28, 15, 1, false)
  574. MUX_CFG(DA850, EMA_A_1, 12, 24, 15, 1, false)
  575. MUX_CFG(DA850, EMA_A_2, 12, 20, 15, 1, false)
  576. MUX_CFG(DA850, NEMA_CS_3, 7, 4, 15, 1, false)
  577. MUX_CFG(DA850, NEMA_CS_4, 7, 8, 15, 1, false)
  578. MUX_CFG(DA850, NEMA_WE, 7, 16, 15, 1, false)
  579. MUX_CFG(DA850, NEMA_OE, 7, 20, 15, 1, false)
  580. MUX_CFG(DA850, EMA_A_0, 12, 28, 15, 1, false)
  581. MUX_CFG(DA850, EMA_A_3, 12, 16, 15, 1, false)
  582. MUX_CFG(DA850, EMA_A_4, 12, 12, 15, 1, false)
  583. MUX_CFG(DA850, EMA_A_5, 12, 8, 15, 1, false)
  584. MUX_CFG(DA850, EMA_A_6, 12, 4, 15, 1, false)
  585. MUX_CFG(DA850, EMA_A_7, 12, 0, 15, 1, false)
  586. MUX_CFG(DA850, EMA_A_8, 11, 28, 15, 1, false)
  587. MUX_CFG(DA850, EMA_A_9, 11, 24, 15, 1, false)
  588. MUX_CFG(DA850, EMA_A_10, 11, 20, 15, 1, false)
  589. MUX_CFG(DA850, EMA_A_11, 11, 16, 15, 1, false)
  590. MUX_CFG(DA850, EMA_A_12, 11, 12, 15, 1, false)
  591. MUX_CFG(DA850, EMA_A_13, 11, 8, 15, 1, false)
  592. MUX_CFG(DA850, EMA_A_14, 11, 4, 15, 1, false)
  593. MUX_CFG(DA850, EMA_A_15, 11, 0, 15, 1, false)
  594. MUX_CFG(DA850, EMA_A_16, 10, 28, 15, 1, false)
  595. MUX_CFG(DA850, EMA_A_17, 10, 24, 15, 1, false)
  596. MUX_CFG(DA850, EMA_A_18, 10, 20, 15, 1, false)
  597. MUX_CFG(DA850, EMA_A_19, 10, 16, 15, 1, false)
  598. MUX_CFG(DA850, EMA_A_20, 10, 12, 15, 1, false)
  599. MUX_CFG(DA850, EMA_A_21, 10, 8, 15, 1, false)
  600. MUX_CFG(DA850, EMA_A_22, 10, 4, 15, 1, false)
  601. MUX_CFG(DA850, EMA_A_23, 10, 0, 15, 1, false)
  602. MUX_CFG(DA850, EMA_D_8, 8, 28, 15, 1, false)
  603. MUX_CFG(DA850, EMA_D_9, 8, 24, 15, 1, false)
  604. MUX_CFG(DA850, EMA_D_10, 8, 20, 15, 1, false)
  605. MUX_CFG(DA850, EMA_D_11, 8, 16, 15, 1, false)
  606. MUX_CFG(DA850, EMA_D_12, 8, 12, 15, 1, false)
  607. MUX_CFG(DA850, EMA_D_13, 8, 8, 15, 1, false)
  608. MUX_CFG(DA850, EMA_D_14, 8, 4, 15, 1, false)
  609. MUX_CFG(DA850, EMA_D_15, 8, 0, 15, 1, false)
  610. MUX_CFG(DA850, EMA_BA_1, 5, 24, 15, 1, false)
  611. MUX_CFG(DA850, EMA_CLK, 6, 0, 15, 1, false)
  612. MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false)
  613. MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false)
  614. /* GPIO function */
  615. MUX_CFG(DA850, GPIO2_4, 6, 12, 15, 8, false)
  616. MUX_CFG(DA850, GPIO2_6, 6, 4, 15, 8, false)
  617. MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false)
  618. MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false)
  619. MUX_CFG(DA850, GPIO3_12, 7, 12, 15, 8, false)
  620. MUX_CFG(DA850, GPIO3_13, 7, 8, 15, 8, false)
  621. MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false)
  622. MUX_CFG(DA850, GPIO4_1, 10, 24, 15, 8, false)
  623. MUX_CFG(DA850, GPIO6_9, 13, 24, 15, 8, false)
  624. MUX_CFG(DA850, GPIO6_10, 13, 20, 15, 8, false)
  625. MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)
  626. MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false)
  627. /* VPIF Capture */
  628. MUX_CFG(DA850, VPIF_DIN0, 15, 4, 15, 1, false)
  629. MUX_CFG(DA850, VPIF_DIN1, 15, 0, 15, 1, false)
  630. MUX_CFG(DA850, VPIF_DIN2, 14, 28, 15, 1, false)
  631. MUX_CFG(DA850, VPIF_DIN3, 14, 24, 15, 1, false)
  632. MUX_CFG(DA850, VPIF_DIN4, 14, 20, 15, 1, false)
  633. MUX_CFG(DA850, VPIF_DIN5, 14, 16, 15, 1, false)
  634. MUX_CFG(DA850, VPIF_DIN6, 14, 12, 15, 1, false)
  635. MUX_CFG(DA850, VPIF_DIN7, 14, 8, 15, 1, false)
  636. MUX_CFG(DA850, VPIF_DIN8, 16, 4, 15, 1, false)
  637. MUX_CFG(DA850, VPIF_DIN9, 16, 0, 15, 1, false)
  638. MUX_CFG(DA850, VPIF_DIN10, 15, 28, 15, 1, false)
  639. MUX_CFG(DA850, VPIF_DIN11, 15, 24, 15, 1, false)
  640. MUX_CFG(DA850, VPIF_DIN12, 15, 20, 15, 1, false)
  641. MUX_CFG(DA850, VPIF_DIN13, 15, 16, 15, 1, false)
  642. MUX_CFG(DA850, VPIF_DIN14, 15, 12, 15, 1, false)
  643. MUX_CFG(DA850, VPIF_DIN15, 15, 8, 15, 1, false)
  644. MUX_CFG(DA850, VPIF_CLKIN0, 14, 0, 15, 1, false)
  645. MUX_CFG(DA850, VPIF_CLKIN1, 14, 4, 15, 1, false)
  646. MUX_CFG(DA850, VPIF_CLKIN2, 19, 8, 15, 1, false)
  647. MUX_CFG(DA850, VPIF_CLKIN3, 19, 16, 15, 1, false)
  648. /* VPIF Display */
  649. MUX_CFG(DA850, VPIF_DOUT0, 17, 4, 15, 1, false)
  650. MUX_CFG(DA850, VPIF_DOUT1, 17, 0, 15, 1, false)
  651. MUX_CFG(DA850, VPIF_DOUT2, 16, 28, 15, 1, false)
  652. MUX_CFG(DA850, VPIF_DOUT3, 16, 24, 15, 1, false)
  653. MUX_CFG(DA850, VPIF_DOUT4, 16, 20, 15, 1, false)
  654. MUX_CFG(DA850, VPIF_DOUT5, 16, 16, 15, 1, false)
  655. MUX_CFG(DA850, VPIF_DOUT6, 16, 12, 15, 1, false)
  656. MUX_CFG(DA850, VPIF_DOUT7, 16, 8, 15, 1, false)
  657. MUX_CFG(DA850, VPIF_DOUT8, 18, 4, 15, 1, false)
  658. MUX_CFG(DA850, VPIF_DOUT9, 18, 0, 15, 1, false)
  659. MUX_CFG(DA850, VPIF_DOUT10, 17, 28, 15, 1, false)
  660. MUX_CFG(DA850, VPIF_DOUT11, 17, 24, 15, 1, false)
  661. MUX_CFG(DA850, VPIF_DOUT12, 17, 20, 15, 1, false)
  662. MUX_CFG(DA850, VPIF_DOUT13, 17, 16, 15, 1, false)
  663. MUX_CFG(DA850, VPIF_DOUT14, 17, 12, 15, 1, false)
  664. MUX_CFG(DA850, VPIF_DOUT15, 17, 8, 15, 1, false)
  665. MUX_CFG(DA850, VPIF_CLKO2, 19, 12, 15, 1, false)
  666. MUX_CFG(DA850, VPIF_CLKO3, 19, 20, 15, 1, false)
  667. #endif
  668. };
  669. const short da850_i2c0_pins[] __initconst = {
  670. DA850_I2C0_SDA, DA850_I2C0_SCL,
  671. -1
  672. };
  673. const short da850_i2c1_pins[] __initconst = {
  674. DA850_I2C1_SCL, DA850_I2C1_SDA,
  675. -1
  676. };
  677. const short da850_lcdcntl_pins[] __initconst = {
  678. DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3,
  679. DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7,
  680. DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11,
  681. DA850_LCD_D_12, DA850_LCD_D_13, DA850_LCD_D_14, DA850_LCD_D_15,
  682. DA850_LCD_PCLK, DA850_LCD_HSYNC, DA850_LCD_VSYNC, DA850_NLCD_AC_ENB_CS,
  683. -1
  684. };
  685. const short da850_vpif_capture_pins[] __initconst = {
  686. DA850_VPIF_DIN0, DA850_VPIF_DIN1, DA850_VPIF_DIN2, DA850_VPIF_DIN3,
  687. DA850_VPIF_DIN4, DA850_VPIF_DIN5, DA850_VPIF_DIN6, DA850_VPIF_DIN7,
  688. DA850_VPIF_DIN8, DA850_VPIF_DIN9, DA850_VPIF_DIN10, DA850_VPIF_DIN11,
  689. DA850_VPIF_DIN12, DA850_VPIF_DIN13, DA850_VPIF_DIN14, DA850_VPIF_DIN15,
  690. DA850_VPIF_CLKIN0, DA850_VPIF_CLKIN1, DA850_VPIF_CLKIN2,
  691. DA850_VPIF_CLKIN3,
  692. -1
  693. };
  694. const short da850_vpif_display_pins[] __initconst = {
  695. DA850_VPIF_DOUT0, DA850_VPIF_DOUT1, DA850_VPIF_DOUT2, DA850_VPIF_DOUT3,
  696. DA850_VPIF_DOUT4, DA850_VPIF_DOUT5, DA850_VPIF_DOUT6, DA850_VPIF_DOUT7,
  697. DA850_VPIF_DOUT8, DA850_VPIF_DOUT9, DA850_VPIF_DOUT10,
  698. DA850_VPIF_DOUT11, DA850_VPIF_DOUT12, DA850_VPIF_DOUT13,
  699. DA850_VPIF_DOUT14, DA850_VPIF_DOUT15, DA850_VPIF_CLKO2,
  700. DA850_VPIF_CLKO3,
  701. -1
  702. };
  703. /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
  704. static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = {
  705. [IRQ_DA8XX_COMMTX] = 7,
  706. [IRQ_DA8XX_COMMRX] = 7,
  707. [IRQ_DA8XX_NINT] = 7,
  708. [IRQ_DA8XX_EVTOUT0] = 7,
  709. [IRQ_DA8XX_EVTOUT1] = 7,
  710. [IRQ_DA8XX_EVTOUT2] = 7,
  711. [IRQ_DA8XX_EVTOUT3] = 7,
  712. [IRQ_DA8XX_EVTOUT4] = 7,
  713. [IRQ_DA8XX_EVTOUT5] = 7,
  714. [IRQ_DA8XX_EVTOUT6] = 7,
  715. [IRQ_DA8XX_EVTOUT7] = 7,
  716. [IRQ_DA8XX_CCINT0] = 7,
  717. [IRQ_DA8XX_CCERRINT] = 7,
  718. [IRQ_DA8XX_TCERRINT0] = 7,
  719. [IRQ_DA8XX_AEMIFINT] = 7,
  720. [IRQ_DA8XX_I2CINT0] = 7,
  721. [IRQ_DA8XX_MMCSDINT0] = 7,
  722. [IRQ_DA8XX_MMCSDINT1] = 7,
  723. [IRQ_DA8XX_ALLINT0] = 7,
  724. [IRQ_DA8XX_RTC] = 7,
  725. [IRQ_DA8XX_SPINT0] = 7,
  726. [IRQ_DA8XX_TINT12_0] = 7,
  727. [IRQ_DA8XX_TINT34_0] = 7,
  728. [IRQ_DA8XX_TINT12_1] = 7,
  729. [IRQ_DA8XX_TINT34_1] = 7,
  730. [IRQ_DA8XX_UARTINT0] = 7,
  731. [IRQ_DA8XX_KEYMGRINT] = 7,
  732. [IRQ_DA850_MPUADDRERR0] = 7,
  733. [IRQ_DA8XX_CHIPINT0] = 7,
  734. [IRQ_DA8XX_CHIPINT1] = 7,
  735. [IRQ_DA8XX_CHIPINT2] = 7,
  736. [IRQ_DA8XX_CHIPINT3] = 7,
  737. [IRQ_DA8XX_TCERRINT1] = 7,
  738. [IRQ_DA8XX_C0_RX_THRESH_PULSE] = 7,
  739. [IRQ_DA8XX_C0_RX_PULSE] = 7,
  740. [IRQ_DA8XX_C0_TX_PULSE] = 7,
  741. [IRQ_DA8XX_C0_MISC_PULSE] = 7,
  742. [IRQ_DA8XX_C1_RX_THRESH_PULSE] = 7,
  743. [IRQ_DA8XX_C1_RX_PULSE] = 7,
  744. [IRQ_DA8XX_C1_TX_PULSE] = 7,
  745. [IRQ_DA8XX_C1_MISC_PULSE] = 7,
  746. [IRQ_DA8XX_MEMERR] = 7,
  747. [IRQ_DA8XX_GPIO0] = 7,
  748. [IRQ_DA8XX_GPIO1] = 7,
  749. [IRQ_DA8XX_GPIO2] = 7,
  750. [IRQ_DA8XX_GPIO3] = 7,
  751. [IRQ_DA8XX_GPIO4] = 7,
  752. [IRQ_DA8XX_GPIO5] = 7,
  753. [IRQ_DA8XX_GPIO6] = 7,
  754. [IRQ_DA8XX_GPIO7] = 7,
  755. [IRQ_DA8XX_GPIO8] = 7,
  756. [IRQ_DA8XX_I2CINT1] = 7,
  757. [IRQ_DA8XX_LCDINT] = 7,
  758. [IRQ_DA8XX_UARTINT1] = 7,
  759. [IRQ_DA8XX_MCASPINT] = 7,
  760. [IRQ_DA8XX_ALLINT1] = 7,
  761. [IRQ_DA8XX_SPINT1] = 7,
  762. [IRQ_DA8XX_UHPI_INT1] = 7,
  763. [IRQ_DA8XX_USB_INT] = 7,
  764. [IRQ_DA8XX_IRQN] = 7,
  765. [IRQ_DA8XX_RWAKEUP] = 7,
  766. [IRQ_DA8XX_UARTINT2] = 7,
  767. [IRQ_DA8XX_DFTSSINT] = 7,
  768. [IRQ_DA8XX_EHRPWM0] = 7,
  769. [IRQ_DA8XX_EHRPWM0TZ] = 7,
  770. [IRQ_DA8XX_EHRPWM1] = 7,
  771. [IRQ_DA8XX_EHRPWM1TZ] = 7,
  772. [IRQ_DA850_SATAINT] = 7,
  773. [IRQ_DA850_TINTALL_2] = 7,
  774. [IRQ_DA8XX_ECAP0] = 7,
  775. [IRQ_DA8XX_ECAP1] = 7,
  776. [IRQ_DA8XX_ECAP2] = 7,
  777. [IRQ_DA850_MMCSDINT0_1] = 7,
  778. [IRQ_DA850_MMCSDINT1_1] = 7,
  779. [IRQ_DA850_T12CMPINT0_2] = 7,
  780. [IRQ_DA850_T12CMPINT1_2] = 7,
  781. [IRQ_DA850_T12CMPINT2_2] = 7,
  782. [IRQ_DA850_T12CMPINT3_2] = 7,
  783. [IRQ_DA850_T12CMPINT4_2] = 7,
  784. [IRQ_DA850_T12CMPINT5_2] = 7,
  785. [IRQ_DA850_T12CMPINT6_2] = 7,
  786. [IRQ_DA850_T12CMPINT7_2] = 7,
  787. [IRQ_DA850_T12CMPINT0_3] = 7,
  788. [IRQ_DA850_T12CMPINT1_3] = 7,
  789. [IRQ_DA850_T12CMPINT2_3] = 7,
  790. [IRQ_DA850_T12CMPINT3_3] = 7,
  791. [IRQ_DA850_T12CMPINT4_3] = 7,
  792. [IRQ_DA850_T12CMPINT5_3] = 7,
  793. [IRQ_DA850_T12CMPINT6_3] = 7,
  794. [IRQ_DA850_T12CMPINT7_3] = 7,
  795. [IRQ_DA850_RPIINT] = 7,
  796. [IRQ_DA850_VPIFINT] = 7,
  797. [IRQ_DA850_CCINT1] = 7,
  798. [IRQ_DA850_CCERRINT1] = 7,
  799. [IRQ_DA850_TCERRINT2] = 7,
  800. [IRQ_DA850_TINTALL_3] = 7,
  801. [IRQ_DA850_MCBSP0RINT] = 7,
  802. [IRQ_DA850_MCBSP0XINT] = 7,
  803. [IRQ_DA850_MCBSP1RINT] = 7,
  804. [IRQ_DA850_MCBSP1XINT] = 7,
  805. [IRQ_DA8XX_ARMCLKSTOPREQ] = 7,
  806. };
  807. static struct map_desc da850_io_desc[] = {
  808. {
  809. .virtual = IO_VIRT,
  810. .pfn = __phys_to_pfn(IO_PHYS),
  811. .length = IO_SIZE,
  812. .type = MT_DEVICE
  813. },
  814. {
  815. .virtual = DA8XX_CP_INTC_VIRT,
  816. .pfn = __phys_to_pfn(DA8XX_CP_INTC_BASE),
  817. .length = DA8XX_CP_INTC_SIZE,
  818. .type = MT_DEVICE
  819. },
  820. };
  821. static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
  822. /* Contents of JTAG ID register used to identify exact cpu type */
  823. static struct davinci_id da850_ids[] = {
  824. {
  825. .variant = 0x0,
  826. .part_no = 0xb7d1,
  827. .manufacturer = 0x017, /* 0x02f >> 1 */
  828. .cpu_id = DAVINCI_CPU_ID_DA850,
  829. .name = "da850/omap-l138",
  830. },
  831. {
  832. .variant = 0x1,
  833. .part_no = 0xb7d1,
  834. .manufacturer = 0x017, /* 0x02f >> 1 */
  835. .cpu_id = DAVINCI_CPU_ID_DA850,
  836. .name = "da850/omap-l138/am18x",
  837. },
  838. };
  839. static struct davinci_timer_instance da850_timer_instance[4] = {
  840. {
  841. .base = DA8XX_TIMER64P0_BASE,
  842. .bottom_irq = IRQ_DA8XX_TINT12_0,
  843. .top_irq = IRQ_DA8XX_TINT34_0,
  844. },
  845. {
  846. .base = DA8XX_TIMER64P1_BASE,
  847. .bottom_irq = IRQ_DA8XX_TINT12_1,
  848. .top_irq = IRQ_DA8XX_TINT34_1,
  849. },
  850. {
  851. .base = DA850_TIMER64P2_BASE,
  852. .bottom_irq = IRQ_DA850_TINT12_2,
  853. .top_irq = IRQ_DA850_TINT34_2,
  854. },
  855. {
  856. .base = DA850_TIMER64P3_BASE,
  857. .bottom_irq = IRQ_DA850_TINT12_3,
  858. .top_irq = IRQ_DA850_TINT34_3,
  859. },
  860. };
  861. /*
  862. * T0_BOT: Timer 0, bottom : Used for clock_event
  863. * T0_TOP: Timer 0, top : Used for clocksource
  864. * T1_BOT, T1_TOP: Timer 1, bottom & top: Used for watchdog timer
  865. */
  866. static struct davinci_timer_info da850_timer_info = {
  867. .timers = da850_timer_instance,
  868. .clockevent_id = T0_BOT,
  869. .clocksource_id = T0_TOP,
  870. };
  871. #ifdef CONFIG_CPU_FREQ
  872. /*
  873. * Notes:
  874. * According to the TRM, minimum PLLM results in maximum power savings.
  875. * The OPP definitions below should keep the PLLM as low as possible.
  876. *
  877. * The output of the PLLM must be between 300 to 600 MHz.
  878. */
  879. struct da850_opp {
  880. unsigned int freq; /* in KHz */
  881. unsigned int prediv;
  882. unsigned int mult;
  883. unsigned int postdiv;
  884. unsigned int cvdd_min; /* in uV */
  885. unsigned int cvdd_max; /* in uV */
  886. };
  887. static const struct da850_opp da850_opp_456 = {
  888. .freq = 456000,
  889. .prediv = 1,
  890. .mult = 19,
  891. .postdiv = 1,
  892. .cvdd_min = 1300000,
  893. .cvdd_max = 1350000,
  894. };
  895. static const struct da850_opp da850_opp_408 = {
  896. .freq = 408000,
  897. .prediv = 1,
  898. .mult = 17,
  899. .postdiv = 1,
  900. .cvdd_min = 1300000,
  901. .cvdd_max = 1350000,
  902. };
  903. static const struct da850_opp da850_opp_372 = {
  904. .freq = 372000,
  905. .prediv = 2,
  906. .mult = 31,
  907. .postdiv = 1,
  908. .cvdd_min = 1200000,
  909. .cvdd_max = 1320000,
  910. };
  911. static const struct da850_opp da850_opp_300 = {
  912. .freq = 300000,
  913. .prediv = 1,
  914. .mult = 25,
  915. .postdiv = 2,
  916. .cvdd_min = 1200000,
  917. .cvdd_max = 1320000,
  918. };
  919. static const struct da850_opp da850_opp_200 = {
  920. .freq = 200000,
  921. .prediv = 1,
  922. .mult = 25,
  923. .postdiv = 3,
  924. .cvdd_min = 1100000,
  925. .cvdd_max = 1160000,
  926. };
  927. static const struct da850_opp da850_opp_96 = {
  928. .freq = 96000,
  929. .prediv = 1,
  930. .mult = 20,
  931. .postdiv = 5,
  932. .cvdd_min = 1000000,
  933. .cvdd_max = 1050000,
  934. };
  935. #define OPP(freq) \
  936. { \
  937. .driver_data = (unsigned int) &da850_opp_##freq, \
  938. .frequency = freq * 1000, \
  939. }
  940. static struct cpufreq_frequency_table da850_freq_table[] = {
  941. OPP(456),
  942. OPP(408),
  943. OPP(372),
  944. OPP(300),
  945. OPP(200),
  946. OPP(96),
  947. {
  948. .driver_data = 0,
  949. .frequency = CPUFREQ_TABLE_END,
  950. },
  951. };
  952. #ifdef CONFIG_REGULATOR
  953. static int da850_set_voltage(unsigned int index);
  954. static int da850_regulator_init(void);
  955. #endif
  956. static struct davinci_cpufreq_config cpufreq_info = {
  957. .freq_table = da850_freq_table,
  958. #ifdef CONFIG_REGULATOR
  959. .init = da850_regulator_init,
  960. .set_voltage = da850_set_voltage,
  961. #endif
  962. };
  963. #ifdef CONFIG_REGULATOR
  964. static struct regulator *cvdd;
  965. static int da850_set_voltage(unsigned int index)
  966. {
  967. struct da850_opp *opp;
  968. if (!cvdd)
  969. return -ENODEV;
  970. opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
  971. return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
  972. }
  973. static int da850_regulator_init(void)
  974. {
  975. cvdd = regulator_get(NULL, "cvdd");
  976. if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
  977. " voltage scaling unsupported\n")) {
  978. return PTR_ERR(cvdd);
  979. }
  980. return 0;
  981. }
  982. #endif
  983. static struct platform_device da850_cpufreq_device = {
  984. .name = "cpufreq-davinci",
  985. .dev = {
  986. .platform_data = &cpufreq_info,
  987. },
  988. .id = -1,
  989. };
  990. unsigned int da850_max_speed = 300000;
  991. int da850_register_cpufreq(char *async_clk)
  992. {
  993. int i;
  994. /* cpufreq driver can help keep an "async" clock constant */
  995. if (async_clk)
  996. clk_add_alias("async", da850_cpufreq_device.name,
  997. async_clk, NULL);
  998. for (i = 0; i < ARRAY_SIZE(da850_freq_table); i++) {
  999. if (da850_freq_table[i].frequency <= da850_max_speed) {
  1000. cpufreq_info.freq_table = &da850_freq_table[i];
  1001. break;
  1002. }
  1003. }
  1004. return platform_device_register(&da850_cpufreq_device);
  1005. }
  1006. static int da850_round_armrate(struct clk *clk, unsigned long rate)
  1007. {
  1008. int ret = 0, diff;
  1009. unsigned int best = (unsigned int) -1;
  1010. struct cpufreq_frequency_table *table = cpufreq_info.freq_table;
  1011. struct cpufreq_frequency_table *pos;
  1012. rate /= 1000; /* convert to kHz */
  1013. cpufreq_for_each_entry(pos, table) {
  1014. diff = pos->frequency - rate;
  1015. if (diff < 0)
  1016. diff = -diff;
  1017. if (diff < best) {
  1018. best = diff;
  1019. ret = pos->frequency;
  1020. }
  1021. }
  1022. return ret * 1000;
  1023. }
  1024. static int da850_set_armrate(struct clk *clk, unsigned long index)
  1025. {
  1026. struct clk *pllclk = &pll0_clk;
  1027. return clk_set_rate(pllclk, index);
  1028. }
  1029. static int da850_set_pll0rate(struct clk *clk, unsigned long index)
  1030. {
  1031. unsigned int prediv, mult, postdiv;
  1032. struct da850_opp *opp;
  1033. struct pll_data *pll = clk->pll_data;
  1034. int ret;
  1035. opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
  1036. prediv = opp->prediv;
  1037. mult = opp->mult;
  1038. postdiv = opp->postdiv;
  1039. ret = davinci_set_pllrate(pll, prediv, mult, postdiv);
  1040. if (WARN_ON(ret))
  1041. return ret;
  1042. return 0;
  1043. }
  1044. #else
  1045. int __init da850_register_cpufreq(char *async_clk)
  1046. {
  1047. return 0;
  1048. }
  1049. static int da850_set_armrate(struct clk *clk, unsigned long rate)
  1050. {
  1051. return -EINVAL;
  1052. }
  1053. static int da850_set_pll0rate(struct clk *clk, unsigned long armrate)
  1054. {
  1055. return -EINVAL;
  1056. }
  1057. static int da850_round_armrate(struct clk *clk, unsigned long rate)
  1058. {
  1059. return clk->rate;
  1060. }
  1061. #endif
  1062. int __init da850_register_pm(struct platform_device *pdev)
  1063. {
  1064. int ret;
  1065. struct davinci_pm_config *pdata = pdev->dev.platform_data;
  1066. ret = davinci_cfg_reg(DA850_RTC_ALARM);
  1067. if (ret)
  1068. return ret;
  1069. pdata->ddr2_ctlr_base = da8xx_get_mem_ctlr();
  1070. pdata->deepsleep_reg = DA8XX_SYSCFG1_VIRT(DA8XX_DEEPSLEEP_REG);
  1071. pdata->ddrpsc_num = DA8XX_LPSC1_EMIF3C;
  1072. pdata->cpupll_reg_base = ioremap(DA8XX_PLL0_BASE, SZ_4K);
  1073. if (!pdata->cpupll_reg_base)
  1074. return -ENOMEM;
  1075. pdata->ddrpll_reg_base = ioremap(DA850_PLL1_BASE, SZ_4K);
  1076. if (!pdata->ddrpll_reg_base) {
  1077. ret = -ENOMEM;
  1078. goto no_ddrpll_mem;
  1079. }
  1080. pdata->ddrpsc_reg_base = ioremap(DA8XX_PSC1_BASE, SZ_4K);
  1081. if (!pdata->ddrpsc_reg_base) {
  1082. ret = -ENOMEM;
  1083. goto no_ddrpsc_mem;
  1084. }
  1085. return platform_device_register(pdev);
  1086. no_ddrpsc_mem:
  1087. iounmap(pdata->ddrpll_reg_base);
  1088. no_ddrpll_mem:
  1089. iounmap(pdata->cpupll_reg_base);
  1090. return ret;
  1091. }
  1092. /* VPIF resource, platform data */
  1093. static u64 da850_vpif_dma_mask = DMA_BIT_MASK(32);
  1094. static struct resource da850_vpif_resource[] = {
  1095. {
  1096. .start = DA8XX_VPIF_BASE,
  1097. .end = DA8XX_VPIF_BASE + 0xfff,
  1098. .flags = IORESOURCE_MEM,
  1099. }
  1100. };
  1101. static struct platform_device da850_vpif_dev = {
  1102. .name = "vpif",
  1103. .id = -1,
  1104. .dev = {
  1105. .dma_mask = &da850_vpif_dma_mask,
  1106. .coherent_dma_mask = DMA_BIT_MASK(32),
  1107. },
  1108. .resource = da850_vpif_resource,
  1109. .num_resources = ARRAY_SIZE(da850_vpif_resource),
  1110. };
  1111. static struct resource da850_vpif_display_resource[] = {
  1112. {
  1113. .start = IRQ_DA850_VPIFINT,
  1114. .end = IRQ_DA850_VPIFINT,
  1115. .flags = IORESOURCE_IRQ,
  1116. },
  1117. };
  1118. static struct platform_device da850_vpif_display_dev = {
  1119. .name = "vpif_display",
  1120. .id = -1,
  1121. .dev = {
  1122. .dma_mask = &da850_vpif_dma_mask,
  1123. .coherent_dma_mask = DMA_BIT_MASK(32),
  1124. },
  1125. .resource = da850_vpif_display_resource,
  1126. .num_resources = ARRAY_SIZE(da850_vpif_display_resource),
  1127. };
  1128. static struct resource da850_vpif_capture_resource[] = {
  1129. {
  1130. .start = IRQ_DA850_VPIFINT,
  1131. .end = IRQ_DA850_VPIFINT,
  1132. .flags = IORESOURCE_IRQ,
  1133. },
  1134. {
  1135. .start = IRQ_DA850_VPIFINT,
  1136. .end = IRQ_DA850_VPIFINT,
  1137. .flags = IORESOURCE_IRQ,
  1138. },
  1139. };
  1140. static struct platform_device da850_vpif_capture_dev = {
  1141. .name = "vpif_capture",
  1142. .id = -1,
  1143. .dev = {
  1144. .dma_mask = &da850_vpif_dma_mask,
  1145. .coherent_dma_mask = DMA_BIT_MASK(32),
  1146. },
  1147. .resource = da850_vpif_capture_resource,
  1148. .num_resources = ARRAY_SIZE(da850_vpif_capture_resource),
  1149. };
  1150. int __init da850_register_vpif(void)
  1151. {
  1152. return platform_device_register(&da850_vpif_dev);
  1153. }
  1154. int __init da850_register_vpif_display(struct vpif_display_config
  1155. *display_config)
  1156. {
  1157. da850_vpif_display_dev.dev.platform_data = display_config;
  1158. return platform_device_register(&da850_vpif_display_dev);
  1159. }
  1160. int __init da850_register_vpif_capture(struct vpif_capture_config
  1161. *capture_config)
  1162. {
  1163. da850_vpif_capture_dev.dev.platform_data = capture_config;
  1164. return platform_device_register(&da850_vpif_capture_dev);
  1165. }
  1166. static struct davinci_gpio_platform_data da850_gpio_platform_data = {
  1167. .ngpio = 144,
  1168. };
  1169. int __init da850_register_gpio(void)
  1170. {
  1171. return da8xx_register_gpio(&da850_gpio_platform_data);
  1172. }
  1173. static struct davinci_soc_info davinci_soc_info_da850 = {
  1174. .io_desc = da850_io_desc,
  1175. .io_desc_num = ARRAY_SIZE(da850_io_desc),
  1176. .jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
  1177. .ids = da850_ids,
  1178. .ids_num = ARRAY_SIZE(da850_ids),
  1179. .cpu_clks = da850_clks,
  1180. .psc_bases = da850_psc_bases,
  1181. .psc_bases_num = ARRAY_SIZE(da850_psc_bases),
  1182. .pinmux_base = DA8XX_SYSCFG0_BASE + 0x120,
  1183. .pinmux_pins = da850_pins,
  1184. .pinmux_pins_num = ARRAY_SIZE(da850_pins),
  1185. .intc_base = DA8XX_CP_INTC_BASE,
  1186. .intc_type = DAVINCI_INTC_TYPE_CP_INTC,
  1187. .intc_irq_prios = da850_default_priorities,
  1188. .intc_irq_num = DA850_N_CP_INTC_IRQ,
  1189. .timer_info = &da850_timer_info,
  1190. .emac_pdata = &da8xx_emac_pdata,
  1191. .sram_dma = DA8XX_SHARED_RAM_BASE,
  1192. .sram_len = SZ_128K,
  1193. };
  1194. void __init da850_init(void)
  1195. {
  1196. unsigned int v;
  1197. davinci_common_init(&davinci_soc_info_da850);
  1198. da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
  1199. if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module"))
  1200. return;
  1201. da8xx_syscfg1_base = ioremap(DA8XX_SYSCFG1_BASE, SZ_4K);
  1202. if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module"))
  1203. return;
  1204. /* Unlock writing to PLL0 registers */
  1205. v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG));
  1206. v &= ~CFGCHIP0_PLL_MASTER_LOCK;
  1207. __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG));
  1208. /* Unlock writing to PLL1 registers */
  1209. v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
  1210. v &= ~CFGCHIP3_PLL1_MASTER_LOCK;
  1211. __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
  1212. davinci_clk_init(davinci_soc_info_da850.cpu_clks);
  1213. }