OpenCores
URL https://opencores.org/ocsvn/or1k_soc_on_altera_embedded_dev_kit/or1k_soc_on_altera_embedded_dev_kit/trunk

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [arch/] [or32/] [board/] [config.c] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 xianfeng
/*
2
 *  linux/arch/or32/board/config.c
3
 *
4
 *  or32 version
5
 *    author(s): Simon Srot (srot@opencores.org) and OpenCores.org
6
 *
7
 * This file is subject to the terms and conditions of the GNU General Public
8
 * License.  See the file COPYING in the main directory of this archive
9
 * for more details.
10
 *
11
 * Based on m68knommu/platform/xx/config.c
12
 */
13
 
14
#include <stdarg.h>
15
#include <linux/types.h>
16
#include <linux/kernel.h>
17
#include <linux/mm.h>
18
#include <linux/tty.h>
19
#include <linux/console.h>
20
#include <linux/device.h>
21
#include <linux/serial_8250.h>
22
 
23
#include <asm/system.h>
24
#include <asm/pgtable.h>
25
#include <asm/irq.h>
26
#include <asm/machdep.h>
27
#include <asm/serial.h>
28
 
29
// extern void register_console(void (*proc)(const char *));
30
 
31
/* Tick timer period */
32
unsigned long tick_period = SYS_TICK_PER;
33
 
34
void BSP_sched_init(void)
35
{
36
        /* Set counter period, enable timer and interrupt */
37
        mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (SYS_TICK_PER & SPR_TTMR_PERIOD));
38
}
39
 
40
void BSP_tick(void)
41
{
42
        mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (SYS_TICK_PER & SPR_TTMR_PERIOD));
43
}
44
 
45
unsigned long BSP_gettimeoffset(void)
46
{
47
        unsigned long count, result;
48
 
49
        count = mfspr(SPR_TTCR);
50
        result = count / CONFIG_OR32_SYS_CLK;
51
#if 0
52
        printk("gettimeofday offset :: cnt %d, sys_tick_per %d, result %d\n",
53
               count, CONFIG_OR32_SYS_CLK, result);
54
#endif
55
        return(result);
56
 
57
}
58
 
59
void BSP_gettod (int *yearp, int *monp, int *dayp,
60
                   int *hourp, int *minp, int *secp)
61
{
62
}
63
 
64
int BSP_hwclk(int op, struct hwclk_time *t)
65
{
66
        if (!op) {
67
                /* read */
68
        } else {
69
                /* write */
70
        }
71
        return 0;
72
}
73
 
74
int BSP_set_clock_mmss (unsigned long nowtime)
75
{
76
#if 0
77
        short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
78
 
79
        tod->second1 = real_seconds / 10;
80
        tod->second2 = real_seconds % 10;
81
        tod->minute1 = real_minutes / 10;
82
        tod->minute2 = real_minutes % 10;
83
#endif
84
        return 0;
85
}
86
 
87
void BSP_reset (void)
88
{
89
        local_irq_disable();
90
}
91
 
92
void config_BSP(char *command, int len)
93
{
94
        mach_sched_init      = BSP_sched_init;
95
        mach_tick            = BSP_tick;
96
        mach_gettimeoffset   = BSP_gettimeoffset;
97
        mach_gettod          = BSP_gettod;
98
        mach_hwclk           = NULL;
99
        mach_set_clock_mmss  = NULL;
100
        mach_mksound         = NULL;
101
        mach_reset           = BSP_reset;
102
        mach_debug_init      = NULL;
103
}
104
 
105
static struct plat_serial8250_port serial_platform_data[] = {
106
        {
107
                .mapbase        = 0x90000000,
108
                .irq            = 2,
109
                .uartclk        = SYS_CLK, /*BASE_BAUD, --jb*/
110
                .regshift       = 0,
111
                .iotype         = UPIO_MEM,
112
                .flags          = UPF_IOREMAP | UPF_BOOT_AUTOCONF,
113
        },
114
        { },
115
};
116
 
117
static struct platform_device serial_device = {
118
        .name                   = "serial8250",
119
        .id                     = PLAT8250_DEV_PLATFORM,
120
        .dev                    = {
121
                .platform_data  = serial_platform_data,
122
        },
123
};
124
 
125
void __init config_serial(void)
126
{
127
        platform_device_register(&serial_device);
128
}
129
arch_initcall(config_serial);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.