linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Add TI PRUSS platform driver
@ 2020-07-29 11:02 Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings Grzegorz Jaszczyk
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, linux-omap, lee.jones, wmills,
	linux-arm-kernel

Hi,

The Programmable Real-Time Unit and Industrial Communication Subsystem
(PRU-ICSS) is present on various TI SoCs. The IP is present on multiple TI SoC
architecture families including the OMAP architecture SoCs such as AM33xx,
AM437x and AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is also
present on the Davinci based OMAPL138 SoCs and K3 architecture based AM65x and
J721E SoCs as well.

A PRUSS consists of dual 32-bit RISC cores (Programmable Real-Time Units, or
PRUs), shared RAM, data and instruction RAMs, some internal peripheral modules
to facilitate industrial communication, and an interrupt controller.

The programmable nature of the PRUs provide flexibility to implement custom
peripheral interfaces, fast real-time responses, or specialized data handling.
The common peripheral modules include the following,
  - an Ethernet MII_RT module with two MII ports
  - an MDIO port to control external Ethernet PHYs
  - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
    Ethernet functions
  - an Enhanced Capture Module (eCAP)
  - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
  - a 16550-compatible UART to support PROFIBUS
  - Enhanced GPIO with async capture and serial support


A typical usage scenario would be to load the application firmware into one or
more of the PRU cores, initialize one or more of the peripherals and perform I/O
through shared RAM from either a kernel driver or directly from userspace.

This series contains the PRUSS platform driver. This is the parent driver for
the entire PRUSS and is used for managing the subsystem level resources like
various memories and the CFG module.  It is responsible for the creation and
deletion of the platform devices for the child PRU devices and other child
devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
they can be managed by specific platform drivers.

Grzegorz Jaszczyk (1):
  dt-bindings: soc: ti: Add TI PRUSS bindings

Suman Anna (5):
  soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs
  soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs
  soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs
  soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC
  soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs

 .../devicetree/bindings/soc/ti/ti,pruss.yaml       | 383 +++++++++++++++++++++
 drivers/soc/ti/Kconfig                             |  11 +
 drivers/soc/ti/Makefile                            |   1 +
 drivers/soc/ti/pruss.c                             | 183 ++++++++++
 include/linux/pruss_driver.h                       |  48 +++
 5 files changed, 626 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
 create mode 100644 drivers/soc/ti/pruss.c
 create mode 100644 include/linux/pruss_driver.h

-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-08-17 21:14   ` Rob Herring
  2020-07-29 11:02 ` [PATCH 2/6] soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs Grzegorz Jaszczyk
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, linux-omap, lee.jones, wmills,
	linux-arm-kernel, Roger Quadros

This patch adds the bindings for the Programmable Real-Time Unit
and Industrial Communication Subsystem (PRU-ICSS) present on various
TI SoCs. The IP is present on multiple TI SoC architecture families
including the OMAP architecture SoCs such as AM33xx, AM437x and
AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is
also present on the Davinci based OMAPL138 SoCs and K3 architecture
based AM65x and J721E SoCs as well.

The IP has a number of sub-modules some of which are represented as
their own devices. This binding covers only the top-level sub-system
devices, and some sub-modules like MDIO, MII_RT (Ethernet MII_RT module
with MII ports) and IEP (Industrial Ethernet Peripheral). The remaining
sub-modules bindings shall be defined in the respective driver
subsystem bindings folders. Couple of full examples have also been
added demonstrating the devices on AM335x and AM437x SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Reviewed-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/soc/ti/ti,pruss.yaml       | 383 +++++++++++++++++++++
 1 file changed, 383 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml

diff --git a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
new file mode 100644
index 0000000..4b7a098
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
@@ -0,0 +1,383 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/ti/ti,pruss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: |+
+  TI Programmable Real-Time Unit and Industrial Communication Subsystem
+
+maintainers:
+  - Suman Anna <s-anna@ti.com>
+
+description: |+
+
+  The Programmable Real-Time Unit and Industrial Communication Subsystem
+  (PRU-ICSS a.k.a. PRUSS) is present on various TI SoCs such as AM335x, AM437x,
+  Keystone 66AK2G, OMAP-L138/DA850 etc. A PRUSS consists of dual 32-bit RISC
+  cores (Programmable Real-Time Units, or PRUs), shared RAM, data and
+  instruction RAMs, some internal peripheral modules to facilitate industrial
+  communication, and an interrupt controller.
+
+  The programmable nature of the PRUs provide flexibility to implement custom
+  peripheral interfaces, fast real-time responses, or specialized data handling.
+  The common peripheral modules include the following,
+    - an Ethernet MII_RT module with two MII ports
+    - an MDIO port to control external Ethernet PHYs
+    - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
+      Ethernet functions
+    - an Enhanced Capture Module (eCAP)
+    - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
+    - a 16550-compatible UART to support PROFIBUS
+    - Enhanced GPIO with async capture and serial support
+
+  A PRU-ICSS subsystem can have up to three shared data memories. A PRU core
+  acts on a primary Data RAM (there are usually 2 Data RAMs) at its address
+  0x0, but also has access to a secondary Data RAM (primary to the other PRU
+  core) at its address 0x2000. A shared Data RAM, if present, can be accessed
+  by both the PRU cores. The Interrupt Controller (INTC) and a CFG module are
+  common to both the PRU cores. Each PRU core also has a private instruction
+  RAM, and specific register spaces for Control and Debug functionalities.
+
+  Various sub-modules within a PRU-ICSS subsystem are represented as individual
+  nodes and are defined using a parent-child hierarchy depending on their
+  integration within the IP and the SoC. These nodes are described in the
+  following sections.
+
+
+  PRU-ICSS Node
+  ==============
+  Each PRU-ICSS instance is represented as its own node with the individual PRU
+  processor cores, the memories node, an INTC node and an MDIO node represented
+  as child nodes within this PRUSS node. This node shall be a child of the
+  corresponding interconnect bus nodes or target-module nodes.
+
+  See ../../mfd/syscon.yaml for generic SysCon binding details.
+
+
+properties:
+  compatible:
+    enum:
+      - ti,am3356-pruss  # for AM335x SoC family
+      - ti,am4376-pruss0 # for AM437x SoC family and PRUSS unit 0
+      - ti,am4376-pruss1 # for AM437x SoC family and PRUSS unit 1
+      - ti,am5728-pruss  # for AM57xx SoC family
+      - ti,k2g-pruss     # for 66AK2G SoC family
+      - ti,am654-icssg   # for K3 AM65x SoC family
+      - ti,j721e-icssg   # for K3 J721E SoC family
+
+  reg:
+    maxItems: 1
+
+  ranges:
+    maxItems: 1
+    description: |
+      Standard ranges definition using addresses from 0 for child nodes.
+
+  power-domains:
+    description: |
+      This property is as per sci-pm-domain.txt.
+
+  memories:
+    description: |
+      The various Data RAMs within a single PRU-ICSS unit are represented as a
+      single node with the name 'memories'.
+
+    type: object
+
+    properties:
+      reg:
+        minItems: 2 # On AM437x one of two PRUSS units don't contain Shared RAM.
+        maxItems: 3
+        items:
+          - description: Address and size of the Data RAM0.
+          - description: Address and size of the Data RAM1.
+          - description: |
+              Address and size of the Shared Data RAM. Note that on AM437x one
+              of two PRUSS units don't contain Shared RAM, while the second one
+              has it.
+
+      reg-names:
+        minItems: 2
+        maxItems: 3
+        items:
+          - const: dram0
+          - const: dram1
+          - const: shrdram2
+
+    required:
+      - reg
+      - reg-names
+
+  cfg:
+    description: |
+      PRU-ICSS configuration space. CFG sub-module represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-cfg
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
+  iep:
+    description: |
+      Industrial Ethernet Peripheral to manage/generate Industrial Ethernet
+      functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x,
+      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP
+      is used for creating PTP clocks and generating PPS signals. The bindings
+      for this shall be defined in ../../net/ti,icss-iep.yaml.
+
+    type: object
+
+  mii-rt:
+    description: |
+      Real-Time Ethernet to support multiple industrial communication protocols.
+      MII-RT sub-module represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-mii
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
+  mii-g-rt:
+    description: |
+      The Real-time Media Independent Interface to support multiple industrial
+      communication protocols (G stands for Gigabit). MII-G-RT sub-module
+      represented as a SysCon.
+
+    type: object
+
+    properties:
+      compatible:
+        items:
+          - const: ti,pruss-mii-g
+          - const: syscon
+
+      reg:
+        maxItems: 1
+
+  interrupt-controller:
+    description: |
+      PRUSS INTC Node. Each PRUSS has a single interrupt controller instance
+      that is common to all the PRU cores. This should be represented as an
+      interrupt-controller node. The bindings for this shall be defined in
+      ../../interrupt-controller/ti,pruss-intc.yaml.
+
+    type: object
+
+  mdio:
+    description: |
+      MDIO Node. Each PRUSS has an MDIO module that can be used to control
+      external PHYs. The MDIO module used within the PRU-ICSS is an instance of
+      the MDIO Controller used in TI Davinci SoCs.
+
+    allOf:
+      - $ref: /schemas/net/ti,davinci-mdio.yaml#
+
+    type: object
+
+patternProperties:
+  "^(pru|rtu|txpru)@[0-9a-f]+$":
+    description: |
+      PRU Node. Each PRUSS has dual PRU cores, each represented as a RemoteProc
+      device through a PRU child node each. Each node can optionally be rendered
+      inactive by using the standard DT string property, "status". The ICSSG IP
+      present on K3 SoCs have additional auxiliary PRU cores with slightly
+      different IP integration. The bindings for this shall be defined in
+      ../../remoteproc/ti,pru-rproc.yaml
+
+    type: object
+
+required:
+  - compatible
+  - reg
+  - ranges
+
+# Due to inability of correctly verifying sub-nodes with an @address through
+# the "required" list, the required sub-nodes below are commented out for now.
+
+#required:
+# - memories
+# - interrupt-controller
+# - pru
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - ti,k2g-pruss
+          - ti,am654-icssg
+          - ti,j721e-icssg
+then:
+  required:
+    - power-domains
+
+examples:
+  - |
+
+    /* Example 1 AM33xx PRU-ICSS */
+    pruss: pruss@0 {
+        compatible = "ti,am3356-pruss";
+        reg = <0x0 0x80000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        pruss_mem: memories@0 {
+            reg = <0x0 0x2000>,
+                  <0x2000 0x2000>,
+                  <0x10000 0x3000>;
+            reg-names = "dram0", "dram1", "shrdram2";
+        };
+
+        pruss_cfg: cfg@26000 {
+            compatible = "ti,pruss-cfg", "syscon";
+            reg = <0x26000 0x2000>;
+        };
+
+        pruss_iep: iep@2e000 {
+            compatible = "ti,am3356-icss-iep";
+            reg = <0x2e000 0x31c>;
+            clocks = <&pruss_iepclk_mux>;
+        };
+
+        pruss_mii_rt: mii-rt@32000 {
+            compatible = "ti,pruss-mii", "syscon";
+            reg = <0x32000 0x58>;
+        };
+
+        pruss_intc: interrupt-controller@20000 {
+            compatible = "ti,pruss-intc";
+            reg = <0x20000 0x2000>;
+            interrupts = <20 21 22 23 24 25 26 27>;
+            interrupt-names = "host_intr0", "host_intr1",
+                              "host_intr2", "host_intr3",
+                              "host_intr4", "host_intr5",
+                              "host_intr6", "host_intr7";
+            interrupt-controller;
+            #interrupt-cells = <3>;
+        };
+
+        pru0: pru@34000 {
+            compatible = "ti,am3356-pru";
+            reg = <0x34000 0x2000>,
+                  <0x22000 0x400>,
+                  <0x22400 0x100>;
+            reg-names = "iram", "control", "debug";
+            firmware-name = "am335x-pru0-fw";
+        };
+
+        pru1: pru@38000 {
+            compatible = "ti,am3356-pru";
+            reg = <0x38000 0x2000>,
+                  <0x24000 0x400>,
+                  <0x24400 0x100>;
+            reg-names = "iram", "control", "debug";
+            firmware-name = "am335x-pru1-fw";
+        };
+
+        pruss_mdio: mdio@32400 {
+            compatible = "ti,davinci_mdio";
+            reg = <0x32400 0x90>;
+            clocks = <&dpll_core_m4_ck>;
+            clock-names = "fck";
+            bus_freq = <1000000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+
+  - |
+
+    /* Example 2 AM43xx PRU-ICSS with PRUSS1 node */
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    pruss1: pruss@0 {
+        compatible = "ti,am4376-pruss";
+        reg = <0x0 0x40000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        pruss1_mem: memories@0 {
+            reg = <0x0 0x2000>,
+                  <0x2000 0x2000>,
+                  <0x10000 0x8000>;
+            reg-names = "dram0", "dram1", "shrdram2";
+        };
+
+        pruss1_cfg: cfg@26000 {
+            compatible = "ti,pruss-cfg", "syscon";
+            reg = <0x26000 0x2000>;
+        };
+
+        pruss1_iep: iep@2e000 {
+            compatible = "ti,am3356-icss-iep";
+            reg = <0x2e000 0x31c>;
+            clocks = <&pruss_iepclk_mux>;
+        };
+
+        pruss1_mii_rt: mii-rt@32000 {
+            compatible = "ti,pruss-mii", "syscon";
+            reg = <0x32000 0x58>;
+        };
+
+        pruss1_intc: interrupt-controller@20000 {
+            compatible = "ti,pruss-intc";
+            reg = <0x20000 0x2000>;
+            interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-names = "host_intr0", "host_intr1",
+                              "host_intr2", "host_intr3",
+                              "host_intr4", "host_intr6",
+                              "host_intr7";
+            interrupt-controller;
+            #interrupt-cells = <3>;
+        };
+
+        pru1_0: pru@34000 {
+            compatible = "ti,am4376-pru";
+            reg = <0x34000 0x3000>,
+                  <0x22000 0x400>,
+                  <0x22400 0x100>;
+            reg-names = "iram", "control", "debug";
+            firmware-name = "am437x-pru1_0-fw";
+        };
+
+        pru1_1: pru@38000 {
+            compatible = "ti,am4376-pru";
+            reg = <0x38000 0x3000>,
+                  <0x24000 0x400>,
+                  <0x24400 0x100>;
+            reg-names = "iram", "control", "debug";
+            firmware-name = "am437x-pru1_1-fw";
+        };
+
+        pruss1_mdio: mdio@32400 {
+            compatible = "ti,davinci_mdio";
+            reg = <0x32400 0x90>;
+            clocks = <&dpll_core_m4_ck>;
+            clock-names = "fck";
+            bus_freq = <1000000>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+
+...
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 3/6] soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs Grzegorz Jaszczyk
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, Andrew F . Davis, Tero Kristo, robh+dt, linux-omap,
	lee.jones, wmills, linux-arm-kernel

From: Suman Anna <s-anna@ti.com>

The Programmable Real-Time Unit - Industrial Communication
Subsystem (PRU-ICSS) is present on various TI SoCs such as
AM335x or AM437x or the Keystone 66AK2G. Each SoC can have
one or more PRUSS instances that may or may not be identical.
For example, AM335x SoCs have a single PRUSS, while AM437x has
two PRUSS instances PRUSS1 and PRUSS0, with the PRUSS0 being
a cut-down version of the PRUSS1.

The PRUSS consists of dual 32-bit RISC cores called the
Programmable Real-Time Units (PRUs), some shared, data and
instruction memories, some internal peripheral modules, and
an interrupt controller. The programmable nature of the PRUs
provide flexibility to implement custom peripheral interfaces,
fast real-time responses, or specialized data handling.

The PRU-ICSS functionality is achieved through three different
platform drivers addressing a specific portion of the PRUSS.
Some sub-modules of the PRU-ICSS IP reuse some of the existing
drivers (like davinci mdio driver or the generic syscon driver).
This design provides flexibility in representing the different
modules of PRUSS accordingly, and at the same time allowing the
PRUSS driver to add some instance specific configuration within
an SoC.

The PRUSS platform driver deals with the overall PRUSS and is
used for managing the subsystem level resources like various
memories and the CFG module. It is responsible for the creation
and deletion of the platform devices for the child PRU devices
and other child devices (like Interrupt Controller, MDIO node
and some syscon nodes) so that they can be managed by specific
platform drivers. The PRUSS interrupt controller is managed by
an irqchip driver, while the individual PRU RISC cores are
managed by a PRU remoteproc driver.

The driver currently supports the AM335x SoC, and support for
other TI SoCs will be added in subsequent patches.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/Kconfig       |  11 ++++
 drivers/soc/ti/Makefile      |   1 +
 drivers/soc/ti/pruss.c       | 147 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/pruss_driver.h |  48 ++++++++++++++
 4 files changed, 207 insertions(+)
 create mode 100644 drivers/soc/ti/pruss.c
 create mode 100644 include/linux/pruss_driver.h

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index e192fb7..b934bc3 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -101,6 +101,17 @@ config TI_K3_SOCINFO
 	  platforms to provide information about the SoC family and
 	  variant to user space.
 
+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.
+
+	  Say Y or M here to support the Programmable Realtime Unit (PRU)
+	  processors on various TI SoCs. It's safe to say N here if you're
+	  not interested in the PRU or if you are unsure.
+
 endif # SOC_TI
 
 config TI_SCI_INTA_MSI_DOMAIN
diff --git a/drivers/soc/ti/Makefile b/drivers/soc/ti/Makefile
index 1110e5c..18129aa 100644
--- a/drivers/soc/ti/Makefile
+++ b/drivers/soc/ti/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_TI_SCI_PM_DOMAINS)		+= ti_sci_pm_domains.o
 obj-$(CONFIG_TI_SCI_INTA_MSI_DOMAIN)	+= ti_sci_inta_msi.o
 obj-$(CONFIG_TI_K3_RINGACC)		+= k3-ringacc.o
 obj-$(CONFIG_TI_K3_SOCINFO)		+= k3-socinfo.o
+obj-$(CONFIG_TI_PRUSS)			+= pruss.o
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
new file mode 100644
index 0000000..c071bb2
--- /dev/null
+++ b/drivers/soc/ti/pruss.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * PRU-ICSS platform driver for various TI SoCs
+ *
+ * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/
+ * Author(s):
+ *	Suman Anna <s-anna@ti.com>
+ *	Andrew F. Davis <afd@ti.com>
+ */
+
+#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>
+#include <linux/pm_runtime.h>
+#include <linux/pruss_driver.h>
+
+static int pruss_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev_of_node(dev);
+	struct device_node *child;
+	struct pruss *pruss;
+	struct resource res;
+	int ret, i, index;
+	const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
+
+	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+	if (ret) {
+		dev_err(dev, "failed to set the DMA coherent mask");
+		return ret;
+	}
+
+	pruss = devm_kzalloc(dev, sizeof(*pruss), GFP_KERNEL);
+	if (!pruss)
+		return -ENOMEM;
+
+	pruss->dev = dev;
+
+	child = of_get_child_by_name(np, "memories");
+	if (!child) {
+		dev_err(dev, "%pOF is missing its 'memories' node\n", child);
+		return -ENODEV;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
+		index = of_property_match_string(child, "reg-names",
+						 mem_names[i]);
+		if (index < 0) {
+			of_node_put(child);
+			return index;
+		}
+
+		if (of_address_to_resource(child, index, &res)) {
+			of_node_put(child);
+			return -EINVAL;
+		}
+
+		pruss->mem_regions[i].va = devm_ioremap(dev, res.start,
+							resource_size(&res));
+		if (!pruss->mem_regions[i].va) {
+			dev_err(dev, "failed to parse and map memory resource %d %s\n",
+				i, mem_names[i]);
+			of_node_put(child);
+			return -ENOMEM;
+		}
+		pruss->mem_regions[i].pa = res.start;
+		pruss->mem_regions[i].size = resource_size(&res);
+
+		dev_dbg(dev, "memory %8s: pa %pa size 0x%zx va %pK\n",
+			mem_names[i], &pruss->mem_regions[i].pa,
+			pruss->mem_regions[i].size, pruss->mem_regions[i].va);
+	}
+	of_node_put(child);
+
+	platform_set_drvdata(pdev, pruss);
+
+	pm_runtime_enable(dev);
+	ret = pm_runtime_get_sync(dev);
+	if (ret < 0) {
+		dev_err(dev, "couldn't enable module\n");
+		pm_runtime_put_noidle(dev);
+		goto rpm_disable;
+	}
+
+	child = of_get_child_by_name(np, "cfg");
+	if (!child) {
+		dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
+		ret = -ENODEV;
+		goto rpm_put;
+	}
+
+	pruss->cfg_regmap = syscon_node_to_regmap(child);
+	of_node_put(child);
+	if (IS_ERR(pruss->cfg_regmap)) {
+		ret = -ENODEV;
+		goto rpm_put;
+	}
+
+	ret = devm_of_platform_populate(dev);
+	if (ret) {
+		dev_err(dev, "failed to register child devices\n");
+		goto rpm_put;
+	}
+
+	return 0;
+
+rpm_put:
+	pm_runtime_put_sync(dev);
+rpm_disable:
+	pm_runtime_disable(dev);
+	return ret;
+}
+
+static int pruss_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+
+	devm_of_platform_depopulate(dev);
+
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
+	return 0;
+}
+
+static const struct of_device_id pruss_of_match[] = {
+	{ .compatible = "ti,am3356-pruss" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, pruss_of_match);
+
+static struct platform_driver pruss_driver = {
+	.driver = {
+		.name = "pruss",
+		.of_match_table = pruss_of_match,
+	},
+	.probe  = pruss_probe,
+	.remove = pruss_remove,
+};
+module_platform_driver(pruss_driver);
+
+MODULE_AUTHOR("Suman Anna <s-anna@ti.com>");
+MODULE_DESCRIPTION("PRU-ICSS Subsystem Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
new file mode 100644
index 0000000..0701fe1
--- /dev/null
+++ b/include/linux/pruss_driver.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * PRU-ICSS sub-system specific definitions
+ *
+ * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/
+ *	Suman Anna <s-anna@ti.com>
+ */
+
+#ifndef _PRUSS_DRIVER_H_
+#define _PRUSS_DRIVER_H_
+
+#include <linux/types.h>
+
+/*
+ * enum pruss_mem - PRUSS memory range identifiers
+ */
+enum pruss_mem {
+	PRUSS_MEM_DRAM0 = 0,
+	PRUSS_MEM_DRAM1,
+	PRUSS_MEM_SHRD_RAM2,
+	PRUSS_MEM_MAX,
+};
+
+/**
+ * struct pruss_mem_region - PRUSS memory region structure
+ * @va: kernel virtual address of the PRUSS memory region
+ * @pa: physical (bus) address of the PRUSS memory region
+ * @size: size of the PRUSS memory region
+ */
+struct pruss_mem_region {
+	void __iomem *va;
+	phys_addr_t pa;
+	size_t size;
+};
+
+/**
+ * struct pruss - PRUSS parent structure
+ * @dev: pruss device pointer
+ * @cfg_regmap: regmap for config region
+ * @mem_regions: data for each of the PRUSS memory regions
+ */
+struct pruss {
+	struct device *dev;
+	struct regmap *cfg_regmap;
+	struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
+};
+
+#endif	/* _PRUSS_DRIVER_H_ */
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 2/6] soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 4/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs Grzegorz Jaszczyk
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, Andrew F . Davis, robh+dt, linux-omap, lee.jones,
	wmills, linux-arm-kernel

From: Suman Anna <s-anna@ti.com>

The AM437x SoCs have two different PRU-ICSS subsystems: PRU-ICSS1
and a smaller PRU-ICSS0. Enhance the PRUSS platform driver to support
both the PRU-ICSS sub-systems on these SoCs.

The PRU-ICSS1 on AM437x is very similar to the PRU-ICSS on AM33xx
except for few minor differences - increased Instruction RAM, increased
Shared Data RAM2, and 1 less interrupt (PRUSS host interrupt 7 which is
redirected to the other PRUSS) towards the MPU INTC. The PRU-ICSS0 is
a cut-down version of the IP, with less DRAM per PRU, no Shared DRAM etc.
It also does not have direct access to L3 bus regions, there is a single
interface to L3 for both PRUSS0 and PRUSS1, and it would have to go
through the PRUSS1's interface. The PRUSS_SYSCFG register is reserved on
PRUSS0, so any external access requires the programming the corresponding
PRUSS_SYSCFG register in PRUSS1. It does have its own dedicated I/O lines
though. Note that this instance does not support any PRU Ethernet related
use cases.

The adaptation uses SoC-specific compatibles in the driver and uses
a newly introduced pruss_match_private_data structure and the
pruss_get_private_data() function to retrieve a PRUSS instance specific
data using a device-name based lookup logic. The reset and the L3 external
access are managed by the parent interconnect ti-sysc bus driver so that
PRUSS1 and PRUSS0 can be independently supported.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/Kconfig |  2 +-
 drivers/soc/ti/pruss.c | 35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index b934bc3..40d6a22 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -103,7 +103,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX
+	depends on SOC_AM33XX || SOC_AM43XX
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index c071bb2..04938ba 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -17,6 +17,14 @@
 #include <linux/pm_runtime.h>
 #include <linux/pruss_driver.h>
 
+/**
+ * struct pruss_private_data - PRUSS driver private data
+ * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
+ */
+struct pruss_private_data {
+	bool has_no_sharedram;
+};
+
 static int pruss_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -25,8 +33,15 @@ static int pruss_probe(struct platform_device *pdev)
 	struct pruss *pruss;
 	struct resource res;
 	int ret, i, index;
+	const struct pruss_private_data *data;
 	const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
 
+	data = of_device_get_match_data(&pdev->dev);
+	if (IS_ERR(data)) {
+		dev_err(dev, "missing private data\n");
+		return -ENODEV;
+	}
+
 	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 	if (ret) {
 		dev_err(dev, "failed to set the DMA coherent mask");
@@ -45,7 +60,14 @@ static int pruss_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
+	for (i = 0; i < PRUSS_MEM_MAX; i++) {
+		/*
+		 * On AM437x one of two PRUSS units don't contain Shared RAM,
+		 * skip it
+		 */
+		if (data && data->has_no_sharedram && i == PRUSS_MEM_SHRD_RAM2)
+			continue;
+
 		index = of_property_match_string(child, "reg-names",
 						 mem_names[i]);
 		if (index < 0) {
@@ -126,8 +148,19 @@ static int pruss_remove(struct platform_device *pdev)
 	return 0;
 }
 
+/* instance-specific driver private data */
+static const struct pruss_private_data am437x_pruss1_data = {
+	.has_no_sharedram = false,
+};
+
+static const struct pruss_private_data am437x_pruss0_data = {
+	.has_no_sharedram = true,
+};
+
 static const struct of_device_id pruss_of_match[] = {
 	{ .compatible = "ti,am3356-pruss" },
+	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
+	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pruss_of_match);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
                   ` (2 preceding siblings ...)
  2020-07-29 11:02 ` [PATCH 3/6] soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 5/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC Grzegorz Jaszczyk
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, linux-omap, lee.jones, wmills,
	linux-arm-kernel

From: Suman Anna <s-anna@ti.com>

The AM57xx family of SoCs supports two PRU-ICSS instances, each of
which has two PRU processor cores. The two PRU-ICSS instances are
identical to each other, and are very similar to the PRU-ICSS1 of
AM33xx/AM43xx except for a few minor differences like the RAM sizes
and the number of interrupts coming into the MPU INTC. They do
not have a programmable module reset line unlike those present on
AM33xx/AM43xx SoCs. The modules are reset just like any other IP
with the SoC's global cold/warm resets. Each PRU-ICSS's INTC is also
preceded by a Crossbar that enables multiple external events to be
routed to a specific number of input interrupt events. Any interrupt
event directed towards PRUSS needs this crossbar to be setup properly
on the firmware side.

The existing PRUSS platform driver has been enhanced to support
these AM57xx PRU-ICSS instances through new AM57xx specific
compatible for properly probing and booting all the different PRU
cores in each PRU-ICSS processor subsystem. A build dependency with
SOC_DRA7XX is also added to enable the driver to be built in
AM57xx-only configuration (there is no separate Kconfig option
for AM57xx vs DRA7xx).

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/Kconfig | 2 +-
 drivers/soc/ti/pruss.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 40d6a22..99dbc14 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -103,7 +103,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX || SOC_AM43XX
+	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 04938ba..5df4caa 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -161,6 +161,7 @@ static const struct of_device_id pruss_of_match[] = {
 	{ .compatible = "ti,am3356-pruss" },
 	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
+	{ .compatible = "ti,am5728-pruss" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pruss_of_match);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
                   ` (3 preceding siblings ...)
  2020-07-29 11:02 ` [PATCH 4/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-07-29 11:02 ` [PATCH 6/6] soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs Grzegorz Jaszczyk
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, Andrew F . Davis, robh+dt, linux-omap, lee.jones,
	wmills, linux-arm-kernel

From: Suman Anna <s-anna@ti.com>

The 66AK2G SoC supports two PRU-ICSS instances, named PRUSS0 and PRUSS1,
each of which has two PRU processor cores. The two PRU-ICSS instances
are identical to each other with few minor SoC integration differences,
and are very similar to the PRU-ICSS1 of AM57xx/AM43xx. The Shared Data
RAM size is larger and the number of interrupts coming into MPU INTC
is like the instances on AM437x. There are also few other differences
attributing to integration in Keystone architecture (like no SYSCFG
register or PRCM handshake protocols). Other IP level differences
include different constant table, differences in system event interrupt
input sources etc. They also do not have a programmable module reset
line like those present on AM33xx/AM43xx SoCs. The modules are reset
just like any other IP with the SoC's global cold/warm resets.

The existing PRUSS platform driver has been enhanced to support these
66AK2G PRU-ICSS instances through new 66AK2G specific compatible for
properly probing and booting all the different PRU cores in each
PRU-ICSS processor subsystem. A build dependency with ARCH_KEYSTONE
is added to enable the driver to be built in K2G-only configuration.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/Kconfig | 2 +-
 drivers/soc/ti/pruss.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 99dbc14..c290343 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -103,7 +103,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX
+	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 5df4caa..d5f128e 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -162,6 +162,7 @@ static const struct of_device_id pruss_of_match[] = {
 	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
 	{ .compatible = "ti,am5728-pruss" },
+	{ .compatible = "ti,k2g-pruss" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pruss_of_match);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
                   ` (4 preceding siblings ...)
  2020-07-29 11:02 ` [PATCH 5/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC Grzegorz Jaszczyk
@ 2020-07-29 11:02 ` Grzegorz Jaszczyk
  2020-08-02 11:53 ` [PATCH 0/6] Add TI PRUSS platform driver Pavel Machek
  2020-08-20 14:43 ` Suman Anna
  7 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-07-29 11:02 UTC (permalink / raw)
  To: ssantosh, s-anna
  Cc: devicetree, grzegorz.jaszczyk, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, linux-omap, lee.jones, wmills,
	linux-arm-kernel

From: Suman Anna <s-anna@ti.com>

The K3 AM65x family of SoCs have the next generation of the PRU-ICSS
processor subsystem capable of supporting Gigabit Ethernet, and is
commonly referred to as ICSSG. These SoCs contain typically three
ICSSG instances named ICSSG0, ICSSG1 and ICSSG2. The three ICSSGs are
identical to each other for the most part with minor SoC integration
differences and capabilities. The ICSSG2 supports slightly enhanced
features like SGMII mode Ethernet, while the ICSS0 and ICSSG1 instances
are limited to MII mode only.

The ICSSGs on K3 AM65x SoCs are in general super-sets of the PRUSS on the
AM57xx/66AK2G SoCs. They include two additional auxiliary PRU cores called
RTUs and few other additional sub-modules. The interrupt integration is
also different on the K3 AM65x SoCs and are propagated through various
SoC-level Interrupt Router and Interrupt Aggregator blocks. Other IP level
differences include different constant tables, differences in system event
interrupt input sources etc. They also do not have a programmable module
reset line like those present on AM33xx/AM43xx SoCs. The modules are reset
just like any other IP with the SoC's global cold/warm resets.

The existing pruss platform driver has been updated to support these new
ICSSG instances through new AM65x specific compatibles. A build dependency
with ARCH_K3 is added to enable building all the existing PRUSS platform
drivers for this ARMv8 platform.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
---
 drivers/soc/ti/Kconfig | 2 +-
 drivers/soc/ti/pruss.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index c290343..f5b82ff 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -103,7 +103,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE
+	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index d5f128e..ccc9783 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -163,6 +163,7 @@ static const struct of_device_id pruss_of_match[] = {
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
 	{ .compatible = "ti,am5728-pruss" },
 	{ .compatible = "ti,k2g-pruss" },
+	{ .compatible = "ti,am654-icssg" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pruss_of_match);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add TI PRUSS platform driver
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
                   ` (5 preceding siblings ...)
  2020-07-29 11:02 ` [PATCH 6/6] soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs Grzegorz Jaszczyk
@ 2020-08-02 11:53 ` Pavel Machek
  2020-08-02 11:57   ` Pavel Machek
  2020-08-20 14:43 ` Suman Anna
  7 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2020-08-02 11:53 UTC (permalink / raw)
  To: Grzegorz Jaszczyk
  Cc: devicetree, linux-omap, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, ssantosh, lee.jones, wmills,
	linux-arm-kernel

Hi!

> A typical usage scenario would be to load the application firmware into one or
> more of the PRU cores, initialize one or more of the peripherals and perform I/O
> through shared RAM from either a kernel driver or directly from userspace.
> 
> This series contains the PRUSS platform driver. This is the parent driver for
> the entire PRUSS and is used for managing the subsystem level resources like
> various memories and the CFG module.  It is responsible for the creation and
> deletion of the platform devices for the child PRU devices and other child
> devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
> they can be managed by specific platform drivers.

>  drivers/soc/ti/Kconfig | 11 + drivers/soc/ti/Makefile | 1 + drivers/soc/ti/pruss.c | 

Is drivers/soc right place for that? We already have subsystem for various
programmable accelerators...


									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add TI PRUSS platform driver
  2020-08-02 11:53 ` [PATCH 0/6] Add TI PRUSS platform driver Pavel Machek
@ 2020-08-02 11:57   ` Pavel Machek
  2020-08-02 21:41     ` Grzegorz Jaszczyk
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2020-08-02 11:57 UTC (permalink / raw)
  To: Grzegorz Jaszczyk
  Cc: devicetree, linux-omap, praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, ssantosh, lee.jones, wmills,
	linux-arm-kernel

On Sun 2020-08-02 13:53:30, Pavel Machek wrote:
> Hi!
> 
> > A typical usage scenario would be to load the application firmware into one or
> > more of the PRU cores, initialize one or more of the peripherals and perform I/O
> > through shared RAM from either a kernel driver or directly from userspace.
> > 
> > This series contains the PRUSS platform driver. This is the parent driver for
> > the entire PRUSS and is used for managing the subsystem level resources like
> > various memories and the CFG module.  It is responsible for the creation and
> > deletion of the platform devices for the child PRU devices and other child
> > devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
> > they can be managed by specific platform drivers.
> 
> >  drivers/soc/ti/Kconfig | 11 + drivers/soc/ti/Makefile | 1 + drivers/soc/ti/pruss.c | 
> 
> Is drivers/soc right place for that? We already have subsystem for various
> programmable accelerators...

....see drivers/remoteproc.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add TI PRUSS platform driver
  2020-08-02 11:57   ` Pavel Machek
@ 2020-08-02 21:41     ` Grzegorz Jaszczyk
  0 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-08-02 21:41 UTC (permalink / raw)
  To: Pavel Machek
  Cc: devicetree, linux-omap, Bajjuri, Praneeth, santosh.shilimkar,
	linux-kernel, robh+dt, ssantosh, Lee Jones, Mills, William,
	linux-arm-kernel

Hi

On Sun, 2 Aug 2020 at 13:57, Pavel Machek <pavel@ucw.cz> wrote:
>
> On Sun 2020-08-02 13:53:30, Pavel Machek wrote:
> > Hi!
> >
> > > A typical usage scenario would be to load the application firmware into one or
> > > more of the PRU cores, initialize one or more of the peripherals and perform I/O
> > > through shared RAM from either a kernel driver or directly from userspace.
> > >
> > > This series contains the PRUSS platform driver. This is the parent driver for
> > > the entire PRUSS and is used for managing the subsystem level resources like
> > > various memories and the CFG module.  It is responsible for the creation and
> > > deletion of the platform devices for the child PRU devices and other child
> > > devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
> > > they can be managed by specific platform drivers.
> >
> > >  drivers/soc/ti/Kconfig | 11 + drivers/soc/ti/Makefile | 1 + drivers/soc/ti/pruss.c |
> >
> > Is drivers/soc right place for that? We already have subsystem for various
> > programmable accelerators...
>
> ....see drivers/remoteproc.

Yes I am aware of that and remoteproc sub-system will be used but only
for managing PRU cores (drivers/remoteproc/pru-rproc - will be
submitted soon), while this driver is the parent driver for the entire
PRUSS (used for managing the subsystem level resources like various
memories and the CFG module). This driver is also responsible for
populating all child devices (described in DT), managed by specific
(and separate) drivers: e.g.:
- PRU core will be managed by drivers/remoteproc/pru-rproc (will be
submitted next)
- PRU interrupt controller will be managed by
drivers/irqchip/irq-pruss-intc.c (it is already under review)
etc.

Best regards,
Grzegorz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings
  2020-07-29 11:02 ` [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings Grzegorz Jaszczyk
@ 2020-08-17 21:14   ` Rob Herring
  2020-08-18 22:07     ` Grzegorz Jaszczyk
  0 siblings, 1 reply; 14+ messages in thread
From: Rob Herring @ 2020-08-17 21:14 UTC (permalink / raw)
  To: Grzegorz Jaszczyk
  Cc: devicetree, linux-omap, praneeth, santosh.shilimkar,
	linux-kernel, ssantosh, lee.jones, wmills, linux-arm-kernel,
	Roger Quadros

On Wed, Jul 29, 2020 at 01:02:03PM +0200, Grzegorz Jaszczyk wrote:
> This patch adds the bindings for the Programmable Real-Time Unit
> and Industrial Communication Subsystem (PRU-ICSS) present on various
> TI SoCs. The IP is present on multiple TI SoC architecture families
> including the OMAP architecture SoCs such as AM33xx, AM437x and
> AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is
> also present on the Davinci based OMAPL138 SoCs and K3 architecture
> based AM65x and J721E SoCs as well.
> 
> The IP has a number of sub-modules some of which are represented as
> their own devices. This binding covers only the top-level sub-system
> devices, and some sub-modules like MDIO, MII_RT (Ethernet MII_RT module
> with MII ports) and IEP (Industrial Ethernet Peripheral). The remaining
> sub-modules bindings shall be defined in the respective driver
> subsystem bindings folders. Couple of full examples have also been
> added demonstrating the devices on AM335x and AM437x SoCs.
> 
> Signed-off-by: Suman Anna <s-anna@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> Reviewed-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/soc/ti/ti,pruss.yaml       | 383 +++++++++++++++++++++
>  1 file changed, 383 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> new file mode 100644
> index 0000000..4b7a098
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> @@ -0,0 +1,383 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/ti/ti,pruss.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: |+
> +  TI Programmable Real-Time Unit and Industrial Communication Subsystem
> +
> +maintainers:
> +  - Suman Anna <s-anna@ti.com>
> +
> +description: |+
> +
> +  The Programmable Real-Time Unit and Industrial Communication Subsystem
> +  (PRU-ICSS a.k.a. PRUSS) is present on various TI SoCs such as AM335x, AM437x,
> +  Keystone 66AK2G, OMAP-L138/DA850 etc. A PRUSS consists of dual 32-bit RISC
> +  cores (Programmable Real-Time Units, or PRUs), shared RAM, data and
> +  instruction RAMs, some internal peripheral modules to facilitate industrial
> +  communication, and an interrupt controller.
> +
> +  The programmable nature of the PRUs provide flexibility to implement custom
> +  peripheral interfaces, fast real-time responses, or specialized data handling.
> +  The common peripheral modules include the following,
> +    - an Ethernet MII_RT module with two MII ports
> +    - an MDIO port to control external Ethernet PHYs
> +    - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
> +      Ethernet functions
> +    - an Enhanced Capture Module (eCAP)
> +    - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
> +    - a 16550-compatible UART to support PROFIBUS
> +    - Enhanced GPIO with async capture and serial support
> +
> +  A PRU-ICSS subsystem can have up to three shared data memories. A PRU core
> +  acts on a primary Data RAM (there are usually 2 Data RAMs) at its address
> +  0x0, but also has access to a secondary Data RAM (primary to the other PRU
> +  core) at its address 0x2000. A shared Data RAM, if present, can be accessed
> +  by both the PRU cores. The Interrupt Controller (INTC) and a CFG module are
> +  common to both the PRU cores. Each PRU core also has a private instruction
> +  RAM, and specific register spaces for Control and Debug functionalities.
> +
> +  Various sub-modules within a PRU-ICSS subsystem are represented as individual
> +  nodes and are defined using a parent-child hierarchy depending on their
> +  integration within the IP and the SoC. These nodes are described in the
> +  following sections.
> +
> +
> +  PRU-ICSS Node
> +  ==============
> +  Each PRU-ICSS instance is represented as its own node with the individual PRU
> +  processor cores, the memories node, an INTC node and an MDIO node represented
> +  as child nodes within this PRUSS node. This node shall be a child of the
> +  corresponding interconnect bus nodes or target-module nodes.
> +
> +  See ../../mfd/syscon.yaml for generic SysCon binding details.
> +
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,am3356-pruss  # for AM335x SoC family
> +      - ti,am4376-pruss0 # for AM437x SoC family and PRUSS unit 0
> +      - ti,am4376-pruss1 # for AM437x SoC family and PRUSS unit 1
> +      - ti,am5728-pruss  # for AM57xx SoC family
> +      - ti,k2g-pruss     # for 66AK2G SoC family
> +      - ti,am654-icssg   # for K3 AM65x SoC family
> +      - ti,j721e-icssg   # for K3 J721E SoC family
> +
> +  reg:
> +    maxItems: 1
> +
> +  ranges:
> +    maxItems: 1
> +    description: |
> +      Standard ranges definition using addresses from 0 for child nodes.

Don't need a description on standard properties.

> +
> +  power-domains:
> +    description: |
> +      This property is as per sci-pm-domain.txt.
> +
> +  memories:

Missing unit-address pattern.

> +    description: |
> +      The various Data RAMs within a single PRU-ICSS unit are represented as a
> +      single node with the name 'memories'.
> +
> +    type: object
> +
> +    properties:
> +      reg:
> +        minItems: 2 # On AM437x one of two PRUSS units don't contain Shared RAM.
> +        maxItems: 3
> +        items:
> +          - description: Address and size of the Data RAM0.
> +          - description: Address and size of the Data RAM1.
> +          - description: |
> +              Address and size of the Shared Data RAM. Note that on AM437x one
> +              of two PRUSS units don't contain Shared RAM, while the second one
> +              has it.
> +
> +      reg-names:
> +        minItems: 2
> +        maxItems: 3
> +        items:
> +          - const: dram0
> +          - const: dram1
> +          - const: shrdram2
> +
> +    required:
> +      - reg
> +      - reg-names

       additionalProperties: false


(And throughout for other child nodes).

> +
> +  cfg:
> +    description: |
> +      PRU-ICSS configuration space. CFG sub-module represented as a SysCon.
> +
> +    type: object
> +
> +    properties:
> +      compatible:
> +        items:
> +          - const: ti,pruss-cfg
> +          - const: syscon
> +
> +      reg:
> +        maxItems: 1
> +
> +  iep:
> +    description: |
> +      Industrial Ethernet Peripheral to manage/generate Industrial Ethernet
> +      functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x,
> +      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP
> +      is used for creating PTP clocks and generating PPS signals. The bindings
> +      for this shall be defined in ../../net/ti,icss-iep.yaml.
> +
> +    type: object
> +
> +  mii-rt:
> +    description: |
> +      Real-Time Ethernet to support multiple industrial communication protocols.
> +      MII-RT sub-module represented as a SysCon.
> +
> +    type: object
> +
> +    properties:
> +      compatible:
> +        items:
> +          - const: ti,pruss-mii
> +          - const: syscon
> +
> +      reg:
> +        maxItems: 1
> +
> +  mii-g-rt:
> +    description: |
> +      The Real-time Media Independent Interface to support multiple industrial
> +      communication protocols (G stands for Gigabit). MII-G-RT sub-module
> +      represented as a SysCon.
> +
> +    type: object
> +
> +    properties:
> +      compatible:
> +        items:
> +          - const: ti,pruss-mii-g
> +          - const: syscon
> +
> +      reg:
> +        maxItems: 1
> +
> +  interrupt-controller:
> +    description: |
> +      PRUSS INTC Node. Each PRUSS has a single interrupt controller instance
> +      that is common to all the PRU cores. This should be represented as an
> +      interrupt-controller node. The bindings for this shall be defined in
> +      ../../interrupt-controller/ti,pruss-intc.yaml.

Use $ref to reference the schema.

> +
> +    type: object
> +
> +  mdio:
> +    description: |
> +      MDIO Node. Each PRUSS has an MDIO module that can be used to control
> +      external PHYs. The MDIO module used within the PRU-ICSS is an instance of
> +      the MDIO Controller used in TI Davinci SoCs.
> +
> +    allOf:
> +      - $ref: /schemas/net/ti,davinci-mdio.yaml#
> +
> +    type: object
> +
> +patternProperties:
> +  "^(pru|rtu|txpru)@[0-9a-f]+$":
> +    description: |
> +      PRU Node. Each PRUSS has dual PRU cores, each represented as a RemoteProc
> +      device through a PRU child node each. Each node can optionally be rendered
> +      inactive by using the standard DT string property, "status". The ICSSG IP
> +      present on K3 SoCs have additional auxiliary PRU cores with slightly
> +      different IP integration. The bindings for this shall be defined in
> +      ../../remoteproc/ti,pru-rproc.yaml
> +
> +    type: object
> +
> +required:
> +  - compatible
> +  - reg
> +  - ranges
> +
> +# Due to inability of correctly verifying sub-nodes with an @address through
> +# the "required" list, the required sub-nodes below are commented out for now.
> +
> +#required:
> +# - memories
> +# - interrupt-controller
> +# - pru

Add:

additionalProperties: false

> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - ti,k2g-pruss
> +          - ti,am654-icssg
> +          - ti,j721e-icssg
> +then:
> +  required:
> +    - power-domains
> +
> +examples:
> +  - |
> +
> +    /* Example 1 AM33xx PRU-ICSS */
> +    pruss: pruss@0 {
> +        compatible = "ti,am3356-pruss";
> +        reg = <0x0 0x80000>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;

I would have expected a warning on this since you defined it to have 1 
entry.

> +
> +        pruss_mem: memories@0 {
> +            reg = <0x0 0x2000>,
> +                  <0x2000 0x2000>,
> +                  <0x10000 0x3000>;
> +            reg-names = "dram0", "dram1", "shrdram2";
> +        };
> +
> +        pruss_cfg: cfg@26000 {
> +            compatible = "ti,pruss-cfg", "syscon";
> +            reg = <0x26000 0x2000>;
> +        };
> +
> +        pruss_iep: iep@2e000 {
> +            compatible = "ti,am3356-icss-iep";
> +            reg = <0x2e000 0x31c>;
> +            clocks = <&pruss_iepclk_mux>;
> +        };
> +
> +        pruss_mii_rt: mii-rt@32000 {
> +            compatible = "ti,pruss-mii", "syscon";
> +            reg = <0x32000 0x58>;
> +        };
> +
> +        pruss_intc: interrupt-controller@20000 {
> +            compatible = "ti,pruss-intc";
> +            reg = <0x20000 0x2000>;
> +            interrupts = <20 21 22 23 24 25 26 27>;
> +            interrupt-names = "host_intr0", "host_intr1",
> +                              "host_intr2", "host_intr3",
> +                              "host_intr4", "host_intr5",
> +                              "host_intr6", "host_intr7";
> +            interrupt-controller;
> +            #interrupt-cells = <3>;
> +        };
> +
> +        pru0: pru@34000 {
> +            compatible = "ti,am3356-pru";
> +            reg = <0x34000 0x2000>,
> +                  <0x22000 0x400>,
> +                  <0x22400 0x100>;
> +            reg-names = "iram", "control", "debug";
> +            firmware-name = "am335x-pru0-fw";
> +        };
> +
> +        pru1: pru@38000 {
> +            compatible = "ti,am3356-pru";
> +            reg = <0x38000 0x2000>,
> +                  <0x24000 0x400>,
> +                  <0x24400 0x100>;
> +            reg-names = "iram", "control", "debug";
> +            firmware-name = "am335x-pru1-fw";
> +        };
> +
> +        pruss_mdio: mdio@32400 {
> +            compatible = "ti,davinci_mdio";
> +            reg = <0x32400 0x90>;
> +            clocks = <&dpll_core_m4_ck>;
> +            clock-names = "fck";
> +            bus_freq = <1000000>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +        };
> +    };
> +
> +  - |
> +
> +    /* Example 2 AM43xx PRU-ICSS with PRUSS1 node */
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    pruss1: pruss@0 {
> +        compatible = "ti,am4376-pruss";
> +        reg = <0x0 0x40000>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;
> +
> +        pruss1_mem: memories@0 {
> +            reg = <0x0 0x2000>,
> +                  <0x2000 0x2000>,
> +                  <0x10000 0x8000>;
> +            reg-names = "dram0", "dram1", "shrdram2";
> +        };
> +
> +        pruss1_cfg: cfg@26000 {
> +            compatible = "ti,pruss-cfg", "syscon";
> +            reg = <0x26000 0x2000>;
> +        };
> +
> +        pruss1_iep: iep@2e000 {
> +            compatible = "ti,am3356-icss-iep";
> +            reg = <0x2e000 0x31c>;
> +            clocks = <&pruss_iepclk_mux>;
> +        };
> +
> +        pruss1_mii_rt: mii-rt@32000 {
> +            compatible = "ti,pruss-mii", "syscon";
> +            reg = <0x32000 0x58>;
> +        };
> +
> +        pruss1_intc: interrupt-controller@20000 {
> +            compatible = "ti,pruss-intc";
> +            reg = <0x20000 0x2000>;
> +            interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>,
> +                         <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
> +            interrupt-names = "host_intr0", "host_intr1",
> +                              "host_intr2", "host_intr3",
> +                              "host_intr4", "host_intr6",
> +                              "host_intr7";
> +            interrupt-controller;
> +            #interrupt-cells = <3>;
> +        };
> +
> +        pru1_0: pru@34000 {
> +            compatible = "ti,am4376-pru";
> +            reg = <0x34000 0x3000>,
> +                  <0x22000 0x400>,
> +                  <0x22400 0x100>;
> +            reg-names = "iram", "control", "debug";
> +            firmware-name = "am437x-pru1_0-fw";
> +        };
> +
> +        pru1_1: pru@38000 {
> +            compatible = "ti,am4376-pru";
> +            reg = <0x38000 0x3000>,
> +                  <0x24000 0x400>,
> +                  <0x24400 0x100>;
> +            reg-names = "iram", "control", "debug";
> +            firmware-name = "am437x-pru1_1-fw";
> +        };
> +
> +        pruss1_mdio: mdio@32400 {
> +            compatible = "ti,davinci_mdio";
> +            reg = <0x32400 0x90>;
> +            clocks = <&dpll_core_m4_ck>;
> +            clock-names = "fck";
> +            bus_freq = <1000000>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +        };
> +    };
> +
> +...
> -- 
> 2.7.4
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings
  2020-08-17 21:14   ` Rob Herring
@ 2020-08-18 22:07     ` Grzegorz Jaszczyk
  0 siblings, 0 replies; 14+ messages in thread
From: Grzegorz Jaszczyk @ 2020-08-18 22:07 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-omap, Bajjuri, Praneeth, santosh.shilimkar,
	linux-kernel, ssantosh, Lee Jones, linux-arm-kernel,
	Roger Quadros

Hi Rob,

On Mon, 17 Aug 2020 at 23:14, Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Jul 29, 2020 at 01:02:03PM +0200, Grzegorz Jaszczyk wrote:
> > This patch adds the bindings for the Programmable Real-Time Unit
> > and Industrial Communication Subsystem (PRU-ICSS) present on various
> > TI SoCs. The IP is present on multiple TI SoC architecture families
> > including the OMAP architecture SoCs such as AM33xx, AM437x and
> > AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is
> > also present on the Davinci based OMAPL138 SoCs and K3 architecture
> > based AM65x and J721E SoCs as well.
> >
> > The IP has a number of sub-modules some of which are represented as
> > their own devices. This binding covers only the top-level sub-system
> > devices, and some sub-modules like MDIO, MII_RT (Ethernet MII_RT module
> > with MII ports) and IEP (Industrial Ethernet Peripheral). The remaining
> > sub-modules bindings shall be defined in the respective driver
> > subsystem bindings folders. Couple of full examples have also been
> > added demonstrating the devices on AM335x and AM437x SoCs.
> >
> > Signed-off-by: Suman Anna <s-anna@ti.com>
> > Signed-off-by: Roger Quadros <rogerq@ti.com>
> > Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> > Reviewed-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  .../devicetree/bindings/soc/ti/ti,pruss.yaml       | 383 +++++++++++++++++++++
> >  1 file changed, 383 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> > new file mode 100644
> > index 0000000..4b7a098
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
> > @@ -0,0 +1,383 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/ti/ti,pruss.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: |+
> > +  TI Programmable Real-Time Unit and Industrial Communication Subsystem
> > +
> > +maintainers:
> > +  - Suman Anna <s-anna@ti.com>
> > +
> > +description: |+
> > +
> > +  The Programmable Real-Time Unit and Industrial Communication Subsystem
> > +  (PRU-ICSS a.k.a. PRUSS) is present on various TI SoCs such as AM335x, AM437x,
> > +  Keystone 66AK2G, OMAP-L138/DA850 etc. A PRUSS consists of dual 32-bit RISC
> > +  cores (Programmable Real-Time Units, or PRUs), shared RAM, data and
> > +  instruction RAMs, some internal peripheral modules to facilitate industrial
> > +  communication, and an interrupt controller.
> > +
> > +  The programmable nature of the PRUs provide flexibility to implement custom
> > +  peripheral interfaces, fast real-time responses, or specialized data handling.
> > +  The common peripheral modules include the following,
> > +    - an Ethernet MII_RT module with two MII ports
> > +    - an MDIO port to control external Ethernet PHYs
> > +    - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
> > +      Ethernet functions
> > +    - an Enhanced Capture Module (eCAP)
> > +    - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
> > +    - a 16550-compatible UART to support PROFIBUS
> > +    - Enhanced GPIO with async capture and serial support
> > +
> > +  A PRU-ICSS subsystem can have up to three shared data memories. A PRU core
> > +  acts on a primary Data RAM (there are usually 2 Data RAMs) at its address
> > +  0x0, but also has access to a secondary Data RAM (primary to the other PRU
> > +  core) at its address 0x2000. A shared Data RAM, if present, can be accessed
> > +  by both the PRU cores. The Interrupt Controller (INTC) and a CFG module are
> > +  common to both the PRU cores. Each PRU core also has a private instruction
> > +  RAM, and specific register spaces for Control and Debug functionalities.
> > +
> > +  Various sub-modules within a PRU-ICSS subsystem are represented as individual
> > +  nodes and are defined using a parent-child hierarchy depending on their
> > +  integration within the IP and the SoC. These nodes are described in the
> > +  following sections.
> > +
> > +
> > +  PRU-ICSS Node
> > +  ==============
> > +  Each PRU-ICSS instance is represented as its own node with the individual PRU
> > +  processor cores, the memories node, an INTC node and an MDIO node represented
> > +  as child nodes within this PRUSS node. This node shall be a child of the
> > +  corresponding interconnect bus nodes or target-module nodes.
> > +
> > +  See ../../mfd/syscon.yaml for generic SysCon binding details.
> > +
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - ti,am3356-pruss  # for AM335x SoC family
> > +      - ti,am4376-pruss0 # for AM437x SoC family and PRUSS unit 0
> > +      - ti,am4376-pruss1 # for AM437x SoC family and PRUSS unit 1
> > +      - ti,am5728-pruss  # for AM57xx SoC family
> > +      - ti,k2g-pruss     # for 66AK2G SoC family
> > +      - ti,am654-icssg   # for K3 AM65x SoC family
> > +      - ti,j721e-icssg   # for K3 J721E SoC family
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  ranges:
> > +    maxItems: 1
> > +    description: |
> > +      Standard ranges definition using addresses from 0 for child nodes.
>
> Don't need a description on standard properties.

Ok.

>
>
> > +
> > +  power-domains:
> > +    description: |
> > +      This property is as per sci-pm-domain.txt.
> > +
> > +  memories:
>
> Missing unit-address pattern.

Ok, I will also update other subnodes regarding the unit-address pattern.

>
>
> > +    description: |
> > +      The various Data RAMs within a single PRU-ICSS unit are represented as a
> > +      single node with the name 'memories'.
> > +
> > +    type: object
> > +
> > +    properties:
> > +      reg:
> > +        minItems: 2 # On AM437x one of two PRUSS units don't contain Shared RAM.
> > +        maxItems: 3
> > +        items:
> > +          - description: Address and size of the Data RAM0.
> > +          - description: Address and size of the Data RAM1.
> > +          - description: |
> > +              Address and size of the Shared Data RAM. Note that on AM437x one
> > +              of two PRUSS units don't contain Shared RAM, while the second one
> > +              has it.
> > +
> > +      reg-names:
> > +        minItems: 2
> > +        maxItems: 3
> > +        items:
> > +          - const: dram0
> > +          - const: dram1
> > +          - const: shrdram2
> > +
> > +    required:
> > +      - reg
> > +      - reg-names
>
>        additionalProperties: false
>

Ok.

>
>
> (And throughout for other child nodes).

Ok.

>
>
> > +
> > +  cfg:
> > +    description: |
> > +      PRU-ICSS configuration space. CFG sub-module represented as a SysCon.
> > +
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        items:
> > +          - const: ti,pruss-cfg
> > +          - const: syscon
> > +
> > +      reg:
> > +        maxItems: 1
> > +
> > +  iep:
> > +    description: |
> > +      Industrial Ethernet Peripheral to manage/generate Industrial Ethernet
> > +      functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x,
> > +      AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP
> > +      is used for creating PTP clocks and generating PPS signals. The bindings
> > +      for this shall be defined in ../../net/ti,icss-iep.yaml.
> > +
> > +    type: object
> > +
> > +  mii-rt:
> > +    description: |
> > +      Real-Time Ethernet to support multiple industrial communication protocols.
> > +      MII-RT sub-module represented as a SysCon.
> > +
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        items:
> > +          - const: ti,pruss-mii
> > +          - const: syscon
> > +
> > +      reg:
> > +        maxItems: 1
> > +
> > +  mii-g-rt:
> > +    description: |
> > +      The Real-time Media Independent Interface to support multiple industrial
> > +      communication protocols (G stands for Gigabit). MII-G-RT sub-module
> > +      represented as a SysCon.
> > +
> > +    type: object
> > +
> > +    properties:
> > +      compatible:
> > +        items:
> > +          - const: ti,pruss-mii-g
> > +          - const: syscon
> > +
> > +      reg:
> > +        maxItems: 1
> > +
> > +  interrupt-controller:
> > +    description: |
> > +      PRUSS INTC Node. Each PRUSS has a single interrupt controller instance
> > +      that is common to all the PRU cores. This should be represented as an
> > +      interrupt-controller node. The bindings for this shall be defined in
> > +      ../../interrupt-controller/ti,pruss-intc.yaml.
>
> Use $ref to reference the schema.

The problem is that the mentioned binding is not merged yet. Is it ok
for you to leave it as is and update once
../../interrupt-controller/ti,pruss-intc.yam get merged?

>
>
> > +
> > +    type: object
> > +
> > +  mdio:
> > +    description: |
> > +      MDIO Node. Each PRUSS has an MDIO module that can be used to control
> > +      external PHYs. The MDIO module used within the PRU-ICSS is an instance of
> > +      the MDIO Controller used in TI Davinci SoCs.
> > +
> > +    allOf:
> > +      - $ref: /schemas/net/ti,davinci-mdio.yaml#
> > +
> > +    type: object
> > +
> > +patternProperties:
> > +  "^(pru|rtu|txpru)@[0-9a-f]+$":
> > +    description: |
> > +      PRU Node. Each PRUSS has dual PRU cores, each represented as a RemoteProc
> > +      device through a PRU child node each. Each node can optionally be rendered
> > +      inactive by using the standard DT string property, "status". The ICSSG IP
> > +      present on K3 SoCs have additional auxiliary PRU cores with slightly
> > +      different IP integration. The bindings for this shall be defined in
> > +      ../../remoteproc/ti,pru-rproc.yaml
> > +
> > +    type: object
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - ranges
> > +
> > +# Due to inability of correctly verifying sub-nodes with an @address through
> > +# the "required" list, the required sub-nodes below are commented out for now.
> > +
> > +#required:
> > +# - memories
> > +# - interrupt-controller
> > +# - pru
>
> Add:
>
> additionalProperties: false

Ok.

>
>
> > +
> > +if:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - ti,k2g-pruss
> > +          - ti,am654-icssg
> > +          - ti,j721e-icssg
> > +then:
> > +  required:
> > +    - power-domains
> > +
> > +examples:
> > +  - |
> > +
> > +    /* Example 1 AM33xx PRU-ICSS */
> > +    pruss: pruss@0 {
> > +        compatible = "ti,am3356-pruss";
> > +        reg = <0x0 0x80000>;
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +        ranges;
>
> I would have expected a warning on this since you defined it to have 1
> entry.

I've double checked with dt_binding_check - there is no warning. For
ranges maxItems: 1 is defined.

Thank you for your review,
Grzegorz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add TI PRUSS platform driver
  2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
                   ` (6 preceding siblings ...)
  2020-08-02 11:53 ` [PATCH 0/6] Add TI PRUSS platform driver Pavel Machek
@ 2020-08-20 14:43 ` Suman Anna
  2020-08-20 16:27   ` santosh.shilimkar
  7 siblings, 1 reply; 14+ messages in thread
From: Suman Anna @ 2020-08-20 14:43 UTC (permalink / raw)
  To: Grzegorz Jaszczyk, ssantosh, Tony Lindgren
  Cc: devicetree, praneeth, santosh.shilimkar, linux-kernel, robh+dt,
	linux-omap, lee.jones, linux-arm-kernel

Hi Santosh, Tony,

On 7/29/20 6:02 AM, Grzegorz Jaszczyk wrote:
> Hi,
> 
> The Programmable Real-Time Unit and Industrial Communication Subsystem
> (PRU-ICSS) is present on various TI SoCs. The IP is present on multiple TI SoC
> architecture families including the OMAP architecture SoCs such as AM33xx,
> AM437x and AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is also
> present on the Davinci based OMAPL138 SoCs and K3 architecture based AM65x and
> J721E SoCs as well.
> 
> A PRUSS consists of dual 32-bit RISC cores (Programmable Real-Time Units, or
> PRUs), shared RAM, data and instruction RAMs, some internal peripheral modules
> to facilitate industrial communication, and an interrupt controller.
> 
> The programmable nature of the PRUs provide flexibility to implement custom
> peripheral interfaces, fast real-time responses, or specialized data handling.
> The common peripheral modules include the following,
>   - an Ethernet MII_RT module with two MII ports
>   - an MDIO port to control external Ethernet PHYs
>   - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
>     Ethernet functions
>   - an Enhanced Capture Module (eCAP)
>   - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
>   - a 16550-compatible UART to support PROFIBUS
>   - Enhanced GPIO with async capture and serial support
> 
> 
> A typical usage scenario would be to load the application firmware into one or
> more of the PRU cores, initialize one or more of the peripherals and perform I/O
> through shared RAM from either a kernel driver or directly from userspace.
> 
> This series contains the PRUSS platform driver. This is the parent driver for
> the entire PRUSS and is used for managing the subsystem level resources like
> various memories and the CFG module.  It is responsible for the creation and
> deletion of the platform devices for the child PRU devices and other child
> devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
> they can be managed by specific platform drivers.
> 
> Grzegorz Jaszczyk (1):
>   dt-bindings: soc: ti: Add TI PRUSS bindings
> 
> Suman Anna (5):
>   soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs
>   soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs
>   soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs
>   soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC
>   soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs

Do you have any comments on the driver portions of this series before Greg posts
a v2 addressing the binding comments. This is one of the foundation series
towards enabling PRUSS, and is a dependency for the PRU remoteproc driver.

regards
Suman

> 
>  .../devicetree/bindings/soc/ti/ti,pruss.yaml       | 383 +++++++++++++++++++++
>  drivers/soc/ti/Kconfig                             |  11 +
>  drivers/soc/ti/Makefile                            |   1 +
>  drivers/soc/ti/pruss.c                             | 183 ++++++++++
>  include/linux/pruss_driver.h                       |  48 +++
>  5 files changed, 626 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
>  create mode 100644 drivers/soc/ti/pruss.c
>  create mode 100644 include/linux/pruss_driver.h
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add TI PRUSS platform driver
  2020-08-20 14:43 ` Suman Anna
@ 2020-08-20 16:27   ` santosh.shilimkar
  0 siblings, 0 replies; 14+ messages in thread
From: santosh.shilimkar @ 2020-08-20 16:27 UTC (permalink / raw)
  To: Suman Anna, Grzegorz Jaszczyk, ssantosh, Tony Lindgren
  Cc: devicetree, praneeth, linux-kernel, robh+dt, linux-omap,
	lee.jones, linux-arm-kernel

On 8/20/20 7:43 AM, Suman Anna wrote:
> Hi Santosh, Tony,
> 
> On 7/29/20 6:02 AM, Grzegorz Jaszczyk wrote:
>> Hi,
>>
>> The Programmable Real-Time Unit and Industrial Communication Subsystem
>> (PRU-ICSS) is present on various TI SoCs. The IP is present on multiple TI SoC
>> architecture families including the OMAP architecture SoCs such as AM33xx,
>> AM437x and AM57xx; and on a Keystone 2 architecture based 66AK2G SoC. It is also
>> present on the Davinci based OMAPL138 SoCs and K3 architecture based AM65x and
>> J721E SoCs as well.
>>
>> A PRUSS consists of dual 32-bit RISC cores (Programmable Real-Time Units, or
>> PRUs), shared RAM, data and instruction RAMs, some internal peripheral modules
>> to facilitate industrial communication, and an interrupt controller.
>>
>> The programmable nature of the PRUs provide flexibility to implement custom
>> peripheral interfaces, fast real-time responses, or specialized data handling.
>> The common peripheral modules include the following,
>>    - an Ethernet MII_RT module with two MII ports
>>    - an MDIO port to control external Ethernet PHYs
>>    - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial
>>      Ethernet functions
>>    - an Enhanced Capture Module (eCAP)
>>    - an Industrial Ethernet Timer with 7/9 capture and 16 compare events
>>    - a 16550-compatible UART to support PROFIBUS
>>    - Enhanced GPIO with async capture and serial support
>>
>>
>> A typical usage scenario would be to load the application firmware into one or
>> more of the PRU cores, initialize one or more of the peripherals and perform I/O
>> through shared RAM from either a kernel driver or directly from userspace.
>>
>> This series contains the PRUSS platform driver. This is the parent driver for
>> the entire PRUSS and is used for managing the subsystem level resources like
>> various memories and the CFG module.  It is responsible for the creation and
>> deletion of the platform devices for the child PRU devices and other child
>> devices (like Interrupt Controller, MDIO node and some syscon nodes) so that
>> they can be managed by specific platform drivers.
>>
>> Grzegorz Jaszczyk (1):
>>    dt-bindings: soc: ti: Add TI PRUSS bindings
>>
>> Suman Anna (5):
>>    soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs
>>    soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs
>>    soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs
>>    soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC
>>    soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs
> 
> Do you have any comments on the driver portions of this series before Greg posts
> a v2 addressing the binding comments. This is one of the foundation series
> towards enabling PRUSS, and is a dependency for the PRU remoteproc driver.
> 
No just post V2 addressing Rob's comment. I will line it up once
rob acks it.

Regards,
Santosh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-08-20 16:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 11:02 [PATCH 0/6] Add TI PRUSS platform driver Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 1/6] dt-bindings: soc: ti: Add TI PRUSS bindings Grzegorz Jaszczyk
2020-08-17 21:14   ` Rob Herring
2020-08-18 22:07     ` Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 2/6] soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 3/6] soc: ti: pruss: Add support for PRU-ICSSs on AM437x SoCs Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 4/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on AM57xx SoCs Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 5/6] soc: ti: pruss: Add support for PRU-ICSS subsystems on 66AK2G SoC Grzegorz Jaszczyk
2020-07-29 11:02 ` [PATCH 6/6] soc: ti: pruss: enable support for ICSSG subsystems on K3 AM65x SoCs Grzegorz Jaszczyk
2020-08-02 11:53 ` [PATCH 0/6] Add TI PRUSS platform driver Pavel Machek
2020-08-02 11:57   ` Pavel Machek
2020-08-02 21:41     ` Grzegorz Jaszczyk
2020-08-20 14:43 ` Suman Anna
2020-08-20 16:27   ` santosh.shilimkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).