Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp920770imu; Wed, 28 Nov 2018 01:32:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/Va9w6akVIUNrgwnKgJg+ij8Pwn8lRTidkLAR9xJobHSEHmQX21Ik1I/erO0XB3CTpk4oFg X-Received: by 2002:a63:4611:: with SMTP id t17mr3787342pga.119.1543397539389; Wed, 28 Nov 2018 01:32:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543397539; cv=none; d=google.com; s=arc-20160816; b=g/m9AypMkdbQN8Ehq4qmbMHE78yRXDNQFOX3hCMSLdlmC98KiJxjcSQ6U82vM4XFGc 973gEzu7TIIZ+Flycnil1mwYWkmJh8HNwj8YwiaF9c5RwBYYVkyoeQAk+ak+rKlk+aaf WWjieB9Iz1yKpoXT/OYeIolMJfSRxYlurwzyCOwAoOZwAij35BRfxixWRv/imHlZ3dDA 9bDtTb4k3hTkI1dlBB33E4PumY3yIRIKuIlTG6rYvHLZ7lUyJoREcfocnoJFavy67yJm 1UzXW1Jj1HlB7Iq+srPDVXG4EyqUO7XaI81N4PGl8V1SldRrS6qTP0TtQfTBZVsgfZrc na+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fXhvMolpm9zr/OHCGKbECNxYlFdFUjmeeXZx13YaI94=; b=UildzitvSXwGnzGOyCeo6O8oX7kxuiyPZRicweeWMx4LDoqLd/Lvnwv21OJikujB4o DxXPbvw153/vthm/pSqula46V4USMQFjzVL0cOEgOWrks4z6dX//TbY55Xb+6vv1QYd0 KRxP82lFA0zCab3EAJzkmkS/HrYUYIgALDvqAaGHOZZ02J3ZVmEalTxFeQyAZtHyV+sh 16jRQdRWCUvvo19FTQWb5uIt4zs05nBWVBG8cdfYsKjYIMXyfliiX2nbfqS32/HhB4u2 DAsdc0FYJH3XYxtC9s27vUvmP+O3nyDkmi28rR06WUZeYqawE+tSpWIvHjT8u99p+vOn yXqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az5si6737204plb.166.2018.11.28.01.32.04; Wed, 28 Nov 2018 01:32:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728366AbeK1UcL (ORCPT + 99 others); Wed, 28 Nov 2018 15:32:11 -0500 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:49294 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728172AbeK1Ubf (ORCPT ); Wed, 28 Nov 2018 15:31:35 -0500 Received: by wens.csie.org (Postfix, from userid 1000) id 6C328601CD; Wed, 28 Nov 2018 17:30:28 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 07/15] rtc: sun6i: Add support for all known variants Date: Wed, 28 Nov 2018 17:30:05 +0800 Message-Id: <20181128093013.24442-9-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181128093013.24442-1-wens@csie.org> References: <20181128093013.24442-1-wens@csie.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are different variants to the RTC hardware first seen on sun6i (A31). The differences we care about in this driver are the clock rate for the internal oscillator, prescalers, and the presence of an external clock output. This patch adds support for all the known base compatibles using the variants data structure previously introduced. Signed-off-by: Chen-Yu Tsai --- drivers/rtc/rtc-sun6i.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index d1866d90b9ef..0a635e9cc25f 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -312,6 +312,50 @@ static void __init sun6i_a31_rtc_clk_init(struct device_node *node) CLK_OF_DECLARE_DRIVER(sun6i_a31_rtc_clk, "allwinner,sun6i-a31-rtc", sun6i_a31_rtc_clk_init); +static const struct sun6i_rtc_clk_data sun8i_a23_rtc_data = { + .rc_osc_rate = 667000, /* datasheet says 600 ~ 700 KHz */ + .has_prescaler = 1, + .has_out_clk = 1, +}; + +static void __init sun8i_a23_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_a23_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_a23_rtc_clk, "allwinner,sun8i-a23-rtc", + sun8i_a23_rtc_clk_init); + +static const struct sun6i_rtc_clk_data sun8i_h3_rtc_data = { + .rc_osc_rate = 16000000, + .fixed_prescaler = 32, + .has_prescaler = 1, + .has_out_clk = 1, +}; + +static void __init sun8i_h3_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_h3_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_h3_rtc_clk, "allwinner,sun8i-h3-rtc", + sun8i_h3_rtc_clk_init); +/* As far as we are concerned, clocks for H5 and H6 are the same as H3 */ +CLK_OF_DECLARE_DRIVER(sun50i_h5_rtc_clk, "allwinner,sun50i-h5-rtc", + sun8i_h3_rtc_clk_init); +CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc", + sun8i_h3_rtc_clk_init); + +static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { + .rc_osc_rate = 32000, + .has_out_clk = 1, +}; + +static void __init sun8i_v3_rtc_clk_init(struct device_node *node) +{ + sun6i_rtc_clk_init(node, &sun8i_v3_rtc_data); +} +CLK_OF_DECLARE_DRIVER(sun8i_v3_rtc_clk, "allwinner,sun8i-v3-rtc", + sun8i_v3_rtc_clk_init); + static irqreturn_t sun6i_rtc_alarmirq(int irq, void *id) { struct sun6i_rtc_dev *chip = (struct sun6i_rtc_dev *) id; @@ -625,6 +669,11 @@ static int sun6i_rtc_probe(struct platform_device *pdev) */ static const struct of_device_id sun6i_rtc_dt_ids[] = { { .compatible = "allwinner,sun6i-a31-rtc" }, + { .compatible = "allwinner,sun8i-a23-rtc" }, + { .compatible = "allwinner,sun8i-h3-rtc" }, + { .compatible = "allwinner,sun8i-v3-rtc" }, + { .compatible = "allwinner,sun50i-h5-rtc" }, + { .compatible = "allwinner,sun50i-h6-rtc" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids); -- 2.19.1