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

This commit is contained in:
Linux Build Service Account 2017-04-18 06:29:42 -07:00 committed by Gerrit - the friendly Code Review server
commit 0fe2dba74c
2 changed files with 17 additions and 0 deletions

View file

@ -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>;

View file

@ -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) {