diff options
author | Greg Ungerer <gerg@snapgear.com> | 2008-02-01 02:34:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-02-01 04:55:43 -0500 |
commit | eb49e9076141756d6c8fc97663e94eead0d7fc42 (patch) | |
tree | 0f4f25315019f813aa6653aaa4c92a4fc896eeb5 /arch | |
parent | 5f84bd52f03f8606982c75dfbda8c4cc1b725fee (diff) |
m68knommu: platform setup for 528x ColdFire parts
Switch to platform style configuration for 528x ColdFire parts.
Initial support is for the UARTs. DMA support moved to common code
for all ColdFire parts.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/m68knommu/platform/528x/config.c | 86 |
1 files changed, 77 insertions, 9 deletions
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c index acbd43486d97..036e1b73d944 100644 --- a/arch/m68knommu/platform/528x/config.c +++ b/arch/m68knommu/platform/528x/config.c | |||
@@ -16,11 +16,15 @@ | |||
16 | #include <linux/param.h> | 16 | #include <linux/param.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <asm/dma.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/spi/spi.h> | ||
21 | #include <linux/spi/flash.h> | ||
22 | #include <linux/io.h> | ||
20 | #include <asm/machdep.h> | 23 | #include <asm/machdep.h> |
21 | #include <asm/coldfire.h> | 24 | #include <asm/coldfire.h> |
22 | #include <asm/mcfsim.h> | 25 | #include <asm/mcfsim.h> |
23 | #include <asm/mcfdma.h> | 26 | #include <asm/mcfuart.h> |
27 | #include <asm/mcfqspi.h> | ||
24 | 28 | ||
25 | /***************************************************************************/ | 29 | /***************************************************************************/ |
26 | 30 | ||
@@ -28,14 +32,67 @@ void coldfire_reset(void); | |||
28 | 32 | ||
29 | /***************************************************************************/ | 33 | /***************************************************************************/ |
30 | 34 | ||
31 | /* | 35 | static struct mcf_platform_uart m528x_uart_platform[] = { |
32 | * DMA channel base address table. | 36 | { |
33 | */ | 37 | .mapbase = MCF_MBAR + MCFUART_BASE1, |
34 | unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { | 38 | .irq = MCFINT_VECBASE + MCFINT_UART0, |
35 | MCF_MBAR + MCFDMA_BASE0, | 39 | }, |
40 | { | ||
41 | .mapbase = MCF_MBAR + MCFUART_BASE2, | ||
42 | .irq = MCFINT_VECBASE + MCFINT_UART0 + 1, | ||
43 | }, | ||
44 | { | ||
45 | .mapbase = MCF_MBAR + MCFUART_BASE3, | ||
46 | .irq = MCFINT_VECBASE + MCFINT_UART0 + 2, | ||
47 | }, | ||
48 | { }, | ||
36 | }; | 49 | }; |
37 | 50 | ||
38 | unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; | 51 | static struct platform_device m528x_uart = { |
52 | .name = "mcfuart", | ||
53 | .id = 0, | ||
54 | .dev.platform_data = m528x_uart_platform, | ||
55 | }; | ||
56 | |||
57 | static struct platform_device *m528x_devices[] __initdata = { | ||
58 | &m528x_uart, | ||
59 | }; | ||
60 | |||
61 | /***************************************************************************/ | ||
62 | |||
63 | #define INTC0 (MCF_MBAR + MCFICM_INTC0) | ||
64 | |||
65 | static void __init m528x_uart_init_line(int line, int irq) | ||
66 | { | ||
67 | u8 port; | ||
68 | u32 imr; | ||
69 | |||
70 | if ((line < 0) || (line > 2)) | ||
71 | return; | ||
72 | |||
73 | /* level 6, line based priority */ | ||
74 | writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line); | ||
75 | |||
76 | imr = readl(INTC0 + MCFINTC_IMRL); | ||
77 | imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1); | ||
78 | writel(imr, INTC0 + MCFINTC_IMRL); | ||
79 | |||
80 | /* make sure PUAPAR is set for UART0 and UART1 */ | ||
81 | if (line < 2) { | ||
82 | port = readb(MCF_MBAR + MCF5282_GPIO_PUAPAR); | ||
83 | port |= (0x03 << (line * 2)); | ||
84 | writeb(port, MCF_MBAR + MCF5282_GPIO_PUAPAR); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | static void __init m528x_uarts_init(void) | ||
89 | { | ||
90 | const int nrlines = ARRAY_SIZE(m528x_uart_platform); | ||
91 | int line; | ||
92 | |||
93 | for (line = 0; (line < nrlines); line++) | ||
94 | m528x_uart_init_line(line, m528x_uart_platform[line].irq); | ||
95 | } | ||
39 | 96 | ||
40 | /***************************************************************************/ | 97 | /***************************************************************************/ |
41 | 98 | ||
@@ -54,10 +111,21 @@ void mcf_autovector(unsigned int vec) | |||
54 | 111 | ||
55 | /***************************************************************************/ | 112 | /***************************************************************************/ |
56 | 113 | ||
57 | void config_BSP(char *commandp, int size) | 114 | void __init config_BSP(char *commandp, int size) |
58 | { | 115 | { |
59 | mcf_disableall(); | 116 | mcf_disableall(); |
60 | mach_reset = coldfire_reset; | 117 | mach_reset = coldfire_reset; |
61 | } | 118 | } |
62 | 119 | ||
63 | /***************************************************************************/ | 120 | /***************************************************************************/ |
121 | |||
122 | static int __init init_BSP(void) | ||
123 | { | ||
124 | m528x_uarts_init(); | ||
125 | platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices)); | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | arch_initcall(init_BSP); | ||
130 | |||
131 | /***************************************************************************/ | ||