From patchwork Thu Nov 20 15:55:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 5349141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3577A9F1E1 for ; Thu, 20 Nov 2014 15:56:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD6F1201B9 for ; Thu, 20 Nov 2014 15:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B43562015D for ; Thu, 20 Nov 2014 15:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757588AbaKTP4g (ORCPT ); Thu, 20 Nov 2014 10:56:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47629 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757329AbaKTP4H (ORCPT ); Thu, 20 Nov 2014 10:56:07 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAKFtc4g007702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Nov 2014 10:55:39 -0500 Received: from shalem.localdomain.com (vpn1-7-214.ams2.redhat.com [10.36.7.214]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAKFtTZw032315; Thu, 20 Nov 2014 10:55:37 -0500 From: Hans de Goede To: Emilio Lopez , Maxime Ripard Cc: Mike Turquette , Linux Media Mailing List , linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH 3/9] clk: sunxi: Add prcm mod0 clock driver Date: Thu, 20 Nov 2014 16:55:22 +0100 Message-Id: <1416498928-1300-4-git-send-email-hdegoede@redhat.com> In-Reply-To: <1416498928-1300-1-git-send-email-hdegoede@redhat.com> References: <1416498928-1300-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add a driver for mod0 clocks found in the prcm. Currently there is only one mod0 clocks in the prcm, the ir clock. Signed-off-by: Hans de Goede --- Documentation/devicetree/bindings/clock/sunxi.txt | 1 + drivers/clk/sunxi/Makefile | 2 +- drivers/clk/sunxi/clk-sun6i-prcm-mod0.c | 63 +++++++++++++++++++++++ drivers/mfd/sun6i-prcm.c | 14 +++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/sunxi/clk-sun6i-prcm-mod0.c diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt index ed116df..342c75a 100644 --- a/Documentation/devicetree/bindings/clock/sunxi.txt +++ b/Documentation/devicetree/bindings/clock/sunxi.txt @@ -56,6 +56,7 @@ Required properties: "allwinner,sun4i-a10-usb-clk" - for usb gates + resets on A10 / A20 "allwinner,sun5i-a13-usb-clk" - for usb gates + resets on A13 "allwinner,sun6i-a31-usb-clk" - for usb gates + resets on A31 + "allwinner,sun6i-a31-ir-clk" - for the ir clock on A31 Required properties for all clocks: - reg : shall be the control register address for the clock. diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile index 7ddc2b5..daf8b1c 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile @@ -10,4 +10,4 @@ obj-y += clk-sun8i-mbus.o obj-$(CONFIG_MFD_SUN6I_PRCM) += \ clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \ - clk-sun8i-apb0.o + clk-sun8i-apb0.o clk-sun6i-prcm-mod0.o diff --git a/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c b/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c new file mode 100644 index 0000000..e80f18e --- /dev/null +++ b/drivers/clk/sunxi/clk-sun6i-prcm-mod0.c @@ -0,0 +1,63 @@ +/* + * Allwinner A31 PRCM mod0 clock driver + * + * Copyright (C) 2014 Hans de Goede + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include + +#include "clk-factors.h" +#include "clk-mod0.h" + +static const struct of_device_id sun6i_a31_prcm_mod0_clk_dt_ids[] = { + { .compatible = "allwinner,sun6i-a31-ir-clk" }, + { /* sentinel */ } +}; + +static DEFINE_SPINLOCK(sun6i_prcm_mod0_lock); + +static int sun6i_a31_prcm_mod0_clk_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct resource *r; + void __iomem *reg; + + if (!np) + return -ENODEV; + + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + reg = devm_ioremap_resource(&pdev->dev, r); + if (IS_ERR(reg)) + return PTR_ERR(reg); + + sunxi_factors_register(np, &sun4i_a10_mod0_data, + &sun6i_prcm_mod0_lock, reg); + return 0; +} + +static struct platform_driver sun6i_a31_prcm_mod0_clk_driver = { + .driver = { + .name = "sun6i-a31-prcm-mod0-clk", + .of_match_table = sun6i_a31_prcm_mod0_clk_dt_ids, + }, + .probe = sun6i_a31_prcm_mod0_clk_probe, +}; +module_platform_driver(sun6i_a31_prcm_mod0_clk_driver); + +MODULE_DESCRIPTION("Allwinner A31 PRCM mod0 clock driver"); +MODULE_AUTHOR("Hans de Goede "); +MODULE_LICENSE("GPL"); diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c index 283ab8d..ff1254f 100644 --- a/drivers/mfd/sun6i-prcm.c +++ b/drivers/mfd/sun6i-prcm.c @@ -41,6 +41,14 @@ static const struct resource sun6i_a31_apb0_gates_clk_res[] = { }, }; +static const struct resource sun6i_a31_ir_clk_res[] = { + { + .start = 0x54, + .end = 0x57, + .flags = IORESOURCE_MEM, + }, +}; + static const struct resource sun6i_a31_apb0_rstc_res[] = { { .start = 0xb0, @@ -69,6 +77,12 @@ static const struct mfd_cell sun6i_a31_prcm_subdevs[] = { .resources = sun6i_a31_apb0_gates_clk_res, }, { + .name = "sun6i-a31-ir-clk", + .of_compatible = "allwinner,sun6i-a31-ir-clk", + .num_resources = ARRAY_SIZE(sun6i_a31_ir_clk_res), + .resources = sun6i_a31_ir_clk_res, + }, + { .name = "sun6i-a31-apb0-clock-reset", .of_compatible = "allwinner,sun6i-a31-clock-reset", .num_resources = ARRAY_SIZE(sun6i_a31_apb0_rstc_res),