1 // SPDX-License-Identifier: GPL-2.0
3 * Freescale i.MX6 PCI Express Root-Complex driver
5 * Copyright (C) 2013 Marek Vasut <marex@denx.de>
7 * Based on upstream Linux kernel driver:
8 * pci-imx6.c: Sean Cross <xobs@kosagi.com>
9 * pcie-designware.c: Jingoo Han <jg1.han@samsung.com>
14 #include <asm/arch/clock.h>
15 #include <asm/arch/iomux.h>
16 #include <asm/arch/crm_regs.h>
19 #include <linux/sizes.h>
21 #include <asm/arch/sys_proto.h>
23 #define PCI_ACCESS_READ 0
24 #define PCI_ACCESS_WRITE 1
27 #define MX6_DBI_ADDR 0x08ffc000
28 #define MX6_IO_ADDR 0x08000000
29 #define MX6_MEM_ADDR 0x08100000
30 #define MX6_ROOT_ADDR 0x08f00000
32 #define MX6_DBI_ADDR 0x01ffc000
33 #define MX6_IO_ADDR 0x01000000
34 #define MX6_MEM_ADDR 0x01100000
35 #define MX6_ROOT_ADDR 0x01f00000
37 #define MX6_DBI_SIZE 0x4000
38 #define MX6_IO_SIZE 0x100000
39 #define MX6_MEM_SIZE 0xe00000
40 #define MX6_ROOT_SIZE 0xfc000
42 /* PCIe Port Logic registers (memory-mapped) */
43 #define PL_OFFSET 0x700
44 #define PCIE_PL_PFLR (PL_OFFSET + 0x08)
45 #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
46 #define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
47 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
48 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
49 #define PCIE_PHY_DEBUG_R1_LINK_UP (1 << 4)
50 #define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING (1 << 29)
52 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
53 #define PCIE_PHY_CTRL_DATA_LOC 0
54 #define PCIE_PHY_CTRL_CAP_ADR_LOC 16
55 #define PCIE_PHY_CTRL_CAP_DAT_LOC 17
56 #define PCIE_PHY_CTRL_WR_LOC 18
57 #define PCIE_PHY_CTRL_RD_LOC 19
59 #define PCIE_PHY_STAT (PL_OFFSET + 0x110)
60 #define PCIE_PHY_STAT_DATA_LOC 0
61 #define PCIE_PHY_STAT_ACK_LOC 16
63 /* PHY registers (not memory-mapped) */
64 #define PCIE_PHY_RX_ASIC_OUT 0x100D
66 #define PHY_RX_OVRD_IN_LO 0x1005
67 #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
68 #define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3)
70 #define PCIE_PHY_PUP_REQ (1 << 7)
73 #define PCIE_ATU_VIEWPORT 0x900
74 #define PCIE_ATU_REGION_INBOUND (0x1 << 31)
75 #define PCIE_ATU_REGION_OUTBOUND (0x0 << 31)
76 #define PCIE_ATU_REGION_INDEX1 (0x1 << 0)
77 #define PCIE_ATU_REGION_INDEX0 (0x0 << 0)
78 #define PCIE_ATU_CR1 0x904
79 #define PCIE_ATU_TYPE_MEM (0x0 << 0)
80 #define PCIE_ATU_TYPE_IO (0x2 << 0)
81 #define PCIE_ATU_TYPE_CFG0 (0x4 << 0)
82 #define PCIE_ATU_TYPE_CFG1 (0x5 << 0)
83 #define PCIE_ATU_CR2 0x908
84 #define PCIE_ATU_ENABLE (0x1 << 31)
85 #define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30)
86 #define PCIE_ATU_LOWER_BASE 0x90C
87 #define PCIE_ATU_UPPER_BASE 0x910
88 #define PCIE_ATU_LIMIT 0x914
89 #define PCIE_ATU_LOWER_TARGET 0x918
90 #define PCIE_ATU_BUS(x) (((x) & 0xff) << 24)
91 #define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19)
92 #define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16)
93 #define PCIE_ATU_UPPER_TARGET 0x91C
95 struct imx_pcie_priv {
96 void __iomem *dbi_base;
97 void __iomem *cfg_base;
100 static struct imx_pcie_priv imx_pcie_priv = {
101 .dbi_base = (void __iomem *)MX6_DBI_ADDR,
102 .cfg_base = (void __iomem *)MX6_ROOT_ADDR,
105 static struct imx_pcie_priv *priv = &imx_pcie_priv;
108 * PHY access functions
110 static int pcie_phy_poll_ack(void __iomem *dbi_base, int exp_val)
113 u32 max_iterations = 10;
114 u32 wait_counter = 0;
117 val = readl(dbi_base + PCIE_PHY_STAT);
118 val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1;
125 } while (wait_counter < max_iterations);
130 static int pcie_phy_wait_ack(void __iomem *dbi_base, int addr)
135 val = addr << PCIE_PHY_CTRL_DATA_LOC;
136 writel(val, dbi_base + PCIE_PHY_CTRL);
138 val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC);
139 writel(val, dbi_base + PCIE_PHY_CTRL);
141 ret = pcie_phy_poll_ack(dbi_base, 1);
145 val = addr << PCIE_PHY_CTRL_DATA_LOC;
146 writel(val, dbi_base + PCIE_PHY_CTRL);
148 ret = pcie_phy_poll_ack(dbi_base, 0);
155 /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */
156 static int pcie_phy_read(void __iomem *dbi_base, int addr , int *data)
161 ret = pcie_phy_wait_ack(dbi_base, addr);
165 /* assert Read signal */
166 phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC;
167 writel(phy_ctl, dbi_base + PCIE_PHY_CTRL);
169 ret = pcie_phy_poll_ack(dbi_base, 1);
173 val = readl(dbi_base + PCIE_PHY_STAT);
174 *data = val & 0xffff;
176 /* deassert Read signal */
177 writel(0x00, dbi_base + PCIE_PHY_CTRL);
179 ret = pcie_phy_poll_ack(dbi_base, 0);
186 static int pcie_phy_write(void __iomem *dbi_base, int addr, int data)
193 ret = pcie_phy_wait_ack(dbi_base, addr);
197 var = data << PCIE_PHY_CTRL_DATA_LOC;
198 writel(var, dbi_base + PCIE_PHY_CTRL);
201 var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC);
202 writel(var, dbi_base + PCIE_PHY_CTRL);
204 ret = pcie_phy_poll_ack(dbi_base, 1);
208 /* deassert cap data */
209 var = data << PCIE_PHY_CTRL_DATA_LOC;
210 writel(var, dbi_base + PCIE_PHY_CTRL);
212 /* wait for ack de-assertion */
213 ret = pcie_phy_poll_ack(dbi_base, 0);
217 /* assert wr signal */
218 var = 0x1 << PCIE_PHY_CTRL_WR_LOC;
219 writel(var, dbi_base + PCIE_PHY_CTRL);
222 ret = pcie_phy_poll_ack(dbi_base, 1);
226 /* deassert wr signal */
227 var = data << PCIE_PHY_CTRL_DATA_LOC;
228 writel(var, dbi_base + PCIE_PHY_CTRL);
230 /* wait for ack de-assertion */
231 ret = pcie_phy_poll_ack(dbi_base, 0);
235 writel(0x0, dbi_base + PCIE_PHY_CTRL);
240 static int imx6_pcie_link_up(void)
245 /* link is debug bit 36, debug register 1 starts at bit 32 */
246 rc = readl(priv->dbi_base + PCIE_PHY_DEBUG_R1);
247 if ((rc & PCIE_PHY_DEBUG_R1_LINK_UP) &&
248 !(rc & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING))
252 * From L0, initiate MAC entry to gen2 if EP/RC supports gen2.
253 * Wait 2ms (LTSSM timeout is 24ms, PHY lock is ~5us in gen2).
254 * If (MAC/LTSSM.state == Recovery.RcvrLock)
255 * && (PHY/rx_valid==0) then pulse PHY/rx_reset. Transition
258 pcie_phy_read(priv->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
259 ltssm = readl(priv->dbi_base + PCIE_PHY_DEBUG_R0) & 0x3F;
267 printf("transition to gen2 is stuck, reset PHY!\n");
269 pcie_phy_read(priv->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
270 temp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
271 pcie_phy_write(priv->dbi_base, PHY_RX_OVRD_IN_LO, temp);
275 pcie_phy_read(priv->dbi_base, PHY_RX_OVRD_IN_LO, &temp);
276 temp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN);
277 pcie_phy_write(priv->dbi_base, PHY_RX_OVRD_IN_LO, temp);
285 static int imx_pcie_regions_setup(void)
288 * i.MX6 defines 16MB in the AXI address map for PCIe.
290 * That address space excepted the pcie registers is
291 * split and defined into different regions by iATU,
292 * with sizes and offsets as follows:
294 * 0x0100_0000 --- 0x010F_FFFF 1MB IORESOURCE_IO
295 * 0x0110_0000 --- 0x01EF_FFFF 14MB IORESOURCE_MEM
296 * 0x01F0_0000 --- 0x01FF_FFFF 1MB Cfg + Registers
299 /* CMD reg:I/O space, MEM space, and Bus Master Enable */
300 setbits_le32(priv->dbi_base + PCI_COMMAND,
301 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
303 /* Set the CLASS_REV of RC CFG header to PCI_CLASS_BRIDGE_PCI */
304 setbits_le32(priv->dbi_base + PCI_CLASS_REVISION,
305 PCI_CLASS_BRIDGE_PCI << 16);
307 /* Region #0 is used for Outbound CFG space access. */
308 writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
310 writel(lower_32_bits((uintptr_t)priv->cfg_base),
311 priv->dbi_base + PCIE_ATU_LOWER_BASE);
312 writel(upper_32_bits((uintptr_t)priv->cfg_base),
313 priv->dbi_base + PCIE_ATU_UPPER_BASE);
314 writel(lower_32_bits((uintptr_t)priv->cfg_base + MX6_ROOT_SIZE),
315 priv->dbi_base + PCIE_ATU_LIMIT);
317 writel(0, priv->dbi_base + PCIE_ATU_LOWER_TARGET);
318 writel(0, priv->dbi_base + PCIE_ATU_UPPER_TARGET);
319 writel(PCIE_ATU_TYPE_CFG0, priv->dbi_base + PCIE_ATU_CR1);
320 writel(PCIE_ATU_ENABLE, priv->dbi_base + PCIE_ATU_CR2);
326 * PCI Express accessors
328 static void __iomem *get_bus_address(pci_dev_t d, int where)
330 void __iomem *va_address;
332 /* Reconfigure Region #0 */
333 writel(0, priv->dbi_base + PCIE_ATU_VIEWPORT);
336 writel(PCIE_ATU_TYPE_CFG0, priv->dbi_base + PCIE_ATU_CR1);
338 writel(PCIE_ATU_TYPE_CFG1, priv->dbi_base + PCIE_ATU_CR1);
340 if (PCI_BUS(d) == 0) {
341 va_address = priv->dbi_base;
343 writel(d << 8, priv->dbi_base + PCIE_ATU_LOWER_TARGET);
344 va_address = priv->cfg_base;
347 va_address += (where & ~0x3);
352 static int imx_pcie_addr_valid(pci_dev_t d)
354 if ((PCI_BUS(d) == 0) && (PCI_DEV(d) > 1))
356 if ((PCI_BUS(d) == 1) && (PCI_DEV(d) > 0))
362 * Replace the original ARM DABT handler with a simple jump-back one.
364 * The problem here is that if we have a PCIe bridge attached to this PCIe
365 * controller, but no PCIe device is connected to the bridges' downstream
366 * port, the attempt to read/write from/to the config space will produce
367 * a DABT. This is a behavior of the controller and can not be disabled
370 * To work around the problem, we backup the current DABT handler address
371 * and replace it with our own DABT handler, which only bounces right back
374 static void imx_pcie_fix_dabt_handler(bool set)
376 extern uint32_t *_data_abort;
377 uint32_t *data_abort_addr = (uint32_t *)&_data_abort;
379 static const uint32_t data_abort_bounce_handler = 0xe25ef004;
380 uint32_t data_abort_bounce_addr = (uint32_t)&data_abort_bounce_handler;
382 static uint32_t data_abort_backup;
385 data_abort_backup = *data_abort_addr;
386 *data_abort_addr = data_abort_bounce_addr;
388 *data_abort_addr = data_abort_backup;
392 static int imx_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
395 void __iomem *va_address;
398 ret = imx_pcie_addr_valid(d);
404 va_address = get_bus_address(d, where);
407 * Read the PCIe config space. We must replace the DABT handler
408 * here in case we got data abort from the PCIe controller, see
409 * imx_pcie_fix_dabt_handler() description. Note that writing the
410 * "val" with valid value is also imperative here as in case we
411 * did got DABT, the val would contain random value.
413 imx_pcie_fix_dabt_handler(true);
414 writel(0xffffffff, val);
415 *val = readl(va_address);
416 imx_pcie_fix_dabt_handler(false);
421 static int imx_pcie_write_config(struct pci_controller *hose, pci_dev_t d,
424 void __iomem *va_address = NULL;
427 ret = imx_pcie_addr_valid(d);
431 va_address = get_bus_address(d, where);
434 * Write the PCIe config space. We must replace the DABT handler
435 * here in case we got data abort from the PCIe controller, see
436 * imx_pcie_fix_dabt_handler() description.
438 imx_pcie_fix_dabt_handler(true);
439 writel(val, va_address);
440 imx_pcie_fix_dabt_handler(false);
448 static int imx6_pcie_assert_core_reset(bool prepare_for_boot)
450 struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
453 setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
455 #if defined(CONFIG_MX6SX)
456 struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR;
458 /* SSP_EN is not used on MX6SX anymore */
459 setbits_le32(&iomuxc_regs->gpr[12], IOMUXC_GPR12_TEST_POWERDOWN);
460 /* Force PCIe PHY reset */
461 setbits_le32(&iomuxc_regs->gpr[5], IOMUXC_GPR5_PCIE_BTNRST);
462 /* Power up PCIe PHY */
463 setbits_le32(&gpc_regs->cntr, PCIE_PHY_PUP_REQ);
466 * If the bootloader already enabled the link we need some special
467 * handling to get the core back into a state where it is safe to
468 * touch it for configuration. As there is no dedicated reset signal
469 * wired up for MX6QDL, we need to manually force LTSSM into "detect"
470 * state before completely disabling LTSSM, which is a prerequisite
471 * for core configuration.
473 * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
474 * indication that the bootloader activated the link.
476 if (is_mx6dq() && prepare_for_boot) {
477 u32 val, gpr1, gpr12;
479 gpr1 = readl(&iomuxc_regs->gpr[1]);
480 gpr12 = readl(&iomuxc_regs->gpr[12]);
481 if ((gpr1 & IOMUXC_GPR1_PCIE_REF_CLK_EN) &&
482 (gpr12 & IOMUXC_GPR12_PCIE_CTL_2)) {
483 val = readl(priv->dbi_base + PCIE_PL_PFLR);
484 val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
485 val |= PCIE_PL_PFLR_FORCE_LINK;
487 imx_pcie_fix_dabt_handler(true);
488 writel(val, priv->dbi_base + PCIE_PL_PFLR);
489 imx_pcie_fix_dabt_handler(false);
491 gpr12 &= ~IOMUXC_GPR12_PCIE_CTL_2;
492 writel(val, &iomuxc_regs->gpr[12]);
495 setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_TEST_POWERDOWN);
496 clrbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_REF_SSP_EN);
502 static int imx6_pcie_init_phy(void)
504 struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
506 clrbits_le32(&iomuxc_regs->gpr[12], IOMUXC_GPR12_APPS_LTSSM_ENABLE);
508 clrsetbits_le32(&iomuxc_regs->gpr[12],
509 IOMUXC_GPR12_DEVICE_TYPE_MASK,
510 IOMUXC_GPR12_DEVICE_TYPE_RC);
511 clrsetbits_le32(&iomuxc_regs->gpr[12],
512 IOMUXC_GPR12_LOS_LEVEL_MASK,
513 IOMUXC_GPR12_LOS_LEVEL_9);
516 clrsetbits_le32(&iomuxc_regs->gpr[12],
517 IOMUXC_GPR12_RX_EQ_MASK,
518 IOMUXC_GPR12_RX_EQ_2);
521 writel((0x0 << IOMUXC_GPR8_PCS_TX_DEEMPH_GEN1_OFFSET) |
522 (0x0 << IOMUXC_GPR8_PCS_TX_DEEMPH_GEN2_3P5DB_OFFSET) |
523 (20 << IOMUXC_GPR8_PCS_TX_DEEMPH_GEN2_6DB_OFFSET) |
524 (127 << IOMUXC_GPR8_PCS_TX_SWING_FULL_OFFSET) |
525 (127 << IOMUXC_GPR8_PCS_TX_SWING_LOW_OFFSET),
526 &iomuxc_regs->gpr[8]);
531 __weak int imx6_pcie_toggle_power(void)
533 #ifdef CONFIG_PCIE_IMX_POWER_GPIO
534 gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
535 gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);
537 gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1);
539 gpio_free(CONFIG_PCIE_IMX_POWER_GPIO);
544 __weak int imx6_pcie_toggle_reset(void)
547 * See 'PCI EXPRESS BASE SPECIFICATION, REV 3.0, SECTION 6.6.1'
548 * for detailed understanding of the PCIe CR reset logic.
550 * The PCIe #PERST reset line _MUST_ be connected, otherwise your
551 * design does not conform to the specification. You must wait at
552 * least 20 ms after de-asserting the #PERST so the EP device can
553 * do self-initialisation.
555 * In case your #PERST pin is connected to a plain GPIO pin of the
556 * CPU, you can define CONFIG_PCIE_IMX_PERST_GPIO in your board's
557 * configuration file and the condition below will handle the rest
558 * of the reset toggling.
560 * In case your #PERST toggling logic is more complex, for example
561 * connected via CPLD or somesuch, you can override this function
562 * in your board file and implement reset logic as needed. You must
563 * not forget to wait at least 20 ms after de-asserting #PERST in
564 * this case either though.
566 * In case your #PERST line of the PCIe EP device is not connected
567 * at all, your design is broken and you should fix your design,
568 * otherwise you will observe problems like for example the link
569 * not coming up after rebooting the system back from running Linux
570 * that uses the PCIe as well OR the PCIe link might not come up in
571 * Linux at all in the first place since it's in some non-reset
572 * state due to being previously used in U-Boot.
574 #ifdef CONFIG_PCIE_IMX_PERST_GPIO
575 gpio_request(CONFIG_PCIE_IMX_PERST_GPIO, "pcie_reset");
576 gpio_direction_output(CONFIG_PCIE_IMX_PERST_GPIO, 0);
578 gpio_set_value(CONFIG_PCIE_IMX_PERST_GPIO, 1);
580 gpio_free(CONFIG_PCIE_IMX_PERST_GPIO);
582 puts("WARNING: Make sure the PCIe #PERST line is connected!\n");
587 static int imx6_pcie_deassert_core_reset(void)
589 struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
591 imx6_pcie_toggle_power();
596 clrbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_PCIE_SW_RST);
599 * Wait for the clock to settle a bit, when the clock are sourced
600 * from the CPU, we need about 30 ms to settle.
604 #if defined(CONFIG_MX6SX)
605 /* SSP_EN is not used on MX6SX anymore */
606 clrbits_le32(&iomuxc_regs->gpr[12], IOMUXC_GPR12_TEST_POWERDOWN);
607 /* Clear PCIe PHY reset bit */
608 clrbits_le32(&iomuxc_regs->gpr[5], IOMUXC_GPR5_PCIE_BTNRST);
611 clrbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_TEST_POWERDOWN);
612 setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_REF_SSP_EN);
615 imx6_pcie_toggle_reset();
620 static int imx_pcie_link_up(void)
622 struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
626 imx6_pcie_assert_core_reset(false);
627 imx6_pcie_init_phy();
628 imx6_pcie_deassert_core_reset();
630 imx_pcie_regions_setup();
633 * By default, the subordinate is set equally to the secondary
634 * bus (0x01) when the RC boots.
635 * This means that theoretically, only bus 1 is reachable from the RC.
636 * Force the PCIe RC subordinate to 0xff, otherwise no downstream
637 * devices will be detected if the enumeration is applied strictly.
639 tmp = readl(priv->dbi_base + 0x18);
641 writel(tmp, priv->dbi_base + 0x18);
644 * FIXME: Force the PCIe RC to Gen1 operation
645 * The RC must be forced into Gen1 mode before bringing the link
646 * up, otherwise no downstream devices are detected. After the
647 * link is up, a managed Gen1->Gen2 transition can be initiated.
649 tmp = readl(priv->dbi_base + 0x7c);
652 writel(tmp, priv->dbi_base + 0x7c);
654 /* LTSSM enable, starting link. */
655 setbits_le32(&iomuxc_regs->gpr[12], IOMUXC_GPR12_APPS_LTSSM_ENABLE);
657 while (!imx6_pcie_link_up()) {
661 #ifdef CONFIG_PCI_SCAN_SHOW
662 puts("PCI: pcie phy link never came up\n");
664 debug("DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n",
665 readl(priv->dbi_base + PCIE_PHY_DEBUG_R0),
666 readl(priv->dbi_base + PCIE_PHY_DEBUG_R1));
674 void imx_pcie_init(void)
676 /* Static instance of the controller. */
677 static struct pci_controller pcc;
678 struct pci_controller *hose = &pcc;
681 memset(&pcc, 0, sizeof(pcc));
684 pci_set_region(&hose->regions[0],
685 MX6_IO_ADDR, MX6_IO_ADDR,
686 MX6_IO_SIZE, PCI_REGION_IO);
688 /* PCI memory space */
689 pci_set_region(&hose->regions[1],
690 MX6_MEM_ADDR, MX6_MEM_ADDR,
691 MX6_MEM_SIZE, PCI_REGION_MEM);
693 /* System memory space */
694 pci_set_region(&hose->regions[2],
695 MMDC0_ARB_BASE_ADDR, MMDC0_ARB_BASE_ADDR,
696 0xefffffff, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
698 hose->region_count = 3;
701 pci_hose_read_config_byte_via_dword,
702 pci_hose_read_config_word_via_dword,
703 imx_pcie_read_config,
704 pci_hose_write_config_byte_via_dword,
705 pci_hose_write_config_word_via_dword,
706 imx_pcie_write_config);
708 /* Start the controller. */
709 ret = imx_pcie_link_up();
712 pci_register_hose(hose);
713 hose->last_busno = pci_hose_scan(hose);
717 void imx_pcie_remove(void)
719 imx6_pcie_assert_core_reset(true);
722 /* Probe function. */
723 void pci_init_board(void)