From patchwork Thu Nov 7 04:58:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 178782 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp495514ilf; Wed, 6 Nov 2019 20:59:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyAbfPcrnXCYOI0jOs6UKLPpEUpHRaAKB9cLOG6o8FHuC+Acg4QNcjURaFXtKpgTzwBmiWl X-Received: by 2002:a50:da4b:: with SMTP id a11mr1478966edk.17.1573102749661; Wed, 06 Nov 2019 20:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573102749; cv=none; d=google.com; s=arc-20160816; b=pgsU909o85Uw+Hzz5PxVFOn83eFEa1WPzwr6/nJnLTnMArw/YuucXXAar/CXJaHngm aUuId0DMxkhjRfwhng0oDz1FdOtvMB8udVcij5lwvq6420eOSyDp/Fb4ZgLSKsIQ5IkT i7EXRs+NIKWarZyV/z/ISMy1VtZIiW1Fk8gglRSPhYnpflNmg8VlOb/81DzfAA2kgqNr x0GMtSrI8js46PB0DTke2WInCmECZCW6ST8EQBgaztW5E1tKuK7iOgWi16DpP6sP87RA txq/JygSaPRmbirRI0zwe0sxVhysDzPXxuWx1F0V6y98xN4nD3/zVtaP2gCqfbjxhILf AqQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=ddfjAO9MpIiKJ7aayY3g7kYKfnVp24qyieQEyY16OeA=; b=W812l7TaHZk58aMXUY+wvMaB7dOn9TP0TzHkr78+BM8XbpQXK5srrueq7Y7AUlerLv uyiCj1xR8ba6yABboTQfn9Q5jCTLLWoTe5PJJHG0IjsVN/oyqTjBKJviCVVsJpu7KXRw 8R6I0PjSeCZPwa7fdTgMFM+1xgTQl4jXonqa7Sf1HcC86INypIhisSpu3X/3H4oDp3MK wA5yXf4an73X4kqMQOJtZxe+kaDR8DpqJyPo3hZgz3ORi7nFuNYuEO+vvftA/yYEKSfB xNAOgSIScdWteu2I345AcVpFxESvmyLDzmQE0VLx9jM/nlbc0MjYkpAAacav0arlbdfp ba4A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si690095eds.217.2019.11.06.20.59.09; Wed, 06 Nov 2019 20:59:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733186AbfKGE7F (ORCPT + 26 others); Wed, 6 Nov 2019 23:59:05 -0500 Received: from mx.socionext.com ([202.248.49.38]:53324 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbfKGE7F (ORCPT ); Wed, 6 Nov 2019 23:59:05 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 07 Nov 2019 13:59:04 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 6CFD8605F8; Thu, 7 Nov 2019 13:59:04 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 7 Nov 2019 13:59:11 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id EC4601A0E9F; Thu, 7 Nov 2019 13:59:03 +0900 (JST) From: Kunihiko Hayashi To: Lorenzo Pieralisi , Andrew Murray , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH 1/2] PCI: uniphier: Set mode register to host mode Date: Thu, 7 Nov 2019 13:58:14 +0900 Message-Id: <1573102695-7018-1-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to avoid effect of the initial mode depending on SoCs, this patch sets the mode register to host(RC) mode. Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.7.4 Reviewed-by: Andrew Murray diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 3f30ee4..8fd7bad 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -33,6 +33,10 @@ #define PCL_PIPEMON 0x0044 #define PCL_PCLK_ALIVE BIT(15) +#define PCL_MODE 0x8000 +#define PCL_MODE_REGEN BIT(8) +#define PCL_MODE_REGVAL BIT(0) + #define PCL_APP_READY_CTRL 0x8008 #define PCL_APP_LTSSM_ENABLE BIT(0) @@ -85,6 +89,12 @@ static void uniphier_pcie_init_rc(struct uniphier_pcie_priv *priv) { u32 val; + /* set RC MODE */ + val = readl(priv->base + PCL_MODE); + val |= PCL_MODE_REGEN; + val &= ~PCL_MODE_REGVAL; + writel(val, priv->base + PCL_MODE); + /* use auxiliary power detection */ val = readl(priv->base + PCL_APP_PM0); val |= PCL_SYS_AUX_PWR_DET; From patchwork Thu Nov 7 04:58:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 178783 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp495521ilf; Wed, 6 Nov 2019 20:59:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxm5VUhD0cbFueggSEcMJnOpt7LwuC5A8wdpyGwu5fO+R5v4IW3xE6VuKgayNKbydyEiukU X-Received: by 2002:a50:e68c:: with SMTP id z12mr1549095edm.53.1573102750329; Wed, 06 Nov 2019 20:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573102750; cv=none; d=google.com; s=arc-20160816; b=FMBn8YLx1KT1UfhIrHKW6n8Qo4x979iWAbxOn0An/e9cv7rfIs5G56tbd88zWwp/jO +ZNdT+gA7KsSeNTgcWuo1VvkGd1K3JeJ3S9FVjTQCVYx5OH5603RdiZFyCHVmQFULUE0 yvHDAJj4+LyAYTCTD/9b3vU6q6KpDPeIQYfYrO1d1QoJ65Kkpvf1a+H/tZDHMUlVC0rK IY+EFBPPG6fprWNMVZdmmREZkslfBD5z0VeBmW0GCsKnKpVwiugz//Ib6WEMMoyrR3vf hoNdiBgbnTJHgv2oIlkJPkLZ8Fe5X9CL+lhPhkjZ5TOs2qR55EjHFDdlFNuU0jDurLVe mLmQ== 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; bh=+WvTDd7bU1Qbgbyqy1GUEZEaZxHZ7Lm8TAnnmQtQthQ=; b=B52Ndgn4do8ZtFkwdm6oONqkF5VUg7b/I/lpQy7mOzVIAaPfbz/k2z9ZI6WW4p7ahg c1BdYezLqvd7wjTUZL4cGkkhN7e0L/y2jg1RBijO9tBnZFb6sUVvhs8kzP9Urzef4nP9 VWVpZbO0B00/dk34ceGtmQ1RnRgkBwlQ8HsfklXuz3jGPHYZWYdsE3MM9sw8Zi4fDXBs jlgLp4k4zndtQIakvt1Zh4Y/5fsblSOiVqfH8kt8i5Y40nDLwjWy6pTHF8IpXwOx4IcU 5DnPKfOk0iYffboYTRdEG4xG5Ae9OvVPMzZUQ1Lpcsh2o9x0thmhueGm61c49wQ5SMca FSMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si690095eds.217.2019.11.06.20.59.10; Wed, 06 Nov 2019 20:59:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733214AbfKGE7I (ORCPT + 26 others); Wed, 6 Nov 2019 23:59:08 -0500 Received: from mx.socionext.com ([202.248.49.38]:53331 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbfKGE7I (ORCPT ); Wed, 6 Nov 2019 23:59:08 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 07 Nov 2019 13:59:06 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id B9291605F8; Thu, 7 Nov 2019 13:59:06 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 7 Nov 2019 13:59:16 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 7DCE31A0E9F; Thu, 7 Nov 2019 13:59:06 +0900 (JST) From: Kunihiko Hayashi To: Lorenzo Pieralisi , Andrew Murray , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH 2/2] PCI: uniphier: Add checking whether PERST# is deasserted Date: Thu, 7 Nov 2019 13:58:15 +0900 Message-Id: <1573102695-7018-2-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573102695-7018-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1573102695-7018-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When PERST# is asserted once, EP configuration will be initialized. If PERST# has been already deasserted, it isn't necessary to assert here. This checks whether PERST# is deasserted using PCL_PINMON register, and adds omit controlling PERST#. Signed-off-by: Kunihiko Hayashi --- drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 8fd7bad..1ea4220 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -22,6 +22,9 @@ #include "pcie-designware.h" +#define PCL_PINMON 0x0028 +#define PCL_PINMON_PERST_OUT BIT(16) + #define PCL_PINCTRL0 0x002c #define PCL_PERST_PLDN_REGEN BIT(12) #define PCL_PERST_NOE_REGEN BIT(11) @@ -100,6 +103,11 @@ static void uniphier_pcie_init_rc(struct uniphier_pcie_priv *priv) val |= PCL_SYS_AUX_PWR_DET; writel(val, priv->base + PCL_APP_PM0); + /* return if PERST# is already deasserted */ + val = readl(priv->base + PCL_PINMON); + if (val & PCL_PINMON_PERST_OUT) + return; + /* assert PERST# */ val = readl(priv->base + PCL_PINCTRL0); val &= ~(PCL_PERST_NOE_REGVAL | PCL_PERST_OUT_REGVAL