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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <asm/mmu.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 12 | #include <asm/io.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 13 | #include <common.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 14 | #include <mpc83xx.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 15 | #include <pci.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 16 | #include <i2c.h> |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 17 | #include <asm/fsl_i2c.h> |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 21 | static struct pci_region pci1_regions[] = { |
| 22 | { |
| 23 | bus_start: CONFIG_SYS_PCI1_MEM_BASE, |
| 24 | phys_start: CONFIG_SYS_PCI1_MEM_PHYS, |
| 25 | size: CONFIG_SYS_PCI1_MEM_SIZE, |
| 26 | flags: PCI_REGION_MEM | PCI_REGION_PREFETCH |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 27 | }, |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 28 | { |
| 29 | bus_start: CONFIG_SYS_PCI1_IO_BASE, |
| 30 | phys_start: CONFIG_SYS_PCI1_IO_PHYS, |
| 31 | size: CONFIG_SYS_PCI1_IO_SIZE, |
| 32 | flags: PCI_REGION_IO |
| 33 | }, |
| 34 | { |
| 35 | bus_start: CONFIG_SYS_PCI1_MMIO_BASE, |
| 36 | phys_start: CONFIG_SYS_PCI1_MMIO_PHYS, |
| 37 | size: CONFIG_SYS_PCI1_MMIO_SIZE, |
| 38 | flags: PCI_REGION_MEM |
| 39 | }, |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 40 | }; |
| 41 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 42 | /* |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 43 | * pci_init_board() |
| 44 | * |
| 45 | * NOTICE: PCI2 is not supported. There is only one |
| 46 | * physical PCI slot on the board. |
| 47 | * |
| 48 | */ |
| 49 | void |
| 50 | pci_init_board(void) |
| 51 | { |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 52 | volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR; |
| 53 | volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk; |
| 54 | volatile law83xx_t *pci_law = immr->sysconf.pcilaw; |
| 55 | struct pci_region *reg[] = { pci1_regions }; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 56 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 57 | /* Enable all 8 PCI_CLK_OUTPUTS */ |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 58 | clk->occr = 0xff000000; |
| 59 | udelay(2000); |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 60 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 61 | /* Configure PCI Local Access Windows */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 62 | pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 63 | pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G; |
| 64 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 65 | pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 66 | pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M; |
| 67 | |
Kim Phillips | 57a2af3 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 68 | udelay(2000); |
Kim Phillips | fd47a74 | 2007-12-20 14:09:22 -0600 | [diff] [blame] | 69 | |
Peter Tyser | e228332 | 2010-09-14 19:13:50 -0500 | [diff] [blame] | 70 | mpc83xx_pci_init(1, reg); |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 71 | } |