Deleted Added
full compact
at91_pmc.c (239188) at91_pmc.c (239190)
1/*-
2 * Copyright (c) 2006 M. Warner Losh. All rights reserved.
3 * Copyright (c) 2010 Greg Ansley. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 M. Warner Losh. All rights reserved.
3 * Copyright (c) 2010 Greg Ansley. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/arm/at91/at91_pmc.c 239188 2012-08-11 05:03:30Z imp $");
28__FBSDID("$FreeBSD: head/sys/arm/at91/at91_pmc.c 239190 2012-08-11 05:45:19Z imp $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/time.h>
36#include <sys/bus.h>

--- 145 unchanged lines hidden (view full) ---

182 if (sc == NULL) {
183 uint32_t *p = (uint32_t *)(AT91_BASE + AT91_PMC_BASE + off);
184
185 *p = val;
186 } else
187 bus_write_4(sc->mem_res, off, val);
188}
189
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/malloc.h>
34#include <sys/module.h>
35#include <sys/time.h>
36#include <sys/bus.h>

--- 145 unchanged lines hidden (view full) ---

182 if (sc == NULL) {
183 uint32_t *p = (uint32_t *)(AT91_BASE + AT91_PMC_BASE + off);
184
185 *p = val;
186 } else
187 bus_write_4(sc->mem_res, off, val);
188}
189
190/*
191 * The following is unused currently since we don't ever set the PLLA
192 * frequency of the device. If we did, we'd have to also pay attention
193 * to the ICPLLA bit in the PMC_PLLICPR register for frequencies lower
194 * than ~600MHz, which the PMC code doesn't do right now.
195 */
196uint32_t
197at91_pmc_800mhz_plla_outb(int freq)
198{
199 uint32_t outa;
200
201 /*
202 * Set OUTA, per the data sheet. See Table 46-16 titled
203 * PLLA Frequency Regarding ICPLLA and OUTA in the SAM9X25 doc,
204 * Table 46-17 in the SAM9G20 doc, or Table 46-16 in the SAM9G45 doc.
205 * Note: the frequencies overlap by 5MHz, so we add 3 here to
206 * center shoot the transition.
207 */
208
209 freq /= 1000000; /* MHz */
210 if (freq >= 800)
211 freq = 800;
212 freq += 3; /* Allow for overlap. */
213 outa = 3 - ((freq / 50) & 3); /* 750 / 50 = 7, see table */
214 return (1 << 29)| (outa << 14);
215}
216
217uint32_t
218at91_pmc_800mhz_pllb_outb(int freq)
219{
220
221 return (0);
222}
223
190void
191at91_pmc_set_pllb_mode(struct at91_pmc_clock *clk, int on)
192{
193 struct at91_pmc_softc *sc = pmc_softc;
194 uint32_t value;
195
196 if (on) {
197 on = PMC_IER_LOCKB;

--- 470 unchanged lines hidden ---
224void
225at91_pmc_set_pllb_mode(struct at91_pmc_clock *clk, int on)
226{
227 struct at91_pmc_softc *sc = pmc_softc;
228 uint32_t value;
229
230 if (on) {
231 on = PMC_IER_LOCKB;

--- 470 unchanged lines hidden ---