pci_tegra.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /*
  2. * Copyright (c) 2010, CompuLab, Ltd.
  3. * Author: Mike Rapoport <mike@compulab.co.il>
  4. *
  5. * Based on NVIDIA PCIe driver
  6. * Copyright (c) 2008-2009, NVIDIA Corporation.
  7. *
  8. * Copyright (c) 2013-2014, NVIDIA Corporation.
  9. *
  10. * SPDX-License-Identifier: GPL-2.0
  11. */
  12. #define pr_fmt(fmt) "tegra-pcie: " fmt
  13. #include <common.h>
  14. #include <clk.h>
  15. #include <dm.h>
  16. #include <errno.h>
  17. #include <fdtdec.h>
  18. #include <malloc.h>
  19. #include <pci.h>
  20. #include <power-domain.h>
  21. #include <reset.h>
  22. #include <asm/io.h>
  23. #include <asm/gpio.h>
  24. #include <linux/list.h>
  25. #ifndef CONFIG_TEGRA186
  26. #include <asm/arch/clock.h>
  27. #include <asm/arch/powergate.h>
  28. #include <asm/arch-tegra/xusb-padctl.h>
  29. #include <dt-bindings/pinctrl/pinctrl-tegra-xusb.h>
  30. #endif
  31. /*
  32. * FIXME: TODO: This driver contains a number of ifdef CONFIG_TEGRA186 that
  33. * should not be present. These are needed because newer Tegra SoCs support
  34. * only the standard clock/reset APIs, whereas older Tegra SoCs support only
  35. * a custom Tegra-specific API. ASAP the older Tegra SoCs' code should be
  36. * fixed to implement the standard APIs, and all drivers converted to solely
  37. * use the new standard APIs, with no ifdefs.
  38. */
  39. DECLARE_GLOBAL_DATA_PTR;
  40. #define AFI_AXI_BAR0_SZ 0x00
  41. #define AFI_AXI_BAR1_SZ 0x04
  42. #define AFI_AXI_BAR2_SZ 0x08
  43. #define AFI_AXI_BAR3_SZ 0x0c
  44. #define AFI_AXI_BAR4_SZ 0x10
  45. #define AFI_AXI_BAR5_SZ 0x14
  46. #define AFI_AXI_BAR0_START 0x18
  47. #define AFI_AXI_BAR1_START 0x1c
  48. #define AFI_AXI_BAR2_START 0x20
  49. #define AFI_AXI_BAR3_START 0x24
  50. #define AFI_AXI_BAR4_START 0x28
  51. #define AFI_AXI_BAR5_START 0x2c
  52. #define AFI_FPCI_BAR0 0x30
  53. #define AFI_FPCI_BAR1 0x34
  54. #define AFI_FPCI_BAR2 0x38
  55. #define AFI_FPCI_BAR3 0x3c
  56. #define AFI_FPCI_BAR4 0x40
  57. #define AFI_FPCI_BAR5 0x44
  58. #define AFI_CACHE_BAR0_SZ 0x48
  59. #define AFI_CACHE_BAR0_ST 0x4c
  60. #define AFI_CACHE_BAR1_SZ 0x50
  61. #define AFI_CACHE_BAR1_ST 0x54
  62. #define AFI_MSI_BAR_SZ 0x60
  63. #define AFI_MSI_FPCI_BAR_ST 0x64
  64. #define AFI_MSI_AXI_BAR_ST 0x68
  65. #define AFI_CONFIGURATION 0xac
  66. #define AFI_CONFIGURATION_EN_FPCI (1 << 0)
  67. #define AFI_FPCI_ERROR_MASKS 0xb0
  68. #define AFI_INTR_MASK 0xb4
  69. #define AFI_INTR_MASK_INT_MASK (1 << 0)
  70. #define AFI_INTR_MASK_MSI_MASK (1 << 8)
  71. #define AFI_SM_INTR_ENABLE 0xc4
  72. #define AFI_SM_INTR_INTA_ASSERT (1 << 0)
  73. #define AFI_SM_INTR_INTB_ASSERT (1 << 1)
  74. #define AFI_SM_INTR_INTC_ASSERT (1 << 2)
  75. #define AFI_SM_INTR_INTD_ASSERT (1 << 3)
  76. #define AFI_SM_INTR_INTA_DEASSERT (1 << 4)
  77. #define AFI_SM_INTR_INTB_DEASSERT (1 << 5)
  78. #define AFI_SM_INTR_INTC_DEASSERT (1 << 6)
  79. #define AFI_SM_INTR_INTD_DEASSERT (1 << 7)
  80. #define AFI_AFI_INTR_ENABLE 0xc8
  81. #define AFI_INTR_EN_INI_SLVERR (1 << 0)
  82. #define AFI_INTR_EN_INI_DECERR (1 << 1)
  83. #define AFI_INTR_EN_TGT_SLVERR (1 << 2)
  84. #define AFI_INTR_EN_TGT_DECERR (1 << 3)
  85. #define AFI_INTR_EN_TGT_WRERR (1 << 4)
  86. #define AFI_INTR_EN_DFPCI_DECERR (1 << 5)
  87. #define AFI_INTR_EN_AXI_DECERR (1 << 6)
  88. #define AFI_INTR_EN_FPCI_TIMEOUT (1 << 7)
  89. #define AFI_INTR_EN_PRSNT_SENSE (1 << 8)
  90. #define AFI_PCIE_CONFIG 0x0f8
  91. #define AFI_PCIE_CONFIG_PCIE_DISABLE(x) (1 << ((x) + 1))
  92. #define AFI_PCIE_CONFIG_PCIE_DISABLE_ALL 0xe
  93. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_MASK (0xf << 20)
  94. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_SINGLE (0x0 << 20)
  95. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_420 (0x0 << 20)
  96. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X2_X1 (0x0 << 20)
  97. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_DUAL (0x1 << 20)
  98. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_222 (0x1 << 20)
  99. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X4_X1 (0x1 << 20)
  100. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_411 (0x2 << 20)
  101. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_401 (0x0 << 20)
  102. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_211 (0x1 << 20)
  103. #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_111 (0x2 << 20)
  104. #define AFI_FUSE 0x104
  105. #define AFI_FUSE_PCIE_T0_GEN2_DIS (1 << 2)
  106. #define AFI_PEX0_CTRL 0x110
  107. #define AFI_PEX1_CTRL 0x118
  108. #define AFI_PEX2_CTRL 0x128
  109. #define AFI_PEX2_CTRL_T186 0x19c
  110. #define AFI_PEX_CTRL_RST (1 << 0)
  111. #define AFI_PEX_CTRL_CLKREQ_EN (1 << 1)
  112. #define AFI_PEX_CTRL_REFCLK_EN (1 << 3)
  113. #define AFI_PEX_CTRL_OVERRIDE_EN (1 << 4)
  114. #define AFI_PLLE_CONTROL 0x160
  115. #define AFI_PLLE_CONTROL_BYPASS_PADS2PLLE_CONTROL (1 << 9)
  116. #define AFI_PLLE_CONTROL_PADS2PLLE_CONTROL_EN (1 << 1)
  117. #define AFI_PEXBIAS_CTRL_0 0x168
  118. #define PADS_CTL_SEL 0x0000009C
  119. #define PADS_CTL 0x000000A0
  120. #define PADS_CTL_IDDQ_1L (1 << 0)
  121. #define PADS_CTL_TX_DATA_EN_1L (1 << 6)
  122. #define PADS_CTL_RX_DATA_EN_1L (1 << 10)
  123. #define PADS_PLL_CTL_TEGRA20 0x000000B8
  124. #define PADS_PLL_CTL_TEGRA30 0x000000B4
  125. #define PADS_PLL_CTL_RST_B4SM (0x1 << 1)
  126. #define PADS_PLL_CTL_LOCKDET (0x1 << 8)
  127. #define PADS_PLL_CTL_REFCLK_MASK (0x3 << 16)
  128. #define PADS_PLL_CTL_REFCLK_INTERNAL_CML (0x0 << 16)
  129. #define PADS_PLL_CTL_REFCLK_INTERNAL_CMOS (0x1 << 16)
  130. #define PADS_PLL_CTL_REFCLK_EXTERNAL (0x2 << 16)
  131. #define PADS_PLL_CTL_TXCLKREF_MASK (0x1 << 20)
  132. #define PADS_PLL_CTL_TXCLKREF_DIV10 (0x0 << 20)
  133. #define PADS_PLL_CTL_TXCLKREF_DIV5 (0x1 << 20)
  134. #define PADS_PLL_CTL_TXCLKREF_BUF_EN (0x1 << 22)
  135. #define PADS_REFCLK_CFG0 0x000000C8
  136. #define PADS_REFCLK_CFG1 0x000000CC
  137. /*
  138. * Fields in PADS_REFCLK_CFG*. Those registers form an array of 16-bit
  139. * entries, one entry per PCIe port. These field definitions and desired
  140. * values aren't in the TRM, but do come from NVIDIA.
  141. */
  142. #define PADS_REFCLK_CFG_TERM_SHIFT 2 /* 6:2 */
  143. #define PADS_REFCLK_CFG_E_TERM_SHIFT 7
  144. #define PADS_REFCLK_CFG_PREDI_SHIFT 8 /* 11:8 */
  145. #define PADS_REFCLK_CFG_DRVI_SHIFT 12 /* 15:12 */
  146. #define RP_VEND_XP 0x00000F00
  147. #define RP_VEND_XP_DL_UP (1 << 30)
  148. #define RP_VEND_CTL2 0x00000FA8
  149. #define RP_VEND_CTL2_PCA_ENABLE (1 << 7)
  150. #define RP_PRIV_MISC 0x00000FE0
  151. #define RP_PRIV_MISC_PRSNT_MAP_EP_PRSNT (0xE << 0)
  152. #define RP_PRIV_MISC_PRSNT_MAP_EP_ABSNT (0xF << 0)
  153. #define RP_LINK_CONTROL_STATUS 0x00000090
  154. #define RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE 0x20000000
  155. #define RP_LINK_CONTROL_STATUS_LINKSTAT_MASK 0x3fff0000
  156. enum tegra_pci_id {
  157. TEGRA20_PCIE,
  158. TEGRA30_PCIE,
  159. TEGRA124_PCIE,
  160. TEGRA210_PCIE,
  161. TEGRA186_PCIE,
  162. };
  163. struct tegra_pcie_port {
  164. struct tegra_pcie *pcie;
  165. struct fdt_resource regs;
  166. unsigned int num_lanes;
  167. unsigned int index;
  168. struct list_head list;
  169. };
  170. struct tegra_pcie_soc {
  171. unsigned int num_ports;
  172. unsigned long pads_pll_ctl;
  173. unsigned long tx_ref_sel;
  174. unsigned long afi_pex2_ctrl;
  175. u32 pads_refclk_cfg0;
  176. u32 pads_refclk_cfg1;
  177. bool has_pex_clkreq_en;
  178. bool has_pex_bias_ctrl;
  179. bool has_cml_clk;
  180. bool has_gen2;
  181. bool force_pca_enable;
  182. };
  183. struct tegra_pcie {
  184. struct pci_controller hose;
  185. struct fdt_resource pads;
  186. struct fdt_resource afi;
  187. struct fdt_resource cs;
  188. struct list_head ports;
  189. unsigned long xbar;
  190. const struct tegra_pcie_soc *soc;
  191. #ifdef CONFIG_TEGRA186
  192. struct clk clk_afi;
  193. struct clk clk_pex;
  194. struct reset_ctl reset_afi;
  195. struct reset_ctl reset_pex;
  196. struct reset_ctl reset_pcie_x;
  197. struct power_domain pwrdom;
  198. #else
  199. struct tegra_xusb_phy *phy;
  200. #endif
  201. };
  202. static void afi_writel(struct tegra_pcie *pcie, unsigned long value,
  203. unsigned long offset)
  204. {
  205. writel(value, pcie->afi.start + offset);
  206. }
  207. static unsigned long afi_readl(struct tegra_pcie *pcie, unsigned long offset)
  208. {
  209. return readl(pcie->afi.start + offset);
  210. }
  211. static void pads_writel(struct tegra_pcie *pcie, unsigned long value,
  212. unsigned long offset)
  213. {
  214. writel(value, pcie->pads.start + offset);
  215. }
  216. #ifndef CONFIG_TEGRA186
  217. static unsigned long pads_readl(struct tegra_pcie *pcie, unsigned long offset)
  218. {
  219. return readl(pcie->pads.start + offset);
  220. }
  221. #endif
  222. static unsigned long rp_readl(struct tegra_pcie_port *port,
  223. unsigned long offset)
  224. {
  225. return readl(port->regs.start + offset);
  226. }
  227. static void rp_writel(struct tegra_pcie_port *port, unsigned long value,
  228. unsigned long offset)
  229. {
  230. writel(value, port->regs.start + offset);
  231. }
  232. static unsigned long tegra_pcie_conf_offset(pci_dev_t bdf, int where)
  233. {
  234. return ((where & 0xf00) << 16) | (PCI_BUS(bdf) << 16) |
  235. (PCI_DEV(bdf) << 11) | (PCI_FUNC(bdf) << 8) |
  236. (where & 0xfc);
  237. }
  238. static int tegra_pcie_conf_address(struct tegra_pcie *pcie, pci_dev_t bdf,
  239. int where, unsigned long *address)
  240. {
  241. unsigned int bus = PCI_BUS(bdf);
  242. if (bus == 0) {
  243. unsigned int dev = PCI_DEV(bdf);
  244. struct tegra_pcie_port *port;
  245. list_for_each_entry(port, &pcie->ports, list) {
  246. if (port->index + 1 == dev) {
  247. *address = port->regs.start + (where & ~3);
  248. return 0;
  249. }
  250. }
  251. return -EFAULT;
  252. } else {
  253. #ifdef CONFIG_TEGRA20
  254. unsigned int dev = PCI_DEV(bdf);
  255. if (dev != 0)
  256. return -EFAULT;
  257. #endif
  258. *address = pcie->cs.start + tegra_pcie_conf_offset(bdf, where);
  259. return 0;
  260. }
  261. }
  262. static int pci_tegra_read_config(struct udevice *bus, pci_dev_t bdf,
  263. uint offset, ulong *valuep,
  264. enum pci_size_t size)
  265. {
  266. struct tegra_pcie *pcie = dev_get_priv(bus);
  267. unsigned long address, value;
  268. int err;
  269. err = tegra_pcie_conf_address(pcie, bdf, offset, &address);
  270. if (err < 0) {
  271. value = 0xffffffff;
  272. goto done;
  273. }
  274. value = readl(address);
  275. #ifdef CONFIG_TEGRA20
  276. /* fixup root port class */
  277. if (PCI_BUS(bdf) == 0) {
  278. if ((offset & ~3) == PCI_CLASS_REVISION) {
  279. value &= ~0x00ff0000;
  280. value |= PCI_CLASS_BRIDGE_PCI << 16;
  281. }
  282. }
  283. #endif
  284. done:
  285. *valuep = pci_conv_32_to_size(value, offset, size);
  286. return 0;
  287. }
  288. static int pci_tegra_write_config(struct udevice *bus, pci_dev_t bdf,
  289. uint offset, ulong value,
  290. enum pci_size_t size)
  291. {
  292. struct tegra_pcie *pcie = dev_get_priv(bus);
  293. unsigned long address;
  294. ulong old;
  295. int err;
  296. err = tegra_pcie_conf_address(pcie, bdf, offset, &address);
  297. if (err < 0)
  298. return 0;
  299. old = readl(address);
  300. value = pci_conv_size_to_32(old, value, offset, size);
  301. writel(value, address);
  302. return 0;
  303. }
  304. static int tegra_pcie_port_parse_dt(const void *fdt, int node,
  305. struct tegra_pcie_port *port)
  306. {
  307. const u32 *addr;
  308. int len;
  309. addr = fdt_getprop(fdt, node, "assigned-addresses", &len);
  310. if (!addr) {
  311. error("property \"assigned-addresses\" not found");
  312. return -FDT_ERR_NOTFOUND;
  313. }
  314. port->regs.start = fdt32_to_cpu(addr[2]);
  315. port->regs.end = port->regs.start + fdt32_to_cpu(addr[4]);
  316. return 0;
  317. }
  318. static int tegra_pcie_get_xbar_config(const void *fdt, int node, u32 lanes,
  319. enum tegra_pci_id id, unsigned long *xbar)
  320. {
  321. switch (id) {
  322. case TEGRA20_PCIE:
  323. switch (lanes) {
  324. case 0x00000004:
  325. debug("single-mode configuration\n");
  326. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_SINGLE;
  327. return 0;
  328. case 0x00000202:
  329. debug("dual-mode configuration\n");
  330. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_DUAL;
  331. return 0;
  332. }
  333. break;
  334. case TEGRA30_PCIE:
  335. switch (lanes) {
  336. case 0x00000204:
  337. debug("4x1, 2x1 configuration\n");
  338. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_420;
  339. return 0;
  340. case 0x00020202:
  341. debug("2x3 configuration\n");
  342. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_222;
  343. return 0;
  344. case 0x00010104:
  345. debug("4x1, 1x2 configuration\n");
  346. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_411;
  347. return 0;
  348. }
  349. break;
  350. case TEGRA124_PCIE:
  351. case TEGRA210_PCIE:
  352. switch (lanes) {
  353. case 0x0000104:
  354. debug("4x1, 1x1 configuration\n");
  355. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X4_X1;
  356. return 0;
  357. case 0x0000102:
  358. debug("2x1, 1x1 configuration\n");
  359. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X2_X1;
  360. return 0;
  361. }
  362. break;
  363. case TEGRA186_PCIE:
  364. switch (lanes) {
  365. case 0x0010004:
  366. debug("x4 x1 configuration\n");
  367. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_401;
  368. return 0;
  369. case 0x0010102:
  370. debug("x2 x1 x1 configuration\n");
  371. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_211;
  372. return 0;
  373. case 0x0010101:
  374. debug("x1 x1 x1 configuration\n");
  375. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_111;
  376. return 0;
  377. }
  378. break;
  379. default:
  380. break;
  381. }
  382. return -FDT_ERR_NOTFOUND;
  383. }
  384. static int tegra_pcie_parse_port_info(const void *fdt, int node,
  385. unsigned int *index,
  386. unsigned int *lanes)
  387. {
  388. struct fdt_pci_addr addr;
  389. int err;
  390. err = fdtdec_get_int(fdt, node, "nvidia,num-lanes", 0);
  391. if (err < 0) {
  392. error("failed to parse \"nvidia,num-lanes\" property");
  393. return err;
  394. }
  395. *lanes = err;
  396. err = fdtdec_get_pci_addr(fdt, node, 0, "reg", &addr);
  397. if (err < 0) {
  398. error("failed to parse \"reg\" property");
  399. return err;
  400. }
  401. *index = PCI_DEV(addr.phys_hi) - 1;
  402. return 0;
  403. }
  404. int __weak tegra_pcie_board_init(void)
  405. {
  406. return 0;
  407. }
  408. static int tegra_pcie_parse_dt(const void *fdt, int node, enum tegra_pci_id id,
  409. struct tegra_pcie *pcie)
  410. {
  411. int err, subnode;
  412. u32 lanes = 0;
  413. err = fdt_get_named_resource(fdt, node, "reg", "reg-names", "pads",
  414. &pcie->pads);
  415. if (err < 0) {
  416. error("resource \"pads\" not found");
  417. return err;
  418. }
  419. err = fdt_get_named_resource(fdt, node, "reg", "reg-names", "afi",
  420. &pcie->afi);
  421. if (err < 0) {
  422. error("resource \"afi\" not found");
  423. return err;
  424. }
  425. err = fdt_get_named_resource(fdt, node, "reg", "reg-names", "cs",
  426. &pcie->cs);
  427. if (err < 0) {
  428. error("resource \"cs\" not found");
  429. return err;
  430. }
  431. err = tegra_pcie_board_init();
  432. if (err < 0) {
  433. error("tegra_pcie_board_init() failed: err=%d", err);
  434. return err;
  435. }
  436. #ifndef CONFIG_TEGRA186
  437. pcie->phy = tegra_xusb_phy_get(TEGRA_XUSB_PADCTL_PCIE);
  438. if (pcie->phy) {
  439. err = tegra_xusb_phy_prepare(pcie->phy);
  440. if (err < 0) {
  441. error("failed to prepare PHY: %d", err);
  442. return err;
  443. }
  444. }
  445. #endif
  446. fdt_for_each_subnode(subnode, fdt, node) {
  447. unsigned int index = 0, num_lanes = 0;
  448. struct tegra_pcie_port *port;
  449. err = tegra_pcie_parse_port_info(fdt, subnode, &index,
  450. &num_lanes);
  451. if (err < 0) {
  452. error("failed to obtain root port info");
  453. continue;
  454. }
  455. lanes |= num_lanes << (index << 3);
  456. if (!fdtdec_get_is_enabled(fdt, subnode))
  457. continue;
  458. port = malloc(sizeof(*port));
  459. if (!port)
  460. continue;
  461. memset(port, 0, sizeof(*port));
  462. port->num_lanes = num_lanes;
  463. port->index = index;
  464. err = tegra_pcie_port_parse_dt(fdt, subnode, port);
  465. if (err < 0) {
  466. free(port);
  467. continue;
  468. }
  469. list_add_tail(&port->list, &pcie->ports);
  470. port->pcie = pcie;
  471. }
  472. err = tegra_pcie_get_xbar_config(fdt, node, lanes, id, &pcie->xbar);
  473. if (err < 0) {
  474. error("invalid lane configuration");
  475. return err;
  476. }
  477. return 0;
  478. }
  479. #ifdef CONFIG_TEGRA186
  480. static int tegra_pcie_power_on(struct tegra_pcie *pcie)
  481. {
  482. int ret;
  483. ret = power_domain_on(&pcie->pwrdom);
  484. if (ret) {
  485. error("power_domain_on() failed: %d\n", ret);
  486. return ret;
  487. }
  488. ret = clk_enable(&pcie->clk_afi);
  489. if (ret) {
  490. error("clk_enable(afi) failed: %d\n", ret);
  491. return ret;
  492. }
  493. ret = clk_enable(&pcie->clk_pex);
  494. if (ret) {
  495. error("clk_enable(pex) failed: %d\n", ret);
  496. return ret;
  497. }
  498. ret = reset_deassert(&pcie->reset_afi);
  499. if (ret) {
  500. error("reset_deassert(afi) failed: %d\n", ret);
  501. return ret;
  502. }
  503. ret = reset_deassert(&pcie->reset_pex);
  504. if (ret) {
  505. error("reset_deassert(pex) failed: %d\n", ret);
  506. return ret;
  507. }
  508. return 0;
  509. }
  510. #else
  511. static int tegra_pcie_power_on(struct tegra_pcie *pcie)
  512. {
  513. const struct tegra_pcie_soc *soc = pcie->soc;
  514. unsigned long value;
  515. int err;
  516. /* reset PCIEXCLK logic, AFI controller and PCIe controller */
  517. reset_set_enable(PERIPH_ID_PCIEXCLK, 1);
  518. reset_set_enable(PERIPH_ID_AFI, 1);
  519. reset_set_enable(PERIPH_ID_PCIE, 1);
  520. err = tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
  521. if (err < 0) {
  522. error("failed to power off PCIe partition: %d", err);
  523. return err;
  524. }
  525. err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
  526. PERIPH_ID_PCIE);
  527. if (err < 0) {
  528. error("failed to power up PCIe partition: %d", err);
  529. return err;
  530. }
  531. /* take AFI controller out of reset */
  532. reset_set_enable(PERIPH_ID_AFI, 0);
  533. /* enable AFI clock */
  534. clock_enable(PERIPH_ID_AFI);
  535. if (soc->has_cml_clk) {
  536. /* enable CML clock */
  537. value = readl(NV_PA_CLK_RST_BASE + 0x48c);
  538. value |= (1 << 0);
  539. value &= ~(1 << 1);
  540. writel(value, NV_PA_CLK_RST_BASE + 0x48c);
  541. }
  542. err = tegra_plle_enable();
  543. if (err < 0) {
  544. error("failed to enable PLLE: %d\n", err);
  545. return err;
  546. }
  547. return 0;
  548. }
  549. static int tegra_pcie_pll_wait(struct tegra_pcie *pcie, unsigned long timeout)
  550. {
  551. const struct tegra_pcie_soc *soc = pcie->soc;
  552. unsigned long start = get_timer(0);
  553. u32 value;
  554. while (get_timer(start) < timeout) {
  555. value = pads_readl(pcie, soc->pads_pll_ctl);
  556. if (value & PADS_PLL_CTL_LOCKDET)
  557. return 0;
  558. }
  559. return -ETIMEDOUT;
  560. }
  561. static int tegra_pcie_phy_enable(struct tegra_pcie *pcie)
  562. {
  563. const struct tegra_pcie_soc *soc = pcie->soc;
  564. u32 value;
  565. int err;
  566. /* initialize internal PHY, enable up to 16 PCIe lanes */
  567. pads_writel(pcie, 0, PADS_CTL_SEL);
  568. /* override IDDQ to 1 on all 4 lanes */
  569. value = pads_readl(pcie, PADS_CTL);
  570. value |= PADS_CTL_IDDQ_1L;
  571. pads_writel(pcie, value, PADS_CTL);
  572. /*
  573. * Set up PHY PLL inputs select PLLE output as refclock, set TX
  574. * ref sel to div10 (not div5).
  575. */
  576. value = pads_readl(pcie, soc->pads_pll_ctl);
  577. value &= ~(PADS_PLL_CTL_REFCLK_MASK | PADS_PLL_CTL_TXCLKREF_MASK);
  578. value |= PADS_PLL_CTL_REFCLK_INTERNAL_CML | soc->tx_ref_sel;
  579. pads_writel(pcie, value, soc->pads_pll_ctl);
  580. /* reset PLL */
  581. value = pads_readl(pcie, soc->pads_pll_ctl);
  582. value &= ~PADS_PLL_CTL_RST_B4SM;
  583. pads_writel(pcie, value, soc->pads_pll_ctl);
  584. udelay(20);
  585. /* take PLL out of reset */
  586. value = pads_readl(pcie, soc->pads_pll_ctl);
  587. value |= PADS_PLL_CTL_RST_B4SM;
  588. pads_writel(pcie, value, soc->pads_pll_ctl);
  589. /* wait for the PLL to lock */
  590. err = tegra_pcie_pll_wait(pcie, 500);
  591. if (err < 0) {
  592. error("PLL failed to lock: %d", err);
  593. return err;
  594. }
  595. /* turn off IDDQ override */
  596. value = pads_readl(pcie, PADS_CTL);
  597. value &= ~PADS_CTL_IDDQ_1L;
  598. pads_writel(pcie, value, PADS_CTL);
  599. /* enable TX/RX data */
  600. value = pads_readl(pcie, PADS_CTL);
  601. value |= PADS_CTL_TX_DATA_EN_1L | PADS_CTL_RX_DATA_EN_1L;
  602. pads_writel(pcie, value, PADS_CTL);
  603. return 0;
  604. }
  605. #endif
  606. static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
  607. {
  608. const struct tegra_pcie_soc *soc = pcie->soc;
  609. struct tegra_pcie_port *port;
  610. u32 value;
  611. int err;
  612. #ifdef CONFIG_TEGRA186
  613. {
  614. #else
  615. if (pcie->phy) {
  616. #endif
  617. value = afi_readl(pcie, AFI_PLLE_CONTROL);
  618. value &= ~AFI_PLLE_CONTROL_BYPASS_PADS2PLLE_CONTROL;
  619. value |= AFI_PLLE_CONTROL_PADS2PLLE_CONTROL_EN;
  620. afi_writel(pcie, value, AFI_PLLE_CONTROL);
  621. }
  622. if (soc->has_pex_bias_ctrl)
  623. afi_writel(pcie, 0, AFI_PEXBIAS_CTRL_0);
  624. value = afi_readl(pcie, AFI_PCIE_CONFIG);
  625. value &= ~AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_MASK;
  626. value |= AFI_PCIE_CONFIG_PCIE_DISABLE_ALL | pcie->xbar;
  627. list_for_each_entry(port, &pcie->ports, list)
  628. value &= ~AFI_PCIE_CONFIG_PCIE_DISABLE(port->index);
  629. afi_writel(pcie, value, AFI_PCIE_CONFIG);
  630. value = afi_readl(pcie, AFI_FUSE);
  631. if (soc->has_gen2)
  632. value &= ~AFI_FUSE_PCIE_T0_GEN2_DIS;
  633. else
  634. value |= AFI_FUSE_PCIE_T0_GEN2_DIS;
  635. afi_writel(pcie, value, AFI_FUSE);
  636. #ifndef CONFIG_TEGRA186
  637. if (pcie->phy)
  638. err = tegra_xusb_phy_enable(pcie->phy);
  639. else
  640. err = tegra_pcie_phy_enable(pcie);
  641. if (err < 0) {
  642. error("failed to power on PHY: %d\n", err);
  643. return err;
  644. }
  645. #endif
  646. /* take the PCIEXCLK logic out of reset */
  647. #ifdef CONFIG_TEGRA186
  648. err = reset_deassert(&pcie->reset_pcie_x);
  649. if (err) {
  650. error("reset_deassert(pcie_x) failed: %d\n", err);
  651. return err;
  652. }
  653. #else
  654. reset_set_enable(PERIPH_ID_PCIEXCLK, 0);
  655. #endif
  656. /* finally enable PCIe */
  657. value = afi_readl(pcie, AFI_CONFIGURATION);
  658. value |= AFI_CONFIGURATION_EN_FPCI;
  659. afi_writel(pcie, value, AFI_CONFIGURATION);
  660. /* disable all interrupts */
  661. afi_writel(pcie, 0, AFI_AFI_INTR_ENABLE);
  662. afi_writel(pcie, 0, AFI_SM_INTR_ENABLE);
  663. afi_writel(pcie, 0, AFI_INTR_MASK);
  664. afi_writel(pcie, 0, AFI_FPCI_ERROR_MASKS);
  665. return 0;
  666. }
  667. static int tegra_pcie_setup_translations(struct udevice *bus)
  668. {
  669. struct tegra_pcie *pcie = dev_get_priv(bus);
  670. unsigned long fpci, axi, size;
  671. struct pci_region *io, *mem, *pref;
  672. int count;
  673. /* BAR 0: type 1 extended configuration space */
  674. fpci = 0xfe100000;
  675. size = fdt_resource_size(&pcie->cs);
  676. axi = pcie->cs.start;
  677. afi_writel(pcie, axi, AFI_AXI_BAR0_START);
  678. afi_writel(pcie, size >> 12, AFI_AXI_BAR0_SZ);
  679. afi_writel(pcie, fpci, AFI_FPCI_BAR0);
  680. count = pci_get_regions(bus, &io, &mem, &pref);
  681. if (count != 3)
  682. return -EINVAL;
  683. /* BAR 1: downstream I/O */
  684. fpci = 0xfdfc0000;
  685. size = io->size;
  686. axi = io->phys_start;
  687. afi_writel(pcie, axi, AFI_AXI_BAR1_START);
  688. afi_writel(pcie, size >> 12, AFI_AXI_BAR1_SZ);
  689. afi_writel(pcie, fpci, AFI_FPCI_BAR1);
  690. /* BAR 2: prefetchable memory */
  691. fpci = (((pref->phys_start >> 12) & 0x0fffffff) << 4) | 0x1;
  692. size = pref->size;
  693. axi = pref->phys_start;
  694. afi_writel(pcie, axi, AFI_AXI_BAR2_START);
  695. afi_writel(pcie, size >> 12, AFI_AXI_BAR2_SZ);
  696. afi_writel(pcie, fpci, AFI_FPCI_BAR2);
  697. /* BAR 3: non-prefetchable memory */
  698. fpci = (((mem->phys_start >> 12) & 0x0fffffff) << 4) | 0x1;
  699. size = mem->size;
  700. axi = mem->phys_start;
  701. afi_writel(pcie, axi, AFI_AXI_BAR3_START);
  702. afi_writel(pcie, size >> 12, AFI_AXI_BAR3_SZ);
  703. afi_writel(pcie, fpci, AFI_FPCI_BAR3);
  704. /* NULL out the remaining BARs as they are not used */
  705. afi_writel(pcie, 0, AFI_AXI_BAR4_START);
  706. afi_writel(pcie, 0, AFI_AXI_BAR4_SZ);
  707. afi_writel(pcie, 0, AFI_FPCI_BAR4);
  708. afi_writel(pcie, 0, AFI_AXI_BAR5_START);
  709. afi_writel(pcie, 0, AFI_AXI_BAR5_SZ);
  710. afi_writel(pcie, 0, AFI_FPCI_BAR5);
  711. /* map all upstream transactions as uncached */
  712. afi_writel(pcie, NV_PA_SDRAM_BASE, AFI_CACHE_BAR0_ST);
  713. afi_writel(pcie, 0, AFI_CACHE_BAR0_SZ);
  714. afi_writel(pcie, 0, AFI_CACHE_BAR1_ST);
  715. afi_writel(pcie, 0, AFI_CACHE_BAR1_SZ);
  716. /* MSI translations are setup only when needed */
  717. afi_writel(pcie, 0, AFI_MSI_FPCI_BAR_ST);
  718. afi_writel(pcie, 0, AFI_MSI_BAR_SZ);
  719. afi_writel(pcie, 0, AFI_MSI_AXI_BAR_ST);
  720. afi_writel(pcie, 0, AFI_MSI_BAR_SZ);
  721. return 0;
  722. }
  723. static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)
  724. {
  725. unsigned long ret = 0;
  726. switch (port->index) {
  727. case 0:
  728. ret = AFI_PEX0_CTRL;
  729. break;
  730. case 1:
  731. ret = AFI_PEX1_CTRL;
  732. break;
  733. case 2:
  734. ret = port->pcie->soc->afi_pex2_ctrl;
  735. break;
  736. }
  737. return ret;
  738. }
  739. static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
  740. {
  741. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  742. unsigned long value;
  743. /* pulse reset signel */
  744. value = afi_readl(port->pcie, ctrl);
  745. value &= ~AFI_PEX_CTRL_RST;
  746. afi_writel(port->pcie, value, ctrl);
  747. udelay(2000);
  748. value = afi_readl(port->pcie, ctrl);
  749. value |= AFI_PEX_CTRL_RST;
  750. afi_writel(port->pcie, value, ctrl);
  751. }
  752. static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
  753. {
  754. struct tegra_pcie *pcie = port->pcie;
  755. const struct tegra_pcie_soc *soc = pcie->soc;
  756. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  757. unsigned long value;
  758. /* enable reference clock */
  759. value = afi_readl(pcie, ctrl);
  760. value |= AFI_PEX_CTRL_REFCLK_EN;
  761. if (pcie->soc->has_pex_clkreq_en)
  762. value |= AFI_PEX_CTRL_CLKREQ_EN;
  763. value |= AFI_PEX_CTRL_OVERRIDE_EN;
  764. afi_writel(pcie, value, ctrl);
  765. tegra_pcie_port_reset(port);
  766. if (soc->force_pca_enable) {
  767. value = rp_readl(port, RP_VEND_CTL2);
  768. value |= RP_VEND_CTL2_PCA_ENABLE;
  769. rp_writel(port, value, RP_VEND_CTL2);
  770. }
  771. /* configure the reference clock driver */
  772. pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
  773. if (soc->num_ports > 2)
  774. pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
  775. }
  776. static bool tegra_pcie_port_check_link(struct tegra_pcie_port *port)
  777. {
  778. unsigned int retries = 3;
  779. unsigned long value;
  780. value = rp_readl(port, RP_PRIV_MISC);
  781. value &= ~RP_PRIV_MISC_PRSNT_MAP_EP_ABSNT;
  782. value |= RP_PRIV_MISC_PRSNT_MAP_EP_PRSNT;
  783. rp_writel(port, value, RP_PRIV_MISC);
  784. do {
  785. unsigned int timeout = 200;
  786. do {
  787. value = rp_readl(port, RP_VEND_XP);
  788. if (value & RP_VEND_XP_DL_UP)
  789. break;
  790. udelay(2000);
  791. } while (--timeout);
  792. if (!timeout) {
  793. debug("link %u down, retrying\n", port->index);
  794. goto retry;
  795. }
  796. timeout = 200;
  797. do {
  798. value = rp_readl(port, RP_LINK_CONTROL_STATUS);
  799. if (value & RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE)
  800. return true;
  801. udelay(2000);
  802. } while (--timeout);
  803. retry:
  804. tegra_pcie_port_reset(port);
  805. } while (--retries);
  806. return false;
  807. }
  808. static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
  809. {
  810. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  811. unsigned long value;
  812. /* assert port reset */
  813. value = afi_readl(port->pcie, ctrl);
  814. value &= ~AFI_PEX_CTRL_RST;
  815. afi_writel(port->pcie, value, ctrl);
  816. /* disable reference clock */
  817. value = afi_readl(port->pcie, ctrl);
  818. value &= ~AFI_PEX_CTRL_REFCLK_EN;
  819. afi_writel(port->pcie, value, ctrl);
  820. }
  821. static void tegra_pcie_port_free(struct tegra_pcie_port *port)
  822. {
  823. list_del(&port->list);
  824. free(port);
  825. }
  826. static int tegra_pcie_enable(struct tegra_pcie *pcie)
  827. {
  828. struct tegra_pcie_port *port, *tmp;
  829. list_for_each_entry_safe(port, tmp, &pcie->ports, list) {
  830. debug("probing port %u, using %u lanes\n", port->index,
  831. port->num_lanes);
  832. tegra_pcie_port_enable(port);
  833. if (tegra_pcie_port_check_link(port))
  834. continue;
  835. debug("link %u down, ignoring\n", port->index);
  836. tegra_pcie_port_disable(port);
  837. tegra_pcie_port_free(port);
  838. }
  839. return 0;
  840. }
  841. static const struct tegra_pcie_soc pci_tegra_soc[] = {
  842. [TEGRA20_PCIE] = {
  843. .num_ports = 2,
  844. .pads_pll_ctl = PADS_PLL_CTL_TEGRA20,
  845. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10,
  846. .pads_refclk_cfg0 = 0xfa5cfa5c,
  847. .has_pex_clkreq_en = false,
  848. .has_pex_bias_ctrl = false,
  849. .has_cml_clk = false,
  850. .has_gen2 = false,
  851. },
  852. [TEGRA30_PCIE] = {
  853. .num_ports = 3,
  854. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  855. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  856. .afi_pex2_ctrl = AFI_PEX2_CTRL,
  857. .pads_refclk_cfg0 = 0xfa5cfa5c,
  858. .pads_refclk_cfg1 = 0xfa5cfa5c,
  859. .has_pex_clkreq_en = true,
  860. .has_pex_bias_ctrl = true,
  861. .has_cml_clk = true,
  862. .has_gen2 = false,
  863. },
  864. [TEGRA124_PCIE] = {
  865. .num_ports = 2,
  866. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  867. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  868. .pads_refclk_cfg0 = 0x44ac44ac,
  869. .has_pex_clkreq_en = true,
  870. .has_pex_bias_ctrl = true,
  871. .has_cml_clk = true,
  872. .has_gen2 = true,
  873. },
  874. [TEGRA210_PCIE] = {
  875. .num_ports = 2,
  876. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  877. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  878. .pads_refclk_cfg0 = 0x90b890b8,
  879. .has_pex_clkreq_en = true,
  880. .has_pex_bias_ctrl = true,
  881. .has_cml_clk = true,
  882. .has_gen2 = true,
  883. .force_pca_enable = true,
  884. },
  885. [TEGRA186_PCIE] = {
  886. .num_ports = 3,
  887. .afi_pex2_ctrl = AFI_PEX2_CTRL_T186,
  888. .pads_refclk_cfg0 = 0x80b880b8,
  889. .pads_refclk_cfg1 = 0x000480b8,
  890. .has_pex_clkreq_en = true,
  891. .has_pex_bias_ctrl = true,
  892. .has_gen2 = true,
  893. },
  894. };
  895. static int pci_tegra_ofdata_to_platdata(struct udevice *dev)
  896. {
  897. struct tegra_pcie *pcie = dev_get_priv(dev);
  898. enum tegra_pci_id id;
  899. id = dev_get_driver_data(dev);
  900. pcie->soc = &pci_tegra_soc[id];
  901. INIT_LIST_HEAD(&pcie->ports);
  902. if (tegra_pcie_parse_dt(gd->fdt_blob, dev->of_offset, id, pcie))
  903. return -EINVAL;
  904. return 0;
  905. }
  906. static int pci_tegra_probe(struct udevice *dev)
  907. {
  908. struct tegra_pcie *pcie = dev_get_priv(dev);
  909. int err;
  910. #ifdef CONFIG_TEGRA186
  911. err = clk_get_by_name(dev, "afi", &pcie->clk_afi);
  912. if (err) {
  913. debug("clk_get_by_name(afi) failed: %d\n", err);
  914. return err;
  915. }
  916. err = clk_get_by_name(dev, "pex", &pcie->clk_pex);
  917. if (err) {
  918. debug("clk_get_by_name(pex) failed: %d\n", err);
  919. return err;
  920. }
  921. err = reset_get_by_name(dev, "afi", &pcie->reset_afi);
  922. if (err) {
  923. debug("reset_get_by_name(afi) failed: %d\n", err);
  924. return err;
  925. }
  926. err = reset_get_by_name(dev, "pex", &pcie->reset_pex);
  927. if (err) {
  928. debug("reset_get_by_name(pex) failed: %d\n", err);
  929. return err;
  930. }
  931. err = reset_get_by_name(dev, "pcie_x", &pcie->reset_pcie_x);
  932. if (err) {
  933. debug("reset_get_by_name(pcie_x) failed: %d\n", err);
  934. return err;
  935. }
  936. err = power_domain_get(dev, &pcie->pwrdom);
  937. if (err) {
  938. debug("power_domain_get() failed: %d\n", err);
  939. return err;
  940. }
  941. #endif
  942. err = tegra_pcie_power_on(pcie);
  943. if (err < 0) {
  944. error("failed to power on");
  945. return err;
  946. }
  947. err = tegra_pcie_enable_controller(pcie);
  948. if (err < 0) {
  949. error("failed to enable controller");
  950. return err;
  951. }
  952. err = tegra_pcie_setup_translations(dev);
  953. if (err < 0) {
  954. error("failed to decode ranges");
  955. return err;
  956. }
  957. err = tegra_pcie_enable(pcie);
  958. if (err < 0) {
  959. error("failed to enable PCIe");
  960. return err;
  961. }
  962. return 0;
  963. }
  964. static const struct dm_pci_ops pci_tegra_ops = {
  965. .read_config = pci_tegra_read_config,
  966. .write_config = pci_tegra_write_config,
  967. };
  968. static const struct udevice_id pci_tegra_ids[] = {
  969. { .compatible = "nvidia,tegra20-pcie", .data = TEGRA20_PCIE },
  970. { .compatible = "nvidia,tegra30-pcie", .data = TEGRA30_PCIE },
  971. { .compatible = "nvidia,tegra124-pcie", .data = TEGRA124_PCIE },
  972. { .compatible = "nvidia,tegra210-pcie", .data = TEGRA210_PCIE },
  973. { .compatible = "nvidia,tegra186-pcie", .data = TEGRA186_PCIE },
  974. { }
  975. };
  976. U_BOOT_DRIVER(pci_tegra) = {
  977. .name = "pci_tegra",
  978. .id = UCLASS_PCI,
  979. .of_match = pci_tegra_ids,
  980. .ops = &pci_tegra_ops,
  981. .ofdata_to_platdata = pci_tegra_ofdata_to_platdata,
  982. .probe = pci_tegra_probe,
  983. .priv_auto_alloc_size = sizeof(struct tegra_pcie),
  984. };