From 80bbf68632003720cb2b37a8d0f9605e3df54a4d Mon Sep 17 00:00:00 2001 From: Christine Gharzuzi Date: Mon, 28 May 2018 13:42:01 +0300 Subject: plat: a8k: add function that retrieves chip revision - This function retrieves the AP id (i.e 806/807/810) - This function is needed since retrieving chip id will be used in multiple cases. Change-Id: I13775ed5919ff10ac99e368317f89b359642d658 Signed-off-by: Christine Gharzuzi Reviewed-on: http://vgitil04.il.marvell.com:8080/55764 Reviewed-by: Kostya Porotchkin Tested-by: iSoC Platform CI Reviewed-on: http://vgitil04.il.marvell.com:8080/55885 --- plat/marvell/a8k/common/plat_ble_setup.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'plat/marvell/a8k/common/plat_ble_setup.c') diff --git a/plat/marvell/a8k/common/plat_ble_setup.c b/plat/marvell/a8k/common/plat_ble_setup.c index b681e2e9..17dd5142 100644 --- a/plat/marvell/a8k/common/plat_ble_setup.c +++ b/plat/marvell/a8k/common/plat_ble_setup.c @@ -143,6 +143,17 @@ #define EFUSE_AP_LD0_CLUSTER_DOWN_OFFS 4 +/* Return the AP revision of the chip */ +static unsigned int ble_get_ap_type(void) +{ + unsigned int chip_rev_id; + + chip_rev_id = mmio_read_32(MVEBU_CSS_GWD_CTRL_IIDR2_REG); + chip_rev_id = ((chip_rev_id & GWD_IIDR2_CHIP_ID_MASK) >> GWD_IIDR2_CHIP_ID_OFFSET); + + return chip_rev_id; +} + /****************************************************************************** * The routine allows to save the CCU and IO windows configuration during DRAM * setup and restore them afterwards before exiting the BLE stage. @@ -513,7 +524,6 @@ static void aro_to_pll(void) int ble_plat_setup(int *skip) { int ret; - unsigned int chip_rev_id; /* Power down unused CPUs */ plat_marvell_early_cpu_powerdown(); @@ -540,11 +550,8 @@ int ble_plat_setup(int *skip) /* Setup AVS */ ble_plat_svc_config(); - chip_rev_id = mmio_read_32(MVEBU_CSS_GWD_CTRL_IIDR2_REG); - chip_rev_id = ((chip_rev_id & GWD_IIDR2_CHIP_ID_MASK) >> GWD_IIDR2_CHIP_ID_OFFSET); - /* work with PLL clock driver in AP807 */ - if (chip_rev_id == CHIP_ID_AP807) + if (ble_get_ap_type() == CHIP_ID_AP807) aro_to_pll(); #if ARO_ENABLE -- cgit