aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanbold Tsagaankhuu <ganbold@FreeBSD.org>2015-05-21 07:01:08 +0000
committerGanbold Tsagaankhuu <ganbold@FreeBSD.org>2015-05-21 07:01:08 +0000
commit37da2ff61aff1e84f190f7ebb8635257e8d459a9 (patch)
treee6a7f81112722d2b395512f5efaf79899d2b449a
parentda3067c13825cb883296c5e4637ae22c9e2f2a1d (diff)
Notes
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_rtc.c51
-rw-r--r--sys/boot/fdt/dts/arm/odroidc1.dts4
-rw-r--r--sys/boot/fdt/dts/arm/vsatv102-m6.dts4
3 files changed, 18 insertions, 41 deletions
diff --git a/sys/arm/amlogic/aml8726/aml8726_rtc.c b/sys/arm/amlogic/aml8726/aml8726_rtc.c
index fe1246373ec2..5af51ce4d34d 100644
--- a/sys/arm/amlogic/aml8726/aml8726_rtc.c
+++ b/sys/arm/amlogic/aml8726/aml8726_rtc.c
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
+#include <arm/amlogic/aml8726/aml8726_soc.h>
+
#include "clock_if.h"
/*
@@ -372,44 +374,27 @@ static int
aml8726_rtc_attach(device_t dev)
{
struct aml8726_rtc_softc *sc = device_get_softc(dev);
- boolean_t init_always_valid;
- char *init_always;
- pcell_t prop;
- phandle_t node;
- ssize_t len;
sc->dev = dev;
- node = ofw_bus_get_node(dev);
-
- len = OF_getprop_alloc(node, "init-always",
- sizeof(char), (void **)&init_always);
- sc->init.always = FALSE;
- init_always_valid = FALSE;
- if (len > 0) {
- if (strncmp(init_always, "true", len) == 0) {
- sc->init.always = TRUE;
- init_always_valid = TRUE;
- } else if (strncmp(init_always, "false", len) == 0)
- init_always_valid = TRUE;
- free(init_always, M_OFWPROP);
- }
- if (init_always_valid == FALSE) {
- device_printf(dev, "missing init-always attribute in FDT\n");
- return (ENXIO);
- }
-
- if (OF_getencprop(node, "xo-init", &prop, sizeof(prop)) <= 0) {
- device_printf(dev, "missing xo-init attribute in FDT\n");
- return (ENXIO);
- }
- sc->init.xo = prop;
-
- if (OF_getencprop(node, "gpo-init", &prop, sizeof(prop)) <= 0) {
- device_printf(dev, "missing gpo-init attribute in FDT\n");
+ switch (aml8726_soc_hw_rev) {
+ case AML_SOC_HW_REV_M3:
+ sc->init.always = true;
+ sc->init.xo = 0x3c0a;
+ sc->init.gpo = 0x100000;
+ break;
+ case AML_SOC_HW_REV_M6:
+ case AML_SOC_HW_REV_M8:
+ case AML_SOC_HW_REV_M8B:
+ sc->init.always = false;
+ sc->init.xo = 0x180a;
+ sc->init.gpo = 0x500000;
+ break;
+ default:
+ device_printf(dev, "unsupported SoC\n");
return (ENXIO);
+ /* NOTREACHED */
}
- sc->init.gpo = prop;
if (bus_alloc_resources(dev, aml8726_rtc_spec, sc->res)) {
device_printf(dev, "can not allocate resources for device\n");
diff --git a/sys/boot/fdt/dts/arm/odroidc1.dts b/sys/boot/fdt/dts/arm/odroidc1.dts
index 3079a9fd6bc0..aadaef37112b 100644
--- a/sys/boot/fdt/dts/arm/odroidc1.dts
+++ b/sys/boot/fdt/dts/arm/odroidc1.dts
@@ -194,10 +194,6 @@
compatible = "amlogic,aml8726-rtc";
reg = <0xc8100740 20>; /* aobus 0x1d0 */
interrupts = <0 72 1>;
-
- init-always = "false";
- xo-init = <0x180a>;
- gpo-init = <0x500000>;
};
clkmsr: clkmsr@c1108758 {
diff --git a/sys/boot/fdt/dts/arm/vsatv102-m6.dts b/sys/boot/fdt/dts/arm/vsatv102-m6.dts
index 3ca8fc9038c5..786f80a43223 100644
--- a/sys/boot/fdt/dts/arm/vsatv102-m6.dts
+++ b/sys/boot/fdt/dts/arm/vsatv102-m6.dts
@@ -153,10 +153,6 @@
compatible = "amlogic,aml8726-rtc";
reg = <0xda004340 20>; /* secbus2 0xd0 */
interrupts = <0 72 1>; /* AM_IRQ2(8) */
-
- init-always = "false";
- xo-init = <0x180a>;
- gpo-init = <0x500000>;
};
clkmsr: clkmsr@c1108758 {