1 /* $OpenBSD: am335x.c,v 1.12 2020/03/31 10:33:10 kettenis Exp $ */
2
3 /*
4 * Copyright (c) 2011 Uwe Stuehler <uwe@openbsd.org>
5 * Copyright (c) 2013 Raphael Graf <r@undefined.ch>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #include <sys/param.h>
21 #include <machine/bus.h>
22
23 #include <armv7/armv7/armv7var.h>
24
25 #define PRCM_SIZE 0x2000
26 #define PRCM_ADDR 0x44E00000
27
28 #define DMTIMERx_SIZE 0x80
29 #define DMTIMER0_ADDR 0x44E05000
30 #define DMTIMER1_ADDR 0x44E31000 /* 1MS */
31 #define DMTIMER2_ADDR 0x48040000
32 #define DMTIMER3_ADDR 0x48042000
33 #define DMTIMER4_ADDR 0x48044000
34 #define DMTIMER5_ADDR 0x48046000
35 #define DMTIMER6_ADDR 0x48048000
36 #define DMTIMER7_ADDR 0x4804A000
37 #define DMTIMER0_IRQ 66
38 #define DMTIMER1_IRQ 67
39 #define DMTIMER2_IRQ 68
40 #define DMTIMER3_IRQ 69
41 #define DMTIMER4_IRQ 92
42 #define DMTIMER5_IRQ 93
43 #define DMTIMER6_IRQ 94
44 #define DMTIMER7_IRQ 95
45
46 struct armv7_dev am335x_devs[] = {
47
48 /*
49 * Power, Reset and Clock Manager
50 */
51
52 { .name = "prcm",
53 .unit = 0,
54 .mem = { { PRCM_ADDR, PRCM_SIZE } },
55 },
56
57 /*
58 * General Purpose Timers
59 */
60
61 { .name = "dmtimer",
62 .unit = 0,
63 .mem = { { DMTIMER2_ADDR, DMTIMERx_SIZE } },
64 .irq = { DMTIMER2_IRQ }
65 },
66
67 { .name = "dmtimer",
68 .unit = 1,
69 .mem = { { DMTIMER3_ADDR, DMTIMERx_SIZE } },
70 .irq = { DMTIMER3_IRQ }
71 },
72
73 /* Terminator */
74 { .name = NULL,
75 .unit = 0
76 }
77 };
78
79 void
am335x_init(void)80 am335x_init(void)
81 {
82 armv7_set_devs(am335x_devs);
83 }
84