2 * AmigaOne platform setup
4 * Copyright 2008 Gerhard Pircher (gerhard_pircher@gmx.net)
6 * Based on original amigaone_setup.c source code
7 * Copyright 2003 by Hans-Joerg Frieden and Thomas Frieden
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
15 #include <linux/kernel.h>
16 #include <linux/seq_file.h>
17 #include <linux/utsrelease.h>
19 #include <asm/machdep.h>
20 #include <asm/cputable.h>
22 #include <asm/pci-bridge.h>
23 #include <asm/i8259.h>
27 extern void __flush_disable_L1(void);
29 void amigaone_show_cpuinfo(struct seq_file
*m
)
31 seq_printf(m
, "vendor\t\t: Eyetech Ltd.\n");
34 static int __init
amigaone_add_bridge(struct device_node
*dev
)
36 const u32
*cfg_addr
, *cfg_data
;
39 struct pci_controller
*hose
;
41 printk(KERN_INFO
"Adding PCI host bridge %s\n", dev
->full_name
);
43 cfg_addr
= of_get_address(dev
, 0, NULL
, NULL
);
44 cfg_data
= of_get_address(dev
, 1, NULL
, NULL
);
45 if ((cfg_addr
== NULL
) || (cfg_data
== NULL
))
48 bus_range
= of_get_property(dev
, "bus-range", &len
);
49 if ((bus_range
== NULL
) || (len
< 2 * sizeof(int)))
50 printk(KERN_WARNING
"Can't get bus-range for %s, assume"
51 " bus 0\n", dev
->full_name
);
53 hose
= pcibios_alloc_controller(dev
);
57 hose
->first_busno
= bus_range
? bus_range
[0] : 0;
58 hose
->last_busno
= bus_range
? bus_range
[1] : 0xff;
60 setup_indirect_pci(hose
, cfg_addr
[0], cfg_data
[0], 0);
62 /* Interpret the "ranges" property */
63 /* This also maps the I/O region and sets isa_io/mem_base */
64 pci_process_bridge_OF_ranges(hose
, dev
, 1);
69 void __init
amigaone_setup_arch(void)
71 struct device_node
*np
;
74 /* Lookup PCI host bridges. */
75 for_each_compatible_node(np
, "pci", "mai-logic,articia-s")
76 phb
= amigaone_add_bridge(np
);
81 ppc_md
.progress("Linux/PPC "UTS_RELEASE
"\n", 0);
84 void __init
amigaone_init_IRQ(void)
86 struct device_node
*pic
, *np
= NULL
;
87 const unsigned long *prop
= NULL
;
88 unsigned long int_ack
= 0;
90 /* Search for ISA interrupt controller. */
91 pic
= of_find_compatible_node(NULL
, "interrupt-controller",
95 /* Look for interrupt acknowledge address in the PCI root node. */
96 np
= of_find_compatible_node(NULL
, "pci", "mai-logic,articia-s");
98 prop
= of_get_property(np
, "8259-interrupt-acknowledge", NULL
);
105 printk(KERN_WARNING
"Cannot find PCI interrupt acknowledge"
106 " address, polling\n");
108 i8259_init(pic
, int_ack
);
109 ppc_md
.get_irq
= i8259_irq
;
110 irq_set_default_host(i8259_get_host());
113 static int __init
request_isa_regions(void)
115 request_region(0x00, 0x20, "dma1");
116 request_region(0x40, 0x20, "timer");
117 request_region(0x80, 0x10, "dma page reg");
118 request_region(0xc0, 0x20, "dma2");
122 machine_device_initcall(amigaone
, request_isa_regions
);
124 void amigaone_restart(char *cmd
)
128 /* Flush and disable caches. */
129 __flush_disable_L1();
131 /* Set SRR0 to the reset vector and turn on MSR_IP. */
132 mtspr(SPRN_SRR0
, 0xfff00100);
133 mtspr(SPRN_SRR1
, MSR_IP
);
135 /* Do an rfi to jump back to firmware. */
136 __asm__
__volatile__("rfi" : : : "memory");
142 static int __init
amigaone_probe(void)
144 unsigned long root
= of_get_flat_dt_root();
146 if (of_flat_dt_is_compatible(root
, "eyetech,amigaone")) {
148 * Coherent memory access cause complete system lockup! Thus
149 * disable this CPU feature, even if the CPU needs it.
151 cur_cpu_spec
->cpu_features
&= ~CPU_FTR_NEED_COHERENT
;
153 ISA_DMA_THRESHOLD
= 0x00ffffff;
154 DMA_MODE_READ
= 0x44;
155 DMA_MODE_WRITE
= 0x48;
163 define_machine(amigaone
) {
165 .probe
= amigaone_probe
,
166 .setup_arch
= amigaone_setup_arch
,
167 .show_cpuinfo
= amigaone_show_cpuinfo
,
168 .init_IRQ
= amigaone_init_IRQ
,
169 .restart
= amigaone_restart
,
170 .calibrate_decr
= generic_calibrate_decr
,
171 .progress
= udbg_progress
,