]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
plat: marvell: armada: move mg conf related code to appropriate driver
authorGrzegorz Jaszczyk <jaz@semihalf.com>
Wed, 17 Apr 2019 09:24:43 +0000 (11:24 +0200)
committerManish Pandey <manish.pandey2@arm.com>
Fri, 10 Jul 2020 10:55:03 +0000 (10:55 +0000)
Now when mg_conf_cm3 driver is present - move all relevant code there.

Change-Id: I444d9e877c450d6ee69ca3a49b547e4c3aeac0be
Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
drivers/marvell/mg_conf_cm3/mg_conf_cm3.c
drivers/marvell/mg_conf_cm3/mg_conf_cm3.h
plat/marvell/armada/common/mss/mss_scp_bl2_format.h
plat/marvell/armada/common/mss/mss_scp_bootloader.c

index e249b5b3821fdcfb43843de0aa2bbe38fe11662e..0efa30e935f43a098ed4ef32dd5c075f84a0a958 100644 (file)
@@ -8,15 +8,41 @@
 #include <a8k_plat_def.h>
 #include <common/debug.h>
 #include <lib/mmio.h>
-#include <mvebu.h>
+#include <mss_scp_bl2_format.h>
 
 /* CONFI REGISTERS */
 #define MG_CM3_CONFI_BASE(CP)          (MVEBU_CP_REGS_BASE(CP) + 0x100000)
+#define MG_CM3_SRAM_BASE(CP)           MG_CM3_CONFI_BASE(CP)
 #define MG_CM3_CONFI_GLOB_CFG_REG(CP)  (MG_CM3_CONFI_BASE(CP) + 0x2B500)
 #define CM3_CPU_EN_BIT                 BIT(28)
 #define MG_CM3_MG_INT_MFX_REG(CP)      (MG_CM3_CONFI_BASE(CP) + 0x2B054)
 #define CM3_SYS_RESET_BIT              BIT(0)
 
+#define MG_SRAM_SIZE   0x20000 /* 128KB */
+
+int mg_image_load(uintptr_t src_addr, uint32_t size, int cp_index)
+{
+       uintptr_t mg_regs = MG_CM3_SRAM_BASE(cp_index);
+
+       if (size > MG_SRAM_SIZE) {
+               ERROR("image is too big to fit into MG CM3 memory\n");
+               return 1;
+       }
+
+       NOTICE("Loading MG image from address 0x%lx Size 0x%x to MG at 0x%lx\n",
+              src_addr, size, mg_regs);
+
+       /* Copy image to MG CM3 SRAM */
+       memcpy((void *)mg_regs, (void *)src_addr, size);
+
+       /* Don't release MG CM3 from reset - it will be done by next step
+        * bootloader (e.g. U-Boot), when appriopriate device-tree setup (which
+        * has enabeld 802.3. auto-neg) will be choosen.
+        */
+
+       return 0;
+}
+
 void mg_start_ap_fw(int cp_nr)
 {
        if (mmio_read_32(MG_CM3_CONFI_GLOB_CFG_REG(cp_nr)) & CM3_CPU_EN_BIT) {
index 44c7b698a6d6994cff54c6519885cde7273940ce..8dfaa32dbb07d8bc497771a9986a2cc9f9a9c8ab 100644 (file)
@@ -6,3 +6,4 @@
  */
 
 void mg_start_ap_fw(int cp_nr);
+int mg_image_load(uintptr_t src_addr, uint32_t size, int cp_index);
index 7150f0a06396cf2a938bd52782e922fd125e1fd7..74dddc645f3cb4c7f4bf3b2ea523f55f368bf98b 100644 (file)
@@ -13,7 +13,6 @@
 #define HEADER_VERSION 0x1
 
 #define MSS_IDRAM_SIZE 0x10000 /* 64KB */
-#define MG_SRAM_SIZE   0x20000 /* 128KB */
 
 /* Types definitions */
 typedef struct file_header {
index 4473d81e13a221774e0ec68002ba69cb361110ad..adf570ea9846de306d09cae0d39dd84e47c0e592 100644 (file)
@@ -12,6 +12,7 @@
 #include <arch_helpers.h>
 #include <common/debug.h>
 #include <drivers/delay_timer.h>
+#include <mg_conf_cm3/mg_conf_cm3.h>
 #include <lib/mmio.h>
 
 #include <plat_pm_trace.h>
@@ -42,8 +43,6 @@
 
 #define MSS_HANDSHAKE_TIMEOUT          50
 
-#define MG_CM3_SRAM_BASE(CP)           (MVEBU_CP_REGS_BASE(CP) + 0x100000)
-
 static int mss_check_image_ready(volatile struct mss_pm_ctrl_block *mss_pm_crtl)
 {
        int timeout = MSS_HANDSHAKE_TIMEOUT;
@@ -61,28 +60,6 @@ static int mss_check_image_ready(volatile struct mss_pm_ctrl_block *mss_pm_crtl)
        return 0;
 }
 
-static int mg_image_load(uintptr_t src_addr, uint32_t size, uintptr_t mg_regs)
-{
-       if (size > MG_SRAM_SIZE) {
-               ERROR("image is too big to fit into MG CM3 memory\n");
-               return 1;
-       }
-
-       NOTICE("Loading MG image from address 0x%lx Size 0x%x to MG at 0x%lx\n",
-              src_addr, size, mg_regs);
-
-       /* Copy image to MG CM3 SRAM */
-       memcpy((void *)mg_regs, (void *)src_addr, size);
-
-       /*
-        * Don't release MG CM3 from reset - it will be done by next step
-        * bootloader (e.g. U-Boot), when appriopriate device-tree setup (which
-        * has enabeld 802.3. auto-neg) will be choosen.
-        */
-
-       return 0;
-}
-
 static int mss_image_load(uint32_t src_addr, uint32_t size, uintptr_t mss_regs)
 {
        uint32_t i, loop_num, timeout;
@@ -258,8 +235,7 @@ static int load_img_to_cm3(enum cm3_t cm3_type,
                        break;
                }
                NOTICE("Load image to CP%d MG\n", cp_index);
-               ret = mg_image_load(single_img, image_size,
-                                   MG_CM3_SRAM_BASE(cp_index));
+               ret = mg_image_load(single_img, image_size, cp_index);
                if (ret != 0) {
                        ERROR("SCP Image load failed\n");
                        return -1;