svn commit: r326190 - in head/sys/arm/allwinner: a83t clkng
Kyle Evans
kevans at FreeBSD.org
Sat Nov 25 15:14:42 UTC 2017
Author: kevans
Date: Sat Nov 25 15:14:40 2017
New Revision: 326190
URL: https://svnweb.freebsd.org/changeset/base/326190
Log:
Add r-ccu support for the Allwinner a83t
The r-ccu on the a83t differs from the others only by what it names the
ar100 parents. Export the _CCU macros (now converted to an enu) so that
ccu_sun8i_r can differentiate between a83t r-ccu and the others, then add
the compat string for the a83t r-ccu.
Reviewed by: manu
Approved by: emaste (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D13206
Modified:
head/sys/arm/allwinner/a83t/files.a83t
head/sys/arm/allwinner/clkng/aw_ccung.c
head/sys/arm/allwinner/clkng/aw_ccung.h
head/sys/arm/allwinner/clkng/ccu_sun8i_r.c
Modified: head/sys/arm/allwinner/a83t/files.a83t
==============================================================================
--- head/sys/arm/allwinner/a83t/files.a83t Sat Nov 25 14:51:40 2017 (r326189)
+++ head/sys/arm/allwinner/a83t/files.a83t Sat Nov 25 15:14:40 2017 (r326190)
@@ -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
Modified: head/sys/arm/allwinner/clkng/aw_ccung.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_ccung.c Sat Nov 25 14:51:40 2017 (r326189)
+++ head/sys/arm/allwinner/clkng/aw_ccung.c Sat Nov 25 15:14:40 2017 (r326190)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
#if defined(SOC_ALLWINNER_A83T)
#include <arm/allwinner/clkng/ccu_a83t.h>
+#include <arm/allwinner/clkng/ccu_sun8i_r.h>
#endif
#include "clkdev_if.h"
@@ -88,28 +89,6 @@ static struct resource_spec aw_ccung_spec[] = {
{ -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 @@ static struct ofw_compat_data compat_data[] = {
#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 @@ aw_ccung_attach(device_t dev)
#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
}
Modified: head/sys/arm/allwinner/clkng/aw_ccung.h
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_ccung.h Sat Nov 25 14:51:40 2017 (r326189)
+++ head/sys/arm/allwinner/clkng/aw_ccung.h Sat Nov 25 15:14:40 2017 (r326190)
@@ -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;
Modified: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c
==============================================================================
--- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c Sat Nov 25 14:51:40 2017 (r326189)
+++ head/sys/arm/allwinner/clkng/ccu_sun8i_r.c Sat Nov 25 15:14:40 2017 (r326190)
@@ -70,6 +70,7 @@ static struct aw_ccung_gate ccu_sun8i_r_gates[] = {
};
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 @@ PREDIV_CLK(ar100_clk, CLK_AR100, /* id */
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 @@ DIV_CLK(apb0_clk,
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 @@ void
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]);
More information about the svn-src-all
mailing list