Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 2 | /* |
| 3 | * pci.c -- WindRiver SBC8349 PCI board support. |
| 4 | * Copyright (c) 2006 Wind River Systems, Inc. |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 5 | * Copyright (C) 2006-2009 Freescale Semiconductor, Inc. |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 6 | * |
| 7 | * Based on MPC8349 PCI support but w/o PIB related code. |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <asm/mmu.h> |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 11 | #include <asm/io.h> |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 12 | #include <common.h> |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 13 | #include <mpc83xx.h> |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 14 | #include <pci.h> |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 15 | #include <i2c.h> |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 16 | #include <asm/fsl_i2c.h> |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 17 | |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 18 | static struct pci_region pci1_regions[] = { |
| 19 | { |
| 20 | bus_start: CONFIG_SYS_PCI1_MEM_BASE, |
| 21 | phys_start: CONFIG_SYS_PCI1_MEM_PHYS, |
| 22 | size: CONFIG_SYS_PCI1_MEM_SIZE, |
| 23 | flags: PCI_REGION_MEM | PCI_REGION_PREFETCH |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 24 | }, |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 25 | { |
| 26 | bus_start: CONFIG_SYS_PCI1_IO_BASE, |
| 27 | phys_start: CONFIG_SYS_PCI1_IO_PHYS, |
| 28 | size: CONFIG_SYS_PCI1_IO_SIZE, |
| 29 | flags: PCI_REGION_IO |
| 30 | }, |
| 31 | { |
| 32 | bus_start: CONFIG_SYS_PCI1_MMIO_BASE, |
| 33 | phys_start: CONFIG_SYS_PCI1_MMIO_PHYS, |
| 34 | size: CONFIG_SYS_PCI1_MMIO_SIZE, |
| 35 | flags: PCI_REGION_MEM |
| 36 | }, |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 37 | }; |
| 38 | |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 39 | /* |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 40 | * pci_init_board() |
| 41 | * |
| 42 | * NOTICE: PCI2 is not supported. There is only one |
| 43 | * physical PCI slot on the board. |
| 44 | * |
| 45 | */ |
| 46 | void |
| 47 | pci_init_board(void) |
| 48 | { |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 49 | volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR; |
| 50 | volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk; |
| 51 | volatile law83xx_t *pci_law = immr->sysconf.pcilaw; |
| 52 | struct pci_region *reg[] = { pci1_regions }; |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 53 | |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 54 | /* Enable all 8 PCI_CLK_OUTPUTS */ |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 55 | clk->occr = 0xff000000; |
| 56 | udelay(2000); |
| 57 | |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 58 | /* Configure PCI Local Access Windows */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 59 | pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 60 | pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G; |
| 61 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 62 | pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR; |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 63 | pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M; |
| 64 | |
Kim Phillips | 9993e19 | 2009-07-18 18:42:13 -0500 | [diff] [blame] | 65 | udelay(2000); |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 66 | |
Peter Tyser | 6aa3d3b | 2010-09-14 19:13:50 -0500 | [diff] [blame] | 67 | mpc83xx_pci_init(1, reg); |
Paul Gortmaker | 91e2576 | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 68 | } |