All of lore.kernel.org
 help / color / mirror / Atom feed
* [v3,1/3] soc: fsl: handle RCPM errata A-008646 on SoC LS1021A
@ 2019-09-24  2:45 ` Biwen Li
  0 siblings, 0 replies; 47+ messages in thread
From: Biwen Li @ 2019-09-24  2:45 UTC (permalink / raw)
  To: leoyang.li, shawnguo, robh+dt, mark.rutland, ran.wang_1
  Cc: devicetree, linuxppc-dev, linux-kernel, linux-arm-kernel,
	Biwen Li

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 <biwen.li@nxp.com>
---
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 <linux/slab.h>
 #include <linux/suspend.h>
 #include <linux/kernel.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #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], &reg_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


^ permalink raw reply related	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2019-09-27 18:30 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-24  2:45 [v3,1/3] soc: fsl: handle RCPM errata A-008646 on SoC LS1021A Biwen Li
2019-09-24  2:45 ` Biwen Li
2019-09-24  2:45 ` Biwen Li
2019-09-24  2:45 ` [v3, 2/3] arm: dts: ls1021a: fix that FlexTimer cannot wakeup system in deep sleep Biwen Li
2019-09-24  2:45   ` [v3,2/3] " Biwen Li
2019-09-24  2:45   ` [v3, 2/3] " Biwen Li
2019-09-24  2:45 ` [v3, 3/3] Documentation: dt: binding: fsl: Add 'fsl, ippdexpcr-alt-addr' property Biwen Li
2019-09-24  2:45   ` [v3,3/3] Documentation: dt: binding: fsl: Add 'fsl,ippdexpcr-alt-addr' property Biwen Li
2019-09-24  2:45   ` [v3, 3/3] Documentation: dt: binding: fsl: Add 'fsl, ippdexpcr-alt-addr' property Biwen Li
2019-09-24 15:58   ` [v3,3/3] Documentation: dt: binding: fsl: Add 'fsl,ippdexpcr-alt-addr' property Leo Li
2019-09-24 15:58     ` Leo Li
2019-09-24 15:58     ` Leo Li
2019-09-24 15:58     ` Leo Li
2019-09-25  3:13     ` Biwen Li
2019-09-25  3:13       ` Biwen Li
2019-09-25  3:13       ` Biwen Li
2019-09-25  3:26       ` Leo Li
2019-09-25  3:26         ` Leo Li
2019-09-25  3:26         ` Leo Li
2019-09-25  3:30         ` Biwen Li
2019-09-25  3:30           ` Biwen Li
2019-09-25  3:30           ` Biwen Li
2019-09-25  3:34           ` Leo Li
2019-09-25  3:34             ` Leo Li
2019-09-25  3:34             ` Leo Li
2019-09-25  3:47             ` Biwen Li
2019-09-25  3:47               ` Biwen Li
2019-09-25  3:47               ` Biwen Li
2019-09-25  3:48               ` Leo Li
2019-09-25  3:48                 ` Leo Li
2019-09-25  3:48                 ` Leo Li
2019-09-25  4:06                 ` Biwen Li
2019-09-25  4:06                   ` Biwen Li
2019-09-25  4:06                   ` Biwen Li
2019-09-25  4:21                   ` Biwen Li
2019-09-25  4:21                     ` Biwen Li
2019-09-25  4:21                     ` Biwen Li
2019-09-25 14:07                     ` [v3, 3/3] Documentation: dt: binding: fsl: Add 'fsl, ippdexpcr-alt-addr' property Li Yang
2019-09-25 14:07                       ` [v3,3/3] Documentation: dt: binding: fsl: Add 'fsl,ippdexpcr-alt-addr' property Li Yang
2019-09-25 14:07                       ` [v3, 3/3] Documentation: dt: binding: fsl: Add 'fsl, ippdexpcr-alt-addr' property Li Yang
2019-09-26  1:54                       ` [EXT] Re: [v3,3/3] Documentation: dt: binding: fsl: Add 'fsl,ippdexpcr-alt-addr' property Biwen Li
2019-09-26  1:54                         ` Biwen Li
2019-09-26  1:54                         ` Biwen Li
2019-09-27 18:28             ` Rob Herring
2019-09-27 18:28               ` Rob Herring
2019-09-27 18:28               ` Rob Herring
2019-09-24  3:21 ` [v3,1/3] soc: fsl: handle RCPM errata A-008646 on SoC LS1021A Biwen Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.