linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver
@ 2022-04-06  9:43 Puranjay Mohan
  2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
                   ` (12 more replies)
  0 siblings, 13 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

Hi Everyone,

This series includes three separate patch series which are supposed to be
applied to three different trees, remoteproc, soc, and net respectively
These are the three series in sequence:-
1. Introduce PRU remoteproc consumer API (5 Patches)
2. Introduce PRU platform consumer API (6 Patches)
3. Introduce ICSSG based ethernet Driver (2 Patches)

I am sending all three series together as RFC because
2nd depends on 1st and 3rd depends on both 1st and 2nd.
Once I have received the comments on this, I will send these series
separately to their respective trees.

The 1st series is the v3 of [1], which had some checkpatch errors,
that have been corrected in v3(this).
The 2nd series is the v2 of [2], It has no functional changes.

[1] https://patchwork.kernel.org/project/linux-remoteproc/cover/20201216165239.2744-1-grzegorz.jaszczyk@linaro.org/
[2] https://patchwork.kernel.org/project/linux-remoteproc/cover/20201211184811.6490-1-grzegorz.jaszczyk@linaro.org/

Now, I am adding the cover letters and details about the individual series

1. Introduce PRU remoteproc consumer API

The Programmable Real-Time Unit and Industrial Communication Subsystem
(PRU-ICSS or simply PRUSS) on various TI SoCs consists of dual 32-bit
RISC cores (Programmable Real-Time Units, or PRUs) for program execution.

There are 3 foundation components for PRUSS subsystem: the PRUSS platform
driver, the PRUSS INTC driver and the PRUSS remoteproc driver. All were
already merged and can be found under:
1) drivers/soc/ti/pruss.c
   Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
2) drivers/irqchip/irq-pruss-intc.c
   Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.yaml
3) drivers/remoteproc/pru_rproc.c
   Documentation/devicetree/bindings/remoteproc/ti,pru-rproc.yaml

The programmable nature of the PRUs provide flexibility to implement custom
peripheral interfaces, fast real-time responses, or specialized data handling.
Example of a PRU consumer drivers will be:
  - Software UART over PRUSS
  - PRU-ICSS Ethernet EMAC

In order to make usage of common PRU resources and allow the consumer drivers to
configure the PRU hardware for specific usage the PRU API is introduced.

Roger Quadros (1):
  remoteproc: pru: Add pru_rproc_set_ctable() function

Suman Anna (2):
  dt-bindings: remoteproc: Add PRU consumer bindings
  remoteproc: pru: Make sysfs entries read-only for PRU client driven
    boots

Tero Kristo (2):
  remoteproc: pru: Add APIs to get and put the PRU cores
  remoteproc: pru: Configure firmware based on client setup


2. Introduce PRU platform consumer API

The Programmable Real-Time Unit and Industrial Communication Subsystem (PRU-ICSS
or simply PRUSS) on various TI SoCs consists of dual 32-bit RISC cores
(Programmable Real-Time Units, or PRUs) for program execution.

There are 3 foundation components for TI PRUSS subsystem: the PRUSS platform
driver, the PRUSS INTC driver and the PRUSS remoteproc driver.

The programmable nature of the PRUs provide flexibility to implement custom
peripheral interfaces, fast real-time responses, or specialized data handling.
Example of a PRU consumer drivers will be:
  - Software UART over PRUSS
  - PRU-ICSS Ethernet EMAC

In order to make usage of common PRU resources and allow the consumer drivers to
configure the PRU hardware for specific usage the PRU API is introduced.

Andrew F. Davis (1):
  soc: ti: pruss: Add pruss_{request,release}_mem_region() API

Suman Anna (3):
  soc: ti: pruss: Add pruss_cfg_read()/update() API
  soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and
    XFR
  soc: ti: pruss: Add helper function to enable OCP master ports

Tero Kristo (2):
  soc: ti: pruss: Add pruss_get()/put() API
  soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX


3. Introduce ICSSG based ethernet Driver

The Programmable Real-time Unit and Industrial Communication Subsystem
Gigabit (PRU_ICSSG) is a low-latency microcontroller subsystem in the TI
SoCs. This subsystem is provided for the use cases like implementation of
custom peripheral interfaces, offloading of tasks from the other
processor cores of the SoC, etc.

The subsystem includes many accelerators for data processing like
multiplier and multiplier-accumulator. It also has peripherals like
UART, MII/RGMII, MDIO, etc. Every ICSSG core includes two 32-bit
load/store RISC CPU cores called PRUs.

The above features allow it to be used for implementing custom firmware
based peripherals like ethernet.

This series adds the YAML documentation and the driver with basic EMAC
support for TI AM654 Silicon Rev 2 SoC with the PRU_ICSSG Sub-system.
running dual-EMAC firmware.
This currently supports basic EMAC with 1Gbps and 100Mbps link. 10M and
half-duplex modes are not yet supported because they require the support
of an IEP, which will be added later.
Advanced features like switch-dev and timestamping will be added later.

Puranjay Mohan (1):
  dt-bindings: net: Add ICSSG Ethernet Driver bindings

Roger Quadros (1):
  net: ti: icssg-prueth: Add ICSSG ethernet driver 

 .../bindings/net/ti,icssg-prueth.yaml         |  172 ++
 .../bindings/remoteproc/ti,pru-consumer.yaml  |   66 +
 drivers/net/ethernet/ti/Kconfig               |   15 +
 drivers/net/ethernet/ti/Makefile              |    3 +
 drivers/net/ethernet/ti/icssg_classifier.c    |  375 ++++
 drivers/net/ethernet/ti/icssg_config.c        |  443 ++++
 drivers/net/ethernet/ti/icssg_config.h        |  200 ++
 drivers/net/ethernet/ti/icssg_ethtool.c       |  301 +++
 drivers/net/ethernet/ti/icssg_mii_cfg.c       |  104 +
 drivers/net/ethernet/ti/icssg_mii_rt.h        |  151 ++
 drivers/net/ethernet/ti/icssg_prueth.c        | 1891 +++++++++++++++++
 drivers/net/ethernet/ti/icssg_prueth.h        |  247 +++
 drivers/net/ethernet/ti/icssg_switch_map.h    |  183 ++
 drivers/remoteproc/pru_rproc.c                |  234 +-
 drivers/soc/ti/pruss.c                        |  257 ++-
 include/linux/pruss.h                         |  300 +++
 include/linux/pruss_driver.h                  |   72 +-
 17 files changed, 4985 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
 create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
 create mode 100644 drivers/net/ethernet/ti/icssg_classifier.c
 create mode 100644 drivers/net/ethernet/ti/icssg_config.c
 create mode 100644 drivers/net/ethernet/ti/icssg_config.h
 create mode 100644 drivers/net/ethernet/ti/icssg_ethtool.c
 create mode 100644 drivers/net/ethernet/ti/icssg_mii_cfg.c
 create mode 100644 drivers/net/ethernet/ti/icssg_mii_rt.h
 create mode 100644 drivers/net/ethernet/ti/icssg_prueth.c
 create mode 100644 drivers/net/ethernet/ti/icssg_prueth.h
 create mode 100644 drivers/net/ethernet/ti/icssg_switch_map.h
 create mode 100644 include/linux/pruss.h

-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-07 13:50   ` Rob Herring
  2022-04-07 15:09   ` Rob Herring
  2022-04-06  9:43 ` [RFC 02/13] remoteproc: pru: Add APIs to get and put the PRU cores Puranjay Mohan
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

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

Add a YAML binding document for PRU consumers. The binding includes
all the common properties that can be used by different PRU consumer
or application nodes and supported by the PRU remoteproc driver.
These are used to configure the PRU hardware for specific user
applications.

The application nodes themselves should define their own bindings.

Co-developed-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 .../bindings/remoteproc/ti,pru-consumer.yaml  | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml

diff --git a/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
new file mode 100644
index 000000000000..c245fe1de656
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/ti,pru-consumer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common TI PRU Consumer Binding
+
+maintainers:
+  - Suman Anna <s-anna@ti.com>
+
+description: |
+  A PRU application/consumer/user node typically uses one or more PRU device
+  nodes to implement a PRU application/functionality. Each application/client
+  node would need a reference to at least a PRU node, and optionally define
+  some properties needed for hardware/firmware configuration. The below
+  properties are a list of common properties supported by the PRU remoteproc
+  infrastructure.
+
+  The application nodes shall define their own bindings like regular platform
+  devices, so below are in addition to each node's bindings.
+
+properties:
+  ti,prus:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: phandles to the PRU, RTU or Tx_PRU nodes used
+
+  firmware-name:
+    $ref: /schemas/types.yaml#/definitions/string-array
+    description: |
+      firmwares for the PRU cores, the default firmware for the core from
+      the PRU node will be used if not provided. The firmware names should
+      correspond to the PRU cores listed in the 'ti,prus' property
+
+  ti,pruss-gp-mux-sel:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    maxItems: 6
+    items:
+        enum: [0, 1, 2, 3, 4]
+    description: |
+      array of values for the GP_MUX_SEL under PRUSS_GPCFG register for a PRU.
+      This selects the internal muxing scheme for the PRU instance. Values
+      should correspond to the PRU cores listed in the 'ti,prus' property. The
+      GP_MUX_SEL setting is a per-slice setting (one setting for PRU0, RTU0,
+      and Tx_PRU0 on K3 SoCs). Use the same value for all cores within the
+      same slice in the associative array. If the array size is smaller than
+      the size of 'ti,prus' property, the default out-of-reset value (0) for the
+      PRU core is used.
+
+required:
+  - ti,prus
+
+dependencies:
+  firmware-name: [ 'ti,prus' ]
+  ti,pruss-gp-mux-sel: [ 'ti,prus' ]
+
+additionalProperties: true
+
+examples:
+  - |
+    /* PRU application node example */
+    pru-app {
+        ti,prus = <&pru0>, <&pru1>;
+        firmware-name = "pruss-app-fw0", "pruss-app-fw1";
+        ti,pruss-gp-mux-sel = <2>, <1>;
+    };
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 02/13] remoteproc: pru: Add APIs to get and put the PRU cores
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
  2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Puranjay Mohan
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: Tero Kristo <t-kristo@ti.com>

Add two new APIs, pru_rproc_get() and pru_rproc_put(), to the PRU
driver to allow client drivers to acquire and release the remoteproc
device associated with a PRU core. The PRU cores are treated as
resources with only one client owning it at a time.

The pru_rproc_get() function returns the rproc handle corresponding
to a PRU core identified by the device tree "ti,prus" property under
the client node. The pru_rproc_put() is the complementary function
to pru_rproc_get().

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Co-developed-by: Puranjay Mohan <p-mohan@ti.com>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/remoteproc/pru_rproc.c | 138 +++++++++++++++++++++++++++++++--
 include/linux/pruss.h          |  56 +++++++++++++
 2 files changed, 189 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/pruss.h

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 1777a01fa84e..7a35b400287a 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -2,12 +2,13 @@
 /*
  * PRU-ICSS remoteproc driver for various TI SoCs
  *
- * Copyright (C) 2014-2020 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2014-2022 Texas Instruments Incorporated - https://www.ti.com/
  *
  * Author(s):
  *	Suman Anna <s-anna@ti.com>
  *	Andrew F. Davis <afd@ti.com>
  *	Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org> for Texas Instruments
+ *	Puranjay Mohan <p-mohan@ti.com>
  */
 
 #include <linux/bitops.h>
@@ -16,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
+#include <linux/pruss.h>
 #include <linux/pruss_driver.h>
 #include <linux/remoteproc.h>
 
@@ -111,6 +113,8 @@ struct pru_private_data {
  * @rproc: remoteproc pointer for this PRU core
  * @data: PRU core specific data
  * @mem_regions: data for each of the PRU memory regions
+ * @client_np: client device node
+ * @lock: mutex to protect client usage
  * @fw_name: name of firmware image used during loading
  * @mapped_irq: virtual interrupt numbers of created fw specific mapping
  * @pru_interrupt_map: pointer to interrupt mapping description (firmware)
@@ -126,6 +130,8 @@ struct pru_rproc {
 	struct rproc *rproc;
 	const struct pru_private_data *data;
 	struct pruss_mem_region mem_regions[PRU_IOMEM_MAX];
+	struct device_node *client_np;
+	struct mutex lock; /* client access lock */
 	const char *fw_name;
 	unsigned int *mapped_irq;
 	struct pru_irq_rsc *pru_interrupt_map;
@@ -146,6 +152,125 @@ void pru_control_write_reg(struct pru_rproc *pru, unsigned int reg, u32 val)
 	writel_relaxed(val, pru->mem_regions[PRU_IOMEM_CTRL].va + reg);
 }
 
+static struct rproc *__pru_rproc_get(struct device_node *np, int index)
+{
+	struct device_node *rproc_np = NULL;
+	struct platform_device *pdev;
+	struct rproc *rproc;
+
+	rproc_np = of_parse_phandle(np, "ti,prus", index);
+	if (!rproc_np || !of_device_is_available(rproc_np))
+		return ERR_PTR(-ENODEV);
+
+	pdev = of_find_device_by_node(rproc_np);
+	of_node_put(rproc_np);
+
+	if (!pdev || !(&pdev->dev) || !((&pdev->dev)->driver))
+		/* probably PRU not yet probed */
+		return ERR_PTR(-EPROBE_DEFER);
+
+	/* make sure it is PRU rproc */
+	if (!is_pru_rproc(&pdev->dev)) {
+		put_device(&pdev->dev);
+		return ERR_PTR(-ENODEV);
+	}
+
+	rproc = platform_get_drvdata(pdev);
+	put_device(&pdev->dev);
+	if (!rproc)
+		return ERR_PTR(-EPROBE_DEFER);
+
+	get_device(&rproc->dev);
+
+	return rproc;
+}
+
+/**
+ * pru_rproc_get() - get the PRU rproc instance from a device node
+ * @np: the user/client device node
+ * @index: index to use for the ti,prus property
+ * @pru_id: optional pointer to return the PRU remoteproc processor id
+ *
+ * This function looks through a client device node's "ti,prus" property at
+ * index @index and returns the rproc handle for a valid PRU remote processor if
+ * found. The function allows only one user to own the PRU rproc resource at a
+ * time. Caller must call pru_rproc_put() when done with using the rproc, not
+ * required if the function returns a failure.
+ *
+ * When optional @pru_id pointer is passed the PRU remoteproc processor id is
+ * returned.
+ *
+ * Return: rproc handle on success, and an ERR_PTR on failure using one
+ * of the following error values
+ *    -ENODEV if device is not found
+ *    -EBUSY if PRU is already acquired by anyone
+ *    -EPROBE_DEFER is PRU device is not probed yet
+ */
+struct rproc *pru_rproc_get(struct device_node *np, int index,
+			    enum pruss_pru_id *pru_id)
+{
+	struct rproc *rproc;
+	struct pru_rproc *pru;
+	struct device *dev;
+
+	try_module_get(THIS_MODULE);
+
+	rproc = __pru_rproc_get(np, index);
+	if (IS_ERR(rproc))
+		return rproc;
+
+	pru = rproc->priv;
+	dev = &rproc->dev;
+
+	mutex_lock(&pru->lock);
+
+	if (pru->client_np) {
+		mutex_unlock(&pru->lock);
+		put_device(dev);
+		return ERR_PTR(-EBUSY);
+	}
+
+	pru->client_np = np;
+
+	mutex_unlock(&pru->lock);
+
+	if (pru_id)
+		*pru_id = pru->id;
+
+	return rproc;
+}
+EXPORT_SYMBOL_GPL(pru_rproc_get);
+
+/**
+ * pru_rproc_put() - release the PRU rproc resource
+ * @rproc: the rproc resource to release
+ *
+ * Releases the PRU rproc resource and makes it available to other
+ * users.
+ */
+void pru_rproc_put(struct rproc *rproc)
+{
+	struct pru_rproc *pru;
+
+	if (IS_ERR_OR_NULL(rproc) || !is_pru_rproc(rproc->dev.parent))
+		return;
+
+	pru = rproc->priv;
+
+	mutex_lock(&pru->lock);
+
+	if (!pru->client_np) {
+		mutex_unlock(&pru->lock);
+		return;
+	}
+
+	pru->client_np = NULL;
+	mutex_unlock(&pru->lock);
+
+	put_device(&rproc->dev);
+}
+EXPORT_SYMBOL_GPL(pru_rproc_put);
+
 static inline u32 pru_debug_read_reg(struct pru_rproc *pru, unsigned int reg)
 {
 	return readl_relaxed(pru->mem_regions[PRU_IOMEM_DEBUG].va + reg);
@@ -438,7 +563,7 @@ static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
 	dram0 = pruss->mem_regions[PRUSS_MEM_DRAM0];
 	dram1 = pruss->mem_regions[PRUSS_MEM_DRAM1];
 	/* PRU1 has its local RAM addresses reversed */
-	if (pru->id == 1)
+	if (pru->id == PRUSS_PRU1)
 		swap(dram0, dram1);
 	shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
 
@@ -747,14 +872,14 @@ static int pru_rproc_set_id(struct pru_rproc *pru)
 	case RTU0_IRAM_ADDR_MASK:
 		fallthrough;
 	case PRU0_IRAM_ADDR_MASK:
-		pru->id = 0;
+		pru->id = PRUSS_PRU0;
 		break;
 	case TX_PRU1_IRAM_ADDR_MASK:
 		fallthrough;
 	case RTU1_IRAM_ADDR_MASK:
 		fallthrough;
 	case PRU1_IRAM_ADDR_MASK:
-		pru->id = 1;
+		pru->id = PRUSS_PRU1;
 		break;
 	default:
 		ret = -EINVAL;
@@ -816,6 +941,8 @@ static int pru_rproc_probe(struct platform_device *pdev)
 	pru->pruss = platform_get_drvdata(ppdev);
 	pru->rproc = rproc;
 	pru->fw_name = fw_name;
+	pru->client_np = NULL;
+	mutex_init(&pru->lock);
 
 	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
 		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -903,7 +1030,7 @@ MODULE_DEVICE_TABLE(of, pru_rproc_match);
 
 static struct platform_driver pru_rproc_driver = {
 	.driver = {
-		.name   = "pru-rproc",
+		.name   = PRU_RPROC_DRVNAME,
 		.of_match_table = pru_rproc_match,
 		.suppress_bind_attrs = true,
 	},
@@ -915,5 +1042,6 @@ module_platform_driver(pru_rproc_driver);
 MODULE_AUTHOR("Suman Anna <s-anna@ti.com>");
 MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
 MODULE_AUTHOR("Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>");
+MODULE_AUTHOR("Puranjay Mohan <p-mohan@ti.com>");
 MODULE_DESCRIPTION("PRU-ICSS Remote Processor Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
new file mode 100644
index 000000000000..fdc719b43db0
--- /dev/null
+++ b/include/linux/pruss.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/**
+ * PRU-ICSS Subsystem user interfaces
+ *
+ * Copyright (C) 2015-2022 Texas Instruments Incorporated - http://www.ti.com
+ *	Suman Anna <s-anna@ti.com>
+ */
+
+#ifndef __LINUX_PRUSS_H
+#define __LINUX_PRUSS_H
+
+#include <linux/device.h>
+#include <linux/types.h>
+
+#define PRU_RPROC_DRVNAME "pru-rproc"
+
+/*
+ * enum pruss_pru_id - PRU core identifiers
+ */
+enum pruss_pru_id {
+	PRUSS_PRU0 = 0,
+	PRUSS_PRU1,
+	PRUSS_NUM_PRUS,
+};
+
+struct device_node;
+
+#if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
+
+struct rproc *pru_rproc_get(struct device_node *np, int index,
+			    enum pruss_pru_id *pru_id);
+void pru_rproc_put(struct rproc *rproc);
+
+#else
+
+static inline struct rproc *
+pru_rproc_get(struct device_node *np, int index, enum pruss_pru_id *pru_id)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void pru_rproc_put(struct rproc *rproc) { }
+
+#endif /* CONFIG_PRU_REMOTEPROC */
+
+static inline bool is_pru_rproc(struct device *dev)
+{
+	const char *drv_name = dev_driver_string(dev);
+
+	if (strncmp(drv_name, PRU_RPROC_DRVNAME, sizeof(PRU_RPROC_DRVNAME)))
+		return false;
+
+	return true;
+}
+
+#endif /* __LINUX_PRUSS_H */
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
  2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
  2022-04-06  9:43 ` [RFC 02/13] remoteproc: pru: Add APIs to get and put the PRU cores Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 04/13] remoteproc: pru: Add pru_rproc_set_ctable() function Puranjay Mohan
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

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

The PRU remoteproc driver is not configured for 'auto-boot' by default,
and allows to be booted either by in-kernel PRU client drivers or by
userspace using the generic remoteproc sysfs interfaces. The sysfs
interfaces should not be permitted to change the remoteproc firmwares
or states when a PRU is being managed by an in-kernel client driver.
Use the newly introduced remoteproc generic 'sysfs_read_only' flag to
provide these restrictions by setting and clearing it appropriately
during the PRU acquire and release steps.

Signed-off-by: Suman Anna <s-anna@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/remoteproc/pru_rproc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 7a35b400287a..9fed3e0372d3 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -231,6 +231,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
 	}
 
 	pru->client_np = np;
+	rproc->sysfs_read_only = true;
 
 	mutex_unlock(&pru->lock);
 
@@ -265,6 +266,7 @@ void pru_rproc_put(struct rproc *rproc)
 	}
 
 	pru->client_np = NULL;
+	rproc->sysfs_read_only = false;
 	mutex_unlock(&pru->lock);
 
 	put_device(&rproc->dev);
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 04/13] remoteproc: pru: Add pru_rproc_set_ctable() function
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (2 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 05/13] remoteproc: pru: Configure firmware based on client setup Puranjay Mohan
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: Roger Quadros <rogerq@ti.com>

Some firmwares expect the OS drivers to configure the CTABLE
entries publishing dynamically allocated memory regions. For
example, the PRU Ethernet firmwares use the C28 and C30 entries
for retrieving the Shared RAM and System SRAM (OCMC) areas
allocated by the PRU Ethernet client driver.

Provide a way for users to do that through a new API,
pru_rproc_set_ctable(). The API returns 0 on success and
a negative value on error.

NOTE:
The programmable CTABLE entries are typically re-programmed by
the PRU firmwares when dealing with a certain block of memory
during block processing. This API provides an interface to the
PRU client drivers to publish a dynamically allocated memory
block with the PRU firmware using a CTABLE entry instead of a
negotiated address in shared memory. Additional synchronization
may be needed between the PRU client drivers and firmwares if
different addresses needs to be published at run-time reusing
the same CTABLE entry.

Co-developed-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/remoteproc/pru_rproc.c | 59 ++++++++++++++++++++++++++++++++++
 include/linux/pruss.h          | 22 +++++++++++++
 2 files changed, 81 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 9fed3e0372d3..d06b763e995e 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -119,6 +119,7 @@ struct pru_private_data {
  * @mapped_irq: virtual interrupt numbers of created fw specific mapping
  * @pru_interrupt_map: pointer to interrupt mapping description (firmware)
  * @pru_interrupt_map_sz: pru_interrupt_map size
+ * @rmw_lock: lock for read, modify, write operations on registers
  * @dbg_single_step: debug state variable to set PRU into single step mode
  * @dbg_continuous: debug state variable to restore PRU execution mode
  * @evt_count: number of mapped events
@@ -136,6 +137,7 @@ struct pru_rproc {
 	unsigned int *mapped_irq;
 	struct pru_irq_rsc *pru_interrupt_map;
 	size_t pru_interrupt_map_sz;
+	spinlock_t rmw_lock; /* register access lock */
 	u32 dbg_single_step;
 	u32 dbg_continuous;
 	u8 evt_count;
@@ -152,6 +154,23 @@ void pru_control_write_reg(struct pru_rproc *pru, unsigned int reg, u32 val)
 	writel_relaxed(val, pru->mem_regions[PRU_IOMEM_CTRL].va + reg);
 }
 
+static inline
+void pru_control_set_reg(struct pru_rproc *pru, unsigned int reg,
+			 u32 mask, u32 set)
+{
+	u32 val;
+	unsigned long flags;
+
+	spin_lock_irqsave(&pru->rmw_lock, flags);
+
+	val = pru_control_read_reg(pru, reg);
+	val &= ~mask;
+	val |= (set & mask);
+	pru_control_write_reg(pru, reg, val);
+
+	spin_unlock_irqrestore(&pru->rmw_lock, flags);
+}
+
 static struct rproc *__pru_rproc_get(struct device_node *np, int index)
 {
 	struct device_node *rproc_np = NULL;
@@ -273,6 +292,45 @@ void pru_rproc_put(struct rproc *rproc)
 }
 EXPORT_SYMBOL_GPL(pru_rproc_put);
 
+/**
+ * pru_rproc_set_ctable() - set the constant table index for the PRU
+ * @rproc: the rproc instance of the PRU
+ * @c: constant table index to set
+ * @addr: physical address to set it to
+ *
+ * Return: 0 on success, or errno in error case.
+ */
+int pru_rproc_set_ctable(struct rproc *rproc, enum pru_ctable_idx c, u32 addr)
+{
+	struct pru_rproc *pru = rproc->priv;
+	unsigned int reg;
+	u32 mask, set;
+	u16 idx;
+	u16 idx_mask;
+
+	if (IS_ERR_OR_NULL(rproc))
+		return -EINVAL;
+
+	if (!rproc->dev.parent || !is_pru_rproc(rproc->dev.parent))
+		return -ENODEV;
+
+	/* pointer is 16 bit and index is 8-bit so mask out the rest */
+	idx_mask = (c >= PRU_C28) ? 0xFFFF : 0xFF;
+
+	/* ctable uses bit 8 and upwards only */
+	idx = (addr >> 8) & idx_mask;
+
+	/* configurable ctable (i.e. C24) starts at PRU_CTRL_CTBIR0 */
+	reg = PRU_CTRL_CTBIR0 + 4 * (c >> 1);
+	mask = idx_mask << (16 * (c & 1));
+	set = idx << (16 * (c & 1));
+
+	pru_control_set_reg(pru, reg, mask, set);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(pru_rproc_set_ctable);
+
 static inline u32 pru_debug_read_reg(struct pru_rproc *pru, unsigned int reg)
 {
 	return readl_relaxed(pru->mem_regions[PRU_IOMEM_DEBUG].va + reg);
@@ -944,6 +1002,7 @@ static int pru_rproc_probe(struct platform_device *pdev)
 	pru->rproc = rproc;
 	pru->fw_name = fw_name;
 	pru->client_np = NULL;
+	spin_lock_init(&pru->rmw_lock);
 	mutex_init(&pru->lock);
 
 	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index fdc719b43db0..d830e20056c7 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -23,13 +23,29 @@ enum pruss_pru_id {
 	PRUSS_NUM_PRUS,
 };
 
+/*
+ * enum pru_ctable_idx - Configurable Constant table index identifiers
+ */
+enum pru_ctable_idx {
+	PRU_C24 = 0,
+	PRU_C25,
+	PRU_C26,
+	PRU_C27,
+	PRU_C28,
+	PRU_C29,
+	PRU_C30,
+	PRU_C31,
+};
+
 struct device_node;
+struct rproc;
 
 #if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
 
 struct rproc *pru_rproc_get(struct device_node *np, int index,
 			    enum pruss_pru_id *pru_id);
 void pru_rproc_put(struct rproc *rproc);
+int pru_rproc_set_ctable(struct rproc *rproc, enum pru_ctable_idx c, u32 addr);
 
 #else
 
@@ -41,6 +57,12 @@ pru_rproc_get(struct device_node *np, int index, enum pruss_pru_id *pru_id)
 
 static inline void pru_rproc_put(struct rproc *rproc) { }
 
+static inline int pru_rproc_set_ctable(struct rproc *rproc,
+				       enum pru_ctable_idx c, u32 addr)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif /* CONFIG_PRU_REMOTEPROC */
 
 static inline bool is_pru_rproc(struct device *dev)
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 05/13] remoteproc: pru: Configure firmware based on client setup
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (3 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 04/13] remoteproc: pru: Add pru_rproc_set_ctable() function Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 06/13] soc: ti: pruss: Add pruss_get()/put() API Puranjay Mohan
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: Tero Kristo <t-kristo@ti.com>

Client device node property firmware-name is now used to configure
firmware for the PRU instances. The default firmware is also
restored once releasing the PRU resource.

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/remoteproc/pru_rproc.c | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index d06b763e995e..2977eb50631b 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -171,6 +171,23 @@ void pru_control_set_reg(struct pru_rproc *pru, unsigned int reg,
 	spin_unlock_irqrestore(&pru->rmw_lock, flags);
 }
 
+/**
+ * pru_rproc_set_firmware() - set firmware for a pru core
+ * @rproc: the rproc instance of the PRU
+ * @fw_name: the new firmware name, or NULL if default is desired
+ *
+ * Return: 0 on success, or errno in error case.
+ */
+static int pru_rproc_set_firmware(struct rproc *rproc, const char *fw_name)
+{
+	struct pru_rproc *pru = rproc->priv;
+
+	if (!fw_name)
+		fw_name = pru->fw_name;
+
+	return rproc_set_firmware(rproc, fw_name);
+}
+
 static struct rproc *__pru_rproc_get(struct device_node *np, int index)
 {
 	struct device_node *rproc_np = NULL;
@@ -231,6 +248,8 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
 	struct rproc *rproc;
 	struct pru_rproc *pru;
 	struct device *dev;
+	const char *fw_name;
+	int ret;
 
 	try_module_get(THIS_MODULE);
 
@@ -257,7 +276,21 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
 	if (pru_id)
 		*pru_id = pru->id;
 
+	ret = of_property_read_string_index(np, "firmware-name", index,
+					    &fw_name);
+	if (!ret) {
+		ret = pru_rproc_set_firmware(rproc, fw_name);
+		if (ret) {
+			dev_err(dev, "failed to set firmware: %d\n", ret);
+			goto err;
+		}
+	}
+
 	return rproc;
+
+err:
+	pru_rproc_put(rproc);
+	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(pru_rproc_get);
 
@@ -277,6 +310,8 @@ void pru_rproc_put(struct rproc *rproc)
 
 	pru = rproc->priv;
 
+	pru_rproc_set_firmware(rproc, NULL);
+
 	mutex_lock(&pru->lock);
 
 	if (!pru->client_np) {
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 06/13] soc: ti: pruss: Add pruss_get()/put() API
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (4 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 05/13] remoteproc: pru: Configure firmware based on client setup Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 07/13] soc: ti: pruss: Add pruss_{request, release}_mem_region() API Puranjay Mohan
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: Tero Kristo <t-kristo@ti.com>

Add two new get and put API, pruss_get() and pruss_put() to the
PRUSS platform driver to allow client drivers to request a handle
to a PRUSS device. This handle will be used by client drivers to
request various operations of the PRUSS platform driver through
additional API that will be added in the following patches.

The pruss_get() function returns the pruss handle corresponding
to a PRUSS device referenced by a PRU remoteproc instance. The
pruss_put() is the complimentary function to pruss_get().

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/soc/ti/pruss.c       | 58 ++++++++++++++++++++++++++++++++++++
 include/linux/pruss.h        | 19 ++++++++++++
 include/linux/pruss_driver.h |  1 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index b36779309e49..5ad62c35da5d 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -6,6 +6,7 @@
  * Author(s):
  *	Suman Anna <s-anna@ti.com>
  *	Andrew F. Davis <afd@ti.com>
+ *	Tero Kristo <t-kristo@ti.com>
  */
 
 #include <linux/clk-provider.h>
@@ -18,6 +19,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/pruss_driver.h>
 #include <linux/regmap.h>
+#include <linux/remoteproc.h>
 #include <linux/slab.h>
 
 /**
@@ -30,6 +32,62 @@ struct pruss_private_data {
 	bool has_core_mux_clock;
 };
 
+/**
+ * pruss_get() - get the pruss for a given PRU remoteproc
+ * @rproc: remoteproc handle of a PRU instance
+ *
+ * Finds the parent pruss device for a PRU given the @rproc handle of the
+ * PRU remote processor. This function increments the pruss device's refcount,
+ * so always use pruss_put() to decrement it back once pruss isn't needed
+ * anymore.
+ *
+ * Return: pruss handle on success, and an ERR_PTR on failure using one
+ * of the following error values
+ *    -EINVAL if invalid parameter
+ *    -ENODEV if PRU device or PRUSS device is not found
+ */
+struct pruss *pruss_get(struct rproc *rproc)
+{
+	struct pruss *pruss;
+	struct device *dev;
+	struct platform_device *ppdev;
+
+	if (IS_ERR_OR_NULL(rproc))
+		return ERR_PTR(-EINVAL);
+
+	dev = &rproc->dev;
+
+	/* make sure it is PRU rproc */
+	if (!dev->parent || !is_pru_rproc(dev->parent))
+		return ERR_PTR(-ENODEV);
+
+	ppdev = to_platform_device(dev->parent->parent);
+	pruss = platform_get_drvdata(ppdev);
+	if (!pruss)
+		return ERR_PTR(-ENODEV);
+
+	get_device(pruss->dev);
+
+	return pruss;
+}
+EXPORT_SYMBOL_GPL(pruss_get);
+
+/**
+ * pruss_put() - decrement pruss device's usecount
+ * @pruss: pruss handle
+ *
+ * Complimentary function for pruss_get(). Needs to be called
+ * after the PRUSS is used, and only if the pruss_get() succeeds.
+ */
+void pruss_put(struct pruss *pruss)
+{
+	if (IS_ERR_OR_NULL(pruss))
+		return;
+
+	put_device(pruss->dev);
+}
+EXPORT_SYMBOL_GPL(pruss_put);
+
 static void pruss_of_free_clk_provider(void *data)
 {
 	struct device_node *clk_mux_np = data;
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index d830e20056c7..23d556e0dd72 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -4,12 +4,14 @@
  *
  * Copyright (C) 2015-2022 Texas Instruments Incorporated - http://www.ti.com
  *	Suman Anna <s-anna@ti.com>
+ *	Tero Kristo <t-kristo@ti.com>
  */
 
 #ifndef __LINUX_PRUSS_H
 #define __LINUX_PRUSS_H
 
 #include <linux/device.h>
+#include <linux/err.h>
 #include <linux/types.h>
 
 #define PRU_RPROC_DRVNAME "pru-rproc"
@@ -39,6 +41,23 @@ enum pru_ctable_idx {
 
 struct device_node;
 struct rproc;
+struct pruss;
+
+#if IS_ENABLED(CONFIG_TI_PRUSS)
+
+struct pruss *pruss_get(struct rproc *rproc);
+void pruss_put(struct pruss *pruss);
+
+#else
+
+static inline struct pruss *pruss_get(struct rproc *rproc)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
+static inline void pruss_put(struct pruss *pruss) { }
+
+#endif /* CONFIG_TI_PRUSS */
 
 #if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
 
diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
index ecfded30ed05..d054d2179d82 100644
--- a/include/linux/pruss_driver.h
+++ b/include/linux/pruss_driver.h
@@ -9,6 +9,7 @@
 #ifndef _PRUSS_DRIVER_H_
 #define _PRUSS_DRIVER_H_
 
+#include <linux/pruss.h>
 #include <linux/types.h>
 
 /*
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 07/13] soc: ti: pruss: Add pruss_{request, release}_mem_region() API
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (5 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 06/13] soc: ti: pruss: Add pruss_get()/put() API Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 08/13] soc: ti: pruss: Add pruss_cfg_read()/update() API Puranjay Mohan
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: "Andrew F. Davis" <afd@ti.com>

Add two new API - pruss_request_mem_region() & pruss_release_mem_region(),
to the PRUSS platform driver to allow client drivers to acquire and release
the common memory resources present within a PRU-ICSS subsystem. This
allows the client drivers to directly manipulate the respective memories,
as per their design contract with the associated firmware.

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/soc/ti/pruss.c       | 77 ++++++++++++++++++++++++++++++++++++
 include/linux/pruss.h        | 39 ++++++++++++++++++
 include/linux/pruss_driver.h | 27 +++----------
 3 files changed, 121 insertions(+), 22 deletions(-)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 5ad62c35da5d..bda920662de2 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -88,6 +88,82 @@ void pruss_put(struct pruss *pruss)
 }
 EXPORT_SYMBOL_GPL(pruss_put);
 
+/**
+ * pruss_request_mem_region() - request a memory resource
+ * @pruss: the pruss instance
+ * @mem_id: the memory resource id
+ * @region: pointer to memory region structure to be filled in
+ *
+ * This function allows a client driver to request a memory resource,
+ * and if successful, will let the client driver own the particular
+ * memory region until released using the pruss_release_mem_region()
+ * API.
+ *
+ * Return: 0 if requested memory region is available (in such case pointer to
+ * memory region is returned via @region), an error otherwise
+ */
+int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
+			     struct pruss_mem_region *region)
+{
+	if (!pruss || !region || mem_id >= PRUSS_MEM_MAX)
+		return -EINVAL;
+
+	mutex_lock(&pruss->lock);
+
+	if (pruss->mem_in_use[mem_id]) {
+		mutex_unlock(&pruss->lock);
+		return -EBUSY;
+	}
+
+	*region = pruss->mem_regions[mem_id];
+	pruss->mem_in_use[mem_id] = region;
+
+	mutex_unlock(&pruss->lock);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(pruss_request_mem_region);
+
+/**
+ * pruss_release_mem_region() - release a memory resource
+ * @pruss: the pruss instance
+ * @region: the memory region to release
+ *
+ * This function is the complimentary function to
+ * pruss_request_mem_region(), and allows the client drivers to
+ * release back a memory resource.
+ *
+ * Return: 0 on success, an error code otherwise
+ */
+int pruss_release_mem_region(struct pruss *pruss,
+			     struct pruss_mem_region *region)
+{
+	int id;
+
+	if (!pruss || !region)
+		return -EINVAL;
+
+	mutex_lock(&pruss->lock);
+
+	/* find out the memory region being released */
+	for (id = 0; id < PRUSS_MEM_MAX; id++) {
+		if (pruss->mem_in_use[id] == region)
+			break;
+	}
+
+	if (id == PRUSS_MEM_MAX) {
+		mutex_unlock(&pruss->lock);
+		return -EINVAL;
+	}
+
+	pruss->mem_in_use[id] = NULL;
+
+	mutex_unlock(&pruss->lock);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(pruss_release_mem_region);
+
 static void pruss_of_free_clk_provider(void *data)
 {
 	struct device_node *clk_mux_np = data;
@@ -290,6 +366,7 @@ static int pruss_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	pruss->dev = dev;
+	mutex_init(&pruss->lock);
 
 	child = of_get_child_by_name(np, "memories");
 	if (!child) {
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index 23d556e0dd72..689ef243bcbc 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -39,6 +39,28 @@ enum pru_ctable_idx {
 	PRU_C31,
 };
 
+/*
+ * 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 device_node;
 struct rproc;
 struct pruss;
@@ -47,6 +69,10 @@ struct pruss;
 
 struct pruss *pruss_get(struct rproc *rproc);
 void pruss_put(struct pruss *pruss);
+int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
+			     struct pruss_mem_region *region);
+int pruss_release_mem_region(struct pruss *pruss,
+			     struct pruss_mem_region *region);
 
 #else
 
@@ -57,6 +83,19 @@ static inline struct pruss *pruss_get(struct rproc *rproc)
 
 static inline void pruss_put(struct pruss *pruss) { }
 
+static inline int pruss_request_mem_region(struct pruss *pruss,
+					   enum pruss_mem mem_id,
+					   struct pruss_mem_region *region)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int pruss_release_mem_region(struct pruss *pruss,
+					   struct pruss_mem_region *region)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif /* CONFIG_TI_PRUSS */
 
 #if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
index d054d2179d82..e2d5477225c6 100644
--- a/include/linux/pruss_driver.h
+++ b/include/linux/pruss_driver.h
@@ -9,37 +9,18 @@
 #ifndef _PRUSS_DRIVER_H_
 #define _PRUSS_DRIVER_H_
 
+#include <linux/mutex.h>
 #include <linux/pruss.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_base: base iomap for CFG region
  * @cfg_regmap: regmap for config region
  * @mem_regions: data for each of the PRUSS memory regions
+ * @mem_in_use: to indicate if memory resource is in use
+ * @lock: mutex to serialize access to resources
  * @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX
  * @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX
  */
@@ -48,6 +29,8 @@ struct pruss {
 	void __iomem *cfg_base;
 	struct regmap *cfg_regmap;
 	struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
+	struct pruss_mem_region *mem_in_use[PRUSS_MEM_MAX];
+	struct mutex lock; /* PRU resource lock */
 	struct clk *core_clk_mux;
 	struct clk *iep_clk_mux;
 };
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 08/13] soc: ti: pruss: Add pruss_cfg_read()/update() API
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (6 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 07/13] soc: ti: pruss: Add pruss_{request, release}_mem_region() API Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 09/13] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Puranjay Mohan
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

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

Add two new generic API pruss_cfg_read() and pruss_cfg_update() to
the PRUSS platform driver to allow other drivers to read and program
respectively a register within the PRUSS CFG sub-module represented
by a syscon driver. This interface provides a simple way for client
drivers without having them to include and parse the CFG syscon node
within their respective device nodes. Various useful registers and
macros for certain register bit-fields and their values have also
been added.

It is the responsibility of the client drivers to reconfigure or
reset a particular register upon any failures.

Signed-off-by: Suman Anna <s-anna@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/soc/ti/pruss.c |  41 +++++++++++++++++
 include/linux/pruss.h  | 102 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index bda920662de2..9ef15daa405a 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -164,6 +164,47 @@ int pruss_release_mem_region(struct pruss *pruss,
 }
 EXPORT_SYMBOL_GPL(pruss_release_mem_region);
 
+/**
+ * pruss_cfg_read() - read a PRUSS CFG sub-module register
+ * @pruss: the pruss instance handle
+ * @reg: register offset within the CFG sub-module
+ * @val: pointer to return the value in
+ *
+ * Reads a given register within the PRUSS CFG sub-module and
+ * returns it through the passed-in @val pointer
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+int pruss_cfg_read(struct pruss *pruss, unsigned int reg, unsigned int *val)
+{
+	if (IS_ERR_OR_NULL(pruss))
+		return -EINVAL;
+
+	return regmap_read(pruss->cfg_regmap, reg, val);
+}
+EXPORT_SYMBOL_GPL(pruss_cfg_read);
+
+/**
+ * pruss_cfg_update() - configure a PRUSS CFG sub-module register
+ * @pruss: the pruss instance handle
+ * @reg: register offset within the CFG sub-module
+ * @mask: bit mask to use for programming the @val
+ * @val: value to write
+ *
+ * Programs a given register within the PRUSS CFG sub-module
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
+		     unsigned int mask, unsigned int val)
+{
+	if (IS_ERR_OR_NULL(pruss))
+		return -EINVAL;
+
+	return regmap_update_bits(pruss->cfg_regmap, reg, mask, val);
+}
+EXPORT_SYMBOL_GPL(pruss_cfg_update);
+
 static void pruss_of_free_clk_provider(void *data)
 {
 	struct device_node *clk_mux_np = data;
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index 689ef243bcbc..eb2f974eef9c 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -10,12 +10,99 @@
 #ifndef __LINUX_PRUSS_H
 #define __LINUX_PRUSS_H
 
+#include <linux/bits.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/types.h>
 
 #define PRU_RPROC_DRVNAME "pru-rproc"
 
+/*
+ * PRU_ICSS_CFG registers
+ * SYSCFG, ISRP, ISP, IESP, IECP, SCRP applicable on AMxxxx devices only
+ */
+#define PRUSS_CFG_REVID		0x00
+#define PRUSS_CFG_SYSCFG	0x04
+#define PRUSS_CFG_GPCFG(x)	(0x08 + (x) * 4)
+#define PRUSS_CFG_CGR		0x10
+#define PRUSS_CFG_ISRP		0x14
+#define PRUSS_CFG_ISP		0x18
+#define PRUSS_CFG_IESP		0x1C
+#define PRUSS_CFG_IECP		0x20
+#define PRUSS_CFG_SCRP		0x24
+#define PRUSS_CFG_PMAO		0x28
+#define PRUSS_CFG_MII_RT	0x2C
+#define PRUSS_CFG_IEPCLK	0x30
+#define PRUSS_CFG_SPP		0x34
+#define PRUSS_CFG_PIN_MX	0x40
+
+/* PRUSS_GPCFG register bits */
+#define PRUSS_GPCFG_PRU_GPO_SH_SEL		BIT(25)
+
+#define PRUSS_GPCFG_PRU_DIV1_SHIFT		20
+#define PRUSS_GPCFG_PRU_DIV1_MASK		GENMASK(24, 20)
+
+#define PRUSS_GPCFG_PRU_DIV0_SHIFT		15
+#define PRUSS_GPCFG_PRU_DIV0_MASK		GENMASK(15, 19)
+
+#define PRUSS_GPCFG_PRU_GPO_MODE		BIT(14)
+#define PRUSS_GPCFG_PRU_GPO_MODE_DIRECT		0
+#define PRUSS_GPCFG_PRU_GPO_MODE_SERIAL		BIT(14)
+
+#define PRUSS_GPCFG_PRU_GPI_SB			BIT(13)
+
+#define PRUSS_GPCFG_PRU_GPI_DIV1_SHIFT		8
+#define PRUSS_GPCFG_PRU_GPI_DIV1_MASK		GENMASK(12, 8)
+
+#define PRUSS_GPCFG_PRU_GPI_DIV0_SHIFT		3
+#define PRUSS_GPCFG_PRU_GPI_DIV0_MASK		GENMASK(7, 3)
+
+#define PRUSS_GPCFG_PRU_GPI_CLK_MODE_POSITIVE	0
+#define PRUSS_GPCFG_PRU_GPI_CLK_MODE_NEGATIVE	BIT(2)
+#define PRUSS_GPCFG_PRU_GPI_CLK_MODE		BIT(2)
+
+#define PRUSS_GPCFG_PRU_GPI_MODE_MASK		GENMASK(1, 0)
+#define PRUSS_GPCFG_PRU_GPI_MODE_SHIFT		0
+
+#define PRUSS_GPCFG_PRU_MUX_SEL_SHIFT		26
+#define PRUSS_GPCFG_PRU_MUX_SEL_MASK		GENMASK(29, 26)
+
+/* PRUSS_MII_RT register bits */
+#define PRUSS_MII_RT_EVENT_EN			BIT(0)
+
+/* PRUSS_SPP register bits */
+#define PRUSS_SPP_XFER_SHIFT_EN			BIT(1)
+#define PRUSS_SPP_PRU1_PAD_HP_EN		BIT(0)
+
+/*
+ * enum pruss_gp_mux_sel - PRUSS GPI/O Mux modes for the
+ * PRUSS_GPCFG0/1 registers
+ *
+ * NOTE: The below defines are the most common values, but there
+ * are some exceptions like on 66AK2G, where the RESERVED and MII2
+ * values are interchanged. Also, this bit-field does not exist on
+ * AM335x SoCs
+ */
+enum pruss_gp_mux_sel {
+	PRUSS_GP_MUX_SEL_GP = 0,
+	PRUSS_GP_MUX_SEL_ENDAT,
+	PRUSS_GP_MUX_SEL_RESERVED,
+	PRUSS_GP_MUX_SEL_SD,
+	PRUSS_GP_MUX_SEL_MII2,
+	PRUSS_GP_MUX_SEL_MAX,
+};
+
+/*
+ * enum pruss_gpi_mode - PRUSS GPI configuration modes, used
+ *			 to program the PRUSS_GPCFG0/1 registers
+ */
+enum pruss_gpi_mode {
+	PRUSS_GPI_MODE_DIRECT = 0,
+	PRUSS_GPI_MODE_PARALLEL,
+	PRUSS_GPI_MODE_28BIT_SHIFT,
+	PRUSS_GPI_MODE_MII,
+};
+
 /*
  * enum pruss_pru_id - PRU core identifiers
  */
@@ -73,6 +160,9 @@ int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
 			     struct pruss_mem_region *region);
 int pruss_release_mem_region(struct pruss *pruss,
 			     struct pruss_mem_region *region);
+int pruss_cfg_read(struct pruss *pruss, unsigned int reg, unsigned int *val);
+int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
+		     unsigned int mask, unsigned int val);
 
 #else
 
@@ -96,6 +186,18 @@ static inline int pruss_release_mem_region(struct pruss *pruss,
 	return -EOPNOTSUPP;
 }
 
+static inline int pruss_cfg_read(struct pruss *pruss, unsigned int reg,
+				 unsigned int *val)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
+				   unsigned int mask, unsigned int val)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif /* CONFIG_TI_PRUSS */
 
 #if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 09/13] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (7 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 08/13] soc: ti: pruss: Add pruss_cfg_read()/update() API Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 10/13] soc: ti: pruss: Add helper function to enable OCP master ports Puranjay Mohan
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

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

The PRUSS CFG module is represented as a syscon node and is currently
managed by the PRUSS platform driver. Add easy accessor functions to set
GPI mode, MII_RT event enable/disable and XFR (XIN XOUT) enable/disable
to enable the PRUSS Ethernet usecase. These functions reuse the generic
pruss_cfg_update() API function.

Signed-off-by: Suman Anna <s-anna@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 include/linux/pruss.h | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index eb2f974eef9c..84e95eb884e9 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -235,4 +235,59 @@ static inline bool is_pru_rproc(struct device *dev)
 	return true;
 }
 
+/**
+ * pruss_cfg_gpimode() - set the GPI mode of the PRU
+ * @pruss: the pruss instance handle
+ * @pru_id: id of the PRU core within the PRUSS
+ * @mode: GPI mode to set
+ *
+ * Sets the GPI mode for a given PRU by programming the
+ * corresponding PRUSS_CFG_GPCFGx register
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+static inline int pruss_cfg_gpimode(struct pruss *pruss,
+				    enum pruss_pru_id pru_id,
+				    enum pruss_gpi_mode mode)
+{
+	if (pru_id < 0 || pru_id >= PRUSS_NUM_PRUS)
+		return -EINVAL;
+
+	return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id),
+				PRUSS_GPCFG_PRU_GPI_MODE_MASK,
+				mode << PRUSS_GPCFG_PRU_GPI_MODE_SHIFT);
+}
+
+/**
+ * pruss_cfg_miirt_enable() - Enable/disable MII RT Events
+ * @pruss: the pruss instance
+ * @enable: enable/disable
+ *
+ * Enable/disable the MII RT Events for the PRUSS.
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+static inline int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable)
+{
+	u32 set = enable ? PRUSS_MII_RT_EVENT_EN : 0;
+
+	return pruss_cfg_update(pruss, PRUSS_CFG_MII_RT,
+				PRUSS_MII_RT_EVENT_EN, set);
+}
+
+/**
+ * pruss_cfg_xfr_enable() - Enable/disable XIN XOUT shift functionality
+ * @pruss: the pruss instance
+ * @enable: enable/disable
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+static inline int pruss_cfg_xfr_enable(struct pruss *pruss, bool enable)
+{
+	u32 set = enable ? PRUSS_SPP_XFER_SHIFT_EN : 0;
+
+	return pruss_cfg_update(pruss, PRUSS_CFG_SPP,
+				PRUSS_SPP_XFER_SHIFT_EN, set);
+}
+
 #endif /* __LINUX_PRUSS_H */
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 10/13] soc: ti: pruss: Add helper function to enable OCP master ports
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (8 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 09/13] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 11/13] soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX Puranjay Mohan
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

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

The PRU-ICSS subsystem on OMAP-architecture based SoCS (AM33xx, AM437x
and AM57xx SoCs) has a control bit STANDBY_INIT in the PRUSS_CFG register
to initiate a Standby sequence (when set) and trigger a MStandby request
to the SoC's PRCM module. This same bit is also used to enable the OCP
master ports (when cleared). The clearing of the STANDBY_INIT bit requires
an acknowledgment from PRCM and is done through the monitoring of the
PRUSS_SYSCFG.SUB_MWAIT bit.

Add a helper function pruss_cfg_ocp_master_ports() to allow the PRU
client drivers to control this bit and enable or disable the firmware
running on PRU cores access to any peripherals or memory to achieve
desired functionality. The access is disabled by default on power-up
and on any suspend (context is not maintained).

Signed-off-by: Suman Anna <s-anna@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 drivers/soc/ti/pruss.c | 81 ++++++++++++++++++++++++++++++++++++++++--
 include/linux/pruss.h  |  6 ++++
 2 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 9ef15daa405a..dbc1700d3176 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -22,14 +22,19 @@
 #include <linux/remoteproc.h>
 #include <linux/slab.h>
 
+#define SYSCFG_STANDBY_INIT	BIT(4)
+#define SYSCFG_SUB_MWAIT_READY	BIT(5)
+
 /**
  * struct pruss_private_data - PRUSS driver private data
  * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
  * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
+ * @has_ocp_syscfg: flag to indicate if OCP SYSCFG is present
  */
 struct pruss_private_data {
 	bool has_no_sharedram;
 	bool has_core_mux_clock;
+	bool has_ocp_syscfg;
 };
 
 /**
@@ -205,6 +210,72 @@ int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
 }
 EXPORT_SYMBOL_GPL(pruss_cfg_update);
 
+/**
+ * pruss_cfg_ocp_master_ports() - configure PRUSS OCP master ports
+ * @pruss: the pruss instance handle
+ * @enable: set to true for enabling or false for disabling the OCP master ports
+ *
+ * This function programs the PRUSS_SYSCFG.STANDBY_INIT bit either to enable or
+ * disable the OCP master ports (applicable only on SoCs using OCP interconnect
+ * like the OMAP family). Clearing the bit achieves dual functionalities - one
+ * is to deassert the MStandby signal to the device PRCM, and the other is to
+ * enable OCP master ports to allow accesses outside of the PRU-ICSS. The
+ * function has to wait for the PRCM to acknowledge through the monitoring of
+ * the PRUSS_SYSCFG.SUB_MWAIT bit when enabling master ports. Setting the bit
+ * disables the master access, and also signals the PRCM that the PRUSS is ready
+ * for Standby.
+ *
+ * Return: 0 on success, or an error code otherwise. ETIMEDOUT is returned
+ * when the ready-state fails.
+ */
+int pruss_cfg_ocp_master_ports(struct pruss *pruss, bool enable)
+{
+	int ret;
+	u32 syscfg_val, i;
+	const struct pruss_private_data *data;
+
+	if (IS_ERR_OR_NULL(pruss))
+		return -EINVAL;
+
+	data = of_device_get_match_data(pruss->dev);
+
+	/* nothing to do on non OMAP-SoCs */
+	if (!data || !data->has_ocp_syscfg)
+		return 0;
+
+	/* assert the MStandby signal during disable path */
+	if (!enable)
+		return pruss_cfg_update(pruss, PRUSS_CFG_SYSCFG,
+					SYSCFG_STANDBY_INIT,
+					SYSCFG_STANDBY_INIT);
+
+	/* enable the OCP master ports and disable MStandby */
+	ret = pruss_cfg_update(pruss, PRUSS_CFG_SYSCFG, SYSCFG_STANDBY_INIT, 0);
+	if (ret)
+		return ret;
+
+	/* wait till we are ready for transactions - delay is arbitrary */
+	for (i = 0; i < 10; i++) {
+		ret = pruss_cfg_read(pruss, PRUSS_CFG_SYSCFG, &syscfg_val);
+		if (ret)
+			goto disable;
+
+		if (!(syscfg_val & SYSCFG_SUB_MWAIT_READY))
+			return 0;
+
+		udelay(5);
+	}
+
+	dev_err(pruss->dev, "timeout waiting for SUB_MWAIT_READY\n");
+	ret = -ETIMEDOUT;
+
+disable:
+	pruss_cfg_update(pruss, PRUSS_CFG_SYSCFG, SYSCFG_STANDBY_INIT,
+			 SYSCFG_STANDBY_INIT);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(pruss_cfg_ocp_master_ports);
+
 static void pruss_of_free_clk_provider(void *data)
 {
 	struct device_node *clk_mux_np = data;
@@ -496,10 +567,16 @@ static int pruss_remove(struct platform_device *pdev)
 /* instance-specific driver private data */
 static const struct pruss_private_data am437x_pruss1_data = {
 	.has_no_sharedram = false,
+	.has_ocp_syscfg = true,
 };
 
 static const struct pruss_private_data am437x_pruss0_data = {
 	.has_no_sharedram = true,
+	.has_ocp_syscfg = false,
+};
+
+static const struct pruss_private_data am33xx_am57xx_data = {
+	.has_ocp_syscfg = true,
 };
 
 static const struct pruss_private_data am65x_j721e_pruss_data = {
@@ -507,10 +584,10 @@ static const struct pruss_private_data am65x_j721e_pruss_data = {
 };
 
 static const struct of_device_id pruss_of_match[] = {
-	{ .compatible = "ti,am3356-pruss" },
+	{ .compatible = "ti,am3356-pruss", .data = &am33xx_am57xx_data },
 	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
-	{ .compatible = "ti,am5728-pruss" },
+	{ .compatible = "ti,am5728-pruss", .data = &am33xx_am57xx_data },
 	{ .compatible = "ti,k2g-pruss" },
 	{ .compatible = "ti,am654-icssg", .data = &am65x_j721e_pruss_data, },
 	{ .compatible = "ti,j721e-icssg", .data = &am65x_j721e_pruss_data, },
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
index 84e95eb884e9..7e5e904521ac 100644
--- a/include/linux/pruss.h
+++ b/include/linux/pruss.h
@@ -163,6 +163,7 @@ int pruss_release_mem_region(struct pruss *pruss,
 int pruss_cfg_read(struct pruss *pruss, unsigned int reg, unsigned int *val);
 int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
 		     unsigned int mask, unsigned int val);
+int pruss_cfg_ocp_master_ports(struct pruss *pruss, bool enable);
 
 #else
 
@@ -198,6 +199,11 @@ static inline int pruss_cfg_update(struct pruss *pruss, unsigned int reg,
 	return -EOPNOTSUPP;
 }
 
+static inline int pruss_cfg_ocp_master_ports(struct pruss *pruss, bool enable)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif /* CONFIG_TI_PRUSS */
 
 #if IS_ENABLED(CONFIG_PRU_REMOTEPROC)
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 11/13] soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (9 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 10/13] soc: ti: pruss: Add helper function to enable OCP master ports Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06  9:43 ` [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
       [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
  12 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

From: Tero Kristo <t-kristo@ti.com>

Add two new helper functions pruss_cfg_get_gpmux() & pruss_cfg_set_gpmux()
to get and set the GP MUX mode for programming the PRUSS internal wrapper
mux functionality as needed by usecases.

Co-developed-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 include/linux/pruss_driver.h | 44 ++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/include/linux/pruss_driver.h b/include/linux/pruss_driver.h
index e2d5477225c6..3312281ef4c1 100644
--- a/include/linux/pruss_driver.h
+++ b/include/linux/pruss_driver.h
@@ -35,4 +35,48 @@ struct pruss {
 	struct clk *iep_clk_mux;
 };
 
+/**
+ * pruss_cfg_get_gpmux() - get the current GPMUX value for a PRU device
+ * @pruss: pruss instance
+ * @pru_id: PRU identifier (0-1)
+ * @mux: pointer to store the current mux value into
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+static inline int pruss_cfg_get_gpmux(struct pruss *pruss,
+				      enum pruss_pru_id pru_id, u8 *mux)
+{
+	int ret = 0;
+	u32 val;
+
+	if (pru_id < 0 || pru_id >= PRUSS_NUM_PRUS)
+		return -EINVAL;
+
+	ret = pruss_cfg_read(pruss, PRUSS_CFG_GPCFG(pru_id), &val);
+	if (!ret)
+		*mux = (u8)((val & PRUSS_GPCFG_PRU_MUX_SEL_MASK) >>
+			    PRUSS_GPCFG_PRU_MUX_SEL_SHIFT);
+	return ret;
+}
+
+/**
+ * pruss_cfg_set_gpmux() - set the GPMUX value for a PRU device
+ * @pruss: pruss instance
+ * @pru_id: PRU identifier (0-1)
+ * @mux: new mux value for PRU
+ *
+ * Return: 0 on success, or an error code otherwise
+ */
+static inline int pruss_cfg_set_gpmux(struct pruss *pruss,
+				      enum pruss_pru_id pru_id, u8 mux)
+{
+	if (mux >= PRUSS_GP_MUX_SEL_MAX ||
+	    pru_id < 0 || pru_id >= PRUSS_NUM_PRUS)
+		return -EINVAL;
+
+	return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id),
+				PRUSS_GPCFG_PRU_MUX_SEL_MASK,
+				(u32)mux << PRUSS_GPCFG_PRU_MUX_SEL_SHIFT);
+}
+
 #endif	/* _PRUSS_DRIVER_H_ */
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings
  2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
                   ` (10 preceding siblings ...)
  2022-04-06  9:43 ` [RFC 11/13] soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX Puranjay Mohan
@ 2022-04-06  9:43 ` Puranjay Mohan
  2022-04-06 18:54   ` Rob Herring
  2022-04-07 16:56   ` Rob Herring
       [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
  12 siblings, 2 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-06  9:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, bjorn.andersson, krzysztof.kozlowski+dt,
	ssantosh, p-mohan, kuba, davem, linux-arm-kernel

Add a YAML binding document for the ICSSG Programmable real time unit
based Ethernet driver. This driver uses the PRU and PRUSS consumer APIs
to interface the PRUs and load/run the firmware for supporting ethernet
functionality.

Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
---
 .../bindings/net/ti,icssg-prueth.yaml         | 172 ++++++++++++++++++
 1 file changed, 172 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml

diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
new file mode 100644
index 000000000000..8b8acb69e43e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
@@ -0,0 +1,172 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ti,icssg-prueth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: |+
+  Texas Instruments ICSSG PRUSS Ethernet
+
+maintainers:
+  - Puranjay Mohan <p-mohan@ti.com>
+
+description: |+
+  Ethernet based on the Programmable Real-Time Unit and Industrial Communication Subsystem.
+
+allOf:
+  - $ref: /schemas/remoteproc/ti,pru-consumer.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ti,am654-icssg-prueth  # for AM65x SoC family
+
+  sram:
+    description: |
+      phandle to MSMC SRAM node
+
+  dmas:
+    description: |
+      list of phandles and specifiers to UDMA as specified in bindings/dma/ti/k3-udma.txt.
+
+  dma-names:
+    items:
+      - const: tx0-0
+      - const: tx0-1
+      - const: tx0-2
+      - const: tx0-3
+      - const: tx1-0
+      - const: tx1-1
+      - const: tx1-2
+      - const: tx1-3
+      - const: rx0
+      - const: rx1
+
+  ethernet-ports:
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      port@[0-1]:
+        type: object
+        description: ICSSG PRUETH external ports
+
+        $ref: ethernet-controller.yaml#
+
+        properties:
+          reg:
+            items:
+              - enum: [0, 1]
+            description: ICSSG PRUETH port number
+
+          ti,syscon-rgmii-delay:
+            $ref: /schemas/types.yaml#/definitions/phandle-array
+            description:
+              phandle to system controller node and register offset
+              to ICSSG control register for RGMII transmit delay
+
+        required:
+          - reg
+
+    additionalProperties: false
+
+  ti,mii-g-rt:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to MII_G_RT module's syscon regmap.
+
+  ti,mii-rt:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      phandle to MII_RT module's syscon regmap
+
+  interrupts:
+    description: |
+      Interrupt specifiers to TX timestamp IRQ.
+
+  interrupt-names:
+    items:
+      - const: tx_ts0
+      - const: tx_ts1
+
+required:
+  - compatible
+  - sram
+  - ti,mii-g-rt
+  - dmas
+  - dma-names
+  - ethernet-ports
+  - interrupts
+  - interrupt-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+
+    /* Example k3-am654 base board SR2.0, dual-emac */
+        pruss2_eth: pruss2_eth {
+                compatible = "ti,am654-icssg-prueth";
+                pinctrl-names = "default";
+                pinctrl-0 = <&icssg2_rgmii_pins_default>;
+                sram = <&msmc_ram>;
+
+                ti,prus = <&pru2_0>, <&rtu2_0>, <&tx_pru2_0>, <&pru2_1>, <&rtu2_1>, <&tx_pru2_1>;
+                firmware-name = "ti-pruss/am65x-pru0-prueth-fw.elf",
+                                "ti-pruss/am65x-rtu0-prueth-fw.elf",
+                                "ti-pruss/am65x-txpru0-prueth-fw.elf",
+                                "ti-pruss/am65x-pru1-prueth-fw.elf",
+                                "ti-pruss/am65x-rtu1-prueth-fw.elf",
+                                "ti-pruss/am65x-txpru1-prueth-fw.elf";
+                ti,pruss-gp-mux-sel = <2>,      /* MII mode */
+                                      <2>,
+                                      <2>,
+                                      <2>,      /* MII mode */
+                                      <2>,
+                                      <2>;
+                ti,mii-g-rt = <&icssg2_mii_g_rt>;
+                dmas = <&main_udmap 0xc300>, /* egress slice 0 */
+                       <&main_udmap 0xc301>, /* egress slice 0 */
+                       <&main_udmap 0xc302>, /* egress slice 0 */
+                       <&main_udmap 0xc303>, /* egress slice 0 */
+                       <&main_udmap 0xc304>, /* egress slice 1 */
+                       <&main_udmap 0xc305>, /* egress slice 1 */
+                       <&main_udmap 0xc306>, /* egress slice 1 */
+                       <&main_udmap 0xc307>, /* egress slice 1 */
+                       <&main_udmap 0x4300>, /* ingress slice 0 */
+                       <&main_udmap 0x4301>, /* ingress slice 1 */
+                       <&main_udmap 0x4302>, /* mgmnt rsp slice 0 */
+                       <&main_udmap 0x4303>; /* mgmnt rsp slice 1 */
+                dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
+                            "tx1-0", "tx1-1", "tx1-2", "tx1-3",
+                            "rx0", "rx1";
+                interrupts = <24 0 2>, <25 1 3>;
+                interrupt-names = "tx_ts0", "tx_ts1";
+                ethernet-ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                        pruss2_emac0: port@0 {
+                                reg = <0>;
+                                phy-handle = <&pruss2_eth0_phy>;
+                                phy-mode = "rgmii-rxid";
+                                interrupts-extended = <&icssg2_intc 24>;
+                                ti,syscon-rgmii-delay = <&scm_conf 0x4120>;
+                                /* Filled in by bootloader */
+                                local-mac-address = [00 00 00 00 00 00];
+                        };
+
+                        pruss2_emac1: port@1 {
+                                reg = <1>;
+                                phy-handle = <&pruss2_eth1_phy>;
+                                phy-mode = "rgmii-rxid";
+                                interrupts-extended = <&icssg2_intc 25>;
+                                ti,syscon-rgmii-delay = <&scm_conf 0x4124>;
+                                /* Filled in by bootloader */
+                                local-mac-address = [00 00 00 00 00 00];
+                        };
+                };
+        };
-- 
2.17.1


_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
       [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
@ 2022-04-06 14:13   ` Andrew Lunn
  2022-04-12  9:42     ` Puranjay Mohan
  2022-04-06 18:37   ` Andrew Lunn
  2022-04-06 18:42   ` Andrew Lunn
  2 siblings, 1 reply; 28+ messages in thread
From: Andrew Lunn @ 2022-04-06 14:13 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

> +static int emac_set_link_ksettings(struct net_device *ndev,
> +				   const struct ethtool_link_ksettings *ecmd)
> +{
> +	struct prueth_emac *emac = netdev_priv(ndev);
> +
> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
> +		return -EOPNOTSUPP;
> +
> +	return phy_ethtool_ksettings_set(emac->phydev, ecmd);
> +}
> +
> +static int emac_get_eee(struct net_device *ndev, struct ethtool_eee *edata)
> +{
> +	struct prueth_emac *emac = netdev_priv(ndev);
> +
> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
> +		return -EOPNOTSUPP;
> +
> +	return phy_ethtool_get_eee(emac->phydev, edata);
> +}

Why do you need the phy_is_pseudo_fixed_link() calls here?

> +/* called back by PHY layer if there is change in link state of hw port*/
> +static void emac_adjust_link(struct net_device *ndev)
> +{

...

> +	if (emac->link) {
> +		/* link ON */
> +		netif_carrier_on(ndev);
> +		/* reactivate the transmit queue */
> +		netif_tx_wake_all_queues(ndev);
> +	} else {
> +		/* link OFF */
> +		netif_carrier_off(ndev);
> +		netif_tx_stop_all_queues(ndev);
> +	}

phylib should of set the carrier for you.

> + * emac_ndo_open - EMAC device open
> + * @ndev: network adapter device
> + *
> + * Called when system wants to start the interface.
> + *
> + * Returns 0 for a successful open, or appropriate error code
> + */
> +static int emac_ndo_open(struct net_device *ndev)
> +{
> +	struct prueth_emac *emac = netdev_priv(ndev);
> +	int ret, i, num_data_chn = emac->tx_ch_num;
> +	struct prueth *prueth = emac->prueth;
> +	int slice = prueth_emac_slice(emac);
> +	struct device *dev = prueth->dev;
> +	int max_rx_flows;
> +	int rx_flow;
> +
> +	/* clear SMEM and MSMC settings for all slices */
> +	if (!prueth->emacs_initialized) {
> +		memset_io(prueth->msmcram.va, 0, prueth->msmcram.size);
> +		memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS);
> +	}
> +
> +	/* set h/w MAC as user might have re-configured */
> +	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
> +
> +	icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
> +	icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
> +
> +	icssg_class_default(prueth->miig_rt, slice, 0);
> +
> +	netif_carrier_off(ndev);

phylib should take care of this.

> +
> +	/* Notify the stack of the actual queue counts. */
> +	ret = netif_set_real_num_tx_queues(ndev, num_data_chn);
> +	if (ret) {
> +		dev_err(dev, "cannot set real number of tx queues\n");
> +		return ret;
> +	}
> +
> +	init_completion(&emac->cmd_complete);
> +	ret = prueth_init_tx_chns(emac);
> +	if (ret) {
> +		dev_err(dev, "failed to init tx channel: %d\n", ret);
> +		return ret;
> +	}
> +
> +	max_rx_flows = PRUETH_MAX_RX_FLOWS;
> +	ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx",
> +				  max_rx_flows, PRUETH_MAX_RX_DESC);
> +	if (ret) {
> +		dev_err(dev, "failed to init rx channel: %d\n", ret);
> +		goto cleanup_tx;
> +	}
> +
> +	ret = prueth_ndev_add_tx_napi(emac);
> +	if (ret)
> +		goto cleanup_rx;
> +
> +	/* we use only the highest priority flow for now i.e. @irq[3] */
> +	rx_flow = PRUETH_RX_FLOW_DATA;
> +	ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq,
> +			  IRQF_TRIGGER_HIGH, dev_name(dev), emac);
> +	if (ret) {
> +		dev_err(dev, "unable to request RX IRQ\n");
> +		goto cleanup_napi;
> +	}
> +
> +	/* reset and start PRU firmware */
> +	ret = prueth_emac_start(prueth, emac);
> +	if (ret)
> +		goto free_rx_irq;
> +
> +	/* Prepare RX */
> +	ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE);
> +	if (ret)
> +		goto stop;
> +
> +	ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn);
> +	if (ret)
> +		goto reset_rx_chn;
> +
> +	for (i = 0; i < emac->tx_ch_num; i++) {
> +		ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn);
> +		if (ret)
> +			goto reset_tx_chan;
> +	}
> +
> +	/* Enable NAPI in Tx and Rx direction */
> +	for (i = 0; i < emac->tx_ch_num; i++)
> +		napi_enable(&emac->tx_chns[i].napi_tx);
> +	napi_enable(&emac->napi_rx);
> +
> +	emac_phy_connect(emac);

Why don't you check the error code?

> +static int prueth_config_rgmiidelay(struct prueth *prueth,
> +				    struct device_node *eth_np,
> +				    phy_interface_t phy_if)
> +{
> +	struct device *dev = prueth->dev;
> +	struct regmap *ctrl_mmr;
> +	u32 rgmii_tx_id = 0;
> +	u32 icssgctrl_reg;
> +
> +	if (!phy_interface_mode_is_rgmii(phy_if))
> +		return 0;
> +
> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
> +	if (IS_ERR(ctrl_mmr)) {
> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
> +		return -ENODEV;
> +	}
> +
> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
> +				       &icssgctrl_reg)) {
> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
> +		return -ENODEV;
> +	}
> +
> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
> +
> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);

Do you need to do a units conversion here, or does the register
already take pico seconds?

	Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
       [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
  2022-04-06 14:13   ` [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Andrew Lunn
@ 2022-04-06 18:37   ` Andrew Lunn
  2022-04-12  9:45     ` Puranjay Mohan
  2022-04-06 18:42   ` Andrew Lunn
  2 siblings, 1 reply; 28+ messages in thread
From: Andrew Lunn @ 2022-04-06 18:37 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

> +static int emac_phy_connect(struct prueth_emac *emac)
> +{
> +	struct prueth *prueth = emac->prueth;
> +
> +	/* connect PHY */
> +	emac->phydev = of_phy_connect(emac->ndev, emac->phy_node,
> +				      &emac_adjust_link, 0, emac->phy_if);

> +static int prueth_config_rgmiidelay(struct prueth *prueth,
> +				    struct device_node *eth_np,
> +				    phy_interface_t phy_if)
> +{
> +	struct device *dev = prueth->dev;
> +	struct regmap *ctrl_mmr;
> +	u32 rgmii_tx_id = 0;
> +	u32 icssgctrl_reg;
> +
> +	if (!phy_interface_mode_is_rgmii(phy_if))
> +		return 0;
> +
> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
> +	if (IS_ERR(ctrl_mmr)) {
> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
> +		return -ENODEV;
> +	}
> +
> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
> +				       &icssgctrl_reg)) {
> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
> +		return -ENODEV;
> +	}
> +
> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
> +
> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
> +
> +	return 0;
> +}
>

O.K, so this does not do what i initially thought it was doing. I was
thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be
a small pico second value to allow the 2ns delay to be tuned to the
board.

But now i think this is actually inserting the full 2ns delay?

The problem is, you also pass phy_if to of_phy_connect() so the PHY
will also insert the delay if requested. So you end up with double
delays for rgmii_id and rgmii_txid.

The general recommendation is that the PHY inserts the delay, based on
phy-mode. The MAC does not add a delay, so i suggest you always write
0 here, just to ensure the system is in a deterministic state, and the
bootloader and not being messing around with things.

	   Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
       [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
  2022-04-06 14:13   ` [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Andrew Lunn
  2022-04-06 18:37   ` Andrew Lunn
@ 2022-04-06 18:42   ` Andrew Lunn
  2022-04-12  9:46     ` Puranjay Mohan
  2 siblings, 1 reply; 28+ messages in thread
From: Andrew Lunn @ 2022-04-06 18:42 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

> +config TI_ICSSG_PRUETH
> +	tristate "TI Gigabit PRU Ethernet driver"
> +	select TI_DAVINCI_MDIO
> +

I don't see a dependency on TI_DAVINCI_MDIO in the code. All you need
is an MDIO bus so that your phy-handle has somewhere to point. But that
could be a GPIO bit banger.

What i do think is missing here is a dependency on PHYLIB.

If possible, it would be good to also have it compile when
COMPILE_TEST is set.

     Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings
  2022-04-06  9:43 ` [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
@ 2022-04-06 18:54   ` Rob Herring
  2022-04-07 16:56   ` Rob Herring
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-04-06 18:54 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, kishon, davem,
	linux-arm-kernel

On Wed, 06 Apr 2022 15:13:57 +0530, Puranjay Mohan wrote:
> Add a YAML binding document for the ICSSG Programmable real time unit
> based Ethernet driver. This driver uses the PRU and PRUSS consumer APIs
> to interface the PRUs and load/run the firmware for supporting ethernet
> functionality.
> 
> Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
> ---
>  .../bindings/net/ti,icssg-prueth.yaml         | 172 ++++++++++++++++++
>  1 file changed, 172 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
schemas/remoteproc/ti,pru-consumer.yaml: ignoring, error parsing file
schemas/remoteproc/ti,pru-consumer.yaml: ignoring, error parsing file
Traceback (most recent call last):
  File "/usr/local/bin/dt-validate", line 176, in <module>
    sg.check_trees(filename, testtree)
  File "/usr/local/bin/dt-validate", line 123, in check_trees
    self.check_subtree(dt, subtree, False, "/", "/", filename)
  File "/usr/local/bin/dt-validate", line 112, in check_subtree
    self.check_subtree(tree, value, disabled, name, fullname + name, filename)
  File "/usr/local/bin/dt-validate", line 112, in check_subtree
    self.check_subtree(tree, value, disabled, name, fullname + name, filename)
  File "/usr/local/bin/dt-validate", line 107, in check_subtree
    self.check_node(tree, subtree, disabled, nodename, fullname, filename)
  File "/usr/local/bin/dt-validate", line 51, in check_node
    errors = sorted(dtschema.DTValidator(schema).iter_errors(node), key=lambda e: e.linecol)
  File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 1027, in iter_errors
    for error in super().iter_errors(instance, _schema):
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 229, in iter_errors
    for error in errors:
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/_validators.py", line 362, in allOf
    yield from validator.descend(instance, subschema, schema_path=index)
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 245, in descend
    for error in self.evolve(schema=schema).iter_errors(instance):
  File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 1027, in iter_errors
    for error in super().iter_errors(instance, _schema):
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 229, in iter_errors
    for error in errors:
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/_validators.py", line 298, in ref
    yield from validator.descend(instance, resolved)
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 245, in descend
    for error in self.evolve(schema=schema).iter_errors(instance):
  File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 1027, in iter_errors
    for error in super().iter_errors(instance, _schema):
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 219, in iter_errors
    scope = id_of(_schema)
  File "/usr/local/lib/python3.8/dist-packages/jsonschema/validators.py", line 96, in _id_of
    return schema.get("$id", "")
AttributeError: 'NoneType' object has no attribute 'get'

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


_______________________________________________
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] 28+ messages in thread

* Re: [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings
  2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
@ 2022-04-07 13:50   ` Rob Herring
  2022-04-07 15:09   ` Rob Herring
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-04-07 13:50 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, netdev,
	linux-remoteproc, linux-kernel, kishon, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

On Wed, 06 Apr 2022 15:13:46 +0530, Puranjay Mohan wrote:
> From: Suman Anna <s-anna@ti.com>
> 
> Add a YAML binding document for PRU consumers. The binding includes
> all the common properties that can be used by different PRU consumer
> or application nodes and supported by the PRU remoteproc driver.
> These are used to configure the PRU hardware for specific user
> applications.
> 
> The application nodes themselves should define their own bindings.
> 
> Co-developed-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Suman Anna <s-anna@ti.com>
> Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
> ---
>  .../bindings/remoteproc/ti,pru-consumer.yaml  | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml:39:9: [warning] wrong indentation: expected 6 but found 8 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


_______________________________________________
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] 28+ messages in thread

* Re: [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings
  2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
  2022-04-07 13:50   ` Rob Herring
@ 2022-04-07 15:09   ` Rob Herring
  2022-04-12  6:41     ` Puranjay Mohan
  1 sibling, 1 reply; 28+ messages in thread
From: Rob Herring @ 2022-04-07 15:09 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

On Wed, Apr 06, 2022 at 03:13:46PM +0530, Puranjay Mohan wrote:
> From: Suman Anna <s-anna@ti.com>
> 
> Add a YAML binding document for PRU consumers. The binding includes
> all the common properties that can be used by different PRU consumer
> or application nodes and supported by the PRU remoteproc driver.
> These are used to configure the PRU hardware for specific user
> applications.
> 
> The application nodes themselves should define their own bindings.
> 
> Co-developed-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Suman Anna <s-anna@ti.com>
> Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
> Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
> ---
>  .../bindings/remoteproc/ti,pru-consumer.yaml  | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
> new file mode 100644
> index 000000000000..c245fe1de656
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/remoteproc/ti,pru-consumer.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Common TI PRU Consumer Binding
> +
> +maintainers:
> +  - Suman Anna <s-anna@ti.com>
> +
> +description: |
> +  A PRU application/consumer/user node typically uses one or more PRU device
> +  nodes to implement a PRU application/functionality. Each application/client
> +  node would need a reference to at least a PRU node, and optionally define
> +  some properties needed for hardware/firmware configuration. The below
> +  properties are a list of common properties supported by the PRU remoteproc
> +  infrastructure.
> +
> +  The application nodes shall define their own bindings like regular platform
> +  devices, so below are in addition to each node's bindings.
> +
> +properties:
> +  ti,prus:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array

Needs contraints. A phandle-array is really a matrix of phandles and 
args. If no args, something like this:

minItems: ??
maxItems: ??
items:
  maxItems: 1

> +    description: phandles to the PRU, RTU or Tx_PRU nodes used
> +
> +  firmware-name:
> +    $ref: /schemas/types.yaml#/definitions/string-array
> +    description: |
> +      firmwares for the PRU cores, the default firmware for the core from
> +      the PRU node will be used if not provided. The firmware names should
> +      correspond to the PRU cores listed in the 'ti,prus' property
> +
> +  ti,pruss-gp-mux-sel:
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    maxItems: 6
> +    items:
> +        enum: [0, 1, 2, 3, 4]
> +    description: |
> +      array of values for the GP_MUX_SEL under PRUSS_GPCFG register for a PRU.
> +      This selects the internal muxing scheme for the PRU instance. Values
> +      should correspond to the PRU cores listed in the 'ti,prus' property. The
> +      GP_MUX_SEL setting is a per-slice setting (one setting for PRU0, RTU0,
> +      and Tx_PRU0 on K3 SoCs). Use the same value for all cores within the
> +      same slice in the associative array. If the array size is smaller than
> +      the size of 'ti,prus' property, the default out-of-reset value (0) for the
> +      PRU core is used.
> +
> +required:
> +  - ti,prus
> +
> +dependencies:
> +  firmware-name: [ 'ti,prus' ]
> +  ti,pruss-gp-mux-sel: [ 'ti,prus' ]
> +
> +additionalProperties: true

This must be false unless it is a common, shared schema.

> +
> +examples:
> +  - |
> +    /* PRU application node example */
> +    pru-app {
> +        ti,prus = <&pru0>, <&pru1>;
> +        firmware-name = "pruss-app-fw0", "pruss-app-fw1";
> +        ti,pruss-gp-mux-sel = <2>, <1>;
> +    };
> -- 
> 2.17.1
> 
> 

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings
  2022-04-06  9:43 ` [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
  2022-04-06 18:54   ` Rob Herring
@ 2022-04-07 16:56   ` Rob Herring
  1 sibling, 0 replies; 28+ messages in thread
From: Rob Herring @ 2022-04-07 16:56 UTC (permalink / raw)
  To: Puranjay Mohan
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

On Wed, Apr 06, 2022 at 03:13:57PM +0530, Puranjay Mohan wrote:
> Add a YAML binding document for the ICSSG Programmable real time unit
> based Ethernet driver. This driver uses the PRU and PRUSS consumer APIs
> to interface the PRUs and load/run the firmware for supporting ethernet
> functionality.
> 
> Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
> ---
>  .../bindings/net/ti,icssg-prueth.yaml         | 172 ++++++++++++++++++
>  1 file changed, 172 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
> new file mode 100644
> index 000000000000..8b8acb69e43e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/ti,icssg-prueth.yaml
> @@ -0,0 +1,172 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/ti,icssg-prueth.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: |+
> +  Texas Instruments ICSSG PRUSS Ethernet
> +
> +maintainers:
> +  - Puranjay Mohan <p-mohan@ti.com>
> +
> +description: |+
> +  Ethernet based on the Programmable Real-Time Unit and Industrial Communication Subsystem.
> +
> +allOf:
> +  - $ref: /schemas/remoteproc/ti,pru-consumer.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,am654-icssg-prueth  # for AM65x SoC family
> +
> +  sram:
> +    description: |
> +      phandle to MSMC SRAM node
> +
> +  dmas:
> +    description: |
> +      list of phandles and specifiers to UDMA as specified in bindings/dma/ti/k3-udma.txt.

How many?

> +
> +  dma-names:
> +    items:
> +      - const: tx0-0
> +      - const: tx0-1
> +      - const: tx0-2
> +      - const: tx0-3
> +      - const: tx1-0
> +      - const: tx1-1
> +      - const: tx1-2
> +      - const: tx1-3
> +      - const: rx0
> +      - const: rx1

Is there a minimum and maximum number? Is it really so variable?

> +
> +  ethernet-ports:
> +    type: object
> +    properties:
> +      '#address-cells':
> +        const: 1
> +      '#size-cells':
> +        const: 0
> +
> +    patternProperties:
> +      port@[0-1]:

fooport@0bar would be valid here.

'^port@[0-1]$'


> +        type: object
> +        description: ICSSG PRUETH external ports
> +
> +        $ref: ethernet-controller.yaml#

           unevaluatedProperties: false

> +
> +        properties:
> +          reg:
> +            items:
> +              - enum: [0, 1]
> +            description: ICSSG PRUETH port number
> +
> +          ti,syscon-rgmii-delay:
> +            $ref: /schemas/types.yaml#/definitions/phandle-array
> +            description:
> +              phandle to system controller node and register offset
> +              to ICSSG control register for RGMII transmit delay
> +
> +        required:
> +          - reg
> +
> +    additionalProperties: false
> +
> +  ti,mii-g-rt:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: |
> +      phandle to MII_G_RT module's syscon regmap.
> +
> +  ti,mii-rt:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: |
> +      phandle to MII_RT module's syscon regmap
> +
> +  interrupts:
> +    description: |
> +      Interrupt specifiers to TX timestamp IRQ.

How many?

> +
> +  interrupt-names:
> +    items:
> +      - const: tx_ts0
> +      - const: tx_ts1
> +
> +required:
> +  - compatible
> +  - sram
> +  - ti,mii-g-rt
> +  - dmas
> +  - dma-names
> +  - ethernet-ports
> +  - interrupts
> +  - interrupt-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +
> +    /* Example k3-am654 base board SR2.0, dual-emac */
> +        pruss2_eth: pruss2_eth {
> +                compatible = "ti,am654-icssg-prueth";
> +                pinctrl-names = "default";
> +                pinctrl-0 = <&icssg2_rgmii_pins_default>;
> +                sram = <&msmc_ram>;
> +
> +                ti,prus = <&pru2_0>, <&rtu2_0>, <&tx_pru2_0>, <&pru2_1>, <&rtu2_1>, <&tx_pru2_1>;
> +                firmware-name = "ti-pruss/am65x-pru0-prueth-fw.elf",
> +                                "ti-pruss/am65x-rtu0-prueth-fw.elf",
> +                                "ti-pruss/am65x-txpru0-prueth-fw.elf",
> +                                "ti-pruss/am65x-pru1-prueth-fw.elf",
> +                                "ti-pruss/am65x-rtu1-prueth-fw.elf",
> +                                "ti-pruss/am65x-txpru1-prueth-fw.elf";
> +                ti,pruss-gp-mux-sel = <2>,      /* MII mode */
> +                                      <2>,
> +                                      <2>,
> +                                      <2>,      /* MII mode */
> +                                      <2>,
> +                                      <2>;
> +                ti,mii-g-rt = <&icssg2_mii_g_rt>;
> +                dmas = <&main_udmap 0xc300>, /* egress slice 0 */
> +                       <&main_udmap 0xc301>, /* egress slice 0 */
> +                       <&main_udmap 0xc302>, /* egress slice 0 */
> +                       <&main_udmap 0xc303>, /* egress slice 0 */
> +                       <&main_udmap 0xc304>, /* egress slice 1 */
> +                       <&main_udmap 0xc305>, /* egress slice 1 */
> +                       <&main_udmap 0xc306>, /* egress slice 1 */
> +                       <&main_udmap 0xc307>, /* egress slice 1 */
> +                       <&main_udmap 0x4300>, /* ingress slice 0 */
> +                       <&main_udmap 0x4301>, /* ingress slice 1 */
> +                       <&main_udmap 0x4302>, /* mgmnt rsp slice 0 */
> +                       <&main_udmap 0x4303>; /* mgmnt rsp slice 1 */
> +                dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3",
> +                            "tx1-0", "tx1-1", "tx1-2", "tx1-3",
> +                            "rx0", "rx1";
> +                interrupts = <24 0 2>, <25 1 3>;
> +                interrupt-names = "tx_ts0", "tx_ts1";
> +                ethernet-ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +                        pruss2_emac0: port@0 {
> +                                reg = <0>;
> +                                phy-handle = <&pruss2_eth0_phy>;
> +                                phy-mode = "rgmii-rxid";
> +                                interrupts-extended = <&icssg2_intc 24>;
> +                                ti,syscon-rgmii-delay = <&scm_conf 0x4120>;
> +                                /* Filled in by bootloader */
> +                                local-mac-address = [00 00 00 00 00 00];
> +                        };
> +
> +                        pruss2_emac1: port@1 {
> +                                reg = <1>;
> +                                phy-handle = <&pruss2_eth1_phy>;
> +                                phy-mode = "rgmii-rxid";
> +                                interrupts-extended = <&icssg2_intc 25>;
> +                                ti,syscon-rgmii-delay = <&scm_conf 0x4124>;
> +                                /* Filled in by bootloader */
> +                                local-mac-address = [00 00 00 00 00 00];
> +                        };
> +                };
> +        };
> -- 
> 2.17.1
> 
> 

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings
  2022-04-07 15:09   ` Rob Herring
@ 2022-04-12  6:41     ` Puranjay Mohan
  0 siblings, 0 replies; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-12  6:41 UTC (permalink / raw)
  To: Rob Herring
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

Hi Rob,

On 07/04/22 20:39, Rob Herring wrote:
> On Wed, Apr 06, 2022 at 03:13:46PM +0530, Puranjay Mohan wrote:
>> From: Suman Anna <s-anna@ti.com>
>>
>> Add a YAML binding document for PRU consumers. The binding includes
>> all the common properties that can be used by different PRU consumer
>> or application nodes and supported by the PRU remoteproc driver.
>> These are used to configure the PRU hardware for specific user
>> applications.
>>
>> The application nodes themselves should define their own bindings.
>>
>> Co-developed-by: Tero Kristo <t-kristo@ti.com>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>> Signed-off-by: Suman Anna <s-anna@ti.com>
>> Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
>> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
>> Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
>> ---
>>  .../bindings/remoteproc/ti,pru-consumer.yaml  | 66 +++++++++++++++++++
>>  1 file changed, 66 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
>> new file mode 100644
>> index 000000000000..c245fe1de656
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/remoteproc/ti,pru-consumer.yaml
>> @@ -0,0 +1,66 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/remoteproc/ti,pru-consumer.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Common TI PRU Consumer Binding
>> +
>> +maintainers:
>> +  - Suman Anna <s-anna@ti.com>
>> +
>> +description: |
>> +  A PRU application/consumer/user node typically uses one or more PRU device
>> +  nodes to implement a PRU application/functionality. Each application/client
>> +  node would need a reference to at least a PRU node, and optionally define
>> +  some properties needed for hardware/firmware configuration. The below
>> +  properties are a list of common properties supported by the PRU remoteproc
>> +  infrastructure.
>> +
>> +  The application nodes shall define their own bindings like regular platform
>> +  devices, so below are in addition to each node's bindings.
>> +
>> +properties:
>> +  ti,prus:
>> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> 
> Needs contraints. A phandle-array is really a matrix of phandles and 
> args. If no args, something like this:
> 
> minItems: ??
> maxItems: ??
> items:
>   maxItems: 1

So, I can add:
minItems: 1
as max items can't be constrained.
Also, there are no args.

> 
>> +    description: phandles to the PRU, RTU or Tx_PRU nodes used
>> +
>> +  firmware-name:
>> +    $ref: /schemas/types.yaml#/definitions/string-array
>> +    description: |
>> +      firmwares for the PRU cores, the default firmware for the core from
>> +      the PRU node will be used if not provided. The firmware names should
>> +      correspond to the PRU cores listed in the 'ti,prus' property
>> +
>> +  ti,pruss-gp-mux-sel:
>> +    $ref: /schemas/types.yaml#/definitions/uint32-array
>> +    maxItems: 6
>> +    items:
>> +        enum: [0, 1, 2, 3, 4]
>> +    description: |
>> +      array of values for the GP_MUX_SEL under PRUSS_GPCFG register for a PRU.
>> +      This selects the internal muxing scheme for the PRU instance. Values
>> +      should correspond to the PRU cores listed in the 'ti,prus' property. The
>> +      GP_MUX_SEL setting is a per-slice setting (one setting for PRU0, RTU0,
>> +      and Tx_PRU0 on K3 SoCs). Use the same value for all cores within the
>> +      same slice in the associative array. If the array size is smaller than
>> +      the size of 'ti,prus' property, the default out-of-reset value (0) for the
>> +      PRU core is used.
>> +
>> +required:
>> +  - ti,prus
>> +
>> +dependencies:
>> +  firmware-name: [ 'ti,prus' ]
>> +  ti,pruss-gp-mux-sel: [ 'ti,prus' ]
>> +
>> +additionalProperties: true
> 
> This must be false unless it is a common, shared schema.

This is a shared schema, so I made it true.

> 
>> +
>> +examples:
>> +  - |
>> +    /* PRU application node example */
>> +    pru-app {
>> +        ti,prus = <&pru0>, <&pru1>;
>> +        firmware-name = "pruss-app-fw0", "pruss-app-fw1";
>> +        ti,pruss-gp-mux-sel = <2>, <1>;
>> +    };
>> -- 
>> 2.17.1
>>
>>


Thanks,
Puranjay

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-06 14:13   ` [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Andrew Lunn
@ 2022-04-12  9:42     ` Puranjay Mohan
  2022-04-13  8:15       ` Roger Quadros
  0 siblings, 1 reply; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-12  9:42 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: nm, devicetree, Grygorii Strashko, vigneshr, mathieu.poirier,
	kishon, netdev, linux-remoteproc, linux-kernel, bjorn.andersson,
	Roger Quadros, krzysztof.kozlowski+dt, ssantosh, kuba, davem,
	linux-arm-kernel

+ Roger, Grygorii

On 06/04/22 19:43, Andrew Lunn wrote:
>> +static int emac_set_link_ksettings(struct net_device *ndev,
>> +				   const struct ethtool_link_ksettings *ecmd)
>> +{
>> +	struct prueth_emac *emac = netdev_priv(ndev);
>> +
>> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
>> +		return -EOPNOTSUPP;
>> +
>> +	return phy_ethtool_ksettings_set(emac->phydev, ecmd);
>> +}
>> +
>> +static int emac_get_eee(struct net_device *ndev, struct ethtool_eee *edata)
>> +{
>> +	struct prueth_emac *emac = netdev_priv(ndev);
>> +
>> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
>> +		return -EOPNOTSUPP;
>> +
>> +	return phy_ethtool_get_eee(emac->phydev, edata);
>> +}
> 
> Why do you need the phy_is_pseudo_fixed_link() calls here?
> 
>> +/* called back by PHY layer if there is change in link state of hw port*/
>> +static void emac_adjust_link(struct net_device *ndev)
>> +{
> 
> ...
> 
>> +	if (emac->link) {
>> +		/* link ON */
>> +		netif_carrier_on(ndev);
>> +		/* reactivate the transmit queue */
>> +		netif_tx_wake_all_queues(ndev);
>> +	} else {
>> +		/* link OFF */
>> +		netif_carrier_off(ndev);
>> +		netif_tx_stop_all_queues(ndev);
>> +	}
> 
> phylib should of set the carrier for you.
> 
>> + * emac_ndo_open - EMAC device open
>> + * @ndev: network adapter device
>> + *
>> + * Called when system wants to start the interface.
>> + *
>> + * Returns 0 for a successful open, or appropriate error code
>> + */
>> +static int emac_ndo_open(struct net_device *ndev)
>> +{
>> +	struct prueth_emac *emac = netdev_priv(ndev);
>> +	int ret, i, num_data_chn = emac->tx_ch_num;
>> +	struct prueth *prueth = emac->prueth;
>> +	int slice = prueth_emac_slice(emac);
>> +	struct device *dev = prueth->dev;
>> +	int max_rx_flows;
>> +	int rx_flow;
>> +
>> +	/* clear SMEM and MSMC settings for all slices */
>> +	if (!prueth->emacs_initialized) {
>> +		memset_io(prueth->msmcram.va, 0, prueth->msmcram.size);
>> +		memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS);
>> +	}
>> +
>> +	/* set h/w MAC as user might have re-configured */
>> +	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
>> +
>> +	icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
>> +	icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
>> +
>> +	icssg_class_default(prueth->miig_rt, slice, 0);
>> +
>> +	netif_carrier_off(ndev);
> 
> phylib should take care of this.
> 
>> +
>> +	/* Notify the stack of the actual queue counts. */
>> +	ret = netif_set_real_num_tx_queues(ndev, num_data_chn);
>> +	if (ret) {
>> +		dev_err(dev, "cannot set real number of tx queues\n");
>> +		return ret;
>> +	}
>> +
>> +	init_completion(&emac->cmd_complete);
>> +	ret = prueth_init_tx_chns(emac);
>> +	if (ret) {
>> +		dev_err(dev, "failed to init tx channel: %d\n", ret);
>> +		return ret;
>> +	}
>> +
>> +	max_rx_flows = PRUETH_MAX_RX_FLOWS;
>> +	ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx",
>> +				  max_rx_flows, PRUETH_MAX_RX_DESC);
>> +	if (ret) {
>> +		dev_err(dev, "failed to init rx channel: %d\n", ret);
>> +		goto cleanup_tx;
>> +	}
>> +
>> +	ret = prueth_ndev_add_tx_napi(emac);
>> +	if (ret)
>> +		goto cleanup_rx;
>> +
>> +	/* we use only the highest priority flow for now i.e. @irq[3] */
>> +	rx_flow = PRUETH_RX_FLOW_DATA;
>> +	ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq,
>> +			  IRQF_TRIGGER_HIGH, dev_name(dev), emac);
>> +	if (ret) {
>> +		dev_err(dev, "unable to request RX IRQ\n");
>> +		goto cleanup_napi;
>> +	}
>> +
>> +	/* reset and start PRU firmware */
>> +	ret = prueth_emac_start(prueth, emac);
>> +	if (ret)
>> +		goto free_rx_irq;
>> +
>> +	/* Prepare RX */
>> +	ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE);
>> +	if (ret)
>> +		goto stop;
>> +
>> +	ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn);
>> +	if (ret)
>> +		goto reset_rx_chn;
>> +
>> +	for (i = 0; i < emac->tx_ch_num; i++) {
>> +		ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn);
>> +		if (ret)
>> +			goto reset_tx_chan;
>> +	}
>> +
>> +	/* Enable NAPI in Tx and Rx direction */
>> +	for (i = 0; i < emac->tx_ch_num; i++)
>> +		napi_enable(&emac->tx_chns[i].napi_tx);
>> +	napi_enable(&emac->napi_rx);
>> +
>> +	emac_phy_connect(emac);
> 
> Why don't you check the error code?
> 
>> +static int prueth_config_rgmiidelay(struct prueth *prueth,
>> +				    struct device_node *eth_np,
>> +				    phy_interface_t phy_if)
>> +{
>> +	struct device *dev = prueth->dev;
>> +	struct regmap *ctrl_mmr;
>> +	u32 rgmii_tx_id = 0;
>> +	u32 icssgctrl_reg;
>> +
>> +	if (!phy_interface_mode_is_rgmii(phy_if))
>> +		return 0;
>> +
>> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
>> +	if (IS_ERR(ctrl_mmr)) {
>> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
>> +				       &icssgctrl_reg)) {
>> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
>> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
>> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
>> +
>> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
> 
> Do you need to do a units conversion here, or does the register
> already take pico seconds?
> 
> 	Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-06 18:37   ` Andrew Lunn
@ 2022-04-12  9:45     ` Puranjay Mohan
  2022-04-12  9:56       ` Grygorii Strashko
  0 siblings, 1 reply; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-12  9:45 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: nm, devicetree, Grygorii Strashko, vigneshr, mathieu.poirier,
	kishon, netdev, linux-remoteproc, linux-kernel, bjorn.andersson,
	Roger Quadros, krzysztof.kozlowski+dt, ssantosh, kuba, davem,
	linux-arm-kernel

+ Roger, Grygorii

On 07/04/22 00:07, Andrew Lunn wrote:
>> +static int emac_phy_connect(struct prueth_emac *emac)
>> +{
>> +	struct prueth *prueth = emac->prueth;
>> +
>> +	/* connect PHY */
>> +	emac->phydev = of_phy_connect(emac->ndev, emac->phy_node,
>> +				      &emac_adjust_link, 0, emac->phy_if);
> 
>> +static int prueth_config_rgmiidelay(struct prueth *prueth,
>> +				    struct device_node *eth_np,
>> +				    phy_interface_t phy_if)
>> +{
>> +	struct device *dev = prueth->dev;
>> +	struct regmap *ctrl_mmr;
>> +	u32 rgmii_tx_id = 0;
>> +	u32 icssgctrl_reg;
>> +
>> +	if (!phy_interface_mode_is_rgmii(phy_if))
>> +		return 0;
>> +
>> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
>> +	if (IS_ERR(ctrl_mmr)) {
>> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
>> +				       &icssgctrl_reg)) {
>> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
>> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
>> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
>> +
>> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
>> +
>> +	return 0;
>> +}
>>
> 
> O.K, so this does not do what i initially thought it was doing. I was
> thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be
> a small pico second value to allow the 2ns delay to be tuned to the
> board.
> 
> But now i think this is actually inserting the full 2ns delay?
> 
> The problem is, you also pass phy_if to of_phy_connect() so the PHY
> will also insert the delay if requested. So you end up with double
> delays for rgmii_id and rgmii_txid.
> 
> The general recommendation is that the PHY inserts the delay, based on
> phy-mode. The MAC does not add a delay, so i suggest you always write
> 0 here, just to ensure the system is in a deterministic state, and the
> bootloader and not being messing around with things.
> 
> 	   Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-06 18:42   ` Andrew Lunn
@ 2022-04-12  9:46     ` Puranjay Mohan
  2022-04-13  8:09       ` Roger Quadros
  0 siblings, 1 reply; 28+ messages in thread
From: Puranjay Mohan @ 2022-04-12  9:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: nm, devicetree, Grygorii Strashko, vigneshr, mathieu.poirier,
	kishon, netdev, linux-remoteproc, linux-kernel, bjorn.andersson,
	roger Quadros, krzysztof.kozlowski+dt, ssantosh, kuba, davem,
	linux-arm-kernel

+Roger, Grygorii

On 07/04/22 00:12, Andrew Lunn wrote:
>> +config TI_ICSSG_PRUETH
>> +	tristate "TI Gigabit PRU Ethernet driver"
>> +	select TI_DAVINCI_MDIO
>> +
> 
> I don't see a dependency on TI_DAVINCI_MDIO in the code. All you need
> is an MDIO bus so that your phy-handle has somewhere to point. But that
> could be a GPIO bit banger.
> 
> What i do think is missing here is a dependency on PHYLIB.
> 
> If possible, it would be good to also have it compile when
> COMPILE_TEST is set.
> 
>      Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-12  9:45     ` Puranjay Mohan
@ 2022-04-12  9:56       ` Grygorii Strashko
  2022-04-12 13:10         ` Andrew Lunn
  0 siblings, 1 reply; 28+ messages in thread
From: Grygorii Strashko @ 2022-04-12  9:56 UTC (permalink / raw)
  To: Puranjay Mohan, Andrew Lunn
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson, Roger Quadros,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel



On 12/04/2022 12:45, Puranjay Mohan wrote:
> + Roger, Grygorii
> 
> On 07/04/22 00:07, Andrew Lunn wrote:
>>> +static int emac_phy_connect(struct prueth_emac *emac)
>>> +{
>>> +	struct prueth *prueth = emac->prueth;
>>> +
>>> +	/* connect PHY */
>>> +	emac->phydev = of_phy_connect(emac->ndev, emac->phy_node,
>>> +				      &emac_adjust_link, 0, emac->phy_if);
>>
>>> +static int prueth_config_rgmiidelay(struct prueth *prueth,
>>> +				    struct device_node *eth_np,
>>> +				    phy_interface_t phy_if)
>>> +{
>>> +	struct device *dev = prueth->dev;
>>> +	struct regmap *ctrl_mmr;
>>> +	u32 rgmii_tx_id = 0;
>>> +	u32 icssgctrl_reg;
>>> +
>>> +	if (!phy_interface_mode_is_rgmii(phy_if))
>>> +		return 0;
>>> +
>>> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
>>> +	if (IS_ERR(ctrl_mmr)) {
>>> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
>>> +		return -ENODEV;
>>> +	}
>>> +
>>> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
>>> +				       &icssgctrl_reg)) {
>>> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
>>> +		return -ENODEV;
>>> +	}
>>> +
>>> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
>>> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
>>> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
>>> +
>>> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
>>> +
>>> +	return 0;
>>> +}
>>>
>>
>> O.K, so this does not do what i initially thought it was doing. I was
>> thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be
>> a small pico second value to allow the 2ns delay to be tuned to the
>> board.
>>
>> But now i think this is actually inserting the full 2ns delay?
>>
>> The problem is, you also pass phy_if to of_phy_connect() so the PHY
>> will also insert the delay if requested. So you end up with double
>> delays for rgmii_id and rgmii_txid.

It's misunderstanding here. The bit field name in TRM is RGMII0_ID_MODE
and meaning:
0h - Internal transmit delay is enabled
1h - Internal transmit delay is not enabled.

So here internal delay will be disabled for RGMII_ID/RGMII_TXID.

>>
>> The general recommendation is that the PHY inserts the delay, based on
>> phy-mode. The MAC does not add a delay, so i suggest you always write
>> 0 here, just to ensure the system is in a deterministic state, and the
>> bootloader and not being messing around with things.
>>
>> 	   Andrew

-- 
Best regards,
Grygorii, Ukraine

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-12  9:56       ` Grygorii Strashko
@ 2022-04-12 13:10         ` Andrew Lunn
  0 siblings, 0 replies; 28+ messages in thread
From: Andrew Lunn @ 2022-04-12 13:10 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: nm, devicetree, vigneshr, mathieu.poirier, kishon, netdev,
	linux-remoteproc, linux-kernel, bjorn.andersson, Roger Quadros,
	krzysztof.kozlowski+dt, ssantosh, Puranjay Mohan, kuba, davem,
	linux-arm-kernel

> > > > +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
> > > > +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
> > > > +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
> > > > +
> > > > +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
> > > > +
> > > > +	return 0;
> > > > +}
> > > > 
> > > 
> > > O.K, so this does not do what i initially thought it was doing. I was
> > > thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be
> > > a small pico second value to allow the 2ns delay to be tuned to the
> > > board.
> > > 
> > > But now i think this is actually inserting the full 2ns delay?
> > > 
> > > The problem is, you also pass phy_if to of_phy_connect() so the PHY
> > > will also insert the delay if requested. So you end up with double
> > > delays for rgmii_id and rgmii_txid.
> 
> It's misunderstanding here. The bit field name in TRM is RGMII0_ID_MODE
> and meaning:
> 0h - Internal transmit delay is enabled
> 1h - Internal transmit delay is not enabled.
> 
> So here internal delay will be disabled for RGMII_ID/RGMII_TXID.

And enabled for the others?

Why don't you always disable the delays and let the PHY do it? That is
what pretty much every other MAC/PHY combination does.

    Andrew

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-12  9:46     ` Puranjay Mohan
@ 2022-04-13  8:09       ` Roger Quadros
  0 siblings, 0 replies; 28+ messages in thread
From: Roger Quadros @ 2022-04-13  8:09 UTC (permalink / raw)
  To: Puranjay Mohan, Andrew Lunn
  Cc: nm, devicetree, Grygorii Strashko, vigneshr, mathieu.poirier,
	kishon, netdev, linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel



On 12/04/2022 12:46, Puranjay Mohan wrote:
> +Roger, Grygorii
> 
> On 07/04/22 00:12, Andrew Lunn wrote:
>>> +config TI_ICSSG_PRUETH
>>> +	tristate "TI Gigabit PRU Ethernet driver"
>>> +	select TI_DAVINCI_MDIO
>>> +
>>
>> I don't see a dependency on TI_DAVINCI_MDIO in the code. All you need
>> is an MDIO bus so that your phy-handle has somewhere to point. But that
>> could be a GPIO bit banger.
>>
>> What i do think is missing here is a dependency on PHYLIB.

That is correct.

>>
>> If possible, it would be good to also have it compile when
>> COMPILE_TEST is set.
>>

Yes, that is a good idea.

cheers,
-roger

_______________________________________________
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] 28+ messages in thread

* Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
  2022-04-12  9:42     ` Puranjay Mohan
@ 2022-04-13  8:15       ` Roger Quadros
  0 siblings, 0 replies; 28+ messages in thread
From: Roger Quadros @ 2022-04-13  8:15 UTC (permalink / raw)
  To: Puranjay Mohan, Andrew Lunn
  Cc: nm, devicetree, Grygorii Strashko, vigneshr, mathieu.poirier,
	kishon, netdev, linux-remoteproc, linux-kernel, bjorn.andersson,
	krzysztof.kozlowski+dt, ssantosh, kuba, davem, linux-arm-kernel

Hi,

On 12/04/2022 12:42, Puranjay Mohan wrote:
> + Roger, Grygorii
> 
> On 06/04/22 19:43, Andrew Lunn wrote:
>>> +static int emac_set_link_ksettings(struct net_device *ndev,
>>> +				   const struct ethtool_link_ksettings *ecmd)
>>> +{
>>> +	struct prueth_emac *emac = netdev_priv(ndev);
>>> +
>>> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
>>> +		return -EOPNOTSUPP;
>>> +
>>> +	return phy_ethtool_ksettings_set(emac->phydev, ecmd);
>>> +}
>>> +
>>> +static int emac_get_eee(struct net_device *ndev, struct ethtool_eee *edata)
>>> +{
>>> +	struct prueth_emac *emac = netdev_priv(ndev);
>>> +
>>> +	if (!emac->phydev || phy_is_pseudo_fixed_link(emac->phydev))
>>> +		return -EOPNOTSUPP;
>>> +
>>> +	return phy_ethtool_get_eee(emac->phydev, edata);
>>> +}
>>
>> Why do you need the phy_is_pseudo_fixed_link() calls here?

I think this is left over code from early days. It can be removed.

>>
>>> +/* called back by PHY layer if there is change in link state of hw port*/
>>> +static void emac_adjust_link(struct net_device *ndev)
>>> +{
>>
>> ...
>>
>>> +	if (emac->link) {
>>> +		/* link ON */
>>> +		netif_carrier_on(ndev);
>>> +		/* reactivate the transmit queue */
>>> +		netif_tx_wake_all_queues(ndev);
>>> +	} else {
>>> +		/* link OFF */
>>> +		netif_carrier_off(ndev);
>>> +		netif_tx_stop_all_queues(ndev);
>>> +	}
>>
>> phylib should of set the carrier for you.
>>
>>> + * emac_ndo_open - EMAC device open
>>> + * @ndev: network adapter device
>>> + *
>>> + * Called when system wants to start the interface.
>>> + *
>>> + * Returns 0 for a successful open, or appropriate error code
>>> + */
>>> +static int emac_ndo_open(struct net_device *ndev)
>>> +{
>>> +	struct prueth_emac *emac = netdev_priv(ndev);
>>> +	int ret, i, num_data_chn = emac->tx_ch_num;
>>> +	struct prueth *prueth = emac->prueth;
>>> +	int slice = prueth_emac_slice(emac);
>>> +	struct device *dev = prueth->dev;
>>> +	int max_rx_flows;
>>> +	int rx_flow;
>>> +
>>> +	/* clear SMEM and MSMC settings for all slices */
>>> +	if (!prueth->emacs_initialized) {
>>> +		memset_io(prueth->msmcram.va, 0, prueth->msmcram.size);
>>> +		memset_io(prueth->shram.va, 0, ICSSG_CONFIG_OFFSET_SLICE1 * PRUETH_NUM_MACS);
>>> +	}
>>> +
>>> +	/* set h/w MAC as user might have re-configured */
>>> +	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
>>> +
>>> +	icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
>>> +	icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr);
>>> +
>>> +	icssg_class_default(prueth->miig_rt, slice, 0);
>>> +
>>> +	netif_carrier_off(ndev);
>>
>> phylib should take care of this.
>>
>>> +
>>> +	/* Notify the stack of the actual queue counts. */
>>> +	ret = netif_set_real_num_tx_queues(ndev, num_data_chn);
>>> +	if (ret) {
>>> +		dev_err(dev, "cannot set real number of tx queues\n");
>>> +		return ret;
>>> +	}
>>> +
>>> +	init_completion(&emac->cmd_complete);
>>> +	ret = prueth_init_tx_chns(emac);
>>> +	if (ret) {
>>> +		dev_err(dev, "failed to init tx channel: %d\n", ret);
>>> +		return ret;
>>> +	}
>>> +
>>> +	max_rx_flows = PRUETH_MAX_RX_FLOWS;
>>> +	ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx",
>>> +				  max_rx_flows, PRUETH_MAX_RX_DESC);
>>> +	if (ret) {
>>> +		dev_err(dev, "failed to init rx channel: %d\n", ret);
>>> +		goto cleanup_tx;
>>> +	}
>>> +
>>> +	ret = prueth_ndev_add_tx_napi(emac);
>>> +	if (ret)
>>> +		goto cleanup_rx;
>>> +
>>> +	/* we use only the highest priority flow for now i.e. @irq[3] */
>>> +	rx_flow = PRUETH_RX_FLOW_DATA;
>>> +	ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq,
>>> +			  IRQF_TRIGGER_HIGH, dev_name(dev), emac);
>>> +	if (ret) {
>>> +		dev_err(dev, "unable to request RX IRQ\n");
>>> +		goto cleanup_napi;
>>> +	}
>>> +
>>> +	/* reset and start PRU firmware */
>>> +	ret = prueth_emac_start(prueth, emac);
>>> +	if (ret)
>>> +		goto free_rx_irq;
>>> +
>>> +	/* Prepare RX */
>>> +	ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE);
>>> +	if (ret)
>>> +		goto stop;
>>> +
>>> +	ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn);
>>> +	if (ret)
>>> +		goto reset_rx_chn;
>>> +
>>> +	for (i = 0; i < emac->tx_ch_num; i++) {
>>> +		ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn);
>>> +		if (ret)
>>> +			goto reset_tx_chan;
>>> +	}
>>> +
>>> +	/* Enable NAPI in Tx and Rx direction */
>>> +	for (i = 0; i < emac->tx_ch_num; i++)
>>> +		napi_enable(&emac->tx_chns[i].napi_tx);
>>> +	napi_enable(&emac->napi_rx);
>>> +
>>> +	emac_phy_connect(emac);
>>
>> Why don't you check the error code?
>>
>>> +static int prueth_config_rgmiidelay(struct prueth *prueth,
>>> +				    struct device_node *eth_np,
>>> +				    phy_interface_t phy_if)
>>> +{
>>> +	struct device *dev = prueth->dev;
>>> +	struct regmap *ctrl_mmr;
>>> +	u32 rgmii_tx_id = 0;
>>> +	u32 icssgctrl_reg;
>>> +
>>> +	if (!phy_interface_mode_is_rgmii(phy_if))
>>> +		return 0;
>>> +
>>> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
>>> +	if (IS_ERR(ctrl_mmr)) {
>>> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
>>> +		return -ENODEV;
>>> +	}
>>> +
>>> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
>>> +				       &icssgctrl_reg)) {
>>> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
>>> +		return -ENODEV;
>>> +	}
>>> +
>>> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
>>> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
>>> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
>>> +
>>> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);
>>
>> Do you need to do a units conversion here, or does the register
>> already take pico seconds?

I think Grygorii already answered this. It is just a fixed delay enable/disable bit.

cheers,
-roger

_______________________________________________
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] 28+ messages in thread

end of thread, other threads:[~2022-04-13  8:17 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06  9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
2022-04-06  9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
2022-04-07 13:50   ` Rob Herring
2022-04-07 15:09   ` Rob Herring
2022-04-12  6:41     ` Puranjay Mohan
2022-04-06  9:43 ` [RFC 02/13] remoteproc: pru: Add APIs to get and put the PRU cores Puranjay Mohan
2022-04-06  9:43 ` [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Puranjay Mohan
2022-04-06  9:43 ` [RFC 04/13] remoteproc: pru: Add pru_rproc_set_ctable() function Puranjay Mohan
2022-04-06  9:43 ` [RFC 05/13] remoteproc: pru: Configure firmware based on client setup Puranjay Mohan
2022-04-06  9:43 ` [RFC 06/13] soc: ti: pruss: Add pruss_get()/put() API Puranjay Mohan
2022-04-06  9:43 ` [RFC 07/13] soc: ti: pruss: Add pruss_{request, release}_mem_region() API Puranjay Mohan
2022-04-06  9:43 ` [RFC 08/13] soc: ti: pruss: Add pruss_cfg_read()/update() API Puranjay Mohan
2022-04-06  9:43 ` [RFC 09/13] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Puranjay Mohan
2022-04-06  9:43 ` [RFC 10/13] soc: ti: pruss: Add helper function to enable OCP master ports Puranjay Mohan
2022-04-06  9:43 ` [RFC 11/13] soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX Puranjay Mohan
2022-04-06  9:43 ` [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
2022-04-06 18:54   ` Rob Herring
2022-04-07 16:56   ` Rob Herring
     [not found] ` <20220406094358.7895-14-p-mohan@ti.com>
2022-04-06 14:13   ` [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Andrew Lunn
2022-04-12  9:42     ` Puranjay Mohan
2022-04-13  8:15       ` Roger Quadros
2022-04-06 18:37   ` Andrew Lunn
2022-04-12  9:45     ` Puranjay Mohan
2022-04-12  9:56       ` Grygorii Strashko
2022-04-12 13:10         ` Andrew Lunn
2022-04-06 18:42   ` Andrew Lunn
2022-04-12  9:46     ` Puranjay Mohan
2022-04-13  8:09       ` Roger Quadros

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).