From owner-svn-src-all@FreeBSD.ORG Thu May 21 07:01:10 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F96D9CE; Thu, 21 May 2015 07:01:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D56C1AA3; Thu, 21 May 2015 07:01:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L71ANU005056; Thu, 21 May 2015 07:01:10 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L719QJ005053; Thu, 21 May 2015 07:01:09 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201505210701.t4L719QJ005053@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Thu, 21 May 2015 07:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283181 - in head/sys: arm/amlogic/aml8726 boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 07:01:10 -0000 Author: ganbold Date: Thu May 21 07:01:08 2015 New Revision: 283181 URL: https://svnweb.freebsd.org/changeset/base/283181 Log: The RTC initialization values are based on the SoC which can be determined at runtime so there's no need to set the values in each DTS. Tested on YYHD18 (aml8726-m3), VSATV102 (aml8726-m6), and ODROIDC1 (aml8726-m8b). Differential Revision: https://reviews.freebsd.org/D2588 Submitted by: John Wehle Modified: head/sys/arm/amlogic/aml8726/aml8726_rtc.c head/sys/boot/fdt/dts/arm/odroidc1.dts head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Modified: head/sys/arm/amlogic/aml8726/aml8726_rtc.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_rtc.c Thu May 21 06:58:50 2015 (r283180) +++ head/sys/arm/amlogic/aml8726/aml8726_rtc.c Thu May 21 07:01:08 2015 (r283181) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #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"); Modified: head/sys/boot/fdt/dts/arm/odroidc1.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/odroidc1.dts Thu May 21 06:58:50 2015 (r283180) +++ head/sys/boot/fdt/dts/arm/odroidc1.dts Thu May 21 07:01:08 2015 (r283181) @@ -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 { Modified: head/sys/boot/fdt/dts/arm/vsatv102-m6.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Thu May 21 06:58:50 2015 (r283180) +++ head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Thu May 21 07:01:08 2015 (r283181) @@ -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 {