Deleted Added
full compact
am335x_dmtpps.c (314506) am335x_dmtpps.c (314512)
1/*-
2 * Copyright (c) 2015 Ian lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 27 unchanged lines hidden (view full) ---

36 * to see if a new counter value has been latched. When a new value has been
37 * latched, the only processing done in the poll routine is to capture the
38 * current set of timecounter timehands (done with pps_capture()) and the
39 * latched value from the timer. The remaining work (done by pps_event() while
40 * holding a mutex) is scheduled to be done later in a non-interrupt context.
41 */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2015 Ian lepore <ian@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 27 unchanged lines hidden (view full) ---

36 * to see if a new counter value has been latched. When a new value has been
37 * latched, the only processing done in the poll routine is to capture the
38 * current set of timecounter timehands (done with pps_capture()) and the
39 * latched value from the timer. The remaining work (done by pps_event() while
40 * holding a mutex) is scheduled to be done later in a non-interrupt context.
41 */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: stable/11/sys/arm/ti/am335x/am335x_dmtpps.c 314506 2017-03-01 19:55:04Z ian $");
44__FBSDID("$FreeBSD: stable/11/sys/arm/ti/am335x/am335x_dmtpps.c 314512 2017-03-01 21:11:36Z ian $");
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/bus.h>
49#include <sys/conf.h>
50#include <sys/kernel.h>
51#include <sys/module.h>
52#include <sys/malloc.h>

--- 405 unchanged lines hidden (view full) ---

458 if (sc->mem_res == NULL) {
459 return (ENXIO);
460 }
461
462 /* Figure out which hardware timer this is and set the name string. */
463 sc->tmr_num = ti_hwmods_get_unit(dev, "timer");
464 snprintf(sc->tmr_name, sizeof(sc->tmr_name), "DMTimer%d", sc->tmr_num);
465
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/bus.h>
49#include <sys/conf.h>
50#include <sys/kernel.h>
51#include <sys/module.h>
52#include <sys/malloc.h>

--- 405 unchanged lines hidden (view full) ---

458 if (sc->mem_res == NULL) {
459 return (ENXIO);
460 }
461
462 /* Figure out which hardware timer this is and set the name string. */
463 sc->tmr_num = ti_hwmods_get_unit(dev, "timer");
464 snprintf(sc->tmr_name, sizeof(sc->tmr_name), "DMTimer%d", sc->tmr_num);
465
466 /*
467 * Configure the timer pulse/capture pin to input/capture mode. This is
468 * required in addition to configuring the pin as input with the pinmux
469 * controller (which was done via fdt data or tunable at probe time).
470 */
471 sc->tclr = DMT_TCLR_GPO_CFG;
472 DMTIMER_WRITE4(sc, DMT_TCLR, sc->tclr);
473
466 /* Set up timecounter hardware, start it. */
467 DMTIMER_WRITE4(sc, DMT_TSICR, DMT_TSICR_RESET);
468 while (DMTIMER_READ4(sc, DMT_TIOCP_CFG) & DMT_TIOCP_RESET)
469 continue;
470
471 sc->tclr |= DMT_TCLR_START | DMT_TCLR_AUTOLOAD;
472 DMTIMER_WRITE4(sc, DMT_TLDR, 0);
473 DMTIMER_WRITE4(sc, DMT_TCRR, 0);

--- 76 unchanged lines hidden ---
474 /* Set up timecounter hardware, start it. */
475 DMTIMER_WRITE4(sc, DMT_TSICR, DMT_TSICR_RESET);
476 while (DMTIMER_READ4(sc, DMT_TIOCP_CFG) & DMT_TIOCP_RESET)
477 continue;
478
479 sc->tclr |= DMT_TCLR_START | DMT_TCLR_AUTOLOAD;
480 DMTIMER_WRITE4(sc, DMT_TLDR, 0);
481 DMTIMER_WRITE4(sc, DMT_TCRR, 0);

--- 76 unchanged lines hidden ---