linux/drivers/rtc/rtc-stmp3xxx.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Freescale STMP37XX/STMP378X Real Time Clock driver
 *
 * Copyright (c) 2007 Sigmatel, Inc.
 * Peter Hartley, <[email protected]>
 *
 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
 * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
 * Copyright 2011 Wolfram Sang, Pengutronix e.K.
 */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/rtc.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/stmp_device.h>
#include <linux/stmp3xxx_rtc_wdt.h>

#define STMP3XXX_RTC_CTRL
#define STMP3XXX_RTC_CTRL_ALARM_IRQ_EN
#define STMP3XXX_RTC_CTRL_ONEMSEC_IRQ_EN
#define STMP3XXX_RTC_CTRL_ALARM_IRQ
#define STMP3XXX_RTC_CTRL_WATCHDOGEN

#define STMP3XXX_RTC_STAT
#define STMP3XXX_RTC_STAT_STALE_SHIFT
#define STMP3XXX_RTC_STAT_RTC_PRESENT
#define STMP3XXX_RTC_STAT_XTAL32000_PRESENT
#define STMP3XXX_RTC_STAT_XTAL32768_PRESENT

#define STMP3XXX_RTC_SECONDS

#define STMP3XXX_RTC_ALARM

#define STMP3XXX_RTC_WATCHDOG

#define STMP3XXX_RTC_PERSISTENT0
#define STMP3XXX_RTC_PERSISTENT0_CLOCKSOURCE
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN
#define STMP3XXX_RTC_PERSISTENT0_ALARM_EN
#define STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP
#define STMP3XXX_RTC_PERSISTENT0_XTAL32KHZ_PWRUP
#define STMP3XXX_RTC_PERSISTENT0_XTAL32_FREQ
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE

#define STMP3XXX_RTC_PERSISTENT1
/* missing bitmask in headers */
#define STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER

struct stmp3xxx_rtc_data {};

#if IS_ENABLED(CONFIG_STMP3XXX_RTC_WATCHDOG)
/**
 * stmp3xxx_wdt_set_timeout - configure the watchdog inside the STMP3xxx RTC
 * @dev: the parent device of the watchdog (= the RTC)
 * @timeout: the desired value for the timeout register of the watchdog.
 *           0 disables the watchdog
 *
 * The watchdog needs one register and two bits which are in the RTC domain.
 * To handle the resource conflict, the RTC driver will create another
 * platform_device for the watchdog driver as a child of the RTC device.
 * The watchdog driver is passed the below accessor function via platform_data
 * to configure the watchdog. Locking is not needed because accessing SET/CLR
 * registers is atomic.
 */

static void stmp3xxx_wdt_set_timeout(struct device *dev, u32 timeout)
{}

static struct stmp3xxx_wdt_pdata wdt_pdata =;

static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
{}
#else
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
{
}
#endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */

static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
{}

/* Time read/write */
static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
{}

static int stmp3xxx_rtc_settime(struct device *dev, struct rtc_time *rtc_tm)
{}

/* interrupt(s) handler */
static irqreturn_t stmp3xxx_rtc_interrupt(int irq, void *dev_id)
{}

static int stmp3xxx_alarm_irq_enable(struct device *dev, unsigned int enabled)
{}

static int stmp3xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

static int stmp3xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

static const struct rtc_class_ops stmp3xxx_rtc_ops =;

static void stmp3xxx_rtc_remove(struct platform_device *pdev)
{}

static int stmp3xxx_rtc_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int stmp3xxx_rtc_suspend(struct device *dev)
{}

static int stmp3xxx_rtc_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(stmp3xxx_rtc_pm_ops, stmp3xxx_rtc_suspend,
			stmp3xxx_rtc_resume);

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

static struct platform_driver stmp3xxx_rtcdrv =;

module_platform_driver();

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