From patchwork Sat May 16 00:23:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 6418511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5DAB5C0432 for ; Sat, 16 May 2015 00:27:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73D6B20567 for ; Sat, 16 May 2015 00:27:58 +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 7845D201CE for ; Sat, 16 May 2015 00:27:57 +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 1YtPvF-0007pM-2h; Sat, 16 May 2015 00:25:45 +0000 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YtPtl-0006Dj-Iz for linux-arm-kernel@lists.infradead.org; Sat, 16 May 2015 00:24:17 +0000 Received: by wicnf17 with SMTP id nf17so8175551wic.1 for ; Fri, 15 May 2015 17:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uXR7RZphuGnAHOHx9UYsIih+heA6Xg+/Lc179XtrvHU=; b=F+WFD9WD31iuQ63EpByy0KYKIWVmkI8i8pRYATYSYs9qGXRsZk7nEjjhY3RffaOIG3 lqrhTjA9my1yiM5QV7+/eJnkgw3+QwRR9GMCyEF2RVImyZplQbEiZgVfQHM3hTA43LCK 2od1EnV3Bkrd8GeLZKZLX+tsfY93IXXFFpAd3MVJ4clT4LRQsjkjVyoVwDreg4EnKxCf wkrwDTc+ur6bVJVVCu1V17UWVkveSS9S/14+CREd9TgRa5iwW5C7Tb6caNSo0HOthOxj hj/dOqKPf0YAz/8axWXCGFSNyLBZCvnfyMt6RnMR2Ck/c3f+V+2COViGXZcgrv5/Ur/H apfA== X-Received: by 10.181.13.144 with SMTP id ey16mr1961832wid.38.1431735831477; Fri, 15 May 2015 17:23:51 -0700 (PDT) Received: from topkick.lan (x5ce62600.dyn.telefonica.de. [92.230.38.0]) by mx.google.com with ESMTPSA id ex2sm4849089wjd.28.2015.05.15.17.23.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 17:23:49 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH 03/14] reset: berlin: convert to a platform driver Date: Sat, 16 May 2015 02:23:32 +0200 Message-Id: <1431735823-28006-4-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1431735823-28006-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1431735823-28006-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150515_172413_807193_4A3186D5 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -0.8 (/) Cc: Philipp Zabel , Antoine Ternart , linux-arm-kernel@lists.infradead.org, Arnd Bergmann 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: Antoine Tenart The Berlin reset controller was introduced without being a platform driver because of a needed DT rework: the node describing the reset controller also describes the pinctrl and clk controllers... Prepare conversion by adding a platform driver probe to a new compatible "marvell,berlin2-reset" with syscon regmap. Signed-off-by: Antoine Tenart Acked-by: Philipp Zabel Signed-off-by: Sebastian Hesselbarth --- Cc: Philipp Zabel --- drivers/reset/reset-berlin.c | 53 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c index f8b48a13cf0b..d43bc163dd02 100644 --- a/drivers/reset/reset-berlin.c +++ b/drivers/reset/reset-berlin.c @@ -11,10 +11,12 @@ #include #include +#include #include #include #include #include +#include #include #include #include @@ -27,6 +29,7 @@ struct berlin_reset_priv { void __iomem *base; unsigned int size; + struct regmap *regmap; struct reset_controller_dev rcdev; }; @@ -37,7 +40,10 @@ static int berlin_reset_reset(struct reset_controller_dev *rcdev, int offset = id >> 8; int mask = BIT(id & 0x1f); - writel(mask, priv->base + offset); + if (priv->regmap) + regmap_write(priv->regmap, offset, mask); + else + writel(mask, priv->base + offset); /* let the reset be effective */ udelay(10); @@ -70,6 +76,51 @@ static int berlin_reset_xlate(struct reset_controller_dev *rcdev, return (offset << 8) | bit; } +static int berlin2_reset_probe(struct platform_device *pdev) +{ + struct device_node *parent_np = of_get_parent(pdev->dev.of_node); + struct berlin_reset_priv *priv; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + + priv->rcdev.owner = THIS_MODULE; + priv->rcdev.ops = &berlin_reset_ops; + priv->rcdev.of_node = pdev->dev.of_node; + priv->rcdev.of_reset_n_cells = 2; + priv->rcdev.of_xlate = berlin_reset_xlate; + + reset_controller_register(&priv->rcdev); + + return 0; +} + +static const struct of_device_id berlin_reset_dt_match[] = { + { .compatible = "marvell,berlin2-reset" }, + { }, +}; +MODULE_DEVICE_TABLE(of, berlin_reset_dt_match); + +static struct platform_driver berlin_reset_driver = { + .probe = berlin2_reset_probe, + .driver = { + .name = "berlin2-reset", + .of_match_table = berlin_reset_dt_match, + }, +}; +module_platform_driver(berlin_reset_driver); + +MODULE_AUTHOR("Antoine Tenart "); +MODULE_AUTHOR("Sebastian Hesselbarth "); +MODULE_DESCRIPTION("Marvell Berlin reset driver"); +MODULE_LICENSE("GPL"); + static int __berlin_reset_init(struct device_node *np) { struct berlin_reset_priv *priv;