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