linux/drivers/rtc/rtc-loongson.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Loongson RTC driver
 *
 * Maintained out-of-tree by Huacai Chen <[email protected]>.
 * Rewritten for mainline by WANG Xuerui <[email protected]>.
 *                           Binbin Zhou <[email protected]>
 */

#include <linux/bitfield.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/acpi.h>

/* Time Of Year(TOY) counters registers */
#define TOY_TRIM_REG
#define TOY_WRITE0_REG
#define TOY_WRITE1_REG
#define TOY_READ0_REG
#define TOY_READ1_REG
#define TOY_MATCH0_REG
#define TOY_MATCH1_REG
#define TOY_MATCH2_REG

/* RTC counters registers */
#define RTC_CTRL_REG
#define RTC_TRIM_REG
#define RTC_WRITE0_REG
#define RTC_READ0_REG
#define RTC_MATCH0_REG
#define RTC_MATCH1_REG
#define RTC_MATCH2_REG

/* bitmask of TOY_WRITE0_REG */
#define TOY_MON
#define TOY_DAY
#define TOY_HOUR
#define TOY_MIN
#define TOY_SEC
#define TOY_MSEC

/* bitmask of TOY_MATCH0/1/2_REG */
#define TOY_MATCH_YEAR
#define TOY_MATCH_MON
#define TOY_MATCH_DAY
#define TOY_MATCH_HOUR
#define TOY_MATCH_MIN
#define TOY_MATCH_SEC

/* bitmask of RTC_CTRL_REG */
#define RTC_ENABLE
#define TOY_ENABLE
#define OSC_ENABLE
#define TOY_ENABLE_MASK

/* PM domain registers */
#define PM1_STS_REG
#define RTC_STS
#define PM1_EN_REG
#define RTC_EN

/*
 * According to the LS1C manual, RTC_CTRL and alarm-related registers are not defined.
 * Accessing the relevant registers will cause the system to hang.
 */
#define LS1C_RTC_CTRL_WORKAROUND

struct loongson_rtc_config {};

struct loongson_rtc_priv {};

static const struct loongson_rtc_config ls1b_rtc_config =;

static const struct loongson_rtc_config ls1c_rtc_config =;

static const struct loongson_rtc_config generic_rtc_config =;

static const struct loongson_rtc_config ls2k1000_rtc_config =;

static const struct regmap_config loongson_rtc_regmap_config =;

/* RTC alarm irq handler */
static irqreturn_t loongson_rtc_isr(int irq, void *id)
{}

/* For ACPI fixed event handler */
static u32 loongson_rtc_handler(void *id)
{}

static int loongson_rtc_set_enabled(struct device *dev)
{}

static bool loongson_rtc_get_enabled(struct device *dev)
{}

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

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

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

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

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

static const struct rtc_class_ops loongson_rtc_ops =;

static int loongson_rtc_probe(struct platform_device *pdev)
{}

static void loongson_rtc_remove(struct platform_device *pdev)
{}

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

static const struct acpi_device_id loongson_rtc_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, loongson_rtc_acpi_match);

static struct platform_driver loongson_rtc_driver =;
module_platform_driver();

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