timer.c (294436) | timer.c (294437) |
---|---|
1/*- 2 * Copyright (c) 2006 Benno Rice. 3 * Copyright (C) 2007-2008 MARVELL INTERNATIONAL LTD. 4 * All rights reserved. 5 * 6 * Adapted to Marvell SoC by Semihalf. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * from: FreeBSD: //depot/projects/arm/src/sys/arm/xscale/pxa2x0/pxa2x0_timer.c, rev 1 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 Benno Rice. 3 * Copyright (C) 2007-2008 MARVELL INTERNATIONAL LTD. 4 * All rights reserved. 5 * 6 * Adapted to Marvell SoC by Semihalf. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * from: FreeBSD: //depot/projects/arm/src/sys/arm/xscale/pxa2x0/pxa2x0_timer.c, rev 1 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/arm/mv/timer.c 294436 2016-01-20 14:23:57Z zbb $"); | 32__FBSDID("$FreeBSD: head/sys/arm/mv/timer.c 294437 2016-01-20 14:28:05Z zbb $"); |
33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/malloc.h> 40#include <sys/rman.h> --- 30 unchanged lines hidden (view full) --- 71#endif 72 73struct mv_timer_softc { 74 struct resource * timer_res[2]; 75 bus_space_tag_t timer_bst; 76 bus_space_handle_t timer_bsh; 77 struct mtx timer_mtx; 78 struct eventtimer et; | 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/malloc.h> 40#include <sys/rman.h> --- 30 unchanged lines hidden (view full) --- 71#endif 72 73struct mv_timer_softc { 74 struct resource * timer_res[2]; 75 bus_space_tag_t timer_bst; 76 bus_space_handle_t timer_bsh; 77 struct mtx timer_mtx; 78 struct eventtimer et; |
79 boolean_t has_wdt; |
|
79}; 80 81static struct resource_spec mv_timer_spec[] = { 82 { SYS_RES_MEMORY, 0, RF_ACTIVE }, 83 { SYS_RES_IRQ, 0, RF_ACTIVE | RF_OPTIONAL }, 84 { -1, 0 } 85}; 86 --- 68 unchanged lines hidden (view full) --- 155 if (error) { 156 device_printf(dev, "could not allocate resources\n"); 157 return (ENXIO); 158 } 159 160 sc->timer_bst = rman_get_bustag(sc->timer_res[0]); 161 sc->timer_bsh = rman_get_bushandle(sc->timer_res[0]); 162 | 80}; 81 82static struct resource_spec mv_timer_spec[] = { 83 { SYS_RES_MEMORY, 0, RF_ACTIVE }, 84 { SYS_RES_IRQ, 0, RF_ACTIVE | RF_OPTIONAL }, 85 { -1, 0 } 86}; 87 --- 68 unchanged lines hidden (view full) --- 156 if (error) { 157 device_printf(dev, "could not allocate resources\n"); 158 return (ENXIO); 159 } 160 161 sc->timer_bst = rman_get_bustag(sc->timer_res[0]); 162 sc->timer_bsh = rman_get_bushandle(sc->timer_res[0]); 163 |
164 sc->has_wdt = ofw_bus_has_prop(dev, "mrvl,has-wdt") || 165 ofw_bus_is_compatible(dev, "marvell,armada-380-wdt"); 166 |
|
163 mtx_init(&timer_softc->timer_mtx, "watchdog", NULL, MTX_DEF); | 167 mtx_init(&timer_softc->timer_mtx, "watchdog", NULL, MTX_DEF); |
164 mv_watchdog_disable(); 165 EVENTHANDLER_REGISTER(watchdog_list, mv_watchdog_event, sc, 0); | |
166 | 168 |
169 if (sc->has_wdt) { 170 mv_watchdog_disable(); 171 EVENTHANDLER_REGISTER(watchdog_list, mv_watchdog_event, sc, 0); 172 } 173 |
|
167 if (ofw_bus_search_compatible(dev, mv_timer_compat)->ocd_data 168 == MV_WDT) { 169 /* Don't set timers for wdt-only entry. */ 170 device_printf(dev, "only watchdog attached\n"); 171 return (0); 172 } else if (sc->timer_res[1] == NULL) { 173 device_printf(dev, "no interrupt resource\n"); 174 bus_release_resources(dev, mv_timer_spec, sc->timer_res); --- 315 unchanged lines hidden --- | 174 if (ofw_bus_search_compatible(dev, mv_timer_compat)->ocd_data 175 == MV_WDT) { 176 /* Don't set timers for wdt-only entry. */ 177 device_printf(dev, "only watchdog attached\n"); 178 return (0); 179 } else if (sc->timer_res[1] == NULL) { 180 device_printf(dev, "no interrupt resource\n"); 181 bus_release_resources(dev, mv_timer_spec, sc->timer_res); --- 315 unchanged lines hidden --- |