Change boot command to boot kernel from 0xc1028380
[u-boot-m93030.git] / board / pcippc2 / pcippc2_fpga.c
blob7f6739ddabc56d9fe70267ccb51f55cc9188d4cf
1 /*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
6 * project.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
24 #include <config.h>
25 #include <common.h>
26 #include <asm/io.h>
28 #include "pci.h"
30 #include "hardware.h"
31 #include "pcippc2.h"
33 u32 pcippc2_fpga0_phys;
34 u32 pcippc2_fpga1_phys;
36 void pcippc2_fpga_init (void)
38 pci_dev_t bdf = pci_find_device(FPGA_VENDOR_ID, FPGA_DEVICE_ID, 0);
39 unsigned int addr;
40 u16 cmd;
42 if (bdf == -1)
44 puts("Unable to find FPGA !\n");
45 hang();
48 pci_read_config_word(bdf, PCI_COMMAND, &cmd);
49 if ((cmd & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)) != (PCI_COMMAND_MEMORY | PCI_COMMAND_IO))
51 puts("FPGA is not configured !\n");
52 hang();
55 pci_read_config_dword(bdf, PCI_BASE_ADDRESS_0, &addr);
56 if (addr & 0x1)
58 /* IO space
60 pcippc2_fpga0_phys = pci_io_to_phys(bdf, addr & 0xfffffffc);
62 else
64 /* Memory space
66 pcippc2_fpga0_phys = pci_mem_to_phys(bdf, addr & 0xfffffff0);
69 pci_read_config_dword(bdf, PCI_BASE_ADDRESS_1, &addr);
70 if (addr & 0x1)
72 /* IO space
74 pcippc2_fpga1_phys = pci_io_to_phys(bdf, addr & 0xfffffffc);
76 else
78 /* Memory space
80 pcippc2_fpga1_phys = pci_mem_to_phys(bdf, addr & 0xfffffff0);
83 /* Interrupts are not used
85 out32(FPGA(INT, INTR_MASK), 0xffffffff);
86 iobarrier_rw();