blob: 0a43d8a93d765e0e435d0b8ac232bd466e1cb7ac [file] [log] [blame]
Arnd Bergmannfef1c772005-06-23 09:43:37 +10001/*
2 * linux/arch/ppc/kernel/bpa_setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu)
7 * Modified by PPC64 Team, IBM Corp
8 * Modified by BPA Team, IBM Deutschland Entwicklung GmbH
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#undef DEBUG
16
17#include <linux/config.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/stddef.h>
22#include <linux/unistd.h>
23#include <linux/slab.h>
24#include <linux/user.h>
25#include <linux/reboot.h>
26#include <linux/init.h>
27#include <linux/delay.h>
28#include <linux/irq.h>
29#include <linux/seq_file.h>
30#include <linux/root_dev.h>
31#include <linux/console.h>
32
33#include <asm/mmu.h>
34#include <asm/processor.h>
35#include <asm/io.h>
36#include <asm/pgtable.h>
37#include <asm/prom.h>
38#include <asm/rtas.h>
39#include <asm/pci-bridge.h>
40#include <asm/iommu.h>
41#include <asm/dma.h>
42#include <asm/machdep.h>
43#include <asm/time.h>
44#include <asm/nvram.h>
45#include <asm/cputable.h>
46
47#include "pci.h"
Arnd Bergmanncebf5892005-06-23 09:43:43 +100048#include "bpa_iic.h"
Arnd Bergmannfef1c772005-06-23 09:43:37 +100049
50#ifdef DEBUG
51#define DBG(fmt...) udbg_printf(fmt)
52#else
53#define DBG(fmt...)
54#endif
55
56void bpa_get_cpuinfo(struct seq_file *m)
57{
58 struct device_node *root;
59 const char *model = "";
60
61 root = of_find_node_by_path("/");
62 if (root)
63 model = get_property(root, "model", NULL);
64 seq_printf(m, "machine\t\t: BPA %s\n", model);
65 of_node_put(root);
66}
67
68static void bpa_progress(char *s, unsigned short hex)
69{
70 printk("*** %04x : %s\n", hex, s ? s : "");
71}
72
73static void __init bpa_setup_arch(void)
74{
Arnd Bergmanncebf5892005-06-23 09:43:43 +100075 ppc_md.init_IRQ = iic_init_IRQ;
76 ppc_md.get_irq = iic_get_irq;
77
Arnd Bergmannfef1c772005-06-23 09:43:37 +100078#ifdef CONFIG_SMP
79 smp_init_pSeries();
80#endif
81
82 /* init to some ~sane value until calibrate_delay() runs */
83 loops_per_jiffy = 50000000;
84
85 if (ROOT_DEV == 0) {
86 printk("No ramdisk, default root is /dev/hda2\n");
87 ROOT_DEV = Root_HDA2;
88 }
89
90 /* Find and initialize PCI host bridges */
91 init_pci_config_tokens();
92 find_and_init_phbs();
Arnd Bergmanncebf5892005-06-23 09:43:43 +100093 spider_init_IRQ();
Arnd Bergmannfef1c772005-06-23 09:43:37 +100094#ifdef CONFIG_DUMMY_CONSOLE
95 conswitchp = &dummy_con;
96#endif
97
98 bpa_nvram_init();
99}
100
101/*
102 * Early initialization. Relocation is on but do not reference unbolted pages
103 */
104static void __init bpa_init_early(void)
105{
106 DBG(" -> bpa_init_early()\n");
107
108 hpte_init_native();
109
110 pci_direct_iommu_init();
111
112 ppc64_interrupt_controller = IC_BPA_IIC;
113
114 DBG(" <- bpa_init_early()\n");
115}
116
117
118static int __init bpa_probe(int platform)
119{
120 if (platform != PLATFORM_BPA)
121 return 0;
122
123 return 1;
124}
125
126struct machdep_calls __initdata bpa_md = {
127 .probe = bpa_probe,
128 .setup_arch = bpa_setup_arch,
129 .init_early = bpa_init_early,
130 .get_cpuinfo = bpa_get_cpuinfo,
131 .restart = rtas_restart,
132 .power_off = rtas_power_off,
133 .halt = rtas_halt,
134 .get_boot_time = rtas_get_boot_time,
135 .get_rtc_time = rtas_get_rtc_time,
136 .set_rtc_time = rtas_set_rtc_time,
137 .calibrate_decr = generic_calibrate_decr,
138 .progress = bpa_progress,
139};