summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_pmc.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2012-05-20 20:50:40 +0000
committerimp <imp@FreeBSD.org>2012-05-20 20:50:40 +0000
commitc72ac4850394de09d3a2b5a9d1fbe2553335f572 (patch)
tree4c28dddf1fecce29ddb4c5e964754de1e211fbd9 /sys/arm/at91/at91_pmc.c
parentb52bde70e443ab8b540917742fd7a9cbd196af85 (diff)
downloadFreeBSD-src-c72ac4850394de09d3a2b5a9d1fbe2553335f572.zip
FreeBSD-src-c72ac4850394de09d3a2b5a9d1fbe2553335f572.tar.gz
Minor cleanup before some more major changes:
o main_clock_hz isn't used, eliminate it o move main clock calculation code and table so we have only one ifdef.
Diffstat (limited to 'sys/arm/at91/at91_pmc.c')
-rw-r--r--sys/arm/at91/at91_pmc.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/sys/arm/at91/at91_pmc.c b/sys/arm/at91/at91_pmc.c
index 125e241..6e1db33 100644
--- a/sys/arm/at91/at91_pmc.c
+++ b/sys/arm/at91/at91_pmc.c
@@ -55,7 +55,6 @@ static struct at91_pmc_softc {
bus_space_handle_t sc_sh;
struct resource *mem_res; /* Memory resource */
device_t dev;
- unsigned int main_clock_hz;
uint32_t pllb_init;
} *pmc_softc;
@@ -147,18 +146,6 @@ static struct at91_pmc_clock *clock_list[16+32] = {
&cpu
};
-#if !defined(AT91C_MAIN_CLOCK)
-static const unsigned int at91_mainf_tbl[] = {
- 3000000, 3276800, 3686400, 3840000, 4000000,
- 4433619, 4915200, 5000000, 5242880, 6000000,
- 6144000, 6400000, 6553600, 7159090, 7372800,
- 7864320, 8000000, 9830400, 10000000, 11059200,
- 12000000, 12288000, 13560000, 14318180, 14745600,
- 16000000, 17344700, 18432000, 20000000
-};
-#define MAINF_TBL_LEN (sizeof(at91_mainf_tbl) / sizeof(*at91_mainf_tbl))
-#endif
-
static inline uint32_t
RD4(struct at91_pmc_softc *sc, bus_size_t off)
{
@@ -412,7 +399,6 @@ at91_pmc_init_clock(struct at91_pmc_softc *sc, unsigned int main_clock)
udpck.pmc_mask = PMC_SCER_UDP_SAM9;
}
mckr = RD4(sc, PMC_MCKR);
- sc->main_clock_hz = main_clock;
main_ck.hz = main_clock;
at91_pmc_pll_rate(&plla, RD4(sc, CKGR_PLLAR));
@@ -465,7 +451,7 @@ at91_pmc_init_clock(struct at91_pmc_softc *sc, unsigned int main_clock)
device_printf(sc->dev,
"Primary: %d Hz PLLA: %d MHz CPU: %d MHz MCK: %d MHz\n",
- sc->main_clock_hz,
+ main_clock,
plla.hz / 1000000,
cpu.hz / 1000000, mck.hz / 1000000);
@@ -520,6 +506,16 @@ at91_pmc_probe(device_t dev)
}
#if !defined(AT91C_MAIN_CLOCK)
+static const unsigned int at91_mainf_tbl[] = {
+ 3000000, 3276800, 3686400, 3840000, 4000000,
+ 4433619, 4915200, 5000000, 5242880, 6000000,
+ 6144000, 6400000, 6553600, 7159090, 7372800,
+ 7864320, 8000000, 9830400, 10000000, 11059200,
+ 12000000, 12288000, 13560000, 14318180, 14745600,
+ 16000000, 17344700, 18432000, 20000000
+};
+#define MAINF_TBL_LEN (sizeof(at91_mainf_tbl) / sizeof(*at91_mainf_tbl))
+
static unsigned int
at91_pmc_sense_mainf(struct at91_pmc_softc *sc)
{
OpenPOWER on IntegriCloud