| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: awin_board.c,v 1.37 2015/10/17 15:00:45 bouyer Exp $ */ | | 1 | /* $NetBSD: awin_board.c,v 1.38 2015/10/17 15:02:55 bouyer Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | | 3 | * Copyright (c) 2012 The NetBSD Foundation, Inc. |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * This code is derived from software contributed to The NetBSD Foundation | | 6 | * This code is derived from software contributed to The NetBSD Foundation |
7 | * by Matt Thomas of 3am Software Foundry. | | 7 | * by Matt Thomas of 3am Software Foundry. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | * POSSIBILITY OF SUCH DAMAGE. | | 28 | * POSSIBILITY OF SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include "opt_allwinner.h" | | 31 | #include "opt_allwinner.h" |
32 | #include "opt_arm_debug.h" | | 32 | #include "opt_arm_debug.h" |
33 | #include "opt_multiprocessor.h" | | 33 | #include "opt_multiprocessor.h" |
34 | | | 34 | |
35 | #define _ARM32_BUS_DMA_PRIVATE | | 35 | #define _ARM32_BUS_DMA_PRIVATE |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | | | 38 | |
39 | __KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.37 2015/10/17 15:00:45 bouyer Exp $"); | | 39 | __KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.38 2015/10/17 15:02:55 bouyer Exp $"); |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/bus.h> | | 42 | #include <sys/bus.h> |
43 | #include <sys/cpu.h> | | 43 | #include <sys/cpu.h> |
44 | #include <sys/device.h> | | 44 | #include <sys/device.h> |
45 | | | 45 | |
46 | #include <prop/proplib.h> | | 46 | #include <prop/proplib.h> |
47 | | | 47 | |
48 | #include <net/if.h> | | 48 | #include <net/if.h> |
49 | #include <net/if_ether.h> | | 49 | #include <net/if_ether.h> |
50 | | | 50 | |
51 | #include <arm/locore.h> | | 51 | #include <arm/locore.h> |
52 | | | 52 | |
| @@ -560,27 +560,27 @@ awin_pll6_get_rate(void) | | | @@ -560,27 +560,27 @@ awin_pll6_get_rate(void) |
560 | unsigned int n, k, m; | | 560 | unsigned int n, k, m; |
561 | | | 561 | |
562 | KASSERT(awin_chip_id() != AWIN_CHIP_ID_A80); | | 562 | KASSERT(awin_chip_id() != AWIN_CHIP_ID_A80); |
563 | | | 563 | |
564 | const uint32_t cfg = CCM_READ4(AWIN_PLL6_CFG_REG); | | 564 | const uint32_t cfg = CCM_READ4(AWIN_PLL6_CFG_REG); |
565 | | | 565 | |
566 | if (awin_chip_id() == AWIN_CHIP_ID_A31) { | | 566 | if (awin_chip_id() == AWIN_CHIP_ID_A31) { |
567 | n = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_N) + 1; | | 567 | n = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_N) + 1; |
568 | k = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_K) + 1; | | 568 | k = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_K) + 1; |
569 | m = 2; | | 569 | m = 2; |
570 | } else { | | 570 | } else { |
571 | n = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_N); | | 571 | n = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_N); |
572 | k = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_K) + 1; | | 572 | k = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_K) + 1; |
573 | m = __SHIFTOUT(cfg, AWIN_PLL_CFG_FACTOR_M) + 1; | | 573 | m = 2; |
574 | } | | 574 | } |
575 | | | 575 | |
576 | return (AWIN_REF_FREQ * n * k) / m; | | 576 | return (AWIN_REF_FREQ * n * k) / m; |
577 | } | | 577 | } |
578 | | | 578 | |
579 | uint32_t | | 579 | uint32_t |
580 | awin_periph0_get_rate(void) | | 580 | awin_periph0_get_rate(void) |
581 | { | | 581 | { |
582 | bus_space_tag_t bst = &armv7_generic_bs_tag; | | 582 | bus_space_tag_t bst = &armv7_generic_bs_tag; |
583 | bus_space_handle_t bsh = awin_core_bsh; | | 583 | bus_space_handle_t bsh = awin_core_bsh; |
584 | unsigned int n, idiv, odiv; | | 584 | unsigned int n, idiv, odiv; |
585 | | | 585 | |
586 | KASSERT(awin_chip_id() == AWIN_CHIP_ID_A80); | | 586 | KASSERT(awin_chip_id() == AWIN_CHIP_ID_A80); |