Deleted Added
full compact
imx6_machdep.c (273561) imx6_machdep.c (276177)
1/*-
2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include "opt_platform.h"
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include "opt_platform.h"
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/imx6_machdep.c 273561 2014-10-23 22:21:22Z ian $");
30__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/imx6_machdep.c 276177 2014-12-24 12:26:43Z andrew $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/reboot.h>
36
37#include <vm/vm.h>
38
39#include <machine/bus.h>
40#include <machine/devmap.h>
41#include <machine/intr.h>
42#include <machine/machdep.h>
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/reboot.h>
36
37#include <vm/vm.h>
38
39#include <machine/bus.h>
40#include <machine/devmap.h>
41#include <machine/intr.h>
42#include <machine/machdep.h>
43#include <machine/platform.h>
43#include <machine/platformvar.h>
44
45#include <arm/arm/mpcore_timervar.h>
46#include <arm/freescale/imx/imx6_anatopreg.h>
47#include <arm/freescale/imx/imx6_anatopvar.h>
48#include <arm/freescale/imx/imx_machdep.h>
49
50#include <dev/fdt/fdt_common.h>
51#include <dev/ofw/openfirm.h>
52
44
45#include <arm/arm/mpcore_timervar.h>
46#include <arm/freescale/imx/imx6_anatopreg.h>
47#include <arm/freescale/imx/imx6_anatopvar.h>
48#include <arm/freescale/imx/imx_machdep.h>
49
50#include <dev/fdt/fdt_common.h>
51#include <dev/ofw/openfirm.h>
52
53#include "platform_if.h"
54
53struct fdt_fixup_entry fdt_fixup_table[] = {
54 { NULL, NULL }
55};
56
57static uint32_t gpio1_node;
58
59/*
60 * Work around the linux workaround for imx6 erratum 006687, in which some

--- 24 unchanged lines hidden (view full) ---

85 return (gic_decode_fdt(iparent, intr, interrupt, trig, pol));
86}
87
88fdt_pic_decode_t fdt_pic_table[] = {
89 &imx6_decode_fdt,
90 NULL
91};
92
55struct fdt_fixup_entry fdt_fixup_table[] = {
56 { NULL, NULL }
57};
58
59static uint32_t gpio1_node;
60
61/*
62 * Work around the linux workaround for imx6 erratum 006687, in which some

--- 24 unchanged lines hidden (view full) ---

87 return (gic_decode_fdt(iparent, intr, interrupt, trig, pol));
88}
89
90fdt_pic_decode_t fdt_pic_table[] = {
91 &imx6_decode_fdt,
92 NULL
93};
94
93vm_offset_t
94platform_lastaddr(void)
95static vm_offset_t
96imx6_lastaddr(platform_t plat)
95{
96
97 return (arm_devmap_lastaddr());
98}
99
97{
98
99 return (arm_devmap_lastaddr());
100}
101
100void
101platform_probe_and_attach(void)
102static int
103imx6_attach(platform_t plat)
102{
103
104 /* Inform the MPCore timer driver that its clock is variable. */
105 arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
104{
105
106 /* Inform the MPCore timer driver that its clock is variable. */
107 arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
106}
107
108
108void
109platform_gpio_init(void)
110{
111
109 return (0);
112}
113
110}
111
114void
115platform_late_init(void)
112static void
113imx6_late_init(platform_t plat)
116{
117
118 /* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */
119 gpio1_node = OF_node_from_xref(
120 OF_finddevice("/soc/aips-bus@02000000/gpio@0209c000"));
121}
122
123/*

--- 7 unchanged lines hidden (view full) ---

131 *
132 * AIPS1/AIPS2 cover most of the on-chip devices such as uart, spi, i2c, etc.
133 *
134 * Notably not mapped right now are HDMI, GPU, and other devices below ARMMP in
135 * the memory map. When we get support for graphics it might make sense to
136 * static map some of that area. Be careful with other things in that area such
137 * as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory.
138 */
114{
115
116 /* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */
117 gpio1_node = OF_node_from_xref(
118 OF_finddevice("/soc/aips-bus@02000000/gpio@0209c000"));
119}
120
121/*

--- 7 unchanged lines hidden (view full) ---

129 *
130 * AIPS1/AIPS2 cover most of the on-chip devices such as uart, spi, i2c, etc.
131 *
132 * Notably not mapped right now are HDMI, GPU, and other devices below ARMMP in
133 * the memory map. When we get support for graphics it might make sense to
134 * static map some of that area. Be careful with other things in that area such
135 * as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory.
136 */
139int
140platform_devmap_init(void)
137static int
138imx6_devmap_init(platform_t plat)
141{
142 const uint32_t IMX6_ARMMP_PHYS = 0x00a00000;
143 const uint32_t IMX6_ARMMP_SIZE = 0x00100000;
144 const uint32_t IMX6_AIPS1_PHYS = 0x02000000;
145 const uint32_t IMX6_AIPS1_SIZE = 0x00100000;
146 const uint32_t IMX6_AIPS2_PHYS = 0x02100000;
147 const uint32_t IMX6_AIPS2_SIZE = 0x00100000;
148

--- 117 unchanged lines hidden (view full) ---

266
267 while ((*UART_STAT_REG & UART_TXRDY) == 0)
268 continue;
269 *UART_TX_REG = c;
270}
271early_putc_t *early_putc = imx6_early_putc;
272#endif
273
139{
140 const uint32_t IMX6_ARMMP_PHYS = 0x00a00000;
141 const uint32_t IMX6_ARMMP_SIZE = 0x00100000;
142 const uint32_t IMX6_AIPS1_PHYS = 0x02000000;
143 const uint32_t IMX6_AIPS1_SIZE = 0x00100000;
144 const uint32_t IMX6_AIPS2_PHYS = 0x02100000;
145 const uint32_t IMX6_AIPS2_SIZE = 0x00100000;
146

--- 117 unchanged lines hidden (view full) ---

264
265 while ((*UART_STAT_REG & UART_TXRDY) == 0)
266 continue;
267 *UART_TX_REG = c;
268}
269early_putc_t *early_putc = imx6_early_putc;
270#endif
271
272static platform_method_t imx6_methods[] = {
273 PLATFORMMETHOD(platform_attach, imx6_attach),
274 PLATFORMMETHOD(platform_lastaddr, imx6_lastaddr),
275 PLATFORMMETHOD(platform_devmap_init, imx6_devmap_init),
276 PLATFORMMETHOD(platform_late_init, imx6_late_init),
277
278 PLATFORMMETHOD_END,
279};
280
281FDT_PLATFORM_DEF2(imx6, imx6s, "i.MX6 Solo", 0, "fsl,imx6s");
282FDT_PLATFORM_DEF2(imx6, imx6d, "i.MX6 Dual", 0, "fsl,imx6d");
283FDT_PLATFORM_DEF2(imx6, imx6q, "i.MX6 Quad", 0, "fsl,imx6q");