Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp922472imu; Wed, 28 Nov 2018 01:34:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wo6OoZ16kAJQUWvNcH+Y1+g3L+KDdX4K0xycmKkScaxRNhNIygTd2yLoUk4YnSHprEfMKG X-Received: by 2002:a63:413:: with SMTP id 19mr32238884pge.7.1543397654527; Wed, 28 Nov 2018 01:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543397654; cv=none; d=google.com; s=arc-20160816; b=y6AbbghIHbrA8HFCRypx4dk3o2Za5dgyTfbwUrIYaVTR83kkJibvhS8cip//QqfMyC HnxhKsI/y7X9wDOdSYgBCF0NQG0+RY4JG7wH4OhkY8jbZj0lDkivPYFIyL999PQSN6SP j5BnSD5h9ewX+WzJ24NXympEocwkp75CtoYDMUuQHftUhlznRaAxCdPPjHQttXHPvIQ5 nd0ctQCSsBn9/wE2XDblFyjaUxnBpubnWR8m+VCtbwL5waLk5ofUWtdw+UBR8sYbZL9O 6pTETJ6NwSoXlOe5Jd6ghhZQocpU3UGeUuKpY/MP2jkcXnnjxLQOW2Lwp9yEvsPxHtfE iQZA== 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=uZwHgNNbbdaDZ7U3mOBCd5CkomYxSv48yePmBDrC9JI=; b=JrDqF89WBBVOMSkWozGc6W6rInO/Q7YdqkwoAGs+J0EprCt7adbxL1k/6roo0m5HJ0 QWKnNLwRvAFdYTMsaGs3WJ0tbU28tPzB+5iVyWi1MCAQHgDhdwdXa2nbpKXwqbLhdp7z IgHlMBcyzUVwFOEPhXHJgZX2s7eRvYFqortLYmXbeH2Om5zMSmXi9MN7okZN3+6mK4wZ qly5cj148IOE636L3cNXvyE1qCDEaQRU/P3icgphOTSbQxFVbMqlVNovdOsuSqmtlRLG gBqbGIa5oBYIZ3XBzjwFlhStmlUb+6nMjs6I5lfs3VL1jbpvR4jpTzbRJOah/exDhHH6 gH+A== 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 y27si6503437pga.459.2018.11.28.01.33.59; Wed, 28 Nov 2018 01:34:14 -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 S1728420AbeK1Uch (ORCPT + 99 others); Wed, 28 Nov 2018 15:32:37 -0500 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:49296 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728168AbeK1Ubf (ORCPT ); Wed, 28 Nov 2018 15:31:35 -0500 Received: by wens.csie.org (Postfix, from userid 1000) id 686A26018C; 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 pre-H6 variants Date: Wed, 28 Nov 2018 17:30:04 +0800 Message-Id: <20181128093013.24442-8-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 pre-H6 base compatibles using the variants data structure previously introduced. Signed-off-by: Chen-Yu Tsai --- drivers/rtc/rtc-sun6i.c | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index d1866d90b9ef..62ed9ce53d8c 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,10 @@ 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" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids); -- 2.20.0.rc1