public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] qe/deep-sleep: add qe deep-sleep for generic board
@ 2014-11-11  6:10 Zhao Qiang
  2014-12-12 21:27 ` York Sun
  0 siblings, 1 reply; 5+ messages in thread
From: Zhao Qiang @ 2014-11-11  6:10 UTC (permalink / raw)
  To: u-boot

Deep sleep for generic board is supported now,
and it use CONFIG_FSL_DEEP_SLEEP instead of CONFIG_DEEP_SLEEP,
so modify it for qe.

Signed-off-by: Zhao Qiang <B45475@freescale.com>
---
 drivers/qe/qe.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 2c5b9bf..8687e73 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -9,12 +9,15 @@
 
 #include "common.h"
 #include <command.h>
+#ifdef CONFIG_LS102XA
+#include <asm/arch/immap_ls102xa.h>
+#endif
 #include "asm/errno.h"
 #include "asm/io.h"
 #include "linux/immap_qe.h"
 #include "qe.h"
 
-#define MPC85xx_DEVDISR_QE_DISABLE	0x1
+#define DEVDISR_QE_DISABLE	0x1
 
 qe_map_t		*qe_immr = NULL;
 static qe_snum_t	snums[QE_NUM_OF_SNUM];
@@ -346,7 +349,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
 	size_t calc_size = sizeof(struct qe_firmware);
 	size_t length;
 	const struct qe_header *hdr;
-#ifdef CONFIG_DEEP_SLEEP
+#if defined(CONFIG_FSL_DEEP_SLEEP) && defined(CONFIG_QE)
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
 	if (!firmware) {
@@ -361,8 +364,8 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
 		printf("Not a microcode\n");
-#ifdef CONFIG_DEEP_SLEEP
-		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
+#if defined(CONFIG_FSL_DEEP_SLEEP) && defined(CONFIG_QE)
+		setbits_be32(&gur->devdisr, DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
 	}
@@ -481,9 +484,13 @@ int u_qe_upload_firmware(const struct qe_firmware *firmware)
 	size_t calc_size = sizeof(struct qe_firmware);
 	size_t length;
 	const struct qe_header *hdr;
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
+#ifdef CONFIG_LS102XA
+	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+#else
 	ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
+#endif
 	if (!firmware) {
 		printf("Invalid address\n");
 		return -EINVAL;
@@ -496,8 +503,8 @@ int u_qe_upload_firmware(const struct qe_firmware *firmware)
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
 		printf("Not a microcode\n");
-#ifdef CONFIG_DEEP_SLEEP
-		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
+#ifdef CONFIG_FSL_DEEP_SLEEP
+		setbits_be32(&gur->devdisr, DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
 	}
@@ -588,9 +595,13 @@ int u_qe_firmware_resume(const struct qe_firmware *firmware, qe_map_t *qe_immrr)
 	unsigned int j;
 	const struct qe_header *hdr;
 	const u32 *code;
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
+#ifdef CONFIG_LS102XA
+	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+#else
 	ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
+#endif
 
 	if (!firmware)
 		return -EINVAL;
@@ -600,8 +611,8 @@ int u_qe_firmware_resume(const struct qe_firmware *firmware, qe_map_t *qe_immrr)
 	/* Check the magic */
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
-#ifdef CONFIG_DEEP_SLEEP
-		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
+#ifdef CONFIG_FSL_DEEP_SLEEP
+		setbits_be32(&gur->devdisr, DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
 	}
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] qe/deep-sleep: add qe deep-sleep for generic board
@ 2014-11-11  5:43 Zhao Qiang
  0 siblings, 0 replies; 5+ messages in thread
From: Zhao Qiang @ 2014-11-11  5:43 UTC (permalink / raw)
  To: u-boot

Deep sleep for generic board is supported now,
and it use CONFIG_FSL_DEEP_SLEEP instead of CONFIG_DEEP_SLEEP,
so modify it for qe.

Signed-off-by: Zhao Qiang <B45475@freescale.com>
---
 drivers/qe/qe.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 2c5b9bf..658b7a8 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -9,6 +9,9 @@
 
 #include "common.h"
 #include <command.h>
+#ifdef CONFIG_LS102XA
+#include <asm/arch/immap_ls102xa.h>
+#endif
 #include "asm/errno.h"
 #include "asm/io.h"
 #include "linux/immap_qe.h"
@@ -346,7 +349,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
 	size_t calc_size = sizeof(struct qe_firmware);
 	size_t length;
 	const struct qe_header *hdr;
-#ifdef CONFIG_DEEP_SLEEP
+#if defined(CONFIG_FSL_DEEP_SLEEP) && defined(CONFIG_QE)
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
 	if (!firmware) {
@@ -361,7 +364,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
 		printf("Not a microcode\n");
-#ifdef CONFIG_DEEP_SLEEP
+#if defined(CONFIG_FSL_DEEP_SLEEP) && defined(CONFIG_QE)
 		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
@@ -481,9 +484,13 @@ int u_qe_upload_firmware(const struct qe_firmware *firmware)
 	size_t calc_size = sizeof(struct qe_firmware);
 	size_t length;
 	const struct qe_header *hdr;
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
+#ifdef CONFIG_LS102XA
+	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+#else
 	ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
+#endif
 	if (!firmware) {
 		printf("Invalid address\n");
 		return -EINVAL;
@@ -496,7 +503,7 @@ int u_qe_upload_firmware(const struct qe_firmware *firmware)
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
 		printf("Not a microcode\n");
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
 		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
@@ -588,9 +595,13 @@ int u_qe_firmware_resume(const struct qe_firmware *firmware, qe_map_t *qe_immrr)
 	unsigned int j;
 	const struct qe_header *hdr;
 	const u32 *code;
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
+#ifdef CONFIG_LS102XA
+	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+#else
 	ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 #endif
+#endif
 
 	if (!firmware)
 		return -EINVAL;
@@ -600,7 +611,7 @@ int u_qe_firmware_resume(const struct qe_firmware *firmware, qe_map_t *qe_immrr)
 	/* Check the magic */
 	if ((hdr->magic[0] != 'Q') || (hdr->magic[1] != 'E') ||
 	    (hdr->magic[2] != 'F')) {
-#ifdef CONFIG_DEEP_SLEEP
+#ifdef CONFIG_FSL_DEEP_SLEEP
 		setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_QE_DISABLE);
 #endif
 		return -EPERM;
-- 
2.1.0.27.g96db324

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

end of thread, other threads:[~2014-12-15  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-11  6:10 [U-Boot] [PATCH] qe/deep-sleep: add qe deep-sleep for generic board Zhao Qiang
2014-12-12 21:27 ` York Sun
2014-12-15  3:08   ` qiang.zhao at freescale.com
2014-12-15  7:55   ` qiang.zhao at freescale.com
  -- strict thread matches above, loose matches on Subject: below --
2014-11-11  5:43 Zhao Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox