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