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: 160006 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp9414342jad; Fri, 8 Mar 2019 17:59:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzvxnEKxdfgPcvaM4B5ffmdyhGgRgb8OMrUC0OqduRwrUmxWmF5S5/GXDN8vGYo285zT4wE X-Received: by 2002:a65:5303:: with SMTP id m3mr19409980pgq.292.1552096751765; Fri, 08 Mar 2019 17:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552096751; cv=none; d=google.com; s=arc-20160816; b=Esbe21MNbBxTJS0C52m5peB6i/4tqVnXeFCPrls8Rm5HAwCLEXuNDj+HhXZTTHp52i P60wFLo2fT4g7LwNtwANvj2lGRW40I03SMLXITH4zs2q7OtBCf9Vyj42sKDUUgYPgnJa QGw3hPT2iZH6mgVDkW47pfogwnzZbiTuqxXo3eJWfpA1EGP8zwbPrg4YZpO4b/J9/7XY 6zPxq6GR/5QmoeWyIKtjgXLrTKAEH6LtbwtiGdxPLGgAlZ3AB6g5rkkJNdVCNvTMCkse m/3kR9sGy+rHJiGc2LTCSX4op7RuUyb3YGjcSBe5g0PNtIQ8Uk0JTCQtC9TuzS0O3zfw feEg== 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 q4si7544976pgv.338.2019.03.08.17.59.11; Fri, 08 Mar 2019 17:59:11 -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 S1726763AbfCIB7E (ORCPT + 31 others); Fri, 8 Mar 2019 20:59:04 -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(+) -- 2.17.1 Reviewed-by: Linus Walleij 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