From patchwork Sat Mar 9 01:56:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 10845695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A09F11390 for ; Sat, 9 Mar 2019 01:59:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8907C2DDC4 for ; Sat, 9 Mar 2019 01:59:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79E2F2DE68; Sat, 9 Mar 2019 01:59:16 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham 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 1BC522DDC4 for ; Sat, 9 Mar 2019 01:59:15 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=kenAoxT+dhU+maOTk+gvdA3qC4ozKFb2QM4XRFC0CME=; b=HQ9bAARhQbwC/NULo8hlufzBeA r1VARitZYJ5lABUGQR++AwhM5CZE2N5a0JTqdEnDpx0QjriTFc99vJ8HI9NkUBdHx5mYPSz65tgG/ EIV4Scvrb8qcBqd30mvbM4BnuwROC4vhJBFluRI94/P6vUT6UaYNTGuYfDpbmLltnTVu95yoQqNhm lvxGnpdvAR7eGA4EK3RKEsUI6mJR/KbG21r8xihw6EtON+zFIKHgz6JkD13X3Si9UaOf3uWiH5hb6 g+mCjTW1AoGUUXoXoCBrRnwBQjCOTq4oB2W+GRINBy6kqeYQGDCii3Xp/rpxIv0oYQ+r8L0U1qoRT xDXFMAzw==; 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 1h2RGc-0001xG-Er; Sat, 09 Mar 2019 01:59:14 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2RGQ-0001nc-Q0 for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2019 01:59:04 +0000 Received: by mail-pg1-x544.google.com with SMTP id u9so15509386pgo.7 for ; Fri, 08 Mar 2019 17:59:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hmQkxeVs4MCB6oMpxb4sXYFHVbv88QBQBaECu3FhUAw=; b=gYTsujj3IR8Pl11nrtaVLSL9KoRCtQ1YNf6qgMRX41MSoB31tWEJZLHK/iC9eAyvKA 1kPMtCkFwm229UcPcr8iGsIIXOScpGIozaXOxr87oU3A3mJWa54+dKyedQ1BYcA9Aws4 ehH4UiAvMnQM4dnjWglyU+yzKf7A69E459uYiZsK9V1bcgpV5bMUvItwDinNlhwFlXTK OfirSjnDP6LSUqPuQTha6wznbz4bIBsakCCXDN1wY9ZcKZqH9kLjYtuH6BapTM9RWwqR W9bJ70BbTvpLqmI1lWDYvu0M/IJuGUlcE9EiET5ppx15ng9cnhSyi1xeIoFDFL5fBAnW cdyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hmQkxeVs4MCB6oMpxb4sXYFHVbv88QBQBaECu3FhUAw=; b=IIhnC6vq+6f5XfU0Jyg83IADfhnLrLhjFDiIETsLu69hOb0WgKBNq5N1ch3M2A9Ysl QbEh5bEgS+5OM66ng3fmE7JOW6MDuPGVPaQx3Y1V/6HiqranO4f3AbE3p4LS+WssTDYa bdBc6m2NNhyH7lgjESzhTWojGgerSsZvAhxCyiP06HFTwzca0oP+Z9dFaV76bsGmNHLL VXmSjjDubPn7UIURYw1P96fxkN8szDoLREwmePzwWu3dtl1L+ISkBJH7ihAS+DEhVXg1 IGZhMamjGnEh+LnWwD3ETGFhpHrAPXamFEr37IxyyHcKH+D0IjhvN61rdMYpyugrDgtW 53mg== X-Gm-Message-State: APjAAAXFseCiAiB5kmLawsbqEBtdeJtpmcHqPH1+TgtnJZnnZ259d3IN 1AR7ylmIRZQ0k+d0xxUJ8cwM X-Google-Smtp-Source: APXvYqwNdosm94HFVwy9qMED0Rvapt+HF86uLidQQxpq6GgNVTKGvnULVQu2/o7LF6sXWa5bEbwbyA== X-Received: by 2002:a63:6a88:: with SMTP id f130mr19376393pgc.114.1552096742200; Fri, 08 Mar 2019 17:59:02 -0800 (PST) Received: from localhost.localdomain ([157.51.75.198]) by smtp.gmail.com with ESMTPSA id b65sm16040201pfm.127.2019.03.08.17.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 17:59:01 -0800 (PST) From: Manivannan Sadhasivam To: linux@armlinux.org.uk, xuwei5@hisilicon.com Subject: [PATCH 1/2] amba: Take device out of reset before reading pid and cid values Date: Sat, 9 Mar 2019 07:26:34 +0530 Message-Id: <20190309015635.5401-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190309015635.5401-1-manivannan.sadhasivam@linaro.org> References: <20190309015635.5401-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190308_175903_034460_3975D2A5 X-CRM114-Status: GOOD ( 13.99 ) 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: daniel.thompson@linaro.org, guodong.xu@linaro.org, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, peter.griffin@linaro.org, haojian.zhuang@linaro.org, Manivannan Sadhasivam , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 For the AMBA Primecell devices having the reset lines wired, it is necessary to take them out of reset before reading the pid and cid values. Earlier we were dependent on the bootloader to do this but a more cleaner approach would be to do it in the kernel itself. Hence, this commit deasserts the reset line just before reading the pid and cid values. Suggested-by: Daniel Thompson Signed-off-by: Manivannan Sadhasivam Reviewed-by: Linus Walleij --- drivers/amba/bus.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 41b706403ef7..da8f1aac5315 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -352,6 +353,7 @@ static void amba_device_release(struct device *dev) static int amba_device_try_add(struct amba_device *dev, struct resource *parent) { + struct reset_control *rst; u32 size; void __iomem *tmp; int i, ret; @@ -388,6 +390,13 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) if (ret == 0) { u32 pid, cid; + /* De-assert the reset line to take the device out of reset */ + rst = reset_control_get_optional_exclusive(&dev->dev, NULL); + if (IS_ERR(rst)) + return PTR_ERR(rst); + + reset_control_deassert(rst); + /* * Read pid and cid based on size of resource * they are located at end of region From patchwork Sat Mar 9 01:56:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 10845697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 261BA139A for ; Sat, 9 Mar 2019 01:59:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B8443003E for ; Sat, 9 Mar 2019 01:59:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0E5C30041; Sat, 9 Mar 2019 01:59:34 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham 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 936B63003E for ; Sat, 9 Mar 2019 01:59:34 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=pDqMjYaDLNszozuTd/HzTPkjR4Zb1C2s0TGcM6EnZOc=; b=YCbqwp+UyDK/Eeh2IjnyGYaSN7 2/ftLyWA8BwDD8rZTVC4pKaG9yoOxTz4uSOqKVysl3tzRmn0caMLwKtb+oMzEep9CtLkiux64ab8c XP9vtLAwq2G/mCifRyqABwjhHm5kcR4G6mgv52fUJEndvWCFebbEzJT49A2irvzunvEzoMEvwWwZ1 i8f2LiuoAiLI5i2WMtB1ptHP2TGVVeJ2eNCvn5oisoSPT/oxkEahTZyhHPhs+HhsN3yPtC52tlMHu tn0iu/rszHFUx9W3cQrETf+HVCIqO1NpVQ7F7wRYDIMhf3tUUD7LgSmupQwQdW2wVHXs9qMmLCey+ hoNmTZgw==; 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 1h2RGv-0002Gr-E8; Sat, 09 Mar 2019 01:59:33 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2RGX-0001uM-RV for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2019 01:59:11 +0000 Received: by mail-pg1-x542.google.com with SMTP id u9so15509513pgo.7 for ; Fri, 08 Mar 2019 17:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y/pIRq3eoYMGqKuzxQRW6Xe3PFikDk+GOICmlrRtQ4w=; b=BgtvqWkRjvb9c+Gh/OXuz6H7Ix6XfCEwIgrSWCB7ywmHqwpb8aRc3mFQwwBXErT+q/ GDEpx/TNa9emQWlTUAs9mo8BEipk3m9g25uP8fz+tbzx1sH4ULUOh5+Zy9RM9bcZkE6I ayubrBHrd723F2B8TjPXhMOxuqW+nSK71cKU6ZM50eU99unmTBIiTj0uFe/m1XMQOpbp S7YUcMfKUmw6bp4dVg8NAkURLowt+DeLEMiKiOB8LbxJ2k//Cq2u9mBCU2K3B3d8/ZtN /M35HtmK8tjCRpeNcCyB9yq07gpdU1eikVExZ2hoIqPK8jL3zgSB65qF8LKTw9aP1nEK YkrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/pIRq3eoYMGqKuzxQRW6Xe3PFikDk+GOICmlrRtQ4w=; b=semZznl/HZ83kaj1/ZdVHuQuErNBDNO5s4PZ166BTuuWmQfwKGyrYb7vW/8fmSJYLG 5gteqxkERtReLp4mlI3flE6PjWqXA0a8Ml46mUEqlgR8WhOpI+vr4yoyCOj05uyQw4tB 5UQDZVvZvEFwcV7NhmB+7Q6wjvlg/fj+OUZPrpuy8FU4kVVZM6znVfunmo6dhTnUd81U A1108rI2ZWCjzpUx6Spg7AE3FNcAwFueeiyYMhU5caT5yIDH7w6w4dbmApiOtKck7DCZ J+jAGr4CZd/BEJpa4KDJRZmLoRhhhoVsWKjx4DoMyMF+MkSfXTvvf/yhCWbzEKuzwTXk KgZA== X-Gm-Message-State: APjAAAVsKcAaTvJGhGZZLC0Cu9KEbw6i1F3HMISs59BMbsdB5N7HKtuG 1OsmIF+RfHkVOjLEZvXd5m0EtoeLyA== X-Google-Smtp-Source: APXvYqw7CuEXXWxNJ0uqXcWyOAyvjrvSCwZpgL7bwgKagnDdpoUA6Sq6eUP7YwzTftQWnUpe1EzArQ== X-Received: by 2002:a17:902:ba8d:: with SMTP id k13mr22137540pls.15.1552096748923; Fri, 08 Mar 2019 17:59:08 -0800 (PST) Received: from localhost.localdomain ([157.51.75.198]) by smtp.gmail.com with ESMTPSA id b65sm16040201pfm.127.2019.03.08.17.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 17:59:08 -0800 (PST) From: Manivannan Sadhasivam To: linux@armlinux.org.uk, xuwei5@hisilicon.com Subject: [PATCH 2/2] arm64: dts: hisilicon: Add reset properties for HI6220 I2C and SPI Date: Sat, 9 Mar 2019 07:26:35 +0530 Message-Id: <20190309015635.5401-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190309015635.5401-1-manivannan.sadhasivam@linaro.org> References: <20190309015635.5401-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190308_175910_110253_56339874 X-CRM114-Status: GOOD ( 11.62 ) 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: daniel.thompson@linaro.org, guodong.xu@linaro.org, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, peter.griffin@linaro.org, haojian.zhuang@linaro.org, Manivannan Sadhasivam , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 Both I2C and SPI needs to be taken out of reset before being used. Earlier, we relied on the bootloader to do the job but a more cleaner approach would be to handle the reset in kernel. Hence, add the reset properties to the nodes to let the corresponding drivers take the peripherals out of reset. Suggested-by: Daniel Thompson Signed-off-by: Manivannan Sadhasivam --- arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi index 108e2a4227f6..b071dc466374 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi @@ -730,6 +730,8 @@ pinctrl-0 = <&spi0_pmx_func &spi0_cfg_func>; num-cs = <1>; cs-gpios = <&gpio6 2 0>; + resets = <&sys_ctrl PERIPH_RSTEN3_SSP>; + reset-names = "reset"; status = "disabled"; }; @@ -741,6 +743,8 @@ i2c-sda-hold-time-ns = <300>; pinctrl-names = "default"; pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>; + resets = <&sys_ctrl PERIPH_RSTEN3_I2C0>; + reset-names = "reset"; status = "disabled"; }; @@ -752,6 +756,8 @@ i2c-sda-hold-time-ns = <300>; pinctrl-names = "default"; pinctrl-0 = <&i2c1_pmx_func &i2c1_cfg_func>; + resets = <&sys_ctrl PERIPH_RSTEN3_I2C1>; + reset-names = "reset"; status = "disabled"; }; @@ -763,6 +769,8 @@ i2c-sda-hold-time-ns = <300>; pinctrl-names = "default"; pinctrl-0 = <&i2c2_pmx_func &i2c2_cfg_func>; + resets = <&sys_ctrl PERIPH_RSTEN3_I2C2>; + reset-names = "reset"; status = "disabled"; };