summaryrefslogtreecommitdiff
path: root/arch/m68k/mvme16x/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/mvme16x/config.c')
-rw-r--r--arch/m68k/mvme16x/config.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index f00c7aa058de..99768fe8da73 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* arch/m68k/mvme16x/config.c
*
@@ -8,10 +9,6 @@
* linux/amiga/config.c
*
* Copyright (C) 1993 Hamish Macdonald
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file README.legal in the main directory of this archive
- * for more details.
*/
#include <linux/types.h>
@@ -24,9 +21,10 @@
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/major.h>
-#include <linux/rtc.h>
#include <linux/interrupt.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc/m48t59.h>
#include <asm/bootinfo.h>
#include <asm/bootinfo-vme.h>
@@ -38,18 +36,14 @@
#include <asm/mvme16xhw.h>
#include <asm/config.h>
-extern t_bdid mvme_bdid;
+#include "mvme16x.h"
-static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;
+extern t_bdid mvme_bdid;
static void mvme16x_get_model(char *model);
extern void mvme16x_sched_init(void);
-extern int mvme16x_hwclk (int, struct rtc_time *);
extern void mvme16x_reset (void);
-int bcd2int (unsigned char b);
-
-
unsigned short mvme16x_config;
EXPORT_SYMBOL(mvme16x_config);
@@ -208,7 +202,6 @@ static void __init mvme16x_init_IRQ (void)
void mvme16x_cons_write(struct console *co, const char *str, unsigned count)
{
volatile unsigned char *base_addr = (u_char *)CD2401_ADDR;
- volatile u_char sink;
u_char ier;
int port;
u_char do_lf = 0;
@@ -229,7 +222,7 @@ void mvme16x_cons_write(struct console *co, const char *str, unsigned count)
if (in_8(PCCSCCTICR) & 0x20)
{
/* We have a Tx int. Acknowledge it */
- sink = in_8(PCCTPIACKR);
+ in_8(PCCTPIACKR);
if ((base_addr[CyLICR] >> 2) == port) {
if (i == count) {
/* Last char of string is now output */
@@ -270,7 +263,6 @@ void __init config_mvme16x(void)
mach_sched_init = mvme16x_sched_init;
mach_init_IRQ = mvme16x_init_IRQ;
- mach_hwclk = mvme16x_hwclk;
mach_reset = mvme16x_reset;
mach_get_model = mvme16x_get_model;
mach_get_hardware_list = mvme16x_get_hardware_list;
@@ -314,6 +306,28 @@ void __init config_mvme16x(void)
}
}
+static struct resource m48t59_rsrc[] = {
+ DEFINE_RES_MEM(MVME_RTC_BASE, 0x2000),
+};
+
+static struct m48t59_plat_data m48t59_data = {
+ .type = M48T59RTC_TYPE_M48T08,
+ .yy_offset = 70,
+};
+
+static int __init mvme16x_platform_init(void)
+{
+ if (!MACH_IS_MVME16x)
+ return 0;
+
+ platform_device_register_resndata(NULL, "rtc-m48t59", -1,
+ m48t59_rsrc, ARRAY_SIZE(m48t59_rsrc),
+ &m48t59_data, sizeof(m48t59_data));
+ return 0;
+}
+
+arch_initcall(mvme16x_platform_init);
+
static irqreturn_t mvme16x_abort_int (int irq, void *dev_id)
{
unsigned long *new = (unsigned long *)vectors;
@@ -428,28 +442,3 @@ static u64 mvme16x_read_clk(struct clocksource *cs)
return ticks;
}
-
-int bcd2int (unsigned char b)
-{
- return ((b>>4)*10 + (b&15));
-}
-
-int mvme16x_hwclk(int op, struct rtc_time *t)
-{
- if (!op) {
- rtc->ctrl = RTC_READ;
- t->tm_year = bcd2int (rtc->bcd_year);
- t->tm_mon = bcd2int(rtc->bcd_mth) - 1;
- t->tm_mday = bcd2int (rtc->bcd_dom);
- t->tm_hour = bcd2int (rtc->bcd_hr);
- t->tm_min = bcd2int (rtc->bcd_min);
- t->tm_sec = bcd2int (rtc->bcd_sec);
- rtc->ctrl = 0;
- if (t->tm_year < 70)
- t->tm_year += 100;
- } else {
- /* FIXME Setting the time is not yet supported */
- return -EOPNOTSUPP;
- }
- return 0;
-}