]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/arm/freescale/imx/imx53_machdep.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / arm / freescale / imx / imx53_machdep.c
1 /*-
2  * Copyright (c) 1994-1998 Mark Brinicombe.
3  * Copyright (c) 1994 Brini.
4  * Copyright (c) 2012, 2013 The FreeBSD Foundation
5  * All rights reserved.
6  *
7  * This code is derived from software written for Brini by Mark Brinicombe
8  * Portions of this software were developed by Oleksandr Rybalko
9  * under sponsorship from the FreeBSD Foundation.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgement:
21  *      This product includes software developed by Brini.
22  * 4. The name of the company nor the name of the author may be used to
23  *    endorse or promote products derived from this software without specific
24  *    prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
27  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  */
38
39 #include "opt_platform.h"
40
41 #include <sys/cdefs.h>
42 __FBSDID("$FreeBSD$");
43
44 #define _ARM32_BUS_DMA_PRIVATE
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/bus.h>
48 #include <sys/reboot.h>
49
50 #include <vm/vm.h>
51 #include <vm/pmap.h>
52
53 #include <machine/bus.h>
54 #include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */
55 #include <machine/machdep.h>
56 #include <machine/pmap.h>
57
58 #include <dev/fdt/fdt_common.h>
59
60 #define IMX53_DEV_VIRT_BASE     0xe0000000
61
62 vm_offset_t
63 initarm_lastaddr(void)
64 {
65
66         boothowto |= RB_VERBOSE|RB_MULTIPLE;
67         bootverbose = 1;
68
69         if (fdt_immr_addr(IMX53_DEV_VIRT_BASE) != 0)
70                 while (1);
71
72         /* Platform-specific initialisation */
73         return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE);
74 }
75
76 /*
77  * Set initial values of GPIO output ports
78  */
79 void
80 initarm_gpio_init(void)
81 {
82
83 }
84
85 void
86 initarm_late_init(void)
87 {
88
89 }
90
91 #define FDT_DEVMAP_MAX  2
92 static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
93         { 0, 0, 0, 0, 0, },
94         { 0, 0, 0, 0, 0, }
95 };
96
97 /*
98  * Construct pmap_devmap[] with DT-derived config data.
99  */
100 int
101 platform_devmap_init(void)
102 {
103
104         /*
105          * Map segment where UART1 and UART2 located.
106          */
107         fdt_devmap[0].pd_va = IMX53_DEV_VIRT_BASE + 0x03f00000;
108         fdt_devmap[0].pd_pa = 0x53f00000;
109         fdt_devmap[0].pd_size = 0x00100000;
110         fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
111         fdt_devmap[0].pd_cache = PTE_NOCACHE;
112
113         pmap_devmap_bootstrap_table = &fdt_devmap[0];
114
115         return (0);
116 }
117
118 struct arm32_dma_range *
119 bus_dma_get_range(void)
120 {
121
122         return (NULL);
123 }
124
125 int
126 bus_dma_get_range_nb(void)
127 {
128
129         return (0);
130 }
131
132 void
133 cpu_reset(void)
134 {
135
136         printf("Reset ...\n");
137         /* Clear n_reset flag */
138         *((volatile u_int16_t *)(IMX53_DEV_VIRT_BASE + 0x03f98000)) =
139             (u_int16_t)0;
140         while (1);
141 }