pci_tegra.c 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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 <malloc.h>
  18. #include <pci.h>
  19. #include <power-domain.h>
  20. #include <reset.h>
  21. #include <asm/io.h>
  22. #include <asm/gpio.h>
  23. #include <linux/ioport.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 resource pads;
  186. struct resource afi;
  187. struct 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(ofnode node, struct tegra_pcie_port *port)
  305. {
  306. const u32 *addr;
  307. int len;
  308. addr = ofnode_get_property(node, "assigned-addresses", &len);
  309. if (!addr) {
  310. error("property \"assigned-addresses\" not found");
  311. return -FDT_ERR_NOTFOUND;
  312. }
  313. port->regs.start = fdt32_to_cpu(addr[2]);
  314. port->regs.end = port->regs.start + fdt32_to_cpu(addr[4]);
  315. return 0;
  316. }
  317. static int tegra_pcie_get_xbar_config(ofnode node, u32 lanes,
  318. enum tegra_pci_id id, unsigned long *xbar)
  319. {
  320. switch (id) {
  321. case TEGRA20_PCIE:
  322. switch (lanes) {
  323. case 0x00000004:
  324. debug("single-mode configuration\n");
  325. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_SINGLE;
  326. return 0;
  327. case 0x00000202:
  328. debug("dual-mode configuration\n");
  329. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_DUAL;
  330. return 0;
  331. }
  332. break;
  333. case TEGRA30_PCIE:
  334. switch (lanes) {
  335. case 0x00000204:
  336. debug("4x1, 2x1 configuration\n");
  337. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_420;
  338. return 0;
  339. case 0x00020202:
  340. debug("2x3 configuration\n");
  341. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_222;
  342. return 0;
  343. case 0x00010104:
  344. debug("4x1, 1x2 configuration\n");
  345. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_411;
  346. return 0;
  347. }
  348. break;
  349. case TEGRA124_PCIE:
  350. case TEGRA210_PCIE:
  351. switch (lanes) {
  352. case 0x0000104:
  353. debug("4x1, 1x1 configuration\n");
  354. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X4_X1;
  355. return 0;
  356. case 0x0000102:
  357. debug("2x1, 1x1 configuration\n");
  358. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X2_X1;
  359. return 0;
  360. }
  361. break;
  362. case TEGRA186_PCIE:
  363. switch (lanes) {
  364. case 0x0010004:
  365. debug("x4 x1 configuration\n");
  366. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_401;
  367. return 0;
  368. case 0x0010102:
  369. debug("x2 x1 x1 configuration\n");
  370. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_211;
  371. return 0;
  372. case 0x0010101:
  373. debug("x1 x1 x1 configuration\n");
  374. *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_T186_111;
  375. return 0;
  376. }
  377. break;
  378. default:
  379. break;
  380. }
  381. return -FDT_ERR_NOTFOUND;
  382. }
  383. static int tegra_pcie_parse_port_info(ofnode node, uint *index, uint *lanes)
  384. {
  385. struct fdt_pci_addr addr;
  386. int err;
  387. err = ofnode_read_u32_default(node, "nvidia,num-lanes", -1);
  388. if (err < 0) {
  389. error("failed to parse \"nvidia,num-lanes\" property");
  390. return err;
  391. }
  392. *lanes = err;
  393. err = ofnode_read_pci_addr(node, 0, "reg", &addr);
  394. if (err < 0) {
  395. error("failed to parse \"reg\" property");
  396. return err;
  397. }
  398. *index = PCI_DEV(addr.phys_hi) - 1;
  399. return 0;
  400. }
  401. int __weak tegra_pcie_board_init(void)
  402. {
  403. return 0;
  404. }
  405. static int tegra_pcie_parse_dt(struct udevice *dev, enum tegra_pci_id id,
  406. struct tegra_pcie *pcie)
  407. {
  408. ofnode subnode;
  409. u32 lanes = 0;
  410. int err;
  411. err = dev_read_resource(dev, 0, &pcie->pads);
  412. if (err < 0) {
  413. error("resource \"pads\" not found");
  414. return err;
  415. }
  416. err = dev_read_resource(dev, 1, &pcie->afi);
  417. if (err < 0) {
  418. error("resource \"afi\" not found");
  419. return err;
  420. }
  421. err = dev_read_resource(dev, 2, &pcie->cs);
  422. if (err < 0) {
  423. error("resource \"cs\" not found");
  424. return err;
  425. }
  426. err = tegra_pcie_board_init();
  427. if (err < 0) {
  428. error("tegra_pcie_board_init() failed: err=%d", err);
  429. return err;
  430. }
  431. #ifndef CONFIG_TEGRA186
  432. pcie->phy = tegra_xusb_phy_get(TEGRA_XUSB_PADCTL_PCIE);
  433. if (pcie->phy) {
  434. err = tegra_xusb_phy_prepare(pcie->phy);
  435. if (err < 0) {
  436. error("failed to prepare PHY: %d", err);
  437. return err;
  438. }
  439. }
  440. #endif
  441. dev_for_each_subnode(subnode, dev) {
  442. unsigned int index = 0, num_lanes = 0;
  443. struct tegra_pcie_port *port;
  444. err = tegra_pcie_parse_port_info(subnode, &index, &num_lanes);
  445. if (err < 0) {
  446. error("failed to obtain root port info");
  447. continue;
  448. }
  449. lanes |= num_lanes << (index << 3);
  450. if (!ofnode_is_available(subnode))
  451. continue;
  452. port = malloc(sizeof(*port));
  453. if (!port)
  454. continue;
  455. memset(port, 0, sizeof(*port));
  456. port->num_lanes = num_lanes;
  457. port->index = index;
  458. err = tegra_pcie_port_parse_dt(subnode, port);
  459. if (err < 0) {
  460. free(port);
  461. continue;
  462. }
  463. list_add_tail(&port->list, &pcie->ports);
  464. port->pcie = pcie;
  465. }
  466. err = tegra_pcie_get_xbar_config(dev_ofnode(dev), lanes, id,
  467. &pcie->xbar);
  468. if (err < 0) {
  469. error("invalid lane configuration");
  470. return err;
  471. }
  472. return 0;
  473. }
  474. #ifdef CONFIG_TEGRA186
  475. static int tegra_pcie_power_on(struct tegra_pcie *pcie)
  476. {
  477. int ret;
  478. ret = power_domain_on(&pcie->pwrdom);
  479. if (ret) {
  480. error("power_domain_on() failed: %d\n", ret);
  481. return ret;
  482. }
  483. ret = clk_enable(&pcie->clk_afi);
  484. if (ret) {
  485. error("clk_enable(afi) failed: %d\n", ret);
  486. return ret;
  487. }
  488. ret = clk_enable(&pcie->clk_pex);
  489. if (ret) {
  490. error("clk_enable(pex) failed: %d\n", ret);
  491. return ret;
  492. }
  493. ret = reset_deassert(&pcie->reset_afi);
  494. if (ret) {
  495. error("reset_deassert(afi) failed: %d\n", ret);
  496. return ret;
  497. }
  498. ret = reset_deassert(&pcie->reset_pex);
  499. if (ret) {
  500. error("reset_deassert(pex) failed: %d\n", ret);
  501. return ret;
  502. }
  503. return 0;
  504. }
  505. #else
  506. static int tegra_pcie_power_on(struct tegra_pcie *pcie)
  507. {
  508. const struct tegra_pcie_soc *soc = pcie->soc;
  509. unsigned long value;
  510. int err;
  511. /* reset PCIEXCLK logic, AFI controller and PCIe controller */
  512. reset_set_enable(PERIPH_ID_PCIEXCLK, 1);
  513. reset_set_enable(PERIPH_ID_AFI, 1);
  514. reset_set_enable(PERIPH_ID_PCIE, 1);
  515. err = tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
  516. if (err < 0) {
  517. error("failed to power off PCIe partition: %d", err);
  518. return err;
  519. }
  520. err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
  521. PERIPH_ID_PCIE);
  522. if (err < 0) {
  523. error("failed to power up PCIe partition: %d", err);
  524. return err;
  525. }
  526. /* take AFI controller out of reset */
  527. reset_set_enable(PERIPH_ID_AFI, 0);
  528. /* enable AFI clock */
  529. clock_enable(PERIPH_ID_AFI);
  530. if (soc->has_cml_clk) {
  531. /* enable CML clock */
  532. value = readl(NV_PA_CLK_RST_BASE + 0x48c);
  533. value |= (1 << 0);
  534. value &= ~(1 << 1);
  535. writel(value, NV_PA_CLK_RST_BASE + 0x48c);
  536. }
  537. err = tegra_plle_enable();
  538. if (err < 0) {
  539. error("failed to enable PLLE: %d\n", err);
  540. return err;
  541. }
  542. return 0;
  543. }
  544. static int tegra_pcie_pll_wait(struct tegra_pcie *pcie, unsigned long timeout)
  545. {
  546. const struct tegra_pcie_soc *soc = pcie->soc;
  547. unsigned long start = get_timer(0);
  548. u32 value;
  549. while (get_timer(start) < timeout) {
  550. value = pads_readl(pcie, soc->pads_pll_ctl);
  551. if (value & PADS_PLL_CTL_LOCKDET)
  552. return 0;
  553. }
  554. return -ETIMEDOUT;
  555. }
  556. static int tegra_pcie_phy_enable(struct tegra_pcie *pcie)
  557. {
  558. const struct tegra_pcie_soc *soc = pcie->soc;
  559. u32 value;
  560. int err;
  561. /* initialize internal PHY, enable up to 16 PCIe lanes */
  562. pads_writel(pcie, 0, PADS_CTL_SEL);
  563. /* override IDDQ to 1 on all 4 lanes */
  564. value = pads_readl(pcie, PADS_CTL);
  565. value |= PADS_CTL_IDDQ_1L;
  566. pads_writel(pcie, value, PADS_CTL);
  567. /*
  568. * Set up PHY PLL inputs select PLLE output as refclock, set TX
  569. * ref sel to div10 (not div5).
  570. */
  571. value = pads_readl(pcie, soc->pads_pll_ctl);
  572. value &= ~(PADS_PLL_CTL_REFCLK_MASK | PADS_PLL_CTL_TXCLKREF_MASK);
  573. value |= PADS_PLL_CTL_REFCLK_INTERNAL_CML | soc->tx_ref_sel;
  574. pads_writel(pcie, value, soc->pads_pll_ctl);
  575. /* reset PLL */
  576. value = pads_readl(pcie, soc->pads_pll_ctl);
  577. value &= ~PADS_PLL_CTL_RST_B4SM;
  578. pads_writel(pcie, value, soc->pads_pll_ctl);
  579. udelay(20);
  580. /* take PLL out of reset */
  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. /* wait for the PLL to lock */
  585. err = tegra_pcie_pll_wait(pcie, 500);
  586. if (err < 0) {
  587. error("PLL failed to lock: %d", err);
  588. return err;
  589. }
  590. /* turn off IDDQ override */
  591. value = pads_readl(pcie, PADS_CTL);
  592. value &= ~PADS_CTL_IDDQ_1L;
  593. pads_writel(pcie, value, PADS_CTL);
  594. /* enable TX/RX data */
  595. value = pads_readl(pcie, PADS_CTL);
  596. value |= PADS_CTL_TX_DATA_EN_1L | PADS_CTL_RX_DATA_EN_1L;
  597. pads_writel(pcie, value, PADS_CTL);
  598. return 0;
  599. }
  600. #endif
  601. static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
  602. {
  603. const struct tegra_pcie_soc *soc = pcie->soc;
  604. struct tegra_pcie_port *port;
  605. u32 value;
  606. int err;
  607. #ifdef CONFIG_TEGRA186
  608. {
  609. #else
  610. if (pcie->phy) {
  611. #endif
  612. value = afi_readl(pcie, AFI_PLLE_CONTROL);
  613. value &= ~AFI_PLLE_CONTROL_BYPASS_PADS2PLLE_CONTROL;
  614. value |= AFI_PLLE_CONTROL_PADS2PLLE_CONTROL_EN;
  615. afi_writel(pcie, value, AFI_PLLE_CONTROL);
  616. }
  617. if (soc->has_pex_bias_ctrl)
  618. afi_writel(pcie, 0, AFI_PEXBIAS_CTRL_0);
  619. value = afi_readl(pcie, AFI_PCIE_CONFIG);
  620. value &= ~AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_MASK;
  621. value |= AFI_PCIE_CONFIG_PCIE_DISABLE_ALL | pcie->xbar;
  622. list_for_each_entry(port, &pcie->ports, list)
  623. value &= ~AFI_PCIE_CONFIG_PCIE_DISABLE(port->index);
  624. afi_writel(pcie, value, AFI_PCIE_CONFIG);
  625. value = afi_readl(pcie, AFI_FUSE);
  626. if (soc->has_gen2)
  627. value &= ~AFI_FUSE_PCIE_T0_GEN2_DIS;
  628. else
  629. value |= AFI_FUSE_PCIE_T0_GEN2_DIS;
  630. afi_writel(pcie, value, AFI_FUSE);
  631. #ifndef CONFIG_TEGRA186
  632. if (pcie->phy)
  633. err = tegra_xusb_phy_enable(pcie->phy);
  634. else
  635. err = tegra_pcie_phy_enable(pcie);
  636. if (err < 0) {
  637. error("failed to power on PHY: %d\n", err);
  638. return err;
  639. }
  640. #endif
  641. /* take the PCIEXCLK logic out of reset */
  642. #ifdef CONFIG_TEGRA186
  643. err = reset_deassert(&pcie->reset_pcie_x);
  644. if (err) {
  645. error("reset_deassert(pcie_x) failed: %d\n", err);
  646. return err;
  647. }
  648. #else
  649. reset_set_enable(PERIPH_ID_PCIEXCLK, 0);
  650. #endif
  651. /* finally enable PCIe */
  652. value = afi_readl(pcie, AFI_CONFIGURATION);
  653. value |= AFI_CONFIGURATION_EN_FPCI;
  654. afi_writel(pcie, value, AFI_CONFIGURATION);
  655. /* disable all interrupts */
  656. afi_writel(pcie, 0, AFI_AFI_INTR_ENABLE);
  657. afi_writel(pcie, 0, AFI_SM_INTR_ENABLE);
  658. afi_writel(pcie, 0, AFI_INTR_MASK);
  659. afi_writel(pcie, 0, AFI_FPCI_ERROR_MASKS);
  660. return 0;
  661. }
  662. static int tegra_pcie_setup_translations(struct udevice *bus)
  663. {
  664. struct tegra_pcie *pcie = dev_get_priv(bus);
  665. unsigned long fpci, axi, size;
  666. struct pci_region *io, *mem, *pref;
  667. int count;
  668. /* BAR 0: type 1 extended configuration space */
  669. fpci = 0xfe100000;
  670. size = resource_size(&pcie->cs);
  671. axi = pcie->cs.start;
  672. afi_writel(pcie, axi, AFI_AXI_BAR0_START);
  673. afi_writel(pcie, size >> 12, AFI_AXI_BAR0_SZ);
  674. afi_writel(pcie, fpci, AFI_FPCI_BAR0);
  675. count = pci_get_regions(bus, &io, &mem, &pref);
  676. if (count != 3)
  677. return -EINVAL;
  678. /* BAR 1: downstream I/O */
  679. fpci = 0xfdfc0000;
  680. size = io->size;
  681. axi = io->phys_start;
  682. afi_writel(pcie, axi, AFI_AXI_BAR1_START);
  683. afi_writel(pcie, size >> 12, AFI_AXI_BAR1_SZ);
  684. afi_writel(pcie, fpci, AFI_FPCI_BAR1);
  685. /* BAR 2: prefetchable memory */
  686. fpci = (((pref->phys_start >> 12) & 0x0fffffff) << 4) | 0x1;
  687. size = pref->size;
  688. axi = pref->phys_start;
  689. afi_writel(pcie, axi, AFI_AXI_BAR2_START);
  690. afi_writel(pcie, size >> 12, AFI_AXI_BAR2_SZ);
  691. afi_writel(pcie, fpci, AFI_FPCI_BAR2);
  692. /* BAR 3: non-prefetchable memory */
  693. fpci = (((mem->phys_start >> 12) & 0x0fffffff) << 4) | 0x1;
  694. size = mem->size;
  695. axi = mem->phys_start;
  696. afi_writel(pcie, axi, AFI_AXI_BAR3_START);
  697. afi_writel(pcie, size >> 12, AFI_AXI_BAR3_SZ);
  698. afi_writel(pcie, fpci, AFI_FPCI_BAR3);
  699. /* NULL out the remaining BARs as they are not used */
  700. afi_writel(pcie, 0, AFI_AXI_BAR4_START);
  701. afi_writel(pcie, 0, AFI_AXI_BAR4_SZ);
  702. afi_writel(pcie, 0, AFI_FPCI_BAR4);
  703. afi_writel(pcie, 0, AFI_AXI_BAR5_START);
  704. afi_writel(pcie, 0, AFI_AXI_BAR5_SZ);
  705. afi_writel(pcie, 0, AFI_FPCI_BAR5);
  706. /* map all upstream transactions as uncached */
  707. afi_writel(pcie, NV_PA_SDRAM_BASE, AFI_CACHE_BAR0_ST);
  708. afi_writel(pcie, 0, AFI_CACHE_BAR0_SZ);
  709. afi_writel(pcie, 0, AFI_CACHE_BAR1_ST);
  710. afi_writel(pcie, 0, AFI_CACHE_BAR1_SZ);
  711. /* MSI translations are setup only when needed */
  712. afi_writel(pcie, 0, AFI_MSI_FPCI_BAR_ST);
  713. afi_writel(pcie, 0, AFI_MSI_BAR_SZ);
  714. afi_writel(pcie, 0, AFI_MSI_AXI_BAR_ST);
  715. afi_writel(pcie, 0, AFI_MSI_BAR_SZ);
  716. return 0;
  717. }
  718. static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)
  719. {
  720. unsigned long ret = 0;
  721. switch (port->index) {
  722. case 0:
  723. ret = AFI_PEX0_CTRL;
  724. break;
  725. case 1:
  726. ret = AFI_PEX1_CTRL;
  727. break;
  728. case 2:
  729. ret = port->pcie->soc->afi_pex2_ctrl;
  730. break;
  731. }
  732. return ret;
  733. }
  734. static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
  735. {
  736. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  737. unsigned long value;
  738. /* pulse reset signel */
  739. value = afi_readl(port->pcie, ctrl);
  740. value &= ~AFI_PEX_CTRL_RST;
  741. afi_writel(port->pcie, value, ctrl);
  742. udelay(2000);
  743. value = afi_readl(port->pcie, ctrl);
  744. value |= AFI_PEX_CTRL_RST;
  745. afi_writel(port->pcie, value, ctrl);
  746. }
  747. static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
  748. {
  749. struct tegra_pcie *pcie = port->pcie;
  750. const struct tegra_pcie_soc *soc = pcie->soc;
  751. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  752. unsigned long value;
  753. /* enable reference clock */
  754. value = afi_readl(pcie, ctrl);
  755. value |= AFI_PEX_CTRL_REFCLK_EN;
  756. if (pcie->soc->has_pex_clkreq_en)
  757. value |= AFI_PEX_CTRL_CLKREQ_EN;
  758. value |= AFI_PEX_CTRL_OVERRIDE_EN;
  759. afi_writel(pcie, value, ctrl);
  760. tegra_pcie_port_reset(port);
  761. if (soc->force_pca_enable) {
  762. value = rp_readl(port, RP_VEND_CTL2);
  763. value |= RP_VEND_CTL2_PCA_ENABLE;
  764. rp_writel(port, value, RP_VEND_CTL2);
  765. }
  766. /* configure the reference clock driver */
  767. pads_writel(pcie, soc->pads_refclk_cfg0, PADS_REFCLK_CFG0);
  768. if (soc->num_ports > 2)
  769. pads_writel(pcie, soc->pads_refclk_cfg1, PADS_REFCLK_CFG1);
  770. }
  771. static bool tegra_pcie_port_check_link(struct tegra_pcie_port *port)
  772. {
  773. unsigned int retries = 3;
  774. unsigned long value;
  775. value = rp_readl(port, RP_PRIV_MISC);
  776. value &= ~RP_PRIV_MISC_PRSNT_MAP_EP_ABSNT;
  777. value |= RP_PRIV_MISC_PRSNT_MAP_EP_PRSNT;
  778. rp_writel(port, value, RP_PRIV_MISC);
  779. do {
  780. unsigned int timeout = 200;
  781. do {
  782. value = rp_readl(port, RP_VEND_XP);
  783. if (value & RP_VEND_XP_DL_UP)
  784. break;
  785. udelay(2000);
  786. } while (--timeout);
  787. if (!timeout) {
  788. debug("link %u down, retrying\n", port->index);
  789. goto retry;
  790. }
  791. timeout = 200;
  792. do {
  793. value = rp_readl(port, RP_LINK_CONTROL_STATUS);
  794. if (value & RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE)
  795. return true;
  796. udelay(2000);
  797. } while (--timeout);
  798. retry:
  799. tegra_pcie_port_reset(port);
  800. } while (--retries);
  801. return false;
  802. }
  803. static void tegra_pcie_port_disable(struct tegra_pcie_port *port)
  804. {
  805. unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
  806. unsigned long value;
  807. /* assert port reset */
  808. value = afi_readl(port->pcie, ctrl);
  809. value &= ~AFI_PEX_CTRL_RST;
  810. afi_writel(port->pcie, value, ctrl);
  811. /* disable reference clock */
  812. value = afi_readl(port->pcie, ctrl);
  813. value &= ~AFI_PEX_CTRL_REFCLK_EN;
  814. afi_writel(port->pcie, value, ctrl);
  815. }
  816. static void tegra_pcie_port_free(struct tegra_pcie_port *port)
  817. {
  818. list_del(&port->list);
  819. free(port);
  820. }
  821. static int tegra_pcie_enable(struct tegra_pcie *pcie)
  822. {
  823. struct tegra_pcie_port *port, *tmp;
  824. list_for_each_entry_safe(port, tmp, &pcie->ports, list) {
  825. debug("probing port %u, using %u lanes\n", port->index,
  826. port->num_lanes);
  827. tegra_pcie_port_enable(port);
  828. if (tegra_pcie_port_check_link(port))
  829. continue;
  830. debug("link %u down, ignoring\n", port->index);
  831. tegra_pcie_port_disable(port);
  832. tegra_pcie_port_free(port);
  833. }
  834. return 0;
  835. }
  836. static const struct tegra_pcie_soc pci_tegra_soc[] = {
  837. [TEGRA20_PCIE] = {
  838. .num_ports = 2,
  839. .pads_pll_ctl = PADS_PLL_CTL_TEGRA20,
  840. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10,
  841. .pads_refclk_cfg0 = 0xfa5cfa5c,
  842. .has_pex_clkreq_en = false,
  843. .has_pex_bias_ctrl = false,
  844. .has_cml_clk = false,
  845. .has_gen2 = false,
  846. },
  847. [TEGRA30_PCIE] = {
  848. .num_ports = 3,
  849. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  850. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  851. .afi_pex2_ctrl = AFI_PEX2_CTRL,
  852. .pads_refclk_cfg0 = 0xfa5cfa5c,
  853. .pads_refclk_cfg1 = 0xfa5cfa5c,
  854. .has_pex_clkreq_en = true,
  855. .has_pex_bias_ctrl = true,
  856. .has_cml_clk = true,
  857. .has_gen2 = false,
  858. },
  859. [TEGRA124_PCIE] = {
  860. .num_ports = 2,
  861. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  862. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  863. .pads_refclk_cfg0 = 0x44ac44ac,
  864. .has_pex_clkreq_en = true,
  865. .has_pex_bias_ctrl = true,
  866. .has_cml_clk = true,
  867. .has_gen2 = true,
  868. },
  869. [TEGRA210_PCIE] = {
  870. .num_ports = 2,
  871. .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
  872. .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
  873. .pads_refclk_cfg0 = 0x90b890b8,
  874. .has_pex_clkreq_en = true,
  875. .has_pex_bias_ctrl = true,
  876. .has_cml_clk = true,
  877. .has_gen2 = true,
  878. .force_pca_enable = true,
  879. },
  880. [TEGRA186_PCIE] = {
  881. .num_ports = 3,
  882. .afi_pex2_ctrl = AFI_PEX2_CTRL_T186,
  883. .pads_refclk_cfg0 = 0x80b880b8,
  884. .pads_refclk_cfg1 = 0x000480b8,
  885. .has_pex_clkreq_en = true,
  886. .has_pex_bias_ctrl = true,
  887. .has_gen2 = true,
  888. },
  889. };
  890. static int pci_tegra_ofdata_to_platdata(struct udevice *dev)
  891. {
  892. struct tegra_pcie *pcie = dev_get_priv(dev);
  893. enum tegra_pci_id id;
  894. id = dev_get_driver_data(dev);
  895. pcie->soc = &pci_tegra_soc[id];
  896. INIT_LIST_HEAD(&pcie->ports);
  897. if (tegra_pcie_parse_dt(dev, id, pcie))
  898. return -EINVAL;
  899. return 0;
  900. }
  901. static int pci_tegra_probe(struct udevice *dev)
  902. {
  903. struct tegra_pcie *pcie = dev_get_priv(dev);
  904. int err;
  905. #ifdef CONFIG_TEGRA186
  906. err = clk_get_by_name(dev, "afi", &pcie->clk_afi);
  907. if (err) {
  908. debug("clk_get_by_name(afi) failed: %d\n", err);
  909. return err;
  910. }
  911. err = clk_get_by_name(dev, "pex", &pcie->clk_pex);
  912. if (err) {
  913. debug("clk_get_by_name(pex) failed: %d\n", err);
  914. return err;
  915. }
  916. err = reset_get_by_name(dev, "afi", &pcie->reset_afi);
  917. if (err) {
  918. debug("reset_get_by_name(afi) failed: %d\n", err);
  919. return err;
  920. }
  921. err = reset_get_by_name(dev, "pex", &pcie->reset_pex);
  922. if (err) {
  923. debug("reset_get_by_name(pex) failed: %d\n", err);
  924. return err;
  925. }
  926. err = reset_get_by_name(dev, "pcie_x", &pcie->reset_pcie_x);
  927. if (err) {
  928. debug("reset_get_by_name(pcie_x) failed: %d\n", err);
  929. return err;
  930. }
  931. err = power_domain_get(dev, &pcie->pwrdom);
  932. if (err) {
  933. debug("power_domain_get() failed: %d\n", err);
  934. return err;
  935. }
  936. #endif
  937. err = tegra_pcie_power_on(pcie);
  938. if (err < 0) {
  939. error("failed to power on");
  940. return err;
  941. }
  942. err = tegra_pcie_enable_controller(pcie);
  943. if (err < 0) {
  944. error("failed to enable controller");
  945. return err;
  946. }
  947. err = tegra_pcie_setup_translations(dev);
  948. if (err < 0) {
  949. error("failed to decode ranges");
  950. return err;
  951. }
  952. err = tegra_pcie_enable(pcie);
  953. if (err < 0) {
  954. error("failed to enable PCIe");
  955. return err;
  956. }
  957. return 0;
  958. }
  959. static const struct dm_pci_ops pci_tegra_ops = {
  960. .read_config = pci_tegra_read_config,
  961. .write_config = pci_tegra_write_config,
  962. };
  963. static const struct udevice_id pci_tegra_ids[] = {
  964. { .compatible = "nvidia,tegra20-pcie", .data = TEGRA20_PCIE },
  965. { .compatible = "nvidia,tegra30-pcie", .data = TEGRA30_PCIE },
  966. { .compatible = "nvidia,tegra124-pcie", .data = TEGRA124_PCIE },
  967. { .compatible = "nvidia,tegra210-pcie", .data = TEGRA210_PCIE },
  968. { .compatible = "nvidia,tegra186-pcie", .data = TEGRA186_PCIE },
  969. { }
  970. };
  971. U_BOOT_DRIVER(pci_tegra) = {
  972. .name = "pci_tegra",
  973. .id = UCLASS_PCI,
  974. .of_match = pci_tegra_ids,
  975. .ops = &pci_tegra_ops,
  976. .ofdata_to_platdata = pci_tegra_ofdata_to_platdata,
  977. .probe = pci_tegra_probe,
  978. .priv_auto_alloc_size = sizeof(struct tegra_pcie),
  979. };