Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/arch/m68k/platform/54xx/config.c
10819 views
1
/***************************************************************************/
2
3
/*
4
* linux/arch/m68knommu/platform/54xx/config.c
5
*
6
* Copyright (C) 2010, Philippe De Muyter <[email protected]>
7
*/
8
9
/***************************************************************************/
10
11
#include <linux/kernel.h>
12
#include <linux/param.h>
13
#include <linux/init.h>
14
#include <linux/interrupt.h>
15
#include <linux/io.h>
16
#include <asm/machdep.h>
17
#include <asm/coldfire.h>
18
#include <asm/m54xxsim.h>
19
#include <asm/mcfuart.h>
20
#include <asm/m54xxgpt.h>
21
22
/***************************************************************************/
23
24
static struct mcf_platform_uart m54xx_uart_platform[] = {
25
{
26
.mapbase = MCF_MBAR + MCFUART_BASE1,
27
.irq = 64 + 35,
28
},
29
{
30
.mapbase = MCF_MBAR + MCFUART_BASE2,
31
.irq = 64 + 34,
32
},
33
{
34
.mapbase = MCF_MBAR + MCFUART_BASE3,
35
.irq = 64 + 33,
36
},
37
{
38
.mapbase = MCF_MBAR + MCFUART_BASE4,
39
.irq = 64 + 32,
40
},
41
};
42
43
static struct platform_device m54xx_uart = {
44
.name = "mcfuart",
45
.id = 0,
46
.dev.platform_data = m54xx_uart_platform,
47
};
48
49
static struct platform_device *m54xx_devices[] __initdata = {
50
&m54xx_uart,
51
};
52
53
54
/***************************************************************************/
55
56
static void __init m54xx_uart_init_line(int line, int irq)
57
{
58
int rts_cts;
59
60
/* enable io pins */
61
switch (line) {
62
case 0:
63
rts_cts = 0; break;
64
case 1:
65
rts_cts = MCF_PAR_PSC_RTS_RTS; break;
66
case 2:
67
rts_cts = MCF_PAR_PSC_RTS_RTS | MCF_PAR_PSC_CTS_CTS; break;
68
case 3:
69
rts_cts = 0; break;
70
}
71
__raw_writeb(MCF_PAR_PSC_TXD | rts_cts | MCF_PAR_PSC_RXD,
72
MCF_MBAR + MCF_PAR_PSC(line));
73
}
74
75
static void __init m54xx_uarts_init(void)
76
{
77
const int nrlines = ARRAY_SIZE(m54xx_uart_platform);
78
int line;
79
80
for (line = 0; (line < nrlines); line++)
81
m54xx_uart_init_line(line, m54xx_uart_platform[line].irq);
82
}
83
84
/***************************************************************************/
85
86
static void mcf54xx_reset(void)
87
{
88
/* disable interrupts and enable the watchdog */
89
asm("movew #0x2700, %sr\n");
90
__raw_writel(0, MCF_MBAR + MCF_GPT_GMS0);
91
__raw_writel(MCF_GPT_GCIR_CNT(1), MCF_MBAR + MCF_GPT_GCIR0);
92
__raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
93
MCF_MBAR + MCF_GPT_GMS0);
94
}
95
96
/***************************************************************************/
97
98
void __init config_BSP(char *commandp, int size)
99
{
100
mach_reset = mcf54xx_reset;
101
m54xx_uarts_init();
102
}
103
104
/***************************************************************************/
105
106
static int __init init_BSP(void)
107
{
108
109
platform_add_devices(m54xx_devices, ARRAY_SIZE(m54xx_devices));
110
return 0;
111
}
112
113
arch_initcall(init_BSP);
114
115
/***************************************************************************/
116
117