From patchwork Thu Apr 30 16:10:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 6305461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ABE099F1C2 for ; Thu, 30 Apr 2015 16:15:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4CD7201E4 for ; Thu, 30 Apr 2015 16:15:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C73C62012B for ; Thu, 30 Apr 2015 16:15:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ynr4h-0008Pr-Oe; Thu, 30 Apr 2015 16:12:31 +0000 Received: from smtp.csie.ntu.edu.tw ([140.112.30.61]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ynr3E-0007ap-1z for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2015 16:11:01 +0000 Received: from mirror2.csie.ntu.edu.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (Authenticated sender: b93043) by smtp.csie.ntu.edu.tw (Postfix) with ESMTPSA id 8E0E12034E; Fri, 1 May 2015 00:10:08 +0800 (CST) Received: by mirror2.csie.ntu.edu.tw (Postfix, from userid 1000) id 6EE895F928; Fri, 1 May 2015 00:10:08 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Lee Jones , Mike Turquette , Stephen Boyd Subject: [PATCH v2 3/5] mfd: sun6i-prcm: Add support for PRCM found on Allwinner A80 SoC Date: Fri, 1 May 2015 00:10:04 +0800 Message-Id: <1430410206-4410-4-git-send-email-wens@csie.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430410206-4410-1-git-send-email-wens@csie.org> References: <1430410206-4410-1-git-send-email-wens@csie.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150430_091100_451337_5FAB4D47 X-CRM114-Status: GOOD ( 11.66 ) X-Spam-Score: -2.3 (--) Cc: Chen-Yu Tsai , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for the PRCM on the A80 SoC. There is little to no document for this at the moment. Only register offsets are available. However with some testing, the clock and reset controls seem to be the similar to the ones on the A31. One thing that needs verifying is whether the apbs divider is the same as the A31 or the A23. The lowest divider is different between those 2 implementations. Signed-off-by: Chen-Yu Tsai --- .../devicetree/bindings/mfd/sun6i-prcm.txt | 3 +- drivers/mfd/sun6i-prcm.c | 58 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt b/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt index 03c5a551da55..c100abfcb2a4 100644 --- a/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt +++ b/Documentation/devicetree/bindings/mfd/sun6i-prcm.txt @@ -4,7 +4,8 @@ PRCM is an MFD device exposing several Power Management related devices (like clks and reset controllers). Required properties: - - compatible: "allwinner,sun6i-a31-prcm" or "allwinner,sun8i-a23-prcm" + - compatible: "allwinner,sun6i-a31-prcm", "allwinner,sun8i-a23-prcm", + "allwinner,sun9i-a80-prcm" - reg: The PRCM registers range The prcm node may contain several subdevices definitions: diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c index 191173166d65..e56344f04066 100644 --- a/drivers/mfd/sun6i-prcm.c +++ b/drivers/mfd/sun6i-prcm.c @@ -33,6 +33,22 @@ static const struct resource sun6i_a31_apb0_clk_res[] = { }, }; +static const struct resource sun9i_a80_cpus_clk_res[] = { + { + .start = 0x10, + .end = 0x13, + .flags = IORESOURCE_MEM, + }, +}; + +static const struct resource sun9i_a80_apbs_clk_res[] = { + { + .start = 0x1c, + .end = 0x1f, + .flags = IORESOURCE_MEM, + }, +}; + static const struct resource sun6i_a31_apb0_gates_clk_res[] = { { .start = 0x28, @@ -111,6 +127,39 @@ static const struct mfd_cell sun8i_a23_prcm_subdevs[] = { }, }; +static const struct mfd_cell sun9i_a80_prcm_subdevs[] = { + { + .name = "sun9i-a80-cpus-clk", + .of_compatible = "allwinner,sun9i-a80-cpus-clk", + .num_resources = ARRAY_SIZE(sun9i_a80_cpus_clk_res), + .resources = sun9i_a80_cpus_clk_res, + }, + { + .name = "sun9i-a80-apbs-clk", + .of_compatible = "allwinner,sun8i-a23-apb0-clk", + .num_resources = ARRAY_SIZE(sun9i_a80_apbs_clk_res), + .resources = sun9i_a80_apbs_clk_res, + }, + { + .name = "sun9i-a80-apbs-gates-clk", + .of_compatible = "allwinner,sun9i-a80-apbs-gates-clk", + .num_resources = ARRAY_SIZE(sun6i_a31_apb0_gates_clk_res), + .resources = sun6i_a31_apb0_gates_clk_res, + }, + { + .name = "sun9i-a80-r-ir-clk", + .of_compatible = "allwinner,sun4i-a10-mod0-clk", + .num_resources = ARRAY_SIZE(sun6i_a31_ir_clk_res), + .resources = sun6i_a31_ir_clk_res, + }, + { + .name = "sun9i-a80-apbs-clock-reset", + .of_compatible = "allwinner,sun6i-a31-clock-reset", + .num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res), + .resources = sun6i_a31_apb0_rstc_res, + }, +}; + static const struct prcm_data sun6i_a31_prcm_data = { .nsubdevs = ARRAY_SIZE(sun6i_a31_prcm_subdevs), .subdevs = sun6i_a31_prcm_subdevs, @@ -121,6 +170,11 @@ static const struct prcm_data sun8i_a23_prcm_data = { .subdevs = sun8i_a23_prcm_subdevs, }; +static const struct prcm_data sun9i_a80_prcm_data = { + .nsubdevs = ARRAY_SIZE(sun9i_a80_prcm_subdevs), + .subdevs = sun9i_a80_prcm_subdevs, +}; + static const struct of_device_id sun6i_prcm_dt_ids[] = { { .compatible = "allwinner,sun6i-a31-prcm", @@ -130,6 +184,10 @@ static const struct of_device_id sun6i_prcm_dt_ids[] = { .compatible = "allwinner,sun8i-a23-prcm", .data = &sun8i_a23_prcm_data, }, + { + .compatible = "allwinner,sun9i-a80-prcm", + .data = &sun9i_a80_prcm_data, + }, { /* sentinel */ }, };