]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/m68k/platform/coldfire/m54xx.c
m68knommu: fix multi-function pin setup for FEC module on ColdFire 523x
[mirror_ubuntu-artful-kernel.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
GU
32 /* enable io pins */
33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD,
34 MCF_MBAR + MCF_PAR_PSC(0));
35 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
36 MCF_MBAR + MCF_PAR_PSC(1));
37 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
38 MCF_PAR_PSC_CTS_CTS, MCF_MBAR + MCF_PAR_PSC(2));
39 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD,
40 MCF_MBAR + MCF_PAR_PSC(3));
ea49f8ff
PDM
41}
42
43/***************************************************************************/
44
5b2e6555 45static void mcf54xx_reset(void)
ea49f8ff
PDM
46{
47 /* disable interrupts and enable the watchdog */
48 asm("movew #0x2700, %sr\n");
49 __raw_writel(0, MCF_MBAR + MCF_GPT_GMS0);
50 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_MBAR + MCF_GPT_GCIR0);
51 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
52 MCF_MBAR + MCF_GPT_GMS0);
53}
54
55/***************************************************************************/
56
88be3515
GU
57#ifdef CONFIG_MMU
58
59unsigned long num_pages;
60
61static void __init mcf54xx_bootmem_alloc(void)
62{
63 unsigned long start_pfn;
64 unsigned long memstart;
65
66 /* _rambase and _ramend will be naturally page aligned */
67 m68k_memory[0].addr = _rambase;
68 m68k_memory[0].size = _ramend - _rambase;
69
70 /* compute total pages in system */
71 num_pages = (_ramend - _rambase) >> PAGE_SHIFT;
72
73 /* page numbers */
74 memstart = PAGE_ALIGN(_ramstart);
75 min_low_pfn = _rambase >> PAGE_SHIFT;
76 start_pfn = memstart >> PAGE_SHIFT;
77 max_low_pfn = _ramend >> PAGE_SHIFT;
78 high_memory = (void *)_ramend;
79
80 m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
81 module_fixup(NULL, __start_fixup, __stop_fixup);
82
83 /* setup bootmem data */
84 m68k_setup_node(0);
85 memstart += init_bootmem_node(NODE_DATA(0), start_pfn,
86 min_low_pfn, max_low_pfn);
87 free_bootmem_node(NODE_DATA(0), memstart, _ramend - memstart);
88}
89
90#endif /* CONFIG_MMU */
91
92/***************************************************************************/
93
ea49f8ff
PDM
94void __init config_BSP(char *commandp, int size)
95{
88be3515
GU
96#ifdef CONFIG_MMU
97 mcf54xx_bootmem_alloc();
98 mmu_context_init();
99#endif
5b2e6555 100 mach_reset = mcf54xx_reset;
35aefb26 101 mach_sched_init = hw_timer_init;
5b2e6555 102 m54xx_uarts_init();
ea49f8ff
PDM
103}
104
105/***************************************************************************/