diff options
Diffstat (limited to 'arch/mips/pci/pci-emma2rh.c')
-rw-r--r-- | arch/mips/pci/pci-emma2rh.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/arch/mips/pci/pci-emma2rh.c b/arch/mips/pci/pci-emma2rh.c new file mode 100644 index 000000000000..0f8b230057d3 --- /dev/null +++ b/arch/mips/pci/pci-emma2rh.c | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * arch/mips/pci/pci-emma2rh.c | ||
3 | * This file defines the PCI configration. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/pci.c | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | #include <linux/config.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/types.h> | ||
30 | #include <linux/pci.h> | ||
31 | |||
32 | #include <asm/bootinfo.h> | ||
33 | #include <asm/debug.h> | ||
34 | |||
35 | #include <asm/emma2rh/emma2rh.h> | ||
36 | |||
37 | static struct resource pci_io_resource = { | ||
38 | .name = "pci IO space", | ||
39 | .start = EMMA2RH_PCI_IO_BASE, | ||
40 | .end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1, | ||
41 | .flags = IORESOURCE_IO, | ||
42 | }; | ||
43 | |||
44 | static struct resource pci_mem_resource = { | ||
45 | .name = "pci memory space", | ||
46 | .start = EMMA2RH_PCI_MEM_BASE, | ||
47 | .end = EMMA2RH_PCI_MEM_BASE + EMMA2RH_PCI_MEM_SIZE - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }; | ||
50 | |||
51 | extern struct pci_ops emma2rh_pci_ops; | ||
52 | |||
53 | static struct pci_controller emma2rh_pci_controller = { | ||
54 | .pci_ops = &emma2rh_pci_ops, | ||
55 | .mem_resource = &pci_mem_resource, | ||
56 | .io_resource = &pci_io_resource, | ||
57 | .mem_offset = -0x04000000, | ||
58 | .io_offset = 0, | ||
59 | }; | ||
60 | |||
61 | static void __init emma2rh_pci_init(void) | ||
62 | { | ||
63 | /* setup PCI interface */ | ||
64 | emma2rh_out32(EMMA2RH_PCI_ARBIT_CTR, 0x70f); | ||
65 | |||
66 | emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, 0x80000a18); | ||
67 | emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_COMMAND, | ||
68 | PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_CAP_LIST | | ||
69 | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); | ||
70 | emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_BASE_ADDRESS_0, 0x10000000); | ||
71 | emma2rh_out32(EMMA2RH_PCI_CONFIG_BASE + PCI_BASE_ADDRESS_1, 0x00000000); | ||
72 | |||
73 | emma2rh_out32(EMMA2RH_PCI_IWIN0_CTR, 0x12000000 | 0x218); | ||
74 | emma2rh_out32(EMMA2RH_PCI_IWIN1_CTR, 0x18000000 | 0x600); | ||
75 | emma2rh_out32(EMMA2RH_PCI_INIT_ESWP, 0x00000200); | ||
76 | |||
77 | emma2rh_out32(EMMA2RH_PCI_TWIN_CTR, 0x00009200); | ||
78 | emma2rh_out32(EMMA2RH_PCI_TWIN_BADR, 0x00000000); | ||
79 | emma2rh_out32(EMMA2RH_PCI_TWIN0_DADR, 0x00000000); | ||
80 | emma2rh_out32(EMMA2RH_PCI_TWIN1_DADR, 0x00000000); | ||
81 | } | ||
82 | |||
83 | static int __init emma2rh_pci_setup(void) | ||
84 | { | ||
85 | emma2rh_pci_init(); | ||
86 | register_pci_controller(&emma2rh_pci_controller); | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | arch_initcall(emma2rh_pci_setup); | ||