/[linux-patches]/genpatches-2.6/historical/2.6.10/2700_ppc-pegasos-2.6.6.patch
Gentoo

Contents of /genpatches-2.6/historical/2.6.10/2700_ppc-pegasos-2.6.6.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download) (as text)
Sat Jun 11 23:16:54 2005 UTC (15 years, 1 month ago) by dsd
File MIME type: text/x-diff
File size: 12476 byte(s)
Import historical releases
1 dsd 2 diff -urN kernel-source-2.6.5/arch/ppc/platforms/chrp_pci.c kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_pci.c
2     --- kernel-source-2.6.5/arch/ppc/platforms/chrp_pci.c 2003-06-17 06:20:27.000000000 +0200
3     +++ kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_pci.c 2004-04-12 23:43:57.495852656 +0200
4     @@ -97,8 +97,9 @@
5     rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
6     int len, u32 *val)
7     {
8     + struct pci_controller *hose = bus->sysdata;
9     unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
10     - | ((bus->number & 0xff) << 16);
11     + | (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
12     unsigned long ret = ~0UL;
13     int rval;
14    
15     @@ -111,8 +112,9 @@
16     rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
17     int len, u32 val)
18     {
19     + struct pci_controller *hose = bus->sysdata;
20     unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
21     - | ((bus->number & 0xff) << 16);
22     + | (((bus->number - hose->first_busno) & 0xff) << 16) | (pci_domain_nr(bus) << 24);
23     int rval;
24    
25     rval = call_rtas("write-pci-config", 3, 1, NULL, addr, len, val);
26     @@ -186,6 +188,170 @@
27     iounmap(reg);
28     }
29    
30     +/* Marvell Discovery II based Pegasos 2 */
31     +volatile unsigned int *peg2_magic_agp_f118;
32     +volatile unsigned int *peg2_magic_agp_f11c;
33     +
34     +int __chrp peg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
35     + int len, u32 *val)
36     +{
37     + volatile unsigned char *cfg_data;
38     + struct pci_controller *hose = bus->sysdata;
39     + u32 msr;
40     +
41     + /* We can read only on function 0 offset 0 to 15 on device 0) */
42     + if (bus->number == hose->first_busno) {
43     + if (devfn == 0) {
44     + if (off > 15) {
45     + * val = (u32) 0;
46     + return PCIBIOS_SUCCESSFUL;
47     + }
48     + } else if ((devfn >> 3) == 0)
49     + return PCIBIOS_DEVICE_NOT_FOUND;
50     + }
51     +
52     + /* Magic fix for the agp bus */
53     + if (hose->index == 1) {
54     + /* Disable cpu interrupts */
55     + msr = mfmsr();
56     + mtmsr(msr & ~MSR_EE);
57     + /* Enable PCI -> AGP idsel mapping */
58     + out_be32 (peg2_magic_agp_f118, 0x8000);
59     + }
60     +
61     + out_le32 (hose->cfg_addr,
62     + 0x80000000 | ((bus->number - hose->first_busno) << 16) | (devfn << 8) | (off & 0xfc));
63     + /*
64     + * Note: the caller has already checked that off is
65     + * suitably aligned and that len is 1, 2 or 4.
66     + */
67     + cfg_data = hose->cfg_data + (off & 3);
68     + switch (len) {
69     + case 1:
70     + *val = in_8((u8 *)cfg_data);
71     + break;
72     + case 2:
73     + *val = in_le16((u16 *)cfg_data);
74     + break;
75     + default:
76     + *val = in_le32((u32 *)cfg_data);
77     + break;
78     + }
79     + /* Magic fix for the agp bus */
80     + if (hose->index == 1) {
81     + /* Disable PCI -> AGP idsel mapping */
82     + out_be32 (peg2_magic_agp_f11c, 0x8000);
83     + /* Enable cpu interrupts */
84     + mtmsr(msr);
85     + }
86     + return PCIBIOS_SUCCESSFUL;
87     +}
88     +
89     +int __chrp peg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
90     + int len, u32 val)
91     +{
92     + volatile unsigned char *cfg_data;
93     + struct pci_controller *hose = bus->sysdata;
94     + u32 msr;
95     +
96     + /* We ignore writes to device 0 */
97     + /*if (bus->number == 0) */
98     + if (bus->number == hose->first_busno) {
99     + if (devfn == 0)
100     + return PCIBIOS_SUCCESSFUL;
101     + else if ((devfn >> 3) == 0)
102     + return PCIBIOS_DEVICE_NOT_FOUND;
103     + }
104     +
105     + /* Magic fix for the agp bus */
106     + if (hose->index == 1) {
107     + /* Disable cpu interrupts */
108     + msr = mfmsr();
109     + mtmsr(msr & ~MSR_EE);
110     + /* Enable PCI -> AGP idsel mapping */
111     + out_be32 (peg2_magic_agp_f118, 0x8000);
112     + }
113     +
114     + out_le32 (hose->cfg_addr,
115     + 0x80000000 | ((bus->number - hose->first_busno) << 16) | (devfn << 8) | (off & 0xfc));
116     + /*
117     + * Note: the caller has already checked that off is
118     + * suitably aligned and that len is 1, 2 or 4.
119     + */
120     + cfg_data = hose->cfg_data + (off & 3);
121     + switch (len) {
122     + case 1:
123     + out_8((u8 *)cfg_data, val);
124     + break;
125     + case 2:
126     + out_le16((u16 *)cfg_data, val);
127     + break;
128     + default:
129     + out_le32((u32 *)cfg_data, val);
130     + break;
131     + }
132     + /* Magic fix for the agp bus */
133     + if (hose->index == 1) {
134     + /* Disable PCI -> AGP idsel mapping */
135     + out_be32 (peg2_magic_agp_f11c, 0x8000);
136     + /* Enable cpu interrupts */
137     + mtmsr(msr);
138     + }
139     + return PCIBIOS_SUCCESSFUL;
140     +}
141     +
142     +
143     +static struct pci_ops peg2_pci_ops =
144     +{
145     + peg2_read_config,
146     + peg2_write_config
147     +};
148     +
149     +#define PEGASOS_USE_RTAS
150     +//#define PEGASOS_USE_PCI_DOMAINS
151     +
152     +static void __init
153     +setup_peg2(struct pci_controller *hose, struct device_node *dev)
154     +{
155     + unsigned long base = 0xf1000c78 & PAGE_MASK;
156     + char *mbase;
157     + unsigned long magic_agp_base = 0xf100f118 & PAGE_MASK;
158     + char *magic_agp_mbase;
159     +#ifdef PEGASOS_USE_RTAS
160     + struct device_node *root = find_path_device("/");
161     + struct device_node *rtas;
162     +
163     + rtas = of_find_node_by_name (root, "rtas");
164     + if (rtas) {
165     + hose->ops = &rtas_pci_ops;
166     + printk ("Pegasos OF RTAS support detected, using it\n");
167     + } else {
168     + printk ("Pegasos OF doesn't support RTAS, please upgrade it\n");
169     +#else
170     + {
171     +#endif
172     + if (strncmp(dev->full_name, "/pci@80000000", 13) == 0) {
173     + mbase = ioremap (base, PAGE_SIZE);
174     + hose->cfg_addr = (unsigned int *) (mbase + (0xf1000c78 & ~PAGE_MASK));
175     + hose->cfg_data = (unsigned char *) (mbase + (0xf1000c7c & ~PAGE_MASK));
176     + hose->ops = &peg2_pci_ops;
177     + } else if (strncmp(dev->full_name, "/pci@C0000000", 13) == 0) {
178     + mbase = ioremap (base, PAGE_SIZE);
179     + hose->cfg_addr = (unsigned int *) (mbase + (0xf1000cf8 & ~PAGE_MASK));
180     + hose->cfg_data = (unsigned char *) (mbase + (0xf1000cfc & ~PAGE_MASK));
181     + hose->ops = &peg2_pci_ops;
182     + magic_agp_mbase = ioremap (magic_agp_base, PAGE_SIZE);
183     + peg2_magic_agp_f118 = (unsigned int *) (magic_agp_mbase + (0xf100f118 & ~PAGE_MASK));
184     + peg2_magic_agp_f11c = (unsigned int *) (magic_agp_mbase + (0xf100f1c8 & ~PAGE_MASK));
185     + } else
186     + printk("Pegasos 2 unknown pci bridge detected %s, type %s, full name %s at %08x, ints %d\n",
187     + dev->name, dev->type, dev->full_name, dev->n_addrs, dev->n_intrs);
188     + }
189     +#ifndef PEGASOS_USE_PCI_DOMAINS
190     + pci_assign_all_busses = 1;
191     +#endif
192     +}
193     +
194     void __init
195     chrp_find_bridges(void)
196     {
197     @@ -195,7 +361,7 @@
198     struct pci_controller *hose;
199     unsigned int *dma;
200     char *model, *machine;
201     - int is_longtrail = 0, is_mot = 0;
202     + int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
203     struct device_node *root = find_path_device("/");
204    
205     /*
206     @@ -207,6 +373,8 @@
207     if (machine != NULL) {
208     is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
209     is_mot = strncmp(machine, "MOT", 3) == 0;
210     + if (strncmp(machine, "Pegasos2", 8) == 0) is_pegasos = 2;
211     + else if (strncmp(machine, "Pegasos", 7) == 0) is_pegasos = 1;
212     }
213     for (dev = root->child; dev != NULL; dev = dev->sibling) {
214     if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
215     @@ -257,6 +425,10 @@
216     hose->cfg_data = (unsigned char *)
217     ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
218     gg2_pci_config_base = (unsigned long) hose->cfg_data;
219     + } else if (is_pegasos == 1) {
220     + setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
221     + } else if (is_pegasos == 2) {
222     + setup_peg2(hose, dev);
223     } else {
224     printk("No methods for %s (model %s), using RTAS\n",
225     dev->full_name, model);
226     @@ -274,6 +446,9 @@
227     printk("pci_dram_offset = %lx\n", pci_dram_offset);
228     }
229     }
230     -
231     - ppc_md.pcibios_fixup = chrp_pcibios_fixup;
232     +
233     + if (is_pegasos)
234     + ppc_md.pcibios_fixup = NULL;
235     + else
236     + ppc_md.pcibios_fixup = chrp_pcibios_fixup;
237     }
238     diff -urN kernel-source-2.6.5/arch/ppc/platforms/chrp_setup.c kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_setup.c
239     --- kernel-source-2.6.5/arch/ppc/platforms/chrp_setup.c 2003-09-28 06:44:11.000000000 +0200
240     +++ kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_setup.c 2004-04-12 23:43:19.915565728 +0200
241     @@ -214,6 +214,37 @@
242     }
243     }
244    
245     +void pegasos_set_l2cr(void)
246     +{
247     + struct device_node *root = find_path_device("/");
248     + char *machine;
249     + struct device_node *np;
250     + int l2cr_value;
251     +
252     + /* On Pegasos, enable the l2 cache if needed, as the OF forgets it */
253     + if (root == NULL)
254     + return;
255     + machine = get_property(root, "model", NULL);
256     + if (machine == NULL)
257     + return;
258     + if (strncmp(machine, "Pegasos", 7) == 0) {
259     + /* Enable L2 cache if needed */
260     + np = find_type_devices("cpu");
261     + if (np != NULL) {
262     + unsigned int *l2cr = (unsigned int *)
263     + get_property (np, "l2cr", NULL);
264     + if (l2cr == NULL) {
265     + printk ("Pegasos l2cr : no cpu l2cr property found\n");
266     + return;
267     + }
268     + if (!((*l2cr) & 0x80000000)) {
269     + printk ("Pegasos l2cr : L2 cache was not active, activating\n");
270     + _set_L2CR(0);
271     + _set_L2CR((*l2cr) | 0x80000000);
272     + }
273     + }
274     + }
275     +}
276    
277     void __init
278     chrp_setup_arch(void)
279     @@ -236,6 +267,9 @@
280     /* Lookup PCI host bridges */
281     chrp_find_bridges();
282    
283     + /* On pegasos, enable the L2 cache if not already done by OF */
284     + pegasos_set_l2cr();
285     +
286     #ifndef CONFIG_PPC64BRIDGE
287     /*
288     * Temporary fixes for PCI devices.
289     @@ -387,6 +421,8 @@
290     #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
291     struct device_node *kbd;
292     #endif
293     + struct device_node *root = find_path_device ("/");
294     + char *machine;
295    
296     for (np = find_devices("pci"); np != NULL; np = np->next) {
297     unsigned int *addrp = (unsigned int *)
298     @@ -400,6 +400,18 @@
299     if (np == NULL)
300     printk(KERN_ERR "Cannot find PCI interrupt acknowledge address\n");
301    
302     + machine = get_property(root, "model", NULL);
303     + if (strncmp(machine, "Pegasos", 7) == 0) {
304     + for (i = 0; i < NUM_8259_INTERRUPTS; i++) {
305     + if (i<16) {
306     + /* byte access */
307     + unsigned int port = 0x4d0 + (i >> 3);
308     + /* ask HW directly */
309     + irq_desc[i].status |= (((inb(port) >> (i & 7)) & 1) ? IRQ_LEVEL : 0 );
310     + }
311     + irq_desc[i].handler = &i8259_pic;
312     + }
313     + } else {
314     chrp_find_openpic();
315    
316     prom_get_irq_senses(init_senses, NUM_8259_INTERRUPTS, NR_IRQS);
317     @@ -413,6 +425,7 @@
318    
319     for (i = 0; i < NUM_8259_INTERRUPTS; i++)
320     irq_desc[i].handler = &i8259_pic;
321     + }
322     i8259_init(chrp_int_ack);
323    
324     #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
325     @@ -450,6 +499,8 @@
326     chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
327     unsigned long r6, unsigned long r7)
328     {
329     + struct device_node *root = find_path_device ("/");
330     + char *machine;
331     #ifdef CONFIG_BLK_DEV_INITRD
332     /* take care of initrd if we have one */
333     if ( r6 )
334     @@ -469,7 +520,11 @@
335     ppc_md.show_cpuinfo = chrp_show_cpuinfo;
336     ppc_md.irq_canonicalize = chrp_irq_canonicalize;
337     ppc_md.init_IRQ = chrp_init_IRQ;
338     - ppc_md.get_irq = openpic_get_irq;
339     + machine = get_property(root, "model", NULL);
340     + if (strncmp(machine, "Pegasos", 7) == 0)
341     + ppc_md.get_irq = i8259_irq;
342     + else
343     + ppc_md.get_irq = openpic_get_irq;
344    
345     ppc_md.init = chrp_init2;
346    
347     diff -urN kernel-source-2.6.5/arch/ppc/platforms/chrp_time.c kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_time.c
348     --- kernel-source-2.6.5/arch/ppc/platforms/chrp_time.c 2003-09-28 06:44:11.000000000 +0200
349     +++ kernel-source-2.6.5-powerpc/arch/ppc/platforms/chrp_time.c 2004-04-12 23:43:19.915565728 +0200
350     @@ -41,6 +41,8 @@
351     int base;
352    
353     rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
354     + if (rtcs == NULL)
355     + rtcs = find_compatible_devices("rtc", "ds1385-rtc");
356     if (rtcs == NULL || rtcs->addrs == NULL)
357     return 0;
358     base = rtcs->addrs[0].address;
359     diff -urN kernel-source-2.6.5/arch/ppc/syslib/prom_init.c kernel-source-2.6.5-powerpc/arch/ppc/syslib/prom_init.c
360     --- kernel-source-2.6.5/arch/ppc/syslib/prom_init.c 2004-02-19 09:54:39.000000000 +0100
361     +++ kernel-source-2.6.5-powerpc/arch/ppc/syslib/prom_init.c 2004-04-12 23:43:19.949560560 +0200
362     @@ -794,6 +794,9 @@
363     char *p, *d;
364     unsigned long phys;
365     void *result[3];
366     + char model[32];
367     + phandle node;
368     + int rc;
369    
370     /* Default */
371     phys = (unsigned long) &_stext;
372     @@ -881,6 +884,10 @@
373     for (i = 0; i < prom_num_displays; ++i)
374     prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);
375    
376     + node = call_prom("finddevice", 1, 1, "/");
377     + rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
378     + if (rc > 0 && !strncmp (model, "Pegasos", 7)) phys = 0x00010000;
379     +
380     prom_print("returning 0x");
381     prom_print_hex(phys);
382     prom_print("from prom_init\n");
383     diff -urN kernel-source-2.6.5/drivers/ide/pci/via82cxxx.c kernel-source-2.6.5-powerpc/drivers/ide/pci/via82cxxx.c
384     --- kernel-source-2.6.5/drivers/ide/pci/via82cxxx.c 2004-04-05 12:54:35.000000000 +0200
385     +++ kernel-source-2.6.5-powerpc/drivers/ide/pci/via82cxxx.c 2004-04-12 23:43:19.967557824 +0200
386     @@ -583,6 +583,8 @@
387     hwif->tuneproc = &via82cxxx_tune_drive;
388     hwif->speedproc = &via_set_drive;
389    
390     + hwif->irq = hwif->channel ? 15 : 14;
391     +
392     for (i = 0; i < 2; i++) {
393     hwif->drives[i].io_32bit = 1;
394     hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;

  ViewVC Help
Powered by ViewVC 1.1.20