Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * arch/ppc/platforms/pal4_setup.c |
| 3 | * |
| 4 | * Board setup routines for the SBS PalomarIV. |
| 5 | * |
| 6 | * Author: Dan Cox |
| 7 | * |
| 8 | * 2002 (c) MontaVista, Software, Inc. This file is licensed under |
| 9 | * the terms of the GNU General Public License version 2. This program |
| 10 | * is licensed "as is" without any warranty of any kind, whether express |
| 11 | * or implied. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/config.h> |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/errno.h> |
| 19 | #include <linux/reboot.h> |
| 20 | #include <linux/time.h> |
| 21 | #include <linux/irq.h> |
| 22 | #include <linux/kdev_t.h> |
| 23 | #include <linux/initrd.h> |
| 24 | #include <linux/console.h> |
| 25 | #include <linux/seq_file.h> |
| 26 | #include <linux/root_dev.h> |
| 27 | |
| 28 | #include <asm/io.h> |
| 29 | #include <asm/todc.h> |
| 30 | #include <asm/bootinfo.h> |
Paul Mackerras | fd582ec | 2005-10-11 22:08:12 +1000 | [diff] [blame] | 31 | #include <asm/machdep.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | #include <syslib/cpc700.h> |
| 34 | |
| 35 | #include "pal4.h" |
| 36 | |
| 37 | extern void pal4_find_bridges(void); |
| 38 | |
| 39 | unsigned int cpc700_irq_assigns[][2] = { |
| 40 | {1, 1}, /* IRQ 0: ECC correctable error */ |
| 41 | {1, 1}, /* IRQ 1: PCI write to memory range */ |
| 42 | {0, 1}, /* IRQ 2: PCI write to command register */ |
| 43 | {0, 1}, /* IRQ 3: UART 0 */ |
| 44 | {0, 1}, /* IRQ 4: UART 1 */ |
| 45 | {0, 1}, /* IRQ 5: ICC 0 */ |
| 46 | {0, 1}, /* IRQ 6: ICC 1 */ |
| 47 | {0, 1}, /* IRQ 7: GPT compare 0 */ |
| 48 | {0, 1}, /* IRQ 8: GPT compare 1 */ |
| 49 | {0, 1}, /* IRQ 9: GPT compare 2 */ |
| 50 | {0, 1}, /* IRQ 10: GPT compare 3 */ |
| 51 | {0, 1}, /* IRQ 11: GPT compare 4 */ |
| 52 | {0, 1}, /* IRQ 12: GPT capture 0 */ |
| 53 | {0, 1}, /* IRQ 13: GPT capture 1 */ |
| 54 | {0, 1}, /* IRQ 14: GPT capture 2 */ |
| 55 | {0, 1}, /* IRQ 15: GPT capture 3 */ |
| 56 | {0, 1}, /* IRQ 16: GPT capture 4 */ |
| 57 | {0, 0}, /* IRQ 17: reserved */ |
| 58 | {0, 0}, /* IRQ 18: reserved */ |
| 59 | {0, 0}, /* IRQ 19: reserved */ |
| 60 | {0, 0}, /* IRQ 20: reserved */ |
| 61 | {0, 1}, /* IRQ 21: Ethernet */ |
| 62 | {0, 0}, /* IRQ 22: reserved */ |
| 63 | {0, 0}, /* IRQ 23: reserved */ |
| 64 | {0, 0}, /* IRQ 24: resreved */ |
| 65 | {0, 0}, /* IRQ 25: reserved */ |
| 66 | {0, 0}, /* IRQ 26: reserved */ |
| 67 | {0, 0}, /* IRQ 27: reserved */ |
| 68 | {0, 0}, /* IRQ 28: reserved */ |
| 69 | {0, 0}, /* IRQ 29: reserved */ |
| 70 | {0, 0}, /* IRQ 30: reserved */ |
| 71 | {0, 0}, /* IRQ 31: reserved */ |
| 72 | }; |
| 73 | |
| 74 | static int |
| 75 | pal4_show_cpuinfo(struct seq_file *m) |
| 76 | { |
| 77 | seq_printf(m, "board\t\t: SBS Palomar IV\n"); |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | static void |
| 83 | pal4_restart(char *cmd) |
| 84 | { |
| 85 | local_irq_disable(); |
| 86 | __asm__ __volatile__("lis 3,0xfff0\n \ |
| 87 | ori 3,3,0x100\n \ |
| 88 | mtspr 26,3\n \ |
| 89 | li 3,0\n \ |
| 90 | mtspr 27,3\n \ |
| 91 | rfi"); |
| 92 | |
| 93 | for(;;); |
| 94 | } |
| 95 | |
| 96 | static void |
| 97 | pal4_power_off(void) |
| 98 | { |
| 99 | local_irq_disable(); |
| 100 | for(;;); |
| 101 | } |
| 102 | |
| 103 | static void |
| 104 | pal4_halt(void) |
| 105 | { |
| 106 | pal4_power_off(); |
| 107 | } |
| 108 | |
| 109 | TODC_ALLOC(); |
| 110 | |
| 111 | static void __init |
| 112 | pal4_setup_arch(void) |
| 113 | { |
| 114 | unsigned long l2; |
| 115 | |
| 116 | TODC_INIT(TODC_TYPE_MK48T37, 0, 0, |
| 117 | ioremap(PAL4_NVRAM, PAL4_NVRAM_SIZE), 8); |
| 118 | |
| 119 | pal4_find_bridges(); |
| 120 | |
| 121 | #ifdef CONFIG_BLK_DEV_INITRD |
| 122 | if (initrd_start) |
| 123 | ROOT_DEV = Root_RAM0; |
| 124 | else |
| 125 | #endif |
| 126 | ROOT_DEV = Root_NFS; |
| 127 | |
| 128 | /* The L2 gets disabled in the bootloader, but all the proper |
| 129 | bits should be present from the fw, so just re-enable it */ |
| 130 | l2 = _get_L2CR(); |
| 131 | if (!(l2 & L2CR_L2E)) { |
| 132 | /* presume that it was initially set if the size is |
| 133 | still present. */ |
| 134 | if (l2 ^ L2CR_L2SIZ_MASK) |
| 135 | _set_L2CR(l2 | L2CR_L2E); |
| 136 | else |
| 137 | printk("L2 not set by firmware; left disabled.\n"); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | static void __init |
| 142 | pal4_map_io(void) |
| 143 | { |
| 144 | io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO); |
| 145 | } |
| 146 | |
| 147 | void __init |
| 148 | platform_init(unsigned long r3, unsigned long r4, unsigned long r5, |
| 149 | unsigned long r6, unsigned long r7) |
| 150 | { |
| 151 | parse_bootinfo(find_bootinfo()); |
| 152 | |
| 153 | isa_io_base = 0 /*PAL4_ISA_IO_BASE*/; |
| 154 | pci_dram_offset = 0 /*PAL4_PCI_SYS_MEM_BASE*/; |
| 155 | |
| 156 | ppc_md.setup_arch = pal4_setup_arch; |
| 157 | ppc_md.show_cpuinfo = pal4_show_cpuinfo; |
| 158 | |
| 159 | ppc_md.setup_io_mappings = pal4_map_io; |
| 160 | |
| 161 | ppc_md.init_IRQ = cpc700_init_IRQ; |
| 162 | ppc_md.get_irq = cpc700_get_irq; |
| 163 | |
| 164 | ppc_md.restart = pal4_restart; |
| 165 | ppc_md.halt = pal4_halt; |
| 166 | ppc_md.power_off = pal4_power_off; |
| 167 | |
| 168 | ppc_md.time_init = todc_time_init; |
| 169 | ppc_md.set_rtc_time = todc_set_rtc_time; |
| 170 | ppc_md.get_rtc_time = todc_get_rtc_time; |
| 171 | ppc_md.calibrate_decr = todc_calibrate_decr; |
| 172 | |
| 173 | ppc_md.nvram_read_val = todc_direct_read_val; |
| 174 | ppc_md.nvram_write_val = todc_direct_write_val; |
| 175 | } |
| 176 | |