Date: Wed, 13 Jun 2007 10:10:24 +0200 (CEST) From: =?iso-8859-1?Q?Bj=F6rn_K=F6nig?= <bkoenig@alpha-tierchen.de> To: "M. Warner Losh" <imp@bsdimp.com> Cc: arm@freebsd.org Subject: Re: main clock frequency Message-ID: <57472.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181722224.squirrel@webmail.alpha-tierchen.de> In-Reply-To: <20070612.215430.-365729166.imp@bsdimp.com> References: <55286.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181705783.squirrel@webmail.alpha-tierchen.de> <20070612.215430.-365729166.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_20070613101024_45905 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit So this is my patch. It would be interesting for me to know the effective main clock values for 10.0 Hz and 16.0 Hz oscillators. My board uses a 18.432 Hz oscillator. Currently I'm working on changing the PCK and MCK on-the-fly via sysctl MIB which basically works well for me. Björn ------=_20070613101024_45905 Content-Type: text/x-diff; name="at91_pmc.c.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="at91_pmc.c.diff" --- src/sys/arm/at91/at91_pmc.c.orig Wed Jun 13 09:39:36 2007 +++ src/sys/arm/at91/at91_pmc.c Wed Jun 13 09:54:18 2007 @@ -394,16 +394,18 @@ at91_pmc_attach(device_t dev) { int err; + uint32_t mcfr; pmc_softc = device_get_softc(dev); pmc_softc->dev = dev; if ((err = at91_pmc_activate(dev)) != 0) return err; -#if defined(AT91_TSC) | defined (AT91_BWCT) - at91_pmc_init_clock(pmc_softc, 16000000); -#else - at91_pmc_init_clock(pmc_softc, 10000000); -#endif + + mcfr = RD4(pmc_softc, CKGR_MCFR); + if (mcfr & CKGR_MCFR_MAINRDY == 0) + return (ENXIO); + + at91_pmc_init_clock(pmc_softc, (mcfr & CKGR_MCFR_MAINF_MASK) * 32768 / 16); return (0); } ------=_20070613101024_45905--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57472.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181722224.squirrel>