Commit c3c51b32 authored by Grzegorz Jaszczyk's avatar Grzegorz Jaszczyk Committed by Marcin Wojtas
Browse files

plat: marvell: ap807: update configuration space of each CP



By default all external CPs start with configuration address space set to
0xf200_0000. To overcome this issue, go in the loop and initialize the
CP one by one, using temporary window configuration which allows to access
each CP and update its configuration space according to decoding
windows scheme defined for each platform.

In case of cn9130 after this procedure bellow addresses will be used:
CP0 - f2000000
CP1 - f4000000
CP2 - f6000000

When the re-configuration is done there is need to restore previous
decoding window configuration(init_io_win).

Change-Id: I1a652bfbd0bf7106930a7a4e949094dc9078a981
Signed-off-by: default avatarGrzegorz Jaszczyk <jaz@semihalf.com>
parent 2da75ae1
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <drivers/marvell/cache_llc.h> #include <drivers/marvell/cache_llc.h>
#include <drivers/marvell/ccu.h> #include <drivers/marvell/ccu.h>
#include <drivers/marvell/io_win.h> #include <drivers/marvell/io_win.h>
#include <drivers/marvell/iob.h>
#include <drivers/marvell/mci.h> #include <drivers/marvell/mci.h>
#include <drivers/marvell/mochi/ap_setup.h> #include <drivers/marvell/mochi/ap_setup.h>
#include <lib/mmio.h> #include <lib/mmio.h>
...@@ -191,6 +192,38 @@ static void misc_soc_configurations(void) ...@@ -191,6 +192,38 @@ static void misc_soc_configurations(void)
mmio_write_32(MVEBU_SYSRST_OUT_CONFIG_REG, reg); mmio_write_32(MVEBU_SYSRST_OUT_CONFIG_REG, reg);
} }
/*
* By default all external CPs start with configuration address space set to
* 0xf200_0000. To overcome this issue, go in the loop and initialize the
* CP one by one, using temporary window configuration which allows to access
* each CP and update its configuration space according to decoding
* windows scheme defined for each platform.
*/
void update_cp110_default_win(int cp_id)
{
int mci_id = cp_id - 1;
uintptr_t cp110_base, cp110_temp_base;
/* CP110 default configuration address space */
cp110_temp_base = MVEBU_AP_IO_BASE(MVEBU_AP0);
struct addr_map_win iowin_temp_win = {
.base_addr = cp110_temp_base,
.win_size = MVEBU_CP_OFFSET,
};
iowin_temp_win.target_id = mci_id;
iow_temp_win_insert(0, &iowin_temp_win, 1);
/* Calculate the new CP110 - base address */
cp110_base = MVEBU_CP_REGS_BASE(cp_id);
/* Go and update the CP110 configuration address space */
iob_cfg_space_update(0, cp_id, cp110_temp_base, cp110_base);
/* Remove the temporary IO-WIN window */
iow_temp_win_remove(0, &iowin_temp_win, 1);
}
void ap_init(void) void ap_init(void)
{ {
/* Setup Aurora2. */ /* Setup Aurora2. */
......
...@@ -250,3 +250,6 @@ int ap_get_count(void) ...@@ -250,3 +250,6 @@ int ap_get_count(void)
return 1; return 1;
} }
void update_cp110_default_win(int cp_id)
{
}
...@@ -13,5 +13,6 @@ ...@@ -13,5 +13,6 @@
void ap_init(void); void ap_init(void);
void ap_ble_init(void); void ap_ble_init(void);
int ap_get_count(void); int ap_get_count(void);
void update_cp110_default_win(int cp_id);
#endif /* AP_SETUP_H */ #endif /* AP_SETUP_H */
...@@ -117,8 +117,11 @@ void bl31_plat_arch_setup(void) ...@@ -117,8 +117,11 @@ void bl31_plat_arch_setup(void)
for (cp = 0; cp < CP_COUNT; cp++) { for (cp = 0; cp < CP_COUNT; cp++) {
/* configure cp110 for CP0*/ /* configure cp110 for CP0*/
if (cp == 1) if (cp >= 1) {
mci_initialize(MVEBU_MCI0); mci_initialize(MVEBU_MCI0);
update_cp110_default_win(cp);
}
/* initialize MCI & CP1 */ /* initialize MCI & CP1 */
cp110_init(MVEBU_CP_REGS_BASE(cp), cp110_init(MVEBU_CP_REGS_BASE(cp),
...@@ -128,6 +131,12 @@ void bl31_plat_arch_setup(void) ...@@ -128,6 +131,12 @@ void bl31_plat_arch_setup(void)
marvell_bl31_mpp_init(cp); marvell_bl31_mpp_init(cp);
} }
/*
* There is need to configure IO_WIN windows again to overwrite
* temporary configuration done during update_cp110_default_win
*/
init_io_win(MVEBU_AP0);
/* initialize IPC between MSS and ATF */ /* initialize IPC between MSS and ATF */
if (mailbox[MBOX_IDX_MAGIC] != MVEBU_MAILBOX_MAGIC_NUM || if (mailbox[MBOX_IDX_MAGIC] != MVEBU_MAILBOX_MAGIC_NUM ||
mailbox[MBOX_IDX_SUSPEND_MAGIC] != MVEBU_MAILBOX_SUSPEND_STATE) mailbox[MBOX_IDX_SUSPEND_MAGIC] != MVEBU_MAILBOX_SUSPEND_STATE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment