2 * arch/ppc/platforms/adir_setup.c
4 * Board setup routines for SBS Adirondack
6 * By Michael Sokolov <msokolov@ivan.Harhan.ORG>
7 * based on the K2 version by Matt Porter <mporter@mvista.com>
10 #include <linux/config.h>
11 #include <linux/stddef.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/errno.h>
15 #include <linux/reboot.h>
16 #include <linux/pci.h>
17 #include <linux/kdev_t.h>
18 #include <linux/types.h>
19 #include <linux/major.h>
20 #include <linux/blk.h>
21 #include <linux/console.h>
22 #include <linux/delay.h>
23 #include <linux/ide.h>
24 #include <linux/seq_file.h>
26 #include <asm/system.h>
27 #include <asm/pgtable.h>
31 #include <asm/machdep.h>
34 #include <asm/bootinfo.h>
38 extern void adir_init_IRQ(void);
39 extern int adir_get_irq(struct pt_regs *);
40 extern void adir_find_bridges(void);
41 extern unsigned long loops_per_jiffy;
43 static unsigned int cpu_750cx[16] = {
44 5, 15, 14, 0, 4, 13, 0, 9, 6, 11, 8, 10, 16, 12, 7, 0
48 adir_get_bus_speed(void)
50 if (!(*((u_char *) ADIR_CLOCK_REG) & ADIR_CLOCK_REG_SEL133))
57 adir_get_cpu_speed(void)
62 hid1 = mfspr(HID1) >> 28;
64 hid1 = cpu_750cx[hid1];
66 cpu_speed = adir_get_bus_speed()*hid1/2;
71 adir_calibrate_decr(void)
73 int freq, divisor = 4;
75 /* determine processor bus speed */
76 freq = adir_get_bus_speed();
77 tb_ticks_per_jiffy = freq / HZ / divisor;
78 tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000);
82 adir_show_cpuinfo(struct seq_file *m)
84 seq_printf(m, "vendor\t\t: SBS\n");
85 seq_printf(m, "machine\t\t: Adirondack\n");
86 seq_printf(m, "cpu speed\t: %dMhz\n", adir_get_cpu_speed()/1000000);
87 seq_printf(m, "bus speed\t: %dMhz\n", adir_get_bus_speed()/1000000);
88 seq_printf(m, "memory type\t: SDRAM\n");
93 extern char cmd_line[];
102 /* Setup TODC access */
103 TODC_INIT(TODC_TYPE_MC146818, ADIR_NVRAM_RTC_ADDR, 0,
104 ADIR_NVRAM_RTC_DATA, 8);
106 /* init to some ~sane value until calibrate_delay() runs */
107 loops_per_jiffy = 50000000/HZ;
109 /* Setup PCI host bridges */
112 #ifdef CONFIG_BLK_DEV_INITRD
114 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); /* /dev/ram */
117 #ifdef CONFIG_ROOT_NFS
118 ROOT_DEV = to_kdev_t(0x00FF); /* /dev/nfs pseudo device */
120 ROOT_DEV = to_kdev_t(0x0801); /* /dev/sda1 */
123 /* Identify the system */
124 printk("System Identification: SBS Adirondack - PowerPC 750CXe @ %d Mhz\n", adir_get_cpu_speed()/1000000);
125 printk("SBS Adirondack port (C) 2001 SBS Technologies, Inc.\n");
127 /* Identify the CPU manufacturer */
129 printk("CPU manufacturer: IBM [rev=%04x]\n", (cpu & 0xffff));
133 adir_restart(char *cmd)
136 /* SRR0 has system reset vector, SRR1 has default MSR value */
137 /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
160 static unsigned long __init
161 adir_find_end_of_memory(void)
163 return boot_mem_size;
169 io_block_mapping(ADIR_PCI32_VIRT_IO_BASE, ADIR_PCI32_IO_BASE,
170 ADIR_PCI32_VIRT_IO_SIZE, _PAGE_IO);
171 io_block_mapping(ADIR_PCI64_VIRT_IO_BASE, ADIR_PCI64_IO_BASE,
172 ADIR_PCI64_VIRT_IO_SIZE, _PAGE_IO);
176 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
177 unsigned long r6, unsigned long r7)
180 * On the Adirondack we use bi_recs and pass the pointer to them in R3.
182 parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
184 /* Remember, isa_io_base is virtual but isa_mem_base is physical! */
185 isa_io_base = ADIR_PCI32_VIRT_IO_BASE;
186 isa_mem_base = ADIR_PCI32_MEM_BASE;
187 pci_dram_offset = ADIR_PCI_SYS_MEM_BASE;
189 ppc_md.setup_arch = adir_setup_arch;
190 ppc_md.show_cpuinfo = adir_show_cpuinfo;
191 ppc_md.irq_cannonicalize = NULL;
192 ppc_md.init_IRQ = adir_init_IRQ;
193 ppc_md.get_irq = adir_get_irq;
196 ppc_md.find_end_of_memory = adir_find_end_of_memory;
197 ppc_md.setup_io_mappings = adir_map_io;
199 ppc_md.restart = adir_restart;
200 ppc_md.power_off = adir_power_off;
201 ppc_md.halt = adir_halt;
203 ppc_md.time_init = todc_time_init;
204 ppc_md.set_rtc_time = todc_set_rtc_time;
205 ppc_md.get_rtc_time = todc_get_rtc_time;
206 ppc_md.nvram_read_val = todc_mc146818_read_val;
207 ppc_md.nvram_write_val = todc_mc146818_write_val;
208 ppc_md.calibrate_decr = adir_calibrate_decr;