devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bai Ping <ping.bai@nxp.com>
To: shawnguo@kernel.org, mturquette@baylibre.com,
	sboyd@codeaurora.org, robh+dt@kernel.org, mark.rutland@arm.com,
	linus.walleij@linaro.org
Cc: devicetree@vger.kernel.org, kernel@pengutronix.de,
	daniel.lezcano@linaro.org, linux-gpio@vger.kernel.org,
	p.zabel@pengutronix.de, jacky.baip@gmail.com,
	fabio.estevam@nxp.com, tglx@linutronix.de,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/12] ARM: imx: correct i.mx6sll dram io low power mode
Date: Tue, 27 Dec 2016 17:47:49 +0800	[thread overview]
Message-ID: <1482832070-22668-12-git-send-email-ping.bai@nxp.com> (raw)
In-Reply-To: <1482832070-22668-1-git-send-email-ping.bai@nxp.com>

i.MX6SLL has different DRAM IO offset, and it has no
CAS/RAS/ODT/RESET pin now, correct the DRAM IO offset.

To better support all different i.MX6 SoCs and different
DRAM types, introduce a new column to store the low power
settings for DRAM IO, then suspend asm code no need to check
SoC or DRAM type, just get the DRAM IO's low power
settings from OCRAM pm_info and set to each DRAM IO.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Bai Ping <ping.bai@nxp.com>
---
 arch/arm/mach-imx/pm-imx6.c      | 17 ++++++++++++++++-
 arch/arm/mach-imx/suspend-imx6.S | 29 +++++++----------------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
index 2ed4316..5fb78a9 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -230,7 +230,7 @@ struct imx6_cpu_pm_info {
 	struct imx6_pm_base gpc_base;
 	struct imx6_pm_base l2_base;
 	u32 mmdc_io_num; /* Number of MMDC IOs which need saved/restored. */
-	u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][2]; /* To save offset and value */
+	u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][3]; /* To save offset,value and low power setting */
 } __aligned(8);
 
 void imx6_set_int_mem_clk_lpm(bool enable)
@@ -570,6 +570,21 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
 		pm_info->mmdc_io_val[i][1] =
 			readl_relaxed(pm_info->iomuxc_base.vbase +
 			mmdc_offset_array[i]);
+		pm_info->mmdc_io_val[i][2] = 0;
+
+	}
+
+	/* i.MX6SLL has no DRAM RESET pin */
+	if (cpu_is_imx6sll()) {
+		pm_info->mmdc_io_val[pm_info->mmdc_io_num - 2][2] = 0x1000;
+		pm_info->mmdc_io_val[pm_info->mmdc_io_num - 1][2] = 0x1000;
+	} else {
+		if (pm_info->ddr_type == IMX_DDR_TYPE_LPDDR2) {
+			 /* for LPDDR2, CKE0/1 and RESET pin need special setting */
+			pm_info->mmdc_io_val[pm_info->mmdc_io_num - 3][2] = 0x1000;
+			pm_info->mmdc_io_val[pm_info->mmdc_io_num - 2][2] = 0x1000;
+			pm_info->mmdc_io_val[pm_info->mmdc_io_num - 1][2] = 0x80000;
+		}
 	}
 
 	imx6_suspend_in_ocram_fn = fncpy(
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
index 76ee2ce..c9a26f4 100644
--- a/arch/arm/mach-imx/suspend-imx6.S
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -104,7 +104,7 @@
 	add	r7, r7, r0
 1:
 	ldr	r8, [r7], #0x4
-	ldr	r9, [r7], #0x4
+	ldr	r9, [r7], #0x8
 	str	r9, [r11, r8]
 	subs	r6, r6, #0x1
 	bne	1b
@@ -179,7 +179,6 @@ ENTRY(imx6_suspend)
 	ldr	r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
 	ldr	r6, [r11, #0x0]
 
-	/* use r11 to store the IO address */
 	ldr	r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET]
 	/* store physical resume addr and pm_info address. */
 	str	r9, [r11, #MX6Q_SRC_GPR1]
@@ -207,32 +206,18 @@ poll_dvfs_set:
 	ands	r7, r7, #(1 << 25)
 	beq	poll_dvfs_set
 
+	/* use r11 to store the IO address */
 	ldr	r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
-	ldr	r6, =0x0
-	ldr	r7, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
+	ldr	r6, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
 	ldr	r8, =PM_INFO_MMDC_IO_VAL_OFFSET
 	add	r8, r8, r0
-	/* LPDDR2's last 3 IOs need special setting */
-	cmp	r3, #IMX_DDR_TYPE_LPDDR2
-	subeq	r7, r7, #0x3
 set_mmdc_io_lpm:
-	ldr	r9, [r8], #0x8
-	str	r6, [r11, r9]
-	subs	r7, r7, #0x1
+	ldr	r7, [r8], #0x8
+	ldr	r9, [r8], #0x4
+	str	r9, [r11, r7]
+	subs	r6, r6, #0x1
 	bne	set_mmdc_io_lpm
 
-	cmp 	r3, #IMX_DDR_TYPE_LPDDR2
-	bne	set_mmdc_io_lpm_done
-	ldr	r6, =0x1000
-	ldr	r9, [r8], #0x8
-	str	r6, [r11, r9]
-	ldr	r9, [r8], #0x8
-	str	r6, [r11, r9]
-	ldr	r6, =0x80000
-	ldr	r9, [r8]
-	str	r6, [r11, r9]
-set_mmdc_io_lpm_done:
-
 	/*
 	 * mask all GPC interrupts before
 	 * enabling the RBC counters to
-- 
1.9.1

  parent reply	other threads:[~2016-12-27  9:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27  9:47 [PATCH v2 00/12] Add basic code support for imx6sll Bai Ping
2016-12-27  9:47 ` [PATCH v2 01/12] ARM: imx: Add basic msl " Bai Ping
2016-12-27  9:47 ` [PATCH v2 02/12] driver: clocksource: add gpt timer " Bai Ping
2017-01-09 10:30   ` Daniel Lezcano
2016-12-27  9:47 ` [PATCH v2 03/12] Document: dt: binding: imx: update clock doc " Bai Ping
2017-01-03 17:48   ` Rob Herring
2016-12-27  9:47 ` [PATCH v2 04/12] driver: clk: imx: Add clock driver " Bai Ping
     [not found]   ` <1482832070-22668-5-git-send-email-ping.bai-3arQi8VN3Tc@public.gmane.org>
2017-01-03 17:49     ` Rob Herring
2017-01-10  0:37     ` Stephen Boyd
     [not found]       ` <20170110003753.GM17126-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-01-10  3:18         ` Jacky Bai
2017-01-12 22:05           ` Stephen Boyd
2017-01-13  3:04             ` Jacky Bai
2017-01-21  1:00               ` Stephen Boyd
2017-01-22  2:14                 ` Jacky Bai
2016-12-27  9:47 ` [PATCH v2 05/12] Document: dt: binding: imx: update pinctrl doc " Bai Ping
2016-12-27 12:59   ` Linus Walleij
2017-01-09  2:32     ` Jacky Bai
     [not found]       ` <AM3PR04MB5304992095753B761E66A9A87640-f56W/S9L6NRDGcFijYBXZgfhPeD8jYilXA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2017-01-11 14:33         ` Linus Walleij
2017-01-12  2:57           ` Jacky Bai
2017-01-13 15:22             ` Linus Walleij
2017-01-17  6:35               ` Jacky Bai
2017-01-18 12:24                 ` Linus Walleij
2017-01-23  6:04                   ` Shawn Guo
2017-01-23  7:17                     ` Jacky Bai
2017-01-26 14:05                       ` Linus Walleij
2017-02-16  7:51     ` Dong Aisheng
2017-02-24  9:02       ` Dong Aisheng
2017-03-14 13:54       ` Linus Walleij
2017-03-15 14:05         ` Dong Aisheng
2016-12-27  9:47 ` [PATCH v2 06/12] driver: pinctrl: imx: Add pinctrl driver support " Bai Ping
2016-12-27 13:01   ` Linus Walleij
2017-01-03  1:00     ` Jacky Bai
2016-12-27  9:47 ` [PATCH v2 07/12] ARM: dts: imx: Add basic dtsi " Bai Ping
2016-12-27  9:47 ` [PATCH v2 08/12] ARM: dts: imx: Add imx6sll EVK board dts support Bai Ping
2016-12-27  9:47 ` [PATCH v2 09/12] ARM: debug: Add low level debug support for imx6sll Bai Ping
2016-12-27  9:47 ` [PATCH v2 10/12] ARM: imx: Add suspend/resume " Bai Ping
2016-12-27  9:47 ` Bai Ping [this message]
2016-12-27  9:47 ` [PATCH v2 12/12] ARM: configs: enable imx6sll support in defconfig Bai Ping
2017-01-23  6:10 ` [PATCH v2 00/12] Add basic code support for imx6sll Shawn Guo
2017-01-23  7:18   ` Jacky Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482832070-22668-12-git-send-email-ping.bai@nxp.com \
    --to=ping.bai@nxp.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=jacky.baip@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=shawnguo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).