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