Skip to content

Commit daee444

Browse files
committed
Use "start-year" than "sh3_rtc_baseyear" as the RTC base year property
name, matching the dsrtc driver and the Devicetree binding.
1 parent 38a46a6 commit daee444

2 files changed

Lines changed: 13 additions & 29 deletions

File tree

sys/arch/hpcsh/hpcsh/autoconf.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: autoconf.c,v 1.27 2012/10/27 17:17:57 chs Exp $ */
1+
/* $NetBSD: autoconf.c,v 1.28 2025/10/13 15:40:14 thorpej Exp $ */
22

33
/*
44
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
3939
*/
4040

4141
#include <sys/cdefs.h>
42-
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.27 2012/10/27 17:17:57 chs Exp $");
42+
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.28 2025/10/13 15:40:14 thorpej Exp $");
4343

4444
#include "opt_md.h"
4545

@@ -112,6 +112,8 @@ makebootdev(const char *cp)
112112
strncpy(booted_device_name, cp, 16);
113113
}
114114

115+
#define HPW50PAD_RTC_BASE 1996
116+
115117
void
116118
device_register(device_t dev, void *aux)
117119
{
@@ -122,18 +124,11 @@ device_register(device_t dev, void *aux)
122124
if (device_is_a(dev, "rtc") &&
123125
parent != NULL && device_is_a(parent, "shb") &&
124126
platid_match(&platid, &platid_mask_MACH_HITACHI_PERSONA_HPW50PAD)) {
125-
prop_number_t rtc_baseyear;
126-
127-
#define HPW50PAD_RTC_BASE 1996
128-
129-
rtc_baseyear = prop_number_create_integer(HPW50PAD_RTC_BASE);
130-
KASSERT(rtc_baseyear != NULL);
131-
132-
if (prop_dictionary_set(device_properties(dev),
133-
"sh3_rtc_baseyear", rtc_baseyear) == false)
134-
printf("WARNING: unable to set sh3_rtc_baseyear "
127+
if (! device_setprop_uint(dev, "start-year",
128+
HPW50PAD_RTC_BASE)) {
129+
printf("WARNING: unable to set start-year "
135130
"property for %s\n", device_xname(dev));
136-
prop_object_release(rtc_baseyear);
131+
}
137132
return;
138133
}
139134
}

sys/arch/sh3/dev/rtc.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: rtc.c,v 1.12 2025/09/07 21:45:14 thorpej Exp $ */
1+
/* $NetBSD: rtc.c,v 1.13 2025/10/13 15:40:14 thorpej Exp $ */
22

33
/*-
44
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
3030
*/
3131

3232
#include <sys/cdefs.h>
33-
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.12 2025/09/07 21:45:14 thorpej Exp $");
33+
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.13 2025/10/13 15:40:14 thorpej Exp $");
3434

3535
#include <sys/param.h>
3636
#include <sys/kernel.h>
@@ -71,7 +71,6 @@ static int rtc_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
7171
#ifndef SH3_RTC_BASEYEAR
7272
#define SH3_RTC_BASEYEAR 1900
7373
#endif
74-
u_int sh3_rtc_baseyear = SH3_RTC_BASEYEAR;
7574

7675
static int
7776
rtc_match(device_t parent, cfdata_t cfp, void *aux)
@@ -86,7 +85,6 @@ rtc_attach(device_t parent, device_t self, void *aux)
8685
{
8786
struct rtc_softc *sc;
8887
uint8_t r;
89-
prop_number_t prop_rtc_baseyear;
9088
#ifdef RTC_DEBUG
9189
char bits[128];
9290
#endif
@@ -123,18 +121,9 @@ rtc_attach(device_t parent, device_t self, void *aux)
123121
sc->sc_todr.todr_gettime_ymdhms = rtc_gettime_ymdhms;
124122
sc->sc_todr.todr_settime_ymdhms = rtc_settime_ymdhms;
125123

126-
prop_rtc_baseyear = prop_dictionary_get(device_properties(self),
127-
"sh3_rtc_baseyear");
128-
if (prop_rtc_baseyear != NULL) {
129-
sh3_rtc_baseyear =
130-
(u_int)prop_number_integer_value(prop_rtc_baseyear);
131-
#ifdef RTC_DEBUG
132-
aprint_debug_dev(self,
133-
"using baseyear %u passed via device property\n",
134-
sh3_rtc_baseyear);
135-
#endif
136-
}
137-
sc->sc_year0 = sh3_rtc_baseyear;
124+
sc->sc_year0 = device_getprop_uint_default(self, "start-year",
125+
SH3_RTC_BASEYEAR);
126+
aprint_debug_dev(self, "using start-year %u\n", sc->sc_year0);
138127

139128
todr_attach(&sc->sc_todr);
140129

0 commit comments

Comments
 (0)