m68knommu: clean up ColdFire 54xx General Timer definitions
[deliverable/linux.git] / arch / m68k / platform / coldfire / m54xx.c
CommitLineData
ea49f8ff
PDM
1/***************************************************************************/
2
3/*
5b2e6555 4 * linux/arch/m68knommu/platform/54xx/config.c
ea49f8ff
PDM
5 *
6 * Copyright (C) 2010, Philippe De Muyter <phdm@macqel.be>
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>
88be3515
GU
16#include <linux/mm.h>
17#include <linux/bootmem.h>
18#include <asm/pgalloc.h>
ea49f8ff
PDM
19#include <asm/machdep.h>
20#include <asm/coldfire.h>
5b2e6555 21#include <asm/m54xxsim.h>
ea49f8ff 22#include <asm/mcfuart.h>
5b2e6555 23#include <asm/m54xxgpt.h>
88be3515
GU
24#ifdef CONFIG_MMU
25#include <asm/mmu_context.h>
26#endif
ea49f8ff 27
ea49f8ff
PDM
28/***************************************************************************/
29
5b2e6555 30static void __init m54xx_uarts_init(void)
ea49f8ff 31{
b9a0c3f8 32 /* enable io pins */
632306f2 33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
b9a0c3f8 34 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
632306f2 35 MCFGPIO_PAR_PSC1);
b9a0c3f8 36 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
632306f2
GU
37 MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
38 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
ea49f8ff
PDM
39}
40
41/***************************************************************************/
42
5b2e6555 43static void mcf54xx_reset(void)
ea49f8ff
PDM
44{
45 /* disable interrupts and enable the watchdog */
46 asm("movew #0x2700, %sr\n");
944c3d81
GU
47 __raw_writel(0, MCF_GPT_GMS0);
48 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
ea49f8ff 49 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
944c3d81 50 MCF_GPT_GMS0);
ea49f8ff
PDM
51}
52
53/***************************************************************************/
54
88be3515
GU
55#ifdef CONFIG_MMU
56
57unsigned long num_pages;
58
59static void __init mcf54xx_bootmem_alloc(void)
60{
61 unsigned long start_pfn;
62 unsigned long memstart;
63
64 /* _rambase and _ramend will be naturally page aligned */
65 m68k_memory[0].addr = _rambase;
66 m68k_memory[0].size = _ramend - _rambase;
67
68 /* compute total pages in system */
69 num_pages = (_ramend - _rambase) >> PAGE_SHIFT;
70
71 /* page numbers */
72 memstart = PAGE_ALIGN(_ramstart);
73 min_low_pfn = _rambase >> PAGE_SHIFT;
74 start_pfn = memstart >> PAGE_SHIFT;
75 max_low_pfn = _ramend >> PAGE_SHIFT;
76 high_memory = (void *)_ramend;
77
78 m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
79 module_fixup(NULL, __start_fixup, __stop_fixup);
80
81 /* setup bootmem data */
82 m68k_setup_node(0);
83 memstart += init_bootmem_node(NODE_DATA(0), start_pfn,
84 min_low_pfn, max_low_pfn);
85 free_bootmem_node(NODE_DATA(0), memstart, _ramend - memstart);
86}
87
88#endif /* CONFIG_MMU */
89
90/***************************************************************************/
91
ea49f8ff
PDM
92void __init config_BSP(char *commandp, int size)
93{
88be3515
GU
94#ifdef CONFIG_MMU
95 mcf54xx_bootmem_alloc();
96 mmu_context_init();
97#endif
5b2e6555 98 mach_reset = mcf54xx_reset;
35aefb26 99 mach_sched_init = hw_timer_init;
5b2e6555 100 m54xx_uarts_init();
ea49f8ff
PDM
101}
102
103/***************************************************************************/
This page took 0.146436 seconds and 5 git commands to generate.