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 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: 160007 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp9414446jad; Fri, 8 Mar 2019 17:59:21 -0800 (PST) X-Google-Smtp-Source: APXvYqy3frdPIIBc1rekCktqHZhpXYx0rGk0rTbfbFfg+f13bJTyEoNO15RMoCIOl0MGiulaq1py X-Received: by 2002:a62:ab04:: with SMTP id p4mr21516884pff.142.1552096761027; Fri, 08 Mar 2019 17:59:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552096761; cv=none; d=google.com; s=arc-20160816; b=eBHeTpHg6VzJMYFJVZB7D45jnDJYCPnK6GpcwFm7zw4bAk8EPeF5wr2NRZPXMxK0Hf 0pkLNFK00MR/XsOgdzgOkiI6ruO3hcBWwWVCXvgDApuBvKmGVds0Fv4Um2MVnYLAca1r TjANZxYWnOTQsdjF04T9DTR3FOhaEMDdA5gE1QiCDS9dFGfra8JWO/4bMeL4fnu8e3F7 vM3zkhSZ3gFqhlQIxUcfhXa1g7nNF9wjF+TFUI530wlqetAPj0/XYfGltSx71yizBkeS APIpuwk6WaOBBIgzjaaVUbb55oeiLWUY7RM4Z+/+SYfpr7ozlna3wTR2+TC6IkfpERxS dPNQ== 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=y/pIRq3eoYMGqKuzxQRW6Xe3PFikDk+GOICmlrRtQ4w=; b=ylQHdewNXoWmp1gUZtbj16P7AzQA0L+ElUhoSLFppDsRNWY2DAemczU9QIC5bPzVJF nFO0noWmPO1tMZjPpk+bKUpvi869XcQTCmYLXc+VnPnzTZliuMoK03vdiOonYn9kmgYu n/GMbrMvUk3h8tWJXiqmk4e4KoqsiQeg4XMvLW0/qwq3F8f7PTFKdRXqvia3xLXDbHd8 oI2mQzasHY3AR9i0h2UjY5x14+RxQxwgdR7Cnku3cuQs0AJg3OeGN5o4iV30LM5z+JIh 3mn3ptG4HTVTCQVKojAR1vpsoIF6MTgI27y7VmpAD8PzjXiZWC0i+vJDUw/P8Ro8BdLz wneQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BgtvqWkR; 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 i22si7884333pgj.178.2019.03.08.17.59.20; Fri, 08 Mar 2019 17:59:21 -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=BgtvqWkR; 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 S1726781AbfCIB7K (ORCPT + 31 others); Fri, 8 Mar 2019 20:59:10 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45723 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbfCIB7J (ORCPT ); Fri, 8 Mar 2019 20:59:09 -0500 Received: by mail-pg1-f194.google.com with SMTP id 125so15277001pgc.12 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=F1Egl5kdHP+A2F//Ss2H1Rzxkmmjv/Iy5hDIOCpKHT9M+mF9pRI6I0a/7FsploEkW/ mULmn/WPkXbe+7WT+c8CMipAiGKZkak65PUmEz6MGRvL6PUsyBjS+lxKKYAavDNc8syP 05FVVLmb9CW4WaR0OBscuk0HQw9iLJ3Gfkb7sTjVJfzk6w9otb6EqhU5bT+fqbvhirb8 b6/UdSvWXOABo6tQKe6aV99Qdd/UiKg1gFOoVbGSLXqRW3UtvZ3YN3/l46gkCzwRoPTn 0T402Q9Qc59f+mKx+Gs/HeeHNw//z8A+DuVb4GRPL6vnTIziypf/tKstHenX4GLYl9T0 y/Jg== X-Gm-Message-State: APjAAAU0X8KSj5E+62s+mLwRzYmD+bAmmCyItfIdLzjEWVaGYOodu66V E4MJW00TMvC/FFSfAayA4uEl 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 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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.17.1 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"; };