pcie-rcar.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. /*
  2. * PCIe driver for Renesas R-Car SoCs
  3. * Copyright (C) 2014 Renesas Electronics Europe Ltd
  4. *
  5. * Based on:
  6. * arch/sh/drivers/pci/pcie-sh7786.c
  7. * arch/sh/drivers/pci/ops-sh7786.c
  8. * Copyright (C) 2009 - 2011 Paul Mundt
  9. *
  10. * Author: Phil Edworthy <phil.edworthy@renesas.com>
  11. *
  12. * This file is licensed under the terms of the GNU General Public
  13. * License version 2. This program is licensed "as is" without any
  14. * warranty of any kind, whether express or implied.
  15. */
  16. #include <linux/clk.h>
  17. #include <linux/delay.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/irq.h>
  20. #include <linux/irqdomain.h>
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/msi.h>
  24. #include <linux/of_address.h>
  25. #include <linux/of_irq.h>
  26. #include <linux/of_pci.h>
  27. #include <linux/of_platform.h>
  28. #include <linux/pci.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/pm_runtime.h>
  31. #include <linux/slab.h>
  32. #define PCIECAR 0x000010
  33. #define PCIECCTLR 0x000018
  34. #define CONFIG_SEND_ENABLE (1 << 31)
  35. #define TYPE0 (0 << 8)
  36. #define TYPE1 (1 << 8)
  37. #define PCIECDR 0x000020
  38. #define PCIEMSR 0x000028
  39. #define PCIEINTXR 0x000400
  40. #define PCIEMSITXR 0x000840
  41. /* Transfer control */
  42. #define PCIETCTLR 0x02000
  43. #define CFINIT 1
  44. #define PCIETSTR 0x02004
  45. #define DATA_LINK_ACTIVE 1
  46. #define PCIEERRFR 0x02020
  47. #define UNSUPPORTED_REQUEST (1 << 4)
  48. #define PCIEMSIFR 0x02044
  49. #define PCIEMSIALR 0x02048
  50. #define MSIFE 1
  51. #define PCIEMSIAUR 0x0204c
  52. #define PCIEMSIIER 0x02050
  53. /* root port address */
  54. #define PCIEPRAR(x) (0x02080 + ((x) * 0x4))
  55. /* local address reg & mask */
  56. #define PCIELAR(x) (0x02200 + ((x) * 0x20))
  57. #define PCIELAMR(x) (0x02208 + ((x) * 0x20))
  58. #define LAM_PREFETCH (1 << 3)
  59. #define LAM_64BIT (1 << 2)
  60. #define LAR_ENABLE (1 << 1)
  61. /* PCIe address reg & mask */
  62. #define PCIEPALR(x) (0x03400 + ((x) * 0x20))
  63. #define PCIEPAUR(x) (0x03404 + ((x) * 0x20))
  64. #define PCIEPAMR(x) (0x03408 + ((x) * 0x20))
  65. #define PCIEPTCTLR(x) (0x0340c + ((x) * 0x20))
  66. #define PAR_ENABLE (1 << 31)
  67. #define IO_SPACE (1 << 8)
  68. /* Configuration */
  69. #define PCICONF(x) (0x010000 + ((x) * 0x4))
  70. #define PMCAP(x) (0x010040 + ((x) * 0x4))
  71. #define EXPCAP(x) (0x010070 + ((x) * 0x4))
  72. #define VCCAP(x) (0x010100 + ((x) * 0x4))
  73. /* link layer */
  74. #define IDSETR1 0x011004
  75. #define TLCTLR 0x011048
  76. #define MACSR 0x011054
  77. #define SPCHGFIN (1 << 4)
  78. #define SPCHGFAIL (1 << 6)
  79. #define SPCHGSUC (1 << 7)
  80. #define LINK_SPEED (0xf << 16)
  81. #define LINK_SPEED_2_5GTS (1 << 16)
  82. #define LINK_SPEED_5_0GTS (2 << 16)
  83. #define MACCTLR 0x011058
  84. #define SPEED_CHANGE (1 << 24)
  85. #define SCRAMBLE_DISABLE (1 << 27)
  86. #define MACS2R 0x011078
  87. #define MACCGSPSETR 0x011084
  88. #define SPCNGRSN (1 << 31)
  89. /* R-Car H1 PHY */
  90. #define H1_PCIEPHYADRR 0x04000c
  91. #define WRITE_CMD (1 << 16)
  92. #define PHY_ACK (1 << 24)
  93. #define RATE_POS 12
  94. #define LANE_POS 8
  95. #define ADR_POS 0
  96. #define H1_PCIEPHYDOUTR 0x040014
  97. #define H1_PCIEPHYSR 0x040018
  98. /* R-Car Gen2 PHY */
  99. #define GEN2_PCIEPHYADDR 0x780
  100. #define GEN2_PCIEPHYDATA 0x784
  101. #define GEN2_PCIEPHYCTRL 0x78c
  102. #define INT_PCI_MSI_NR 32
  103. #define RCONF(x) (PCICONF(0)+(x))
  104. #define RPMCAP(x) (PMCAP(0)+(x))
  105. #define REXPCAP(x) (EXPCAP(0)+(x))
  106. #define RVCCAP(x) (VCCAP(0)+(x))
  107. #define PCIE_CONF_BUS(b) (((b) & 0xff) << 24)
  108. #define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19)
  109. #define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16)
  110. #define RCAR_PCI_MAX_RESOURCES 4
  111. #define MAX_NR_INBOUND_MAPS 6
  112. struct rcar_msi {
  113. DECLARE_BITMAP(used, INT_PCI_MSI_NR);
  114. struct irq_domain *domain;
  115. struct msi_controller chip;
  116. unsigned long pages;
  117. struct mutex lock;
  118. int irq1;
  119. int irq2;
  120. };
  121. static inline struct rcar_msi *to_rcar_msi(struct msi_controller *chip)
  122. {
  123. return container_of(chip, struct rcar_msi, chip);
  124. }
  125. /* Structure representing the PCIe interface */
  126. struct rcar_pcie {
  127. struct device *dev;
  128. void __iomem *base;
  129. struct list_head resources;
  130. int root_bus_nr;
  131. struct clk *clk;
  132. struct clk *bus_clk;
  133. struct rcar_msi msi;
  134. };
  135. static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
  136. unsigned long reg)
  137. {
  138. writel(val, pcie->base + reg);
  139. }
  140. static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
  141. unsigned long reg)
  142. {
  143. return readl(pcie->base + reg);
  144. }
  145. enum {
  146. RCAR_PCI_ACCESS_READ,
  147. RCAR_PCI_ACCESS_WRITE,
  148. };
  149. static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
  150. {
  151. int shift = 8 * (where & 3);
  152. u32 val = rcar_pci_read_reg(pcie, where & ~3);
  153. val &= ~(mask << shift);
  154. val |= data << shift;
  155. rcar_pci_write_reg(pcie, val, where & ~3);
  156. }
  157. static u32 rcar_read_conf(struct rcar_pcie *pcie, int where)
  158. {
  159. int shift = 8 * (where & 3);
  160. u32 val = rcar_pci_read_reg(pcie, where & ~3);
  161. return val >> shift;
  162. }
  163. /* Serialization is provided by 'pci_lock' in drivers/pci/access.c */
  164. static int rcar_pcie_config_access(struct rcar_pcie *pcie,
  165. unsigned char access_type, struct pci_bus *bus,
  166. unsigned int devfn, int where, u32 *data)
  167. {
  168. int dev, func, reg, index;
  169. dev = PCI_SLOT(devfn);
  170. func = PCI_FUNC(devfn);
  171. reg = where & ~3;
  172. index = reg / 4;
  173. /*
  174. * While each channel has its own memory-mapped extended config
  175. * space, it's generally only accessible when in endpoint mode.
  176. * When in root complex mode, the controller is unable to target
  177. * itself with either type 0 or type 1 accesses, and indeed, any
  178. * controller initiated target transfer to its own config space
  179. * result in a completer abort.
  180. *
  181. * Each channel effectively only supports a single device, but as
  182. * the same channel <-> device access works for any PCI_SLOT()
  183. * value, we cheat a bit here and bind the controller's config
  184. * space to devfn 0 in order to enable self-enumeration. In this
  185. * case the regular ECAR/ECDR path is sidelined and the mangled
  186. * config access itself is initiated as an internal bus transaction.
  187. */
  188. if (pci_is_root_bus(bus)) {
  189. if (dev != 0)
  190. return PCIBIOS_DEVICE_NOT_FOUND;
  191. if (access_type == RCAR_PCI_ACCESS_READ) {
  192. *data = rcar_pci_read_reg(pcie, PCICONF(index));
  193. } else {
  194. /* Keep an eye out for changes to the root bus number */
  195. if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS))
  196. pcie->root_bus_nr = *data & 0xff;
  197. rcar_pci_write_reg(pcie, *data, PCICONF(index));
  198. }
  199. return PCIBIOS_SUCCESSFUL;
  200. }
  201. if (pcie->root_bus_nr < 0)
  202. return PCIBIOS_DEVICE_NOT_FOUND;
  203. /* Clear errors */
  204. rcar_pci_write_reg(pcie, rcar_pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
  205. /* Set the PIO address */
  206. rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
  207. PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
  208. /* Enable the configuration access */
  209. if (bus->parent->number == pcie->root_bus_nr)
  210. rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR);
  211. else
  212. rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR);
  213. /* Check for errors */
  214. if (rcar_pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST)
  215. return PCIBIOS_DEVICE_NOT_FOUND;
  216. /* Check for master and target aborts */
  217. if (rcar_read_conf(pcie, RCONF(PCI_STATUS)) &
  218. (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT))
  219. return PCIBIOS_DEVICE_NOT_FOUND;
  220. if (access_type == RCAR_PCI_ACCESS_READ)
  221. *data = rcar_pci_read_reg(pcie, PCIECDR);
  222. else
  223. rcar_pci_write_reg(pcie, *data, PCIECDR);
  224. /* Disable the configuration access */
  225. rcar_pci_write_reg(pcie, 0, PCIECCTLR);
  226. return PCIBIOS_SUCCESSFUL;
  227. }
  228. static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
  229. int where, int size, u32 *val)
  230. {
  231. struct rcar_pcie *pcie = bus->sysdata;
  232. int ret;
  233. ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
  234. bus, devfn, where, val);
  235. if (ret != PCIBIOS_SUCCESSFUL) {
  236. *val = 0xffffffff;
  237. return ret;
  238. }
  239. if (size == 1)
  240. *val = (*val >> (8 * (where & 3))) & 0xff;
  241. else if (size == 2)
  242. *val = (*val >> (8 * (where & 2))) & 0xffff;
  243. dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n",
  244. bus->number, devfn, where, size, (unsigned long)*val);
  245. return ret;
  246. }
  247. /* Serialization is provided by 'pci_lock' in drivers/pci/access.c */
  248. static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
  249. int where, int size, u32 val)
  250. {
  251. struct rcar_pcie *pcie = bus->sysdata;
  252. int shift, ret;
  253. u32 data;
  254. ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
  255. bus, devfn, where, &data);
  256. if (ret != PCIBIOS_SUCCESSFUL)
  257. return ret;
  258. dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x where=0x%04x size=%d val=0x%08lx\n",
  259. bus->number, devfn, where, size, (unsigned long)val);
  260. if (size == 1) {
  261. shift = 8 * (where & 3);
  262. data &= ~(0xff << shift);
  263. data |= ((val & 0xff) << shift);
  264. } else if (size == 2) {
  265. shift = 8 * (where & 2);
  266. data &= ~(0xffff << shift);
  267. data |= ((val & 0xffff) << shift);
  268. } else
  269. data = val;
  270. ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_WRITE,
  271. bus, devfn, where, &data);
  272. return ret;
  273. }
  274. static struct pci_ops rcar_pcie_ops = {
  275. .read = rcar_pcie_read_conf,
  276. .write = rcar_pcie_write_conf,
  277. };
  278. static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie,
  279. struct resource *res)
  280. {
  281. /* Setup PCIe address space mappings for each resource */
  282. resource_size_t size;
  283. resource_size_t res_start;
  284. u32 mask;
  285. rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win));
  286. /*
  287. * The PAMR mask is calculated in units of 128Bytes, which
  288. * keeps things pretty simple.
  289. */
  290. size = resource_size(res);
  291. mask = (roundup_pow_of_two(size) / SZ_128) - 1;
  292. rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
  293. if (res->flags & IORESOURCE_IO)
  294. res_start = pci_pio_to_address(res->start);
  295. else
  296. res_start = res->start;
  297. rcar_pci_write_reg(pcie, upper_32_bits(res_start), PCIEPAUR(win));
  298. rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F,
  299. PCIEPALR(win));
  300. /* First resource is for IO */
  301. mask = PAR_ENABLE;
  302. if (res->flags & IORESOURCE_IO)
  303. mask |= IO_SPACE;
  304. rcar_pci_write_reg(pcie, mask, PCIEPTCTLR(win));
  305. }
  306. static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci)
  307. {
  308. struct resource_entry *win;
  309. int i = 0;
  310. /* Setup PCI resources */
  311. resource_list_for_each_entry(win, &pci->resources) {
  312. struct resource *res = win->res;
  313. if (!res->flags)
  314. continue;
  315. switch (resource_type(res)) {
  316. case IORESOURCE_IO:
  317. case IORESOURCE_MEM:
  318. rcar_pcie_setup_window(i, pci, res);
  319. i++;
  320. break;
  321. case IORESOURCE_BUS:
  322. pci->root_bus_nr = res->start;
  323. break;
  324. default:
  325. continue;
  326. }
  327. pci_add_resource(resource, res);
  328. }
  329. return 1;
  330. }
  331. static void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
  332. {
  333. struct device *dev = pcie->dev;
  334. unsigned int timeout = 1000;
  335. u32 macsr;
  336. if ((rcar_pci_read_reg(pcie, MACS2R) & LINK_SPEED) != LINK_SPEED_5_0GTS)
  337. return;
  338. if (rcar_pci_read_reg(pcie, MACCTLR) & SPEED_CHANGE) {
  339. dev_err(dev, "Speed change already in progress\n");
  340. return;
  341. }
  342. macsr = rcar_pci_read_reg(pcie, MACSR);
  343. if ((macsr & LINK_SPEED) == LINK_SPEED_5_0GTS)
  344. goto done;
  345. /* Set target link speed to 5.0 GT/s */
  346. rcar_rmw32(pcie, EXPCAP(12), PCI_EXP_LNKSTA_CLS,
  347. PCI_EXP_LNKSTA_CLS_5_0GB);
  348. /* Set speed change reason as intentional factor */
  349. rcar_rmw32(pcie, MACCGSPSETR, SPCNGRSN, 0);
  350. /* Clear SPCHGFIN, SPCHGSUC, and SPCHGFAIL */
  351. if (macsr & (SPCHGFIN | SPCHGSUC | SPCHGFAIL))
  352. rcar_pci_write_reg(pcie, macsr, MACSR);
  353. /* Start link speed change */
  354. rcar_rmw32(pcie, MACCTLR, SPEED_CHANGE, SPEED_CHANGE);
  355. while (timeout--) {
  356. macsr = rcar_pci_read_reg(pcie, MACSR);
  357. if (macsr & SPCHGFIN) {
  358. /* Clear the interrupt bits */
  359. rcar_pci_write_reg(pcie, macsr, MACSR);
  360. if (macsr & SPCHGFAIL)
  361. dev_err(dev, "Speed change failed\n");
  362. goto done;
  363. }
  364. msleep(1);
  365. };
  366. dev_err(dev, "Speed change timed out\n");
  367. done:
  368. dev_info(dev, "Current link speed is %s GT/s\n",
  369. (macsr & LINK_SPEED) == LINK_SPEED_5_0GTS ? "5" : "2.5");
  370. }
  371. static int rcar_pcie_enable(struct rcar_pcie *pcie)
  372. {
  373. struct device *dev = pcie->dev;
  374. struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
  375. struct pci_bus *bus, *child;
  376. int ret;
  377. /* Try setting 5 GT/s link speed */
  378. rcar_pcie_force_speedup(pcie);
  379. rcar_pcie_setup(&bridge->windows, pcie);
  380. pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS);
  381. bridge->dev.parent = dev;
  382. bridge->sysdata = pcie;
  383. bridge->busnr = pcie->root_bus_nr;
  384. bridge->ops = &rcar_pcie_ops;
  385. bridge->map_irq = of_irq_parse_and_map_pci;
  386. bridge->swizzle_irq = pci_common_swizzle;
  387. if (IS_ENABLED(CONFIG_PCI_MSI))
  388. bridge->msi = &pcie->msi.chip;
  389. ret = pci_scan_root_bus_bridge(bridge);
  390. if (ret < 0)
  391. return ret;
  392. bus = bridge->bus;
  393. pci_bus_size_bridges(bus);
  394. pci_bus_assign_resources(bus);
  395. list_for_each_entry(child, &bus->children, node)
  396. pcie_bus_configure_settings(child);
  397. pci_bus_add_devices(bus);
  398. return 0;
  399. }
  400. static int phy_wait_for_ack(struct rcar_pcie *pcie)
  401. {
  402. struct device *dev = pcie->dev;
  403. unsigned int timeout = 100;
  404. while (timeout--) {
  405. if (rcar_pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK)
  406. return 0;
  407. udelay(100);
  408. }
  409. dev_err(dev, "Access to PCIe phy timed out\n");
  410. return -ETIMEDOUT;
  411. }
  412. static void phy_write_reg(struct rcar_pcie *pcie,
  413. unsigned int rate, unsigned int addr,
  414. unsigned int lane, unsigned int data)
  415. {
  416. unsigned long phyaddr;
  417. phyaddr = WRITE_CMD |
  418. ((rate & 1) << RATE_POS) |
  419. ((lane & 0xf) << LANE_POS) |
  420. ((addr & 0xff) << ADR_POS);
  421. /* Set write data */
  422. rcar_pci_write_reg(pcie, data, H1_PCIEPHYDOUTR);
  423. rcar_pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR);
  424. /* Ignore errors as they will be dealt with if the data link is down */
  425. phy_wait_for_ack(pcie);
  426. /* Clear command */
  427. rcar_pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR);
  428. rcar_pci_write_reg(pcie, 0, H1_PCIEPHYADRR);
  429. /* Ignore errors as they will be dealt with if the data link is down */
  430. phy_wait_for_ack(pcie);
  431. }
  432. static int rcar_pcie_wait_for_dl(struct rcar_pcie *pcie)
  433. {
  434. unsigned int timeout = 10;
  435. while (timeout--) {
  436. if ((rcar_pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE))
  437. return 0;
  438. msleep(5);
  439. }
  440. return -ETIMEDOUT;
  441. }
  442. static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
  443. {
  444. int err;
  445. /* Begin initialization */
  446. rcar_pci_write_reg(pcie, 0, PCIETCTLR);
  447. /* Set mode */
  448. rcar_pci_write_reg(pcie, 1, PCIEMSR);
  449. /*
  450. * Initial header for port config space is type 1, set the device
  451. * class to match. Hardware takes care of propagating the IDSETR
  452. * settings, so there is no need to bother with a quirk.
  453. */
  454. rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1);
  455. /*
  456. * Setup Secondary Bus Number & Subordinate Bus Number, even though
  457. * they aren't used, to avoid bridge being detected as broken.
  458. */
  459. rcar_rmw32(pcie, RCONF(PCI_SECONDARY_BUS), 0xff, 1);
  460. rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1);
  461. /* Initialize default capabilities. */
  462. rcar_rmw32(pcie, REXPCAP(0), 0xff, PCI_CAP_ID_EXP);
  463. rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS),
  464. PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4);
  465. rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f,
  466. PCI_HEADER_TYPE_BRIDGE);
  467. /* Enable data link layer active state reporting */
  468. rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), PCI_EXP_LNKCAP_DLLLARC,
  469. PCI_EXP_LNKCAP_DLLLARC);
  470. /* Write out the physical slot number = 0 */
  471. rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
  472. /* Set the completion timer timeout to the maximum 50ms. */
  473. rcar_rmw32(pcie, TLCTLR + 1, 0x3f, 50);
  474. /* Terminate list of capabilities (Next Capability Offset=0) */
  475. rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
  476. /* Enable MSI */
  477. if (IS_ENABLED(CONFIG_PCI_MSI))
  478. rcar_pci_write_reg(pcie, 0x801f0000, PCIEMSITXR);
  479. /* Finish initialization - establish a PCI Express link */
  480. rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
  481. /* This will timeout if we don't have a link. */
  482. err = rcar_pcie_wait_for_dl(pcie);
  483. if (err)
  484. return err;
  485. /* Enable INTx interrupts */
  486. rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8);
  487. wmb();
  488. return 0;
  489. }
  490. static int rcar_pcie_hw_init_h1(struct rcar_pcie *pcie)
  491. {
  492. unsigned int timeout = 10;
  493. /* Initialize the phy */
  494. phy_write_reg(pcie, 0, 0x42, 0x1, 0x0EC34191);
  495. phy_write_reg(pcie, 1, 0x42, 0x1, 0x0EC34180);
  496. phy_write_reg(pcie, 0, 0x43, 0x1, 0x00210188);
  497. phy_write_reg(pcie, 1, 0x43, 0x1, 0x00210188);
  498. phy_write_reg(pcie, 0, 0x44, 0x1, 0x015C0014);
  499. phy_write_reg(pcie, 1, 0x44, 0x1, 0x015C0014);
  500. phy_write_reg(pcie, 1, 0x4C, 0x1, 0x786174A0);
  501. phy_write_reg(pcie, 1, 0x4D, 0x1, 0x048000BB);
  502. phy_write_reg(pcie, 0, 0x51, 0x1, 0x079EC062);
  503. phy_write_reg(pcie, 0, 0x52, 0x1, 0x20000000);
  504. phy_write_reg(pcie, 1, 0x52, 0x1, 0x20000000);
  505. phy_write_reg(pcie, 1, 0x56, 0x1, 0x00003806);
  506. phy_write_reg(pcie, 0, 0x60, 0x1, 0x004B03A5);
  507. phy_write_reg(pcie, 0, 0x64, 0x1, 0x3F0F1F0F);
  508. phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000);
  509. while (timeout--) {
  510. if (rcar_pci_read_reg(pcie, H1_PCIEPHYSR))
  511. return rcar_pcie_hw_init(pcie);
  512. msleep(5);
  513. }
  514. return -ETIMEDOUT;
  515. }
  516. static int rcar_pcie_hw_init_gen2(struct rcar_pcie *pcie)
  517. {
  518. /*
  519. * These settings come from the R-Car Series, 2nd Generation User's
  520. * Manual, section 50.3.1 (2) Initialization of the physical layer.
  521. */
  522. rcar_pci_write_reg(pcie, 0x000f0030, GEN2_PCIEPHYADDR);
  523. rcar_pci_write_reg(pcie, 0x00381203, GEN2_PCIEPHYDATA);
  524. rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
  525. rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
  526. rcar_pci_write_reg(pcie, 0x000f0054, GEN2_PCIEPHYADDR);
  527. /* The following value is for DC connection, no termination resistor */
  528. rcar_pci_write_reg(pcie, 0x13802007, GEN2_PCIEPHYDATA);
  529. rcar_pci_write_reg(pcie, 0x00000001, GEN2_PCIEPHYCTRL);
  530. rcar_pci_write_reg(pcie, 0x00000006, GEN2_PCIEPHYCTRL);
  531. return rcar_pcie_hw_init(pcie);
  532. }
  533. static int rcar_msi_alloc(struct rcar_msi *chip)
  534. {
  535. int msi;
  536. mutex_lock(&chip->lock);
  537. msi = find_first_zero_bit(chip->used, INT_PCI_MSI_NR);
  538. if (msi < INT_PCI_MSI_NR)
  539. set_bit(msi, chip->used);
  540. else
  541. msi = -ENOSPC;
  542. mutex_unlock(&chip->lock);
  543. return msi;
  544. }
  545. static int rcar_msi_alloc_region(struct rcar_msi *chip, int no_irqs)
  546. {
  547. int msi;
  548. mutex_lock(&chip->lock);
  549. msi = bitmap_find_free_region(chip->used, INT_PCI_MSI_NR,
  550. order_base_2(no_irqs));
  551. mutex_unlock(&chip->lock);
  552. return msi;
  553. }
  554. static void rcar_msi_free(struct rcar_msi *chip, unsigned long irq)
  555. {
  556. mutex_lock(&chip->lock);
  557. clear_bit(irq, chip->used);
  558. mutex_unlock(&chip->lock);
  559. }
  560. static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
  561. {
  562. struct rcar_pcie *pcie = data;
  563. struct rcar_msi *msi = &pcie->msi;
  564. struct device *dev = pcie->dev;
  565. unsigned long reg;
  566. reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
  567. /* MSI & INTx share an interrupt - we only handle MSI here */
  568. if (!reg)
  569. return IRQ_NONE;
  570. while (reg) {
  571. unsigned int index = find_first_bit(&reg, 32);
  572. unsigned int irq;
  573. /* clear the interrupt */
  574. rcar_pci_write_reg(pcie, 1 << index, PCIEMSIFR);
  575. irq = irq_find_mapping(msi->domain, index);
  576. if (irq) {
  577. if (test_bit(index, msi->used))
  578. generic_handle_irq(irq);
  579. else
  580. dev_info(dev, "unhandled MSI\n");
  581. } else {
  582. /* Unknown MSI, just clear it */
  583. dev_dbg(dev, "unexpected MSI\n");
  584. }
  585. /* see if there's any more pending in this vector */
  586. reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
  587. }
  588. return IRQ_HANDLED;
  589. }
  590. static int rcar_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev,
  591. struct msi_desc *desc)
  592. {
  593. struct rcar_msi *msi = to_rcar_msi(chip);
  594. struct rcar_pcie *pcie = container_of(chip, struct rcar_pcie, msi.chip);
  595. struct msi_msg msg;
  596. unsigned int irq;
  597. int hwirq;
  598. hwirq = rcar_msi_alloc(msi);
  599. if (hwirq < 0)
  600. return hwirq;
  601. irq = irq_find_mapping(msi->domain, hwirq);
  602. if (!irq) {
  603. rcar_msi_free(msi, hwirq);
  604. return -EINVAL;
  605. }
  606. irq_set_msi_desc(irq, desc);
  607. msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
  608. msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
  609. msg.data = hwirq;
  610. pci_write_msi_msg(irq, &msg);
  611. return 0;
  612. }
  613. static int rcar_msi_setup_irqs(struct msi_controller *chip,
  614. struct pci_dev *pdev, int nvec, int type)
  615. {
  616. struct rcar_pcie *pcie = container_of(chip, struct rcar_pcie, msi.chip);
  617. struct rcar_msi *msi = to_rcar_msi(chip);
  618. struct msi_desc *desc;
  619. struct msi_msg msg;
  620. unsigned int irq;
  621. int hwirq;
  622. int i;
  623. /* MSI-X interrupts are not supported */
  624. if (type == PCI_CAP_ID_MSIX)
  625. return -EINVAL;
  626. WARN_ON(!list_is_singular(&pdev->dev.msi_list));
  627. desc = list_entry(pdev->dev.msi_list.next, struct msi_desc, list);
  628. hwirq = rcar_msi_alloc_region(msi, nvec);
  629. if (hwirq < 0)
  630. return -ENOSPC;
  631. irq = irq_find_mapping(msi->domain, hwirq);
  632. if (!irq)
  633. return -ENOSPC;
  634. for (i = 0; i < nvec; i++) {
  635. /*
  636. * irq_create_mapping() called from rcar_pcie_probe() pre-
  637. * allocates descs, so there is no need to allocate descs here.
  638. * We can therefore assume that if irq_find_mapping() above
  639. * returns non-zero, then the descs are also successfully
  640. * allocated.
  641. */
  642. if (irq_set_msi_desc_off(irq, i, desc)) {
  643. /* TODO: clear */
  644. return -EINVAL;
  645. }
  646. }
  647. desc->nvec_used = nvec;
  648. desc->msi_attrib.multiple = order_base_2(nvec);
  649. msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
  650. msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
  651. msg.data = hwirq;
  652. pci_write_msi_msg(irq, &msg);
  653. return 0;
  654. }
  655. static void rcar_msi_teardown_irq(struct msi_controller *chip, unsigned int irq)
  656. {
  657. struct rcar_msi *msi = to_rcar_msi(chip);
  658. struct irq_data *d = irq_get_irq_data(irq);
  659. rcar_msi_free(msi, d->hwirq);
  660. }
  661. static struct irq_chip rcar_msi_irq_chip = {
  662. .name = "R-Car PCIe MSI",
  663. .irq_enable = pci_msi_unmask_irq,
  664. .irq_disable = pci_msi_mask_irq,
  665. .irq_mask = pci_msi_mask_irq,
  666. .irq_unmask = pci_msi_unmask_irq,
  667. };
  668. static int rcar_msi_map(struct irq_domain *domain, unsigned int irq,
  669. irq_hw_number_t hwirq)
  670. {
  671. irq_set_chip_and_handler(irq, &rcar_msi_irq_chip, handle_simple_irq);
  672. irq_set_chip_data(irq, domain->host_data);
  673. return 0;
  674. }
  675. static const struct irq_domain_ops msi_domain_ops = {
  676. .map = rcar_msi_map,
  677. };
  678. static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
  679. {
  680. struct device *dev = pcie->dev;
  681. struct rcar_msi *msi = &pcie->msi;
  682. unsigned long base;
  683. int err, i;
  684. mutex_init(&msi->lock);
  685. msi->chip.dev = dev;
  686. msi->chip.setup_irq = rcar_msi_setup_irq;
  687. msi->chip.setup_irqs = rcar_msi_setup_irqs;
  688. msi->chip.teardown_irq = rcar_msi_teardown_irq;
  689. msi->domain = irq_domain_add_linear(dev->of_node, INT_PCI_MSI_NR,
  690. &msi_domain_ops, &msi->chip);
  691. if (!msi->domain) {
  692. dev_err(dev, "failed to create IRQ domain\n");
  693. return -ENOMEM;
  694. }
  695. for (i = 0; i < INT_PCI_MSI_NR; i++)
  696. irq_create_mapping(msi->domain, i);
  697. /* Two irqs are for MSI, but they are also used for non-MSI irqs */
  698. err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq,
  699. IRQF_SHARED | IRQF_NO_THREAD,
  700. rcar_msi_irq_chip.name, pcie);
  701. if (err < 0) {
  702. dev_err(dev, "failed to request IRQ: %d\n", err);
  703. goto err;
  704. }
  705. err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq,
  706. IRQF_SHARED | IRQF_NO_THREAD,
  707. rcar_msi_irq_chip.name, pcie);
  708. if (err < 0) {
  709. dev_err(dev, "failed to request IRQ: %d\n", err);
  710. goto err;
  711. }
  712. /* setup MSI data target */
  713. msi->pages = __get_free_pages(GFP_KERNEL, 0);
  714. base = virt_to_phys((void *)msi->pages);
  715. rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
  716. rcar_pci_write_reg(pcie, 0, PCIEMSIAUR);
  717. /* enable all MSI interrupts */
  718. rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);
  719. return 0;
  720. err:
  721. irq_domain_remove(msi->domain);
  722. return err;
  723. }
  724. static int rcar_pcie_get_resources(struct rcar_pcie *pcie)
  725. {
  726. struct device *dev = pcie->dev;
  727. struct resource res;
  728. int err, i;
  729. err = of_address_to_resource(dev->of_node, 0, &res);
  730. if (err)
  731. return err;
  732. pcie->base = devm_ioremap_resource(dev, &res);
  733. if (IS_ERR(pcie->base))
  734. return PTR_ERR(pcie->base);
  735. pcie->clk = devm_clk_get(dev, "pcie");
  736. if (IS_ERR(pcie->clk)) {
  737. dev_err(dev, "cannot get platform clock\n");
  738. return PTR_ERR(pcie->clk);
  739. }
  740. err = clk_prepare_enable(pcie->clk);
  741. if (err)
  742. return err;
  743. pcie->bus_clk = devm_clk_get(dev, "pcie_bus");
  744. if (IS_ERR(pcie->bus_clk)) {
  745. dev_err(dev, "cannot get pcie bus clock\n");
  746. err = PTR_ERR(pcie->bus_clk);
  747. goto fail_clk;
  748. }
  749. err = clk_prepare_enable(pcie->bus_clk);
  750. if (err)
  751. goto fail_clk;
  752. i = irq_of_parse_and_map(dev->of_node, 0);
  753. if (!i) {
  754. dev_err(dev, "cannot get platform resources for msi interrupt\n");
  755. err = -ENOENT;
  756. goto err_map_reg;
  757. }
  758. pcie->msi.irq1 = i;
  759. i = irq_of_parse_and_map(dev->of_node, 1);
  760. if (!i) {
  761. dev_err(dev, "cannot get platform resources for msi interrupt\n");
  762. err = -ENOENT;
  763. goto err_map_reg;
  764. }
  765. pcie->msi.irq2 = i;
  766. return 0;
  767. err_map_reg:
  768. clk_disable_unprepare(pcie->bus_clk);
  769. fail_clk:
  770. clk_disable_unprepare(pcie->clk);
  771. return err;
  772. }
  773. static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
  774. struct of_pci_range *range,
  775. int *index)
  776. {
  777. u64 restype = range->flags;
  778. u64 cpu_addr = range->cpu_addr;
  779. u64 cpu_end = range->cpu_addr + range->size;
  780. u64 pci_addr = range->pci_addr;
  781. u32 flags = LAM_64BIT | LAR_ENABLE;
  782. u64 mask;
  783. u64 size;
  784. int idx = *index;
  785. if (restype & IORESOURCE_PREFETCH)
  786. flags |= LAM_PREFETCH;
  787. /*
  788. * If the size of the range is larger than the alignment of the start
  789. * address, we have to use multiple entries to perform the mapping.
  790. */
  791. if (cpu_addr > 0) {
  792. unsigned long nr_zeros = __ffs64(cpu_addr);
  793. u64 alignment = 1ULL << nr_zeros;
  794. size = min(range->size, alignment);
  795. } else {
  796. size = range->size;
  797. }
  798. /* Hardware supports max 4GiB inbound region */
  799. size = min(size, 1ULL << 32);
  800. mask = roundup_pow_of_two(size) - 1;
  801. mask &= ~0xf;
  802. while (cpu_addr < cpu_end) {
  803. /*
  804. * Set up 64-bit inbound regions as the range parser doesn't
  805. * distinguish between 32 and 64-bit types.
  806. */
  807. rcar_pci_write_reg(pcie, lower_32_bits(pci_addr),
  808. PCIEPRAR(idx));
  809. rcar_pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
  810. rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags,
  811. PCIELAMR(idx));
  812. rcar_pci_write_reg(pcie, upper_32_bits(pci_addr),
  813. PCIEPRAR(idx + 1));
  814. rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr),
  815. PCIELAR(idx + 1));
  816. rcar_pci_write_reg(pcie, 0, PCIELAMR(idx + 1));
  817. pci_addr += size;
  818. cpu_addr += size;
  819. idx += 2;
  820. if (idx > MAX_NR_INBOUND_MAPS) {
  821. dev_err(pcie->dev, "Failed to map inbound regions!\n");
  822. return -EINVAL;
  823. }
  824. }
  825. *index = idx;
  826. return 0;
  827. }
  828. static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,
  829. struct device_node *node)
  830. {
  831. const int na = 3, ns = 2;
  832. int rlen;
  833. parser->node = node;
  834. parser->pna = of_n_addr_cells(node);
  835. parser->np = parser->pna + na + ns;
  836. parser->range = of_get_property(node, "dma-ranges", &rlen);
  837. if (!parser->range)
  838. return -ENOENT;
  839. parser->end = parser->range + rlen / sizeof(__be32);
  840. return 0;
  841. }
  842. static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie,
  843. struct device_node *np)
  844. {
  845. struct of_pci_range range;
  846. struct of_pci_range_parser parser;
  847. int index = 0;
  848. int err;
  849. if (pci_dma_range_parser_init(&parser, np))
  850. return -EINVAL;
  851. /* Get the dma-ranges from DT */
  852. for_each_of_pci_range(&parser, &range) {
  853. u64 end = range.cpu_addr + range.size - 1;
  854. dev_dbg(pcie->dev, "0x%08x 0x%016llx..0x%016llx -> 0x%016llx\n",
  855. range.flags, range.cpu_addr, end, range.pci_addr);
  856. err = rcar_pcie_inbound_ranges(pcie, &range, &index);
  857. if (err)
  858. return err;
  859. }
  860. return 0;
  861. }
  862. static const struct of_device_id rcar_pcie_of_match[] = {
  863. { .compatible = "renesas,pcie-r8a7779", .data = rcar_pcie_hw_init_h1 },
  864. { .compatible = "renesas,pcie-r8a7790",
  865. .data = rcar_pcie_hw_init_gen2 },
  866. { .compatible = "renesas,pcie-r8a7791",
  867. .data = rcar_pcie_hw_init_gen2 },
  868. { .compatible = "renesas,pcie-rcar-gen2",
  869. .data = rcar_pcie_hw_init_gen2 },
  870. { .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
  871. { .compatible = "renesas,pcie-rcar-gen3", .data = rcar_pcie_hw_init },
  872. {},
  873. };
  874. static int rcar_pcie_parse_request_of_pci_ranges(struct rcar_pcie *pci)
  875. {
  876. int err;
  877. struct device *dev = pci->dev;
  878. struct device_node *np = dev->of_node;
  879. resource_size_t iobase;
  880. struct resource_entry *win, *tmp;
  881. err = of_pci_get_host_bridge_resources(np, 0, 0xff, &pci->resources,
  882. &iobase);
  883. if (err)
  884. return err;
  885. err = devm_request_pci_bus_resources(dev, &pci->resources);
  886. if (err)
  887. goto out_release_res;
  888. resource_list_for_each_entry_safe(win, tmp, &pci->resources) {
  889. struct resource *res = win->res;
  890. if (resource_type(res) == IORESOURCE_IO) {
  891. err = pci_remap_iospace(res, iobase);
  892. if (err) {
  893. dev_warn(dev, "error %d: failed to map resource %pR\n",
  894. err, res);
  895. resource_list_destroy_entry(win);
  896. }
  897. }
  898. }
  899. return 0;
  900. out_release_res:
  901. pci_free_resource_list(&pci->resources);
  902. return err;
  903. }
  904. static int rcar_pcie_probe(struct platform_device *pdev)
  905. {
  906. struct device *dev = &pdev->dev;
  907. struct rcar_pcie *pcie;
  908. unsigned int data;
  909. int err;
  910. int (*hw_init_fn)(struct rcar_pcie *);
  911. struct pci_host_bridge *bridge;
  912. bridge = pci_alloc_host_bridge(sizeof(*pcie));
  913. if (!bridge)
  914. return -ENOMEM;
  915. pcie = pci_host_bridge_priv(bridge);
  916. pcie->dev = dev;
  917. INIT_LIST_HEAD(&pcie->resources);
  918. rcar_pcie_parse_request_of_pci_ranges(pcie);
  919. err = rcar_pcie_get_resources(pcie);
  920. if (err < 0) {
  921. dev_err(dev, "failed to request resources: %d\n", err);
  922. goto err_free_bridge;
  923. }
  924. err = rcar_pcie_parse_map_dma_ranges(pcie, dev->of_node);
  925. if (err)
  926. goto err_free_bridge;
  927. pm_runtime_enable(dev);
  928. err = pm_runtime_get_sync(dev);
  929. if (err < 0) {
  930. dev_err(dev, "pm_runtime_get_sync failed\n");
  931. goto err_pm_disable;
  932. }
  933. /* Failure to get a link might just be that no cards are inserted */
  934. hw_init_fn = of_device_get_match_data(dev);
  935. err = hw_init_fn(pcie);
  936. if (err) {
  937. dev_info(dev, "PCIe link down\n");
  938. err = -ENODEV;
  939. goto err_pm_put;
  940. }
  941. data = rcar_pci_read_reg(pcie, MACSR);
  942. dev_info(dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f);
  943. if (IS_ENABLED(CONFIG_PCI_MSI)) {
  944. err = rcar_pcie_enable_msi(pcie);
  945. if (err < 0) {
  946. dev_err(dev,
  947. "failed to enable MSI support: %d\n",
  948. err);
  949. goto err_pm_put;
  950. }
  951. }
  952. err = rcar_pcie_enable(pcie);
  953. if (err)
  954. goto err_pm_put;
  955. return 0;
  956. err_pm_put:
  957. pm_runtime_put(dev);
  958. err_pm_disable:
  959. pm_runtime_disable(dev);
  960. err_free_bridge:
  961. pci_free_host_bridge(bridge);
  962. pci_free_resource_list(&pcie->resources);
  963. return err;
  964. }
  965. static struct platform_driver rcar_pcie_driver = {
  966. .driver = {
  967. .name = "rcar-pcie",
  968. .of_match_table = rcar_pcie_of_match,
  969. .suppress_bind_attrs = true,
  970. },
  971. .probe = rcar_pcie_probe,
  972. };
  973. builtin_platform_driver(rcar_pcie_driver);