Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1704909ybn; Thu, 26 Sep 2019 00:32:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGCpNPZOInN64VUl8OBMy0YqUhbz5Np3Xr3rhXAQCSdzYMRGY17pUMNtPRoia0Esk/+c03 X-Received: by 2002:a50:ee10:: with SMTP id g16mr2021273eds.267.1569483131565; Thu, 26 Sep 2019 00:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569483131; cv=none; d=google.com; s=arc-20160816; b=t7VydbjYXEDE1qOn36EVLGQ6sEc0U0eTd2n/k3YL/9vLaxRB6IxJhb4t/xaSFwW8Ri o+NoOewDa/jVemeQ+2Kad3DNEFgqLcnm+PS9zrVL2SqkUfUXIGfgCnLNsYv5gcL1tf6e WBkjeemgO78/nqG/wiaqiZjfifoK+QJkNoXh9Fbt9rhjx/2HgjCkb6cq2PEaWiAnoMd+ 8UgFnQih2dWj+qRpM4b5I7viJrT/ig+u2PvoORXU9VeiCzaGcT1Gb+Q1K07734i9p8os UOfoBRvNAcvvAI6moossErQD3y393AfFSGKSOxhcC8ywfy0CZzRoOnPHoSCD5sls2ATe FhoQ== 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=jcRtOCisFuYHwEBaZlwFCj/1qFqTOVlKz1JTv2oKORQ=; b=D6KhxZK1t99E07X+Sr2HhaXuo0PXQ6oHywC7f/MdYTiovWGOUEc+JhDhdaearA3f2w /SIH1AD7ZLAvk6jVny4n1YH9jcpaTK0TBqvVL6J23K2YtbnW40DhNTmnrDyUeObT1MXr xOiK3JkCK6r9C+PRcNUDf+KZ9rPkNGU9zBKMbqmyqG46xqxDGuMALeG4UQYtwlq7Myml d+AdRviteenPrla/XCO8pjNcKFDGj6Gn4nAnKSycfQt/pru5SIJWINGQMuNbY2s2jzCQ hPYMVheDpgkqSjSITtG1/PUamS3WS320FI8oaMTZ1CL+V9XPsdag85NU42u2bJCnzcIw KznA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si856792eda.256.2019.09.26.00.31.47; Thu, 26 Sep 2019 00:32:11 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408845AbfIXC4Y (ORCPT + 99 others); Mon, 23 Sep 2019 22:56:24 -0400 Received: from inva021.nxp.com ([92.121.34.21]:60504 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728992AbfIXC4X (ORCPT ); Mon, 23 Sep 2019 22:56:23 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A7A28200386; Tue, 24 Sep 2019 04:56:21 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0D92320021A; Tue, 24 Sep 2019 04:56:17 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7BA284029F; Tue, 24 Sep 2019 10:56:11 +0800 (SGT) From: Biwen Li To: leoyang.li@nxp.com, shawnguo@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, ran.wang_1@nxp.com Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Biwen Li Subject: [v3,1/3] soc: fsl: handle RCPM errata A-008646 on SoC LS1021A Date: Tue, 24 Sep 2019 10:45:46 +0800 Message-Id: <20190924024548.4356-1-biwen.li@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Description: - Reading configuration register RCPM_IPPDEXPCR1 always return zero Workaround: - Save register RCPM_IPPDEXPCR1's value to register SCFG_SPARECR8.(uboot's psci also need reading value from the register SCFG_SPARECR8 to set register RCPM_IPPDEXPCR1) Impact: - FlexTimer module will cannot wakeup system in deep sleep on SoC LS1021A Signed-off-by: Biwen Li --- Change in v3: - update commit message - rename property name fsl,rcpm-scfg -> fsl,ippdexpcr-alt-addr Change in v2: - fix stype problems drivers/soc/fsl/rcpm.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/soc/fsl/rcpm.c b/drivers/soc/fsl/rcpm.c index 82c0ad5e663e..7f42b17d3f29 100644 --- a/drivers/soc/fsl/rcpm.c +++ b/drivers/soc/fsl/rcpm.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #define RCPM_WAKEUP_CELL_MAX_SIZE 7 @@ -29,6 +31,9 @@ static int rcpm_pm_prepare(struct device *dev) struct rcpm *rcpm; u32 value[RCPM_WAKEUP_CELL_MAX_SIZE + 1], tmp; int i, ret, idx; + struct regmap * scfg_addr_regmap = NULL; + u32 reg_offset[RCPM_WAKEUP_CELL_MAX_SIZE + 1]; + u32 reg_value = 0; rcpm = dev_get_drvdata(dev); if (!rcpm) @@ -63,6 +68,22 @@ static int rcpm_pm_prepare(struct device *dev) tmp |= value[i + 1]; iowrite32be(tmp, rcpm->ippdexpcr_base + i * 4); } + /* Workaround of errata A-008646 on SoC LS1021A: There is a bug of + * register ippdexpcr1. Reading configuration register RCPM_IPPDEXPCR1 + * always return zero. So save ippdexpcr1's value to register SCFG_SPARECR8. + * And the value of ippdexpcr1 will be read from SCFG_SPARECR8. + */ + scfg_addr_regmap = syscon_regmap_lookup_by_phandle(np, "fsl,ippdexpcr-alt-addr"); + if (scfg_addr_regmap) { + if (of_property_read_u32_array(dev->of_node, + "fsl,ippdexpcr-alt-addr", reg_offset, rcpm->wakeup_cells + 1)) { + scfg_addr_regmap = NULL; + continue; + } + regmap_read(scfg_addr_regmap, reg_offset[i + 1], ®_value); + /* Write value to register SCFG_SPARECR8 */ + regmap_write(scfg_addr_regmap, reg_offset[i + 1], tmp | reg_value); + } } } } while (ws = wakeup_source_get_next(ws)); -- 2.17.1