| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pl061gpio_fdt.c,v 1.3 2018/10/15 23:50:48 jmcneill Exp $ */ | | 1 | /* $NetBSD: pl061gpio_fdt.c,v 1.4 2018/10/15 23:53:47 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2018 Jonathan A. Kollasch | | 4 | * Copyright (c) 2018 Jonathan A. Kollasch |
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,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
20 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | 20 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
23 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 23 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: pl061gpio_fdt.c,v 1.3 2018/10/15 23:50:48 jmcneill Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: pl061gpio_fdt.c,v 1.4 2018/10/15 23:53:47 jmcneill 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/device.h> | | 34 | #include <sys/device.h> |
35 | #include <sys/intr.h> | | 35 | #include <sys/intr.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/kernel.h> | | 37 | #include <sys/kernel.h> |
38 | #include <sys/kmem.h> | | 38 | #include <sys/kmem.h> |
39 | #include <sys/gpio.h> | | 39 | #include <sys/gpio.h> |
40 | | | 40 | |
41 | #include <dev/gpio/gpiovar.h> | | 41 | #include <dev/gpio/gpiovar.h> |
42 | | | 42 | |
43 | #include <dev/ic/pl061reg.h> | | 43 | #include <dev/ic/pl061reg.h> |
| @@ -88,27 +88,27 @@ plgpio_fdt_attach(device_t parent, devic | | | @@ -88,27 +88,27 @@ plgpio_fdt_attach(device_t parent, devic |
88 | { | | 88 | { |
89 | struct plgpio_softc * const sc = device_private(self); | | 89 | struct plgpio_softc * const sc = device_private(self); |
90 | struct fdt_attach_args * const faa = aux; | | 90 | struct fdt_attach_args * const faa = aux; |
91 | bus_addr_t addr; | | 91 | bus_addr_t addr; |
92 | bus_size_t size; | | 92 | bus_size_t size; |
93 | int error; | | 93 | int error; |
94 | | | 94 | |
95 | if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) { | | 95 | if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) { |
96 | aprint_error(": couldn't get registers\n"); | | 96 | aprint_error(": couldn't get registers\n"); |
97 | return; | | 97 | return; |
98 | } | | 98 | } |
99 | | | 99 | |
100 | sc->sc_dev = self; | | 100 | sc->sc_dev = self; |
101 | sc->sc_bst = faa->faa_a4x_bst; | | 101 | sc->sc_bst = faa->faa_bst; |
102 | error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh); | | 102 | error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh); |
103 | if (error) { | | 103 | if (error) { |
104 | aprint_error(": couldn't map %#"PRIx64": %d", (uint64_t)addr, error); | | 104 | aprint_error(": couldn't map %#"PRIx64": %d", (uint64_t)addr, error); |
105 | return; | | 105 | return; |
106 | } | | 106 | } |
107 | | | 107 | |
108 | aprint_naive("\n"); | | 108 | aprint_naive("\n"); |
109 | aprint_normal(": GPIO\n"); | | 109 | aprint_normal(": GPIO\n"); |
110 | | | 110 | |
111 | plgpio_attach(sc); | | 111 | plgpio_attach(sc); |
112 | | | 112 | |
113 | fdtbus_register_gpio_controller(self, faa->faa_phandle, | | 113 | fdtbus_register_gpio_controller(self, faa->faa_phandle, |
114 | &plgpio_fdt_funcs); | | 114 | &plgpio_fdt_funcs); |