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

Commit b513051a authored by Gilad Broner's avatar Gilad Broner
Browse files

msm: tspp: remove msm_tspp_platform_data structure



TSPP clock names will not change for current platforms, so there
is no need to have them as parameters in the device tree node.
Moreover, upcoming platforms will use the generic device tree clocks
properties instead.
Removed cell-index property as well since there will always be one
instance of TSPP.

Change-Id: I504dfe8c8db87ee993411b068acf5b08ced34600
Signed-off-by: default avatarGilad Broner <gbroner@codeaurora.org>
parent 727d84fa
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -8,17 +8,12 @@ The devicetree representation of the TSPP block should be:
Required properties:

- compatible: "qcom,msm_tspp"
- cell-index: <0> - represents device ID.
- reg: physical memory base addresses and sizes for the following:
	TSIF0, TSIF1, TSPP and TSPP_BAM.
- reg-names: names of the memory regions.
- interrupts: represents IRQ numbers for the following:
	TSIF_TSPP_IRQ, TSIF0_IRQ, TSIF1_IRQ, TSIF_BAM_IRQ.
- interrupt-names: TSPP, TSIF and BAM interrupt names.
- qcom,tsif-pclk: interface clock name.
- qcom,tsif-ref-clk: reference clock name.
	The driver uses clk_get to get the clocks by name. The clocks
	should be defined in the relevant clock file (e.g. clock-8974.c).
- pinctrl-names: the names of the pinctrl states that are used by the driver to
	configure the TLMM pins. The allowed states are:
	disabled - both tsif inputs are not used
@@ -53,7 +48,6 @@ Example (for 8974 platform, avaialble at msm8974.dtsi):

	tspp: msm_tspp@f99d8000 {
		compatible = "qcom,msm_tspp";
		cell-index = <0>;
		reg = <0xf99d8000 0x1000>, /* MSM_TSIF0_PHYS */
		      <0xf99d9000 0x1000>, /* MSM_TSIF1_PHYS */
		      <0xf99da000 0x1000>, /* MSM_TSPP_PHYS  */
@@ -70,8 +64,6 @@ Example (for 8974 platform, avaialble at msm8974.dtsi):
			"TSIF0_IRQ",
			"TSIF1_IRQ",
			"TSIF_BAM_IRQ";
		qcom,tsif-pclk = "iface_clk";
		qcom,tsif-ref-clk = "ref_clk";

		pinctrl-names = "disabled",
			"tsif0-mode1", "tsif0-mode2",
@@ -99,5 +91,3 @@ Example (for 8974 platform, avaialble at msm8974.dtsi):
				<82 512 0 0>, /* No vote */
				<82 512 12288 24576>; /* Max. bandwidth, 2xTSIF, each max of 96Mbps */
	};

+0 −3
Original line number Diff line number Diff line
@@ -684,7 +684,6 @@

	tspp: msm_tspp@f99d8000 {
		compatible = "qcom,msm_tspp";
		cell-index = <0>;
		reg = <0xf99d8000 0x1000>, /* MSM_TSIF0_PHYS */
		      <0xf99d9000 0x1000>, /* MSM_TSIF1_PHYS */
		      <0xf99da000 0x1000>, /* MSM_TSPP_PHYS  */
@@ -701,8 +700,6 @@
			"TSIF0_IRQ",
			"TSIF1_IRQ",
			"TSIF_BAM_IRQ";
		qcom,tsif-pclk = "iface_clk";
		qcom,tsif-ref-clk = "ref_clk";

		qcom,msm-bus,name = "tsif";
		qcom,msm-bus,num-cases = <2>;
+0 −3
Original line number Diff line number Diff line
@@ -556,7 +556,6 @@

	tspp: msm_tspp@f99d8000 {
		compatible = "qcom,msm_tspp";
		cell-index = <0>;
		reg = <0xf99d8000 0x1000>, /* MSM_TSIF0_PHYS */
		      <0xf99d9000 0x1000>, /* MSM_TSIF1_PHYS */
		      <0xf99da000 0x1000>, /* MSM_TSPP_PHYS  */
@@ -573,8 +572,6 @@
			"TSIF0_IRQ",
			"TSIF1_IRQ",
			"TSIF_BAM_IRQ";
		qcom,tsif-pclk = "iface_clk";
		qcom,tsif-ref-clk = "ref_clk";

		qcom,msm-bus,name = "tsif";
		qcom,msm-bus,num-cases = <2>;
+4 −2
Original line number Diff line number Diff line
@@ -1052,8 +1052,10 @@
			"TSIF0_IRQ",
			"TSIF1_IRQ",
			"TSIF_BAM_IRQ";
		qcom,tsif-pclk = "iface_clk";
		qcom,tsif-ref-clk = "ref_clk";

		clock-names = "iface_clk", "ref_clk";
		clocks = <&clock_gcc clk_gcc_tsif_ahb_clk>,
			<&clock_gcc clk_gcc_tsif_ref_clk>;

		qcom,msm-bus,name = "tsif";
		qcom,msm-bus,num-cases = <2>;
+32 −90
Original line number Diff line number Diff line
@@ -2649,43 +2649,6 @@ static void tspp_debugfs_exit(struct tspp_device *device)
	}
}

/* copy device-tree data to platfrom data struct */
static struct msm_tspp_platform_data *
msm_tspp_dt_to_pdata(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node;
	struct msm_tspp_platform_data *data;
	struct property *prop;
	int rc;

	/* Note: memory allocated by devm_kzalloc is freed automatically */
	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
	if (!data) {
		pr_err("tspp: Unable to allocate platform data\n");
		return NULL;
	}
	rc = of_property_read_string(node, "qcom,tsif-pclk", &data->tsif_pclk);
	if (rc) {
		pr_err("tspp: Could not find tsif-pclk property, err = %d\n",
			rc);
		return NULL;
	}
	rc = of_property_read_string(node, "qcom,tsif-ref-clk",
			&data->tsif_ref_clk);
	if (rc) {
		pr_err("tspp: Could not find tsif-ref-clk property, err = %d\n",
			rc);
		return NULL;
	}

	data->tsif_vreg_present = 0;
	prop = of_find_property(node, "vdd_cx-supply", NULL);
	if (prop)
		data->tsif_vreg_present = 1;

	return data;
}

static int msm_tspp_map_irqs(struct platform_device *pdev,
				struct tspp_device *device)
{
@@ -2736,7 +2699,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
	int rc = -ENODEV;
	u32 version;
	u32 i;
	struct msm_tspp_platform_data *data;
	struct tspp_device *device;
	struct resource *mem_tsif0;
	struct resource *mem_tsif1;
@@ -2746,16 +2708,8 @@ static int msm_tspp_probe(struct platform_device *pdev)
	unsigned long rate;

	if (pdev->dev.of_node) {
		/* get information from device tree */
		data = msm_tspp_dt_to_pdata(pdev);
		/* get device ID */
		rc = of_property_read_u32(pdev->dev.of_node,
					"cell-index", &pdev->id);
		if (rc)
			pdev->id = -1;

		pdev->dev.platform_data = data;

		/* ID is always 0 since there is only 1 instance of TSPP */
		pdev->id = 0;
		tspp_bus_pdata = msm_bus_cl_get_pdata(pdev);
	} else {
		/* must have device tree data */
@@ -2763,18 +2717,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
		rc = -EINVAL;
		goto out;
	}
	if (!data) {
		pr_err("tspp: Platform data not available\n");
		rc = -EINVAL;
		goto out;
	}

	/* check for valid device id */
	if ((pdev->id < 0) || (pdev->id >= TSPP_MAX_DEVICES)) {
		pr_err("tspp: Invalid device ID %d\n", pdev->id);
		rc = -EINVAL;
		goto out;
	}

	/* OK, we will use this device */
	device = kzalloc(sizeof(struct tspp_device), GFP_KERNEL);
@@ -2806,41 +2748,44 @@ static int msm_tspp_probe(struct platform_device *pdev)
	}

	/* map regulators */
	if (data->tsif_vreg_present) {
	device->tsif_vreg = devm_regulator_get(&pdev->dev, "vdd_cx");
	if (IS_ERR(device->tsif_vreg)) {
		rc = PTR_ERR(device->tsif_vreg);
		device->tsif_vreg = NULL;
			goto err_regultaor;
		if (rc == -ENODEV) {
			pr_notice("%s: vdd_cx regulator will not be used\n",
				__func__);
		} else {
			dev_err(&pdev->dev,
				"failed to get CX regulator, err=%d\n", rc);
			goto err_regulator;
		}

	} else {
		/* Set an initial voltage and enable the regulator */
		rc = regulator_set_voltage(device->tsif_vreg,
					RPM_REGULATOR_CORNER_NONE,
					RPM_REGULATOR_CORNER_SUPER_TURBO);
		if (rc) {
			dev_err(&pdev->dev, "Unable to set CX voltage.\n");
			goto err_regultaor;
			goto err_regulator;
		}

		rc = regulator_enable(device->tsif_vreg);
		if (rc) {
			dev_err(&pdev->dev, "Unable to enable CX regulator.\n");
			goto err_regultaor;
			goto err_regulator;
		}
	}

	/* map clocks */
	if (data->tsif_pclk) {
		device->tsif_pclk = clk_get(&pdev->dev, data->tsif_pclk);
	device->tsif_pclk = clk_get(&pdev->dev, "iface_clk");
	if (IS_ERR(device->tsif_pclk)) {
		rc = PTR_ERR(device->tsif_pclk);
		device->tsif_pclk = NULL;
		goto err_pclock;
	}
	}
	if (data->tsif_ref_clk) {
		device->tsif_ref_clk = clk_get(&pdev->dev, data->tsif_ref_clk);

	device->tsif_ref_clk = clk_get(&pdev->dev, "ref_clk");
	if (IS_ERR(device->tsif_ref_clk)) {
		rc = PTR_ERR(device->tsif_ref_clk);
		device->tsif_ref_clk = NULL;
@@ -2850,7 +2795,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
	rc = clk_set_rate(device->tsif_ref_clk, rate);
	if (rc)
		goto err_res_tsif0;
	}

	/* map I/O memory */
	mem_tsif0 = platform_get_resource_byname(pdev,
@@ -2917,7 +2861,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
	/* power management */
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);

	tspp_debugfs_init(device, 0);

	for (i = 0; i < TSPP_TSIF_INSTANCES; i++)
@@ -2974,7 +2917,6 @@ static int msm_tspp_probe(struct platform_device *pdev)

	/* everything is ok, so add the device to the list */
	list_add_tail(&(device->devlist), &tspp_devices);

	return 0;

err_clock:
@@ -3002,7 +2944,7 @@ err_refclock:
err_pclock:
	if (device->tsif_vreg)
		regulator_disable(device->tsif_vreg);
err_regultaor:
err_regulator:
	if (device->tsif_bus_client)
		msm_bus_scale_unregister_client(device->tsif_bus_client);
err_pinctrl:
Loading