aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/host/pcie-rcar.c124
1 files changed, 63 insertions, 61 deletions
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index ab0ab0d8253c..ee20676de2c7 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -105,7 +105,7 @@
105#define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19) 105#define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19)
106#define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16) 106#define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16)
107 107
108#define PCI_MAX_RESOURCES 4 108#define RCAR_PCI_MAX_RESOURCES 4
109#define MAX_NR_INBOUND_MAPS 6 109#define MAX_NR_INBOUND_MAPS 6
110 110
111struct rcar_msi { 111struct rcar_msi {
@@ -127,7 +127,7 @@ static inline struct rcar_msi *to_rcar_msi(struct msi_chip *chip)
127struct rcar_pcie { 127struct rcar_pcie {
128 struct device *dev; 128 struct device *dev;
129 void __iomem *base; 129 void __iomem *base;
130 struct resource res[PCI_MAX_RESOURCES]; 130 struct resource res[RCAR_PCI_MAX_RESOURCES];
131 struct resource busn; 131 struct resource busn;
132 int root_bus_nr; 132 int root_bus_nr;
133 struct clk *clk; 133 struct clk *clk;
@@ -140,36 +140,37 @@ static inline struct rcar_pcie *sys_to_pcie(struct pci_sys_data *sys)
140 return sys->private_data; 140 return sys->private_data;
141} 141}
142 142
143static void pci_write_reg(struct rcar_pcie *pcie, unsigned long val, 143static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
144 unsigned long reg) 144 unsigned long reg)
145{ 145{
146 writel(val, pcie->base + reg); 146 writel(val, pcie->base + reg);
147} 147}
148 148
149static unsigned long pci_read_reg(struct rcar_pcie *pcie, unsigned long reg) 149static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
150 unsigned long reg)
150{ 151{
151 return readl(pcie->base + reg); 152 return readl(pcie->base + reg);
152} 153}
153 154
154enum { 155enum {
155 PCI_ACCESS_READ, 156 RCAR_PCI_ACCESS_READ,
156 PCI_ACCESS_WRITE, 157 RCAR_PCI_ACCESS_WRITE,
157}; 158};
158 159
159static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) 160static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
160{ 161{
161 int shift = 8 * (where & 3); 162 int shift = 8 * (where & 3);
162 u32 val = pci_read_reg(pcie, where & ~3); 163 u32 val = rcar_pci_read_reg(pcie, where & ~3);
163 164
164 val &= ~(mask << shift); 165 val &= ~(mask << shift);
165 val |= data << shift; 166 val |= data << shift;
166 pci_write_reg(pcie, val, where & ~3); 167 rcar_pci_write_reg(pcie, val, where & ~3);
167} 168}
168 169
169static u32 rcar_read_conf(struct rcar_pcie *pcie, int where) 170static u32 rcar_read_conf(struct rcar_pcie *pcie, int where)
170{ 171{
171 int shift = 8 * (where & 3); 172 int shift = 8 * (where & 3);
172 u32 val = pci_read_reg(pcie, where & ~3); 173 u32 val = rcar_pci_read_reg(pcie, where & ~3);
173 174
174 return val >> shift; 175 return val >> shift;
175} 176}
@@ -205,14 +206,14 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
205 if (dev != 0) 206 if (dev != 0)
206 return PCIBIOS_DEVICE_NOT_FOUND; 207 return PCIBIOS_DEVICE_NOT_FOUND;
207 208
208 if (access_type == PCI_ACCESS_READ) { 209 if (access_type == RCAR_PCI_ACCESS_READ) {
209 *data = pci_read_reg(pcie, PCICONF(index)); 210 *data = rcar_pci_read_reg(pcie, PCICONF(index));
210 } else { 211 } else {
211 /* Keep an eye out for changes to the root bus number */ 212 /* Keep an eye out for changes to the root bus number */
212 if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS)) 213 if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS))
213 pcie->root_bus_nr = *data & 0xff; 214 pcie->root_bus_nr = *data & 0xff;
214 215
215 pci_write_reg(pcie, *data, PCICONF(index)); 216 rcar_pci_write_reg(pcie, *data, PCICONF(index));
216 } 217 }
217 218
218 return PCIBIOS_SUCCESSFUL; 219 return PCIBIOS_SUCCESSFUL;
@@ -222,20 +223,20 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
222 return PCIBIOS_DEVICE_NOT_FOUND; 223 return PCIBIOS_DEVICE_NOT_FOUND;
223 224
224 /* Clear errors */ 225 /* Clear errors */
225 pci_write_reg(pcie, pci_read_reg(pcie, PCIEERRFR), PCIEERRFR); 226 rcar_pci_write_reg(pcie, rcar_pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
226 227
227 /* Set the PIO address */ 228 /* Set the PIO address */
228 pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) | PCIE_CONF_DEV(dev) | 229 rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
229 PCIE_CONF_FUNC(func) | reg, PCIECAR); 230 PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
230 231
231 /* Enable the configuration access */ 232 /* Enable the configuration access */
232 if (bus->parent->number == pcie->root_bus_nr) 233 if (bus->parent->number == pcie->root_bus_nr)
233 pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR); 234 rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR);
234 else 235 else
235 pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR); 236 rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR);
236 237
237 /* Check for errors */ 238 /* Check for errors */
238 if (pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST) 239 if (rcar_pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST)
239 return PCIBIOS_DEVICE_NOT_FOUND; 240 return PCIBIOS_DEVICE_NOT_FOUND;
240 241
241 /* Check for master and target aborts */ 242 /* Check for master and target aborts */
@@ -243,13 +244,13 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
243 (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT)) 244 (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT))
244 return PCIBIOS_DEVICE_NOT_FOUND; 245 return PCIBIOS_DEVICE_NOT_FOUND;
245 246
246 if (access_type == PCI_ACCESS_READ) 247 if (access_type == RCAR_PCI_ACCESS_READ)
247 *data = pci_read_reg(pcie, PCIECDR); 248 *data = rcar_pci_read_reg(pcie, PCIECDR);
248 else 249 else
249 pci_write_reg(pcie, *data, PCIECDR); 250 rcar_pci_write_reg(pcie, *data, PCIECDR);
250 251
251 /* Disable the configuration access */ 252 /* Disable the configuration access */
252 pci_write_reg(pcie, 0, PCIECCTLR); 253 rcar_pci_write_reg(pcie, 0, PCIECCTLR);
253 254
254 return PCIBIOS_SUCCESSFUL; 255 return PCIBIOS_SUCCESSFUL;
255} 256}
@@ -260,7 +261,7 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
260 struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata); 261 struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata);
261 int ret; 262 int ret;
262 263
263 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ, 264 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
264 bus, devfn, where, val); 265 bus, devfn, where, val);
265 if (ret != PCIBIOS_SUCCESSFUL) { 266 if (ret != PCIBIOS_SUCCESSFUL) {
266 *val = 0xffffffff; 267 *val = 0xffffffff;
@@ -286,7 +287,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
286 int shift, ret; 287 int shift, ret;
287 u32 data; 288 u32 data;
288 289
289 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ, 290 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
290 bus, devfn, where, &data); 291 bus, devfn, where, &data);
291 if (ret != PCIBIOS_SUCCESSFUL) 292 if (ret != PCIBIOS_SUCCESSFUL)
292 return ret; 293 return ret;
@@ -305,7 +306,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
305 } else 306 } else
306 data = val; 307 data = val;
307 308
308 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_WRITE, 309 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_WRITE,
309 bus, devfn, where, &data); 310 bus, devfn, where, &data);
310 311
311 return ret; 312 return ret;
@@ -323,7 +324,7 @@ static void rcar_pcie_setup_window(int win, struct resource *res,
323 resource_size_t size; 324 resource_size_t size;
324 u32 mask; 325 u32 mask;
325 326
326 pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); 327 rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win));
327 328
328 /* 329 /*
329 * The PAMR mask is calculated in units of 128Bytes, which 330 * The PAMR mask is calculated in units of 128Bytes, which
@@ -331,17 +332,17 @@ static void rcar_pcie_setup_window(int win, struct resource *res,
331 */ 332 */
332 size = resource_size(res); 333 size = resource_size(res);
333 mask = (roundup_pow_of_two(size) / SZ_128) - 1; 334 mask = (roundup_pow_of_two(size) / SZ_128) - 1;
334 pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); 335 rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
335 336
336 pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win)); 337 rcar_pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win));
337 pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win)); 338 rcar_pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win));
338 339
339 /* First resource is for IO */ 340 /* First resource is for IO */
340 mask = PAR_ENABLE; 341 mask = PAR_ENABLE;
341 if (res->flags & IORESOURCE_IO) 342 if (res->flags & IORESOURCE_IO)
342 mask |= IO_SPACE; 343 mask |= IO_SPACE;
343 344
344 pci_write_reg(pcie, mask, PCIEPTCTLR(win)); 345 rcar_pci_write_reg(pcie, mask, PCIEPTCTLR(win));
345} 346}
346 347
347static int rcar_pcie_setup(int nr, struct pci_sys_data *sys) 348static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
@@ -353,7 +354,7 @@ static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
353 pcie->root_bus_nr = -1; 354 pcie->root_bus_nr = -1;
354 355
355 /* Setup PCI resources */ 356 /* Setup PCI resources */
356 for (i = 0; i < PCI_MAX_RESOURCES; i++) { 357 for (i = 0; i < RCAR_PCI_MAX_RESOURCES; i++) {
357 358
358 res = &pcie->res[i]; 359 res = &pcie->res[i];
359 if (!res->flags) 360 if (!res->flags)
@@ -405,7 +406,7 @@ static int phy_wait_for_ack(struct rcar_pcie *pcie)
405 unsigned int timeout = 100; 406 unsigned int timeout = 100;
406 407
407 while (timeout--) { 408 while (timeout--) {
408 if (pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK) 409 if (rcar_pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK)
409 return 0; 410 return 0;
410 411
411 udelay(100); 412 udelay(100);
@@ -428,15 +429,15 @@ static void phy_write_reg(struct rcar_pcie *pcie,
428 ((addr & 0xff) << ADR_POS); 429 ((addr & 0xff) << ADR_POS);
429 430
430 /* Set write data */ 431 /* Set write data */
431 pci_write_reg(pcie, data, H1_PCIEPHYDOUTR); 432 rcar_pci_write_reg(pcie, data, H1_PCIEPHYDOUTR);
432 pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR); 433 rcar_pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR);
433 434
434 /* Ignore errors as they will be dealt with if the data link is down */ 435 /* Ignore errors as they will be dealt with if the data link is down */
435 phy_wait_for_ack(pcie); 436 phy_wait_for_ack(pcie);
436 437
437 /* Clear command */ 438 /* Clear command */
438 pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR); 439 rcar_pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR);
439 pci_write_reg(pcie, 0, H1_PCIEPHYADRR); 440 rcar_pci_write_reg(pcie, 0, H1_PCIEPHYADRR);
440 441
441 /* Ignore errors as they will be dealt with if the data link is down */ 442 /* Ignore errors as they will be dealt with if the data link is down */
442 phy_wait_for_ack(pcie); 443 phy_wait_for_ack(pcie);
@@ -447,7 +448,7 @@ static int rcar_pcie_wait_for_dl(struct rcar_pcie *pcie)
447 unsigned int timeout = 10; 448 unsigned int timeout = 10;
448 449
449 while (timeout--) { 450 while (timeout--) {
450 if ((pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE)) 451 if ((rcar_pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE))
451 return 0; 452 return 0;
452 453
453 msleep(5); 454 msleep(5);
@@ -461,17 +462,17 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
461 int err; 462 int err;
462 463
463 /* Begin initialization */ 464 /* Begin initialization */
464 pci_write_reg(pcie, 0, PCIETCTLR); 465 rcar_pci_write_reg(pcie, 0, PCIETCTLR);
465 466
466 /* Set mode */ 467 /* Set mode */
467 pci_write_reg(pcie, 1, PCIEMSR); 468 rcar_pci_write_reg(pcie, 1, PCIEMSR);
468 469
469 /* 470 /*
470 * Initial header for port config space is type 1, set the device 471 * Initial header for port config space is type 1, set the device
471 * class to match. Hardware takes care of propagating the IDSETR 472 * class to match. Hardware takes care of propagating the IDSETR
472 * settings, so there is no need to bother with a quirk. 473 * settings, so there is no need to bother with a quirk.
473 */ 474 */
474 pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1); 475 rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1);
475 476
476 /* 477 /*
477 * Setup Secondary Bus Number & Subordinate Bus Number, even though 478 * Setup Secondary Bus Number & Subordinate Bus Number, even though
@@ -495,17 +496,17 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
495 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0); 496 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
496 497
497 /* Set the completion timer timeout to the maximum 50ms. */ 498 /* Set the completion timer timeout to the maximum 50ms. */
498 rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50); 499 rcar_rmw32(pcie, TLCTLR + 1, 0x3f, 50);
499 500
500 /* Terminate list of capabilities (Next Capability Offset=0) */ 501 /* Terminate list of capabilities (Next Capability Offset=0) */
501 rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0); 502 rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
502 503
503 /* Enable MSI */ 504 /* Enable MSI */
504 if (IS_ENABLED(CONFIG_PCI_MSI)) 505 if (IS_ENABLED(CONFIG_PCI_MSI))
505 pci_write_reg(pcie, 0x101f0000, PCIEMSITXR); 506 rcar_pci_write_reg(pcie, 0x101f0000, PCIEMSITXR);
506 507
507 /* Finish initialization - establish a PCI Express link */ 508 /* Finish initialization - establish a PCI Express link */
508 pci_write_reg(pcie, CFINIT, PCIETCTLR); 509 rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
509 510
510 /* This will timeout if we don't have a link. */ 511 /* This will timeout if we don't have a link. */
511 err = rcar_pcie_wait_for_dl(pcie); 512 err = rcar_pcie_wait_for_dl(pcie);
@@ -543,7 +544,7 @@ static int rcar_pcie_hw_init_h1(struct rcar_pcie *pcie)
543 phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000); 544 phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000);
544 545
545 while (timeout--) { 546 while (timeout--) {
546 if (pci_read_reg(pcie, H1_PCIEPHYSR)) 547 if (rcar_pci_read_reg(pcie, H1_PCIEPHYSR))
547 return rcar_pcie_hw_init(pcie); 548 return rcar_pcie_hw_init(pcie);
548 549
549 msleep(5); 550 msleep(5);
@@ -582,7 +583,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
582 struct rcar_msi *msi = &pcie->msi; 583 struct rcar_msi *msi = &pcie->msi;
583 unsigned long reg; 584 unsigned long reg;
584 585
585 reg = pci_read_reg(pcie, PCIEMSIFR); 586 reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
586 587
587 /* MSI & INTx share an interrupt - we only handle MSI here */ 588 /* MSI & INTx share an interrupt - we only handle MSI here */
588 if (!reg) 589 if (!reg)
@@ -593,7 +594,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
593 unsigned int irq; 594 unsigned int irq;
594 595
595 /* clear the interrupt */ 596 /* clear the interrupt */
596 pci_write_reg(pcie, 1 << index, PCIEMSIFR); 597 rcar_pci_write_reg(pcie, 1 << index, PCIEMSIFR);
597 598
598 irq = irq_find_mapping(msi->domain, index); 599 irq = irq_find_mapping(msi->domain, index);
599 if (irq) { 600 if (irq) {
@@ -607,7 +608,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
607 } 608 }
608 609
609 /* see if there's any more pending in this vector */ 610 /* see if there's any more pending in this vector */
610 reg = pci_read_reg(pcie, PCIEMSIFR); 611 reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
611 } 612 }
612 613
613 return IRQ_HANDLED; 614 return IRQ_HANDLED;
@@ -634,8 +635,8 @@ static int rcar_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
634 635
635 irq_set_msi_desc(irq, desc); 636 irq_set_msi_desc(irq, desc);
636 637
637 msg.address_lo = pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE; 638 msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
638 msg.address_hi = pci_read_reg(pcie, PCIEMSIAUR); 639 msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
639 msg.data = hwirq; 640 msg.data = hwirq;
640 641
641 write_msi_msg(irq, &msg); 642 write_msi_msg(irq, &msg);
@@ -712,11 +713,11 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
712 msi->pages = __get_free_pages(GFP_KERNEL, 0); 713 msi->pages = __get_free_pages(GFP_KERNEL, 0);
713 base = virt_to_phys((void *)msi->pages); 714 base = virt_to_phys((void *)msi->pages);
714 715
715 pci_write_reg(pcie, base | MSIFE, PCIEMSIALR); 716 rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
716 pci_write_reg(pcie, 0, PCIEMSIAUR); 717 rcar_pci_write_reg(pcie, 0, PCIEMSIAUR);
717 718
718 /* enable all MSI interrupts */ 719 /* enable all MSI interrupts */
719 pci_write_reg(pcie, 0xffffffff, PCIEMSIIER); 720 rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);
720 721
721 return 0; 722 return 0;
722 723
@@ -809,6 +810,7 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
809 if (cpu_addr > 0) { 810 if (cpu_addr > 0) {
810 unsigned long nr_zeros = __ffs64(cpu_addr); 811 unsigned long nr_zeros = __ffs64(cpu_addr);
811 u64 alignment = 1ULL << nr_zeros; 812 u64 alignment = 1ULL << nr_zeros;
813
812 size = min(range->size, alignment); 814 size = min(range->size, alignment);
813 } else { 815 } else {
814 size = range->size; 816 size = range->size;
@@ -824,13 +826,13 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
824 * Set up 64-bit inbound regions as the range parser doesn't 826 * Set up 64-bit inbound regions as the range parser doesn't
825 * distinguish between 32 and 64-bit types. 827 * distinguish between 32 and 64-bit types.
826 */ 828 */
827 pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx)); 829 rcar_pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx));
828 pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx)); 830 rcar_pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
829 pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx)); 831 rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx));
830 832
831 pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1)); 833 rcar_pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1));
832 pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1)); 834 rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1));
833 pci_write_reg(pcie, 0, PCIELAMR(idx+1)); 835 rcar_pci_write_reg(pcie, 0, PCIELAMR(idx + 1));
834 836
835 pci_addr += size; 837 pci_addr += size;
836 cpu_addr += size; 838 cpu_addr += size;
@@ -935,7 +937,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
935 of_pci_range_to_resource(&range, pdev->dev.of_node, 937 of_pci_range_to_resource(&range, pdev->dev.of_node,
936 &pcie->res[win++]); 938 &pcie->res[win++]);
937 939
938 if (win > PCI_MAX_RESOURCES) 940 if (win > RCAR_PCI_MAX_RESOURCES)
939 break; 941 break;
940 } 942 }
941 943
@@ -965,7 +967,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
965 return 0; 967 return 0;
966 } 968 }
967 969
968 data = pci_read_reg(pcie, MACSR); 970 data = rcar_pci_read_reg(pcie, MACSR);
969 dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f); 971 dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f);
970 972
971 rcar_pcie_enable(pcie); 973 rcar_pcie_enable(pcie);