Deleted Added
full compact
ar71xx_chip.c (234941) ar71xx_chip.c (248781)
1/*-
2 * Copyright (c) 2010 Adrian Chadd
3 * 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) 2010 Adrian Chadd
3 * 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/mips/atheros/ar71xx_chip.c 234941 2012-05-03 05:52:39Z adrian $");
28__FBSDID("$FreeBSD: head/sys/mips/atheros/ar71xx_chip.c 248781 2013-03-27 03:33:19Z adrian $");
29
30#include "opt_ddb.h"
31
32#include <sys/param.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/systm.h>
36#include <sys/bus.h>

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

73#define AR71XX_AHB_DIV_SHIFT 20
74#define AR71XX_AHB_DIV_MASK 0x7
75
76/* XXX these shouldn't be in here - this file is a per-chip file */
77/* XXX these should be in the top-level ar71xx type, not ar71xx -chip */
78uint32_t u_ar71xx_cpu_freq;
79uint32_t u_ar71xx_ahb_freq;
80uint32_t u_ar71xx_ddr_freq;
29
30#include "opt_ddb.h"
31
32#include <sys/param.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/systm.h>
36#include <sys/bus.h>

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

73#define AR71XX_AHB_DIV_SHIFT 20
74#define AR71XX_AHB_DIV_MASK 0x7
75
76/* XXX these shouldn't be in here - this file is a per-chip file */
77/* XXX these should be in the top-level ar71xx type, not ar71xx -chip */
78uint32_t u_ar71xx_cpu_freq;
79uint32_t u_ar71xx_ahb_freq;
80uint32_t u_ar71xx_ddr_freq;
81uint32_t u_ar71xx_refclk;
81
82static void
83ar71xx_chip_detect_mem_size(void)
84{
85}
86
87static void
88ar71xx_chip_detect_sys_frequency(void)
89{
90 uint32_t pll;
91 uint32_t freq;
92 uint32_t div;
93
82
83static void
84ar71xx_chip_detect_mem_size(void)
85{
86}
87
88static void
89ar71xx_chip_detect_sys_frequency(void)
90{
91 uint32_t pll;
92 uint32_t freq;
93 uint32_t div;
94
95 u_ar71xx_refclk = AR71XX_BASE_FREQ;
96
94 pll = ATH_READ_REG(AR71XX_PLL_REG_CPU_CONFIG);
95
96 div = ((pll >> AR71XX_PLL_DIV_SHIFT) & AR71XX_PLL_DIV_MASK) + 1;
97 freq = div * AR71XX_BASE_FREQ;
98
99 div = ((pll >> AR71XX_CPU_DIV_SHIFT) & AR71XX_CPU_DIV_MASK) + 1;
100 u_ar71xx_cpu_freq = freq / div;
101

--- 232 unchanged lines hidden ---
97 pll = ATH_READ_REG(AR71XX_PLL_REG_CPU_CONFIG);
98
99 div = ((pll >> AR71XX_PLL_DIV_SHIFT) & AR71XX_PLL_DIV_MASK) + 1;
100 freq = div * AR71XX_BASE_FREQ;
101
102 div = ((pll >> AR71XX_CPU_DIV_SHIFT) & AR71XX_CPU_DIV_MASK) + 1;
103 u_ar71xx_cpu_freq = freq / div;
104

--- 232 unchanged lines hidden ---