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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [arch/] [or32/] [board/] [config.c] - Blame information for rev 67

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 marcus.erl
/*
2
 *  linux/arch/or32/board/config.c
3
 *
4
 *  or32 version
5
 *    author(s): Simon Srot (srot@opencores.org)
6
 *
7
 *  For more information about OpenRISC processors, licensing and
8
 *  design services you may contact Beyond Semiconductor at
9
 *  sales@bsemi.com or visit website http://www.bsemi.com.
10
 *
11
 * This file is subject to the terms and conditions of the GNU General Public
12
 * License.  See the file COPYING in the main directory of this archive
13
 * for more details.
14
 *
15
 * Based on m68knommu/platform/xx/config.c
16
 */
17
 
18
#include <stdarg.h>
19
#include <linux/types.h>
20
#include <linux/kernel.h>
21
#include <linux/mm.h>
22 65 AlbertVeli
#include <linux/platform_device.h>
23 62 marcus.erl
#include <linux/tty.h>
24
#include <linux/console.h>
25
#include <linux/device.h>
26
#include <linux/serial_8250.h>
27
 
28
#include <asm/system.h>
29
#include <asm/pgtable.h>
30
#include <asm/irq.h>
31
#include <asm/machdep.h>
32 65 AlbertVeli
#include <asm/mmc.h>
33 62 marcus.erl
#include <asm/serial.h>
34
 
35
// extern void register_console(void (*proc)(const char *));
36
 
37
/* Tick timer period */
38
unsigned long tick_period = SYS_TICK_PER;
39
 
40
void BSP_sched_init(void)
41
{
42
        /* Set counter period, enable timer and interrupt */
43
        mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (SYS_TICK_PER & SPR_TTMR_PERIOD));
44
}
45
 
46
void BSP_tick(void)
47
{
48
        mtspr(SPR_TTMR, SPR_TTMR_IE | SPR_TTMR_RT | (SYS_TICK_PER & SPR_TTMR_PERIOD));
49
}
50
 
51
unsigned long BSP_gettimeoffset(void)
52
{
53
        unsigned long count, result;
54
 
55
        count = mfspr(SPR_TTCR);
56
        result = count / CONFIG_OR32_SYS_CLK;
57
#if 0
58
        printk("gettimeofday offset :: cnt %d, sys_tick_per %d, result %d\n",
59
               count, CONFIG_OR32_SYS_CLK, result);
60
#endif
61
        return(result);
62
 
63
}
64
 
65
void BSP_gettod (int *yearp, int *monp, int *dayp,
66
                   int *hourp, int *minp, int *secp)
67
{
68
}
69
 
70
int BSP_hwclk(int op, struct hwclk_time *t)
71
{
72
        if (!op) {
73
                /* read */
74
        } else {
75
                /* write */
76
        }
77
        return 0;
78
}
79
 
80
int BSP_set_clock_mmss (unsigned long nowtime)
81
{
82
#if 0
83
        short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
84 65 AlbertVeli
 
85 62 marcus.erl
        tod->second1 = real_seconds / 10;
86
        tod->second2 = real_seconds % 10;
87
        tod->minute1 = real_minutes / 10;
88
        tod->minute2 = real_minutes % 10;
89
#endif
90
        return 0;
91
}
92
 
93
void BSP_reset (void)
94
{
95
        local_irq_disable();
96
}
97
 
98
void config_BSP(char *command, int len)
99
{
100
        mach_sched_init      = BSP_sched_init;
101
        mach_tick            = BSP_tick;
102
        mach_gettimeoffset   = BSP_gettimeoffset;
103
        mach_gettod          = BSP_gettod;
104
        mach_hwclk           = NULL;
105
        mach_set_clock_mmss  = NULL;
106
        mach_mksound         = NULL;
107
        mach_reset           = BSP_reset;
108
        mach_debug_init      = NULL;
109
}
110
 
111
static struct plat_serial8250_port serial_platform_data[] = {
112
        {
113
                .mapbase        = 0x90000000,
114
                .irq            = 2,
115
                .uartclk        = SYS_CLK, /*BASE_BAUD,*/
116
                .regshift       = 0,
117
                .iotype         = UPIO_MEM,
118
                .flags          = UPF_IOREMAP | UPF_BOOT_AUTOCONF,
119
        },
120
        { },
121
};
122
 
123
static struct platform_device serial_device = {
124
        .name                   = "serial8250",
125
        .id                     = PLAT8250_DEV_PLATFORM,
126
        .dev                    = {
127
                .platform_data  = serial_platform_data,
128
        },
129
};
130
 
131 65 AlbertVeli
static struct resource ocores_mmc_resources[] = {
132
        [0] = {
133
                .start  = 0xa0000000,
134
                .end    = 0xa0000100,
135
                .flags  = IORESOURCE_MEM,
136
        },
137
        [1] = {
138 66 tac2
                .name   = "cmd_irq",
139
                .start  = 3,
140
                .end    = 3,
141 65 AlbertVeli
                .flags  = IORESOURCE_IRQ,
142
        },
143 66 tac2
        [2] = {
144
                .name   = "cmd_err_irq",
145
                .start  = 4,
146
                .end    = 4,
147
                .flags  = IORESOURCE_IRQ,
148
        },
149
        [3] = {
150
                .name   = "dat_irq",
151
                .start  = 5,
152
                .end    = 5,
153
                .flags  = IORESOURCE_IRQ,
154
        },
155
 
156
 
157 65 AlbertVeli
};
158
 
159
static struct platform_device ocores_mmc_device = {
160
        .name           = "mmc-ocores",
161 67 AlbertVeli
        .id             = -1,
162 65 AlbertVeli
        .num_resources  = ARRAY_SIZE(ocores_mmc_resources),
163
        .resource       = ocores_mmc_resources,
164
};
165
 
166
static struct ocores_platform_data ocores_platform_data = {
167
        .ocr_mask       = MMC_VDD_32_33 | MMC_VDD_33_34,
168
};
169
 
170
static void __init ocores_set_mmc_info(struct ocores_platform_data *info)
171 62 marcus.erl
{
172 65 AlbertVeli
        ocores_mmc_device.dev.platform_data = info;
173
}
174
 
175
static int __init config_or32(void)
176
{
177 62 marcus.erl
        platform_device_register(&serial_device);
178 65 AlbertVeli
        platform_device_register(&ocores_mmc_device);
179
        ocores_set_mmc_info(&ocores_platform_data);
180
 
181
        return 0;
182 62 marcus.erl
}
183 65 AlbertVeli
 
184
arch_initcall(config_or32);

powered by: WebSVN 2.1.0

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