Skip to content

Commit

Permalink
Merge tag 'rproc-v4.9' of git://github.com/andersson/remoteproc
Browse files Browse the repository at this point in the history
Pull remoteproc updates from Bjorn Andersson:
 "In addition to a slew of minor fixes and cleanups these patches
  refactor how we deal with remoteprocs that will be auto-booting
  themselves.

  That does clean up the remote resource handling but makes for
  additional work to clarify responsibilities and life cycles of
  resources. We also revise how module locking of remoteproc drivers
  work, so that they are locked as we hand out references to them to
  third parties, rather than only when booted by anyone.

  In addition to that we also introduce the Qualcomm Wireless Subsystem
  remoteproc driver"

* tag 'rproc-v4.9' of git://github.com/andersson/remoteproc: (26 commits)
  remoteproc: Refactor rproc module locking
  remoteproc: Split driver and consumer dereferencing
  remoteproc: Correct resource handling upon boot failure
  remoteproc: Drop unnecessary NULL check
  remoteproc: core: transform struct fw_rsc_vdev_vring reserved field in pa
  remoteproc: Modify FW_RSC_ADDR_ANY definition
  remoteproc: qcom: wcnss: Fix return value check in wcnss_probe()
  remoteproc: qcom: Introduce WCNSS peripheral image loader
  dt-binding: remoteproc: Introduce Qualcomm WCNSS loader binding
  remoteproc: Only update table_ptr if we have a loaded table
  remoteproc: Move handling of cached table to boot/shutdown
  remoteproc: Move vdev handling to boot/shutdown
  remoteproc: Calculate max_notifyid during load
  remoteproc: Introduce auto-boot flag
  remoteproc/omap: revise a minor error trace message
  remoteproc/omap: fix various code formatting issues
  remoteproc: print hex numbers with a leading 0x format
  remoteproc: align code with open parenthesis
  remoteproc: fix bare unsigned type usage
  remoteproc: use variable names for sizeof() operator
  ...
  • Loading branch information
Linus Torvalds committed Oct 7, 2016
2 parents 4c1fad6 + fbb6aac commit d880e5a
Show file tree
Hide file tree
Showing 20 changed files with 1,168 additions and 205 deletions.
132 changes: 132 additions & 0 deletions Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Qualcomm WCNSS Peripheral Image Loader

This document defines the binding for a component that loads and boots firmware
on the Qualcomm WCNSS core.

- compatible:
Usage: required
Value type: <string>
Definition: must be one of:
"qcom,riva-pil",
"qcom,pronto-v1-pil",
"qcom,pronto-v2-pil"

- reg:
Usage: required
Value type: <prop-encoded-array>
Definition: must specify the base address and size of the CCU, DXE and
PMU register blocks

- reg-names:
Usage: required
Value type: <stringlist>
Definition: must be "ccu", "dxe", "pmu"

- interrupts-extended:
Usage: required
Value type: <prop-encoded-array>
Definition: must list the watchdog and fatal IRQs and may specify the
ready, handover and stop-ack IRQs

- interrupt-names:
Usage: required
Value type: <stringlist>
Definition: should be "wdog", "fatal", optionally followed by "ready",
"handover", "stop-ack"

- vddmx-supply:
- vddcx-supply:
- vddpx-supply:
Usage: required
Value type: <phandle>
Definition: reference to the regulators to be held on behalf of the
booting of the WCNSS core

- qcom,smem-states:
Usage: optional
Value type: <prop-encoded-array>
Definition: reference to the SMEM state used to indicate to WCNSS that
it should shut down

- qcom,smem-state-names:
Usage: optional
Value type: <stringlist>
Definition: should be "stop"

- memory-region:
Usage: required
Value type: <prop-encoded-array>
Definition: reference to reserved-memory node for the remote processor
see ../reserved-memory/reserved-memory.txt

= SUBNODES
A single subnode of the WCNSS PIL describes the attached rf module and its
resource dependencies.

- compatible:
Usage: required
Value type: <string>
Definition: must be one of:
"qcom,wcn3620",
"qcom,wcn3660",
"qcom,wcn3680"

- clocks:
Usage: required
Value type: <prop-encoded-array>
Definition: should specify the xo clock and optionally the rf clock

- clock-names:
Usage: required
Value type: <stringlist>
Definition: should be "xo", optionally followed by "rf"

- vddxo-supply:
- vddrfa-supply:
- vddpa-supply:
- vdddig-supply:
Usage: required
Value type: <phandle>
Definition: reference to the regulators to be held on behalf of the
booting of the WCNSS core

= EXAMPLE
The following example describes the resources needed to boot control the WCNSS,
with attached WCN3680, as it is commonly found on MSM8974 boards.

pronto@fb204000 {
compatible = "qcom,pronto-v2-pil";
reg = <0xfb204000 0x2000>, <0xfb202000 0x1000>, <0xfb21b000 0x3000>;
reg-names = "ccu", "dxe", "pmu";

interrupts-extended = <&intc 0 149 1>,
<&wcnss_smp2p_slave 0 0>,
<&wcnss_smp2p_slave 1 0>,
<&wcnss_smp2p_slave 2 0>,
<&wcnss_smp2p_slave 3 0>;
interrupt-names = "wdog", "fatal", "ready", "handover", "stop-ack";

vddmx-supply = <&pm8841_s1>;
vddcx-supply = <&pm8841_s2>;
vddpx-supply = <&pm8941_s3>;

qcom,smem-states = <&wcnss_smp2p_out 0>;
qcom,smem-state-names = "stop";

memory-region = <&wcnss_region>;

pinctrl-names = "default";
pinctrl-0 = <&wcnss_pin_a>;

iris {
compatible = "qcom,wcn3680";

clocks = <&rpmcc RPM_CXO_CLK_SRC>, <&rpmcc RPM_CXO_A2>;
clock-names = "xo", "rf";

vddxo-supply = <&pm8941_l6>;
vddrfa-supply = <&pm8941_l11>;
vddpa-supply = <&pm8941_l19>;
vdddig-supply = <&pm8941_s3>;
};
};
6 changes: 3 additions & 3 deletions Documentation/remoteproc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ int dummy_rproc_example(struct rproc *my_rproc)
On success, the new rproc is returned, and on failure, NULL.

Note: _never_ directly deallocate @rproc, even if it was not registered
yet. Instead, when you need to unroll rproc_alloc(), use rproc_put().
yet. Instead, when you need to unroll rproc_alloc(), use rproc_free().

void rproc_put(struct rproc *rproc)
void rproc_free(struct rproc *rproc)
- Free an rproc handle that was allocated by rproc_alloc.
This function essentially unrolls rproc_alloc(), by decrementing the
rproc's refcount. It doesn't directly free rproc; that would happen
Expand Down Expand Up @@ -131,7 +131,7 @@ int dummy_rproc_example(struct rproc *my_rproc)
has completed successfully.

After rproc_del() returns, @rproc is still valid, and its
last refcount should be decremented by calling rproc_put().
last refcount should be decremented by calling rproc_free().

Returns 0 on success and -EINVAL if @rproc isn't valid.

Expand Down
16 changes: 16 additions & 0 deletions drivers/remoteproc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ config QCOM_Q6V5_PIL
Say y here to support the Qualcomm Peripherial Image Loader for the
Hexagon V5 based remote processors.

config QCOM_WCNSS_IRIS
tristate
depends on OF && ARCH_QCOM

config QCOM_WCNSS_PIL
tristate "Qualcomm WCNSS Peripheral Image Loader"
depends on OF && ARCH_QCOM
depends on QCOM_SMEM
select QCOM_MDT_LOADER
select QCOM_SCM
select QCOM_WCNSS_IRIS
select REMOTEPROC
help
Say y here to support the Peripheral Image Loader for the Qualcomm
Wireless Connectivity Subsystem.

config ST_REMOTEPROC
tristate "ST remoteproc support"
depends on ARCH_STI
Expand Down
2 changes: 2 additions & 0 deletions drivers/remoteproc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o
obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
obj-$(CONFIG_QCOM_MDT_LOADER) += qcom_mdt_loader.o
obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o
obj-$(CONFIG_QCOM_WCNSS_IRIS) += qcom_wcnss_iris.o
obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss.o
obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
6 changes: 3 additions & 3 deletions drivers/remoteproc/da8xx_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void da8xx_rproc_kick(struct rproc *rproc, int vqid)
{
struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv;

/* Interupt remote proc */
/* Interrupt remote proc */
writel(SYSCFG_CHIPSIG2, drproc->chipsig);
}

Expand Down Expand Up @@ -261,7 +261,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
return 0;

free_rproc:
rproc_put(rproc);
rproc_free(rproc);

return ret;
}
Expand Down Expand Up @@ -290,7 +290,7 @@ static int da8xx_rproc_remove(struct platform_device *pdev)
disable_irq(drproc->irq);

rproc_del(rproc);
rproc_put(rproc);
rproc_free(rproc);

return 0;
}
Expand Down
9 changes: 5 additions & 4 deletions drivers/remoteproc/omap_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static void omap_rproc_kick(struct rproc *rproc, int vqid)
/* send the index of the triggered virtqueue in the mailbox payload */
ret = mbox_send_message(oproc->mbox, (void *)vqid);
if (ret < 0)
dev_err(dev, "omap_mbox_msg_send failed: %d\n", ret);
dev_err(dev, "failed to send mailbox message, status = %d\n",
ret);
}

/*
Expand Down Expand Up @@ -196,7 +197,7 @@ static int omap_rproc_probe(struct platform_device *pdev)
}

rproc = rproc_alloc(&pdev->dev, pdata->name, &omap_rproc_ops,
pdata->firmware, sizeof(*oproc));
pdata->firmware, sizeof(*oproc));
if (!rproc)
return -ENOMEM;

Expand All @@ -214,7 +215,7 @@ static int omap_rproc_probe(struct platform_device *pdev)
return 0;

free_rproc:
rproc_put(rproc);
rproc_free(rproc);
return ret;
}

Expand All @@ -223,7 +224,7 @@ static int omap_rproc_remove(struct platform_device *pdev)
struct rproc *rproc = platform_get_drvdata(pdev);

rproc_del(rproc);
rproc_put(rproc);
rproc_free(rproc);

return 0;
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/remoteproc/qcom_q6v5_pil.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,10 @@ static int q6v5_probe(struct platform_device *pdev)
goto free_rproc;

qproc->state = qcom_smem_state_get(&pdev->dev, "stop", &qproc->stop_bit);
if (IS_ERR(qproc->state))
if (IS_ERR(qproc->state)) {
ret = PTR_ERR(qproc->state);
goto free_rproc;
}

ret = rproc_add(rproc);
if (ret)
Expand All @@ -873,7 +875,7 @@ static int q6v5_probe(struct platform_device *pdev)
return 0;

free_rproc:
rproc_put(rproc);
rproc_free(rproc);

return ret;
}
Expand All @@ -883,7 +885,7 @@ static int q6v5_remove(struct platform_device *pdev)
struct q6v5 *qproc = platform_get_drvdata(pdev);

rproc_del(qproc->rproc);
rproc_put(qproc->rproc);
rproc_free(qproc->rproc);

return 0;
}
Expand Down
Loading

0 comments on commit d880e5a

Please sign in to comment.