This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / ppc / platforms / sbc82xx.c
1 /*
2  * arch/ppc/platforms/sbc82xx.c
3  *
4  * SBC82XX platform support
5  *
6  * Author: Guy Streeter <streeter@redhat.com>
7  *
8  * Derived from: est8260_setup.c by Allen Curtis, ONZ
9  *
10  * Copyright 2004 Red Hat, Inc.
11  *
12  * This program is free software; you can redistribute  it and/or modify it
13  * under  the terms of  the GNU General  Public License as published by the
14  * Free Software Foundation;  either version 2 of the  License, or (at your
15  * option) any later version.
16  */
17
18 #include <linux/config.h>
19 #include <linux/seq_file.h>
20 #include <linux/stddef.h>
21
22 #include <asm/mpc8260.h>
23 #include <asm/machdep.h>
24 #include <asm/io.h>
25 #include <asm/todc.h>
26 #include <asm/immap_8260.h>
27
28 static void (*callback_setup_arch)(void);
29
30 extern unsigned char __res[sizeof(bd_t)];
31
32 extern void m8260_init(unsigned long r3, unsigned long r4,
33         unsigned long r5, unsigned long r6, unsigned long r7);
34
35 extern void (*late_time_init)(void);
36
37 static int
38 sbc82xx_show_cpuinfo(struct seq_file *m)
39 {
40         bd_t    *binfo = (bd_t *)__res;
41
42         seq_printf(m, "vendor\t\t: Wind River\n"
43                       "machine\t\t: SBC PowerQUICC II\n"
44                       "\n"
45                       "mem size\t\t: 0x%08lx\n"
46                       "console baud\t\t: %ld\n"
47                       "\n",
48                       binfo->bi_memsize,
49                       binfo->bi_baudrate);
50         return 0;
51 }
52
53 static void __init
54 sbc82xx_setup_arch(void)
55 {
56         printk("SBC PowerQUICC II Port\n");
57         callback_setup_arch();
58 }
59
60 TODC_ALLOC();
61
62 /*
63  * Timer init happens before mem_init but after paging init, so we cannot
64  * directly use ioremap() at that time.
65  * late_time_init() is call after paging init.
66  */
67 #ifdef CONFIG_GEN_RTC
68 static void sbc82xx_time_init(void)
69 {
70         volatile memctl8260_t *mc = &immr->im_memctl;
71         TODC_INIT(TODC_TYPE_MK48T59, 0, 0, SBC82xx_TODC_NVRAM_ADDR, 0);
72
73         /* Set up CS11 for RTC chip */
74         mc->memc_br11=0;
75         mc->memc_or11=0xffff0836;
76         mc->memc_br11=0x80000801;
77
78         todc_info->nvram_data =
79                 (unsigned int)ioremap(todc_info->nvram_data, 0x2000);
80         BUG_ON(!todc_info->nvram_data);
81         ppc_md.get_rtc_time     = todc_get_rtc_time;
82         ppc_md.set_rtc_time     = todc_set_rtc_time;
83         ppc_md.nvram_read_val   = todc_direct_read_val;
84         ppc_md.nvram_write_val  = todc_direct_write_val;
85         todc_time_init();
86 }
87 #endif /* CONFIG_GEN_RTC */
88
89 void __init
90 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
91               unsigned long r6, unsigned long r7)
92 {
93         /* Generic 8260 platform initialization */
94         m8260_init(r3, r4, r5, r6, r7);
95
96         /* u-boot may be using one of the FCC Ethernet devices.
97            Use the MAC address to the SCC. */
98         __res[offsetof(bd_t, bi_enetaddr[5])] &= ~3;
99
100         /* Anything special for this platform */
101         ppc_md.show_cpuinfo     = sbc82xx_show_cpuinfo;
102
103         callback_setup_arch     = ppc_md.setup_arch;
104         ppc_md.setup_arch       = sbc82xx_setup_arch;
105 #ifdef CONFIG_GEN_RTC
106         ppc_md.time_init        = NULL;
107         ppc_md.get_rtc_time     = NULL;
108         ppc_md.set_rtc_time     = NULL;
109         ppc_md.nvram_read_val   = NULL;
110         ppc_md.nvram_write_val  = NULL;
111         late_time_init          = sbc82xx_time_init;
112 #endif /* CONFIG_GEN_RTC */
113 }