1 1.37 thorpej /* $NetBSD: rtc.c,v 1.37 2025/09/07 21:45:13 thorpej Exp $ */ 2 1.1 takemura 3 1.1 takemura /*- 4 1.1 takemura * Copyright (c) 1999 Shin Takemura. All rights reserved. 5 1.1 takemura * Copyright (c) 1999 SATO Kazumi. All rights reserved. 6 1.1 takemura * Copyright (c) 1999 PocketBSD Project. All rights reserved. 7 1.1 takemura * 8 1.1 takemura * Redistribution and use in source and binary forms, with or without 9 1.1 takemura * modification, are permitted provided that the following conditions 10 1.1 takemura * are met: 11 1.1 takemura * 1. Redistributions of source code must retain the above copyright 12 1.1 takemura * notice, this list of conditions and the following disclaimer. 13 1.1 takemura * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 takemura * notice, this list of conditions and the following disclaimer in the 15 1.1 takemura * documentation and/or other materials provided with the distribution. 16 1.1 takemura * 3. All advertising materials mentioning features or use of this software 17 1.1 takemura * must display the following acknowledgement: 18 1.1 takemura * This product includes software developed by the PocketBSD project 19 1.1 takemura * and its contributors. 20 1.1 takemura * 4. Neither the name of the project nor the names of its contributors 21 1.1 takemura * may be used to endorse or promote products derived from this software 22 1.1 takemura * without specific prior written permission. 23 1.1 takemura * 24 1.1 takemura * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 1.1 takemura * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 1.1 takemura * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 1.1 takemura * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 1.1 takemura * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 1.1 takemura * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 1.1 takemura * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 1.1 takemura * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 1.1 takemura * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 1.1 takemura * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 1.1 takemura * SUCH DAMAGE. 35 1.1 takemura * 36 1.1 takemura */ 37 1.20 lukem 38 1.20 lukem #include <sys/cdefs.h> 39 1.37 thorpej __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.37 2025/09/07 21:45:13 thorpej Exp $"); 40 1.1 takemura 41 1.5 enami #include "opt_vr41xx.h" 42 1.5 enami 43 1.1 takemura #include <sys/param.h> 44 1.1 takemura #include <sys/systm.h> 45 1.24 gdamore #include <sys/timetc.h> 46 1.25 ad #include <sys/device.h> 47 1.27 tsutsui #include <sys/cpu.h> 48 1.1 takemura 49 1.8 uch #include <machine/sysconf.h> 50 1.1 takemura #include <machine/bus.h> 51 1.8 uch 52 1.8 uch #include <dev/clock_subr.h> 53 1.1 takemura 54 1.1 takemura #include <hpcmips/vr/vr.h> 55 1.5 enami #include <hpcmips/vr/vrcpudef.h> 56 1.12 takemura #include <hpcmips/vr/vripif.h> 57 1.14 takemura #include <hpcmips/vr/vripreg.h> 58 1.1 takemura #include <hpcmips/vr/rtcreg.h> 59 1.1 takemura 60 1.3 sato /* 61 1.3 sato * for debugging definitions 62 1.6 toshii * VRRTCDEBUG print rtc debugging information 63 1.3 sato */ 64 1.4 sato #ifdef VRRTCDEBUG 65 1.4 sato #ifndef VRRTCDEBUG_CONF 66 1.4 sato #define VRRTCDEBUG_CONF 0 67 1.4 sato #endif 68 1.4 sato int vrrtc_debug = VRRTCDEBUG_CONF; 69 1.4 sato #define DPRINTF(arg) if (vrrtc_debug) printf arg; 70 1.4 sato #define DDUMP_REGS(arg) if (vrrtc_debug) vrrtc_dump_regs(arg); 71 1.4 sato #else /* VRRTCDEBUG */ 72 1.4 sato #define DPRINTF(arg) 73 1.4 sato #define DDUMP_REGS(arg) 74 1.4 sato #endif /* VRRTCDEBUG */ 75 1.1 takemura 76 1.1 takemura struct vrrtc_softc { 77 1.31 tsutsui device_t sc_dev; 78 1.1 takemura bus_space_tag_t sc_iot; 79 1.1 takemura bus_space_handle_t sc_ioh; 80 1.1 takemura void *sc_ih; 81 1.14 takemura #ifndef SINGLE_VRIP_BASE 82 1.14 takemura int sc_rtcint_reg; 83 1.14 takemura int sc_tclk_h_reg, sc_tclk_l_reg; 84 1.14 takemura int sc_tclk_cnt_h_reg, sc_tclk_cnt_l_reg; 85 1.14 takemura #endif /* SINGLE_VRIP_BASE */ 86 1.24 gdamore int64_t sc_epoch; 87 1.24 gdamore struct todr_chip_handle sc_todr; 88 1.24 gdamore struct timecounter sc_tc; 89 1.1 takemura }; 90 1.1 takemura 91 1.30 tsutsui void vrrtc_init(device_t); 92 1.26 tsutsui int vrrtc_get(todr_chip_handle_t, struct timeval *); 93 1.26 tsutsui int vrrtc_set(todr_chip_handle_t, struct timeval *); 94 1.24 gdamore uint32_t vrrtc_get_timecount(struct timecounter *); 95 1.1 takemura 96 1.8 uch struct platform_clock vr_clock = { 97 1.8 uch #define CLOCK_RATE 128 98 1.24 gdamore CLOCK_RATE, vrrtc_init, 99 1.1 takemura }; 100 1.1 takemura 101 1.31 tsutsui int vrrtc_match(device_t, cfdata_t, void *); 102 1.31 tsutsui void vrrtc_attach(device_t, device_t, void *); 103 1.32 tsutsui int vrrtc_intr(void*, vaddr_t, uint32_t); 104 1.7 uch void vrrtc_dump_regs(struct vrrtc_softc *); 105 1.1 takemura 106 1.31 tsutsui CFATTACH_DECL_NEW(vrrtc, sizeof(struct vrrtc_softc), 107 1.18 thorpej vrrtc_match, vrrtc_attach, NULL, NULL); 108 1.1 takemura 109 1.8 uch int 110 1.31 tsutsui vrrtc_match(device_t parent, cfdata_t cf, void *aux) 111 1.1 takemura { 112 1.7 uch 113 1.29 tsutsui return 1; 114 1.1 takemura } 115 1.1 takemura 116 1.14 takemura #ifndef SINGLE_VRIP_BASE 117 1.14 takemura #define RTCINT_REG_W (sc->sc_rtcint_reg) 118 1.14 takemura #define TCLK_H_REG_W (sc->sc_tclk_h_reg) 119 1.14 takemura #define TCLK_L_REG_W (sc->sc_tclk_l_reg) 120 1.14 takemura #define TCLK_CNT_H_REG_W (sc->sc_tclk_cnt_h_reg) 121 1.14 takemura #define TCLK_CNT_L_REG_W (sc->sc_tclk_cnt_l_reg) 122 1.14 takemura #endif /* SINGLE_VRIP_BASE */ 123 1.14 takemura 124 1.1 takemura void 125 1.31 tsutsui vrrtc_attach(device_t parent, device_t self, void *aux) 126 1.1 takemura { 127 1.1 takemura struct vrip_attach_args *va = aux; 128 1.30 tsutsui struct vrrtc_softc *sc = device_private(self); 129 1.24 gdamore int year; 130 1.14 takemura 131 1.14 takemura #ifndef SINGLE_VRIP_BASE 132 1.14 takemura if (va->va_addr == VR4102_RTC_ADDR) { 133 1.14 takemura sc->sc_rtcint_reg = VR4102_RTCINT_REG_W; 134 1.14 takemura sc->sc_tclk_h_reg = VR4102_TCLK_H_REG_W; 135 1.14 takemura sc->sc_tclk_l_reg = VR4102_TCLK_L_REG_W; 136 1.14 takemura sc->sc_tclk_cnt_h_reg = VR4102_TCLK_CNT_H_REG_W; 137 1.14 takemura sc->sc_tclk_cnt_l_reg = VR4102_TCLK_CNT_L_REG_W; 138 1.29 tsutsui } else if (va->va_addr == VR4122_RTC_ADDR) { 139 1.14 takemura sc->sc_rtcint_reg = VR4122_RTCINT_REG_W; 140 1.14 takemura sc->sc_tclk_h_reg = VR4122_TCLK_H_REG_W; 141 1.14 takemura sc->sc_tclk_l_reg = VR4122_TCLK_L_REG_W; 142 1.14 takemura sc->sc_tclk_cnt_h_reg = VR4122_TCLK_CNT_H_REG_W; 143 1.14 takemura sc->sc_tclk_cnt_l_reg = VR4122_TCLK_CNT_L_REG_W; 144 1.29 tsutsui } else if (va->va_addr == VR4181_RTC_ADDR) { 145 1.14 takemura sc->sc_rtcint_reg = VR4181_RTCINT_REG_W; 146 1.14 takemura sc->sc_tclk_h_reg = RTC_NO_REG_W; 147 1.14 takemura sc->sc_tclk_l_reg = RTC_NO_REG_W; 148 1.14 takemura sc->sc_tclk_cnt_h_reg = RTC_NO_REG_W; 149 1.14 takemura sc->sc_tclk_cnt_l_reg = RTC_NO_REG_W; 150 1.14 takemura } else { 151 1.16 provos panic("%s: unknown base address 0x%lx", 152 1.31 tsutsui device_xname(self), va->va_addr); 153 1.14 takemura } 154 1.14 takemura #endif /* SINGLE_VRIP_BASE */ 155 1.14 takemura 156 1.37 thorpej sc->sc_dev = self; 157 1.1 takemura sc->sc_iot = va->va_iot; 158 1.1 takemura if (bus_space_map(sc->sc_iot, va->va_addr, va->va_size, 159 1.7 uch 0 /* no flags */, &sc->sc_ioh)) { 160 1.1 takemura printf("vrrtc_attach: can't map i/o space\n"); 161 1.1 takemura return; 162 1.1 takemura } 163 1.1 takemura /* RTC interrupt handler is directly dispatched from CPU intr */ 164 1.1 takemura vr_intr_establish(VR_INTR1, vrrtc_intr, sc); 165 1.19 wiz /* But need to set level 1 interrupt mask register, 166 1.35 kamil * so register fake interrurpt handler 167 1.1 takemura */ 168 1.12 takemura if (!(sc->sc_ih = vrip_intr_establish(va->va_vc, va->va_unit, 0, 169 1.7 uch IPL_CLOCK, 0, 0))) { 170 1.1 takemura printf (":can't map interrupt.\n"); 171 1.1 takemura return; 172 1.1 takemura } 173 1.1 takemura /* 174 1.1 takemura * Rtc is attached to call this routine 175 1.1 takemura * before cpu_initclock() calls clock_init(). 176 1.1 takemura * So we must disable all interrupt for now. 177 1.1 takemura */ 178 1.1 takemura /* 179 1.1 takemura * Disable all rtc interrupts 180 1.1 takemura */ 181 1.1 takemura /* Disable Elapse compare intr */ 182 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, ECMP_H_REG_W, 0); 183 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, ECMP_M_REG_W, 0); 184 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, ECMP_L_REG_W, 0); 185 1.1 takemura /* Disable RTC Long1 intr */ 186 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCL1_H_REG_W, 0); 187 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCL1_L_REG_W, 0); 188 1.1 takemura /* Disable RTC Long2 intr */ 189 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCL2_H_REG_W, 0); 190 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCL2_L_REG_W, 0); 191 1.1 takemura /* Disable RTC TCLK intr */ 192 1.13 sato if (TCLK_H_REG_W != RTC_NO_REG_W) { 193 1.10 sato bus_space_write_2(sc->sc_iot, sc->sc_ioh, TCLK_H_REG_W, 0); 194 1.10 sato bus_space_write_2(sc->sc_iot, sc->sc_ioh, TCLK_L_REG_W, 0); 195 1.10 sato } 196 1.1 takemura /* 197 1.36 andvar * Clear all rtc interrupts. 198 1.1 takemura */ 199 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCINT_REG_W, RTCINT_ALL); 200 1.1 takemura 201 1.24 gdamore /* 202 1.24 gdamore * Figure out the epoch, which could be either forward or 203 1.24 gdamore * backwards in time. We assume that the start date will always 204 1.24 gdamore * be on Jan 1. 205 1.24 gdamore */ 206 1.24 gdamore for (year = EPOCHYEAR; year < POSIX_BASE_YEAR; year++) { 207 1.34 christos sc->sc_epoch += days_per_year(year) * SECS_PER_DAY; 208 1.24 gdamore } 209 1.24 gdamore for (year = POSIX_BASE_YEAR; year < EPOCHYEAR; year++) { 210 1.34 christos sc->sc_epoch -= days_per_year(year) * SECS_PER_DAY; 211 1.24 gdamore } 212 1.24 gdamore 213 1.24 gdamore /* 214 1.24 gdamore * Initialize MI todr(9) 215 1.24 gdamore */ 216 1.24 gdamore sc->sc_todr.todr_settime = vrrtc_set; 217 1.24 gdamore sc->sc_todr.todr_gettime = vrrtc_get; 218 1.37 thorpej sc->sc_todr.todr_dev = self; 219 1.24 gdamore todr_attach(&sc->sc_todr); 220 1.24 gdamore 221 1.30 tsutsui platform_clock_attach(self, &vr_clock); 222 1.1 takemura } 223 1.1 takemura 224 1.1 takemura int 225 1.32 tsutsui vrrtc_intr(void *arg, vaddr_t pc, uint32_t status) 226 1.1 takemura { 227 1.1 takemura struct vrrtc_softc *sc = arg; 228 1.1 takemura struct clockframe cf; 229 1.14 takemura 230 1.1 takemura bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCINT_REG_W, RTCINT_ALL); 231 1.1 takemura cf.pc = pc; 232 1.29 tsutsui cf.sr = status; 233 1.27 tsutsui cf.intr = (curcpu()->ci_idepth > 1); 234 1.1 takemura hardclock(&cf); 235 1.1 takemura 236 1.1 takemura return 0; 237 1.1 takemura } 238 1.1 takemura 239 1.1 takemura void 240 1.30 tsutsui vrrtc_init(device_t self) 241 1.1 takemura { 242 1.30 tsutsui struct vrrtc_softc *sc = device_private(self); 243 1.1 takemura 244 1.8 uch DDUMP_REGS(sc); 245 1.8 uch /* 246 1.8 uch * Set tick (CLOCK_RATE) 247 1.8 uch */ 248 1.8 uch bus_space_write_2(sc->sc_iot, sc->sc_ioh, RTCL1_H_REG_W, 0); 249 1.29 tsutsui bus_space_write_2(sc->sc_iot, sc->sc_ioh, 250 1.29 tsutsui RTCL1_L_REG_W, RTCL1_L_HZ / CLOCK_RATE); 251 1.24 gdamore 252 1.24 gdamore /* 253 1.24 gdamore * Initialize timecounter. 254 1.24 gdamore */ 255 1.24 gdamore sc->sc_tc.tc_get_timecount = vrrtc_get_timecount; 256 1.24 gdamore sc->sc_tc.tc_name = "vrrtc"; 257 1.24 gdamore sc->sc_tc.tc_counter_mask = 0xffff; 258 1.24 gdamore sc->sc_tc.tc_frequency = ETIME_L_HZ; 259 1.24 gdamore sc->sc_tc.tc_priv = sc; 260 1.24 gdamore sc->sc_tc.tc_quality = 100; 261 1.24 gdamore tc_init(&sc->sc_tc); 262 1.24 gdamore } 263 1.24 gdamore 264 1.24 gdamore uint32_t 265 1.24 gdamore vrrtc_get_timecount(struct timecounter *tc) 266 1.24 gdamore { 267 1.24 gdamore struct vrrtc_softc *sc = (struct vrrtc_softc *)tc->tc_priv; 268 1.24 gdamore bus_space_tag_t iot = sc->sc_iot; 269 1.24 gdamore bus_space_handle_t ioh = sc->sc_ioh; 270 1.24 gdamore 271 1.29 tsutsui return bus_space_read_2(iot, ioh, ETIME_L_REG_W); 272 1.8 uch } 273 1.1 takemura 274 1.24 gdamore int 275 1.26 tsutsui vrrtc_get(todr_chip_handle_t tch, struct timeval *tvp) 276 1.8 uch { 277 1.37 thorpej struct vrrtc_softc *sc = device_private(tch->todr_dev); 278 1.8 uch bus_space_tag_t iot = sc->sc_iot; 279 1.8 uch bus_space_handle_t ioh = sc->sc_ioh; 280 1.29 tsutsui uint32_t timeh; /* elapse time (2*timeh sec) */ 281 1.29 tsutsui uint32_t timel; /* timel/32768 sec */ 282 1.29 tsutsui uint64_t sec, usec; 283 1.8 uch 284 1.8 uch timeh = bus_space_read_2(iot, ioh, ETIME_H_REG_W); 285 1.8 uch timeh = (timeh << 16) | bus_space_read_2(iot, ioh, ETIME_M_REG_W); 286 1.8 uch timel = bus_space_read_2(iot, ioh, ETIME_L_REG_W); 287 1.1 takemura 288 1.11 shin DPRINTF(("clock_get: timeh %08x timel %08x\n", timeh, timel)); 289 1.1 takemura 290 1.24 gdamore timeh -= EPOCHOFF; 291 1.28 tsutsui sec = (uint64_t)timeh * 2; 292 1.24 gdamore sec -= sc->sc_epoch; 293 1.24 gdamore tvp->tv_sec = sec; 294 1.24 gdamore tvp->tv_sec += timel / ETIME_L_HZ; 295 1.24 gdamore 296 1.24 gdamore /* scale from 32kHz to 1MHz */ 297 1.24 gdamore usec = (timel % ETIME_L_HZ); 298 1.24 gdamore usec *= 1000000; 299 1.24 gdamore usec /= ETIME_L_HZ; 300 1.28 tsutsui tvp->tv_usec = usec; 301 1.1 takemura 302 1.24 gdamore return 0; 303 1.4 sato } 304 1.4 sato 305 1.24 gdamore int 306 1.26 tsutsui vrrtc_set(todr_chip_handle_t tch, struct timeval *tvp) 307 1.4 sato { 308 1.37 thorpej struct vrrtc_softc *sc = device_private(tch->todr_dev); 309 1.8 uch bus_space_tag_t iot = sc->sc_iot; 310 1.8 uch bus_space_handle_t ioh = sc->sc_ioh; 311 1.29 tsutsui uint32_t timeh; /* elapse time (2*timeh sec) */ 312 1.29 tsutsui uint32_t timel; /* timel/32768 sec */ 313 1.24 gdamore int64_t sec, cnt; 314 1.8 uch 315 1.24 gdamore sec = tvp->tv_sec + sc->sc_epoch; 316 1.24 gdamore sec += sc->sc_epoch; 317 1.24 gdamore timeh = EPOCHOFF + (sec / 2); 318 1.24 gdamore timel = sec % 2; 319 1.24 gdamore 320 1.24 gdamore cnt = tvp->tv_usec; 321 1.24 gdamore /* scale from 1MHz to 32kHz */ 322 1.24 gdamore cnt *= ETIME_L_HZ; 323 1.24 gdamore cnt /= 1000000; 324 1.24 gdamore timel += (uint32_t)cnt; 325 1.8 uch 326 1.8 uch bus_space_write_2(iot, ioh, ETIME_H_REG_W, (timeh >> 16) & 0xffff); 327 1.8 uch bus_space_write_2(iot, ioh, ETIME_M_REG_W, timeh & 0xffff); 328 1.8 uch bus_space_write_2(iot, ioh, ETIME_L_REG_W, timel); 329 1.1 takemura 330 1.24 gdamore return 0; 331 1.1 takemura } 332 1.1 takemura 333 1.1 takemura void 334 1.8 uch vrrtc_dump_regs(struct vrrtc_softc *sc) 335 1.1 takemura { 336 1.8 uch int timeh; 337 1.8 uch int timel; 338 1.1 takemura 339 1.1 takemura timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, ETIME_H_REG_W); 340 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, ETIME_M_REG_W); 341 1.8 uch timel = (timel << 16) 342 1.8 uch | bus_space_read_2(sc->sc_iot, sc->sc_ioh, ETIME_L_REG_W); 343 1.8 uch printf("clock_init() Elapse Time %04x%04x\n", timeh, timel); 344 1.1 takemura 345 1.8 uch timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, ECMP_H_REG_W); 346 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, ECMP_M_REG_W); 347 1.8 uch timel = (timel << 16) 348 1.8 uch | bus_space_read_2(sc->sc_iot, sc->sc_ioh, ECMP_L_REG_W); 349 1.8 uch printf("clock_init() Elapse Compare %04x%04x\n", timeh, timel); 350 1.1 takemura 351 1.8 uch timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL1_H_REG_W); 352 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL1_L_REG_W); 353 1.8 uch printf("clock_init() LONG1 %04x%04x\n", timeh, timel); 354 1.1 takemura 355 1.8 uch timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL1_CNT_H_REG_W); 356 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL1_CNT_L_REG_W); 357 1.8 uch printf("clock_init() LONG1 CNTL %04x%04x\n", timeh, timel); 358 1.1 takemura 359 1.8 uch timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL2_H_REG_W); 360 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL2_L_REG_W); 361 1.8 uch printf("clock_init() LONG2 %04x%04x\n", timeh, timel); 362 1.1 takemura 363 1.8 uch timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL2_CNT_H_REG_W); 364 1.8 uch timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, RTCL2_CNT_L_REG_W); 365 1.8 uch printf("clock_init() LONG2 CNTL %04x%04x\n", timeh, timel); 366 1.1 takemura 367 1.13 sato if (TCLK_H_REG_W != RTC_NO_REG_W) { 368 1.10 sato timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, TCLK_H_REG_W); 369 1.10 sato timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, TCLK_L_REG_W); 370 1.10 sato printf("clock_init() TCLK %04x%04x\n", timeh, timel); 371 1.10 sato 372 1.29 tsutsui timeh = bus_space_read_2(sc->sc_iot, sc->sc_ioh, 373 1.29 tsutsui TCLK_CNT_H_REG_W); 374 1.29 tsutsui timel = bus_space_read_2(sc->sc_iot, sc->sc_ioh, 375 1.29 tsutsui TCLK_CNT_L_REG_W); 376 1.10 sato printf("clock_init() TCLK CNTL %04x%04x\n", timeh, timel); 377 1.10 sato } 378 1.1 takemura } 379