Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [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 <common.h> |
| 14 | #include <mpc83xx.h> |
| 15 | #include <pci.h> |
| 16 | |
| 17 | #if defined(CONFIG_PCI) |
| 18 | static struct pci_region pci_regions[] = { |
| 19 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 20 | bus_start: CONFIG_SYS_PCI_MEM_BASE, |
| 21 | phys_start: CONFIG_SYS_PCI_MEM_PHYS, |
| 22 | size: CONFIG_SYS_PCI_MEM_SIZE, |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 23 | flags: PCI_REGION_MEM | PCI_REGION_PREFETCH |
| 24 | }, |
| 25 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 26 | bus_start: CONFIG_SYS_PCI_MMIO_BASE, |
| 27 | phys_start: CONFIG_SYS_PCI_MMIO_PHYS, |
| 28 | size: CONFIG_SYS_PCI_MMIO_SIZE, |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 29 | flags: PCI_REGION_MEM |
| 30 | }, |
| 31 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 32 | bus_start: CONFIG_SYS_PCI_IO_BASE, |
| 33 | phys_start: CONFIG_SYS_PCI_IO_PHYS, |
| 34 | size: CONFIG_SYS_PCI_IO_SIZE, |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 35 | flags: PCI_REGION_IO |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | void pci_init_board(void) |
| 40 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 41 | volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR; |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 42 | volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk; |
| 43 | volatile law83xx_t *pci_law = immr->sysconf.pcilaw; |
| 44 | struct pci_region *reg[] = { pci_regions }; |
| 45 | |
| 46 | /* Enable all 5 PCI_CLK_OUTPUTS */ |
| 47 | clk->occr |= 0xf8000000; |
| 48 | udelay(2000); |
| 49 | |
| 50 | /* Configure PCI Local Access Windows */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 51 | pci_law[0].bar = CONFIG_SYS_PCI_MEM_PHYS & LAWBAR_BAR; |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 52 | pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB; |
| 53 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 54 | pci_law[1].bar = CONFIG_SYS_PCI_IO_PHYS & LAWBAR_BAR; |
Kim Phillips | 5e918a9 | 2008-01-16 00:38:05 -0600 | [diff] [blame] | 55 | pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB; |
| 56 | |
| 57 | mpc83xx_pci_init(1, reg, 0); |
| 58 | } |
| 59 | #endif /* CONFIG_PCI */ |