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

Commit 37e5cdce authored by Kiran Gunda's avatar Kiran Gunda
Browse files

spmi: pmic-arb: Reserve a channel for debug port



Do not keep the channel reserved for debug port in the
ppid to apid mapping table. This is to avoid accessing
that particular channel during the read/write/irq operations.

Change-Id: I8f49d1d87978a5b68ea711d3e30606d72fd09f73
Signed-off-by: default avatarKiran Gunda <kgunda@codeaurora.org>
parent 27489753
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ Required properties:
    cell 4: interrupt flags indicating level-sense information, as defined in
            dt-bindings/interrupt-controller/irq.h

Optional properties:
- qcom,reserved-chan : Reserved channel for debug purpose

Example V1 PMIC-Arbiter:

	spmi {
@@ -56,6 +59,7 @@ Example V1 PMIC-Arbiter:

		qcom,ee = <0>;
		qcom,channel = <0>;
		qcom,reserved-chan = <511>;

		#address-cells = <2>;
		#size-cells = <0>;
+13 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ struct spmi_pmic_arb {
	u16			max_apid;
	u16			max_periph;
	u32			*mapping_table;
	int			reserved_chan;
	DECLARE_BITMAP(mapping_table_valid, PMIC_ARB_MAX_PERIPHS);
	struct irq_domain	*domain;
	struct spmi_controller	*spmic;
@@ -861,6 +862,10 @@ static u16 pmic_arb_find_apid(struct spmi_pmic_arb *pa, u16 ppid)
	 * ppid_to_apid is an in-memory invert of that table.
	 */
	for (apid = pa->last_apid; apid < pa->max_periph; apid++) {
		/* Do not keep the reserved channel in the mapping table */
		if (pa->reserved_chan >= 0 && apid == pa->reserved_chan)
			continue;

		regval = readl_relaxed(pa->cnfg +
				      SPMI_OWNERSHIP_TABLE_REG(apid));
		pa->apid_data[apid].irq_owner
@@ -920,6 +925,10 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pa)
	 * receive interrupts from the PPID.
	 */
	for (apid = 0; apid < pa->max_periph; apid++) {
		/* Do not keep the reserved channel in the mapping table */
		if (pa->reserved_chan >= 0 && apid == pa->reserved_chan)
			continue;

		offset = pa->ver_ops->channel_map_offset(apid);
		if (offset >= pa->core_size)
			break;
@@ -1340,6 +1349,10 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)

	pa->ee = ee;

	pa->reserved_chan = -EINVAL;
	of_property_read_u32(pdev->dev.of_node, "qcom,reserved-chan",
						&pa->reserved_chan);

	pa->mapping_table = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PERIPHS - 1,
					sizeof(*pa->mapping_table), GFP_KERNEL);
	if (!pa->mapping_table) {