CCN: Add API to query the PART0 ID from CCN

This patch adds the API `ccn_get_part0_id` to query the PART0 ID from the
PERIPHERAL_ID 0 register in the CCN driver. This ID allows to distinguish
the variant of CCN present on the system and possibly enable dynamic
configuration of the IP based on the variant. Also added an assert in
`ccn_master_to_rn_id_map()` to ensure that the master map bitfield provided
by the platform is within the expected interface id.

Change-Id: I92d2db7bd93a9be8a7fbe72a522cbcba0aba2d0e
This commit is contained in:
Soby Mathew 2016-03-23 17:14:57 +00:00
parent e141aa0357
commit 6331a31a66
3 changed files with 22 additions and 0 deletions

View file

@ -254,6 +254,7 @@ static unsigned long long ccn_master_to_rn_id_map(unsigned long long master_map)
assert(ccn_plat_desc); assert(ccn_plat_desc);
FOR_EACH_PRESENT_MASTER_INTERFACE(iface_id, master_map) { FOR_EACH_PRESENT_MASTER_INTERFACE(iface_id, master_map) {
assert(iface_id < ccn_plat_desc->num_masters);
/* Convert the master ID into the node ID */ /* Convert the master ID into the node ID */
node_id = ccn_plat_desc->master_to_rn_id_map[iface_id]; node_id = ccn_plat_desc->master_to_rn_id_map[iface_id];
@ -501,3 +502,15 @@ void ccn_program_sys_addrmap(unsigned int sn0_id,
} }
} }
/*******************************************************************************
* This function returns the part0 id from the peripheralID 0 register
* in CCN. This id can be used to distinguish the CCN variant present in the
* system.
******************************************************************************/
int ccn_get_part0_id(uintptr_t periphbase)
{
assert(periphbase);
return (int)(mmio_read_64(periphbase
+ MN_PERIPH_ID_0_1_OFFSET) & 0xFF);
}

View file

@ -149,6 +149,7 @@ typedef enum rn_types {
#define MN_DDC_STAT_OFFSET DOMAIN_CTRL_STAT_OFFSET #define MN_DDC_STAT_OFFSET DOMAIN_CTRL_STAT_OFFSET
#define MN_DDC_SET_OFFSET DOMAIN_CTRL_SET_OFFSET #define MN_DDC_SET_OFFSET DOMAIN_CTRL_SET_OFFSET
#define MN_DDC_CLR_OFFSET DOMAIN_CTRL_CLR_OFFSET #define MN_DDC_CLR_OFFSET DOMAIN_CTRL_CLR_OFFSET
#define MN_PERIPH_ID_0_1_OFFSET 0xFE0
#define MN_ID_OFFSET REGION_ID_OFFSET #define MN_ID_OFFSET REGION_ID_OFFSET
/* HNF System Address Map register bit masks and shifts */ /* HNF System Address Map register bit masks and shifts */

View file

@ -51,6 +51,13 @@
#define CCN_L3_RUN_MODE_HAM 0x2 /* HNF_PM_HALF */ #define CCN_L3_RUN_MODE_HAM 0x2 /* HNF_PM_HALF */
#define CCN_L3_RUN_MODE_FAM 0x3 /* HNF_PM_FULL */ #define CCN_L3_RUN_MODE_FAM 0x3 /* HNF_PM_FULL */
/* part 0 IDs for various CCN variants */
#define CCN_502_PART0_ID 0x30
#define CCN_504_PART0_ID 0x26
#define CCN_505_PART0_ID 0x27
#define CCN_508_PART0_ID 0x28
#define CCN_512_PART0_ID 0x29
/* /*
* The following macro takes the value returned from a read of a HN-F P-state * The following macro takes the value returned from a read of a HN-F P-state
* status register and returns the retention state value. * status register and returns the retention state value.
@ -107,6 +114,7 @@ void ccn_program_sys_addrmap(unsigned int sn0_id,
unsigned int top_addr_bit1, unsigned int top_addr_bit1,
unsigned char three_sn_en); unsigned char three_sn_en);
unsigned int ccn_get_l3_run_mode(void); unsigned int ccn_get_l3_run_mode(void);
int ccn_get_part0_id(uintptr_t periphbase);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __CCN_H__ */ #endif /* __CCN_H__ */