| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */ | | 1 | /* $NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2017-2019 Jared McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2017-2019 Jared McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,44 +17,45 @@ | | | @@ -17,44 +17,45 @@ |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $"); |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/bus.h> | | 33 | #include <sys/bus.h> |
34 | #include <sys/cpu.h> | | 34 | #include <sys/cpu.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | | | 36 | |
37 | #include <dev/fdt/fdtvar.h> | | 37 | #include <dev/fdt/fdtvar.h> |
38 | | | 38 | |
39 | #include <dev/clk/clk_backend.h> | | 39 | #include <dev/clk/clk_backend.h> |
40 | | | 40 | |
41 | #define RESET_REG(index) (((index) / 32) * 4) | | 41 | #define RESET_REG(index) (((index) / 32) * 4) |
42 | #define RESET_MASK(index) __BIT((index) % 32) | | 42 | #define RESET_MASK(index) __BIT((index) % 32) |
43 | | | 43 | |
44 | #define LEVEL_OFFSET 0x7c | | 44 | #define LEVEL_OFFSET 0x7c |
45 | | | 45 | |
46 | static const char * compatible[] = { | | 46 | static const char * compatible[] = { |
47 | "amlogic,meson8b-reset", | | 47 | "amlogic,meson8b-reset", |
| | | 48 | "amlogic,meson-axg-reset", |
48 | "amlogic,meson-gxbb-reset", | | 49 | "amlogic,meson-gxbb-reset", |
49 | NULL | | 50 | NULL |
50 | }; | | 51 | }; |
51 | | | 52 | |
52 | struct meson_resets_softc { | | 53 | struct meson_resets_softc { |
53 | device_t sc_dev; | | 54 | device_t sc_dev; |
54 | bus_space_tag_t sc_bst; | | 55 | bus_space_tag_t sc_bst; |
55 | bus_space_handle_t sc_bsh; | | 56 | bus_space_handle_t sc_bsh; |
56 | }; | | 57 | }; |
57 | | | 58 | |
58 | #define RESET_READ(sc, reg) \ | | 59 | #define RESET_READ(sc, reg) \ |
59 | bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) | | 60 | bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) |
60 | #define RESET_WRITE(sc, reg, val) \ | | 61 | #define RESET_WRITE(sc, reg, val) \ |