Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23952d20 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: clock-local2: Support parsing voter clocks from dt"

parents 5e1cdcb9 df4e399c
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -252,3 +252,35 @@ ocmemcx_ahb_clk: ocmemcx_ahb_clk {
	qcom,has-sibling;
	qcom,parent = <&mmssnoc_ahb_clk>;
};

*****************************************************************************

"qcom,local-vote-clk"

Some branch clocks are shared between different processors and execution environments
(TZ, APPS, RPM, MODEM). The votes from each of these masters are logically or'd in
hardware and control whether the clock is gated.

Required Properties:
- compatible:		Must be "qcom,local-vote-clk"

- qcom,base-offset:	Offset for the branch clock registers

- qcom,en-offset:	Offset for the APPS master voting register

- qcom,en-bit:		Bit in the APPS master voting register to set/unset

Recommended Properties:
- qcom,parent:		See "General Optional Properties"

Optional Properties:
- qcom,bcr-offset:	Offset from the register region described in the parent
			clock controller for the reset.

gcc_bam_dma_ahb_clk: gcc_bam_dma_ahb_clk {
	compatible = "qcom,local-vote-clk";
	qcom,base-offset = <GCC_BAM_DMA_AHB_CBCR>;
	qcom,en-offset = <GCC_APCS_CLOCK_BRANCH_ENA_VOTE>;
	qcom,en-bit = <12>;
	qcom,parent = <&pnoc_clk>;
};
+47 −0
Original line number Diff line number Diff line
@@ -1544,3 +1544,50 @@ static void *cbc_dt_parser(struct device *dev, struct device_node *np)
	return msmclk_generic_clk_init(dev, np, &branch_clk->c);
}
MSMCLK_PARSER(cbc_dt_parser, "qcom,cbc", 0);

static void *local_vote_clk_dt_parser(struct device *dev,
						struct device_node *np)
{
	struct local_vote_clk *vote_clk;
	struct msmclk_data *drv;
	int rc, val;

	vote_clk = devm_kzalloc(dev, sizeof(*vote_clk), GFP_KERNEL);
	if (!vote_clk) {
		dt_err(np, "failed to alloc memory\n");
		return ERR_PTR(-ENOMEM);
	}

	drv = msmclk_parse_phandle(dev, np->parent->phandle);
	if (IS_ERR_OR_NULL(drv))
		return ERR_CAST(drv);
	vote_clk->base = &drv->base;

	rc = of_property_read_u32(np, "qcom,base-offset",
						&vote_clk->cbcr_reg);
	if (rc) {
		dt_err(np, "missing/incorrect qcom,base-offset dt property\n");
		return ERR_PTR(-EINVAL);
	}

	rc = of_property_read_u32(np, "qcom,en-offset", &vote_clk->vote_reg);
	if (rc) {
		dt_err(np, "missing/incorrect qcom,en-offset dt property\n");
		return ERR_PTR(-EINVAL);
	}

	rc = of_property_read_u32(np, "qcom,en-bit", &val);
	if (rc) {
		dt_err(np, "missing/incorrect qcom,en-bit dt property\n");
		return ERR_PTR(-EINVAL);
	}
	vote_clk->en_mask = BIT(val);

	vote_clk->c.ops = &clk_ops_vote;

	/* Optional property */
	of_property_read_u32(np, "qcom,bcr-offset", &vote_clk->bcr_reg);

	return msmclk_generic_clk_init(dev, np, &vote_clk->c);
}
MSMCLK_PARSER(local_vote_clk_dt_parser, "qcom,local-vote-clk", 0);
+5 −5
Original line number Diff line number Diff line
@@ -116,12 +116,12 @@ static inline struct branch_clk *to_branch_clk(struct clk *clk)
 */
struct local_vote_clk {
	struct clk c;
	const u32 cbcr_reg;
	const u32 vote_reg;
	const u32 bcr_reg;
	const u32 en_mask;
	u32 cbcr_reg;
	u32 vote_reg;
	u32 bcr_reg;
	u32 en_mask;
	const u32 halt_check;
	void *const __iomem *base;
	void * __iomem *base;
};

static inline struct local_vote_clk *to_local_vote_clk(struct clk *clk)