Commit 9935047b authored by Manish Pandey's avatar Manish Pandey Committed by TrustedFirmware Code Review
Browse files

Merge changes I80316689,I23cac4fb,If911e7de,I169ff358,I4e040cd5, ... into integration

* changes:
  ddr: a80x0: add DDR 32-bit ECC mode support
  ble: ap807: improve PLL configuration sequence
  ble: ap807: clean-up PLL configuration sequence
  ddr: a80x0: add DDR 32-bit mode support
  plat: marvell: mci: perform mci link tuning for all mci interfaces
  plat: marvell: mci: use more meaningful name for mci link tuning
  plat: marvell: a8k: remove wrong or unnecessary comments
  plat: marvell: ap807: enable snoop filter for ap807
  plat: marvell: ap807: update configuration space of each CP
  plat: marvell: ap807: use correct address for MCIx4 register
  plat: marvell: add support for PLL 2.2GHz mode
  plat: marvell: armada: make a8k_common.mk and mss_common.mk more generic
  marvell: armada: add extra level in marvell platform hierarchy
parents a53e89bc 32b3b999
......@@ -84,7 +84,7 @@ There are several build options:
- BLE_PATH
Points to BLE (Binary ROM extension) sources folder. Only required for A8K builds.
The parameter is optional, its default value is ``plat/marvell/a8k/common/ble``.
The parameter is optional, its default value is ``plat/marvell/armada/a8k/common/ble``.
- MV_DDR_PATH
......@@ -192,7 +192,11 @@ Special Build Flags
In order to build UART recovery image this operation should be disabled for
a70x0 and a80x0 because of hardware limitation (boot from secondary image
can interrupt UART recovery process). This MACRO definition is set in
``plat/marvell/a8k/common/include/platform_def.h`` file.
``plat/marvell/armada/a8k/common/include/platform_def.h`` file.
- DDR32
In order to work in 32bit DDR, instead of the default 64bit ECC DDR,
this flag should be set to 1.
For more information about build options, please refer to the
:ref:`Build Options` document.
......
......@@ -8,13 +8,13 @@ SoC being used is already supported in TF-A.
Source Code Structure
---------------------
- The customer platform specific code shall reside under ``plat/marvell/<soc family>/<soc>_cust``
(e.g. 'plat/marvell/a8k/a7040_cust').
- The customer platform specific code shall reside under ``plat/marvell/armada/<soc family>/<soc>_cust``
(e.g. 'plat/marvell/armada/a8k/a7040_cust').
- The platform name for build purposes is called ``<soc>_cust`` (e.g. ``a7040_cust``).
- The build system will reuse all files from within the soc directory, and take only the porting
files from the customer platform directory.
Files that require porting are located at ``plat/marvell/<soc family>/<soc>_cust`` directory.
Files that require porting are located at ``plat/marvell/armada/<soc family>/<soc>_cust`` directory.
Armada-70x0/Armada-80x0 Porting
......@@ -64,7 +64,7 @@ boot loader recovery (marvell_plat_config.c)
- Example:
In A7040-DB specific implementation
(``plat/marvell/a8k/a70x0/board/marvell_plat_config.c``), the image skip is
(``plat/marvell/armada/a8k/a70x0/board/marvell_plat_config.c``), the image skip is
implemented using GPIO: mpp 33 (SW5).
Before resetting the board make sure there is a valid image on the next flash
......@@ -91,7 +91,7 @@ The BLE and consequently, the DDR init code is executed at the early stage of
the boot process.
Each supported platform of the TF-A has its own DDR porting file called
dram_port.c located at ``atf/plat/marvell/a8k/<platform>/board`` directory.
dram_port.c located at ``atf/plat/marvell/armada/a8k/<platform>/board`` directory.
Please refer to '<path_to_mv_ddr_sources>/doc/porting_guide.txt' for detailed
porting description.
......@@ -128,7 +128,7 @@ Comphy Porting (phy-porting-layer.h or phy-default-porting-layer.h)
The porting layer for PHY was introduced in TF-A. There is one file
``drivers/marvell/comphy/phy-default-porting-layer.h`` which contains the
defaults. Those default parameters are used only if there is no appropriate
phy-porting-layer.h file under: ``plat/marvell/<soc
phy-porting-layer.h file under: ``plat/marvell/armada/<soc
family>/<platform>/board/phy-porting-layer.h``. If the phy-porting-layer.h
exists, the phy-default-porting-layer.h is not going to be included.
......@@ -140,7 +140,7 @@ Comphy Porting (phy-porting-layer.h or phy-default-porting-layer.h)
The easiest way to prepare the PHY porting layer for custom board is to copy
existing example to a new platform:
- cp ``plat/marvell/a8k/a80x0/board/phy-porting-layer.h`` "plat/marvell/<soc family>/<platform>/board/phy-porting-layer.h"
- cp ``plat/marvell/armada/a8k/a80x0/board/phy-porting-layer.h`` "plat/marvell/armada/<soc family>/<platform>/board/phy-porting-layer.h"
- adjust relevant parameters or
- if different comphy index is used for specific feature, move it to proper table entry and then adjust.
......@@ -150,7 +150,7 @@ Comphy Porting (phy-porting-layer.h or phy-default-porting-layer.h)
- Example:
Example porting layer for armada-8040-db is under:
``plat/marvell/a8k/a80x0/board/phy-porting-layer.h``
``plat/marvell/armada/a8k/a80x0/board/phy-porting-layer.h``
.. note::
If there is no PHY porting layer for new platform (missing
......
......@@ -5,10 +5,10 @@ Marvell
:maxdepth: 1
:caption: Contents
build
porting
misc/mvebu-a8k-addr-map
misc/mvebu-amb
misc/mvebu-ccu
misc/mvebu-io-win
misc/mvebu-iob
armada/build
armada/porting
armada/misc/mvebu-a8k-addr-map
armada/misc/mvebu-amb
armada/misc/mvebu-ccu
armada/misc/mvebu-io-win
armada/misc/mvebu-iob
......@@ -39,19 +39,29 @@
#define AP807_CPU_PLL_PARAM(cluster) AP807_CPU_PLL_CTRL(cluster)
#define AP807_CPU_PLL_CFG(cluster) (AP807_CPU_PLL_CTRL(cluster) + 0x4)
#define AP807_CPU_PLL_CFG_BYPASS_MODE (0x1)
#define AP807_CPU_PLL_FRC_DSCHG (0x2)
#define AP807_CPU_PLL_CFG_USE_REG_FILE (0x1 << 9)
static void pll_set_freq(unsigned int freq_val)
{
int i;
if (freq_val != PLL_FREQ_2200)
return;
for (i = 0 ; i < AP807_CLUSTER_NUM ; i++) {
/* Set parameter of cluster i PLL to 2.2GHz */
mmio_write_32(AP807_CPU_PLL_PARAM(i), freq_val);
/* Set apll_lpf_frc_dschg - Control
* voltage of internal VCO is discharged
*/
mmio_write_32(AP807_CPU_PLL_CFG(i),
AP807_CPU_PLL_CFG_USE_REG_FILE);
AP807_CPU_PLL_FRC_DSCHG);
/* Set use_rf_conf load PLL parameter from register */
mmio_write_32(AP807_CPU_PLL_CFG(i),
AP807_CPU_PLL_CFG_USE_REG_FILE |
AP807_CPU_PLL_CFG_BYPASS_MODE);
mmio_write_32(AP807_CPU_PLL_PARAM(i), freq_val);
AP807_CPU_PLL_FRC_DSCHG |
AP807_CPU_PLL_CFG_USE_REG_FILE);
/* Un-set apll_lpf_frc_dschg */
mmio_write_32(AP807_CPU_PLL_CFG(i),
AP807_CPU_PLL_CFG_USE_REG_FILE);
}
......@@ -84,19 +94,16 @@ static void aro_to_pll(void)
*/
void ap807_clocks_init(unsigned int freq_option)
{
/* Switch from ARO to PLL */
aro_to_pll();
/* Modifications in frequency table:
* 0x0: 764x: change to 2000 MHz.
* 0x2: 744x change to 1800 MHz, 764x change to 2200/2400.
* 0x3: 3900/744x/764x change to 1200 MHz.
*/
switch (freq_option) {
case CPU_2000_DDR_1200_RCLK_1200:
pll_set_freq(PLL_FREQ_2000);
break;
default:
break;
}
if (freq_option == CPU_2200_DDR_1200_RCLK_1200)
pll_set_freq(PLL_FREQ_2200);
/* Switch from ARO to PLL */
aro_to_pll();
}
......@@ -2236,7 +2236,7 @@ int mvebu_cp110_comphy_xfi_rx_training(uint64_t comphy_base,
printf("########################################################\n");
printf("# To use trained values update the ATF sources:\n");
printf("# plat/marvell/a8k/<board_type>/board/phy-porting-layer.h ");
printf("# plat/marvell/armada/a8k/<board_type>/board/phy-porting-layer.h ");
printf("file\n# with new values as below (for appropriate AP nr %d",
ap_nr);
printf("and CP nr: %d comphy_index %d\n\n",
......
......@@ -7,7 +7,7 @@
/* Those are parameters for xfi mode, which need to be tune for each board type.
* For known DB boards the parameters was already calibrated and placed under
* the plat/marvell/a8k/<board_type>/board/phy-porting-layer.h
* the plat/marvell/armada/a8k/<board_type>/board/phy-porting-layer.h
*/
struct xfi_params {
uint8_t g1_ffe_res_sel;
......
......@@ -571,21 +571,21 @@ static int mci_enable_simultaneous_transactions(int mci_index)
debug_enter();
/* ID assignment (assigning global ID offset to CP) */
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(0),
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(mci_index),
MCI_DID_GLOBAL_ASSIGN_REQ_MCI_LOCAL_ID(2) |
MCI_DID_GLOBAL_ASSIGN_REQ_MCI_COUNT(2) |
MCI_DID_GLOBAL_ASSIGN_REQ_HOPS_NUM(2));
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_DID_GLOBAL_ASSIGNMENT_REQUEST_REG) |
MCI_INDIRECT_CTRL_ASSIGN_CMD);
ret |= mci_poll_command_completion(mci_index, MCI_CMD_WRITE);
/* Assigning dest. ID=3 to all transactions entering from AXI at AP */
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(0),
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(mci_index),
MCI_HB_CTRL_WIN0_DEST_VALID_FLAG(1) |
MCI_HB_CTRL_WIN0_DEST_ID(3));
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_HB_CTRL_WIN0_DESTINATION_REG_NUM) |
MCI_INDIRECT_CTRL_HOPID(GID_AXI_HB) |
......@@ -593,10 +593,10 @@ static int mci_enable_simultaneous_transactions(int mci_index)
ret |= mci_poll_command_completion(mci_index, MCI_CMD_WRITE);
/* Assigning dest. ID=1 to all transactions entering from AXI at CP */
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(0),
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(mci_index),
MCI_HB_CTRL_WIN0_DEST_VALID_FLAG(1) |
MCI_HB_CTRL_WIN0_DEST_ID(1));
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_HB_CTRL_WIN0_DESTINATION_REG_NUM) |
MCI_INDIRECT_CTRL_HOPID(GID_IHB_EXT) |
......@@ -607,8 +607,8 @@ static int mci_enable_simultaneous_transactions(int mci_index)
* This will lead to get match for any AXI address
* and receive destination ID=3
*/
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(0), 0xffffffff);
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(mci_index), 0xffffffff);
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_HB_CTRL_WIN0_ADDRESS_MASK_REG_NUM) |
MCI_INDIRECT_CTRL_HOPID(GID_AXI_HB) |
......@@ -619,8 +619,8 @@ static int mci_enable_simultaneous_transactions(int mci_index)
* This will lead to get match for any AXI address
* and receive destination ID=1
*/
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(0), 0xffffffff);
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_WRITE_READ_DATA_REG(mci_index), 0xffffffff);
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_HB_CTRL_WIN0_ADDRESS_MASK_REG_NUM) |
MCI_INDIRECT_CTRL_HOPID(GID_IHB_EXT) |
......@@ -653,7 +653,7 @@ static _Bool mci_simulatenous_trans_missing(int mci_index)
* performed by BootROM.
*/
debug_enter();
mci_mmio_write_32(MCI_ACCESS_CMD_REG(0),
mci_mmio_write_32(MCI_ACCESS_CMD_REG(mci_index),
MCI_INDIRECT_REG_CTRL_ADDR(
MCI_HB_CTRL_WIN0_DESTINATION_REG_NUM) |
MCI_INDIRECT_CTRL_HOPID(GID_AXI_HB) |
......@@ -697,7 +697,8 @@ int mci_configure(int mci_index)
* wasn't already enabled in bootrom.
*/
if (mci_simulatenous_trans_missing(mci_index)) {
VERBOSE("Enabling MCI simultaneous transaction\n");
VERBOSE("Enabling MCI simultaneous transaction for mci%d\n",
mci_index);
/* set MCI to support read/write transactions
* to arrive at the same time
*/
......@@ -819,7 +820,7 @@ void mci_turn_link_on(void)
}
/* Initialize MCI for performance improvements */
int mci_initialize(int mci_index)
int mci_link_tune(int mci_index)
{
int ret;
......
......@@ -11,6 +11,7 @@
#include <drivers/marvell/cache_llc.h>
#include <drivers/marvell/ccu.h>
#include <drivers/marvell/io_win.h>
#include <drivers/marvell/iob.h>
#include <drivers/marvell/mci.h>
#include <drivers/marvell/mochi/ap_setup.h>
#include <lib/mmio.h>
......@@ -31,6 +32,11 @@
#define DSS_CR0 (MVEBU_RFU_BASE + 0x100)
#define DVM_48BIT_VA_ENABLE (1 << 21)
/* SoC RFU / IHBx4 Control */
#define MCIX4_807_REG_START_ADDR_REG(unit_id) (MVEBU_RFU_BASE + \
0x4258 + (unit_id * 0x4))
/* Secure MoChi incoming access */
#define SEC_MOCHI_IN_ACC_REG (MVEBU_RFU_BASE + 0x4738)
#define SEC_MOCHI_IN_ACC_IHB0_EN (1)
......@@ -124,7 +130,7 @@ static void mci_remap_indirect_access_base(void)
uint32_t mci;
for (mci = 0; mci < MCI_MAX_UNIT_ID; mci++)
mmio_write_32(MCIX4_REG_START_ADDRESS_REG(mci),
mmio_write_32(MCIX4_807_REG_START_ADDR_REG(mci),
MVEBU_MCI_REG_BASE_REMAP(mci) >>
MCI_REMAP_OFF_SHIFT);
}
......@@ -186,6 +192,38 @@ static void misc_soc_configurations(void)
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)
{
/* Setup Aurora2. */
......
......@@ -250,3 +250,6 @@ int ap_get_count(void)
return 1;
}
void update_cp110_default_win(int cp_id)
{
}
......@@ -21,11 +21,13 @@ enum hws_freq {
DDR_FREQ_SAR
};
#include <mvebu_def.h>
enum cpu_clock_freq_mode {
CPU_2000_DDR_1200_RCLK_1200 = 0x0,
CPU_2000_DDR_1050_RCLK_1050 = 0x1,
CPU_1600_DDR_800_RCLK_800 = 0x4,
CPU_1800_DDR_1200_RCLK_1200 = 0x6,
CPU_2200_DDR_1200_RCLK_1200 = 0x6,
CPU_1800_DDR_1050_RCLK_1050 = 0x7,
CPU_1600_DDR_900_RCLK_900 = 0x0B,
CPU_1600_DDR_1050_RCLK_1050 = 0x0D,
......
......@@ -10,7 +10,7 @@
#ifndef MCI_H
#define MCI_H
int mci_initialize(int mci_index);
int mci_link_tune(int mci_index);
void mci_turn_link_down(void);
void mci_turn_link_on(void);
int mci_get_link_status(void);
......
......@@ -13,5 +13,6 @@
void ap_init(void);
void ap_ble_init(void);
int ap_get_count(void);
void update_cp110_default_win(int cp_id);
#endif /* AP_SETUP_H */
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