tegra124.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
  4. */
  5. #include <linux/of.h>
  6. #include <linux/of_device.h>
  7. #include <linux/slab.h>
  8. #include <dt-bindings/memory/tegra124-mc.h>
  9. #include "mc.h"
  10. static const struct tegra_mc_client tegra124_mc_clients[] = {
  11. {
  12. .id = 0x00,
  13. .name = "ptcr",
  14. .swgroup = TEGRA_SWGROUP_PTC,
  15. .regs = {
  16. .la = {
  17. .reg = 0x34c,
  18. .shift = 0,
  19. .mask = 0xff,
  20. .def = 0x0,
  21. },
  22. },
  23. }, {
  24. .id = 0x01,
  25. .name = "display0a",
  26. .swgroup = TEGRA_SWGROUP_DC,
  27. .regs = {
  28. .smmu = {
  29. .reg = 0x228,
  30. .bit = 1,
  31. },
  32. .la = {
  33. .reg = 0x2e8,
  34. .shift = 0,
  35. .mask = 0xff,
  36. .def = 0xc2,
  37. },
  38. },
  39. }, {
  40. .id = 0x02,
  41. .name = "display0ab",
  42. .swgroup = TEGRA_SWGROUP_DCB,
  43. .regs = {
  44. .smmu = {
  45. .reg = 0x228,
  46. .bit = 2,
  47. },
  48. .la = {
  49. .reg = 0x2f4,
  50. .shift = 0,
  51. .mask = 0xff,
  52. .def = 0xc6,
  53. },
  54. },
  55. }, {
  56. .id = 0x03,
  57. .name = "display0b",
  58. .swgroup = TEGRA_SWGROUP_DC,
  59. .regs = {
  60. .smmu = {
  61. .reg = 0x228,
  62. .bit = 3,
  63. },
  64. .la = {
  65. .reg = 0x2e8,
  66. .shift = 16,
  67. .mask = 0xff,
  68. .def = 0x50,
  69. },
  70. },
  71. }, {
  72. .id = 0x04,
  73. .name = "display0bb",
  74. .swgroup = TEGRA_SWGROUP_DCB,
  75. .regs = {
  76. .smmu = {
  77. .reg = 0x228,
  78. .bit = 4,
  79. },
  80. .la = {
  81. .reg = 0x2f4,
  82. .shift = 16,
  83. .mask = 0xff,
  84. .def = 0x50,
  85. },
  86. },
  87. }, {
  88. .id = 0x05,
  89. .name = "display0c",
  90. .swgroup = TEGRA_SWGROUP_DC,
  91. .regs = {
  92. .smmu = {
  93. .reg = 0x228,
  94. .bit = 5,
  95. },
  96. .la = {
  97. .reg = 0x2ec,
  98. .shift = 0,
  99. .mask = 0xff,
  100. .def = 0x50,
  101. },
  102. },
  103. }, {
  104. .id = 0x06,
  105. .name = "display0cb",
  106. .swgroup = TEGRA_SWGROUP_DCB,
  107. .regs = {
  108. .smmu = {
  109. .reg = 0x228,
  110. .bit = 6,
  111. },
  112. .la = {
  113. .reg = 0x2f8,
  114. .shift = 0,
  115. .mask = 0xff,
  116. .def = 0x50,
  117. },
  118. },
  119. }, {
  120. .id = 0x0e,
  121. .name = "afir",
  122. .swgroup = TEGRA_SWGROUP_AFI,
  123. .regs = {
  124. .smmu = {
  125. .reg = 0x228,
  126. .bit = 14,
  127. },
  128. .la = {
  129. .reg = 0x2e0,
  130. .shift = 0,
  131. .mask = 0xff,
  132. .def = 0x13,
  133. },
  134. },
  135. }, {
  136. .id = 0x0f,
  137. .name = "avpcarm7r",
  138. .swgroup = TEGRA_SWGROUP_AVPC,
  139. .regs = {
  140. .smmu = {
  141. .reg = 0x228,
  142. .bit = 15,
  143. },
  144. .la = {
  145. .reg = 0x2e4,
  146. .shift = 0,
  147. .mask = 0xff,
  148. .def = 0x04,
  149. },
  150. },
  151. }, {
  152. .id = 0x10,
  153. .name = "displayhc",
  154. .swgroup = TEGRA_SWGROUP_DC,
  155. .regs = {
  156. .smmu = {
  157. .reg = 0x228,
  158. .bit = 16,
  159. },
  160. .la = {
  161. .reg = 0x2f0,
  162. .shift = 0,
  163. .mask = 0xff,
  164. .def = 0x50,
  165. },
  166. },
  167. }, {
  168. .id = 0x11,
  169. .name = "displayhcb",
  170. .swgroup = TEGRA_SWGROUP_DCB,
  171. .regs = {
  172. .smmu = {
  173. .reg = 0x228,
  174. .bit = 17,
  175. },
  176. .la = {
  177. .reg = 0x2fc,
  178. .shift = 0,
  179. .mask = 0xff,
  180. .def = 0x50,
  181. },
  182. },
  183. }, {
  184. .id = 0x15,
  185. .name = "hdar",
  186. .swgroup = TEGRA_SWGROUP_HDA,
  187. .regs = {
  188. .smmu = {
  189. .reg = 0x228,
  190. .bit = 21,
  191. },
  192. .la = {
  193. .reg = 0x318,
  194. .shift = 0,
  195. .mask = 0xff,
  196. .def = 0x24,
  197. },
  198. },
  199. }, {
  200. .id = 0x16,
  201. .name = "host1xdmar",
  202. .swgroup = TEGRA_SWGROUP_HC,
  203. .regs = {
  204. .smmu = {
  205. .reg = 0x228,
  206. .bit = 22,
  207. },
  208. .la = {
  209. .reg = 0x310,
  210. .shift = 0,
  211. .mask = 0xff,
  212. .def = 0x1e,
  213. },
  214. },
  215. }, {
  216. .id = 0x17,
  217. .name = "host1xr",
  218. .swgroup = TEGRA_SWGROUP_HC,
  219. .regs = {
  220. .smmu = {
  221. .reg = 0x228,
  222. .bit = 23,
  223. },
  224. .la = {
  225. .reg = 0x310,
  226. .shift = 16,
  227. .mask = 0xff,
  228. .def = 0x50,
  229. },
  230. },
  231. }, {
  232. .id = 0x1c,
  233. .name = "msencsrd",
  234. .swgroup = TEGRA_SWGROUP_MSENC,
  235. .regs = {
  236. .smmu = {
  237. .reg = 0x228,
  238. .bit = 28,
  239. },
  240. .la = {
  241. .reg = 0x328,
  242. .shift = 0,
  243. .mask = 0xff,
  244. .def = 0x23,
  245. },
  246. },
  247. }, {
  248. .id = 0x1d,
  249. .name = "ppcsahbdmar",
  250. .swgroup = TEGRA_SWGROUP_PPCS,
  251. .regs = {
  252. .smmu = {
  253. .reg = 0x228,
  254. .bit = 29,
  255. },
  256. .la = {
  257. .reg = 0x344,
  258. .shift = 0,
  259. .mask = 0xff,
  260. .def = 0x49,
  261. },
  262. },
  263. }, {
  264. .id = 0x1e,
  265. .name = "ppcsahbslvr",
  266. .swgroup = TEGRA_SWGROUP_PPCS,
  267. .regs = {
  268. .smmu = {
  269. .reg = 0x228,
  270. .bit = 30,
  271. },
  272. .la = {
  273. .reg = 0x344,
  274. .shift = 16,
  275. .mask = 0xff,
  276. .def = 0x1a,
  277. },
  278. },
  279. }, {
  280. .id = 0x1f,
  281. .name = "satar",
  282. .swgroup = TEGRA_SWGROUP_SATA,
  283. .regs = {
  284. .smmu = {
  285. .reg = 0x228,
  286. .bit = 31,
  287. },
  288. .la = {
  289. .reg = 0x350,
  290. .shift = 0,
  291. .mask = 0xff,
  292. .def = 0x65,
  293. },
  294. },
  295. }, {
  296. .id = 0x22,
  297. .name = "vdebsevr",
  298. .swgroup = TEGRA_SWGROUP_VDE,
  299. .regs = {
  300. .smmu = {
  301. .reg = 0x22c,
  302. .bit = 2,
  303. },
  304. .la = {
  305. .reg = 0x354,
  306. .shift = 0,
  307. .mask = 0xff,
  308. .def = 0x4f,
  309. },
  310. },
  311. }, {
  312. .id = 0x23,
  313. .name = "vdember",
  314. .swgroup = TEGRA_SWGROUP_VDE,
  315. .regs = {
  316. .smmu = {
  317. .reg = 0x22c,
  318. .bit = 3,
  319. },
  320. .la = {
  321. .reg = 0x354,
  322. .shift = 16,
  323. .mask = 0xff,
  324. .def = 0x3d,
  325. },
  326. },
  327. }, {
  328. .id = 0x24,
  329. .name = "vdemcer",
  330. .swgroup = TEGRA_SWGROUP_VDE,
  331. .regs = {
  332. .smmu = {
  333. .reg = 0x22c,
  334. .bit = 4,
  335. },
  336. .la = {
  337. .reg = 0x358,
  338. .shift = 0,
  339. .mask = 0xff,
  340. .def = 0x66,
  341. },
  342. },
  343. }, {
  344. .id = 0x25,
  345. .name = "vdetper",
  346. .swgroup = TEGRA_SWGROUP_VDE,
  347. .regs = {
  348. .smmu = {
  349. .reg = 0x22c,
  350. .bit = 5,
  351. },
  352. .la = {
  353. .reg = 0x358,
  354. .shift = 16,
  355. .mask = 0xff,
  356. .def = 0xa5,
  357. },
  358. },
  359. }, {
  360. .id = 0x26,
  361. .name = "mpcorelpr",
  362. .swgroup = TEGRA_SWGROUP_MPCORELP,
  363. .regs = {
  364. .la = {
  365. .reg = 0x324,
  366. .shift = 0,
  367. .mask = 0xff,
  368. .def = 0x04,
  369. },
  370. },
  371. }, {
  372. .id = 0x27,
  373. .name = "mpcorer",
  374. .swgroup = TEGRA_SWGROUP_MPCORE,
  375. .regs = {
  376. .la = {
  377. .reg = 0x320,
  378. .shift = 0,
  379. .mask = 0xff,
  380. .def = 0x04,
  381. },
  382. },
  383. }, {
  384. .id = 0x2b,
  385. .name = "msencswr",
  386. .swgroup = TEGRA_SWGROUP_MSENC,
  387. .regs = {
  388. .smmu = {
  389. .reg = 0x22c,
  390. .bit = 11,
  391. },
  392. .la = {
  393. .reg = 0x328,
  394. .shift = 16,
  395. .mask = 0xff,
  396. .def = 0x80,
  397. },
  398. },
  399. }, {
  400. .id = 0x31,
  401. .name = "afiw",
  402. .swgroup = TEGRA_SWGROUP_AFI,
  403. .regs = {
  404. .smmu = {
  405. .reg = 0x22c,
  406. .bit = 17,
  407. },
  408. .la = {
  409. .reg = 0x2e0,
  410. .shift = 16,
  411. .mask = 0xff,
  412. .def = 0x80,
  413. },
  414. },
  415. }, {
  416. .id = 0x32,
  417. .name = "avpcarm7w",
  418. .swgroup = TEGRA_SWGROUP_AVPC,
  419. .regs = {
  420. .smmu = {
  421. .reg = 0x22c,
  422. .bit = 18,
  423. },
  424. .la = {
  425. .reg = 0x2e4,
  426. .shift = 16,
  427. .mask = 0xff,
  428. .def = 0x80,
  429. },
  430. },
  431. }, {
  432. .id = 0x35,
  433. .name = "hdaw",
  434. .swgroup = TEGRA_SWGROUP_HDA,
  435. .regs = {
  436. .smmu = {
  437. .reg = 0x22c,
  438. .bit = 21,
  439. },
  440. .la = {
  441. .reg = 0x318,
  442. .shift = 16,
  443. .mask = 0xff,
  444. .def = 0x80,
  445. },
  446. },
  447. }, {
  448. .id = 0x36,
  449. .name = "host1xw",
  450. .swgroup = TEGRA_SWGROUP_HC,
  451. .regs = {
  452. .smmu = {
  453. .reg = 0x22c,
  454. .bit = 22,
  455. },
  456. .la = {
  457. .reg = 0x314,
  458. .shift = 0,
  459. .mask = 0xff,
  460. .def = 0x80,
  461. },
  462. },
  463. }, {
  464. .id = 0x38,
  465. .name = "mpcorelpw",
  466. .swgroup = TEGRA_SWGROUP_MPCORELP,
  467. .regs = {
  468. .la = {
  469. .reg = 0x324,
  470. .shift = 16,
  471. .mask = 0xff,
  472. .def = 0x80,
  473. },
  474. },
  475. }, {
  476. .id = 0x39,
  477. .name = "mpcorew",
  478. .swgroup = TEGRA_SWGROUP_MPCORE,
  479. .regs = {
  480. .la = {
  481. .reg = 0x320,
  482. .shift = 16,
  483. .mask = 0xff,
  484. .def = 0x80,
  485. },
  486. },
  487. }, {
  488. .id = 0x3b,
  489. .name = "ppcsahbdmaw",
  490. .swgroup = TEGRA_SWGROUP_PPCS,
  491. .regs = {
  492. .smmu = {
  493. .reg = 0x22c,
  494. .bit = 27,
  495. },
  496. .la = {
  497. .reg = 0x348,
  498. .shift = 0,
  499. .mask = 0xff,
  500. .def = 0x80,
  501. },
  502. },
  503. }, {
  504. .id = 0x3c,
  505. .name = "ppcsahbslvw",
  506. .swgroup = TEGRA_SWGROUP_PPCS,
  507. .regs = {
  508. .smmu = {
  509. .reg = 0x22c,
  510. .bit = 28,
  511. },
  512. .la = {
  513. .reg = 0x348,
  514. .shift = 16,
  515. .mask = 0xff,
  516. .def = 0x80,
  517. },
  518. },
  519. }, {
  520. .id = 0x3d,
  521. .name = "sataw",
  522. .swgroup = TEGRA_SWGROUP_SATA,
  523. .regs = {
  524. .smmu = {
  525. .reg = 0x22c,
  526. .bit = 29,
  527. },
  528. .la = {
  529. .reg = 0x350,
  530. .shift = 16,
  531. .mask = 0xff,
  532. .def = 0x65,
  533. },
  534. },
  535. }, {
  536. .id = 0x3e,
  537. .name = "vdebsevw",
  538. .swgroup = TEGRA_SWGROUP_VDE,
  539. .regs = {
  540. .smmu = {
  541. .reg = 0x22c,
  542. .bit = 30,
  543. },
  544. .la = {
  545. .reg = 0x35c,
  546. .shift = 0,
  547. .mask = 0xff,
  548. .def = 0x80,
  549. },
  550. },
  551. }, {
  552. .id = 0x3f,
  553. .name = "vdedbgw",
  554. .swgroup = TEGRA_SWGROUP_VDE,
  555. .regs = {
  556. .smmu = {
  557. .reg = 0x22c,
  558. .bit = 31,
  559. },
  560. .la = {
  561. .reg = 0x35c,
  562. .shift = 16,
  563. .mask = 0xff,
  564. .def = 0x80,
  565. },
  566. },
  567. }, {
  568. .id = 0x40,
  569. .name = "vdembew",
  570. .swgroup = TEGRA_SWGROUP_VDE,
  571. .regs = {
  572. .smmu = {
  573. .reg = 0x230,
  574. .bit = 0,
  575. },
  576. .la = {
  577. .reg = 0x360,
  578. .shift = 0,
  579. .mask = 0xff,
  580. .def = 0x80,
  581. },
  582. },
  583. }, {
  584. .id = 0x41,
  585. .name = "vdetpmw",
  586. .swgroup = TEGRA_SWGROUP_VDE,
  587. .regs = {
  588. .smmu = {
  589. .reg = 0x230,
  590. .bit = 1,
  591. },
  592. .la = {
  593. .reg = 0x360,
  594. .shift = 16,
  595. .mask = 0xff,
  596. .def = 0x80,
  597. },
  598. },
  599. }, {
  600. .id = 0x44,
  601. .name = "ispra",
  602. .swgroup = TEGRA_SWGROUP_ISP2,
  603. .regs = {
  604. .smmu = {
  605. .reg = 0x230,
  606. .bit = 4,
  607. },
  608. .la = {
  609. .reg = 0x370,
  610. .shift = 0,
  611. .mask = 0xff,
  612. .def = 0x18,
  613. },
  614. },
  615. }, {
  616. .id = 0x46,
  617. .name = "ispwa",
  618. .swgroup = TEGRA_SWGROUP_ISP2,
  619. .regs = {
  620. .smmu = {
  621. .reg = 0x230,
  622. .bit = 6,
  623. },
  624. .la = {
  625. .reg = 0x374,
  626. .shift = 0,
  627. .mask = 0xff,
  628. .def = 0x80,
  629. },
  630. },
  631. }, {
  632. .id = 0x47,
  633. .name = "ispwb",
  634. .swgroup = TEGRA_SWGROUP_ISP2,
  635. .regs = {
  636. .smmu = {
  637. .reg = 0x230,
  638. .bit = 7,
  639. },
  640. .la = {
  641. .reg = 0x374,
  642. .shift = 16,
  643. .mask = 0xff,
  644. .def = 0x80,
  645. },
  646. },
  647. }, {
  648. .id = 0x4a,
  649. .name = "xusb_hostr",
  650. .swgroup = TEGRA_SWGROUP_XUSB_HOST,
  651. .regs = {
  652. .smmu = {
  653. .reg = 0x230,
  654. .bit = 10,
  655. },
  656. .la = {
  657. .reg = 0x37c,
  658. .shift = 0,
  659. .mask = 0xff,
  660. .def = 0x39,
  661. },
  662. },
  663. }, {
  664. .id = 0x4b,
  665. .name = "xusb_hostw",
  666. .swgroup = TEGRA_SWGROUP_XUSB_HOST,
  667. .regs = {
  668. .smmu = {
  669. .reg = 0x230,
  670. .bit = 11,
  671. },
  672. .la = {
  673. .reg = 0x37c,
  674. .shift = 16,
  675. .mask = 0xff,
  676. .def = 0x80,
  677. },
  678. },
  679. }, {
  680. .id = 0x4c,
  681. .name = "xusb_devr",
  682. .swgroup = TEGRA_SWGROUP_XUSB_DEV,
  683. .regs = {
  684. .smmu = {
  685. .reg = 0x230,
  686. .bit = 12,
  687. },
  688. .la = {
  689. .reg = 0x380,
  690. .shift = 0,
  691. .mask = 0xff,
  692. .def = 0x39,
  693. },
  694. },
  695. }, {
  696. .id = 0x4d,
  697. .name = "xusb_devw",
  698. .swgroup = TEGRA_SWGROUP_XUSB_DEV,
  699. .regs = {
  700. .smmu = {
  701. .reg = 0x230,
  702. .bit = 13,
  703. },
  704. .la = {
  705. .reg = 0x380,
  706. .shift = 16,
  707. .mask = 0xff,
  708. .def = 0x80,
  709. },
  710. },
  711. }, {
  712. .id = 0x4e,
  713. .name = "isprab",
  714. .swgroup = TEGRA_SWGROUP_ISP2B,
  715. .regs = {
  716. .smmu = {
  717. .reg = 0x230,
  718. .bit = 14,
  719. },
  720. .la = {
  721. .reg = 0x384,
  722. .shift = 0,
  723. .mask = 0xff,
  724. .def = 0x18,
  725. },
  726. },
  727. }, {
  728. .id = 0x50,
  729. .name = "ispwab",
  730. .swgroup = TEGRA_SWGROUP_ISP2B,
  731. .regs = {
  732. .smmu = {
  733. .reg = 0x230,
  734. .bit = 16,
  735. },
  736. .la = {
  737. .reg = 0x388,
  738. .shift = 0,
  739. .mask = 0xff,
  740. .def = 0x80,
  741. },
  742. },
  743. }, {
  744. .id = 0x51,
  745. .name = "ispwbb",
  746. .swgroup = TEGRA_SWGROUP_ISP2B,
  747. .regs = {
  748. .smmu = {
  749. .reg = 0x230,
  750. .bit = 17,
  751. },
  752. .la = {
  753. .reg = 0x388,
  754. .shift = 16,
  755. .mask = 0xff,
  756. .def = 0x80,
  757. },
  758. },
  759. }, {
  760. .id = 0x54,
  761. .name = "tsecsrd",
  762. .swgroup = TEGRA_SWGROUP_TSEC,
  763. .regs = {
  764. .smmu = {
  765. .reg = 0x230,
  766. .bit = 20,
  767. },
  768. .la = {
  769. .reg = 0x390,
  770. .shift = 0,
  771. .mask = 0xff,
  772. .def = 0x9b,
  773. },
  774. },
  775. }, {
  776. .id = 0x55,
  777. .name = "tsecswr",
  778. .swgroup = TEGRA_SWGROUP_TSEC,
  779. .regs = {
  780. .smmu = {
  781. .reg = 0x230,
  782. .bit = 21,
  783. },
  784. .la = {
  785. .reg = 0x390,
  786. .shift = 16,
  787. .mask = 0xff,
  788. .def = 0x80,
  789. },
  790. },
  791. }, {
  792. .id = 0x56,
  793. .name = "a9avpscr",
  794. .swgroup = TEGRA_SWGROUP_A9AVP,
  795. .regs = {
  796. .smmu = {
  797. .reg = 0x230,
  798. .bit = 22,
  799. },
  800. .la = {
  801. .reg = 0x3a4,
  802. .shift = 0,
  803. .mask = 0xff,
  804. .def = 0x04,
  805. },
  806. },
  807. }, {
  808. .id = 0x57,
  809. .name = "a9avpscw",
  810. .swgroup = TEGRA_SWGROUP_A9AVP,
  811. .regs = {
  812. .smmu = {
  813. .reg = 0x230,
  814. .bit = 23,
  815. },
  816. .la = {
  817. .reg = 0x3a4,
  818. .shift = 16,
  819. .mask = 0xff,
  820. .def = 0x80,
  821. },
  822. },
  823. }, {
  824. .id = 0x58,
  825. .name = "gpusrd",
  826. .swgroup = TEGRA_SWGROUP_GPU,
  827. .regs = {
  828. .smmu = {
  829. /* read-only */
  830. .reg = 0x230,
  831. .bit = 24,
  832. },
  833. .la = {
  834. .reg = 0x3c8,
  835. .shift = 0,
  836. .mask = 0xff,
  837. .def = 0x1a,
  838. },
  839. },
  840. }, {
  841. .id = 0x59,
  842. .name = "gpuswr",
  843. .swgroup = TEGRA_SWGROUP_GPU,
  844. .regs = {
  845. .smmu = {
  846. /* read-only */
  847. .reg = 0x230,
  848. .bit = 25,
  849. },
  850. .la = {
  851. .reg = 0x3c8,
  852. .shift = 16,
  853. .mask = 0xff,
  854. .def = 0x80,
  855. },
  856. },
  857. }, {
  858. .id = 0x5a,
  859. .name = "displayt",
  860. .swgroup = TEGRA_SWGROUP_DC,
  861. .regs = {
  862. .smmu = {
  863. .reg = 0x230,
  864. .bit = 26,
  865. },
  866. .la = {
  867. .reg = 0x2f0,
  868. .shift = 16,
  869. .mask = 0xff,
  870. .def = 0x50,
  871. },
  872. },
  873. }, {
  874. .id = 0x60,
  875. .name = "sdmmcra",
  876. .swgroup = TEGRA_SWGROUP_SDMMC1A,
  877. .regs = {
  878. .smmu = {
  879. .reg = 0x234,
  880. .bit = 0,
  881. },
  882. .la = {
  883. .reg = 0x3b8,
  884. .shift = 0,
  885. .mask = 0xff,
  886. .def = 0x49,
  887. },
  888. },
  889. }, {
  890. .id = 0x61,
  891. .name = "sdmmcraa",
  892. .swgroup = TEGRA_SWGROUP_SDMMC2A,
  893. .regs = {
  894. .smmu = {
  895. .reg = 0x234,
  896. .bit = 1,
  897. },
  898. .la = {
  899. .reg = 0x3bc,
  900. .shift = 0,
  901. .mask = 0xff,
  902. .def = 0x49,
  903. },
  904. },
  905. }, {
  906. .id = 0x62,
  907. .name = "sdmmcr",
  908. .swgroup = TEGRA_SWGROUP_SDMMC3A,
  909. .regs = {
  910. .smmu = {
  911. .reg = 0x234,
  912. .bit = 2,
  913. },
  914. .la = {
  915. .reg = 0x3c0,
  916. .shift = 0,
  917. .mask = 0xff,
  918. .def = 0x49,
  919. },
  920. },
  921. }, {
  922. .id = 0x63,
  923. .swgroup = TEGRA_SWGROUP_SDMMC4A,
  924. .name = "sdmmcrab",
  925. .regs = {
  926. .smmu = {
  927. .reg = 0x234,
  928. .bit = 3,
  929. },
  930. .la = {
  931. .reg = 0x3c4,
  932. .shift = 0,
  933. .mask = 0xff,
  934. .def = 0x49,
  935. },
  936. },
  937. }, {
  938. .id = 0x64,
  939. .name = "sdmmcwa",
  940. .swgroup = TEGRA_SWGROUP_SDMMC1A,
  941. .regs = {
  942. .smmu = {
  943. .reg = 0x234,
  944. .bit = 4,
  945. },
  946. .la = {
  947. .reg = 0x3b8,
  948. .shift = 16,
  949. .mask = 0xff,
  950. .def = 0x80,
  951. },
  952. },
  953. }, {
  954. .id = 0x65,
  955. .name = "sdmmcwaa",
  956. .swgroup = TEGRA_SWGROUP_SDMMC2A,
  957. .regs = {
  958. .smmu = {
  959. .reg = 0x234,
  960. .bit = 5,
  961. },
  962. .la = {
  963. .reg = 0x3bc,
  964. .shift = 16,
  965. .mask = 0xff,
  966. .def = 0x80,
  967. },
  968. },
  969. }, {
  970. .id = 0x66,
  971. .name = "sdmmcw",
  972. .swgroup = TEGRA_SWGROUP_SDMMC3A,
  973. .regs = {
  974. .smmu = {
  975. .reg = 0x234,
  976. .bit = 6,
  977. },
  978. .la = {
  979. .reg = 0x3c0,
  980. .shift = 16,
  981. .mask = 0xff,
  982. .def = 0x80,
  983. },
  984. },
  985. }, {
  986. .id = 0x67,
  987. .name = "sdmmcwab",
  988. .swgroup = TEGRA_SWGROUP_SDMMC4A,
  989. .regs = {
  990. .smmu = {
  991. .reg = 0x234,
  992. .bit = 7,
  993. },
  994. .la = {
  995. .reg = 0x3c4,
  996. .shift = 16,
  997. .mask = 0xff,
  998. .def = 0x80,
  999. },
  1000. },
  1001. }, {
  1002. .id = 0x6c,
  1003. .name = "vicsrd",
  1004. .swgroup = TEGRA_SWGROUP_VIC,
  1005. .regs = {
  1006. .smmu = {
  1007. .reg = 0x234,
  1008. .bit = 12,
  1009. },
  1010. .la = {
  1011. .reg = 0x394,
  1012. .shift = 0,
  1013. .mask = 0xff,
  1014. .def = 0x1a,
  1015. },
  1016. },
  1017. }, {
  1018. .id = 0x6d,
  1019. .name = "vicswr",
  1020. .swgroup = TEGRA_SWGROUP_VIC,
  1021. .regs = {
  1022. .smmu = {
  1023. .reg = 0x234,
  1024. .bit = 13,
  1025. },
  1026. .la = {
  1027. .reg = 0x394,
  1028. .shift = 16,
  1029. .mask = 0xff,
  1030. .def = 0x80,
  1031. },
  1032. },
  1033. }, {
  1034. .id = 0x72,
  1035. .name = "viw",
  1036. .swgroup = TEGRA_SWGROUP_VI,
  1037. .regs = {
  1038. .smmu = {
  1039. .reg = 0x234,
  1040. .bit = 18,
  1041. },
  1042. .la = {
  1043. .reg = 0x398,
  1044. .shift = 0,
  1045. .mask = 0xff,
  1046. .def = 0x80,
  1047. },
  1048. },
  1049. }, {
  1050. .id = 0x73,
  1051. .name = "displayd",
  1052. .swgroup = TEGRA_SWGROUP_DC,
  1053. .regs = {
  1054. .smmu = {
  1055. .reg = 0x234,
  1056. .bit = 19,
  1057. },
  1058. .la = {
  1059. .reg = 0x3c8,
  1060. .shift = 0,
  1061. .mask = 0xff,
  1062. .def = 0x50,
  1063. },
  1064. },
  1065. },
  1066. };
  1067. static const struct tegra_smmu_swgroup tegra124_swgroups[] = {
  1068. { .name = "dc", .swgroup = TEGRA_SWGROUP_DC, .reg = 0x240 },
  1069. { .name = "dcb", .swgroup = TEGRA_SWGROUP_DCB, .reg = 0x244 },
  1070. { .name = "afi", .swgroup = TEGRA_SWGROUP_AFI, .reg = 0x238 },
  1071. { .name = "avpc", .swgroup = TEGRA_SWGROUP_AVPC, .reg = 0x23c },
  1072. { .name = "hda", .swgroup = TEGRA_SWGROUP_HDA, .reg = 0x254 },
  1073. { .name = "hc", .swgroup = TEGRA_SWGROUP_HC, .reg = 0x250 },
  1074. { .name = "msenc", .swgroup = TEGRA_SWGROUP_MSENC, .reg = 0x264 },
  1075. { .name = "ppcs", .swgroup = TEGRA_SWGROUP_PPCS, .reg = 0x270 },
  1076. { .name = "sata", .swgroup = TEGRA_SWGROUP_SATA, .reg = 0x274 },
  1077. { .name = "vde", .swgroup = TEGRA_SWGROUP_VDE, .reg = 0x27c },
  1078. { .name = "isp2", .swgroup = TEGRA_SWGROUP_ISP2, .reg = 0x258 },
  1079. { .name = "xusb_host", .swgroup = TEGRA_SWGROUP_XUSB_HOST, .reg = 0x288 },
  1080. { .name = "xusb_dev", .swgroup = TEGRA_SWGROUP_XUSB_DEV, .reg = 0x28c },
  1081. { .name = "isp2b", .swgroup = TEGRA_SWGROUP_ISP2B, .reg = 0xaa4 },
  1082. { .name = "tsec", .swgroup = TEGRA_SWGROUP_TSEC, .reg = 0x294 },
  1083. { .name = "a9avp", .swgroup = TEGRA_SWGROUP_A9AVP, .reg = 0x290 },
  1084. { .name = "gpu", .swgroup = TEGRA_SWGROUP_GPU, .reg = 0xaac },
  1085. { .name = "sdmmc1a", .swgroup = TEGRA_SWGROUP_SDMMC1A, .reg = 0xa94 },
  1086. { .name = "sdmmc2a", .swgroup = TEGRA_SWGROUP_SDMMC2A, .reg = 0xa98 },
  1087. { .name = "sdmmc3a", .swgroup = TEGRA_SWGROUP_SDMMC3A, .reg = 0xa9c },
  1088. { .name = "sdmmc4a", .swgroup = TEGRA_SWGROUP_SDMMC4A, .reg = 0xaa0 },
  1089. { .name = "vic", .swgroup = TEGRA_SWGROUP_VIC, .reg = 0x284 },
  1090. { .name = "vi", .swgroup = TEGRA_SWGROUP_VI, .reg = 0x280 },
  1091. };
  1092. static const unsigned int tegra124_group_drm[] = {
  1093. TEGRA_SWGROUP_DC,
  1094. TEGRA_SWGROUP_DCB,
  1095. TEGRA_SWGROUP_VIC,
  1096. };
  1097. static const struct tegra_smmu_group_soc tegra124_groups[] = {
  1098. {
  1099. .name = "drm",
  1100. .swgroups = tegra124_group_drm,
  1101. .num_swgroups = ARRAY_SIZE(tegra124_group_drm),
  1102. },
  1103. };
  1104. #define TEGRA124_MC_RESET(_name, _control, _status, _bit) \
  1105. { \
  1106. .name = #_name, \
  1107. .id = TEGRA124_MC_RESET_##_name, \
  1108. .control = _control, \
  1109. .status = _status, \
  1110. .bit = _bit, \
  1111. }
  1112. static const struct tegra_mc_reset tegra124_mc_resets[] = {
  1113. TEGRA124_MC_RESET(AFI, 0x200, 0x204, 0),
  1114. TEGRA124_MC_RESET(AVPC, 0x200, 0x204, 1),
  1115. TEGRA124_MC_RESET(DC, 0x200, 0x204, 2),
  1116. TEGRA124_MC_RESET(DCB, 0x200, 0x204, 3),
  1117. TEGRA124_MC_RESET(HC, 0x200, 0x204, 6),
  1118. TEGRA124_MC_RESET(HDA, 0x200, 0x204, 7),
  1119. TEGRA124_MC_RESET(ISP2, 0x200, 0x204, 8),
  1120. TEGRA124_MC_RESET(MPCORE, 0x200, 0x204, 9),
  1121. TEGRA124_MC_RESET(MPCORELP, 0x200, 0x204, 10),
  1122. TEGRA124_MC_RESET(MSENC, 0x200, 0x204, 11),
  1123. TEGRA124_MC_RESET(PPCS, 0x200, 0x204, 14),
  1124. TEGRA124_MC_RESET(SATA, 0x200, 0x204, 15),
  1125. TEGRA124_MC_RESET(VDE, 0x200, 0x204, 16),
  1126. TEGRA124_MC_RESET(VI, 0x200, 0x204, 17),
  1127. TEGRA124_MC_RESET(VIC, 0x200, 0x204, 18),
  1128. TEGRA124_MC_RESET(XUSB_HOST, 0x200, 0x204, 19),
  1129. TEGRA124_MC_RESET(XUSB_DEV, 0x200, 0x204, 20),
  1130. TEGRA124_MC_RESET(TSEC, 0x200, 0x204, 21),
  1131. TEGRA124_MC_RESET(SDMMC1, 0x200, 0x204, 22),
  1132. TEGRA124_MC_RESET(SDMMC2, 0x200, 0x204, 23),
  1133. TEGRA124_MC_RESET(SDMMC3, 0x200, 0x204, 25),
  1134. TEGRA124_MC_RESET(SDMMC4, 0x970, 0x974, 0),
  1135. TEGRA124_MC_RESET(ISP2B, 0x970, 0x974, 1),
  1136. TEGRA124_MC_RESET(GPU, 0x970, 0x974, 2),
  1137. };
  1138. static int tegra124_mc_icc_set(struct icc_node *src, struct icc_node *dst)
  1139. {
  1140. /* TODO: program PTSA */
  1141. return 0;
  1142. }
  1143. static int tegra124_mc_icc_aggreate(struct icc_node *node, u32 tag, u32 avg_bw,
  1144. u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
  1145. {
  1146. /*
  1147. * ISO clients need to reserve extra bandwidth up-front because
  1148. * there could be high bandwidth pressure during initial filling
  1149. * of the client's FIFO buffers. Secondly, we need to take into
  1150. * account impurities of the memory subsystem.
  1151. */
  1152. if (tag & TEGRA_MC_ICC_TAG_ISO)
  1153. peak_bw = tegra_mc_scale_percents(peak_bw, 400);
  1154. *agg_avg += avg_bw;
  1155. *agg_peak = max(*agg_peak, peak_bw);
  1156. return 0;
  1157. }
  1158. static struct icc_node_data *
  1159. tegra124_mc_of_icc_xlate_extended(struct of_phandle_args *spec, void *data)
  1160. {
  1161. struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
  1162. const struct tegra_mc_client *client;
  1163. unsigned int i, idx = spec->args[0];
  1164. struct icc_node_data *ndata;
  1165. struct icc_node *node;
  1166. list_for_each_entry(node, &mc->provider.nodes, node_list) {
  1167. if (node->id != idx)
  1168. continue;
  1169. ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
  1170. if (!ndata)
  1171. return ERR_PTR(-ENOMEM);
  1172. client = &mc->soc->clients[idx];
  1173. ndata->node = node;
  1174. switch (client->swgroup) {
  1175. case TEGRA_SWGROUP_DC:
  1176. case TEGRA_SWGROUP_DCB:
  1177. case TEGRA_SWGROUP_PTC:
  1178. case TEGRA_SWGROUP_VI:
  1179. /* these clients are isochronous by default */
  1180. ndata->tag = TEGRA_MC_ICC_TAG_ISO;
  1181. break;
  1182. default:
  1183. ndata->tag = TEGRA_MC_ICC_TAG_DEFAULT;
  1184. break;
  1185. }
  1186. return ndata;
  1187. }
  1188. for (i = 0; i < mc->soc->num_clients; i++) {
  1189. if (mc->soc->clients[i].id == idx)
  1190. return ERR_PTR(-EPROBE_DEFER);
  1191. }
  1192. dev_err(mc->dev, "invalid ICC client ID %u\n", idx);
  1193. return ERR_PTR(-EINVAL);
  1194. }
  1195. static const struct tegra_mc_icc_ops tegra124_mc_icc_ops = {
  1196. .xlate_extended = tegra124_mc_of_icc_xlate_extended,
  1197. .aggregate = tegra124_mc_icc_aggreate,
  1198. .set = tegra124_mc_icc_set,
  1199. };
  1200. #ifdef CONFIG_ARCH_TEGRA_124_SOC
  1201. static const unsigned long tegra124_mc_emem_regs[] = {
  1202. MC_EMEM_ARB_CFG,
  1203. MC_EMEM_ARB_OUTSTANDING_REQ,
  1204. MC_EMEM_ARB_TIMING_RCD,
  1205. MC_EMEM_ARB_TIMING_RP,
  1206. MC_EMEM_ARB_TIMING_RC,
  1207. MC_EMEM_ARB_TIMING_RAS,
  1208. MC_EMEM_ARB_TIMING_FAW,
  1209. MC_EMEM_ARB_TIMING_RRD,
  1210. MC_EMEM_ARB_TIMING_RAP2PRE,
  1211. MC_EMEM_ARB_TIMING_WAP2PRE,
  1212. MC_EMEM_ARB_TIMING_R2R,
  1213. MC_EMEM_ARB_TIMING_W2W,
  1214. MC_EMEM_ARB_TIMING_R2W,
  1215. MC_EMEM_ARB_TIMING_W2R,
  1216. MC_EMEM_ARB_DA_TURNS,
  1217. MC_EMEM_ARB_DA_COVERS,
  1218. MC_EMEM_ARB_MISC0,
  1219. MC_EMEM_ARB_MISC1,
  1220. MC_EMEM_ARB_RING1_THROTTLE
  1221. };
  1222. static const struct tegra_smmu_soc tegra124_smmu_soc = {
  1223. .clients = tegra124_mc_clients,
  1224. .num_clients = ARRAY_SIZE(tegra124_mc_clients),
  1225. .swgroups = tegra124_swgroups,
  1226. .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
  1227. .groups = tegra124_groups,
  1228. .num_groups = ARRAY_SIZE(tegra124_groups),
  1229. .supports_round_robin_arbitration = true,
  1230. .supports_request_limit = true,
  1231. .num_tlb_lines = 32,
  1232. .num_asids = 128,
  1233. };
  1234. const struct tegra_mc_soc tegra124_mc_soc = {
  1235. .clients = tegra124_mc_clients,
  1236. .num_clients = ARRAY_SIZE(tegra124_mc_clients),
  1237. .num_address_bits = 34,
  1238. .atom_size = 32,
  1239. .client_id_mask = 0x7f,
  1240. .smmu = &tegra124_smmu_soc,
  1241. .emem_regs = tegra124_mc_emem_regs,
  1242. .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs),
  1243. .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
  1244. MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
  1245. MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
  1246. .reset_ops = &tegra_mc_reset_ops_common,
  1247. .resets = tegra124_mc_resets,
  1248. .num_resets = ARRAY_SIZE(tegra124_mc_resets),
  1249. .icc_ops = &tegra124_mc_icc_ops,
  1250. .ops = &tegra30_mc_ops,
  1251. };
  1252. #endif /* CONFIG_ARCH_TEGRA_124_SOC */
  1253. #ifdef CONFIG_ARCH_TEGRA_132_SOC
  1254. static const struct tegra_smmu_soc tegra132_smmu_soc = {
  1255. .clients = tegra124_mc_clients,
  1256. .num_clients = ARRAY_SIZE(tegra124_mc_clients),
  1257. .swgroups = tegra124_swgroups,
  1258. .num_swgroups = ARRAY_SIZE(tegra124_swgroups),
  1259. .groups = tegra124_groups,
  1260. .num_groups = ARRAY_SIZE(tegra124_groups),
  1261. .supports_round_robin_arbitration = true,
  1262. .supports_request_limit = true,
  1263. .num_tlb_lines = 32,
  1264. .num_asids = 128,
  1265. };
  1266. const struct tegra_mc_soc tegra132_mc_soc = {
  1267. .clients = tegra124_mc_clients,
  1268. .num_clients = ARRAY_SIZE(tegra124_mc_clients),
  1269. .num_address_bits = 34,
  1270. .atom_size = 32,
  1271. .client_id_mask = 0x7f,
  1272. .smmu = &tegra132_smmu_soc,
  1273. .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
  1274. MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
  1275. MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
  1276. .reset_ops = &tegra_mc_reset_ops_common,
  1277. .resets = tegra124_mc_resets,
  1278. .num_resets = ARRAY_SIZE(tegra124_mc_resets),
  1279. .icc_ops = &tegra124_mc_icc_ops,
  1280. .ops = &tegra30_mc_ops,
  1281. };
  1282. #endif /* CONFIG_ARCH_TEGRA_132_SOC */