Index: src/sys/arch/sparc64/conf/files.sparc64
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/conf/files.sparc64,v
retrieving revision 1.170
diff -u -r1.170 files.sparc64
--- src/sys/arch/sparc64/conf/files.sparc64	4 Jun 2026 13:57:03 -0000	1.170
+++ src/sys/arch/sparc64/conf/files.sparc64	25 Jun 2026 08:20:19 -0000
@@ -95,7 +95,7 @@
 attach rtc at ebus with rtc_ebus
 file	arch/sparc64/dev/rtc.c			rtc
 
-device bq4802rtc
+device bq4802rtc: sysmon_envsys
 attach bq4802rtc at ebus with bq4802rtc_ebus
 file	arch/sparc64/dev/bq4802_ebus.c		bq4802rtc
 
Index: src/sys/arch/sparc64/dev/bq4802_ebus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/dev/bq4802_ebus.c,v
retrieving revision 1.2
diff -u -r1.2 bq4802_ebus.c
--- src/sys/arch/sparc64/dev/bq4802_ebus.c	16 Feb 2026 16:29:59 -0000	1.2
+++ src/sys/arch/sparc64/dev/bq4802_ebus.c	25 Jun 2026 08:20:19 -0000
@@ -35,10 +35,10 @@
 /* Clock driver for rtc/bq4802 (a Texas Instruments bq4802Y/bq4802LY). */
 
 #include <sys/param.h>
-#include <sys/kernel.h>
 #include <sys/device.h>
 #include <sys/proc.h>
 #include <sys/types.h>
+#include <sys/sysctl.h>
 
 #include <sys/bus.h>
 #include <machine/autoconf.h>
@@ -49,13 +49,16 @@
 #include <dev/ebus/ebusreg.h>
 #include <dev/ebus/ebusvar.h>
 
+
 struct bq4802rtc_softc {
 	device_t	sc_dev;
 
-	struct		todr_chip_handle sc_tch;
+	struct todr_chip_handle	sc_tch;
+
+	bus_space_tag_t		sc_bst;	
+	bus_space_handle_t	sc_bsh;
 
-	bus_space_tag_t sc_bst;	
-	bus_space_handle_t sc_bsh;
+	int			sc_osc_stp;	/* Oscillator stop (sysctl) */
 };
 
 static int	bq4802rtc_ebus_match(device_t, cfdata_t, void *);
@@ -64,6 +67,7 @@
 		    struct clock_ymdhms *);
 static int	bq4802_settime_ymdhms(struct todr_chip_handle *,
 		    struct clock_ymdhms *);
+static int	sysctl_bq4802_osc(SYSCTLFN_ARGS);
 
 CFATTACH_DECL_NEW(bq4802rtc_ebus, sizeof(struct bq4802rtc_softc),
     bq4802rtc_ebus_match, bq4802rtc_ebus_attach, NULL, NULL);
@@ -96,8 +100,9 @@
 	struct bq4802rtc_softc *sc = device_private(self);
 	struct ebus_attach_args *ea = aux;
 	todr_chip_handle_t tch = &sc->sc_tch;
+	const struct sysctlnode *me = NULL, *node = NULL;
 	int sz;
-	uint8_t ctrl;
+	uint8_t ctrl, new;
 
 	sc->sc_dev = self;
 	sc->sc_bst = ea->ea_bustag;
@@ -120,11 +125,37 @@
 
 	/* Setup: alarms off, disable DST, enable updates, 24-hour mode */
 	ctrl = bq4802_read(sc, BQ4802_CTRL);
-	ctrl = ctrl & ~(BQ4802_CTRL_DSE | BQ4802_CTRL_UTI);
-	ctrl = ctrl | BQ4802_CTRL_24 | BQ4802_CTRL_STP;
-	bq4802_write(sc, BQ4802_CTRL, ctrl);
+	if (ctrl & BQ4802_CTRL_STP)
+		sc->sc_osc_stp = 0;
+	else {
+		aprint_error_dev(self,
+		    "WARNING: oscillator is stopped (0x%02x)\n", ctrl);
+		sc->sc_osc_stp = 1;
+	}
+	new = ctrl & ~(BQ4802_CTRL_DSE | BQ4802_CTRL_UTI);
+	new = new | BQ4802_CTRL_24;
+	if (new != ctrl)
+		bq4802_write(sc, BQ4802_CTRL, ctrl);
 
 	todr_attach(tch);
+
+	/* Setup sysctl for the oscillator control */
+	sysctl_createv(NULL, 0, NULL, &me,
+	    CTLFLAG_READWRITE,
+	    CTLTYPE_NODE, device_xname(self), NULL,
+	    NULL, 0, NULL, 0,
+	    CTL_HW, CTL_CREATE, CTL_EOL);
+	if (me == NULL)
+		aprint_error_dev(self, "unable to add sysctl root\n");
+	else {
+		sysctl_createv(NULL, 0, NULL, &node,
+		    CTLFLAG_READWRITE | CTLFLAG_OWNDESC,
+		    CTLTYPE_INT, "stop_oscillator", "Stop the chip oscillator",
+		    sysctl_bq4802_osc, 1, (void *)sc, 0,
+		    CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
+		if (node == NULL)
+			aprint_error_dev(self, "unable to add sysctl node\n");
+	}
 }
 
 static int
@@ -182,3 +213,53 @@
 
 	return 0;
 }
+
+static int
+sysctl_bq4802_osc(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct bq4802rtc_softc *sc = node.sysctl_data;
+	int stp;
+	uint8_t ctrl;
+
+	if (newp) {
+		/* write */
+		stp = sc->sc_osc_stp;
+		node.sysctl_data = &stp;
+		if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) {
+			if (stp != 0 && stp != 1)
+				return EINVAL;
+
+			if (stp != sc->sc_osc_stp) {
+				sc->sc_osc_stp = stp;
+				ctrl = bq4802_read(sc, BQ4802_CTRL);
+				if (stp)
+					ctrl &= ~BQ4802_CTRL_STP;
+				else
+					ctrl |= BQ4802_CTRL_STP;
+				bq4802_write(sc, BQ4802_CTRL, ctrl);
+			}
+
+			return 0;
+		}
+		return EINVAL;
+	} else {
+		node.sysctl_data = &sc->sc_osc_stp;
+		node.sysctl_size = 4;
+		return (sysctl_lookup(SYSCTLFN_CALL(&node)));
+	}
+
+	return 0;
+}
+
+/*
+SYSCTL_SETUP(sysctl_bq4802_setup, "sysctl bq4802 subtree setup")
+{
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		       CTLFLAG_PERMANENT,
+		       CTLTYPE_NODE, "hw", NULL,
+		       NULL, 0, NULL, 0,
+		       CTL_HW, CTL_EOL);
+}
+*/
Index: src/share/man/man4/bq4802rtc.4
===================================================================
RCS file: src/share/man/man4/bq4802rtc.4
diff -N src/share/man/man4/bq4802rtc.4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/share/man/man4/bq4802rtc.4	25 Jun 2026 08:20:19 -0000
@@ -0,0 +1,82 @@
+.\"	$NetBSD$
+.\"
+.\" Copyright (c) 2026 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Julian Coleman.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 8, 2026
+.Dt BQ4802RTC 4
+.Os
+.Sh NAME
+.Nm bq4802rtc
+.Nd Texas Instruments bq4802Y/bq4802LY Real-Time Clock
+.Sh SYNOPSIS
+.Cd "bq4802rtc* at ebus?  # sparc64"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the Texas Instruments bq4802Y/bq4802LY
+real-time clock.
+Access methods to retrieve and set date and time
+are provided through the
+.Em TODR
+interface defined in
+.Xr todr 9 .
+.Pp
+The chip supports stopping the oscillator to conserve battery life
+if the computer will be stored for an extended period.
+The
+.Nm
+driver
+makes the oscillator control available via
+.Xr sysctl 8 .
+For example:
+.Bd -literal -offset indent
+hw.bq4802rtc0.stop_oscillator = 0
+.Ed
+.Pp
+A value of
+.Dq 0
+means that the oscillator is running when the computer is powered off,
+and a value of
+.Dq 1
+means that the oscillator is stopped.
+If the oscillator is stopped, then the driver will output a warning message
+at attach time, but does not automatically restart the oscillator.
+.Sh SEE ALSO
+.Xr sysctl 8,
+.Xr todr 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 11.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Julian Coleman Aq Mt jcoleman@NetBSD.org .
Index: src/distrib/sets/lists/man/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1835
diff -u -r1.1835 mi
--- src/distrib/sets/lists/man/mi	11 Jun 2026 19:51:15 -0000	1.1835
+++ src/distrib/sets/lists/man/mi	25 Jun 2026 08:20:20 -0000
@@ -1072,6 +1072,7 @@
 ./usr/share/man/cat4/bochsfb.0			man-sys-catman		.cat
 ./usr/share/man/cat4/bpf.0			man-sys-catman		.cat
 ./usr/share/man/cat4/bpfjit.0			man-sys-catman		.cat
+./usr/share/man/cat4/bq4802rtc.0		man-sys-catman		.cat
 ./usr/share/man/cat4/brgphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/bridge.0			man-sys-catman		.cat
 ./usr/share/man/cat4/bt.0			man-sys-catman		.cat
@@ -4675,6 +4676,7 @@
 ./usr/share/man/man4/bochsfb.4			man-sys-man		.man
 ./usr/share/man/man4/bpf.4			man-sys-man		.man
 ./usr/share/man/man4/bpfjit.4			man-sys-man		.man
+./usr/share/man/man4/bq4802rtc.4		man-sys-man		.man
 ./usr/share/man/man4/brgphy.4			man-sys-man		.man
 ./usr/share/man/man4/bridge.4			man-sys-man		.man
 ./usr/share/man/man4/bt.4			man-sys-man		.man
Index: src/distrib/sets/lists/manhtml/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/manhtml/mi,v
retrieving revision 1.53
diff -u -r1.53 mi
--- src/distrib/sets/lists/manhtml/mi	11 Jun 2026 19:51:15 -0000	1.53
+++ src/distrib/sets/lists/manhtml/mi	25 Jun 2026 08:20:20 -0000
@@ -955,6 +955,7 @@
 ./usr/share/man/html4/bochsfb.html		man-sys-htmlman		html
 ./usr/share/man/html4/bpf.html			man-sys-htmlman		html
 ./usr/share/man/html4/bpfjit.html		man-sys-htmlman		html
+./usr/share/man/html4/bq4802rtc.html		man-sys-htmlman		html
 ./usr/share/man/html4/brgphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/bridge.html		man-sys-htmlman		html
 ./usr/share/man/html4/bt.html			man-sys-htmlman		html
