]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
soc: ti: pruss: Parse various syscon nodes and store their regmaps
authorSuman Anna <s-anna@ti.com>
Tue, 19 Feb 2019 21:24:40 +0000 (15:24 -0600)
committerSuman Anna <s-anna@ti.com>
Sat, 23 Feb 2019 17:15:12 +0000 (11:15 -0600)
The PRUSS device node currently uses three different syscon nodes for
CFG, IEP and MII_RT sub-modules. Parse these syscon nodes and store
their regmap handles to allow adding functions to program any register
within these sub-modules.

The MFD_SYSCON Kconfig option is also enabled whenever the PRUSS remoteproc
driver is enabled. The MFD_SYSCON is a boolean option, and the select
dependency option is chosen following the majority usage style within the
kernel, as well as to align with similar usage in couple of other
remoteproc drivers.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
drivers/soc/ti/Kconfig
drivers/soc/ti/pruss.c
include/linux/pruss_driver.h

index ae6c64d76233d60d9b4def431a634650ec55438e..35f38272f8b0c07e07bc03d97c4b7db5e5b4ae54 100644 (file)
@@ -87,6 +87,7 @@ config TI_SCI_PM_DOMAINS
 config TI_PRUSS
        tristate "TI PRU-ICSS Subsystem Platform drivers"
        depends on SOC_AM33XX
+       select MFD_SYSCON
        help
          TI PRU-ICSS Subsystem platform specific support.
 
index 2f4f47f806004a4b6a61b6a7e1873b473ba0206f..9242458f9fd1bfd53b80ad94308eb093a00d6ac4 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
@@ -41,6 +42,39 @@ static int pruss_probe(struct platform_device *pdev)
 
        pruss->dev = dev;
 
+       np = of_get_child_by_name(node, "cfg");
+       if (!np) {
+               dev_err(dev, "%pOF is missing cfg node\n", np);
+               return -ENODEV;
+       }
+
+       pruss->cfg = syscon_node_to_regmap(np);
+       of_node_put(np);
+       if (IS_ERR(pruss->cfg))
+               return -ENODEV;
+
+       np = of_get_child_by_name(node, "iep");
+       if (!np) {
+               dev_err(dev, "%pOF is missing iep node\n", np);
+               return -ENODEV;
+       }
+
+       pruss->iep = syscon_node_to_regmap(np);
+       of_node_put(np);
+       if (IS_ERR(pruss->iep))
+               return -ENODEV;
+
+       np = of_get_child_by_name(node, "mii-rt");
+       if (!np) {
+               dev_err(dev, "%pOF is missing mii-rt node\n", np);
+               return -ENODEV;
+       }
+
+       pruss->mii_rt = syscon_node_to_regmap(np);
+       of_node_put(np);
+       if (IS_ERR(pruss->mii_rt))
+               return -ENODEV;
+
        np = of_get_child_by_name(node, "memories");
        if (!np) {
                dev_err(dev, "%pOF is missing memories node\n", np);
index a381c3aa331ebba8bd00bc73e155c668c043dee4..874c61be8a0739aa3b1618d99784fb05228e33f1 100644 (file)
@@ -34,10 +34,16 @@ struct pruss_mem_region {
 /**
  * struct pruss - PRUSS parent structure
  * @dev: pruss device pointer
+ * @cfg: regmap for config region
+ * @iep: regmap for IEP sub-module
+ * @mii_rt: regmap for MII_RT sub-module
  * @mem_regions: data for each of the PRUSS memory regions
  */
 struct pruss {
        struct device *dev;
+       struct regmap *cfg;
+       struct regmap *iep;
+       struct regmap *mii_rt;
        struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
 };