Lines Matching +full:sys +full:- +full:syscon

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
28 #include <sys/param.h>
29 #include <sys/systm.h>
30 #include <sys/bus.h>
32 #include <sys/kernel.h>
33 #include <sys/module.h>
34 #include <sys/rman.h>
35 #include <sys/lock.h>
36 #include <sys/mutex.h>
37 #include <sys/sysctl.h>
42 #include <dev/syscon/syscon.h>
49 #define CONTROL0 0 /* Offset in config->regs[] array */
61 #define CONTROL1 1 /* Offset in config->regs[] array */
66 #define STATUS 2 /* Offset in config->regs[] array */
87 struct syscon *syscon; member
99 .calib_add = -150000,
116 {"marvell,armada-ap806-thermal", (uintptr_t) &mv_ap806_config},
117 {"marvell,armada-cp110-thermal", (uintptr_t) &mv_cp110_config},
122 SYSCON_READ_4((sc)->syscon, sc->config->regs[reg])
124 SYSCON_WRITE_4((sc)->syscon, sc->config->regs[reg], (val))
130 shift = 31 - index; in sign_extend()
141 while (--timeout > 0) { in mv_thermal_wait_sensor()
143 if ((reg & sc->config->valid_mask) == sc->config->valid_mask) in mv_thermal_wait_sensor()
159 if (sc->cur_sensor == sensor) in mv_thermal_select_sensor()
179 reg |= (sensor - 1) << CONTROL0_CHANNEL_SHIFT; in mv_thermal_select_sensor()
182 sc->cur_sensor = sensor; in mv_thermal_select_sensor()
204 if (sc->config->signed_value) in mv_thermal_read_sensor()
205 sample = sign_extend(reg, fls(STATUS_TEMP_MASK) - 1); in mv_thermal_read_sensor()
209 *temp = ((sample * sc->config->calib_mul) - sc->config->calib_add) / in mv_thermal_read_sensor()
210 sc->config->calib_div; in mv_thermal_read_sensor()
263 mtx_lock(&(sc)->mtx); in mv_thermal_sysctl()
272 mtx_unlock(&(sc)->mtx); in mv_thermal_sysctl()
283 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in mv_thermal_probe()
301 sc->dev = dev; in mv_thermal_attach()
303 sc->config = (struct mv_thermal_config *) in mv_thermal_attach()
304 ofw_bus_search_compatible(dev, compat_data)->ocd_data; in mv_thermal_attach()
306 mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); in mv_thermal_attach()
308 if (SYSCON_GET_HANDLE(sc->dev, &sc->syscon) != 0 || in mv_thermal_attach()
309 sc->syscon == NULL) { in mv_thermal_attach()
310 device_printf(dev, "cannot get syscon for device\n"); in mv_thermal_attach()
314 sc->cur_sensor = -1; in mv_thermal_attach()
315 switch (sc->config->type) { in mv_thermal_attach()
333 for (i = 0; i < sc->config->ncpus; i++) { in mv_thermal_attach()