1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * pci.c -- WindRiver SBC8349 PCI board support.
4 * Copyright (c) 2006 Wind River Systems, Inc.
5 * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
6 *
7 * Based on MPC8349 PCI support but w/o PIB related code.
8 */
9
10 #include <init.h>
11 #include <asm/mmu.h>
12 #include <asm/io.h>
13 #include <common.h>
14 #include <mpc83xx.h>
15 #include <pci.h>
16 #include <i2c.h>
17 #include <asm/fsl_i2c.h>
18 #include <linux/delay.h>
19
20 static struct pci_region pci1_regions[] = {
21 {
22 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
23 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
24 size: CONFIG_SYS_PCI1_MEM_SIZE,
25 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
26 },
27 {
28 bus_start: CONFIG_SYS_PCI1_IO_BASE,
29 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
30 size: CONFIG_SYS_PCI1_IO_SIZE,
31 flags: PCI_REGION_IO
32 },
33 {
34 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
35 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
36 size: CONFIG_SYS_PCI1_MMIO_SIZE,
37 flags: PCI_REGION_MEM
38 },
39 };
40
41 /*
42 * pci_init_board()
43 *
44 * NOTICE: PCI2 is not supported. There is only one
45 * physical PCI slot on the board.
46 *
47 */
48 void
pci_init_board(void)49 pci_init_board(void)
50 {
51 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
52 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
53 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
54 struct pci_region *reg[] = { pci1_regions };
55
56 /* Enable all 8 PCI_CLK_OUTPUTS */
57 clk->occr = 0xff000000;
58 udelay(2000);
59
60 /* Configure PCI Local Access Windows */
61 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
62 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
63
64 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
65 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
66
67 udelay(2000);
68
69 mpc83xx_pci_init(1, reg);
70 }
71