| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $ */ | | 1 | /* $NetBSD: tegra_car.c,v 1.28 2015/11/19 22:26:48 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2015 Jared D. 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. |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
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 "locators.h" | | 29 | #include "locators.h" |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.28 2015/11/19 22:26:48 jmcneill Exp $"); |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/bus.h> | | 35 | #include <sys/bus.h> |
36 | #include <sys/device.h> | | 36 | #include <sys/device.h> |
37 | #include <sys/intr.h> | | 37 | #include <sys/intr.h> |
38 | #include <sys/systm.h> | | 38 | #include <sys/systm.h> |
39 | #include <sys/kernel.h> | | 39 | #include <sys/kernel.h> |
40 | #include <sys/rndpool.h> | | 40 | #include <sys/rndpool.h> |
41 | #include <sys/rndsource.h> | | 41 | #include <sys/rndsource.h> |
42 | | | 42 | |
43 | #include <arm/nvidia/tegra_reg.h> | | 43 | #include <arm/nvidia/tegra_reg.h> |
44 | #include <arm/nvidia/tegra_carreg.h> | | 44 | #include <arm/nvidia/tegra_carreg.h> |
45 | #include <arm/nvidia/tegra_pmcreg.h> | | 45 | #include <arm/nvidia/tegra_pmcreg.h> |
| @@ -86,32 +86,32 @@ tegra_car_attach(device_t parent, device | | | @@ -86,32 +86,32 @@ tegra_car_attach(device_t parent, device |
86 | sc->sc_dev = self; | | 86 | sc->sc_dev = self; |
87 | sc->sc_bst = tio->tio_bst; | | 87 | sc->sc_bst = tio->tio_bst; |
88 | bus_space_subregion(tio->tio_bst, tio->tio_bsh, | | 88 | bus_space_subregion(tio->tio_bst, tio->tio_bsh, |
89 | loc->loc_offset, loc->loc_size, &sc->sc_bsh); | | 89 | loc->loc_offset, loc->loc_size, &sc->sc_bsh); |
90 | | | 90 | |
91 | KASSERT(pmc_softc == NULL); | | 91 | KASSERT(pmc_softc == NULL); |
92 | pmc_softc = sc; | | 92 | pmc_softc = sc; |
93 | | | 93 | |
94 | aprint_naive("\n"); | | 94 | aprint_naive("\n"); |
95 | aprint_normal(": CAR\n"); | | 95 | aprint_normal(": CAR\n"); |
96 | | | 96 | |
97 | tegra_car_init(sc); | | 97 | tegra_car_init(sc); |
98 | | | 98 | |
99 | aprint_verbose_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate()); | | 99 | aprint_debug_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate()); |
100 | aprint_verbose_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate()); | | 100 | aprint_debug_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate()); |
101 | aprint_verbose_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate()); | | 101 | aprint_debug_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate()); |
102 | aprint_verbose_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate()); | | 102 | aprint_debug_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate()); |
103 | aprint_verbose_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate()); | | 103 | aprint_debug_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate()); |
104 | aprint_verbose_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate()); | | 104 | aprint_debug_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate()); |
105 | | | 105 | |
106 | config_interrupts(self, tegra_car_rnd_attach); | | 106 | config_interrupts(self, tegra_car_rnd_attach); |
107 | } | | 107 | } |
108 | | | 108 | |
109 | static void | | 109 | static void |
110 | tegra_car_init(struct tegra_car_softc *sc) | | 110 | tegra_car_init(struct tegra_car_softc *sc) |
111 | { | | 111 | { |
112 | bus_space_tag_t bst = sc->sc_bst; | | 112 | bus_space_tag_t bst = sc->sc_bst; |
113 | bus_space_handle_t bsh = sc->sc_bsh; | | 113 | bus_space_handle_t bsh = sc->sc_bsh; |
114 | | | 114 | |
115 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | | 115 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, |
116 | __SHIFTIN(1, CAR_PLLD2_BASE_MDIV) | | | 116 | __SHIFTIN(1, CAR_PLLD2_BASE_MDIV) | |
117 | __SHIFTIN(99, CAR_PLLD2_BASE_NDIV) | | | 117 | __SHIFTIN(99, CAR_PLLD2_BASE_NDIV) | |