]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/cpc45/pd67290.c
* Code cleanup, mostly for GCC-3.3.x
[karo-tx-uboot.git] / board / cpc45 / pd67290.c
1 /* pd67290.c - system configuration module for SPD67290
2  *
3  * See file CREDITS for list of people who contributed to this
4  * project.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19  * MA 02111-1307 USA
20  *
21  * (C) 2004 DENX Software Engineering, Heiko Schocher <hs@denx.de>
22  */
23
24 #include <common.h>
25 #include <malloc.h>
26 #include <net.h>
27 #include <asm/io.h>
28 #include <pci.h>
29
30 /* imports */
31 #include <mpc824x.h>
32
33 static struct pci_device_id supported[] = {
34         {PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6729},
35         {}
36 };
37
38 /***************************************************************************
39 *
40 * SPD67290Init -
41 *
42 * RETURNS: -1 on error, 0 if OK
43 */
44
45 int SPD67290Init (void)
46 {
47         pci_dev_t devno;
48         int idx = 0;            /* general index */
49         ulong membaseCsr;       /* base address of device memory space */
50
51         /* find PD67290 device */
52         if ((devno = pci_find_devices (supported, idx++)) < 0) {
53                 printf ("No PD67290 device found !!\n");
54                 return -1;
55         }
56         /* - 0xfe000000 see MPC 8245 Users Manual Adress Map B */
57         membaseCsr = PCMCIA_IO_BASE - 0xfe000000;
58
59         /* set base address */
60         pci_write_config_dword (devno, PCI_BASE_ADDRESS_0, membaseCsr);
61
62         /* enable mapped memory and IO addresses */
63         pci_write_config_dword (devno,
64                                 PCI_COMMAND,
65                                 PCI_COMMAND_MEMORY |
66                                 PCI_COMMAND_IO | PCI_COMMAND_WAIT);
67         return 0;
68 }