Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Freescale Semiconductor, Inc. |
| 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #include <asm/mmu.h> |
| 14 | #include <asm/io.h> |
| 15 | #include <common.h> |
| 16 | #include <mpc83xx.h> |
| 17 | #include <pci.h> |
| 18 | #include <i2c.h> |
| 19 | #include <asm/fsl_i2c.h> |
| 20 | |
| 21 | #if defined(CONFIG_PCI) |
| 22 | static struct pci_region pci_regions[] = { |
| 23 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 24 | bus_start: CONFIG_SYS_PCI_MEM_BASE, |
| 25 | phys_start: CONFIG_SYS_PCI_MEM_PHYS, |
| 26 | size: CONFIG_SYS_PCI_MEM_SIZE, |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 27 | flags: PCI_REGION_MEM | PCI_REGION_PREFETCH |
| 28 | }, |
| 29 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 30 | bus_start: CONFIG_SYS_PCI_MMIO_BASE, |
| 31 | phys_start: CONFIG_SYS_PCI_MMIO_PHYS, |
| 32 | size: CONFIG_SYS_PCI_MMIO_SIZE, |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 33 | flags: PCI_REGION_MEM |
| 34 | }, |
| 35 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 36 | bus_start: CONFIG_SYS_PCI_IO_BASE, |
| 37 | phys_start: CONFIG_SYS_PCI_IO_PHYS, |
| 38 | size: CONFIG_SYS_PCI_IO_SIZE, |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 39 | flags: PCI_REGION_IO |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | void pci_init_board(void) |
| 44 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 45 | volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR; |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 46 | volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk; |
| 47 | volatile law83xx_t *pci_law = immr->sysconf.pcilaw; |
| 48 | struct pci_region *reg[] = { pci_regions }; |
| 49 | |
Anton Vorontsov | 00f7bba | 2008-10-02 19:17:33 +0400 | [diff] [blame^] | 50 | if (board_pci_host_broken()) |
| 51 | return; |
| 52 | |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 53 | /* Enable all 5 PCI_CLK_OUTPUTS */ |
| 54 | clk->occr |= 0xf8000000; |
| 55 | udelay(2000); |
| 56 | |
| 57 | /* Configure PCI Local Access Windows */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 58 | pci_law[0].bar = CONFIG_SYS_PCI_MEM_PHYS & LAWBAR_BAR; |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 59 | pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB; |
| 60 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 61 | pci_law[1].bar = CONFIG_SYS_PCI_IO_PHYS & LAWBAR_BAR; |
Dave Liu | 19580e6 | 2007-09-18 12:37:57 +0800 | [diff] [blame] | 62 | pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB; |
| 63 | |
| 64 | udelay(2000); |
| 65 | |
| 66 | mpc83xx_pci_init(1, reg, 0); |
| 67 | } |
| 68 | #endif /* CONFIG_PCI */ |