Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 1 | /* |
| 2 | * pci.c -- WindRiver SBC8349 PCI board support. |
| 3 | * Copyright (c) 2006 Wind River Systems, Inc. |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 4 | * Copyright (C) 2006-2009 Freescale Semiconductor, Inc. |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 5 | * |
| 6 | * Based on MPC8349 PCI support but w/o PIB related code. |
| 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #include <asm/mmu.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 29 | #include <asm/io.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 30 | #include <common.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 31 | #include <mpc83xx.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 32 | #include <pci.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 33 | #include <i2c.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 34 | #include <asm/fsl_i2c.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 35 | |
| 36 | DECLARE_GLOBAL_DATA_PTR; |
| 37 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 38 | static struct pci_region pci1_regions[] = { |
| 39 | { |
| 40 | bus_start: CONFIG_SYS_PCI1_MEM_BASE, |
| 41 | phys_start: CONFIG_SYS_PCI1_MEM_PHYS, |
| 42 | size: CONFIG_SYS_PCI1_MEM_SIZE, |
| 43 | flags: PCI_REGION_MEM | PCI_REGION_PREFETCH |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 44 | }, |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 45 | { |
| 46 | bus_start: CONFIG_SYS_PCI1_IO_BASE, |
| 47 | phys_start: CONFIG_SYS_PCI1_IO_PHYS, |
| 48 | size: CONFIG_SYS_PCI1_IO_SIZE, |
| 49 | flags: PCI_REGION_IO |
| 50 | }, |
| 51 | { |
| 52 | bus_start: CONFIG_SYS_PCI1_MMIO_BASE, |
| 53 | phys_start: CONFIG_SYS_PCI1_MMIO_PHYS, |
| 54 | size: CONFIG_SYS_PCI1_MMIO_SIZE, |
| 55 | flags: PCI_REGION_MEM |
| 56 | }, |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 57 | }; |
| 58 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 59 | /* |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 60 | * pci_init_board() |
| 61 | * |
| 62 | * NOTICE: PCI2 is not supported. There is only one |
| 63 | * physical PCI slot on the board. |
| 64 | * |
| 65 | */ |
| 66 | void |
| 67 | pci_init_board(void) |
| 68 | { |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 69 | volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR; |
| 70 | volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk; |
| 71 | volatile law83xx_t *pci_law = immr->sysconf.pcilaw; |
| 72 | struct pci_region *reg[] = { pci1_regions }; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 73 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 74 | /* Enable all 8 PCI_CLK_OUTPUTS */ |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 75 | clk->occr = 0xff000000; |
| 76 | udelay(2000); |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 77 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 78 | /* Configure PCI Local Access Windows */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 79 | pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 80 | pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G; |
| 81 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 82 | pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 83 | pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M; |
| 84 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 85 | udelay(2000); |
Kim Phillips | fd47a74 | 2007-12-20 14:09:22 -0600 | [diff] [blame] | 86 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame^] | 87 | mpc83xx_pci_init(1, reg, 0); |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 88 | } |