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

Commit 6819681b authored by Devesh Jhunjhunwala's avatar Devesh Jhunjhunwala
Browse files

clk: msm: clock-gcc-californium: Add a7pll clock for cpuss



The a7pll clock can be used as a parent for the cpu clock.
Add a device tree entry for the same and enable it.

Change-Id: I9950d699270e88c44a96ccb3a8f86484e5d34b13
Signed-off-by: default avatarDevesh Jhunjhunwala <deveshj@codeaurora.org>
parent 60be5879
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -113,12 +113,14 @@

	clock_gcc: qcom,gcc@1800000 {
		compatible = "qcom,gcc-californium";
		reg = <0x1800000 0x80000>;
		reg-names = "cc_base";
		reg = <0x1800000 0x80000>,
		      <0xb008018 0x1c>;
		reg-names = "cc_base", "apcs_base";
		#clock-cells = <1>;

		qcom,regulator-names = "vdd_dig";
		qcom,regulator-names = "vdd_dig", "vdd_dig_ao";
		vdd_dig-supply = <&pmdcalifornium_s5_level>;
		vdd_dig_ao-supply = <&pmdcalifornium_s5_level_ao>;
	};

	clock_debug: qcom,cc-debug@1874000 {
@@ -134,8 +136,9 @@
		reg-names = "rcg-base";
		#clock-cells = <1>;

		clock-names = "clk-1";
		clocks = <&clock_gcc clk_gpll0_ao>;
		clock-names = "clk-1", "clk-5";
		clocks = <&clock_gcc clk_gpll0_ao>,
			 <&clock_gcc clk_a7pll_clk>;

		qcom,speed0-bin-v0 =
			<         0 RPM_SMD_REGULATOR_LEVEL_NONE>,
+52 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@

static void __iomem *virt_base;
static void __iomem *virt_dbgbase;
static void __iomem *virt_apcsbase;

#define GCC_REG_BASE(x) (void __iomem *)(virt_base + (x))

@@ -95,6 +96,8 @@ static void __iomem *virt_dbgbase;
	}

static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner, NULL);
static DEFINE_VDD_REGULATORS(vdd_dig_ao, VDD_DIG_NUM, 1, vdd_corner, NULL);

#define GPLL0_MODE                                       (0x21000)
#define MSS_Q6_BIMC_AXI_CBCR                             (0x49004)
#define QUSB2A_PHY_BCR                                   (0x41028)
@@ -229,6 +232,35 @@ DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(rf_clk2_pin, rf_clk2_pin_ao,
DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(rf_clk3_pin, rf_clk3_pin_ao,
				     RF_CLK3_PIN_ID);

static struct alpha_pll_masks alpha_pll_masks_20nm_p = {
	.lock_mask = BIT(31),
	.update_mask = BIT(22),
	.vco_mask = BM(21, 20) >> 20,
	.vco_shift = 20,
	.alpha_en_mask = BIT(24),
};

static struct alpha_pll_vco_tbl alpha_pll_vco_20nm_p[] = {
	VCO(3,  250000000,  500000000),
	VCO(2,  500000000, 1000000000),
	VCO(1, 1000000000, 1500000000),
	VCO(0, 1500000000, 2000000000),
};

static struct alpha_pll_clk a7pll_clk = {
	.masks = &alpha_pll_masks_20nm_p,
	.base = &virt_apcsbase,
	.vco_tbl = alpha_pll_vco_20nm_p,
	.num_vco = ARRAY_SIZE(alpha_pll_vco_20nm_p),
	.c = {
		.parent = &xo_a_clk.c,
		.dbg_name = "a7pll_clk",
		.ops = &clk_ops_alpha_pll,
		VDD_DIG_FMAX_MAP2_AO(LOW, 1000000000, NOMINAL, 2000000000),
		CLK_INIT(a7pll_clk.c),
	},
};

static unsigned int soft_vote_gpll0;

static struct pll_vote_clk gpll0 = {
@@ -1328,6 +1360,7 @@ static struct mux_clk gcc_debug_mux = {
};

static struct clk_lookup msm_clocks_rpm_californium[] = {
	CLK_LIST(a7pll_clk),
	CLK_LIST(xo),
	CLK_LIST(xo_a_clk),
	CLK_LIST(cxo_clk_src),
@@ -1479,6 +1512,18 @@ static int msm_gcc_californium_probe(struct platform_device *pdev)
		return -ENOMEM;
	}

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apcs_base");
	if (!res) {
		dev_err(&pdev->dev, "Failed to get APCS base.\n");
		return -EINVAL;
	}
	virt_apcsbase = devm_ioremap(&pdev->dev, res->start,
						resource_size(res));
	if (!virt_apcsbase) {
		dev_err(&pdev->dev, "Failed to map in APCS registers.\n");
		return -ENOMEM;
	}

	vdd_dig.regulator[0] = devm_regulator_get(&pdev->dev, "vdd_dig");
	if (IS_ERR(vdd_dig.regulator[0])) {
		if (!(PTR_ERR(vdd_dig.regulator[0]) == -EPROBE_DEFER))
@@ -1486,6 +1531,13 @@ static int msm_gcc_californium_probe(struct platform_device *pdev)
		return PTR_ERR(vdd_dig.regulator[0]);
	}

	vdd_dig_ao.regulator[0] = devm_regulator_get(&pdev->dev, "vdd_dig_ao");
	if (IS_ERR(vdd_dig_ao.regulator[0])) {
		if (!(PTR_ERR(vdd_dig_ao.regulator[0]) == -EPROBE_DEFER))
			dev_err(&pdev->dev, "Unable to get vdd_dig_ao regulator!");
		return PTR_ERR(vdd_dig_ao.regulator[0]);
	}

	ret = of_msm_clock_register(pdev->dev.of_node,
				    msm_clocks_rpm_californium,
				    ARRAY_SIZE(msm_clocks_rpm_californium));
+2 −3
Original line number Diff line number Diff line
@@ -49,12 +49,11 @@
	},					\
	.num_fmax = VDD_DIG_NUM

#define VDD_MMPLL4_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \
	.vdd_class = &vdd_mmpll4,		\
#define VDD_DIG_FMAX_MAP2_AO(l1, f1, l2, f2) \
	.vdd_class = &vdd_dig_ao,			\
	.fmax = (unsigned long[VDD_DIG_NUM]) {	\
		[VDD_DIG_##l1] = (f1),		\
		[VDD_DIG_##l2] = (f2),		\
		[VDD_DIG_##l3] = (f3),		\
	},					\
	.num_fmax = VDD_DIG_NUM

+3 −0
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@
#define clk_gcc_usb3_pipe_clk 0x26f8a97a
#define clk_gcc_usb_phy_cfg_ahb_clk 0xccb7e26f

/* a7pll */
#define clk_a7pll_clk		0x3dd5dd94

/* clock_debug controlled clocks */
#define clk_gcc_debug_mux 0x8121ac15