Index: head/sys/arm/allwinner/a83t/files.a83t =================================================================== --- head/sys/arm/allwinner/a83t/files.a83t +++ head/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: head/sys/arm/allwinner/clkng/aw_ccung.h =================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.h +++ head/sys/arm/allwinner/clkng/aw_ccung.h @@ -29,6 +29,17 @@ #ifndef __CCU_NG_H__ #define __CCU_NG_H__ +enum aw_ccung_type { + H3_CCU = 1, + H3_R_CCU, + A31_CCU, + A64_CCU, + A64_R_CCU, + A13_CCU, + A83T_CCU, + A83T_R_CCU, +}; + struct aw_ccung_softc { device_t dev; struct resource *res; Index: head/sys/arm/allwinner/clkng/aw_ccung.c =================================================================== --- head/sys/arm/allwinner/clkng/aw_ccung.c +++ head/sys/arm/allwinner/clkng/aw_ccung.c @@ -78,6 +78,7 @@ #if defined(SOC_ALLWINNER_A83T) #include +#include #endif #include "clkdev_if.h" @@ -88,28 +89,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 +106,7 @@ #endif #if defined(SOC_ALLWINNER_A83T) { "allwinner,sun8i-a83t-ccu", A83T_CCU }, + { "allwinner,sun8i-a83t-r-ccu", A83T_R_CCU }, #endif {NULL, 0 } }; @@ -373,6 +353,9 @@ #if defined(SOC_ALLWINNER_A83T) case A83T_CCU: ccu_a83t_register_clocks(sc); + break; + case A83T_R_CCU: + ccu_sun8i_r_register_clocks(sc); break; #endif } Index: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c =================================================================== --- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c +++ head/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,14 @@ 0, 2, /* shift, width */ 0, NULL); /* flags, div table */ -static struct aw_clk_prediv_mux_def *prediv_mux_clks[] = { +static struct aw_clk_prediv_mux_def *r_ccu_prediv_mux_clks[] = { &ar100_clk, }; +static struct aw_clk_prediv_mux_def *a83t_r_ccu_prediv_mux_clks[] = { + &a83t_ar100_clk, +}; + static struct clk_div_def *div_clks[] = { &apb0_clk, }; @@ -112,11 +124,18 @@ ccu_sun8i_r_register_clocks(struct aw_ccung_softc *sc) { int i; + struct aw_clk_prediv_mux_def **prediv_mux_clks; sc->resets = ccu_sun8i_r_resets; sc->nresets = nitems(ccu_sun8i_r_resets); sc->gates = ccu_sun8i_r_gates; sc->ngates = nitems(ccu_sun8i_r_gates); + + /* a83t names the parents differently than the others */ + if (sc->type == A83T_R_CCU) + prediv_mux_clks = a83t_r_ccu_prediv_mux_clks; + else + prediv_mux_clks = r_ccu_prediv_mux_clks; for (i = 0; i < nitems(prediv_mux_clks); i++) aw_clk_prediv_mux_register(sc->clkdom, prediv_mux_clks[i]);