Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Real-time clock driver for MPC5121
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright 2007, Domen Puncer <domen.puncer@telargo.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright 2008, Freescale Semiconductor, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright 2011, Dmitry Eremin-Solenikov
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/rtc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/of_address.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/of_irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/of_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct mpc5121_rtc_regs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	u8 set_time;		/* RTC + 0x00 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	u8 hour_set;		/* RTC + 0x01 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	u8 minute_set;		/* RTC + 0x02 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	u8 second_set;		/* RTC + 0x03 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	u8 set_date;		/* RTC + 0x04 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	u8 month_set;		/* RTC + 0x05 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	u8 weekday_set;		/* RTC + 0x06 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	u8 date_set;		/* RTC + 0x07 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	u8 write_sw;		/* RTC + 0x08 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u8 sw_set;		/* RTC + 0x09 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u16 year_set;		/* RTC + 0x0a */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	u8 alm_enable;		/* RTC + 0x0c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	u8 alm_hour_set;	/* RTC + 0x0d */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	u8 alm_min_set;		/* RTC + 0x0e */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	u8 int_enable;		/* RTC + 0x0f */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	u8 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	u8 hour;		/* RTC + 0x11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u8 minute;		/* RTC + 0x12 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u8 second;		/* RTC + 0x13 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	u8 month;		/* RTC + 0x14 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u8 wday_mday;		/* RTC + 0x15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u16 year;		/* RTC + 0x16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u8 int_alm;		/* RTC + 0x18 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u8 int_sw;		/* RTC + 0x19 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u8 alm_status;		/* RTC + 0x1a */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u8 sw_minute;		/* RTC + 0x1b */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u8 bus_error_1;		/* RTC + 0x1c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u8 int_day;		/* RTC + 0x1d */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u8 int_min;		/* RTC + 0x1e */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	u8 int_sec;		/* RTC + 0x1f */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	 * target_time:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	 *	intended to be used for hibernation but hibernation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	 *	does not work on silicon rev 1.5 so use it for non-volatile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	 *	storage of offset between the actual_time register and linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	 *	time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u32 target_time;	/* RTC + 0x20 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	 * actual_time:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	 *	readonly time since VBAT_RTC was last connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u32 actual_time;	/* RTC + 0x24 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u32 keep_alive;		/* RTC + 0x28 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) struct mpc5121_rtc_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	unsigned irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	unsigned irq_periodic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct mpc5121_rtc_regs __iomem *regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct rtc_device *rtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	struct rtc_wkalrm wkalarm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * Update second/minute/hour registers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * This is just so alarm will work.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static void mpc5121_rtc_update_smh(struct mpc5121_rtc_regs __iomem *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 				   struct rtc_time *tm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	out_8(&regs->second_set, tm->tm_sec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	out_8(&regs->minute_set, tm->tm_min);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	out_8(&regs->hour_set, tm->tm_hour);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/* set time sequence */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	out_8(&regs->set_time, 0x1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	out_8(&regs->set_time, 0x3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	out_8(&regs->set_time, 0x1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	out_8(&regs->set_time, 0x0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static int mpc5121_rtc_read_time(struct device *dev, struct rtc_time *tm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	unsigned long now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 * linux time is actual_time plus the offset saved in target_time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	now = in_be32(&regs->actual_time) + in_be32(&regs->target_time);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	rtc_time64_to_tm(now, tm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 * update second minute hour registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	 * so alarms will work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	mpc5121_rtc_update_smh(regs, tm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static int mpc5121_rtc_set_time(struct device *dev, struct rtc_time *tm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	unsigned long now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	 * The actual_time register is read only so we write the offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	 * between it and linux time to the target_time register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	now = rtc_tm_to_time64(tm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	out_be32(&regs->target_time, now - in_be32(&regs->actual_time));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	 * update second minute hour registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * so alarms will work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	mpc5121_rtc_update_smh(regs, tm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static int mpc5200_rtc_read_time(struct device *dev, struct rtc_time *tm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	int tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	tm->tm_sec = in_8(&regs->second);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	tm->tm_min = in_8(&regs->minute);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	/* 12 hour format? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	if (in_8(&regs->hour) & 0x20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		tm->tm_hour = (in_8(&regs->hour) >> 1) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			(in_8(&regs->hour) & 1 ? 12 : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		tm->tm_hour = in_8(&regs->hour);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	tmp = in_8(&regs->wday_mday);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	tm->tm_mday = tmp & 0x1f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	tm->tm_mon = in_8(&regs->month) - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	tm->tm_year = in_be16(&regs->year) - 1900;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	tm->tm_wday = (tmp >> 5) % 7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	tm->tm_isdst = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static int mpc5200_rtc_set_time(struct device *dev, struct rtc_time *tm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	mpc5121_rtc_update_smh(regs, tm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	/* date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	out_8(&regs->month_set, tm->tm_mon + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	out_8(&regs->weekday_set, tm->tm_wday ? tm->tm_wday : 7);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	out_8(&regs->date_set, tm->tm_mday);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	out_be16(&regs->year_set, tm->tm_year + 1900);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	/* set date sequence */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	out_8(&regs->set_date, 0x1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	out_8(&regs->set_date, 0x3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	out_8(&regs->set_date, 0x1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	out_8(&regs->set_date, 0x0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static int mpc5121_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	*alarm = rtc->wkalarm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	alarm->pending = in_8(&regs->alm_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static int mpc5121_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 * the alarm has no seconds so deal with it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	if (alarm->time.tm_sec) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		alarm->time.tm_sec = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		alarm->time.tm_min++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		if (alarm->time.tm_min >= 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			alarm->time.tm_min = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			alarm->time.tm_hour++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			if (alarm->time.tm_hour >= 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 				alarm->time.tm_hour = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	alarm->time.tm_mday = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	alarm->time.tm_mon = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	alarm->time.tm_year = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	out_8(&regs->alm_min_set, alarm->time.tm_min);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	out_8(&regs->alm_hour_set, alarm->time.tm_hour);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	out_8(&regs->alm_enable, alarm->enabled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	rtc->wkalarm = *alarm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static irqreturn_t mpc5121_rtc_handler(int irq, void *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	if (in_8(&regs->int_alm)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		/* acknowledge and clear status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		out_8(&regs->int_alm, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		out_8(&regs->alm_status, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	return IRQ_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static irqreturn_t mpc5121_rtc_handler_upd(int irq, void *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	if (in_8(&regs->int_sec) && (in_8(&regs->int_enable) & 0x1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		/* acknowledge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		out_8(&regs->int_sec, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_UF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	return IRQ_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) static int mpc5121_rtc_alarm_irq_enable(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 					unsigned int enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	int val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	if (enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 		val = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		val = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	out_8(&regs->alm_enable, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	rtc->wkalarm.enabled = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) static const struct rtc_class_ops mpc5121_rtc_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	.read_time = mpc5121_rtc_read_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	.set_time = mpc5121_rtc_set_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	.read_alarm = mpc5121_rtc_read_alarm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	.set_alarm = mpc5121_rtc_set_alarm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	.alarm_irq_enable = mpc5121_rtc_alarm_irq_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) static const struct rtc_class_ops mpc5200_rtc_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	.read_time = mpc5200_rtc_read_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	.set_time = mpc5200_rtc_set_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	.read_alarm = mpc5121_rtc_read_alarm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	.set_alarm = mpc5121_rtc_set_alarm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	.alarm_irq_enable = mpc5121_rtc_alarm_irq_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) static int mpc5121_rtc_probe(struct platform_device *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	struct mpc5121_rtc_data *rtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	rtc = devm_kzalloc(&op->dev, sizeof(*rtc), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	if (!rtc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	rtc->regs = devm_platform_ioremap_resource(op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	if (IS_ERR(rtc->regs)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		dev_err(&op->dev, "%s: couldn't map io space\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 		return PTR_ERR(rtc->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	device_init_wakeup(&op->dev, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	platform_set_drvdata(op, rtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	err = devm_request_irq(&op->dev, rtc->irq, mpc5121_rtc_handler, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 			       "mpc5121-rtc", &op->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		dev_err(&op->dev, "%s: could not request irq: %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 							__func__, rtc->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		goto out_dispose;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	err = devm_request_irq(&op->dev, rtc->irq_periodic,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 			       mpc5121_rtc_handler_upd, 0, "mpc5121-rtc_upd",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			       &op->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		dev_err(&op->dev, "%s: could not request irq: %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 						__func__, rtc->irq_periodic);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		goto out_dispose2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	rtc->rtc = devm_rtc_allocate_device(&op->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	if (IS_ERR(rtc->rtc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		err = PTR_ERR(rtc->rtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		goto out_dispose2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	rtc->rtc->ops = &mpc5200_rtc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	rtc->rtc->uie_unsupported = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_0000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	rtc->rtc->range_max = 65733206399ULL; /* 4052-12-31 23:59:59 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	if (of_device_is_compatible(op->dev.of_node, "fsl,mpc5121-rtc")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 		u32 ka;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		ka = in_be32(&rtc->regs->keep_alive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		if (ka & 0x02) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 			dev_warn(&op->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 				"mpc5121-rtc: Battery or oscillator failure!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 			out_be32(&rtc->regs->keep_alive, ka);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		rtc->rtc->ops = &mpc5121_rtc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		 * This is a limitation of the driver that abuses the target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		 * time register, the actual maximum year for the mpc5121 is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		 * also 4052.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		rtc->rtc->range_min = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		rtc->rtc->range_max = U32_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	err = rtc_register_device(rtc->rtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	if (err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		goto out_dispose2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) out_dispose2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	irq_dispose_mapping(rtc->irq_periodic);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) out_dispose:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	irq_dispose_mapping(rtc->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) static int mpc5121_rtc_remove(struct platform_device *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	struct mpc5121_rtc_data *rtc = platform_get_drvdata(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	/* disable interrupt, so there are no nasty surprises */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	out_8(&regs->alm_enable, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	out_8(&regs->int_enable, in_8(&regs->int_enable) & ~0x1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	irq_dispose_mapping(rtc->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	irq_dispose_mapping(rtc->irq_periodic);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) static const struct of_device_id mpc5121_rtc_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	{ .compatible = "fsl,mpc5121-rtc", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	{ .compatible = "fsl,mpc5200-rtc", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) MODULE_DEVICE_TABLE(of, mpc5121_rtc_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) static struct platform_driver mpc5121_rtc_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 		.name = "mpc5121-rtc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 		.of_match_table = of_match_ptr(mpc5121_rtc_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	.probe = mpc5121_rtc_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	.remove = mpc5121_rtc_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) module_platform_driver(mpc5121_rtc_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) MODULE_AUTHOR("John Rigby <jcrigby@gmail.com>");