Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[platform/kernel/u-boot.git] / drivers / qe / qe.c
index 5fd2135..9c5fbd1 100644 (file)
@@ -4,20 +4,7 @@
  * Dave Liu <daveliu@freescale.com>
  * based on source code of Shlomi Gridish
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include "common.h"
@@ -27,6 +14,8 @@
 #include "asm/immap_qe.h"
 #include "qe.h"
 
+#define MPC85xx_DEVDISR_QE_DISABLE     0x1
+
 qe_map_t               *qe_immr = NULL;
 static qe_snum_t       snums[QE_NUM_OF_SNUM];
 
@@ -178,7 +167,7 @@ void qe_init(uint qe_base)
        /*
         * Upload microcode to IRAM for those SOCs which do not have ROM in QE.
         */
-       qe_upload_firmware((const void *)CONFIG_SYS_QE_FMAN_FW_ADDR);
+       qe_upload_firmware((const void *)CONFIG_SYS_QE_FW_ADDR);
 
        /* enable the microcode in IRAM */
        out_be32(&qe_immr->iram.iready,QE_IRAM_READY);
@@ -330,7 +319,9 @@ 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
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+#endif
        if (!firmware) {
                printf("Invalid address\n");
                return -EINVAL;
@@ -343,6 +334,9 @@ 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);
+#endif
                return -EPERM;
        }