plat/xilinx/zynqmp/pm_service/pm_api_clock.c
/**
 * pm_api_clock_get_topology() - PM call to request a clock's topology
 * @clock_id	Clock ID
 * @index	Topology index for next toplogy node
 * @topology	Buffer to store nodes in topology and flags
 *
 * This function is used by master to get topology information for the
 * clock specified by given clock ID. Each response would return 3
 * topology nodes. To get next nodes, caller needs to call this API with
 * index of next node. Index starts from 0.
 *
 * @return	Returns status, either success or error+reason
 */
PM call to request a clock's topology
@clock_id    Clock ID
@index       Topology index for next toplogy node
@topology    Buffer to store nodes in topology and flags

This function is used by master to get topology information for the
clock specified by given clock ID. Each response would return 3
topology nodes. To get next nodes, caller needs to call this API with
index of next node. Index starts from 0.

@return      Returns status, either success or error+reason
PM call to request a clock ' s topology @clock_id Clock ID @index Topology index for next toplogy node @topology Buffer to store nodes in topology and flags This function is used by master to get topology information for the clock specified by given clock ID . Each response would return 3 topology nodes . To get next nodes caller needs to call this API with index of next node . Index starts from 0 . @return Returns status either success or error + reason
enum pm_ret_status pm_api_clock_get_topology(unsigned int clock_id,
					     unsigned int index,
					     uint32_t *topology)
{
	struct pm_clock_node *clock_nodes;
	uint8_t num_nodes;
	unsigned int i;
	if (!pm_clock_valid(clock_id))
		return PM_RET_ERROR_ARGS;
	if (pm_clock_type(clock_id) != CLK_TYPE_OUTPUT)
		return PM_RET_ERROR_NOTSUPPORTED;
	memset(topology, 0, CLK_TOPOLOGY_PAYLOAD_LEN);
	clock_nodes = *clocks[clock_id].nodes;
	num_nodes = clocks[clock_id].num_nodes;
	if (index >= num_nodes)
		return PM_RET_SUCCESS;
	for (i = 0; i < 3U; i++) {
		if ((index + i) == num_nodes)
			break;
		topology[i] =  clock_nodes[index + i].type;
		topology[i] |= clock_nodes[index + i].clkflags <<
					CLK_CLKFLAGS_SHIFT;
		topology[i] |= clock_nodes[index + i].typeflags <<
					CLK_TYPEFLAGS_SHIFT;
	}
	return PM_RET_SUCCESS;
}
enum pm_ret_status pm_api_clock_get_topology ( unsigned int clock_id , unsigned int index , uint32_t * topology ) { struct pm_clock_node * clock_nodes ; uint8_t num_nodes ; unsigned int i ; if ( ! pm_clock_valid ( clock_id ) ) return PM_RET_ERROR_ARGS ; if ( pm_clock_type ( clock_id ) != CLK_TYPE_OUTPUT ) return PM_RET_ERROR_NOTSUPPORTED ; memset ( topology , 0 , CLK_TOPOLOGY_PAYLOAD_LEN ) ; clock_nodes = * clocks [ clock_id ] . nodes ; num_nodes = clocks [ clock_id ] . num_nodes ; if ( index >= num_nodes ) return PM_RET_SUCCESS ; for ( i = 0 ; i < 3U ; i ++ ) { if ( ( index + i ) == num_nodes ) break ; topology [ i ] = clock_nodes [ index + i ] . type ; topology [ i ] |= clock_nodes [ index + i ] . clkflags << CLK_CLKFLAGS_SHIFT ; topology [ i ] |= clock_nodes [ index + i ] . typeflags << CLK_TYPEFLAGS_SHIFT ; } return PM_RET_SUCCESS ; }
pm_api_clock_get_topology() - PM call to request a clock's topology
 @clock_id    Clock ID
 @index       Topology index for next toplogy node
 @topology    Buffer to store nodes in topology and flags
pm_api_clock_get_topology () - PM call to request a clock ' s topology @clock_id Clock ID @index Topology index for next toplogy node @topology Buffer to store nodes in topology and flags
/* Skip parent till index */