ODROID-C1 onboard ethernet support.diff -r1.6 -r1.7 src/sys/arch/arm/amlogic/amlogic_board.c
(jmcneill)
--- src/sys/arch/arm/amlogic/Attic/amlogic_board.c 2015/03/01 15:06:09 1.6
+++ src/sys/arch/arm/amlogic/Attic/amlogic_board.c 2015/03/04 12:36:12 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_board.c,v 1.6 2015/03/01 15:06:09 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_board.c,v 1.7 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include "opt_amlogic.h" | 29 | #include "opt_amlogic.h" | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: amlogic_board.c,v 1.6 2015/03/01 15:06:09 jmcneill Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: amlogic_board.c,v 1.7 2015/03/04 12:36:12 jmcneill Exp $"); | |
33 | 33 | |||
34 | #define _ARM32_BUS_DMA_PRIVATE | 34 | #define _ARM32_BUS_DMA_PRIVATE | |
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/bus.h> | 36 | #include <sys/bus.h> | |
37 | #include <sys/cpu.h> | 37 | #include <sys/cpu.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | 39 | |||
40 | #include <uvm/uvm_extern.h> | 40 | #include <uvm/uvm_extern.h> | |
41 | 41 | |||
42 | #include <arm/bootconfig.h> | 42 | #include <arm/bootconfig.h> | |
43 | #include <arm/cpufunc.h> | 43 | #include <arm/cpufunc.h> | |
44 | 44 | |||
45 | #include <arm/amlogic/amlogic_reg.h> | 45 | #include <arm/amlogic/amlogic_reg.h> | |
@@ -147,26 +147,33 @@ amlogic_get_rate_a9(void) | @@ -147,26 +147,33 @@ amlogic_get_rate_a9(void) | |||
147 | return rate; | 147 | return rate; | |
148 | } | 148 | } | |
149 | 149 | |||
150 | uint32_t | 150 | uint32_t | |
151 | amlogic_get_rate_a9periph(void) | 151 | amlogic_get_rate_a9periph(void) | |
152 | { | 152 | { | |
153 | const uint32_t cntl1 = CBUS_READ(HHI_SYS_CPU_CLK_CNTL1_REG); | 153 | const uint32_t cntl1 = CBUS_READ(HHI_SYS_CPU_CLK_CNTL1_REG); | |
154 | const u_int div = __SHIFTOUT(cntl1, | 154 | const u_int div = __SHIFTOUT(cntl1, | |
155 | HHI_SYS_CPU_CLK_CNTL1_PERIPH_CLK_MUX) + 2; | 155 | HHI_SYS_CPU_CLK_CNTL1_PERIPH_CLK_MUX) + 2; | |
156 | 156 | |||
157 | return amlogic_get_rate_a9() / div; | 157 | return amlogic_get_rate_a9() / div; | |
158 | } | 158 | } | |
159 | 159 | |||
160 | void | |||
161 | amlogic_eth_init(void) | |||
162 | { | |||
163 | CBUS_WRITE(EE_CLK_GATING1_REG, | |||
164 | CBUS_READ(EE_CLK_GATING1_REG) | EE_CLK_GATING1_ETHERNET); | |||
165 | } | |||
166 | ||||
160 | static void | 167 | static void | |
161 | amlogic_usbphy_clkgate_enable(int port) | 168 | amlogic_usbphy_clkgate_enable(int port) | |
162 | { | 169 | { | |
163 | switch (port) { | 170 | switch (port) { | |
164 | case 0: | 171 | case 0: | |
165 | CBUS_WRITE(EE_CLK_GATING1_REG, | 172 | CBUS_WRITE(EE_CLK_GATING1_REG, | |
166 | CBUS_READ(EE_CLK_GATING1_REG) | | 173 | CBUS_READ(EE_CLK_GATING1_REG) | | |
167 | EE_CLK_GATING1_USB_GENERAL | | 174 | EE_CLK_GATING1_USB_GENERAL | | |
168 | EE_CLK_GATING1_USB0); | 175 | EE_CLK_GATING1_USB0); | |
169 | CBUS_WRITE(EE_CLK_GATING2_REG, | 176 | CBUS_WRITE(EE_CLK_GATING2_REG, | |
170 | CBUS_READ(EE_CLK_GATING2_REG) | | 177 | CBUS_READ(EE_CLK_GATING2_REG) | | |
171 | EE_CLK_GATING2_USB0_TO_DDR); | 178 | EE_CLK_GATING2_USB0_TO_DDR); | |
172 | break; | 179 | break; |
--- src/sys/arch/arm/amlogic/Attic/amlogic_crureg.h 2015/02/28 18:50:57 1.4
+++ src/sys/arch/arm/amlogic/Attic/amlogic_crureg.h 2015/03/04 12:36:12 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_crureg.h,v 1.4 2015/02/28 18:50:57 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_crureg.h,v 1.5 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -29,29 +29,32 @@ | @@ -29,29 +29,32 @@ | |||
29 | #ifndef _ARM_AMLOGIC_CRUREG_H | 29 | #ifndef _ARM_AMLOGIC_CRUREG_H | |
30 | #define _ARM_AMLOGIC_CRUREG_H | 30 | #define _ARM_AMLOGIC_CRUREG_H | |
31 | 31 | |||
32 | #define CBUS_REG(n) ((n) << 2) | 32 | #define CBUS_REG(n) ((n) << 2) | |
33 | 33 | |||
34 | #define EE_CLK_GATING0_REG CBUS_REG(0x1050) | 34 | #define EE_CLK_GATING0_REG CBUS_REG(0x1050) | |
35 | #define EE_CLK_GATING1_REG CBUS_REG(0x1051) | 35 | #define EE_CLK_GATING1_REG CBUS_REG(0x1051) | |
36 | #define EE_CLK_GATING2_REG CBUS_REG(0x1052) | 36 | #define EE_CLK_GATING2_REG CBUS_REG(0x1052) | |
37 | #define EE_CLK_GATING3_REG CBUS_REG(0x1054) | 37 | #define EE_CLK_GATING3_REG CBUS_REG(0x1054) | |
38 | 38 | |||
39 | #define EE_CLK_GATING1_USB_GENERAL __BIT(26) | 39 | #define EE_CLK_GATING1_USB_GENERAL __BIT(26) | |
40 | #define EE_CLK_GATING1_USB1 __BIT(22) | 40 | #define EE_CLK_GATING1_USB1 __BIT(22) | |
41 | #define EE_CLK_GATING1_USB0 __BIT(21) | 41 | #define EE_CLK_GATING1_USB0 __BIT(21) | |
42 | #define EE_CLK_GATING1_ETHERNET __BIT(3) | |||
43 | ||||
42 | #define EE_CLK_GATING2_USB0_TO_DDR __BIT(9) | 44 | #define EE_CLK_GATING2_USB0_TO_DDR __BIT(9) | |
43 | #define EE_CLK_GATING2_USB1_TO_DDR __BIT(8) | 45 | #define EE_CLK_GATING2_USB1_TO_DDR __BIT(8) | |
44 | 46 | |||
47 | ||||
45 | #define HHI_SYS_CPU_CLK_CNTL1_REG CBUS_REG(0x1057) | 48 | #define HHI_SYS_CPU_CLK_CNTL1_REG CBUS_REG(0x1057) | |
46 | #define HHI_SYS_CPU_CLK_CNTL1_SDIV __BITS(29,20) | 49 | #define HHI_SYS_CPU_CLK_CNTL1_SDIV __BITS(29,20) | |
47 | #define HHI_SYS_CPU_CLK_CNTL1_PERIPH_CLK_MUX __BITS(8,6) | 50 | #define HHI_SYS_CPU_CLK_CNTL1_PERIPH_CLK_MUX __BITS(8,6) | |
48 | 51 | |||
49 | #define HHI_SYS_CPU_CLK_CNTL0_REG CBUS_REG(0x1067) | 52 | #define HHI_SYS_CPU_CLK_CNTL0_REG CBUS_REG(0x1067) | |
50 | #define HHI_SYS_CPU_CLK_CNTL0_CLKSEL __BIT(7) | 53 | #define HHI_SYS_CPU_CLK_CNTL0_CLKSEL __BIT(7) | |
51 | #define HHI_SYS_CPU_CLK_CNTL0_SOUTSEL __BITS(3,2) | 54 | #define HHI_SYS_CPU_CLK_CNTL0_SOUTSEL __BITS(3,2) | |
52 | #define HHI_SYS_CPU_CLK_CNTL0_PLLSEL __BITS(1,0) | 55 | #define HHI_SYS_CPU_CLK_CNTL0_PLLSEL __BITS(1,0) | |
53 | 56 | |||
54 | #define HHI_SYS_PLL_CNTL_REG CBUS_REG(0x10c0) | 57 | #define HHI_SYS_PLL_CNTL_REG CBUS_REG(0x10c0) | |
55 | #define HHI_SYS_PLL_CNTL_MUL __BITS(8,0) | 58 | #define HHI_SYS_PLL_CNTL_MUL __BITS(8,0) | |
56 | #define HHI_SYS_PLL_CNTL_DIV __BITS(14,9) | 59 | #define HHI_SYS_PLL_CNTL_DIV __BITS(14,9) | |
57 | #define HHI_SYS_PLL_CNTL_OD __BITS(17,16) | 60 | #define HHI_SYS_PLL_CNTL_OD __BITS(17,16) |
--- src/sys/arch/arm/amlogic/Attic/amlogic_intr.h 2015/02/28 15:20:43 1.3
+++ src/sys/arch/arm/amlogic/Attic/amlogic_intr.h 2015/03/04 12:36:12 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_intr.h,v 1.3 2015/02/28 15:20:43 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_intr.h,v 1.4 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -25,19 +25,21 @@ | @@ -25,19 +25,21 @@ | |||
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #ifndef _ARM_AMLOGIC_INTR_H | 29 | #ifndef _ARM_AMLOGIC_INTR_H | |
30 | #define _ARM_AMLOGIC_INTR_H | 30 | #define _ARM_AMLOGIC_INTR_H | |
31 | 31 | |||
32 | #define PIC_MAXSOURCES 256 | 32 | #define PIC_MAXSOURCES 256 | |
33 | #define PIC_MAXMAXSOURCES 282 | 33 | #define PIC_MAXMAXSOURCES 282 | |
34 | 34 | |||
35 | #include <arm/cortex/gic_intr.h> | 35 | #include <arm/cortex/gic_intr.h> | |
36 | #include <arm/cortex/a9tmr_intr.h> | 36 | #include <arm/cortex/a9tmr_intr.h> | |
37 | 37 | |||
38 | #define AMLOGIC_INTR_GMAC 40 | |||
39 | #define AMLOGIC_INTR_MMC 60 | |||
38 | #define AMLOGIC_INTR_USB0 62 | 40 | #define AMLOGIC_INTR_USB0 62 | |
39 | #define AMLOGIC_INTR_USB1 63 | 41 | #define AMLOGIC_INTR_USB1 63 | |
40 | #define AMLOGIC_INTR_UART2AO 70 | 42 | #define AMLOGIC_INTR_UART2AO 70 | |
41 | #define AMLOGIC_INTR_UART0AO 122 | 43 | #define AMLOGIC_INTR_UART0AO 122 | |
42 | 44 | |||
43 | #endif /* _ARM_AMLOGIC_INTR_H */ | 45 | #endif /* _ARM_AMLOGIC_INTR_H */ |
--- src/sys/arch/arm/amlogic/Attic/amlogic_io.c 2015/02/28 15:20:43 1.3
+++ src/sys/arch/arm/amlogic/Attic/amlogic_io.c 2015/03/04 12:36:12 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_io.c,v 1.3 2015/02/28 15:20:43 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_io.c,v 1.4 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -19,61 +19,65 @@ | @@ -19,61 +19,65 @@ | |||
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include "opt_amlogic.h" | 29 | #include "opt_amlogic.h" | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: amlogic_io.c,v 1.3 2015/02/28 15:20:43 jmcneill Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: amlogic_io.c,v 1.4 2015/03/04 12:36:12 jmcneill Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | 37 | |||
38 | #include <machine/cpu.h> | 38 | #include <machine/cpu.h> | |
39 | #include <sys/bus.h> | 39 | #include <sys/bus.h> | |
40 | 40 | |||
41 | #include <arm/mainbus/mainbus.h> | 41 | #include <arm/mainbus/mainbus.h> | |
42 | #include <arm/amlogic/amlogic_reg.h> | 42 | #include <arm/amlogic/amlogic_reg.h> | |
43 | #include <arm/amlogic/amlogic_var.h> | 43 | #include <arm/amlogic/amlogic_var.h> | |
44 | 44 | |||
45 | #include "locators.h" | 45 | #include "locators.h" | |
46 | 46 | |||
47 | static int amlogicio_match(device_t, cfdata_t, void *); | 47 | static int amlogicio_match(device_t, cfdata_t, void *); | |
48 | static void amlogicio_attach(device_t, device_t, void *); | 48 | static void amlogicio_attach(device_t, device_t, void *); | |
49 | 49 | |||
50 | CFATTACH_DECL_NEW(amlogic_io, 0, | 50 | CFATTACH_DECL_NEW(amlogic_io, 0, | |
51 | amlogicio_match, amlogicio_attach, NULL, NULL); | 51 | amlogicio_match, amlogicio_attach, NULL, NULL); | |
52 | 52 | |||
53 | static int amlogicio_print(void *, const char *); | 53 | static int amlogicio_print(void *, const char *); | |
54 | static int amlogicio_find(device_t, cfdata_t, const int *, void *); | 54 | static int amlogicio_find(device_t, cfdata_t, const int *, void *); | |
55 | 55 | |||
56 | static bool amlogicio_found = false; | 56 | static bool amlogicio_found = false; | |
57 | 57 | |||
58 | #define NOPORT AMLOGICIOCF_PORT_DEFAULT | |||
59 | ||||
58 | static const struct amlogic_locators amlogic_locators[] = { | 60 | static const struct amlogic_locators amlogic_locators[] = { | |
59 | { "amlogiccom", | 61 | { "amlogiccom", | |
60 | AMLOGIC_UART0AO_OFFSET, AMLOGIC_UART_SIZE, 0, AMLOGIC_INTR_UART0AO }, | 62 | AMLOGIC_UART0AO_OFFSET, AMLOGIC_UART_SIZE, 0, AMLOGIC_INTR_UART0AO }, | |
61 | { "amlogiccom", | 63 | { "amlogiccom", | |
62 | AMLOGIC_UART2AO_OFFSET, AMLOGIC_UART_SIZE, 2, AMLOGIC_INTR_UART2AO }, | 64 | AMLOGIC_UART2AO_OFFSET, AMLOGIC_UART_SIZE, 2, AMLOGIC_INTR_UART2AO }, | |
63 | { "dwctwo", | 65 | { "dwctwo", | |
64 | AMLOGIC_USB0_OFFSET, AMLOGIC_USB_SIZE, 0, AMLOGIC_INTR_USB0 }, | 66 | AMLOGIC_USB0_OFFSET, AMLOGIC_USB_SIZE, 0, AMLOGIC_INTR_USB0 }, | |
65 | { "dwctwo", | 67 | { "dwctwo", | |
66 | AMLOGIC_USB1_OFFSET, AMLOGIC_USB_SIZE, 1, AMLOGIC_INTR_USB1 }, | 68 | AMLOGIC_USB1_OFFSET, AMLOGIC_USB_SIZE, 1, AMLOGIC_INTR_USB1 }, | |
69 | { "awge", | |||
70 | AMLOGIC_GMAC_OFFSET, AMLOGIC_GMAC_SIZE, NOPORT, AMLOGIC_INTR_GMAC }, | |||
67 | #if notyet | 71 | #if notyet | |
68 | { "amlogicmmc", | 72 | { "amlogicmmc", | |
69 | AMLOGIC_MMC_OFFSET, AMLOGIC_MMC_SIZE, 0, AMLOGIC_INTR_MMC }, | 73 | AMLOGIC_MMC_OFFSET, AMLOGIC_MMC_SIZE, 0, AMLOGIC_INTR_MMC }, | |
70 | #endif | 74 | #endif | |
71 | }; | 75 | }; | |
72 | 76 | |||
73 | int | 77 | int | |
74 | amlogicio_match(device_t parent, cfdata_t cf, void *aux) | 78 | amlogicio_match(device_t parent, cfdata_t cf, void *aux) | |
75 | { | 79 | { | |
76 | if (amlogicio_found) | 80 | if (amlogicio_found) | |
77 | return 0; | 81 | return 0; | |
78 | return 1; | 82 | return 1; | |
79 | } | 83 | } |
--- src/sys/arch/arm/amlogic/Attic/files.amlogic 2015/02/28 15:20:43 1.3
+++ src/sys/arch/arm/amlogic/Attic/files.amlogic 2015/03/04 12:36:12 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.amlogic,v 1.3 2015/02/28 15:20:43 jmcneill Exp $ | 1 | # $NetBSD: files.amlogic,v 1.4 2015/03/04 12:36:12 jmcneill Exp $ | |
2 | # | 2 | # | |
3 | # Configuration info for Amlogic ARM Peripherals | 3 | # Configuration info for Amlogic ARM Peripherals | |
4 | # | 4 | # | |
5 | 5 | |||
6 | include "arch/arm/pic/files.pic" | 6 | include "arch/arm/pic/files.pic" | |
7 | include "arch/arm/cortex/files.cortex" | 7 | include "arch/arm/cortex/files.cortex" | |
8 | 8 | |||
9 | file arch/arm/arm32/arm32_boot.c | 9 | file arch/arm/arm32/arm32_boot.c | |
10 | file arch/arm/arm32/arm32_kvminit.c | 10 | file arch/arm/arm32/arm32_kvminit.c | |
11 | file arch/arm/arm32/arm32_reboot.c | 11 | file arch/arm/arm32/arm32_reboot.c | |
12 | file arch/arm/arm32/irq_dispatch.S | 12 | file arch/arm/arm32/irq_dispatch.S | |
13 | 13 | |||
14 | file arch/arm/amlogic/amlogic_board.c | 14 | file arch/arm/amlogic/amlogic_board.c | |
@@ -24,20 +24,24 @@ file arch/arm/amlogic/amlogic_io.c amlo | @@ -24,20 +24,24 @@ file arch/arm/amlogic/amlogic_io.c amlo | |||
24 | device amlogiccom | 24 | device amlogiccom | |
25 | attach amlogiccom at amlogicio with amlogic_com | 25 | attach amlogiccom at amlogicio with amlogic_com | |
26 | file arch/arm/amlogic/amlogic_com.c amlogic_com needs-flag | 26 | file arch/arm/amlogic/amlogic_com.c amlogic_com needs-flag | |
27 | 27 | |||
28 | # mmc/sd/sdio | 28 | # mmc/sd/sdio | |
29 | device amlogicmmc: sdmmcbus | 29 | device amlogicmmc: sdmmcbus | |
30 | attach amlogicmmc at amlogicio with amlogic_mmc | 30 | attach amlogicmmc at amlogicio with amlogic_mmc | |
31 | file arch/arm/amlogic/amlogic_mmc.c amlogic_mmc | 31 | file arch/arm/amlogic/amlogic_mmc.c amlogic_mmc | |
32 | 32 | |||
33 | # usb otg | 33 | # usb otg | |
34 | attach dwctwo at amlogicio with amlogic_dwctwo | 34 | attach dwctwo at amlogicio with amlogic_dwctwo | |
35 | file arch/arm/amlogic/amlogic_dwctwo.c amlogic_dwctwo | 35 | file arch/arm/amlogic/amlogic_dwctwo.c amlogic_dwctwo | |
36 | 36 | |||
37 | # ethernet mac | |||
38 | attach awge at amlogicio with amlogic_gmac | |||
39 | file arch/arm/amlogic/amlogic_gmac.c amlogic_gmac | |||
40 | ||||
37 | # Console parameters | 41 | # Console parameters | |
38 | defparam opt_amlogic.h CONADDR | 42 | defparam opt_amlogic.h CONADDR | |
39 | defparam opt_amlogic.h CONSPEED | 43 | defparam opt_amlogic.h CONSPEED | |
40 | defparam opt_amlogic.h CONMODE | 44 | defparam opt_amlogic.h CONMODE | |
41 | 45 | |||
42 | # Memory parameters | 46 | # Memory parameters | |
43 | defparam opt_amlogic.h MEMSIZE | 47 | defparam opt_amlogic.h MEMSIZE |
--- src/sys/arch/arm/amlogic/Attic/amlogic_reg.h 2015/03/01 15:37:26 1.5
+++ src/sys/arch/arm/amlogic/Attic/amlogic_reg.h 2015/03/04 12:36:12 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_reg.h,v 1.5 2015/03/01 15:37:26 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_reg.h,v 1.6 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -27,47 +27,47 @@ | @@ -27,47 +27,47 @@ | |||
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #ifndef _ARM_AMLOGIC_REG_H | 29 | #ifndef _ARM_AMLOGIC_REG_H | |
30 | #define _ARM_AMLOGIC_REG_H | 30 | #define _ARM_AMLOGIC_REG_H | |
31 | 31 | |||
32 | #define CONSADDR_VA (CONSADDR - AMLOGIC_CORE_BASE + AMLOGIC_CORE_VBASE) | 32 | #define CONSADDR_VA (CONSADDR - AMLOGIC_CORE_BASE + AMLOGIC_CORE_VBASE) | |
33 | 33 | |||
34 | #define AMLOGIC_CORE_BASE 0xc0000000 | 34 | #define AMLOGIC_CORE_BASE 0xc0000000 | |
35 | #define AMLOGIC_CORE_SIZE 0x1b000000 | 35 | #define AMLOGIC_CORE_SIZE 0x1b000000 | |
36 | #define AMLOGIC_CORE_VBASE 0xe0000000 | 36 | #define AMLOGIC_CORE_VBASE 0xe0000000 | |
37 | 37 | |||
38 | #define AMLOGIC_CBUS_OFFSET 0x01100000 | 38 | #define AMLOGIC_CBUS_OFFSET 0x01100000 | |
39 | 39 | |||
40 | #define AMLOGIC_UART0_OFFSET 0x01102130 | |||
41 | #define AMLOGIC_UART1_OFFSET 0x01102137 | |||
42 | #define AMLOGIC_UART2_OFFSET 0x011021c0 | |||
43 | #define AMLOGIC_UART0AO_OFFSET 0x081004c0 | 40 | #define AMLOGIC_UART0AO_OFFSET 0x081004c0 | |
44 | #define AMLOGIC_UART2AO_OFFSET 0x081004e0 | 41 | #define AMLOGIC_UART2AO_OFFSET 0x081004e0 | |
45 | #define AMLOGIC_UART_SIZE 0x20 | 42 | #define AMLOGIC_UART_SIZE 0x20 | |
46 | #define AMLOGIC_UART_FREQ 24000000 | 43 | #define AMLOGIC_UART_FREQ 24000000 | |
47 | 44 | |||
48 | #define AMLOGIC_MMC_OFFSET 0x01108e00 | 45 | #define AMLOGIC_MMC_OFFSET 0x01108e00 | |
49 | #define AMLOGIC_MMC_SIZE 0x30 | 46 | #define AMLOGIC_MMC_SIZE 0x30 | |
50 | 47 | |||
51 | #define AMLOGIC_PL310_OFFSET 0x04200000 | 48 | #define AMLOGIC_PL310_OFFSET 0x04200000 | |
52 | 49 | |||
53 | #define AMLOGIC_AOBUS_OFFSET 0x08100000 | 50 | #define AMLOGIC_AOBUS_OFFSET 0x08100000 | |
54 | 51 | |||
55 | #define AMLOGIC_GPIOAO_OFFSET 0x08100024 | 52 | #define AMLOGIC_GPIOAO_OFFSET 0x08100024 | |
56 | 53 | |||
57 | #define AMLOGIC_USB0_OFFSET 0x09040000 | 54 | #define AMLOGIC_USB0_OFFSET 0x09040000 | |
58 | #define AMLOGIC_USB1_OFFSET 0x090c0000 | 55 | #define AMLOGIC_USB1_OFFSET 0x090c0000 | |
59 | #define AMLOGIC_USB_SIZE 0x40000 | 56 | #define AMLOGIC_USB_SIZE 0x40000 | |
60 | 57 | |||
58 | #define AMLOGIC_GMAC_OFFSET 0x09410000 | |||
59 | #define AMLOGIC_GMAC_SIZE 0x10000 | |||
60 | ||||
61 | #define AMLOGIC_SRAM_OFFSET 0x19000000 | 61 | #define AMLOGIC_SRAM_OFFSET 0x19000000 | |
62 | 62 | |||
63 | #define AMLOGIC_CPUCONF_OFFSET 0x1901ff80 | 63 | #define AMLOGIC_CPUCONF_OFFSET 0x1901ff80 | |
64 | 64 | |||
65 | #define AMLOGIC_CBUS_CPU_CLK_CNTL_REG 0x419c | 65 | #define AMLOGIC_CBUS_CPU_CLK_CNTL_REG 0x419c | |
66 | 66 | |||
67 | #define AMLOGIC_AOBUS_PWR_CTRL0_REG 0xe0 | 67 | #define AMLOGIC_AOBUS_PWR_CTRL0_REG 0xe0 | |
68 | #define AMLOGIC_AOBUS_PWR_CTRL1_REG 0xe4 | 68 | #define AMLOGIC_AOBUS_PWR_CTRL1_REG 0xe4 | |
69 | #define AMLOGIC_AOBUS_PWR_MEM_PD0_REG 0xf4 | 69 | #define AMLOGIC_AOBUS_PWR_MEM_PD0_REG 0xf4 | |
70 | 70 | |||
71 | #define AMLOGIC_CPUCONF_CTRL_REG 0x00 | 71 | #define AMLOGIC_CPUCONF_CTRL_REG 0x00 | |
72 | #define AMLOGIC_CPUCONF_CPU_ADDR_REG(n) (0x04 * (n)) | 72 | #define AMLOGIC_CPUCONF_CPU_ADDR_REG(n) (0x04 * (n)) | |
73 | 73 |
--- src/sys/arch/arm/amlogic/Attic/amlogic_var.h 2015/02/28 15:20:43 1.2
+++ src/sys/arch/arm/amlogic/Attic/amlogic_var.h 2015/03/04 12:36:12 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: amlogic_var.h,v 1.2 2015/02/28 15:20:43 jmcneill Exp $ */ | 1 | /* $NetBSD: amlogic_var.h,v 1.3 2015/03/04 12:36:12 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -47,20 +47,21 @@ struct amlogicio_attach_args { | @@ -47,20 +47,21 @@ struct amlogicio_attach_args { | |||
47 | bus_space_tag_t aio_core_a4x_bst; | 47 | bus_space_tag_t aio_core_a4x_bst; | |
48 | bus_space_handle_t aio_bsh; | 48 | bus_space_handle_t aio_bsh; | |
49 | bus_dma_tag_t aio_dmat; | 49 | bus_dma_tag_t aio_dmat; | |
50 | }; | 50 | }; | |
51 | 51 | |||
52 | extern struct bus_space amlogic_bs_tag; | 52 | extern struct bus_space amlogic_bs_tag; | |
53 | extern struct bus_space amlogic_a4x_bs_tag; | 53 | extern struct bus_space amlogic_a4x_bs_tag; | |
54 | extern bus_space_handle_t amlogic_core_bsh; | 54 | extern bus_space_handle_t amlogic_core_bsh; | |
55 | extern struct arm32_bus_dma_tag amlogic_dma_tag; | 55 | extern struct arm32_bus_dma_tag amlogic_dma_tag; | |
56 | 56 | |||
57 | void amlogic_bootstrap(void); | 57 | void amlogic_bootstrap(void); | |
58 | 58 | |||
59 | void amlogic_usbphy_init(int); | 59 | void amlogic_usbphy_init(int); | |
60 | void amlogic_eth_init(void); | |||
60 | 61 | |||
61 | uint32_t amlogic_get_rate_xtal(void); | 62 | uint32_t amlogic_get_rate_xtal(void); | |
62 | uint32_t amlogic_get_rate_sys(void); | 63 | uint32_t amlogic_get_rate_sys(void); | |
63 | uint32_t amlogic_get_rate_a9(void); | 64 | uint32_t amlogic_get_rate_a9(void); | |
64 | uint32_t amlogic_get_rate_a9periph(void); | 65 | uint32_t amlogic_get_rate_a9periph(void); | |
65 | 66 | |||
66 | #endif /* _ARM_AMLOGIC_VAR_H */ | 67 | #endif /* _ARM_AMLOGIC_VAR_H */ |
--- src/sys/arch/evbarm/conf/Attic/ODROID-C1 2015/03/01 15:37:26 1.5
+++ src/sys/arch/evbarm/conf/Attic/ODROID-C1 2015/03/04 12:36:12 1.6
@@ -1,15 +1,15 @@ | @@ -1,15 +1,15 @@ | |||
1 | # | 1 | # | |
2 | # $NetBSD: ODROID-C1,v 1.5 2015/03/01 15:37:26 jmcneill Exp $ | 2 | # $NetBSD: ODROID-C1,v 1.6 2015/03/04 12:36:12 jmcneill Exp $ | |
3 | # | 3 | # | |
4 | # Odroid-C1 (Amlogic S805) based SBC (Single Board Computer) | 4 | # Odroid-C1 (Amlogic S805) based SBC (Single Board Computer) | |
5 | # | 5 | # | |
6 | 6 | |||
7 | include "arch/evbarm/conf/std.amlogic" | 7 | include "arch/evbarm/conf/std.amlogic" | |
8 | 8 | |||
9 | # estimated number of users | 9 | # estimated number of users | |
10 | 10 | |||
11 | maxusers 32 | 11 | maxusers 32 | |
12 | 12 | |||
13 | # Standard system options | 13 | # Standard system options | |
14 | 14 | |||
15 | options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT | 15 | options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT | |
@@ -165,26 +165,31 @@ armgic0 at armperiph? # Interrupt Co | @@ -165,26 +165,31 @@ armgic0 at armperiph? # Interrupt Co | |||
165 | a9tmr0 at armperiph? # Global Timer | 165 | a9tmr0 at armperiph? # Global Timer | |
166 | a9wdt0 at armperiph? # Watchdog | 166 | a9wdt0 at armperiph? # Watchdog | |
167 | 167 | |||
168 | # Specify the memory size in megabytes. | 168 | # Specify the memory size in megabytes. | |
169 | #options MEMSIZE=1024 | 169 | #options MEMSIZE=1024 | |
170 | 170 | |||
171 | # On-board I/O | 171 | # On-board I/O | |
172 | amlogicio0 at mainbus? | 172 | amlogicio0 at mainbus? | |
173 | 173 | |||
174 | # On-board UARTs | 174 | # On-board UARTs | |
175 | amlogiccom0 at amlogicio0 port 0 | 175 | amlogiccom0 at amlogicio0 port 0 | |
176 | options CONSADDR=0xc81004c0, CONSPEED=115200 | 176 | options CONSADDR=0xc81004c0, CONSPEED=115200 | |
177 | 177 | |||
178 | # Gigabit ethernet | |||
179 | awge0 at amlogicio0 | |||
180 | rgephy* at mii? phy ? | |||
181 | ukphy* at mii? phy ? | |||
182 | ||||
178 | # USB | 183 | # USB | |
179 | dwctwo0 at amlogicio0 port 0 | 184 | dwctwo0 at amlogicio0 port 0 | |
180 | dwctwo1 at amlogicio0 port 1 | 185 | dwctwo1 at amlogicio0 port 1 | |
181 | usb* at dwctwo? | 186 | usb* at dwctwo? | |
182 | 187 | |||
183 | include "dev/usb/usbdevices.config" | 188 | include "dev/usb/usbdevices.config" | |
184 | midi* at midibus? | 189 | midi* at midibus? | |
185 | 190 | |||
186 | ## USB debugging options | 191 | ## USB debugging options | |
187 | #options USBVERBOSE | 192 | #options USBVERBOSE | |
188 | #options USB_DEBUG | 193 | #options USB_DEBUG | |
189 | #options UHUB_DEBUG | 194 | #options UHUB_DEBUG | |
190 | #options DWC2_DEBUG | 195 | #options DWC2_DEBUG |