Index: sys/arm/allwinner/a83t/files.a83t =================================================================== --- sys/arm/allwinner/a83t/files.a83t +++ sys/arm/allwinner/a83t/files.a83t @@ -1,5 +1,6 @@ # $FreeBSD$ arm/allwinner/clkng/ccu_a83t.c standard +arm/allwinner/clkng/ccu_sun8i_r.c standard arm/allwinner/a83t/a83t_padconf.c standard arm/allwinner/a83t/a83t_r_padconf.c standard Index: sys/arm/allwinner/clkng/aw_ccung.h =================================================================== --- sys/arm/allwinner/clkng/aw_ccung.h +++ sys/arm/allwinner/clkng/aw_ccung.h @@ -29,6 +29,33 @@ #ifndef __CCU_NG_H__ #define __CCU_NG_H__ +#ifdef __aarch64__ +#include "opt_soc.h" +#endif + +#if defined(SOC_ALLWINNER_H3) || defined(SOC_ALLWINNER_H5) +#define H3_CCU 1 +#define H3_R_CCU 2 +#endif + +#if defined(SOC_ALLWINNER_A31) +#define A31_CCU 3 +#endif + +#if defined(SOC_ALLWINNER_A64) +#define A64_CCU 4 +#define A64_R_CCU 5 +#endif + +#if defined(SOC_ALLWINNER_A13) +#define A13_CCU 6 +#endif + +#if defined(SOC_ALLWINNER_A83T) +#define A83T_CCU 7 +#define A83T_R_CCU 8 +#endif + struct aw_ccung_softc { device_t dev; struct resource *res; Index: sys/arm/allwinner/clkng/aw_ccung.c =================================================================== --- sys/arm/allwinner/clkng/aw_ccung.c +++ sys/arm/allwinner/clkng/aw_ccung.c @@ -54,10 +54,6 @@ #include #include -#ifdef __aarch64__ -#include "opt_soc.h" -#endif - #if defined(SOC_ALLWINNER_A13) #include #endif @@ -78,6 +74,7 @@ #if defined(SOC_ALLWINNER_A83T) #include +#include #endif #include "clkdev_if.h" @@ -88,28 +85,6 @@ { -1, 0 } }; -#if defined(SOC_ALLWINNER_H3) || defined(SOC_ALLWINNER_H5) -#define H3_CCU 1 -#define H3_R_CCU 2 -#endif - -#if defined(SOC_ALLWINNER_A31) -#define A31_CCU 3 -#endif - -#if defined(SOC_ALLWINNER_A64) -#define A64_CCU 4 -#define A64_R_CCU 5 -#endif - -#if defined(SOC_ALLWINNER_A13) -#define A13_CCU 6 -#endif - -#if defined(SOC_ALLWINNER_A83T) -#define A83T_CCU 7 -#endif - static struct ofw_compat_data compat_data[] = { #if defined(SOC_ALLWINNER_A31) { "allwinner,sun5i-a13-ccu", A13_CCU}, @@ -127,6 +102,7 @@ #endif #if defined(SOC_ALLWINNER_A83T) { "allwinner,sun8i-a83t-ccu", A83T_CCU }, + { "allwinner,sun8i-a83t-r-ccu", A83T_R_CCU }, #endif {NULL, 0 } }; @@ -374,6 +350,9 @@ case A83T_CCU: ccu_a83t_register_clocks(sc); break; + case A83T_R_CCU: + ccu_sun8i_r_register_clocks(sc); + break; #endif } Index: sys/arm/allwinner/clkng/ccu_sun8i_r.c =================================================================== --- sys/arm/allwinner/clkng/ccu_sun8i_r.c +++ sys/arm/allwinner/clkng/ccu_sun8i_r.c @@ -70,6 +70,7 @@ }; static const char *ar100_parents[] = {"osc32k", "osc24M", "pll_periph0", "iosc"}; +static const char *a83t_ar100_parents[] = {"osc16M-d512", "osc24M", "pll_periph", "osc16M"}; PREDIV_CLK(ar100_clk, CLK_AR100, /* id */ "ar100", ar100_parents, /* name, parents */ 0x00, /* offset */ @@ -77,6 +78,13 @@ 4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* div */ 8, 5, 0, AW_CLK_FACTOR_HAS_COND, /* prediv */ 16, 2, 2); /* prediv condition */ +PREDIV_CLK(a83t_ar100_clk, CLK_AR100, /* id */ + "ar100", a83t_ar100_parents, /* name, parents */ + 0x00, /* offset */ + 16, 2, /* mux */ + 4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO, /* div */ + 8, 5, 0, AW_CLK_FACTOR_HAS_COND, /* prediv */ + 16, 2, 2); /* prediv condition */ static const char *ahb0_parents[] = {"ar100"}; FIXED_CLK(ahb0_clk, @@ -96,10 +104,6 @@ 0, 2, /* shift, width */ 0, NULL); /* flags, div table */ -static struct aw_clk_prediv_mux_def *prediv_mux_clks[] = { - &ar100_clk, -}; - static struct clk_div_def *div_clks[] = { &apb0_clk, }; @@ -118,8 +122,12 @@ sc->gates = ccu_sun8i_r_gates; sc->ngates = nitems(ccu_sun8i_r_gates); - for (i = 0; i < nitems(prediv_mux_clks); i++) - aw_clk_prediv_mux_register(sc->clkdom, prediv_mux_clks[i]); + /* a83t names the parents differently than the others */ + if (sc->type == A83T_R_CCU) + aw_clk_prediv_mux_register(sc->clkdom, &a83t_ar100_clk); + else + aw_clk_prediv_mux_register(sc->clkdom, &ar100_clk); + for (i = 0; i < nitems(div_clks); i++) clknode_div_register(sc->clkdom, div_clks[i]); for (i = 0; i < nitems(fixed_factor_clks); i++)