From patchwork Thu May 21 17:03:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 11563569 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93211739 for ; Thu, 21 May 2020 17:04:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72AA12083E for ; Thu, 21 May 2020 17:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590080656; bh=Hq8G/n1aTE0RbeAZXasbY8Sy3Jzb3ZkNEOp6LANBSIw=; h=From:To:Cc:Subject:Date:List-ID:From; b=pPJvhW7CWuiw6Yk6VOjvp+9jRH46iITjWt1KJKO6uE4uhJGLBIYvBwe/qCvpdif9g vsWNBxOxTpgsxuGUM9zJCwpWJZmZYOVuhRamFSyMPFG5o55cfMrQJ5Be+hV+anEnd5 +JVtRZs/9wXqiP1Zvg3j3V/L8OYUKefAOGDW0z98= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730292AbgEUREH (ORCPT ); Thu, 21 May 2020 13:04:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:41156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730288AbgEUREH (ORCPT ); Thu, 21 May 2020 13:04:07 -0400 Received: from localhost.localdomain (cpe-70-114-128-244.austin.res.rr.com [70.114.128.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 022AA207F7; Thu, 21 May 2020 17:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590080646; bh=Hq8G/n1aTE0RbeAZXasbY8Sy3Jzb3ZkNEOp6LANBSIw=; h=From:To:Cc:Subject:Date:From; b=0Le+xT4gTl4liBmnVzcMWErxSLdTnCCRS9fmY9icqejD6O+fG/AGexgDKZYqQWYRR 24CHEok0mNKrN8MjnoEE9OwFCql7J9bqzmJh9ymb7bA4B0s6WldT5fSbWL72gAUr0L oAkEgfrxUPJuhfvTYipHS6Eg/Lch5Drx2ZfzTYyM= From: Dinh Nguyen To: linux-kernel@vger.kernel.org Cc: dinguyen@kernel.org, devicetree@vger.kernel.org, broonie@kernel.org, robh+dt@kernel.org, linux-spi@vger.kernel.org, Liang Jin J Subject: [PATCH 1/2] spi: dw: add reset control Date: Thu, 21 May 2020 12:03:58 -0500 Message-Id: <20200521170359.20430-1-dinguyen@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add mechanism to get the reset control and deassert it in order to bring the IP out of reset. Signed-off-by: Liang Jin J Signed-off-by: Dinh Nguyen --- drivers/spi/spi-dw-mmio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 384a3ab6dc2d..5c813e15ed89 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "spi-dw.h" @@ -30,6 +31,7 @@ struct dw_spi_mmio { struct clk *clk; struct clk *pclk; void *priv; + struct reset_control *rstc; }; #define MSCC_CPU_SYSTEM_CTRL_GENERAL_CTRL 0x24 @@ -145,6 +147,10 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) if (!dwsmmio) return -ENOMEM; + dwsmmio->rstc = devm_reset_control_get_exclusive(&pdev->dev, "spi"); + if (!IS_ERR(dwsmmio->rstc)) + reset_control_deassert(dwsmmio->rstc); + dws = &dwsmmio->dws; /* Get basic io resource and map it */ @@ -220,6 +226,9 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) clk_disable_unprepare(dwsmmio->pclk); clk_disable_unprepare(dwsmmio->clk); + if (dwsmmio->rstc) + reset_control_assert(dwsmmio->rstc); + return 0; } From patchwork Thu May 21 17:03:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 11563567 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B2FB913 for ; Thu, 21 May 2020 17:04:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EA9A2083E for ; Thu, 21 May 2020 17:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590080656; bh=ByMsLNxOv98oD1I2QYWRxCwZOStuOsJ8QrLvIt31QKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lA1E9zEhUEr3SWOJ/HwRJS3N44WfFYknQJurP6Pmx6BPEjFoziJwGXwNLbYie4voZ w5f4GFEhE9ngZd2tIGRpwDPAEtvuqgLIuHVOjH5q9Hupev6X8r3HLW0Yc1JJCrYEsg EMDRNW7IAx1PGFXGlrB265dOful57Uki4BE+j4S0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730316AbgEUREM (ORCPT ); Thu, 21 May 2020 13:04:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:41180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730290AbgEUREI (ORCPT ); Thu, 21 May 2020 13:04:08 -0400 Received: from localhost.localdomain (cpe-70-114-128-244.austin.res.rr.com [70.114.128.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0718820884; Thu, 21 May 2020 17:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590080647; bh=ByMsLNxOv98oD1I2QYWRxCwZOStuOsJ8QrLvIt31QKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEWX/A2oF2OsTQvKsQzx1VKJFvSfCWBtkpcqgBPKZO4a5l1STPNfU2YJS8csgUYV0 H1Xs5V5nTZpviD5s2+EeDRquxVbz7fdMI4FjVxRjzob/WDnHAOmQaJLAR6j3BLl7Yo TZ0/Y40CgQX6mGYbWI04Z+8y643g53u9KaZd4mpE= From: Dinh Nguyen To: linux-kernel@vger.kernel.org Cc: dinguyen@kernel.org, devicetree@vger.kernel.org, broonie@kernel.org, robh+dt@kernel.org, linux-spi@vger.kernel.org Subject: [PATCH 2/2] dt-bindings: snps,dw-apb-ssi: add optional reset property Date: Thu, 21 May 2020 12:03:59 -0500 Message-Id: <20200521170359.20430-2-dinguyen@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521170359.20430-1-dinguyen@kernel.org> References: <20200521170359.20430-1-dinguyen@kernel.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add optional reset property. Signed-off-by: Dinh Nguyen --- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt b/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt index 3ed08ee9feba..e01c557a9876 100644 --- a/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt +++ b/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt @@ -37,5 +37,7 @@ Example: num-cs = <2>; cs-gpios = <&gpio0 13 0>, <&gpio0 14 0>; + resets = <&rst SPIM0_RST>; + reset-names = "spi"; };