Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6416741imb; Fri, 8 Mar 2019 17:59:56 -0800 (PST) X-Google-Smtp-Source: APXvYqydY4qVrn1uB61VRqgmSDW5rcYScyUDCC1kuvXnBdEQ1n3/giZmesTCy4P/lRyzpUlxZJ+P X-Received: by 2002:a65:4389:: with SMTP id m9mr2792906pgp.8.1552096795994; Fri, 08 Mar 2019 17:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552096795; cv=none; d=google.com; s=arc-20160816; b=jhIQLE6iYnGmmNda3ijO3uoL+p5eEu/3K8Ub5aXRNkcZQqp47GH15LIyZ9ewY9SRE+ yODbc6w1NwrXFqKn4WCwMzSPeL5fD3xYjrksM2/CyNXU0ShXuTy39AXGSyeITRSbxg33 yjsNugbG/ku3OwzMd1o+q01yca/jIkr5wOjWir2gJecPfJM4rwDgktFLWMHvVe7G4VeM K2ShoCNNjHGUV/FEV3Z9j0+7xeFkq0Vt6ZoQ9yqBLJ6EoQWuATvyLe2fhz/+iSATT4Ot V2zcuk4abaumFGqhLfrTTO85Bo4TS4lat7hBQR0u0hMAKkI/HAEhATtgwPRm+wgg0s8P xUQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=hmQkxeVs4MCB6oMpxb4sXYFHVbv88QBQBaECu3FhUAw=; b=lIcnKP0PHzYRMjkjoKEVcDeto7yGRQSWY4RoRw/YrC3sOkn/TxkPMQm4MTZ21QQz+6 OLZyUJM0o3TeUkmXfn8+SmB2Fa+Fz+U/4xF6irxufEX/xxkOtbTHbiQ08TdLwK8+s1Lm o+A6Gb5HbYY2HApgnChhNdASLD3XDuSTmnXHEfo7Og2DPVBk4gnhAcfXVzKRwtvNzKYP u5NFBXaCFlhwNLMTkJ49xFTZLaTopKW4TDPnO+pU23tp0bdK3mYXmF3xzaHtZf569MBu lRJGxqwQx1JM/CUXxRvVeN/Yi2ycsRbnTbShFC2kaKvsPM2JJp/COwICpP4N5KyvOFIn esgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gYTsujj3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si4029956plu.364.2019.03.08.17.59.41; Fri, 08 Mar 2019 17:59:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gYTsujj3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726755AbfCIB7D (ORCPT + 99 others); Fri, 8 Mar 2019 20:59:03 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35546 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbfCIB7D (ORCPT ); Fri, 8 Mar 2019 20:59:03 -0500 Received: by mail-pf1-f193.google.com with SMTP id j5so15419839pfa.2 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=koMC1Xi9U/rrtGzirhZ7M/lpfELIPE5Fm39Sau78Ex5dgWUb6veRFAhYf9pRtqCUwT yh3freoWgBKiuaGctoFFhAJZU/1IUw4gPGHJFR9TfxWriZfC0RLiRHakz85Lu0xQjkR0 jfrFoOT3nXdBwderhUVBs7gfKalJQFCYSGAbyPy1Ov7/5Q9vHjSCIvXN2udeIPGDAUKS G5M8PSfe+7SQpWlJxfnvixeTJ6yrQP53eyIBXgybD2+8GVtQvS+53wHZLEkjgx6nvOwL BroNoyHlB23XxO7yvWkj7XaqBfkYp3tn6F6HS0nappPWBY7XmxcYfZ/8HXsXUIuEyH1p y/tA== X-Gm-Message-State: APjAAAUk+ltJJCCtHo4kzbHjsbZVGvMOMhlfxRTIA7bnhoG3rjvTW5nY NtiLt4Ol/HnYdO7Ngmr7mq7YndktEw== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, peter.griffin@linaro.org, guodong.xu@linaro.org, haojian.zhuang@linaro.org, Manivannan Sadhasivam 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.17.1