[U-Boot] [PATCH] qe/deep-sleep: add qe deep-sleep for generic board
Zhao Qiang
B45475 at freescale.com
Tue Nov 11 07:10:26 CET 2014
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 at 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
More information about the U-Boot
mailing list