linux/drivers/rtc/rtc-snvs.c

// SPDX-License-Identifier: GPL-2.0+
//
// Copyright (C) 2011-2012 Freescale Semiconductor, Inc.

#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_wakeirq.h>
#include <linux/rtc.h>
#include <linux/clk.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>

#define SNVS_LPREGISTER_OFFSET

/* These register offsets are relative to LP (Low Power) range */
#define SNVS_LPCR
#define SNVS_LPSR
#define SNVS_LPSRTCMR
#define SNVS_LPSRTCLR
#define SNVS_LPTAR
#define SNVS_LPPGDR

#define SNVS_LPCR_SRTC_ENV
#define SNVS_LPCR_LPTA_EN
#define SNVS_LPCR_LPWUI_EN
#define SNVS_LPSR_LPTA

#define SNVS_LPPGDR_INIT
#define CNTR_TO_SECS_SH

/* The maximum RTC clock cycles that are allowed to pass between two
 * consecutive clock counter register reads. If the values are corrupted a
 * bigger difference is expected. The RTC frequency is 32kHz. With 320 cycles
 * we end at 10ms which should be enough for most cases. If it once takes
 * longer than expected we do a retry.
 */
#define MAX_RTC_READ_DIFF_CYCLES

struct snvs_rtc_data {};

/* Read 64 bit timer register, which could be in inconsistent state */
static u64 rtc_read_lpsrt(struct snvs_rtc_data *data)
{}

/* Read the secure real time counter, taking care to deal with the cases of the
 * counter updating while being read.
 */
static u32 rtc_read_lp_counter(struct snvs_rtc_data *data)
{}

/* Just read the lsb from the counter, dealing with inconsistent state */
static int rtc_read_lp_counter_lsb(struct snvs_rtc_data *data, u32 *lsb)
{}

static int rtc_write_sync_lp(struct snvs_rtc_data *data)
{}

static int snvs_rtc_enable(struct snvs_rtc_data *data, bool enable)
{}

static int snvs_rtc_read_time(struct device *dev, struct rtc_time *tm)
{}

static int snvs_rtc_set_time(struct device *dev, struct rtc_time *tm)
{}

static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{}

static int snvs_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
{}

static int snvs_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{}

static const struct rtc_class_ops snvs_rtc_ops =;

static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
{}

static const struct regmap_config snvs_rtc_config =;

static void snvs_rtc_action(void *data)
{}

static int snvs_rtc_probe(struct platform_device *pdev)
{}

static int __maybe_unused snvs_rtc_suspend_noirq(struct device *dev)
{}

static int __maybe_unused snvs_rtc_resume_noirq(struct device *dev)
{}

static const struct dev_pm_ops snvs_rtc_pm_ops =;

static const struct of_device_id snvs_dt_ids[] =;
MODULE_DEVICE_TABLE(of, snvs_dt_ids);

static struct platform_driver snvs_rtc_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();