blob: 26c4f24e4f8b00d6cf608fca1bd8163e59891c3b [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Paul Gortmaker91e25762007-01-16 11:38:14 -05002/*
3 * pci.c -- WindRiver SBC8349 PCI board support.
4 * Copyright (c) 2006 Wind River Systems, Inc.
Kim Phillips9993e192009-07-18 18:42:13 -05005 * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
Paul Gortmaker91e25762007-01-16 11:38:14 -05006 *
7 * Based on MPC8349 PCI support but w/o PIB related code.
Paul Gortmaker91e25762007-01-16 11:38:14 -05008 */
9
Simon Glass2cf431c2019-11-14 12:57:47 -070010#include <init.h>
Paul Gortmaker91e25762007-01-16 11:38:14 -050011#include <asm/mmu.h>
Kim Phillips9993e192009-07-18 18:42:13 -050012#include <asm/io.h>
Paul Gortmaker91e25762007-01-16 11:38:14 -050013#include <common.h>
Kim Phillips9993e192009-07-18 18:42:13 -050014#include <mpc83xx.h>
Paul Gortmaker91e25762007-01-16 11:38:14 -050015#include <pci.h>
Paul Gortmaker91e25762007-01-16 11:38:14 -050016#include <i2c.h>
Kim Phillips9993e192009-07-18 18:42:13 -050017#include <asm/fsl_i2c.h>
Simon Glassc05ed002020-05-10 11:40:11 -060018#include <linux/delay.h>
Paul Gortmaker91e25762007-01-16 11:38:14 -050019
Kim Phillips9993e192009-07-18 18:42:13 -050020static struct pci_region pci1_regions[] = {
21 {
22 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
23 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
24 size: CONFIG_SYS_PCI1_MEM_SIZE,
25 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
Paul Gortmaker91e25762007-01-16 11:38:14 -050026 },
Kim Phillips9993e192009-07-18 18:42:13 -050027 {
28 bus_start: CONFIG_SYS_PCI1_IO_BASE,
29 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
30 size: CONFIG_SYS_PCI1_IO_SIZE,
31 flags: PCI_REGION_IO
32 },
33 {
34 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
35 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
36 size: CONFIG_SYS_PCI1_MMIO_SIZE,
37 flags: PCI_REGION_MEM
38 },
Paul Gortmaker91e25762007-01-16 11:38:14 -050039};
40
Kim Phillips9993e192009-07-18 18:42:13 -050041/*
Paul Gortmaker91e25762007-01-16 11:38:14 -050042 * pci_init_board()
43 *
44 * NOTICE: PCI2 is not supported. There is only one
45 * physical PCI slot on the board.
46 *
47 */
48void
49pci_init_board(void)
50{
Kim Phillips9993e192009-07-18 18:42:13 -050051 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
52 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
53 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
54 struct pci_region *reg[] = { pci1_regions };
Paul Gortmaker91e25762007-01-16 11:38:14 -050055
Kim Phillips9993e192009-07-18 18:42:13 -050056 /* Enable all 8 PCI_CLK_OUTPUTS */
Paul Gortmaker91e25762007-01-16 11:38:14 -050057 clk->occr = 0xff000000;
58 udelay(2000);
59
Kim Phillips9993e192009-07-18 18:42:13 -050060 /* Configure PCI Local Access Windows */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020061 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
Paul Gortmaker91e25762007-01-16 11:38:14 -050062 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
63
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020064 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
Paul Gortmaker91e25762007-01-16 11:38:14 -050065 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
66
Kim Phillips9993e192009-07-18 18:42:13 -050067 udelay(2000);
Paul Gortmaker91e25762007-01-16 11:38:14 -050068
Peter Tyser6aa3d3b2010-09-14 19:13:50 -050069 mpc83xx_pci_init(1, reg);
Paul Gortmaker91e25762007-01-16 11:38:14 -050070}