drivers: counter: add Maxim DS3231 support

The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-06-23 20:03:52 -05:00 committed by Carles Cufí
commit e444274e95
22 changed files with 2681 additions and 0 deletions

View file

@ -0,0 +1,39 @@
#
# Copyright (c) 2019 Peter Bigot Consulting, LLC
#
# SPDX-License-Identifier: Apache-2.0
#
description: Maxim DS3231 I2C RTC/TCXO
compatible: "maxim,ds3231"
include: i2c-device.yaml
properties:
reg:
required: true
32k-gpios:
type: phandle-array
required: false
description: |
32 KiHz open drain output
The DS3231 defaults to providing a 32 KiHz square wave on this
signal. The driver does not make use of this, but applications
may want access.
isw-gpios:
type: phandle-array
required: false
description: |
interrupt/square wave open drain output
The DS3231 uses this signal to notify when an alarm has triggered,
and also to produce a square wave aligned to the countdown chain.
Both capabilities are used within the driver. This signal must be
present to support time set and read operations that preserve
sub-second accuracy.