OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [mips/] [ddb5xxx/] [ddb5476/] [pci.c] - Blame information for rev 1275

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#include <linux/config.h>
2
#include <linux/kernel.h>
3
#include <linux/init.h>
4
#include <linux/types.h>
5
#include <linux/pci.h>
6
 
7
#include <asm/pci_channel.h>
8
#include <asm/debug.h>
9
 
10
#include <asm/ddb5xxx/ddb5xxx.h>
11
 
12
static struct resource extpci_io_resource = {
13
        "pci IO space",
14
        0x1000,                         /* leave some room for ISA bus */
15
        DDB_PCI_IO_SIZE -1,
16
        IORESOURCE_IO};
17
 
18
static struct resource extpci_mem_resource = {
19
        "pci memory space",
20
        DDB_PCI_MEM_BASE + 0x00100000,  /* leave 1 MB for RTC */
21
        DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE -1,
22
        IORESOURCE_MEM};
23
 
24
extern struct pci_ops ddb5476_ext_pci_ops;
25
 
26
struct pci_channel mips_pci_channels[] = {
27
        { &ddb5476_ext_pci_ops, &extpci_io_resource, &extpci_mem_resource },
28
        { NULL, NULL, NULL}
29
};
30
 
31
 
32
/*
33
 * we fix up irqs based on the slot number.
34
 * The first entry is at AD:11.
35
 *
36
 * This does not work for devices on sub-buses yet.
37
 */
38
 
39
/*
40
 * temporary
41
 */
42
 
43
#define         PCI_EXT_INTA            8
44
#define         PCI_EXT_INTB            9
45
#define         PCI_EXT_INTC            10
46
#define         PCI_EXT_INTD            11
47
#define         PCI_EXT_INTE            12
48
 
49
/*
50
 * based on ddb5477 manual page 11
51
 */
52
#define         MAX_SLOT_NUM            21
53
static unsigned char irq_map[MAX_SLOT_NUM] = {
54
        /* SLOT:  0, AD:11 */ 0xff,
55
        /* SLOT:  1, AD:12 */ 0xff,
56
        /* SLOT:  2, AD:13 */ 9,                /* USB */
57
        /* SLOT:  3, AD:14 */ 10,               /* PMU */
58
        /* SLOT:  4, AD:15 */ 0xff,
59
        /* SLOT:  5, AD:16 */ 0x0,              /* P2P bridge */
60
        /* SLOT:  6, AD:17 */ nile4_to_irq(PCI_EXT_INTB),
61
        /* SLOT:  7, AD:18 */ nile4_to_irq(PCI_EXT_INTC),
62
        /* SLOT:  8, AD:19 */ nile4_to_irq(PCI_EXT_INTD),
63
        /* SLOT:  9, AD:20 */ nile4_to_irq(PCI_EXT_INTA),
64
        /* SLOT: 10, AD:21 */ 0xff,
65
        /* SLOT: 11, AD:22 */ 0xff,
66
        /* SLOT: 12, AD:23 */ 0xff,
67
        /* SLOT: 13, AD:24 */ 14,               /* HD controller, M5229 */
68
        /* SLOT: 14, AD:25 */ 0xff,
69
        /* SLOT: 15, AD:26 */ 0xff,
70
        /* SLOT: 16, AD:27 */ 0xff,
71
        /* SLOT: 17, AD:28 */ 0xff,
72
        /* SLOT: 18, AD:29 */ 0xff,
73
        /* SLOT: 19, AD:30 */ 0xff,
74
        /* SLOT: 20, AD:31 */ 0xff
75
};
76
 
77
extern int vrc5477_irq_to_irq(int irq);
78
void __init pcibios_fixup_irqs(void)
79
{
80
        struct pci_dev *dev;
81
        int slot_num;
82
 
83
        pci_for_each_dev(dev) {
84
                slot_num = PCI_SLOT(dev->devfn);
85
 
86
                /* we don't do IRQ fixup for sub-bus yet */
87
                if (dev->bus->parent != NULL) {
88
                        db_run(printk("Don't know how to fixup irq for PCI device %d on sub-bus %d\n",
89
                                slot_num, dev->bus->number));
90
                        continue;
91
                }
92
 
93
                db_assert(slot_num < MAX_SLOT_NUM);
94
                db_assert(irq_map[slot_num] != 0xff);
95
 
96
                pci_write_config_byte(dev,
97
                                      PCI_INTERRUPT_LINE,
98
                                      irq_map[slot_num]);
99
                dev->irq = irq_map[slot_num];
100
        }
101
}
102
 
103
void __init ddb_pci_reset_bus(void)
104
{
105
        u32 temp;
106
 
107
        /*
108
         * I am not sure about the "official" procedure, the following
109
         * steps work as far as I know:
110
         * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
111
         * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
112
         * The same is true for both PCI channels.
113
         */
114
        temp = ddb_in32(DDB_PCICTRL+4);
115
        temp |= 0x80000000;
116
        ddb_out32(DDB_PCICTRL+4, temp);
117
        temp &= ~0xc0000000;
118
        ddb_out32(DDB_PCICTRL+4, temp);
119
 
120
}
121
 
122
unsigned __init int pcibios_assign_all_busses(void)
123
{
124
        /* we hope pci_auto has assigned the bus numbers to all buses */
125
        return 1;
126
}
127
 
128
void __init pcibios_fixup_resources(struct pci_dev *dev)
129
{
130
}
131
 
132
void __init pcibios_fixup(void)
133
{
134
}
135
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.