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

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

Merge "msm: tspp: remove msm_tspp_platform_data structure"

parents 2a3e6155 b513051a
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -8,17 +8,12 @@ The devicetree representation of the TSPP block should be:
Required properties:
Required properties:


- compatible: "qcom,msm_tspp"
- compatible: "qcom,msm_tspp"
- cell-index: <0> - represents device ID.
- reg: physical memory base addresses and sizes for the following:
- reg: physical memory base addresses and sizes for the following:
	TSIF0, TSIF1, TSPP and TSPP_BAM.
	TSIF0, TSIF1, TSPP and TSPP_BAM.
- reg-names: names of the memory regions.
- reg-names: names of the memory regions.
- interrupts: represents IRQ numbers for the following:
- interrupts: represents IRQ numbers for the following:
	TSIF_TSPP_IRQ, TSIF0_IRQ, TSIF1_IRQ, TSIF_BAM_IRQ.
	TSIF_TSPP_IRQ, TSIF0_IRQ, TSIF1_IRQ, TSIF_BAM_IRQ.
- interrupt-names: TSPP, TSIF and BAM interrupt names.
- 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
- pinctrl-names: the names of the pinctrl states that are used by the driver to
	configure the TLMM pins. The allowed states are:
	configure the TLMM pins. The allowed states are:
	disabled - both tsif inputs are not used
	disabled - both tsif inputs are not used
@@ -53,7 +48,6 @@ Example (for 8974 platform, avaialble at msm8974.dtsi):


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


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

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


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


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


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


		qcom,msm-bus,name = "tsif";
		qcom,msm-bus,name = "tsif";
		qcom,msm-bus,num-cases = <2>;
		qcom,msm-bus,num-cases = <2>;
+4 −2
Original line number Original line Diff line number Diff line
@@ -1052,8 +1052,10 @@
			"TSIF0_IRQ",
			"TSIF0_IRQ",
			"TSIF1_IRQ",
			"TSIF1_IRQ",
			"TSIF_BAM_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,name = "tsif";
		qcom,msm-bus,num-cases = <2>;
		qcom,msm-bus,num-cases = <2>;
+32 −90
Original line number Original line 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,
static int msm_tspp_map_irqs(struct platform_device *pdev,
				struct tspp_device *device)
				struct tspp_device *device)
{
{
@@ -2736,7 +2699,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
	int rc = -ENODEV;
	int rc = -ENODEV;
	u32 version;
	u32 version;
	u32 i;
	u32 i;
	struct msm_tspp_platform_data *data;
	struct tspp_device *device;
	struct tspp_device *device;
	struct resource *mem_tsif0;
	struct resource *mem_tsif0;
	struct resource *mem_tsif1;
	struct resource *mem_tsif1;
@@ -2746,16 +2708,8 @@ static int msm_tspp_probe(struct platform_device *pdev)
	unsigned long rate;
	unsigned long rate;


	if (pdev->dev.of_node) {
	if (pdev->dev.of_node) {
		/* get information from device tree */
		/* ID is always 0 since there is only 1 instance of TSPP */
		data = msm_tspp_dt_to_pdata(pdev);
		pdev->id = 0;
		/* 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;

		tspp_bus_pdata = msm_bus_cl_get_pdata(pdev);
		tspp_bus_pdata = msm_bus_cl_get_pdata(pdev);
	} else {
	} else {
		/* must have device tree data */
		/* must have device tree data */
@@ -2763,18 +2717,6 @@ static int msm_tspp_probe(struct platform_device *pdev)
		rc = -EINVAL;
		rc = -EINVAL;
		goto out;
		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 */
	/* OK, we will use this device */
	device = kzalloc(sizeof(struct tspp_device), GFP_KERNEL);
	device = kzalloc(sizeof(struct tspp_device), GFP_KERNEL);
@@ -2806,41 +2748,44 @@ static int msm_tspp_probe(struct platform_device *pdev)
	}
	}


	/* map regulators */
	/* map regulators */
	if (data->tsif_vreg_present) {
	device->tsif_vreg = devm_regulator_get(&pdev->dev, "vdd_cx");
	device->tsif_vreg = devm_regulator_get(&pdev->dev, "vdd_cx");
	if (IS_ERR(device->tsif_vreg)) {
	if (IS_ERR(device->tsif_vreg)) {
		rc = PTR_ERR(device->tsif_vreg);
		rc = PTR_ERR(device->tsif_vreg);
		device->tsif_vreg = NULL;
		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 */
		/* Set an initial voltage and enable the regulator */
		rc = regulator_set_voltage(device->tsif_vreg,
		rc = regulator_set_voltage(device->tsif_vreg,
					RPM_REGULATOR_CORNER_NONE,
					RPM_REGULATOR_CORNER_NONE,
					RPM_REGULATOR_CORNER_SUPER_TURBO);
					RPM_REGULATOR_CORNER_SUPER_TURBO);
		if (rc) {
		if (rc) {
			dev_err(&pdev->dev, "Unable to set CX voltage.\n");
			dev_err(&pdev->dev, "Unable to set CX voltage.\n");
			goto err_regultaor;
			goto err_regulator;
		}
		}


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


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

	if (data->tsif_ref_clk) {
	device->tsif_ref_clk = clk_get(&pdev->dev, "ref_clk");
		device->tsif_ref_clk = clk_get(&pdev->dev, data->tsif_ref_clk);
	if (IS_ERR(device->tsif_ref_clk)) {
	if (IS_ERR(device->tsif_ref_clk)) {
		rc = PTR_ERR(device->tsif_ref_clk);
		rc = PTR_ERR(device->tsif_ref_clk);
		device->tsif_ref_clk = NULL;
		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);
	rc = clk_set_rate(device->tsif_ref_clk, rate);
	if (rc)
	if (rc)
		goto err_res_tsif0;
		goto err_res_tsif0;
	}


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

	tspp_debugfs_init(device, 0);
	tspp_debugfs_init(device, 0);


	for (i = 0; i < TSPP_TSIF_INSTANCES; i++)
	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 */
	/* everything is ok, so add the device to the list */
	list_add_tail(&(device->devlist), &tspp_devices);
	list_add_tail(&(device->devlist), &tspp_devices);

	return 0;
	return 0;


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