From patchwork Tue Mar 13 16:34:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel FERNANDEZ X-Patchwork-Id: 10279979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B243602C2 for ; Tue, 13 Mar 2018 16:36:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2959A2908A for ; Tue, 13 Mar 2018 16:36:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D92129092; Tue, 13 Mar 2018 16:36:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73D3E2908A for ; Tue, 13 Mar 2018 16:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l+nDN0Jzxzlsc6I9mp6d350CGaU6OuZv2I6ZfGawFqk=; b=Y7wTozcxz0trml 17QMhH3rGQils9Abpc1sqYykUOID7bDssUqyoZIIk1kmwVEH+emA7m2N4rrX+PY43ID81O2aagJc8 Uh8cnr3Jxs3rD0ls3x+FaJo9K5d4v0oTlrjnmfGW8izsgA8iyXZzBpr/HwvYkrGbQX+/Guak+uq9n VfE0Miag+d72ySXcLKSJPF2Z6jC+f86xa58cFzii4MugeMR2J6xQv6d7rVZP+s+HoJqKTH/R7Ohg6 ZsJh8Yg2A0au13H4WSlv0/15ITdCMc26wkpTxd5qLs0C9fX+v9DlPgF6jU4brCjJePMfbm+hIDeC2 +7j7lUzGgYgDKKRKvruw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1evmuM-0001Qi-9E; Tue, 13 Mar 2018 16:36:14 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1evmsw-00079Z-DL for linux-arm-kernel@lists.infradead.org; Tue, 13 Mar 2018 16:34:54 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w2DGY5Jm028955; Tue, 13 Mar 2018 17:34:31 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2gpc6wa0bj-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 13 Mar 2018 17:34:31 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 053D05D; Tue, 13 Mar 2018 16:34:28 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag4node2.st.com [10.75.127.11]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9DFA9A634; Tue, 13 Mar 2018 16:34:27 +0000 (GMT) Received: from localhost (10.75.127.45) by SFHDAG4NODE2.st.com (10.75.127.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 13 Mar 2018 17:34:27 +0100 From: To: Philipp Zabel , Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre Torgue , Subject: [PATCH 2/2] reset: simple: Enable stm32mp1 reset driver Date: Tue, 13 Mar 2018 17:34:19 +0100 Message-ID: <1520958859-27911-3-git-send-email-gabriel.fernandez@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520958859-27911-1-git-send-email-gabriel.fernandez@st.com> References: <1520958859-27911-1-git-send-email-gabriel.fernandez@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG6NODE2.st.com (10.75.127.17) To SFHDAG4NODE2.st.com (10.75.127.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-13_07:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180313_093450_131967_F2278838 X-CRM114-Status: GOOD ( 15.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, benjamin GAIGNARD , Loic PALLARDY , sboyd@kernel.org, Michael Turquette , linux-kernel@vger.kernel.org, gabriel.fernandez.st@gmail.com, Gabriel Fernandez , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gabriel Fernandez The stm32mp1 reset driver is quite similar to simple reset driver. The difference is that stm32mp1 has a reset SET register and a reset CLEAR register. Writing '0' on reset SET register has no effect Writing '1' on reset SET register activates the reset of the corresponding peripheral Writing '0' on reset CLEAR register has no effect Writing '1' on reset CLEAR register releases the reset of the corresponding peripheral Signed-off-by: Gabriel Fernandez --- drivers/reset/reset-simple.c | 27 +++++++++++++++++++++------ drivers/reset/reset-simple.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/reset/reset-simple.c b/drivers/reset/reset-simple.c index f7ce891..57ecb49 100644 --- a/drivers/reset/reset-simple.c +++ b/drivers/reset/reset-simple.c @@ -41,15 +41,23 @@ static int reset_simple_update(struct reset_controller_dev *rcdev, int offset = id % (reg_width * BITS_PER_BYTE); unsigned long flags; u32 reg; + void __iomem *addr; spin_lock_irqsave(&data->lock, flags); - reg = readl(data->membase + (bank * reg_width)); - if (assert ^ data->active_low) - reg |= BIT(offset); - else - reg &= ~BIT(offset); - writel(reg, data->membase + (bank * reg_width)); + addr = data->membase + (bank * reg_width); + if (data->clr_offset) { + reg = BIT(offset); + if (!assert) + addr += data->clr_offset; + } else { + reg = readl(addr); + if (assert ^ data->active_low) + reg |= BIT(offset); + else + reg &= ~BIT(offset); + } + writel(reg, addr); spin_unlock_irqrestore(&data->lock, flags); @@ -103,6 +111,7 @@ struct reset_simple_devdata { u32 nr_resets; bool active_low; bool status_active_low; + u32 clr_offset; }; #define SOCFPGA_NR_BANKS 8 @@ -118,9 +127,14 @@ struct reset_simple_devdata { .status_active_low = true, }; +struct reset_simple_devdata reset_stm32mp1 = { + .clr_offset = 0x4, +}; + static const struct of_device_id reset_simple_dt_ids[] = { { .compatible = "altr,rst-mgr", .data = &reset_simple_socfpga }, { .compatible = "st,stm32-rcc", }, + { .compatible = "st,stm32mp1-rcc", .data = &reset_stm32mp1}, { .compatible = "allwinner,sun6i-a31-clock-reset", .data = &reset_simple_active_low }, { .compatible = "zte,zx296718-reset", @@ -163,6 +177,7 @@ static int reset_simple_probe(struct platform_device *pdev) data->rcdev.nr_resets = devdata->nr_resets; data->active_low = devdata->active_low; data->status_active_low = devdata->status_active_low; + data->clr_offset = devdata->clr_offset; } if (of_device_is_compatible(dev->of_node, "altr,rst-mgr") && diff --git a/drivers/reset/reset-simple.h b/drivers/reset/reset-simple.h index 8a49602..0bbdd34 100644 --- a/drivers/reset/reset-simple.h +++ b/drivers/reset/reset-simple.h @@ -38,6 +38,7 @@ struct reset_simple_data { struct reset_controller_dev rcdev; bool active_low; bool status_active_low; + u32 clr_offset; }; extern const struct reset_control_ops reset_simple_ops;