FreeBSD Bugzilla – Attachment 195014 Details for
Bug 229644
PINE64+ 12.0-CURRENT #0 r336112 - time management problem
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
possible workaround for allwinner timer glitches
a64unstable_generic_timer.diff (text/plain), 2.19 KB, created by
Ian Lepore
on 2018-07-09 22:47:32 UTC
(
hide
)
Description:
possible workaround for allwinner timer glitches
Filename:
MIME Type:
Creator:
Ian Lepore
Created:
2018-07-09 22:47:32 UTC
Size:
2.19 KB
patch
obsolete
>Index: sys/arm/arm/generic_timer.c >=================================================================== >--- sys/arm/arm/generic_timer.c (revision 336112) >+++ sys/arm/arm/generic_timer.c (working copy) >@@ -178,6 +178,19 @@ get_cntxct(bool physical) > return (val); > } > >+static uint64_t >+get_cntxcval(bool physical) >+{ >+ uint64_t val; >+ >+ if (physical) >+ val = get_el0(cntp_cval); >+ else >+ val = get_el0(cntv_cval); >+ >+ return (val); >+} >+ > static int > set_ctrl(uint32_t val, bool physical) > { >@@ -275,6 +288,38 @@ arm_tmr_start(struct eventtimer *et, sbintime_t fi > > } > >+static int >+arm_tmr_start_a64_unstable(struct eventtimer *et, sbintime_t first, >+ sbintime_t period __unused) >+{ >+ struct arm_tmr_softc *sc; >+ int counts, ctrl, retries; >+ const int max_tries = 10; >+ uint64_t cntreg, cval, tval; >+ >+ sc = (struct arm_tmr_softc *)et->et_priv; >+ >+ if (first == 0) >+ return (EINVAL); >+ >+ ctrl = get_ctrl(sc->physical); >+ ctrl &= ~GT_CTRL_INT_MASK; >+ ctrl |= GT_CTRL_ENABLE; >+ counts = ((uint32_t)et->et_frequency * first) >> 32; >+ for (retries = 0; retries < max_tries; ++retries) { >+ cntreg = get_cntxct(sc->physical); >+ set_tval(counts, sc->physical); >+ cval = get_cntxcval(sc->physical); >+ tval = cval - cntreg; >+ if (tval - counts < 40) >+ break; >+ } >+ >+ set_ctrl(ctrl, sc->physical); >+ return (0); >+ >+} >+ > static void > arm_tmr_disable(bool physical) > { >@@ -397,7 +442,9 @@ arm_tmr_attach(device_t dev) > #endif > int error; > int i; >+ bool a64_unstable; > >+ a64_unstable = false; > sc = device_get_softc(dev); > if (arm_tmr_sc) > return (ENXIO); >@@ -413,6 +460,7 @@ arm_tmr_attach(device_t dev) > sc->clkfreq = clock; > > if (OF_hasprop(node, "allwinner,sun50i-a64-unstable-timer")) { >+ a64_unstable = true; > sc->get_cntxct = &get_cntxct_a64_unstable; > if (bootverbose) > device_printf(dev, >@@ -475,7 +523,7 @@ arm_tmr_attach(device_t dev) > sc->et.et_frequency = sc->clkfreq; > sc->et.et_min_period = (0x00000010LLU << 32) / sc->et.et_frequency; > sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency; >- sc->et.et_start = arm_tmr_start; >+ sc->et.et_start = (a64_unstable) ? arm_tmr_start_a64_unstable : arm_tmr_start; > sc->et.et_stop = arm_tmr_stop; > sc->et.et_priv = sc; > et_register(&sc->et);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229644
:
195014
|
195033
|
195062
|
196420