linux/drivers/rtc/rtc-omap.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * TI OMAP Real Time Clock interface for Linux
 *
 * Copyright (C) 2003 MontaVista Software, Inc.
 * Author: George G. Davis <[email protected]> or <[email protected]>
 *
 * Copyright (C) 2006 David Brownell (new RTC framework)
 * Copyright (C) 2014 Johan Hovold <[email protected]>
 */

#include <linux/bcd.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/rtc.h>
#include <linux/rtc/rtc-omap.h>

/*
 * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock
 * with century-range alarm matching, driven by the 32kHz clock.
 *
 * The main user-visible ways it differs from PC RTCs are by omitting
 * "don't care" alarm fields and sub-second periodic IRQs, and having
 * an autoadjust mechanism to calibrate to the true oscillator rate.
 *
 * Board-specific wiring options include using split power mode with
 * RTC_OFF_NOFF used as the reset signal (so the RTC won't be reset),
 * and wiring RTC_WAKE_INT (so the RTC alarm can wake the system from
 * low power modes) for OMAP1 boards (OMAP-L138 has this built into
 * the SoC). See the BOARD-SPECIFIC CUSTOMIZATION comment.
 */

/* RTC registers */
#define OMAP_RTC_SECONDS_REG
#define OMAP_RTC_MINUTES_REG
#define OMAP_RTC_HOURS_REG
#define OMAP_RTC_DAYS_REG
#define OMAP_RTC_MONTHS_REG
#define OMAP_RTC_YEARS_REG
#define OMAP_RTC_WEEKS_REG

#define OMAP_RTC_ALARM_SECONDS_REG
#define OMAP_RTC_ALARM_MINUTES_REG
#define OMAP_RTC_ALARM_HOURS_REG
#define OMAP_RTC_ALARM_DAYS_REG
#define OMAP_RTC_ALARM_MONTHS_REG
#define OMAP_RTC_ALARM_YEARS_REG

#define OMAP_RTC_CTRL_REG
#define OMAP_RTC_STATUS_REG
#define OMAP_RTC_INTERRUPTS_REG

#define OMAP_RTC_COMP_LSB_REG
#define OMAP_RTC_COMP_MSB_REG
#define OMAP_RTC_OSC_REG

#define OMAP_RTC_SCRATCH0_REG
#define OMAP_RTC_SCRATCH1_REG
#define OMAP_RTC_SCRATCH2_REG

#define OMAP_RTC_KICK0_REG
#define OMAP_RTC_KICK1_REG

#define OMAP_RTC_IRQWAKEEN

#define OMAP_RTC_ALARM2_SECONDS_REG
#define OMAP_RTC_ALARM2_MINUTES_REG
#define OMAP_RTC_ALARM2_HOURS_REG
#define OMAP_RTC_ALARM2_DAYS_REG
#define OMAP_RTC_ALARM2_MONTHS_REG
#define OMAP_RTC_ALARM2_YEARS_REG

#define OMAP_RTC_PMIC_REG

/* OMAP_RTC_CTRL_REG bit fields: */
#define OMAP_RTC_CTRL_SPLIT
#define OMAP_RTC_CTRL_DISABLE
#define OMAP_RTC_CTRL_SET_32_COUNTER
#define OMAP_RTC_CTRL_TEST
#define OMAP_RTC_CTRL_MODE_12_24
#define OMAP_RTC_CTRL_AUTO_COMP
#define OMAP_RTC_CTRL_ROUND_30S
#define OMAP_RTC_CTRL_STOP

/* OMAP_RTC_STATUS_REG bit fields: */
#define OMAP_RTC_STATUS_POWER_UP
#define OMAP_RTC_STATUS_ALARM2
#define OMAP_RTC_STATUS_ALARM
#define OMAP_RTC_STATUS_1D_EVENT
#define OMAP_RTC_STATUS_1H_EVENT
#define OMAP_RTC_STATUS_1M_EVENT
#define OMAP_RTC_STATUS_1S_EVENT
#define OMAP_RTC_STATUS_RUN
#define OMAP_RTC_STATUS_BUSY

/* OMAP_RTC_INTERRUPTS_REG bit fields: */
#define OMAP_RTC_INTERRUPTS_IT_ALARM2
#define OMAP_RTC_INTERRUPTS_IT_ALARM
#define OMAP_RTC_INTERRUPTS_IT_TIMER

/* OMAP_RTC_OSC_REG bit fields: */
#define OMAP_RTC_OSC_32KCLK_EN
#define OMAP_RTC_OSC_SEL_32KCLK_SRC
#define OMAP_RTC_OSC_OSC32K_GZ_DISABLE

/* OMAP_RTC_IRQWAKEEN bit fields: */
#define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN

/* OMAP_RTC_PMIC bit fields: */
#define OMAP_RTC_PMIC_POWER_EN_EN
#define OMAP_RTC_PMIC_EXT_WKUP_EN(x)
#define OMAP_RTC_PMIC_EXT_WKUP_POL(x)

/* OMAP_RTC_KICKER values */
#define KICK0_VALUE
#define KICK1_VALUE

struct omap_rtc;

struct omap_rtc_device_type {};

struct omap_rtc {};

static inline u8 rtc_read(struct omap_rtc *rtc, unsigned int reg)
{}

static inline u32 rtc_readl(struct omap_rtc *rtc, unsigned int reg)
{}

static inline void rtc_write(struct omap_rtc *rtc, unsigned int reg, u8 val)
{}

static inline void rtc_writel(struct omap_rtc *rtc, unsigned int reg, u32 val)
{}

static void am3352_rtc_unlock(struct omap_rtc *rtc)
{}

static void am3352_rtc_lock(struct omap_rtc *rtc)
{}

static void default_rtc_unlock(struct omap_rtc *rtc)
{}

static void default_rtc_lock(struct omap_rtc *rtc)
{}

/*
 * We rely on the rtc framework to handle locking (rtc->ops_lock),
 * so the only other requirement is that register accesses which
 * require BUSY to be clear are made with IRQs locally disabled
 */
static void rtc_wait_not_busy(struct omap_rtc *rtc)
{}

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

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

/* this hardware doesn't support "don't care" alarm fields */
static void tm2bcd(struct rtc_time *tm)
{}

static void bcd2tm(struct rtc_time *tm)
{}

static void omap_rtc_read_time_raw(struct omap_rtc *rtc, struct rtc_time *tm)
{}

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

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

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

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

static struct omap_rtc *omap_rtc_power_off_rtc;

/**
 * omap_rtc_power_off_program: Set the pmic power off sequence. The RTC
 * generates pmic_pwr_enable control, which can be used to control an external
 * PMIC.
 */
int omap_rtc_power_off_program(struct device *dev)
{}
EXPORT_SYMBOL();

/*
 * omap_rtc_poweroff: RTC-controlled power off
 *
 * The RTC can be used to control an external PMIC via the pmic_power_en pin,
 * which can be configured to transition to OFF on ALARM2 events.
 *
 * Notes:
 * The one-second alarm offset is the shortest offset possible as the alarm
 * registers must be set before the next timer update and the offset
 * calculation is too heavy for everything to be done within a single access
 * period (~15 us).
 *
 * Called with local interrupts disabled.
 */
static void omap_rtc_power_off(void)
{}

static const struct rtc_class_ops omap_rtc_ops =;

static const struct omap_rtc_device_type omap_rtc_default_type =;

static const struct omap_rtc_device_type omap_rtc_am3352_type =;

static const struct omap_rtc_device_type omap_rtc_da830_type =;

static const struct platform_device_id omap_rtc_id_table[] =;
MODULE_DEVICE_TABLE(platform, omap_rtc_id_table);

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

static const struct pinctrl_pin_desc rtc_pins_desc[] =;

static int rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
{}

static const char *rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
					unsigned int group)
{}

static const struct pinctrl_ops rtc_pinctrl_ops =;

#define PIN_CONFIG_ACTIVE_HIGH

static const struct pinconf_generic_params rtc_params[] =;

#ifdef CONFIG_DEBUG_FS
static const struct pin_config_item rtc_conf_items[ARRAY_SIZE(rtc_params)] =;
#endif

static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
			unsigned int pin, unsigned long *config)
{}

static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
			unsigned int pin, unsigned long *configs,
			unsigned int num_configs)
{}

static const struct pinconf_ops rtc_pinconf_ops =;

static struct pinctrl_desc rtc_pinctrl_desc =;

static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val,
				 size_t bytes)
{}

static int omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val,
				  size_t bytes)
{}

static struct nvmem_config omap_rtc_nvmem_config =;

static int omap_rtc_probe(struct platform_device *pdev)
{}

static void omap_rtc_remove(struct platform_device *pdev)
{}

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

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

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

static const struct dev_pm_ops omap_rtc_pm_ops =;

static void omap_rtc_shutdown(struct platform_device *pdev)
{}

static struct platform_driver omap_rtc_driver =;

module_platform_driver();

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