Skip to content

Commit

Permalink
clk: zynqmp: Use firmware specific common clock flags
Browse files Browse the repository at this point in the history
Currently firmware passes CCF specific flags to ZynqMP clock driver.
So firmware needs to be updated if CCF flags are changed. The firmware
should have its own 'flag number space' that is distinct from the
common clk framework's 'flag number space'. So define and use ZynqMP
specific common clock flags instead of using CCF flags.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Reviewed-by: Jolly Shah <jolly.shah@xilinx.com>
State: pending
  • Loading branch information
rajanv-xilinx authored and Michal Simek committed Mar 22, 2021
1 parent 573b7c2 commit 54ed8a7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
22 changes: 22 additions & 0 deletions drivers/clk/zynqmp/clk-zynqmp.h
Expand Up @@ -10,6 +10,28 @@

#include <linux/firmware/xlnx-zynqmp.h>

/* Common Flags */
/* must be gated across rate change */
#define ZYNQMP_CLK_SET_RATE_GATE BIT(0)
/* must be gated across re-parent */
#define ZYNQMP_CLK_SET_PARENT_GATE BIT(1)
/* propagate rate change up one level */
#define ZYNQMP_CLK_SET_RATE_PARENT BIT(2)
/* do not gate even if unused */
#define ZYNQMP_CLK_IGNORE_UNUSED BIT(3)
/* do not use the cached clk rate */
#define ZYNQMP_CLK_GET_RATE_NOCACHE BIT(6)
/* don't re-parent on rate change */
#define ZYNQMP_CLK_SET_RATE_NO_REPARENT BIT(7)
/* do not use the cached clk accuracy */
#define ZYNQMP_CLK_GET_ACCURACY_NOCACHE BIT(8)
/* recalc rates after notifications */
#define ZYNQMP_CLK_RECALC_NEW_RATES BIT(9)
/* clock needs to run to set rate */
#define ZYNQMP_CLK_SET_RATE_UNGATE BIT(10)
/* do not gate, ever */
#define ZYNQMP_CLK_IS_CRITICAL BIT(11)

enum topology_type {
TYPE_INVALID,
TYPE_MUX,
Expand Down
23 changes: 21 additions & 2 deletions drivers/clk/zynqmp/clkc.c
Expand Up @@ -385,14 +385,33 @@ static int __zynqmp_clock_get_topology(struct clock_topology *topology,
{
int i;
u32 type;
u32 flag;

for (i = 0; i < ARRAY_SIZE(response->topology); i++) {
type = FIELD_GET(CLK_TOPOLOGY_TYPE, response->topology[i]);
if (type == TYPE_INVALID)
return END_OF_TOPOLOGY_NODE;
topology[*nnodes].type = type;
topology[*nnodes].flag = FIELD_GET(CLK_TOPOLOGY_FLAGS,
response->topology[i]);
flag = FIELD_GET(CLK_TOPOLOGY_FLAGS, response->topology[i]);
topology[*nnodes].flag = 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_SET_RATE_PARENT) ?
CLK_SET_RATE_PARENT : 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_IGNORE_UNUSED) ?
CLK_IGNORE_UNUSED : 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_GET_RATE_NOCACHE) ?
CLK_GET_RATE_NOCACHE : 0;
topology[*nnodes].flag |= (flag &
ZYNQMP_CLK_SET_RATE_NO_REPARENT) ?
CLK_SET_RATE_NO_REPARENT : 0;
topology[*nnodes].flag |= (flag &
ZYNQMP_CLK_GET_ACCURACY_NOCACHE) ?
CLK_GET_ACCURACY_NOCACHE : 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_RECALC_NEW_RATES) ?
CLK_RECALC_NEW_RATES : 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_SET_RATE_UNGATE) ?
CLK_SET_RATE_UNGATE : 0;
topology[*nnodes].flag |= (flag & ZYNQMP_CLK_IS_CRITICAL) ?
CLK_IS_CRITICAL : 0;
topology[*nnodes].type_flag =
FIELD_GET(CLK_TOPOLOGY_TYPE_FLAGS,
response->topology[i]);
Expand Down

0 comments on commit 54ed8a7

Please sign in to comment.