Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 4/7] spmi: pmic-arb: Make the APID init a version operation
From: Abel Vesa @ 2024-04-07 16:23 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Neil Armstrong, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Srini Kandagatla, Johan Hovold, David Collins, linux-kernel,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, devicetree,
	Abel Vesa
In-Reply-To: <20240407-spmi-multi-master-support-v9-0-fa151c1391f3@linaro.org>

Rather than using conditionals in probe function, add the APID init
as a version specific operation. Due to v7, which supports multiple
buses, pass on the bus index to be used for sorting out the apid base
and count.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 drivers/spmi/spmi-pmic-arb.c | 144 +++++++++++++++++++++----------------------
 1 file changed, 69 insertions(+), 75 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 704fd4506971..dc969f8bed18 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -186,6 +186,7 @@ struct spmi_pmic_arb {
  * struct pmic_arb_ver_ops - version dependent functionality.
  *
  * @ver_str:		version string.
+ * @init_apid:		finds the apid base and count
  * @ppid_to_apid:	finds the apid for a given ppid.
  * @non_data_cmd:	on v1 issues an spmi non-data command.
  *			on v2 no HW support, returns -EOPNOTSUPP.
@@ -205,6 +206,7 @@ struct spmi_pmic_arb {
  */
 struct pmic_arb_ver_ops {
 	const char *ver_str;
+	int (*init_apid)(struct spmi_pmic_arb *pmic_arb);
 	int (*ppid_to_apid)(struct spmi_pmic_arb *pmic_arb, u16 ppid);
 	/* spmi commands (read_cmd, write_cmd, cmd) functionality */
 	int (*offset)(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr,
@@ -947,6 +949,32 @@ static int qpnpint_irq_domain_alloc(struct irq_domain *domain,
 	return 0;
 }
 
+static int pmic_arb_init_apid_min_max(struct spmi_pmic_arb *pmic_arb)
+{
+	/*
+	 * Initialize max_apid/min_apid to the opposite bounds, during
+	 * the irq domain translation, we are sure to update these
+	 */
+	pmic_arb->max_apid = 0;
+	pmic_arb->min_apid = pmic_arb->max_periphs - 1;
+
+	return 0;
+}
+
+static int pmic_arb_init_apid_v1(struct spmi_pmic_arb *pmic_arb)
+{
+	u32 *mapping_table;
+
+	mapping_table = devm_kcalloc(&pmic_arb->spmic->dev, pmic_arb->max_periphs,
+				     sizeof(*mapping_table), GFP_KERNEL);
+	if (!mapping_table)
+		return -ENOMEM;
+
+	pmic_arb->mapping_table = mapping_table;
+
+	return pmic_arb_init_apid_min_max(pmic_arb);
+}
+
 static int pmic_arb_ppid_to_apid_v1(struct spmi_pmic_arb *pmic_arb, u16 ppid)
 {
 	u32 *mapping_table = pmic_arb->mapping_table;
@@ -1149,6 +1177,34 @@ static int pmic_arb_offset_v2(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr,
 	return 0x1000 * pmic_arb->ee + 0x8000 * apid;
 }
 
+static int pmic_arb_init_apid_v5(struct spmi_pmic_arb *pmic_arb)
+{
+	int ret;
+
+	pmic_arb->base_apid = 0;
+	pmic_arb->apid_count = readl_relaxed(pmic_arb->core + PMIC_ARB_FEATURES) &
+					   PMIC_ARB_FEATURES_PERIPH_MASK;
+
+	if (pmic_arb->base_apid + pmic_arb->apid_count > pmic_arb->max_periphs) {
+		dev_err(&pmic_arb->spmic->dev, "Unsupported APID count %d detected\n",
+			pmic_arb->base_apid + pmic_arb->apid_count);
+		return -EINVAL;
+	}
+
+	ret = pmic_arb_init_apid_min_max(pmic_arb);
+	if (ret)
+		return ret;
+
+	ret = pmic_arb_read_apid_map_v5(pmic_arb);
+	if (ret) {
+		dev_err(&pmic_arb->spmic->dev, "could not read APID->PPID mapping table, rc= %d\n",
+			ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 /*
  * v5 offset per ee and per apid for observer channels and per apid for
  * read/write channels.
@@ -1363,6 +1419,7 @@ pmic_arb_apid_owner_v7(struct spmi_pmic_arb *pmic_arb, u16 n)
 
 static const struct pmic_arb_ver_ops pmic_arb_v1 = {
 	.ver_str		= "v1",
+	.init_apid		= pmic_arb_init_apid_v1,
 	.ppid_to_apid		= pmic_arb_ppid_to_apid_v1,
 	.non_data_cmd		= pmic_arb_non_data_cmd_v1,
 	.offset			= pmic_arb_offset_v1,
@@ -1377,6 +1434,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v1 = {
 
 static const struct pmic_arb_ver_ops pmic_arb_v2 = {
 	.ver_str		= "v2",
+	.init_apid		= pmic_arb_init_apid_v1,
 	.ppid_to_apid		= pmic_arb_ppid_to_apid_v2,
 	.non_data_cmd		= pmic_arb_non_data_cmd_v2,
 	.offset			= pmic_arb_offset_v2,
@@ -1391,6 +1449,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v2 = {
 
 static const struct pmic_arb_ver_ops pmic_arb_v3 = {
 	.ver_str		= "v3",
+	.init_apid		= pmic_arb_init_apid_v1,
 	.ppid_to_apid		= pmic_arb_ppid_to_apid_v2,
 	.non_data_cmd		= pmic_arb_non_data_cmd_v2,
 	.offset			= pmic_arb_offset_v2,
@@ -1405,6 +1464,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v3 = {
 
 static const struct pmic_arb_ver_ops pmic_arb_v5 = {
 	.ver_str		= "v5",
+	.init_apid		= pmic_arb_init_apid_v5,
 	.ppid_to_apid		= pmic_arb_ppid_to_apid_v5,
 	.non_data_cmd		= pmic_arb_non_data_cmd_v2,
 	.offset			= pmic_arb_offset_v5,
@@ -1419,6 +1479,7 @@ static const struct pmic_arb_ver_ops pmic_arb_v5 = {
 
 static const struct pmic_arb_ver_ops pmic_arb_v7 = {
 	.ver_str		= "v7",
+	.init_apid		= pmic_arb_init_apid_v5,
 	.ppid_to_apid		= pmic_arb_ppid_to_apid_v5,
 	.non_data_cmd		= pmic_arb_non_data_cmd_v2,
 	.offset			= pmic_arb_offset_v7,
@@ -1444,7 +1505,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	struct spmi_controller *ctrl;
 	struct resource *res;
 	void __iomem *core;
-	u32 *mapping_table;
 	u32 channel, ee, hw_ver;
 	int err;
 
@@ -1472,12 +1532,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 
 	pmic_arb->core_size = resource_size(res);
 
-	pmic_arb->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
-					      sizeof(*pmic_arb->ppid_to_apid),
-					      GFP_KERNEL);
-	if (!pmic_arb->ppid_to_apid)
-		return -ENOMEM;
-
 	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
 
 	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
@@ -1511,58 +1565,17 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 			return PTR_ERR(pmic_arb->wr_base);
 	}
 
-	pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
+	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
+		 pmic_arb->ver_ops->ver_str, hw_ver);
 
-	if (hw_ver >= PMIC_ARB_VERSION_V7_MIN) {
+	if (hw_ver < PMIC_ARB_VERSION_V7_MIN)
+		pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
+	else
 		pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS_V7;
-		/* Optional property for v7: */
-		of_property_read_u32(pdev->dev.of_node, "qcom,bus-id",
-					&pmic_arb->bus_instance);
-		if (pmic_arb->bus_instance > 1) {
-			dev_err(&pdev->dev, "invalid bus instance (%u) specified\n",
-				pmic_arb->bus_instance);
-			return -EINVAL;
-		}
 
-		if (pmic_arb->bus_instance == 0) {
-			pmic_arb->base_apid = 0;
-			pmic_arb->apid_count =
-				readl_relaxed(core + PMIC_ARB_FEATURES) &
-				PMIC_ARB_FEATURES_PERIPH_MASK;
-		} else {
-			pmic_arb->base_apid =
-				readl_relaxed(core + PMIC_ARB_FEATURES) &
-				PMIC_ARB_FEATURES_PERIPH_MASK;
-			pmic_arb->apid_count =
-				readl_relaxed(core + PMIC_ARB_FEATURES1) &
-				PMIC_ARB_FEATURES_PERIPH_MASK;
-		}
-
-		if (pmic_arb->base_apid + pmic_arb->apid_count > pmic_arb->max_periphs) {
-			dev_err(&pdev->dev, "Unsupported APID count %d detected\n",
-				pmic_arb->base_apid + pmic_arb->apid_count);
-			return -EINVAL;
-		}
-	} else if (hw_ver >= PMIC_ARB_VERSION_V5_MIN) {
-		pmic_arb->base_apid = 0;
-		pmic_arb->apid_count = readl_relaxed(core + PMIC_ARB_FEATURES) &
-					PMIC_ARB_FEATURES_PERIPH_MASK;
-
-		if (pmic_arb->apid_count > pmic_arb->max_periphs) {
-			dev_err(&pdev->dev, "Unsupported APID count %d detected\n",
-				pmic_arb->apid_count);
-			return -EINVAL;
-		}
-	}
-
-	pmic_arb->apid_data = devm_kcalloc(&ctrl->dev, pmic_arb->max_periphs,
-					   sizeof(*pmic_arb->apid_data),
-					   GFP_KERNEL);
-	if (!pmic_arb->apid_data)
-		return -ENOMEM;
-
-	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
-		 pmic_arb->ver_ops->ver_str, hw_ver);
+	err = pmic_arb->ver_ops->init_apid(pmic_arb);
+	if (err)
+		return err;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "intr");
 	pmic_arb->intr = devm_ioremap_resource(&ctrl->dev, res);
@@ -1604,16 +1617,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	}
 
 	pmic_arb->ee = ee;
-	mapping_table = devm_kcalloc(&ctrl->dev, pmic_arb->max_periphs,
-					sizeof(*mapping_table), GFP_KERNEL);
-	if (!mapping_table)
-		return -ENOMEM;
-
-	pmic_arb->mapping_table = mapping_table;
-	/* Initialize max_apid/min_apid to the opposite bounds, during
-	 * the irq domain translation, we are sure to update these */
-	pmic_arb->max_apid = 0;
-	pmic_arb->min_apid = pmic_arb->max_periphs - 1;
 
 	platform_set_drvdata(pdev, ctrl);
 	raw_spin_lock_init(&pmic_arb->lock);
@@ -1622,15 +1625,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	ctrl->read_cmd = pmic_arb_read_cmd;
 	ctrl->write_cmd = pmic_arb_write_cmd;
 
-	if (hw_ver >= PMIC_ARB_VERSION_V5_MIN) {
-		err = pmic_arb_read_apid_map_v5(pmic_arb);
-		if (err) {
-			dev_err(&pdev->dev, "could not read APID->PPID mapping table, rc= %d\n",
-				err);
-			return err;
-		}
-	}
-
 	dev_dbg(&pdev->dev, "adding irq domain\n");
 	pmic_arb->domain = irq_domain_add_tree(pdev->dev.of_node,
 					 &pmic_arb_irq_domain_ops, pmic_arb);

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

* [PATCH v9 3/7] spmi: pmic-arb: Fix some compile warnings about members not being described
From: Abel Vesa @ 2024-04-07 16:23 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Neil Armstrong, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Srini Kandagatla, Johan Hovold, David Collins, linux-kernel,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, devicetree,
	Abel Vesa
In-Reply-To: <20240407-spmi-multi-master-support-v9-0-fa151c1391f3@linaro.org>

Fix the following compile warnings:

 warning: Function parameter or struct member 'core' not described in 'spmi_pmic_arb'
 warning: Function parameter or struct member 'core_size' not described in 'spmi_pmic_arb'
 warning: Function parameter or struct member 'mapping_table_valid' not described in 'spmi_pmic_arb'
 warning: Function parameter or struct member 'pmic_arb' not described in 'pmic_arb_read_data'
 warning: Function parameter or struct member 'pmic_arb' not described in 'pmic_arb_write_data'

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 drivers/spmi/spmi-pmic-arb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 9ed1180fe31f..704fd4506971 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -132,6 +132,8 @@ struct apid_data {
  * @wr_base:		on v1 "core", on v2 "chnls"    register base off DT.
  * @intr:		address of the SPMI interrupt control registers.
  * @cnfg:		address of the PMIC Arbiter configuration registers.
+ * @core:		core register base for v2 and above only (see above)
+ * @core_size:		core register base size
  * @lock:		lock to synchronize accesses.
  * @channel:		execution environment channel to use for accesses.
  * @irq:		PMIC ARB interrupt.
@@ -144,6 +146,7 @@ struct apid_data {
  * @apid_count:		on v5 and v7: number of APIDs associated with the
  *			particular SPMI bus instance
  * @mapping_table:	in-memory copy of PPID -> APID mapping table.
+ * @mapping_table_valid:bitmap containing valid-only periphs
  * @domain:		irq domain object for PMIC IRQ domain
  * @spmic:		SPMI controller object
  * @ver_ops:		version dependent operations.
@@ -232,6 +235,7 @@ static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb *pmic_arb,
 
 /**
  * pmic_arb_read_data: reads pmic-arb's register and copy 1..4 bytes to buf
+ * @pmic_arb:	the SPMI PMIC arbiter
  * @bc:		byte count -1. range: 0..3
  * @reg:	register's address
  * @buf:	output parameter, length must be bc + 1
@@ -246,6 +250,7 @@ pmic_arb_read_data(struct spmi_pmic_arb *pmic_arb, u8 *buf, u32 reg, u8 bc)
 
 /**
  * pmic_arb_write_data: write 1..4 bytes from buf to pmic-arb's register
+ * @pmic_arb:	the SPMI PMIC arbiter
  * @bc:		byte-count -1. range: 0..3.
  * @reg:	register's address.
  * @buf:	buffer to write. length must be bc + 1.

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

* [PATCH v9 2/7] dt-bindings: spmi: Deprecate qcom,bus-id
From: Abel Vesa @ 2024-04-07 16:23 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Neil Armstrong, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Srini Kandagatla, Johan Hovold, David Collins, linux-kernel,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, devicetree,
	Abel Vesa, Krzysztof Kozlowski
In-Reply-To: <20240407-spmi-multi-master-support-v9-0-fa151c1391f3@linaro.org>

As it is optional and no platform is actually using the secondary bus,
deprecate the qcom,bus-id property. For newer platforms that implement
SPMI PMIC ARB v7 in HW, the X1E80100 approach should be used.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.yaml b/Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.yaml
index f983b4af6db9..51daf1b847a9 100644
--- a/Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.yaml
+++ b/Documentation/devicetree/bindings/spmi/qcom,spmi-pmic-arb.yaml
@@ -92,6 +92,7 @@ properties:
     description: >
       SPMI bus instance. only applicable to PMIC arbiter version 7 and beyond.
       Supported values, 0 = primary bus, 1 = secondary bus
+    deprecated: true
 
 required:
   - compatible

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

* [PATCH v9 0/7] spmi: pmic-arb: Add support for multiple buses
From: Abel Vesa @ 2024-04-07 16:23 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Neil Armstrong, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Srini Kandagatla, Johan Hovold, David Collins, linux-kernel,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, devicetree,
	Abel Vesa, Krzysztof Kozlowski

This patchset prepares for and adds support for 2 buses, which is supported
in HW starting with version 7. Until now, none of the currently
supported platforms in upstream have used the second bus. The X1E80100
platform, on the other hand, needs the second bus for the USB2.0 to work
as there are 3 SMB2360 PMICs which provide eUSB2 repeaters and they are
all found on the second bus.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
Changes in v9:
- Use the proper number of buses on deregister, like David suggested
- Moved the lock from the arbiter to the bus, like David suggested
- Fixed type in schema file, pointed out by David
- Added Neil's R-b tag to patches #3, #6 and #7
- Link to v8: https://lore.kernel.org/r/20240402-spmi-multi-master-support-v8-0-ce6f2d14a058@linaro.org

Changes in v8:
- Added Neil's R-b tag to the 3rd patch
- Fixed compile warnings already existent by adding another patch
- Fixed compile warning about get_core_resources, reported by Neil
- Dropped and moved the spurious core removal changes, as suggested by Neil
- Link to v7: https://lore.kernel.org/r/20240329-spmi-multi-master-support-v7-0-7b902824246c@linaro.org

Changes in v7:
- This time really collected Krzysztof's R-b tags
- Added Neil's R-b tag to the 4th patch
- Split the multi bus patch into two separate patches, one for adding
  the bus object and one for the secondary bus, as per Neil's suggestion
- Fixed regression for single bus platforms triggered by casting to
  pmic_arb instead of bus in pmic_arb_non_data_cmd_v1
- Fixed bus object allocation by using ctrl drvdata instead
- Prefixed the spmi node property in x1e80100 schema with '^'
- Fixed struct and function documentation warnings reported by Neil

Changes in v6 (resend):
- Collected Krzysztof's R-b tags
- Link to v6: https://lore.kernel.org/r/20240222-spmi-multi-master-support-v6-0-bc34ea9561da@linaro.org

Changes in v6:
- Changed the compatible to platform specific (X1E80100) along with the
  schema. Fixed the spmi buses unit addresses and added the empty ranges
  property. Added missing properties to the spmi buses and the
  "unevaluatedProperties: false".
- Deprecated the "qcom,bus-id" in the legacy schema.
- Changed the driver to check for legacy compatible first
- Link to v5: https://lore.kernel.org/r/20240221-spmi-multi-master-support-v5-0-3255ca413a0b@linaro.org

Changes in v5:
- Dropped the RFC as there aren't any concerns about the approach anymore
- Dropped the unused dev and res variables from pmic_arb_get_obsrvr_chnls_v2
- Link to v4: https://lore.kernel.org/r/20240220-spmi-multi-master-support-v4-0-dc813c878ba8@linaro.org

Changes in v4:
- Fixed comment above pmic_arb_init_apid_v7 by dropping the extra "bus" word
- Swicthed to devm_platform_ioremap_resource_byname for obsrvr and chnls.
  The core remains with platform_get_resource_byname as we need the core size.
- Dropped comment from probe related to the need of platform_get_resource_byname
  as it not true anymore.
- Dropped the qcom,bus-id optional property.
- Link to v3: https://lore.kernel.org/r/20240214-spmi-multi-master-support-v3-0-0bae0ef04faf@linaro.org

Changes in v3:
- Split the change into 3 separate patches. First 2 patches are moving
  apid init and core resources into version specific ops. Third one is
  adding the support for 2 buses and dedicated compatible.
- Added separate bindings patch
- Link to v2: https://lore.kernel.org/r/20240213-spmi-multi-master-support-v2-1-b3b102326906@linaro.org

Changes in v2:
- Reworked it so that it registers a spmi controller for each bus
  rather than relying on the generic framework to pass on the bus
  (master) id.
- Link to v1: https://lore.kernel.org/r/20240207-spmi-multi-master-support-v1-0-ce57f301c7fd@linaro.org

---
Abel Vesa (7):
      dt-bindings: spmi: Add X1E80100 SPMI PMIC ARB schema
      dt-bindings: spmi: Deprecate qcom,bus-id
      spmi: pmic-arb: Fix some compile warnings about members not being described
      spmi: pmic-arb: Make the APID init a version operation
      spmi: pmic-arb: Make core resources acquiring a version operation
      spmi: pmic-arb: Register controller for bus instead of arbiter
      spmi: pmic-arb: Add multi bus support

 .../bindings/spmi/qcom,spmi-pmic-arb.yaml          |   1 +
 .../bindings/spmi/qcom,x1e80100-spmi-pmic-arb.yaml | 136 +++
 drivers/spmi/spmi-pmic-arb.c                       | 964 +++++++++++++--------
 3 files changed, 728 insertions(+), 373 deletions(-)
---
base-commit: 8568bb2ccc278f344e6ac44af6ed010a90aa88dc
change-id: 20240207-spmi-multi-master-support-832a704b779b

Best regards,
-- 
Abel Vesa <abel.vesa@linaro.org>


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

^ permalink raw reply

* [PATCH v9 1/7] dt-bindings: spmi: Add X1E80100 SPMI PMIC ARB schema
From: Abel Vesa @ 2024-04-07 16:23 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, Bjorn Andersson, Konrad Dybcio,
	Dmitry Baryshkov, Neil Armstrong, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Srini Kandagatla, Johan Hovold, David Collins, linux-kernel,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, devicetree,
	Abel Vesa, Krzysztof Kozlowski
In-Reply-To: <20240407-spmi-multi-master-support-v9-0-fa151c1391f3@linaro.org>

Add dedicated schema for X1E80100 PMIC ARB (v7) as it allows multiple
buses by declaring them as child nodes.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 .../bindings/spmi/qcom,x1e80100-spmi-pmic-arb.yaml | 136 +++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/Documentation/devicetree/bindings/spmi/qcom,x1e80100-spmi-pmic-arb.yaml b/Documentation/devicetree/bindings/spmi/qcom,x1e80100-spmi-pmic-arb.yaml
new file mode 100644
index 000000000000..a28b70fb330a
--- /dev/null
+++ b/Documentation/devicetree/bindings/spmi/qcom,x1e80100-spmi-pmic-arb.yaml
@@ -0,0 +1,136 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spmi/qcom,x1e80100-spmi-pmic-arb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm X1E80100 SPMI Controller (PMIC Arbiter v7)
+
+maintainers:
+  - Stephen Boyd <sboyd@kernel.org>
+
+description: |
+  The X1E80100 SPMI PMIC Arbiter implements HW version 7 and it's an SPMI
+  controller with wrapping arbitration logic to allow for multiple on-chip
+  devices to control up to 2 SPMI separate buses.
+
+  The PMIC Arbiter can also act as an interrupt controller, providing interrupts
+  to slave devices.
+
+properties:
+  compatible:
+    const: qcom,x1e80100-spmi-pmic-arb
+
+  reg:
+    items:
+      - description: core registers
+      - description: tx-channel per virtual slave registers
+      - description: rx-channel (called observer) per virtual slave registers
+
+  reg-names:
+    items:
+      - const: core
+      - const: chnls
+      - const: obsrvr
+
+  ranges: true
+
+  '#address-cells':
+    const: 2
+
+  '#size-cells':
+    const: 2
+
+  qcom,ee:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 5
+    description: >
+      indicates the active Execution Environment identifier
+
+  qcom,channel:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 5
+    description: >
+      which of the PMIC Arb provided channels to use for accesses
+
+patternProperties:
+  "^spmi@[a-f0-9]+$":
+    type: object
+    $ref: /schemas/spmi/spmi.yaml
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        items:
+          - description: configuration registers
+          - description: interrupt controller registers
+
+      reg-names:
+        items:
+          - const: cnfg
+          - const: intr
+
+      interrupts:
+        maxItems: 1
+
+      interrupt-names:
+        const: periph_irq
+
+      interrupt-controller: true
+
+      '#interrupt-cells':
+        const: 4
+        description: |
+          cell 1: slave ID for the requested interrupt (0-15)
+          cell 2: peripheral ID for requested interrupt (0-255)
+          cell 3: the requested peripheral interrupt (0-7)
+          cell 4: interrupt flags indicating level-sense information,
+                  as defined in dt-bindings/interrupt-controller/irq.h
+
+required:
+  - compatible
+  - reg-names
+  - qcom,ee
+  - qcom,channel
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      spmi: arbiter@c400000 {
+        compatible = "qcom,x1e80100-spmi-pmic-arb";
+        reg = <0 0x0c400000 0 0x3000>,
+              <0 0x0c500000 0 0x4000000>,
+              <0 0x0c440000 0 0x80000>;
+        reg-names = "core", "chnls", "obsrvr";
+
+        qcom,ee = <0>;
+        qcom,channel = <0>;
+
+        #address-cells = <2>;
+        #size-cells = <2>;
+        ranges;
+
+        spmi_bus0: spmi@c42d000 {
+          reg = <0 0x0c42d000 0 0x4000>,
+                <0 0x0c4c0000 0 0x10000>;
+          reg-names = "cnfg", "intr";
+
+          interrupt-names = "periph_irq";
+          interrupts-extended = <&pdc 1 IRQ_TYPE_LEVEL_HIGH>;
+          interrupt-controller;
+          #interrupt-cells = <4>;
+
+          #address-cells = <2>;
+          #size-cells = <0>;
+        };
+      };
+    };

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

* Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set additionalProperties to true
From: Krzysztof Kozlowski @ 2024-04-07 16:15 UTC (permalink / raw)
  To: Peng Fan, Peng Fan (OSS), Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Sudeep Holla, Cristian Marussi
  Cc: devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <DU0PR04MB9417C5B9BDD9E0B47E7494C088012@DU0PR04MB9417.eurprd04.prod.outlook.com>

On 07/04/2024 12:04, Peng Fan wrote:
>> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set
>> additionalProperties to true
>>
>> On 07/04/2024 02:37, Peng Fan wrote:
>>>> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set
>>>> additionalProperties to true
>>>>
>>>> On 05/04/2024 14:39, Peng Fan (OSS) wrote:
>>>>> From: Peng Fan <peng.fan@nxp.com>
>>>>>
>>>>> When adding vendor extension protocols, there is dt-schema warning:
>>>>> "
>>>>> imx,scmi.example.dtb: scmi: 'protocol@81', 'protocol@84' do not
>>>>> match any of the regexes: 'pinctrl-[0-9]+'
>>>>> "
>>>>>
>>>>> Set additionalProperties to true to address the issue.
>>>>
>>>> I do not see anything addressed here, except making the binding
>>>> accepting anything anywhere...
>>>
>>> I not wanna add vendor protocols in arm,scmi.yaml, so will introduce a
>>> new yaml imx.scmi.yaml which add i.MX SCMI protocol extension.
>>>
>>> With additionalProperties set to false, I not know how, please suggest.
>>
>> First of all, you cannot affect negatively existing devices (their
>> bindings) and your patch does exactly that. This should make you thing what
>> is the correct approach...
>>
>> Rob gave you the comment about missing compatible - you still did not
>> address that.
> 
> I added the compatible in patch 2/6 in the examples "compatible = "arm,scmi";"

So you claim that your vendor extensions are the same or fully
compatible with arm,scmi and you add nothing... Are your
extensions/protocol valid for arm,scmi? If yes, why is this in separate
binding. If no, why you use someone else's compatible?

Maybe your binding is correct, feel free to convince me (and read first
writing bindings).

Best regards,
Krzysztof


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

^ permalink raw reply

* [PATCH AUTOSEL 6.6 01/22] scsi: ufs: core: Fix MCQ MAC configuration
From: Sasha Levin @ 2024-04-07 13:12 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Rohit Ner, Peter Wang, Can Guo, Martin K . Petersen, Sasha Levin,
	jejb, matthias.bgg, angelogioacchino.delregno, bvanassche,
	stanley.chu, powen.kao, quic_nguyenb, alice.chao, yang.lee,
	linux-scsi, linux-arm-kernel, linux-mediatek

From: Rohit Ner <rohitner@google.com>

[ Upstream commit 767712f91de76abd22a45184e6e3440120b8bfce ]

As per JEDEC Standard No. 223E Section 5.9.2, the max # active commands
value programmed by the host sw in MCQConfig.MAC should be one less than
the actual value.

Signed-off-by: Rohit Ner <rohitner@google.com>
Link: https://lore.kernel.org/r/20240220095637.2900067-1-rohitner@google.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 0787456c2b892..c873fd8239427 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
 
 	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
 	val &= ~MCQ_CFG_MAC_MASK;
-	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
+	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
 	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
 }
 EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
-- 
2.43.0


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

^ permalink raw reply related

* [PATCH AUTOSEL 6.8 01/25] scsi: ufs: core: Fix MCQ MAC configuration
From: Sasha Levin @ 2024-04-07 13:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Rohit Ner, Peter Wang, Can Guo, Martin K . Petersen, Sasha Levin,
	jejb, matthias.bgg, angelogioacchino.delregno, bvanassche,
	stanley.chu, quic_nguyenb, powen.kao, alice.chao, yang.lee,
	linux-scsi, linux-arm-kernel, linux-mediatek

From: Rohit Ner <rohitner@google.com>

[ Upstream commit 767712f91de76abd22a45184e6e3440120b8bfce ]

As per JEDEC Standard No. 223E Section 5.9.2, the max # active commands
value programmed by the host sw in MCQConfig.MAC should be one less than
the actual value.

Signed-off-by: Rohit Ner <rohitner@google.com>
Link: https://lore.kernel.org/r/20240220095637.2900067-1-rohitner@google.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 0787456c2b892..c873fd8239427 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -94,7 +94,7 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
 
 	val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
 	val &= ~MCQ_CFG_MAC_MASK;
-	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds);
+	val |= FIELD_PREP(MCQ_CFG_MAC_MASK, max_active_cmds - 1);
 	ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
 }
 EXPORT_SYMBOL_GPL(ufshcd_mcq_config_mac);
-- 
2.43.0


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

^ permalink raw reply related

* [PATCH net-next v1 00/12] First try to replace page_frag with page_frag_cache
From: Yunsheng Lin @ 2024-04-07 13:08 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: netdev, linux-kernel, Yunsheng Lin, Alexander Duyck,
	Matthias Brugger, AngeloGioacchino Del Regno, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	linux-arm-kernel, linux-mediatek, bpf

After [1], Only there are two implementations for page frag:

1. mm/page_alloc.c: net stack seems to be using it in the
   rx part with 'struct page_frag_cache' and the main API
   being page_frag_alloc_align().
2. net/core/sock.c: net stack seems to be using it in the
   tx part with 'struct page_frag' and the main API being
   skb_page_frag_refill().

This patchset tries to unfiy the page frag implementation
by replacing page_frag with page_frag_cache for sk_page_frag()
first. net_high_order_alloc_disable_key for the implementation
in net/core/sock.c doesn't seems matter that much now have
have pcp support for high-order pages in commit 44042b449872
("mm/page_alloc: allow high-order pages to be stored on the
per-cpu lists").

As the related change is mostly related to networking, so
targeting the net-next. And will try to replace the rest
of page_frag in the follow patchset.

After this patchset, we are not only able to unify the page
frag implementation a little, but seems able to have about
0.5+% performance boost testing by using the vhost_net_test
introduced in [1] and page_frag_test.ko introduced in this
patch.

Before this patchset:
Performance counter stats for './vhost_net_test' (10 runs):

         603027.29 msec task-clock                       #    1.756 CPUs utilized               ( +-  0.04% )
           2097713      context-switches                 #    3.479 K/sec                       ( +-  0.00% )
               212      cpu-migrations                   #    0.352 /sec                        ( +-  4.72% )
                40      page-faults                      #    0.066 /sec                        ( +-  1.18% )
      467215266413      cycles                           #    0.775 GHz                         ( +-  0.12% )  (66.02%)
      131736729037      stalled-cycles-frontend          #   28.20% frontend cycles idle        ( +-  2.38% )  (64.34%)
       77728393294      stalled-cycles-backend           #   16.64% backend cycles idle         ( +-  3.98% )  (65.42%)
      345874254764      instructions                     #    0.74  insn per cycle
                                                  #    0.38  stalled cycles per insn     ( +-  0.75% )  (70.28%)
      105166217892      branches                         #  174.397 M/sec                       ( +-  0.65% )  (68.56%)
        9649321070      branch-misses                    #    9.18% of all branches             ( +-  0.69% )  (65.38%)

           343.376 +- 0.147 seconds time elapsed  ( +-  0.04% )


 Performance counter stats for 'insmod ./page_frag_test.ko nr_test=99999999' (30 runs):

             39.12 msec task-clock                       #    0.001 CPUs utilized               ( +-  4.51% )
                 5      context-switches                 #  127.805 /sec                        ( +-  3.76% )
                 1      cpu-migrations                   #   25.561 /sec                        ( +- 15.52% )
               197      page-faults                      #    5.035 K/sec                       ( +-  0.10% )
          10689913      cycles                           #    0.273 GHz                         ( +-  9.46% )  (72.72%)
           2821237      stalled-cycles-frontend          #   26.39% frontend cycles idle        ( +- 12.04% )  (76.23%)
           5035549      stalled-cycles-backend           #   47.11% backend cycles idle         ( +-  9.69% )  (49.40%)
           5439395      instructions                     #    0.51  insn per cycle
                                                  #    0.93  stalled cycles per insn     ( +- 11.58% )  (51.45%)
           1274419      branches                         #   32.575 M/sec                       ( +- 12.69% )  (77.88%)
             49562      branch-misses                    #    3.89% of all branches             ( +-  9.91% )  (72.32%)

            30.309 +- 0.305 seconds time elapsed  ( +-  1.01% )


After this patchset:
Performance counter stats for './vhost_net_test' (10 runs):

         598081.02 msec task-clock                       #    1.752 CPUs utilized               ( +-  0.11% )
           2097738      context-switches                 #    3.507 K/sec                       ( +-  0.00% )
               220      cpu-migrations                   #    0.368 /sec                        ( +-  6.58% )
                40      page-faults                      #    0.067 /sec                        ( +-  0.92% )
      469788205101      cycles                           #    0.785 GHz                         ( +-  0.27% )  (64.86%)
      137108509582      stalled-cycles-frontend          #   29.19% frontend cycles idle        ( +-  0.96% )  (63.62%)
       75499065401      stalled-cycles-backend           #   16.07% backend cycles idle         ( +-  1.04% )  (65.86%)
      345469451681      instructions                     #    0.74  insn per cycle
                                                  #    0.40  stalled cycles per insn     ( +-  0.37% )  (70.16%)
      102782224964      branches                         #  171.853 M/sec                       ( +-  0.62% )  (69.28%)
        9295357532      branch-misses                    #    9.04% of all branches             ( +-  1.08% )  (66.21%)

           341.466 +- 0.305 seconds time elapsed  ( +-  0.09% )


 Performance counter stats for 'insmod ./page_frag_test.ko nr_test=99999999' (30 runs):

             40.09 msec task-clock                       #    0.001 CPUs utilized               ( +-  4.60% )
                 5      context-switches                 #  124.722 /sec                        ( +-  3.45% )
                 1      cpu-migrations                   #   24.944 /sec                        ( +- 12.62% )
               197      page-faults                      #    4.914 K/sec                       ( +-  0.11% )
          10221721      cycles                           #    0.255 GHz                         ( +-  9.05% )  (27.73%)
           2459009      stalled-cycles-frontend          #   24.06% frontend cycles idle        ( +- 10.80% )  (29.05%)
           5148423      stalled-cycles-backend           #   50.37% backend cycles idle         ( +-  7.30% )  (82.47%)
           5889929      instructions                     #    0.58  insn per cycle
                                                  #    0.87  stalled cycles per insn     ( +- 11.85% )  (87.75%)
           1276667      branches                         #   31.846 M/sec                       ( +- 11.48% )  (89.80%)
             50631      branch-misses                    #    3.97% of all branches             ( +-  8.72% )  (83.20%)

            29.341 +- 0.300 seconds time elapsed  ( +-  1.02% )

CC: Alexander Duyck <alexander.duyck@gmail.com>

1. https://lore.kernel.org/all/20240228093013.8263-1-linyunsheng@huawei.com/

Yunsheng Lin (12):
  mm: Move the page fragment allocator from page_alloc into its own file
  mm: page_frag: use initial zero offset for page_frag_alloc_align()
  mm: page_frag: change page_frag_alloc_* API to accept align param
  mm: page_frag: add '_va' suffix to page_frag API
  mm: page_frag: add two inline helper for page_frag API
  mm: page_frag: reuse MSB of 'size' field for pfmemalloc
  mm: page_frag: reuse existing bit field of 'va' for pagecnt_bias
  net: introduce the skb_copy_to_va_nocache() helper
  mm: page_frag: introduce prepare/commit API for page_frag
  net: replace page_frag with page_frag_cache
  mm: page_frag: add a test module for page_frag
  mm: page_frag: update documentation and maintainer for page_frag

 Documentation/mm/page_frags.rst               | 115 ++++--
 MAINTAINERS                                   |  10 +
 .../chelsio/inline_crypto/chtls/chtls.h       |   3 -
 .../chelsio/inline_crypto/chtls/chtls_io.c    | 101 ++---
 .../chelsio/inline_crypto/chtls/chtls_main.c  |   3 -
 drivers/net/ethernet/google/gve/gve_rx.c      |   4 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c     |   2 +-
 drivers/net/ethernet/intel/ice/ice_txrx.h     |   2 +-
 drivers/net/ethernet/intel/ice/ice_txrx_lib.c |   2 +-
 .../net/ethernet/intel/ixgbevf/ixgbevf_main.c |   4 +-
 .../marvell/octeontx2/nic/otx2_common.c       |   2 +-
 drivers/net/ethernet/mediatek/mtk_wed_wo.c    |   4 +-
 drivers/net/tun.c                             |  34 +-
 drivers/nvme/host/tcp.c                       |   8 +-
 drivers/nvme/target/tcp.c                     |  22 +-
 drivers/vhost/net.c                           |   6 +-
 include/linux/gfp.h                           |  22 --
 include/linux/mm_types.h                      |  18 -
 include/linux/page_frag_cache.h               | 339 ++++++++++++++++
 include/linux/sched.h                         |   4 +-
 include/linux/skbuff.h                        |  15 +-
 include/net/sock.h                            |  29 +-
 kernel/bpf/cpumap.c                           |   2 +-
 kernel/exit.c                                 |   3 +-
 kernel/fork.c                                 |   2 +-
 mm/Kconfig.debug                              |   8 +
 mm/Makefile                                   |   2 +
 mm/page_alloc.c                               | 136 -------
 mm/page_frag_cache.c                          | 185 +++++++++
 mm/page_frag_test.c                           | 366 ++++++++++++++++++
 net/core/skbuff.c                             |  57 +--
 net/core/skmsg.c                              |  22 +-
 net/core/sock.c                               |  46 ++-
 net/core/xdp.c                                |   2 +-
 net/ipv4/ip_output.c                          |  35 +-
 net/ipv4/tcp.c                                |  35 +-
 net/ipv4/tcp_output.c                         |  28 +-
 net/ipv6/ip6_output.c                         |  35 +-
 net/kcm/kcmsock.c                             |  30 +-
 net/mptcp/protocol.c                          |  74 ++--
 net/rxrpc/txbuf.c                             |  16 +-
 net/sunrpc/svcsock.c                          |   4 +-
 net/tls/tls_device.c                          | 139 ++++---
 43 files changed, 1404 insertions(+), 572 deletions(-)
 create mode 100644 include/linux/page_frag_cache.h
 create mode 100644 mm/page_frag_cache.c
 create mode 100644 mm/page_frag_test.c

-- 
2.33.0


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

^ permalink raw reply

* RE: [PATCH 1/5] dt-bindings: firmware: add i.MX SCMI Extension protocol
From: Peng Fan @ 2024-04-07 12:35 UTC (permalink / raw)
  To: Rob Herring, Peng Fan (OSS)
  Cc: Krzysztof Kozlowski, Conor Dooley, Sudeep Holla, Cristian Marussi,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	dl-linux-imx, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20240212150919.GA322668-robh@kernel.org>

Hi Rob,

Sorry for late reply.

> Subject: Re: [PATCH 1/5] dt-bindings: firmware: add i.MX SCMI Extension
> protocol
> 
> On Fri, Feb 02, 2024 at 02:34:39PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Add i.MX SCMI Extension protocol BBM and MISC binding.
> 
> No idea what BBM and MISC are.
The Battery Backup (BB) Domain contains the Battery Backed
Security Module (BBSM) and the Battery Backed Non-Secure Module
(BBNSM).
BBNSM:
The BBNSM is the interface to a non-interruptable power supply
(backup battery) and serves as the non-volatile logic and storage
for the chip. When the chip is powered off, the BBNSM will maintain
PMIC logic while connected to a backup supply.
Main features: RTC, PMIC Control, ONOFF Control BBSM serves as
nonvolatile security logic and storage for ELE Main features:
Monotonic counter, Secure RTC, Zeroizable Master Key, Security
Violation and Tamper Detection


MISC: it is i.MX SCMI extension protocol, including BLK CTRL
settings, board level GPIO expander settings. 
> 
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  .../devicetree/bindings/firmware/nxp,scmi.yaml     | 64
> ++++++++++++++++++++++
> >  1 file changed, 64 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/firmware/nxp,scmi.yaml
> > b/Documentation/devicetree/bindings/firmware/nxp,scmi.yaml
> > new file mode 100644
> > index 000000000000..00d6361bbbea
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/firmware/nxp,scmi.yaml
> > @@ -0,0 +1,64 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) # Copyright 2024
> > +NXP %YAML 1.2
> > +---
> > +$id:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> >
> +cetree.org%2Fschemas%2Ffirmware%2Fnxp%2Cscmi.yaml%23&data=05%7
> C02%7Cp
> >
> +eng.fan%40nxp.com%7C625d14c7c4f14d16289908dc2bdc9967%7C686ea1
> d3bc2b4c
> >
> +6fa92cd99c5c301635%7C0%7C0%7C638433473675932860%7CUnknown%
> 7CTWFpbGZsb
> >
> +3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> 0%3D
> >
> +%7C0%7C%7C%7C&sdata=dP0%2FgyCwmWtSW9BNYWZQtunpgayjCl2AkSkj
> ZIZjn9o%3D&
> > +reserved=0
> > +$schema:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> > +cetree.org%2Fmeta-
> schemas%2Fcore.yaml%23&data=05%7C02%7Cpeng.fan%40nx
> >
> +p.com%7C625d14c7c4f14d16289908dc2bdc9967%7C686ea1d3bc2b4c6fa9
> 2cd99c5c
> >
> +301635%7C0%7C0%7C638433473675946764%7CUnknown%7CTWFpbGZs
> b3d8eyJWIjoiM
> >
> +C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7
> C%7C%7
> >
> +C&sdata=efmqKP8%2FyS4YoDLCb%2Fmxx72D7ZW2KxiEDhgnWdEUT1s%3D
> &reserved=0
> > +
> > +title: i.MX System Control and Management Interface (SCMI) Protocol
> > +Extension
> > +
> > +maintainers:
> > +  - Peng Fan <peng.fan@nxp.com>
> > +
> > +allOf:
> > +  - $ref: arm,scmi.yaml#
> > +
> > +properties:
> > +  protocol@11:
> 
> Wrong unit-address?

Yeah. Fixed.

> 
> > +    $ref: 'arm,scmi.yaml#/$defs/protocol-node'
> > +    unevaluatedProperties: false
> 
> Description of what this protocol is needed.

Added.

> 
> > +
> > +    properties:
> > +      reg:
> > +        const: 0x81
> > +
> > +  protocol@13:
> > +    $ref: 'arm,scmi.yaml#/$defs/protocol-node'
> > +    unevaluatedProperties: false
> > +
> > +    properties:
> > +      reg:
> > +        const: 0x84
> > +
> > +      wakeup-sources:
> 
> Is this somehow generic?

I think it yes, but if you disagree, please suggest.

> 
> > +        description: each entry consists of 2 integers and represents
> > + the source and edge
> 
> What does 'edge' mean in this context?

Electric signal edge.

> 
> > +        items:
> > +          items:
> > +            - description: the wakeup source
> > +            - description: the wakeup edge
> 
> Constraints?

Will add in V3.
minItems: 1
maxItems: 32
> 
> > +        $ref: /schemas/types.yaml#/definitions/uint32-matrix
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    firmware {
> > +        scmi {
> 
> 
> Need a compatible here so this actually gets tested.

Fixed.

> 
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +
> > +            protocol@81 {
> > +              reg = <0x81>;
> > +            };
> > +
> > +            protocol@84 {
> > +              reg = <0x84>;
> > +              wakeup-sources = <6 1
> > +                                7 1
> > +                                8 1
> > +                                9 1
> > +                                10 1>;
> 
> <> around each entry. e.g. "<6 1>"

Fix in V3.

Thanks,
Peng.
> 
> > +            };
> > +         };
> > +    };
> > +...
> >
> > --
> > 2.37.1
> >

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

^ permalink raw reply

* [PATCH 3/4] arm64: dts: rockchip: drop redundant disable-gpios in Lubancat 1
From: Krzysztof Kozlowski @ 2024-04-07 10:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Krzysztof Kozlowski
In-Reply-To: <20240407102854.38672-1-krzysztof.kozlowski@linaro.org>

There is no "disable-gpios" property in the PCI bindings or Linux
driver, so assume this was copied from downstream.  This property looks
like some real hardware, just described wrongly.  Rockchip PCIe
controller (DesignWare based) does not define any other GPIO-s property,
except reset-gpios which is already there, so not sure what would be the
real property for this GPIO.

This fixes dtbs_check warning:

  rk3566-lubancat-1.dtb: pcie@fe260000: Unevaluated properties are not allowed ('disable-gpios' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm64/boot/dts/rockchip/rk3566-lubancat-1.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3566-lubancat-1.dts b/arch/arm64/boot/dts/rockchip/rk3566-lubancat-1.dts
index 6ecdf5d28339..c1194d1e438d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-lubancat-1.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-lubancat-1.dts
@@ -447,7 +447,6 @@ rgmii_phy1: phy@0 {
 
 &pcie2x1 {
 	reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
-	disable-gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
 	vpcie3v3-supply = <&vcc3v3_pcie>;
 	status = "okay";
 };
-- 
2.34.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

* [PATCH 4/4] arm64: dts: rockchip: drop redundant disable-gpios in Lubancat 2
From: Krzysztof Kozlowski @ 2024-04-07 10:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Krzysztof Kozlowski
In-Reply-To: <20240407102854.38672-1-krzysztof.kozlowski@linaro.org>

There is no "disable-gpios" property in the PCI bindings or Linux
driver, so assume this was copied from downstream.  This property looks
like some real hardware, just described wrongly.  Rockchip PCIe
controller (DesignWare based) does not define any other GPIO-s property,
except reset-gpios which is already there, so not sure what would be the
real property for this GPIO.

This fixes dtbs_check warning:

  rk3568-lubancat-2.dtb: pcie@fe260000: Unevaluated properties are not allowed ('disable-gpios' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm64/boot/dts/rockchip/rk3568-lubancat-2.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-lubancat-2.dts b/arch/arm64/boot/dts/rockchip/rk3568-lubancat-2.dts
index a8a4cc190eb3..a3112d5df200 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-lubancat-2.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-lubancat-2.dts
@@ -523,7 +523,6 @@ &pcie3x2 {
 
 &pcie2x1 {
 	reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
-	disable-gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_HIGH>;
 	vpcie3v3-supply = <&vcc3v3_mini_pcie>;
 	status = "okay";
 };
-- 
2.34.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

* Re: [PATCH v4 4/5] dt-bindings: fsl-imx-sdma: Add I2C peripheral types ID
From: Vinod Koul @ 2024-04-07 11:21 UTC (permalink / raw)
  To: Frank Li
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Joy Zou, dmaengine, linux-arm-kernel, linux-kernel, devicetree,
	imx
In-Reply-To: <20240329-sdma_upstream-v4-4-daeb3067dea7@nxp.com>

On 29-03-24, 10:34, Frank Li wrote:
> Add peripheral types ID 26 for I2C because sdma firmware (sdma-6q: v3.6,
> sdma-7d: v4.6) support I2C DMA transfer.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>  Documentation/devicetree/bindings/dma/fsl,imx-sdma.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl,imx-sdma.yaml b/Documentation/devicetree/bindings/dma/fsl,imx-sdma.yaml
> index b95dd8db5a30a..80bcd3a6ecaf3 100644
> --- a/Documentation/devicetree/bindings/dma/fsl,imx-sdma.yaml
> +++ b/Documentation/devicetree/bindings/dma/fsl,imx-sdma.yaml
> @@ -93,6 +93,7 @@ properties:
>            - Shared ASRC: 23
>            - SAI: 24
>            - HDMI Audio: 25
> +          - I2C: 26

Sorry comment was for this patch, I have skipped these two now

>  
>         The third cell: transfer priority ID
>           enum:
> 
> -- 
> 2.34.1

-- 
~Vinod

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

^ permalink raw reply

* Re: [PATCH v4 5/5] dmaengine: imx-sdma: Add i2c dma support
From: Vinod Koul @ 2024-04-07 11:20 UTC (permalink / raw)
  To: Frank Li
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Joy Zou, dmaengine, linux-arm-kernel, linux-kernel, devicetree,
	imx, Robin Gong, Clark Wang, Daniel Baluta
In-Reply-To: <20240329-sdma_upstream-v4-5-daeb3067dea7@nxp.com>

On 29-03-24, 10:34, Frank Li wrote:
> From: Robin Gong <yibin.gong@nxp.com>
> 
> New sdma script (sdma-6q: v3.6, sdma-7d: v4.6) support i2c at imx8mp and
> imx6ull. So add I2C dma support.
> 
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
> Acked-by: Clark Wang <xiaoning.wang@nxp.com>
> Reviewed-by: Joy Zou <joy.zou@nxp.com>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/dma/imx-sdma.c      | 7 +++++++
>  include/linux/dma/imx-dma.h | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index f68ab34a3c880..1ab8a7d3a50dc 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -251,6 +251,8 @@ struct sdma_script_start_addrs {
>  	s32 sai_2_mcu_addr;
>  	s32 uart_2_mcu_rom_addr;
>  	s32 uartsh_2_mcu_rom_addr;
> +	s32 i2c_2_mcu_addr;
> +	s32 mcu_2_i2c_addr;
>  	/* End of v3 array */
>  	s32 mcu_2_zqspi_addr;
>  	/* End of v4 array */
> @@ -1081,6 +1083,11 @@ static int sdma_get_pc(struct sdma_channel *sdmac,
>  		per_2_emi = sdma->script_addrs->sai_2_mcu_addr;
>  		emi_2_per = sdma->script_addrs->mcu_2_sai_addr;
>  		break;
> +	case IMX_DMATYPE_I2C:
> +		per_2_emi = sdma->script_addrs->i2c_2_mcu_addr;
> +		emi_2_per = sdma->script_addrs->mcu_2_i2c_addr;
> +		sdmac->is_ram_script = true;
> +		break;
>  	case IMX_DMATYPE_HDMI:
>  		emi_2_per = sdma->script_addrs->hdmi_dma_addr;
>  		sdmac->is_ram_script = true;
> diff --git a/include/linux/dma/imx-dma.h b/include/linux/dma/imx-dma.h
> index cfec5f946e237..76a8de9ae1517 100644
> --- a/include/linux/dma/imx-dma.h
> +++ b/include/linux/dma/imx-dma.h
> @@ -41,6 +41,7 @@ enum sdma_peripheral_type {
>  	IMX_DMATYPE_SAI,	/* SAI */
>  	IMX_DMATYPE_MULTI_SAI,	/* MULTI FIFOs For Audio */
>  	IMX_DMATYPE_HDMI,       /* HDMI Audio */
> +	IMX_DMATYPE_I2C,	/* I2C */

I have HDMI Audio: 26 already?

-- 
~Vinod

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

^ permalink raw reply

* RE: [PATCH v2 4/6] firmware: arm_scmi: add initial support for i.MX MISC protocol
From: Peng Fan @ 2024-04-07 11:16 UTC (permalink / raw)
  To: Marco Felsch
  Cc: Peng Fan (OSS), Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Sudeep Holla, Cristian Marussi, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev
In-Reply-To: <20240407110208.4huirwif7as3dsps@pengutronix.de>

> Subject: Re: [PATCH v2 4/6] firmware: arm_scmi: add initial support for i.MX
> MISC protocol
> 
> Hi Peng,
> 
> On 24-04-07, Peng Fan wrote:
> > > Subject: Re: [PATCH v2 4/6] firmware: arm_scmi: add initial support
> > > for i.MX MISC protocol
> > >
> > > Hi Peng,
> > >
> > > On 24-04-05, Peng Fan (OSS) wrote:
> > > > From: Peng Fan <peng.fan@nxp.com>
> > > >
> > > > The i.MX MISC protocol is for misc settings, such as gpio expander
> > > > wakeup.
> > >
> > > Can you elaborate a bit more please?
> >
> > The gpio expander is under M33(SCMI firmware used core) I2C control,
> 
> Due to missing technical references I guess that your specific EVK has an i2c-
> expander connected to the system-critical-i2c bus? The system-critical-i2c
> should be only used for system critical topics like PMIC control.

Right.

> 
> > But the gpio expander supports board function such as PCIE_WAKEUP,
> > BTN_WAKEUP. So these are managed by MISC protocol.
> 
> This seems more like an specific i.MX95-EVK problem too me since you have
> conneccted the i2c-gpio-expander to the system-critical-i2c bus instead of
> using an bus available within Linux. Also can you please provide me a link
> with the propsoal for the MISC protocol? I can't find any references within the
> SCMI v3.2

It is i.MX VENDOR Extension, not a standard one in Spec.

> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdevelo
> per.arm.com%2Fdocumentation%2Fden0056%2Fe%2F&data=05%7C02%7Cp
> eng.fan%40nxp.com%7C6120357a772045a0618808dc56f22c95%7C686ea1d
> 3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638480845336536607%7CUnk
> nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
> 1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=NI%2F8WMPuGzJwD74
> 1jcuknHZUR5uI2me9iEeWbeDKshE%3D&reserved=0 nor within the SCP
> firmware git:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub
> .com%2FARM-software%2FSCP-
> firmware&data=05%7C02%7Cpeng.fan%40nxp.com%7C6120357a772045a06
> 18808dc56f22c95%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> 638480845336550459%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C
> &sdata=N3bT9ItgvL4Z9xP1oxlmDTG%2FFjsXkuhJIA9wooJWfcM%3D&reserve
> d=0.
> 
> > SAI_CLK_MSEL in WAKEUP BLK CTRL is also managed by MISC Protocol.
> 
> You recently said that we need blk-ctrl drivers for managing/controlling the
> GPR stuff within Linux since the SCMI firmware does not support this. Now
> blk-ctrl GPR control is supported by the firmware?

AONMIX/WAKEUPMIX BLK CTRL is managed by SCMI firmware, for other
non system critical BLK CTRLs, they are managed by Linux directly, such as
GPU/VPU BLK CTRL and etc.

Regards,
Peng.
> 
> Regards,
>   Marco
> 
> >
> > And etc...
> >
> > I will add more info in commit log in next version later, after I get
> > more reviews on the patchset.
> >
> > Thanks,
> > Peng.
> >
> > >
> > > Regards,
> > >   Marco
> > >
> > >
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > >  drivers/firmware/arm_scmi/Kconfig       |  10 ++
> > > >  drivers/firmware/arm_scmi/Makefile      |   1 +
> > > >  drivers/firmware/arm_scmi/imx-sm-misc.c | 305
> > > ++++++++++++++++++++++++++++++++
> > > >  include/linux/scmi_imx_protocol.h       |  17 ++
> > > >  4 files changed, 333 insertions(+)
> > > >
> > > > diff --git a/drivers/firmware/arm_scmi/Kconfig
> > > > b/drivers/firmware/arm_scmi/Kconfig
> > > > index 56d11c9d9f47..bfeae92f6420 100644
> > > > --- a/drivers/firmware/arm_scmi/Kconfig
> > > > +++ b/drivers/firmware/arm_scmi/Kconfig
> > > > @@ -191,3 +191,13 @@ config IMX_SCMI_BBM_EXT
> > > >  	  and BUTTON.
> > > >
> > > >  	  This driver can also be built as a module.
> > > > +
> > > > +config IMX_SCMI_MISC_EXT
> > > > +	tristate "i.MX SCMI MISC EXTENSION"
> > > > +	depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > > > +	default y if ARCH_MXC
> > > > +	help
> > > > +	  This enables i.MX System MISC control logic such as gpio expander
> > > > +	  wakeup
> > > > +
> > > > +	  This driver can also be built as a module.
> > > > diff --git a/drivers/firmware/arm_scmi/Makefile
> > > > b/drivers/firmware/arm_scmi/Makefile
> > > > index 327687acf857..a23fde721222 100644
> > > > --- a/drivers/firmware/arm_scmi/Makefile
> > > > +++ b/drivers/firmware/arm_scmi/Makefile
> > > > @@ -12,6 +12,7 @@ scmi-transport-
> > > $(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO)
> > > > += virtio.o
> > > >  scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o
> > > > scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o
> > > > system.o voltage.o powercap.o
> > > >  scmi-protocols-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o
> > > > +scmi-protocols-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o
> > > >  scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y)
> > > > $(scmi-transport-y)
> > > >
> > > >  obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o diff --git
> > > > a/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > > b/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > > new file mode 100644
> > > > index 000000000000..1b0ec2281518
> > > > --- /dev/null
> > > > +++ b/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > > @@ -0,0 +1,305 @@
> > > > +// SPDX-License-Identifier: GPL-2.0
> > > > +/*
> > > > + * System control and Management Interface (SCMI) NXP MISC
> > > > +Protocol
> > > > + *
> > > > + * Copyright 2024 NXP
> > > > + */
> > > > +
> > > > +#define pr_fmt(fmt) "SCMI Notifications MISC - " fmt
> > > > +
> > > > +#include <linux/bits.h>
> > > > +#include <linux/io.h>
> > > > +#include <linux/module.h>
> > > > +#include <linux/of.h>
> > > > +#include <linux/platform_device.h> #include
> > > > +<linux/scmi_protocol.h> #include <linux/scmi_imx_protocol.h>
> > > > +
> > > > +#include "protocols.h"
> > > > +#include "notify.h"
> > > > +
> > > > +#define SCMI_PROTOCOL_SUPPORTED_VERSION		0x10000
> > > > +
> > > > +enum scmi_imx_misc_protocol_cmd {
> > > > +	SCMI_IMX_MISC_CTRL_SET	= 0x3,
> > > > +	SCMI_IMX_MISC_CTRL_GET	= 0x4,
> > > > +	SCMI_IMX_MISC_CTRL_NOTIFY = 0x8, };
> > > > +
> > > > +struct scmi_imx_misc_info {
> > > > +	u32 version;
> > > > +	u32 nr_dev_ctrl;
> > > > +	u32 nr_brd_ctrl;
> > > > +	u32 nr_reason;
> > > > +};
> > > > +
> > > > +struct scmi_msg_imx_misc_protocol_attributes {
> > > > +	__le32 attributes;
> > > > +};
> > > > +
> > > > +#define GET_BRD_CTRLS_NR(x)	le32_get_bits((x), GENMASK(31,
> > > 24))
> > > > +#define GET_REASONS_NR(x)	le32_get_bits((x), GENMASK(23,
> 16))
> > > > +#define GET_DEV_CTRLS_NR(x)	le32_get_bits((x), GENMASK(15, 0))
> > > > +#define BRD_CTRL_START_ID	BIT(15)
> > > > +
> > > > +struct scmi_imx_misc_ctrl_set_in {
> > > > +	__le32 id;
> > > > +	__le32 num;
> > > > +	__le32 value[MISC_MAX_VAL];
> > > > +};
> > > > +
> > > > +struct scmi_imx_misc_ctrl_notify_in {
> > > > +	__le32 ctrl_id;
> > > > +	__le32 flags;
> > > > +};
> > > > +
> > > > +struct scmi_imx_misc_ctrl_notify_payld {
> > > > +	__le32 ctrl_id;
> > > > +	__le32 flags;
> > > > +};
> > > > +
> > > > +struct scmi_imx_misc_ctrl_get_out {
> > > > +	__le32 num;
> > > > +	__le32 *val;
> > > > +};
> > > > +
> > > > +static int scmi_imx_misc_attributes_get(const struct
> > > > +scmi_protocol_handle
> > > *ph,
> > > > +					struct scmi_imx_misc_info *mi) {
> > > > +	int ret;
> > > > +	struct scmi_xfer *t;
> > > > +	struct scmi_msg_imx_misc_protocol_attributes *attr;
> > > > +
> > > > +	ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
> > > > +				      sizeof(*attr), &t);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	attr = t->rx.buf;
> > > > +
> > > > +	ret = ph->xops->do_xfer(ph, t);
> > > > +	if (!ret) {
> > > > +		mi->nr_dev_ctrl = GET_DEV_CTRLS_NR(attr->attributes);
> > > > +		mi->nr_brd_ctrl = GET_BRD_CTRLS_NR(attr->attributes);
> > > > +		mi->nr_reason = GET_REASONS_NR(attr->attributes);
> > > > +		dev_info(ph->dev, "i.MX MISC NUM DEV CTRL: %d, NUM
> > > BRD CTRL: %d,NUM Reason: %d\n",
> > > > +			 mi->nr_dev_ctrl, mi->nr_brd_ctrl, mi->nr_reason);
> > > > +	}
> > > > +
> > > > +	ph->xops->xfer_put(ph, t);
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +static int scmi_imx_misc_ctrl_validate_id(const struct
> > > scmi_protocol_handle *ph,
> > > > +					  u32 ctrl_id)
> > > > +{
> > > > +	struct scmi_imx_misc_info *mi = ph->get_priv(ph);
> > > > +
> > > > +	if ((ctrl_id < BRD_CTRL_START_ID) && (ctrl_id > mi->nr_dev_ctrl))
> > > > +		return -EINVAL;
> > > > +	if (ctrl_id >= BRD_CTRL_START_ID + mi->nr_brd_ctrl)
> > > > +		return -EINVAL;
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int scmi_imx_misc_ctrl_notify(const struct
> > > > +scmi_protocol_handle
> > > *ph,
> > > > +				     u32 ctrl_id, u32 flags)
> > > > +{
> > > > +	struct scmi_imx_misc_ctrl_notify_in *in;
> > > > +	struct scmi_xfer *t;
> > > > +	int ret;
> > > > +
> > > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_NOTIFY,
> > > > +				      sizeof(*in), 0, &t);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	in = t->tx.buf;
> > > > +	in->ctrl_id = cpu_to_le32(ctrl_id);
> > > > +	in->flags = cpu_to_le32(flags);
> > > > +
> > > > +	ret = ph->xops->do_xfer(ph, t);
> > > > +
> > > > +	ph->xops->xfer_put(ph, t);
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +static int
> > > > +scmi_imx_misc_ctrl_set_notify_enabled(const struct
> > > scmi_protocol_handle *ph,
> > > > +				      u8 evt_id, u32 src_id, bool enable) {
> > > > +	int ret;
> > > > +
> > > > +	ret = scmi_imx_misc_ctrl_notify(ph, src_id, enable ? evt_id : 0);
> > > > +	if (ret)
> > > > +		dev_err(ph->dev, "FAIL_ENABLED - evt[%X] src[%d] -
> > > ret:%d\n",
> > > > +			evt_id, src_id, ret);
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +static int scmi_imx_misc_ctrl_get_num_sources(const struct
> > > > +scmi_protocol_handle *ph) {
> > > > +	return GENMASK(15, 0);
> > > > +}
> > > > +
> > > > +static void *
> > > > +scmi_imx_misc_ctrl_fill_custom_report(const struct
> > > > +scmi_protocol_handle
> > > *ph,
> > > > +				      u8 evt_id, ktime_t timestamp,
> > > > +				      const void *payld, size_t payld_sz,
> > > > +				      void *report, u32 *src_id) {
> > > > +	const struct scmi_imx_misc_ctrl_notify_payld *p = payld;
> > > > +	struct scmi_imx_misc_ctrl_notify_report *r = report;
> > > > +
> > > > +	if (sizeof(*p) != payld_sz)
> > > > +		return NULL;
> > > > +
> > > > +	r->timestamp = timestamp;
> > > > +	r->ctrl_id = p->ctrl_id;
> > > > +	r->flags = p->flags;
> > > > +	*src_id = r->ctrl_id;
> > > > +	dev_dbg(ph->dev, "%s: ctrl_id: %d flags: %d\n", __func__,
> > > > +		r->ctrl_id, r->flags);
> > > > +
> > > > +	return r;
> > > > +}
> > > > +
> > > > +static const struct scmi_event_ops scmi_imx_misc_event_ops = {
> > > > +	.get_num_sources = scmi_imx_misc_ctrl_get_num_sources,
> > > > +	.set_notify_enabled = scmi_imx_misc_ctrl_set_notify_enabled,
> > > > +	.fill_custom_report = scmi_imx_misc_ctrl_fill_custom_report,
> > > > +};
> > > > +
> > > > +static const struct scmi_event scmi_imx_misc_events[] = {
> > > > +	{
> > > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_DISABLED,
> > > > +		.max_payld_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_payld),
> > > > +		.max_report_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_report),
> > > > +	},
> > > > +	{
> > > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_FALLING_EDGE,
> > > > +		.max_payld_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_payld),
> > > > +		.max_report_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_report),
> > > > +	},
> > > > +	{
> > > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_RISING_EDGE,
> > > > +		.max_payld_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_payld),
> > > > +		.max_report_sz = sizeof(struct
> > > scmi_imx_misc_ctrl_notify_report),
> > > > +	}
> > > > +};
> > > > +
> > > > +static struct scmi_protocol_events scmi_imx_misc_protocol_events = {
> > > > +	.queue_sz = SCMI_PROTO_QUEUE_SZ,
> > > > +	.ops = &scmi_imx_misc_event_ops,
> > > > +	.evts = scmi_imx_misc_events,
> > > > +	.num_events = ARRAY_SIZE(scmi_imx_misc_events), };
> > > > +
> > > > +static int scmi_imx_misc_protocol_init(const struct
> > > > +scmi_protocol_handle *ph) {
> > > > +	struct scmi_imx_misc_info *minfo;
> > > > +	u32 version;
> > > > +	int ret;
> > > > +
> > > > +	ret = ph->xops->version_get(ph, &version);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	dev_info(ph->dev, "NXP SM MISC Version %d.%d\n",
> > > > +		 PROTOCOL_REV_MAJOR(version),
> > > PROTOCOL_REV_MINOR(version));
> > > > +
> > > > +	minfo = devm_kzalloc(ph->dev, sizeof(*minfo), GFP_KERNEL);
> > > > +	if (!minfo)
> > > > +		return -ENOMEM;
> > > > +
> > > > +	ret = scmi_imx_misc_attributes_get(ph, minfo);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	return ph->set_priv(ph, minfo, version); }
> > > > +
> > > > +static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle
> *ph,
> > > > +				  u32 ctrl_id, u32 *num, u32 *val) {
> > > > +	struct scmi_imx_misc_ctrl_get_out *out;
> > > > +	struct scmi_xfer *t;
> > > > +	int ret, i;
> > > > +
> > > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_GET,
> > > sizeof(u32),
> > > > +				      0, &t);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	put_unaligned_le32(ctrl_id, t->tx.buf);
> > > > +	ret = ph->xops->do_xfer(ph, t);
> > > > +	if (!ret) {
> > > > +		out = t->rx.buf;
> > > > +		*num = le32_to_cpu(out->num);
> > > > +		for (i = 0; i < *num && i < MISC_MAX_VAL; i++)
> > > > +			val[i] = le32_to_cpu(out->val[i]);
> > > > +	}
> > > > +
> > > > +	ph->xops->xfer_put(ph, t);
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +static int scmi_imx_misc_ctrl_set(const struct scmi_protocol_handle
> *ph,
> > > > +				  u32 ctrl_id, u32 num, u32 *val) {
> > > > +	struct scmi_imx_misc_ctrl_set_in *in;
> > > > +	struct scmi_xfer *t;
> > > > +	int ret, i;
> > > > +
> > > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	if (num > MISC_MAX_VAL)
> > > > +		return -EINVAL;
> > > > +
> > > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_SET,
> > > sizeof(*in),
> > > > +				      0, &t);
> > > > +	if (ret)
> > > > +		return ret;
> > > > +
> > > > +	in = t->tx.buf;
> > > > +	in->id = cpu_to_le32(ctrl_id);
> > > > +	in->num = cpu_to_le32(num);
> > > > +	for (i = 0; i < num; i++)
> > > > +		in->value[i] = cpu_to_le32(val[i]);
> > > > +
> > > > +	ret = ph->xops->do_xfer(ph, t);
> > > > +
> > > > +	ph->xops->xfer_put(ph, t);
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +static const struct scmi_imx_misc_proto_ops
> > > > +scmi_imx_misc_proto_ops =
> > > {
> > > > +	.misc_ctrl_set = scmi_imx_misc_ctrl_set,
> > > > +	.misc_ctrl_get = scmi_imx_misc_ctrl_get, };
> > > > +
> > > > +static const struct scmi_protocol scmi_imx_misc = {
> > > > +	.id = SCMI_PROTOCOL_IMX_MISC,
> > > > +	.owner = THIS_MODULE,
> > > > +	.instance_init = &scmi_imx_misc_protocol_init,
> > > > +	.ops = &scmi_imx_misc_proto_ops,
> > > > +	.events = &scmi_imx_misc_protocol_events,
> > > > +	.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION, };
> > > > +module_scmi_protocol(scmi_imx_misc);
> > > > diff --git a/include/linux/scmi_imx_protocol.h
> > > > b/include/linux/scmi_imx_protocol.h
> > > > index 90ce011a4429..a69bd4a20f0f 100644
> > > > --- a/include/linux/scmi_imx_protocol.h
> > > > +++ b/include/linux/scmi_imx_protocol.h
> > > > @@ -13,8 +13,14 @@
> > > >  #include <linux/notifier.h>
> > > >  #include <linux/types.h>
> > > >
> > > > +#define SCMI_PAYLOAD_LEN	100
> > > > +
> > > > +#define SCMI_ARRAY(X, Y)	((SCMI_PAYLOAD_LEN - (X)) / sizeof(Y))
> > > > +#define MISC_MAX_VAL		SCMI_ARRAY(8, uint32_t)
> > > > +
> > > >  enum scmi_nxp_protocol {
> > > >  	SCMI_PROTOCOL_IMX_BBM = 0x81,
> > > > +	SCMI_PROTOCOL_IMX_MISC = 0x84,
> > > >  };
> > > >
> > > >  struct scmi_imx_bbm_proto_ops {
> > > > @@ -42,4 +48,15 @@ struct scmi_imx_bbm_notif_report {
> > > >  	unsigned int		rtc_id;
> > > >  	unsigned int		rtc_evt;
> > > >  };
> > > > +
> > > > +struct scmi_imx_misc_ctrl_notify_report {
> > > > +	ktime_t			timestamp;
> > > > +	unsigned int		ctrl_id;
> > > > +	unsigned int		flags;
> > > > +};
> > > > +
> > > > +struct scmi_imx_misc_proto_ops {
> > > > +	int (*misc_ctrl_set)(const struct scmi_protocol_handle *ph, u32
> > > > +id,
> > > u32 num, u32 *val);
> > > > +	int (*misc_ctrl_get)(const struct scmi_protocol_handle *ph, u32
> > > > +id,
> > > > +u32 *num, u32 *val); };
> > > >  #endif
> > > >
> > > > --
> > > > 2.37.1
> > > >
> > > >
> > > >
> >

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

^ permalink raw reply

* Re: [PATCH v2 4/6] firmware: arm_scmi: add initial support for i.MX MISC protocol
From: Marco Felsch @ 2024-04-07 11:02 UTC (permalink / raw)
  To: Peng Fan
  Cc: Peng Fan (OSS), Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Sudeep Holla, Cristian Marussi, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev
In-Reply-To: <DU0PR04MB9417A07F56B7E14DAB3DCE2188012@DU0PR04MB9417.eurprd04.prod.outlook.com>

Hi Peng,

On 24-04-07, Peng Fan wrote:
> > Subject: Re: [PATCH v2 4/6] firmware: arm_scmi: add initial support for i.MX
> > MISC protocol
> > 
> > Hi Peng,
> > 
> > On 24-04-05, Peng Fan (OSS) wrote:
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > The i.MX MISC protocol is for misc settings, such as gpio expander
> > > wakeup.
> > 
> > Can you elaborate a bit more please?
> 
> The gpio expander is under M33(SCMI firmware used core) I2C control,

Due to missing technical references I guess that your specific EVK has
an i2c-expander connected to the system-critical-i2c bus? The
system-critical-i2c should be only used for system critical topics like
PMIC control.

> But the gpio expander supports board function such as PCIE_WAKEUP,
> BTN_WAKEUP. So these are managed by MISC protocol.

This seems more like an specific i.MX95-EVK problem too me since you
have conneccted the i2c-gpio-expander to the system-critical-i2c bus
instead of using an bus available within Linux. Also can you please
provide me a link with the propsoal for the MISC protocol? I can't find
any references within the SCMI v3.2
https://developer.arm.com/documentation/den0056/e/ nor within the SCP
firmware git: https://github.com/ARM-software/SCP-firmware.

> SAI_CLK_MSEL in WAKEUP BLK CTRL is also managed by MISC Protocol.

You recently said that we need blk-ctrl drivers for managing/controlling
the GPR stuff within Linux since the SCMI firmware does not support
this. Now blk-ctrl GPR control is supported by the firmware?

Regards,
  Marco

> 
> And etc...
> 
> I will add more info in commit log in next version later, after I get more
> reviews on the patchset.
> 
> Thanks,
> Peng.
> 
> > 
> > Regards,
> >   Marco
> > 
> > 
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/firmware/arm_scmi/Kconfig       |  10 ++
> > >  drivers/firmware/arm_scmi/Makefile      |   1 +
> > >  drivers/firmware/arm_scmi/imx-sm-misc.c | 305
> > ++++++++++++++++++++++++++++++++
> > >  include/linux/scmi_imx_protocol.h       |  17 ++
> > >  4 files changed, 333 insertions(+)
> > >
> > > diff --git a/drivers/firmware/arm_scmi/Kconfig
> > > b/drivers/firmware/arm_scmi/Kconfig
> > > index 56d11c9d9f47..bfeae92f6420 100644
> > > --- a/drivers/firmware/arm_scmi/Kconfig
> > > +++ b/drivers/firmware/arm_scmi/Kconfig
> > > @@ -191,3 +191,13 @@ config IMX_SCMI_BBM_EXT
> > >  	  and BUTTON.
> > >
> > >  	  This driver can also be built as a module.
> > > +
> > > +config IMX_SCMI_MISC_EXT
> > > +	tristate "i.MX SCMI MISC EXTENSION"
> > > +	depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > > +	default y if ARCH_MXC
> > > +	help
> > > +	  This enables i.MX System MISC control logic such as gpio expander
> > > +	  wakeup
> > > +
> > > +	  This driver can also be built as a module.
> > > diff --git a/drivers/firmware/arm_scmi/Makefile
> > > b/drivers/firmware/arm_scmi/Makefile
> > > index 327687acf857..a23fde721222 100644
> > > --- a/drivers/firmware/arm_scmi/Makefile
> > > +++ b/drivers/firmware/arm_scmi/Makefile
> > > @@ -12,6 +12,7 @@ scmi-transport-
> > $(CONFIG_ARM_SCMI_TRANSPORT_VIRTIO)
> > > += virtio.o
> > >  scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_OPTEE) += optee.o
> > > scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o
> > > system.o voltage.o powercap.o
> > >  scmi-protocols-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o
> > > +scmi-protocols-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o
> > >  scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y)
> > > $(scmi-transport-y)
> > >
> > >  obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o diff --git
> > > a/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > b/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > new file mode 100644
> > > index 000000000000..1b0ec2281518
> > > --- /dev/null
> > > +++ b/drivers/firmware/arm_scmi/imx-sm-misc.c
> > > @@ -0,0 +1,305 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * System control and Management Interface (SCMI) NXP MISC Protocol
> > > + *
> > > + * Copyright 2024 NXP
> > > + */
> > > +
> > > +#define pr_fmt(fmt) "SCMI Notifications MISC - " fmt
> > > +
> > > +#include <linux/bits.h>
> > > +#include <linux/io.h>
> > > +#include <linux/module.h>
> > > +#include <linux/of.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/scmi_protocol.h>
> > > +#include <linux/scmi_imx_protocol.h>
> > > +
> > > +#include "protocols.h"
> > > +#include "notify.h"
> > > +
> > > +#define SCMI_PROTOCOL_SUPPORTED_VERSION		0x10000
> > > +
> > > +enum scmi_imx_misc_protocol_cmd {
> > > +	SCMI_IMX_MISC_CTRL_SET	= 0x3,
> > > +	SCMI_IMX_MISC_CTRL_GET	= 0x4,
> > > +	SCMI_IMX_MISC_CTRL_NOTIFY = 0x8,
> > > +};
> > > +
> > > +struct scmi_imx_misc_info {
> > > +	u32 version;
> > > +	u32 nr_dev_ctrl;
> > > +	u32 nr_brd_ctrl;
> > > +	u32 nr_reason;
> > > +};
> > > +
> > > +struct scmi_msg_imx_misc_protocol_attributes {
> > > +	__le32 attributes;
> > > +};
> > > +
> > > +#define GET_BRD_CTRLS_NR(x)	le32_get_bits((x), GENMASK(31,
> > 24))
> > > +#define GET_REASONS_NR(x)	le32_get_bits((x), GENMASK(23, 16))
> > > +#define GET_DEV_CTRLS_NR(x)	le32_get_bits((x), GENMASK(15, 0))
> > > +#define BRD_CTRL_START_ID	BIT(15)
> > > +
> > > +struct scmi_imx_misc_ctrl_set_in {
> > > +	__le32 id;
> > > +	__le32 num;
> > > +	__le32 value[MISC_MAX_VAL];
> > > +};
> > > +
> > > +struct scmi_imx_misc_ctrl_notify_in {
> > > +	__le32 ctrl_id;
> > > +	__le32 flags;
> > > +};
> > > +
> > > +struct scmi_imx_misc_ctrl_notify_payld {
> > > +	__le32 ctrl_id;
> > > +	__le32 flags;
> > > +};
> > > +
> > > +struct scmi_imx_misc_ctrl_get_out {
> > > +	__le32 num;
> > > +	__le32 *val;
> > > +};
> > > +
> > > +static int scmi_imx_misc_attributes_get(const struct scmi_protocol_handle
> > *ph,
> > > +					struct scmi_imx_misc_info *mi)
> > > +{
> > > +	int ret;
> > > +	struct scmi_xfer *t;
> > > +	struct scmi_msg_imx_misc_protocol_attributes *attr;
> > > +
> > > +	ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
> > > +				      sizeof(*attr), &t);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	attr = t->rx.buf;
> > > +
> > > +	ret = ph->xops->do_xfer(ph, t);
> > > +	if (!ret) {
> > > +		mi->nr_dev_ctrl = GET_DEV_CTRLS_NR(attr->attributes);
> > > +		mi->nr_brd_ctrl = GET_BRD_CTRLS_NR(attr->attributes);
> > > +		mi->nr_reason = GET_REASONS_NR(attr->attributes);
> > > +		dev_info(ph->dev, "i.MX MISC NUM DEV CTRL: %d, NUM
> > BRD CTRL: %d,NUM Reason: %d\n",
> > > +			 mi->nr_dev_ctrl, mi->nr_brd_ctrl, mi->nr_reason);
> > > +	}
> > > +
> > > +	ph->xops->xfer_put(ph, t);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static int scmi_imx_misc_ctrl_validate_id(const struct
> > scmi_protocol_handle *ph,
> > > +					  u32 ctrl_id)
> > > +{
> > > +	struct scmi_imx_misc_info *mi = ph->get_priv(ph);
> > > +
> > > +	if ((ctrl_id < BRD_CTRL_START_ID) && (ctrl_id > mi->nr_dev_ctrl))
> > > +		return -EINVAL;
> > > +	if (ctrl_id >= BRD_CTRL_START_ID + mi->nr_brd_ctrl)
> > > +		return -EINVAL;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int scmi_imx_misc_ctrl_notify(const struct scmi_protocol_handle
> > *ph,
> > > +				     u32 ctrl_id, u32 flags)
> > > +{
> > > +	struct scmi_imx_misc_ctrl_notify_in *in;
> > > +	struct scmi_xfer *t;
> > > +	int ret;
> > > +
> > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_NOTIFY,
> > > +				      sizeof(*in), 0, &t);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	in = t->tx.buf;
> > > +	in->ctrl_id = cpu_to_le32(ctrl_id);
> > > +	in->flags = cpu_to_le32(flags);
> > > +
> > > +	ret = ph->xops->do_xfer(ph, t);
> > > +
> > > +	ph->xops->xfer_put(ph, t);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static int
> > > +scmi_imx_misc_ctrl_set_notify_enabled(const struct
> > scmi_protocol_handle *ph,
> > > +				      u8 evt_id, u32 src_id, bool enable) {
> > > +	int ret;
> > > +
> > > +	ret = scmi_imx_misc_ctrl_notify(ph, src_id, enable ? evt_id : 0);
> > > +	if (ret)
> > > +		dev_err(ph->dev, "FAIL_ENABLED - evt[%X] src[%d] -
> > ret:%d\n",
> > > +			evt_id, src_id, ret);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static int scmi_imx_misc_ctrl_get_num_sources(const struct
> > > +scmi_protocol_handle *ph) {
> > > +	return GENMASK(15, 0);
> > > +}
> > > +
> > > +static void *
> > > +scmi_imx_misc_ctrl_fill_custom_report(const struct scmi_protocol_handle
> > *ph,
> > > +				      u8 evt_id, ktime_t timestamp,
> > > +				      const void *payld, size_t payld_sz,
> > > +				      void *report, u32 *src_id)
> > > +{
> > > +	const struct scmi_imx_misc_ctrl_notify_payld *p = payld;
> > > +	struct scmi_imx_misc_ctrl_notify_report *r = report;
> > > +
> > > +	if (sizeof(*p) != payld_sz)
> > > +		return NULL;
> > > +
> > > +	r->timestamp = timestamp;
> > > +	r->ctrl_id = p->ctrl_id;
> > > +	r->flags = p->flags;
> > > +	*src_id = r->ctrl_id;
> > > +	dev_dbg(ph->dev, "%s: ctrl_id: %d flags: %d\n", __func__,
> > > +		r->ctrl_id, r->flags);
> > > +
> > > +	return r;
> > > +}
> > > +
> > > +static const struct scmi_event_ops scmi_imx_misc_event_ops = {
> > > +	.get_num_sources = scmi_imx_misc_ctrl_get_num_sources,
> > > +	.set_notify_enabled = scmi_imx_misc_ctrl_set_notify_enabled,
> > > +	.fill_custom_report = scmi_imx_misc_ctrl_fill_custom_report,
> > > +};
> > > +
> > > +static const struct scmi_event scmi_imx_misc_events[] = {
> > > +	{
> > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_DISABLED,
> > > +		.max_payld_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_payld),
> > > +		.max_report_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_report),
> > > +	},
> > > +	{
> > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_FALLING_EDGE,
> > > +		.max_payld_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_payld),
> > > +		.max_report_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_report),
> > > +	},
> > > +	{
> > > +		.id = SCMI_EVENT_IMX_MISC_CONTROL_RISING_EDGE,
> > > +		.max_payld_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_payld),
> > > +		.max_report_sz = sizeof(struct
> > scmi_imx_misc_ctrl_notify_report),
> > > +	}
> > > +};
> > > +
> > > +static struct scmi_protocol_events scmi_imx_misc_protocol_events = {
> > > +	.queue_sz = SCMI_PROTO_QUEUE_SZ,
> > > +	.ops = &scmi_imx_misc_event_ops,
> > > +	.evts = scmi_imx_misc_events,
> > > +	.num_events = ARRAY_SIZE(scmi_imx_misc_events), };
> > > +
> > > +static int scmi_imx_misc_protocol_init(const struct
> > > +scmi_protocol_handle *ph) {
> > > +	struct scmi_imx_misc_info *minfo;
> > > +	u32 version;
> > > +	int ret;
> > > +
> > > +	ret = ph->xops->version_get(ph, &version);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	dev_info(ph->dev, "NXP SM MISC Version %d.%d\n",
> > > +		 PROTOCOL_REV_MAJOR(version),
> > PROTOCOL_REV_MINOR(version));
> > > +
> > > +	minfo = devm_kzalloc(ph->dev, sizeof(*minfo), GFP_KERNEL);
> > > +	if (!minfo)
> > > +		return -ENOMEM;
> > > +
> > > +	ret = scmi_imx_misc_attributes_get(ph, minfo);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	return ph->set_priv(ph, minfo, version); }
> > > +
> > > +static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle *ph,
> > > +				  u32 ctrl_id, u32 *num, u32 *val) {
> > > +	struct scmi_imx_misc_ctrl_get_out *out;
> > > +	struct scmi_xfer *t;
> > > +	int ret, i;
> > > +
> > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_GET,
> > sizeof(u32),
> > > +				      0, &t);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	put_unaligned_le32(ctrl_id, t->tx.buf);
> > > +	ret = ph->xops->do_xfer(ph, t);
> > > +	if (!ret) {
> > > +		out = t->rx.buf;
> > > +		*num = le32_to_cpu(out->num);
> > > +		for (i = 0; i < *num && i < MISC_MAX_VAL; i++)
> > > +			val[i] = le32_to_cpu(out->val[i]);
> > > +	}
> > > +
> > > +	ph->xops->xfer_put(ph, t);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static int scmi_imx_misc_ctrl_set(const struct scmi_protocol_handle *ph,
> > > +				  u32 ctrl_id, u32 num, u32 *val) {
> > > +	struct scmi_imx_misc_ctrl_set_in *in;
> > > +	struct scmi_xfer *t;
> > > +	int ret, i;
> > > +
> > > +	ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	if (num > MISC_MAX_VAL)
> > > +		return -EINVAL;
> > > +
> > > +	ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CTRL_SET,
> > sizeof(*in),
> > > +				      0, &t);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	in = t->tx.buf;
> > > +	in->id = cpu_to_le32(ctrl_id);
> > > +	in->num = cpu_to_le32(num);
> > > +	for (i = 0; i < num; i++)
> > > +		in->value[i] = cpu_to_le32(val[i]);
> > > +
> > > +	ret = ph->xops->do_xfer(ph, t);
> > > +
> > > +	ph->xops->xfer_put(ph, t);
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static const struct scmi_imx_misc_proto_ops scmi_imx_misc_proto_ops =
> > {
> > > +	.misc_ctrl_set = scmi_imx_misc_ctrl_set,
> > > +	.misc_ctrl_get = scmi_imx_misc_ctrl_get, };
> > > +
> > > +static const struct scmi_protocol scmi_imx_misc = {
> > > +	.id = SCMI_PROTOCOL_IMX_MISC,
> > > +	.owner = THIS_MODULE,
> > > +	.instance_init = &scmi_imx_misc_protocol_init,
> > > +	.ops = &scmi_imx_misc_proto_ops,
> > > +	.events = &scmi_imx_misc_protocol_events,
> > > +	.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION, };
> > > +module_scmi_protocol(scmi_imx_misc);
> > > diff --git a/include/linux/scmi_imx_protocol.h
> > > b/include/linux/scmi_imx_protocol.h
> > > index 90ce011a4429..a69bd4a20f0f 100644
> > > --- a/include/linux/scmi_imx_protocol.h
> > > +++ b/include/linux/scmi_imx_protocol.h
> > > @@ -13,8 +13,14 @@
> > >  #include <linux/notifier.h>
> > >  #include <linux/types.h>
> > >
> > > +#define SCMI_PAYLOAD_LEN	100
> > > +
> > > +#define SCMI_ARRAY(X, Y)	((SCMI_PAYLOAD_LEN - (X)) / sizeof(Y))
> > > +#define MISC_MAX_VAL		SCMI_ARRAY(8, uint32_t)
> > > +
> > >  enum scmi_nxp_protocol {
> > >  	SCMI_PROTOCOL_IMX_BBM = 0x81,
> > > +	SCMI_PROTOCOL_IMX_MISC = 0x84,
> > >  };
> > >
> > >  struct scmi_imx_bbm_proto_ops {
> > > @@ -42,4 +48,15 @@ struct scmi_imx_bbm_notif_report {
> > >  	unsigned int		rtc_id;
> > >  	unsigned int		rtc_evt;
> > >  };
> > > +
> > > +struct scmi_imx_misc_ctrl_notify_report {
> > > +	ktime_t			timestamp;
> > > +	unsigned int		ctrl_id;
> > > +	unsigned int		flags;
> > > +};
> > > +
> > > +struct scmi_imx_misc_proto_ops {
> > > +	int (*misc_ctrl_set)(const struct scmi_protocol_handle *ph, u32 id,
> > u32 num, u32 *val);
> > > +	int (*misc_ctrl_get)(const struct scmi_protocol_handle *ph, u32 id,
> > > +u32 *num, u32 *val); };
> > >  #endif
> > >
> > > --
> > > 2.37.1
> > >
> > >
> > >
> 

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

^ permalink raw reply

* Re: [PATCH 2/4] arm64: dts: rockchip: drop redundant bus-scan-delay-ms in Pinebook
From: Dragan Simic @ 2024-04-07 10:34 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
In-Reply-To: <20240407102854.38672-2-krzysztof.kozlowski@linaro.org>

Hello Krzysztof,

On 2024-04-07 12:28, Krzysztof Kozlowski wrote:
> There is no "bus-scan-delay-ms" property in the PCI bindings or Linux
> driver, so assume this was copied from downstream.  This fixes
> dtbs_check warning:
> 
>   rk3399-pinebook-pro.dtb: pcie@f8000000: Unevaluated properties are
> not allowed ('bus-scan-delay-ms' was unexpected)

Please note that it's been already deleted. [1]

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=43853e843aa6c3d47ff2b0cce898318839483d05

> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
> b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
> index 054c6a4d1a45..294eb2de263d 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
> @@ -779,7 +779,6 @@ &pcie_phy {
>  };
> 
>  &pcie0 {
> -	bus-scan-delay-ms = <1000>;
>  	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
>  	num-lanes = <4>;
>  	pinctrl-names = "default";

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

^ permalink raw reply

* [PATCH 2/4] arm64: dts: rockchip: drop redundant bus-scan-delay-ms in Pinebook
From: Krzysztof Kozlowski @ 2024-04-07 10:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Krzysztof Kozlowski
In-Reply-To: <20240407102854.38672-1-krzysztof.kozlowski@linaro.org>

There is no "bus-scan-delay-ms" property in the PCI bindings or Linux
driver, so assume this was copied from downstream.  This fixes
dtbs_check warning:

  rk3399-pinebook-pro.dtb: pcie@f8000000: Unevaluated properties are not allowed ('bus-scan-delay-ms' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
index 054c6a4d1a45..294eb2de263d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
@@ -779,7 +779,6 @@ &pcie_phy {
 };
 
 &pcie0 {
-	bus-scan-delay-ms = <1000>;
 	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
 	num-lanes = <4>;
 	pinctrl-names = "default";
-- 
2.34.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

* [PATCH 1/4] arm64: dts: rockchip: drop redundant pcie-reset-suspend in Scarlet Dumo
From: Krzysztof Kozlowski @ 2024-04-07 10:28 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Krzysztof Kozlowski

There is no "pcie-reset-suspend" property in the PCI bindings or Linux
driver, so assume this was copied from downstream.  Drop the property,
but leave the comment, because it might be useful for someone.

This fixes dtbs_check warning:

  rk3399-gru-scarlet-dumo.dtb: pcie@f8000000: Unevaluated properties are not allowed ('pcie-reset-suspend' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi
index 5846a11f0e84..b9d64048d46c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi
@@ -689,7 +689,6 @@ &pcie0 {
 	ep-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
 
 	/* PERST# asserted in S3 */
-	pcie-reset-suspend = <1>;
 
 	vpcie3v3-supply = <&wlan_3v3>;
 	vpcie1v8-supply = <&pp1800_pcie>;
-- 
2.34.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

* [PATCH] arm64: dts: cavium: thunder2-99xx:: drop redundant reg-names
From: Krzysztof Kozlowski @ 2024-04-07 10:28 UTC (permalink / raw)
  To: Robert Richter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-arm-kernel, devicetree, linux-kernel
  Cc: Krzysztof Kozlowski

There is no "reg-names" property in the PCI bindings and the value does
not conform to Devicetree coding style (upper-case letters, space), so
assume this was copied from downstream.

This fixes dtbs_check warning:

  thunder2-99xx.dtb: pcie@30000000: Unevaluated properties are not allowed ('reg-names' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 arch/arm64/boot/dts/cavium/thunder2-99xx.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/cavium/thunder2-99xx.dtsi b/arch/arm64/boot/dts/cavium/thunder2-99xx.dtsi
index 3419bd252696..874d4d3a4e4f 100644
--- a/arch/arm64/boot/dts/cavium/thunder2-99xx.dtsi
+++ b/arch/arm64/boot/dts/cavium/thunder2-99xx.dtsi
@@ -103,7 +103,6 @@ pcie@30000000 {
 
 		/* ECAM at 0x3000_0000 - 0x4000_0000 */
 		reg = <0x0 0x30000000  0x0 0x10000000>;
-		reg-names = "PCI ECAM";
 
 		/*
 		 * PCI ranges:
-- 
2.34.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

* RE: [PATCH v2 2/6] dt-bindings: firmware: add i.MX SCMI Extension protocol
From: Peng Fan @ 2024-04-07 10:15 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Peng Fan (OSS), Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Sudeep Holla,
	Cristian Marussi
  Cc: devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <ca7f1e62-5f70-4aa5-b539-764b778a71e5@kernel.org>

> Subject: Re: [PATCH v2 2/6] dt-bindings: firmware: add i.MX SCMI Extension
> protocol
> 
> On 07/04/2024 02:51, Peng Fan wrote:
> >> Subject: Re: [PATCH v2 2/6] dt-bindings: firmware: add i.MX SCMI
> >> Extension protocol
> >>
> >> On 05/04/2024 14:39, Peng Fan (OSS) wrote:
> >>> From: Peng Fan <peng.fan@nxp.com>
> >>>
> >>> Add i.MX SCMI Extension protocols bindings for:
> >>>  - Battery Backed Secure Module(BBSM)
> >>
> >> Which is what?
> >
> > I should say BBM(BBSM + BBNSM), BBM has RTC and ON/OFF key features,
> > but BBM is managed by SCMI firmware and exported to agent by BBM
> > protocol. So add bindings for i.MX BBM protocol.
> >
> > Is this ok?
> 
> No, I still don't know what is BBSM, BBNSM and BBM.

From RM:
The Battery Backup (BB) Domain contains the Battery Backed
Security Module (BBSM) and the Battery Backed Non-Secure
Module (BBNSM).
BBNSM:
The BBNSM is the interface to a non-interruptable power
supply (backup battery) and serves as the non-volatile logic
and storage for the chip. When the chip is powered off, the
BBNSM will maintain PMIC logic while connected to a backup supply.
Main features: RTC, PMIC Control, ONOFF Control
BBSM serves as nonvolatile security logic and storage for ELE
Main features: Monotonic counter, Secure RTC,
Zeroizable Master Key,
Security Violation and Tamper Detection

> 
> >
> >>
> >>>  - MISC settings such as General Purpose Registers settings.
> >>>
> >>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >>> ---
> >>>  .../devicetree/bindings/firmware/imx,scmi.yaml     | 80
> >> ++++++++++++++++++++++
> >>>  1 file changed, 80 insertions(+)
> >>>
> >>> diff --git
> >>> a/Documentation/devicetree/bindings/firmware/imx,scmi.yaml
> >>> b/Documentation/devicetree/bindings/firmware/imx,scmi.yaml
> >>> new file mode 100644
> >>> index 000000000000..7ee19a661d83
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/firmware/imx,scmi.yaml
> >>> @@ -0,0 +1,80 @@
> >>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) # Copyright
> >>> +2024 NXP %YAML 1.2
> >>> +---
> >>> +$id:
> >>> +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fde
> >>>
> +vi%2F&data=05%7C02%7Cpeng.fan%40nxp.com%7C410d9f1b5b874269dc6
> 908dc5
> >>>
> +6e0b628%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638480
> 77032584
> >>>
> +3394%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2l
> uMzIiLC
> >>>
> +JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=e4zKRcyHbSCtn
> o6%2B%
> >>> +2BBaz%2FGhvPT0HikAdLmwi4VZxX4o%3D&reserved=0
> >>>
> >>
> +cetree.org%2Fschemas%2Ffirmware%2Fimx%2Cscmi.yaml%23&data=05%7
> >> C02%7Cp
> >>>
> >>
> +eng.fan%40nxp.com%7C5d16781d3eca425a342508dc562910b7%7C686ea
> >> 1d3bc2b4c
> >>>
> >>
> +6fa92cd99c5c301635%7C0%7C0%7C638479981570959816%7CUnknown%
> >> 7CTWFpbGZsb
> >>>
> >>
> +3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> >> 0%3D
> >>>
> >>
> +%7C0%7C%7C%7C&sdata=mWNwPvu2eyF18MroVOBHb%2Fjeo%2BIHfV5V
> >> h%2F9ebdx65MM
> >>> +%3D&reserved=0
> >>> +$schema:
> >>> +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fde
> >>>
> +vi%2F&data=05%7C02%7Cpeng.fan%40nxp.com%7C410d9f1b5b874269dc6
> 908dc5
> >>>
> +6e0b628%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638480
> 77032585
> >>>
> +6477%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2l
> uMzIiLC
> >>>
> +JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=y1OBJ%2FPp4
> MljifpmG
> >>> +ZM%2FB6Ab20ivqm2qef7gzEjbNmA%3D&reserved=0
> >>> +cetree.org%2Fmeta-
> >> schemas%2Fcore.yaml%23&data=05%7C02%7Cpeng.fan%40nx
> >>>
> >>
> +p.com%7C5d16781d3eca425a342508dc562910b7%7C686ea1d3bc2b4c6fa
> >> 92cd99c5c
> >>>
> >>
> +301635%7C0%7C0%7C638479981570971949%7CUnknown%7CTWFpbGZs
> >> b3d8eyJWIjoiM
> >>>
> >>
> +C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7
> >> C%7C%7
> >>>
> >>
> +C&sdata=v4XnGG00D4I8j5MJvDUVYMRTm7yRrvz0V3fUyc5KAAA%3D&reser
> >> ved=0
> >>> +
> >>> +title: i.MX System Control and Management Interface(SCMI) Vendor
> >>> +Protocols Extension
> >>> +
> >>> +maintainers:
> >>> +  - Peng Fan <peng.fan@nxp.com>
> >>> +
> >>> +allOf:
> >>> +  - $ref: arm,scmi.yaml#
> >>
> >> Sorry, but arm,scmi is a final schema. Is your plan to define some
> >> common part?
> >
> > No. I just wanna add vendor extension per SCMI spec.
> >
> > 0x80-0xFF:
> > Reserved for vendor or platform-specific extensions to this interface
> >
> > Each vendor may have different usage saying id 0x81, so I add i.MX
> > dt-schema file.
> >
> >>
> >>> +
> >>> +properties:
> >>> +  protocol@81:
> >>> +    $ref: 'arm,scmi.yaml#/$defs/protocol-node'
> >>> +    unevaluatedProperties: false
> >>> +    description:
> >>> +      The BBM Protocol is for managing Battery Backed Secure Module
> >> (BBSM) RTC
> >>> +      and the ON/OFF Key
> >>> +
> >>> +    properties:
> >>> +      reg:
> >>> +        const: 0x81
> >>> +
> >>> +    required:
> >>> +      - reg
> >>> +
> >>> +  protocol@84:
> >>> +    $ref: 'arm,scmi.yaml#/$defs/protocol-node'
> >>> +    unevaluatedProperties: false
> >>> +    description:
> >>> +      The MISC Protocol is for managing SoC Misc settings, such as
> >>> + GPR settings
> >>
> >> Genera register is not a setting... this is a pleonasm. Please be
> >> more specific what is the GPR, MISC protocol etc.
> >
> > The MISC Protocol is for managing SoC Misc settings, such as SAI
> > MCLK/MQS in Always On domain BLK CTRL,  SAI_CLK_SEL in WAKEUP BLK
> > CTRL, gpio expanders which is under control of SCMI firmware.
> 
> So like a bag for everything which you do not want to call something specific?
> 
> No, be specific...

This is not linux stuff, this is i.MX SCMI firmware design.

Sadly there is no public RM for i.MX95, we could not afford each settings
has a protocol ID, it is too heavy. The name MISC is not developed for linux,
it is firmware owner decided to use it.

> 
> >
> >>> +
> >>> +    properties:
> >>> +      reg:
> >>> +        const: 0x84
> >>> +
> >>> +      wakeup-sources:
> >>> +        description:
> >>> +          Each entry consists of 2 integers, represents the source
> >>> + and electric signal edge
> >>
> >> Can you answer questions from reviewers?
> >
> > Sorry. Is this ok?
> > minItems: 1
> > maxItems: 32
> 
> No. Does it answers Rob's question? I see zero correlation to his question.

Constraints and edge, right? Edge, I have use electric signal edge, so
what else?

> 
> Do not ignore emails from reviewers but respond to them.
> 
> >
> >>
> >>> +        items:
> >>> +          items:
> >>> +            - description: the wakeup source
> >>> +            - description: the wakeup electric signal edge
> >>> +        $ref: /schemas/types.yaml#/definitions/uint32-matrix
> >>> +
> >>> +    required:
> >>> +      - reg
> >>> +
> >>> +additionalProperties: false
> >>> +
> >>> +examples:
> >>> +  - |
> >>> +    firmware {
> >>> +        scmi {
> >>> +            compatible = "arm,scmi";
> >>
> >>> +            mboxes = <&mu2 5 0>, <&mu2 3 0>, <&mu2 3 1>;
> >>> +            shmem = <&scmi_buf0>, <&scmi_buf1>;
> >>> +
> >>> +            #address-cells = <1>;
> >>> +            #size-cells = <0>;
> >>> +
> >>> +            protocol@81 {
> >>> +                reg = <0x81>;
> >>> +            };
> >>> +
> >>> +            protocol@84 {
> >>> +                reg = <0x84>;
> >>> +                wakeup-sources = <0x8000 1
> >>> +                                  0x8001 1
> >>> +                                  0x8002 1
> >>> +                                  0x8003 1
> >>> +                                  0x8004 1>;
> >>
> >> Nothing improved... If you are going to ignore reviews, then you will
> >> only get NAKed.
> >
> > Sorry, you mean the examples, or the whole dt-schema?
> 
> *Read comments and respond to them*. Regardless where they are.

Yeah. My bad.

Thanks,
Peng
> 
> Best regards,
> Krzysztof


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

^ permalink raw reply

* Re: [RFC][PATCH 0/2] Amlogic T7 (A113D2) Clock Driver
From: Xianwei Zhao @ 2024-04-07 10:08 UTC (permalink / raw)
  To: tanure
  Cc: Yu Tu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Stephen Boyd, Michael Turquette, linux-arm-kernel,
	linux-amlogic, devicetree, linux-kernel, linux-clk
In-Reply-To: <CAJX_Q+2wA+hNDhYtOsMi-DyuvH0KfkVgbsVFBFDj=Ph4fOEJaw@mail.gmail.com>

Hi Lucas,
    Thanks for your reply.

On 2024/4/3 16:12, Lucas Tanure wrote:
> [ EXTERNAL EMAIL ]
> 
> On Wed, Apr 3, 2024 at 7:44 AM Xianwei Zhao <xianwei.zhao@amlogic.com> wrote:
>>
>> Hi Lucas,
>>      As we are preparing the T7 clock patchset, we would like to your
>> purpose and plan of this RFC patches. Are you going to submit these
>> patches at last?
> 
> Hi Xianwei,
> 
> I made some progress, and now the SD card controller probes but fails
> to read blocks from the SD card. I do think my port of the clock
> driver is okay, but I will not send my clock driver until the SD card
> fully works, so I am sure the clocking driver is tested.
> But if you have something already done, please send it, and I will
> test and review it from my side.
> 
> Any help with the sdcard controller is also much appreciated.
> The SDCard part works well on our clock patchset. Then we will send the 
formal clock submission later. What do you think?
> Thanks
> Lucas
> 
>> On 2024/3/18 19:43, Lucas Tanure wrote:
>>> [ EXTERNAL EMAIL ]
>>>
>>> I am trying to port the T7 clock driver from Khadas 5.4 kernel for Vim4
>>> to mainline, but I am encountering some issues in the path.
>>>
>>> The kernel panics at clk_mux_val_to_index, but I believe that all the
>>> needed clocks are registered.
>>>
>>> If anyone from Amlogic or the community could help me understand what
>>> my driver is missing, that would be great.
>>> I will continue to try to figure out, but it has been some weeks
>>> without progress =/.
>>>
>>> Lucas Tanure (2):
>>>     clk: meson: T7: add support for Amlogic T7 SoC PLL clock driver
>>>     arm64: dts: amlogic: t7: SDCard, Ethernet and Clocking
>>>
>>>    .../amlogic/amlogic-t7-a311d2-khadas-vim4.dts |   66 +
>>>    arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi   |  189 +
>>>    drivers/clk/meson/Kconfig                     |   25 +
>>>    drivers/clk/meson/Makefile                    |    2 +
>>>    drivers/clk/meson/t7-peripherals.c            | 6368 +++++++++++++++++
>>>    drivers/clk/meson/t7-peripherals.h            |  131 +
>>>    drivers/clk/meson/t7-pll.c                    | 1543 ++++
>>>    drivers/clk/meson/t7-pll.h                    |   83 +
>>>    .../clock/amlogic,t7-peripherals-clkc.h       |  410 ++
>>>    .../dt-bindings/clock/amlogic,t7-pll-clkc.h   |   69 +
>>>    10 files changed, 8886 insertions(+)
>>>    create mode 100644 drivers/clk/meson/t7-peripherals.c
>>>    create mode 100644 drivers/clk/meson/t7-peripherals.h
>>>    create mode 100644 drivers/clk/meson/t7-pll.c
>>>    create mode 100644 drivers/clk/meson/t7-pll.h
>>>    create mode 100644 include/dt-bindings/clock/amlogic,t7-peripherals-clkc.h
>>>    create mode 100644 include/dt-bindings/clock/amlogic,t7-pll-clkc.h
>>>
>>> Starting kernel ...
>>>
>>> uboot time: 14277917 us
>>> boot 64bit kernel
>>> [    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd092]
>>> [    0.000000] Linux version 6.8.0-09793-gda876e5b54b3-dirty (tanureal@ryzen) (aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621, GNU ld (GNU Toolchain for the A-pr4
>>> [    0.000000] KASLR disabled due to lack of seed
>>> [    0.000000] Machine model: Khadas vim4
>>> [    0.000000] efi: UEFI not found.
>>> [    0.000000] OF: reserved mem: 0x0000000005000000..0x00000000052fffff (3072 KiB) nomap non-reusable secmon@5000000
>>> [    0.000000] OF: reserved mem: 0x0000000005300000..0x00000000072fffff (32768 KiB) nomap non-reusable secmon@5300000
>>> [    0.000000] NUMA: No NUMA configuration found
>>> [    0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x00000000df7fffff]
>>> [    0.000000] NUMA: NODE_DATA [mem 0xdf10c9c0-0xdf10efff]
>>> [    0.000000] Zone ranges:
>>> [    0.000000]   DMA      [mem 0x0000000000000000-0x00000000df7fffff]
>>> [    0.000000]   DMA32    empty
>>> [    0.000000]   Normal   empty
>>> [    0.000000] Movable zone start for each node
>>> [    0.000000] Early memory node ranges
>>> [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000004ffffff]
>>> [    0.000000]   node   0: [mem 0x0000000005000000-0x00000000072fffff]
>>> [    0.000000]   node   0: [mem 0x0000000007300000-0x00000000df7fffff]
>>> [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000000df7fffff]
>>> [    0.000000] On node 0, zone DMA: 2048 pages in unavailable ranges
>>> [    0.000000] cma: Reserved 32 MiB at 0x00000000d9800000 on node -1
>>> [    0.000000] psci: probing for conduit method from DT.
>>> [    0.000000] psci: PSCIv1.0 detected in firmware.
>>> [    0.000000] psci: Using standard PSCI v0.2 function IDs
>>> [    0.000000] psci: Trusted OS migration not required
>>> [    0.000000] psci: SMC Calling Convention v1.1
>>> [    0.000000] percpu: Embedded 24 pages/cpu s58152 r8192 d31960 u98304
>>> [    0.000000] Detected VIPT I-cache on CPU0
>>> [    0.000000] CPU features: detected: Spectre-v2
>>> [    0.000000] CPU features: detected: Spectre-v4
>>> [    0.000000] CPU features: detected: Spectre-BHB
>>> [    0.000000] CPU features: detected: ARM erratum 858921
>>> [    0.000000] alternatives: applying boot alternatives
>>> [    0.000000] Kernel command line: root=UUID=a91e7bfe-4263-4e53-867d-7824e7c6a992 rw rootfstype=ext4 console=ttyS0,921600 no_console_suspend earlycon=ttyS0,0xfe078000 khadas_board=VIM4 androidboot.selinux=permissive androidboot.0
>>> [    0.000000] Unknown kernel command line parameters "khadas_board=VIM4", will be passed to user space.
>>> [    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
>>> [    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
>>> [    0.000000] Fallback order for Node 0: 0
>>> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 901152
>>> [    0.000000] Policy zone: DMA
>>> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
>>> [    0.000000] software IO TLB: SWIOTLB bounce buffer size adjusted to 3MB
>>> [    0.000000] software IO TLB: area num 8.
>>> [    0.000000] software IO TLB: SWIOTLB bounce buffer size roundup to 4MB
>>> [    0.000000] software IO TLB: mapped [mem 0x00000000d8e00000-0x00000000d9200000] (4MB)
>>> [    0.000000] Memory: 3445944K/3661824K available (16896K kernel code, 4426K rwdata, 9184K rodata, 9728K init, 611K bss, 183112K reserved, 32768K cma-reserved)
>>> [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
>>> [    0.000000] rcu: Preemptible hierarchical RCU implementation.
>>> [    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=8.
>>> [    0.000000]  Trampoline variant of Tasks RCU enabled.
>>> [    0.000000]  Tracing variant of Tasks RCU enabled.
>>> [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
>>> [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
>>> [    0.000000] RCU Tasks: Setting shift to 3 and lim to 1 rcu_task_cb_adjust=1.
>>> [    0.000000] RCU Tasks Trace: Setting shift to 3 and lim to 1 rcu_task_cb_adjust=1.
>>> [    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
>>> [    0.000000] GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set
>>> [    0.000000] Root IRQ handler: gic_handle_irq
>>> [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
>>> [    0.000000] arch_timer: Enabling local workaround for ARM erratum 858921
>>> [    0.000000] arch_timer: CPU0: Trapping CNTVCT access
>>> [    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
>>> [    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
>>> [    0.000000] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
>>> [    0.000210] Console: colour dummy device 80x25
>>> [    0.000253] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
>>> [    0.000261] pid_max: default: 32768 minimum: 301
>>> [    0.000300] LSM: initializing lsm=capability
>>> [    0.000358] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
>>> [    0.000371] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
>>> [    0.000920] cacheinfo: Unable to detect cache hierarchy for CPU 0
>>> [    0.001389] rcu: Hierarchical SRCU implementation.
>>> [    0.001391] rcu:     Max phase no-delay instances is 1000.
>>> [    0.001834] EFI services will not be available.
>>> [    0.001999] smp: Bringing up secondary CPUs ...
>>> [    0.002408] CPU features: detected: ARM erratum 845719
>>> [    0.002426] Detected VIPT I-cache on CPU1
>>> [    0.002516] CPU1: Booted secondary processor 0x0000000100 [0x410fd034]
>>> [    0.003007] Detected VIPT I-cache on CPU2
>>> [    0.003054] CPU2: Booted secondary processor 0x0000000101 [0x410fd034]
>>> [    0.003497] Detected VIPT I-cache on CPU3
>>> [    0.003546] CPU3: Booted secondary processor 0x0000000102 [0x410fd034]
>>> [    0.003988] Detected VIPT I-cache on CPU4
>>> [    0.004038] CPU4: Booted secondary processor 0x0000000103 [0x410fd034]
>>> [    0.004472] Detected VIPT I-cache on CPU5
>>> [    0.004509] arch_timer: Enabling local workaround for ARM erratum 858921
>>> [    0.004519] arch_timer: CPU5: Trapping CNTVCT access
>>> [    0.004527] CPU5: Booted secondary processor 0x0000000001 [0x410fd092]
>>> [    0.004915] Detected VIPT I-cache on CPU6
>>> [    0.004940] arch_timer: Enabling local workaround for ARM erratum 858921
>>> [    0.004946] arch_timer: CPU6: Trapping CNTVCT access
>>> [    0.004951] CPU6: Booted secondary processor 0x0000000002 [0x410fd092]
>>> [    0.005333] Detected VIPT I-cache on CPU7
>>> [    0.005358] arch_timer: Enabling local workaround for ARM erratum 858921
>>> [    0.005364] arch_timer: CPU7: Trapping CNTVCT access
>>> [    0.005369] CPU7: Booted secondary processor 0x0000000003 [0x410fd092]
>>> [    0.005414] smp: Brought up 1 node, 8 CPUs
>>> [    0.005419] SMP: Total of 8 processors activated.
>>> [    0.005421] CPU: All CPU(s) started at EL2
>>> [    0.005434] CPU features: detected: 32-bit EL0 Support
>>> [    0.005437] CPU features: detected: 32-bit EL1 Support
>>> [    0.005440] CPU features: detected: CRC32 instructions
>>> [    0.005485] alternatives: applying system-wide alternatives
>>> [    0.006730] devtmpfs: initialized
>>> [    0.008534] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
>>> [    0.008545] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
>>> [    0.008989] pinctrl core: initialized pinctrl subsystem
>>> [    0.009581] DMI not present or invalid.
>>> [    0.011290] NET: Registered PF_NETLINK/PF_ROUTE protocol family
>>> [    0.011944] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
>>> [    0.012293] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
>>> [    0.012711] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
>>> [    0.012832] audit: initializing netlink subsys (disabled)
>>> [    0.013075] audit: type=2000 audit(0.012:1): state=initialized audit_enabled=0 res=1
>>> [    0.013508] thermal_sys: Registered thermal governor 'step_wise'
>>> [    0.013512] thermal_sys: Registered thermal governor 'power_allocator'
>>> [    0.013557] cpuidle: using governor menu
>>> [    0.013675] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
>>> [    0.013784] ASID allocator initialised with 65536 entries
>>> [    0.014630] Serial: AMBA PL011 UART driver
>>> [    0.017553] Modules: 22496 pages in range for non-PLT usage
>>> [    0.017556] Modules: 514016 pages in range for PLT usage
>>> [    0.017980] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
>>> [    0.017984] HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
>>> [    0.017988] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
>>> [    0.017990] HugeTLB: 0 KiB vmemmap can be freed for a 32.0 MiB page
>>> [    0.017993] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
>>> [    0.017995] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page
>>> [    0.017997] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
>>> [    0.018000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
>>> [    0.018247] Demotion targets for Node 0: null
>>> [    0.018884] ACPI: Interpreter disabled.
>>> [    0.019584] iommu: Default domain type: Translated
>>> [    0.019587] iommu: DMA domain TLB invalidation policy: strict mode
>>> [    0.019979] SCSI subsystem initialized
>>> [    0.020174] usbcore: registered new interface driver usbfs
>>> [    0.020187] usbcore: registered new interface driver hub
>>> [    0.020200] usbcore: registered new device driver usb
>>> [    0.020434] pps_core: LinuxPPS API ver. 1 registered
>>> [    0.020437] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
>>> [    0.020443] PTP clock support registered
>>> [    0.020487] EDAC MC: Ver: 3.0.0
>>> [    0.020717] scmi_core: SCMI protocol bus registered
>>> [    0.021039] FPGA manager framework
>>> [    0.021076] Advanced Linux Sound Architecture Driver Initialized.
>>> [    0.021612] vgaarb: loaded
>>> [    0.021857] clocksource: Switched to clocksource arch_sys_counter
>>> [    0.021967] VFS: Disk quotas dquot_6.6.0
>>> [    0.021984] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
>>> [    0.022062] pnp: PnP ACPI: disabled
>>> [    0.026651] NET: Registered PF_INET protocol family
>>> [    0.026781] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
>>> [    0.028598] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
>>> [    0.028615] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
>>> [    0.028622] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
>>> [    0.028750] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
>>> [    0.029019] TCP: Hash tables configured (established 32768 bind 32768)
>>> [    0.029096] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
>>> [    0.029124] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
>>> [    0.029225] NET: Registered PF_UNIX/PF_LOCAL protocol family
>>> [    0.029506] RPC: Registered named UNIX socket transport module.
>>> [    0.029510] RPC: Registered udp transport module.
>>> [    0.029512] RPC: Registered tcp transport module.
>>> [    0.029513] RPC: Registered tcp-with-tls transport module.
>>> [    0.029515] RPC: Registered tcp NFSv4.1 backchannel transport module.
>>> [    0.029524] PCI: CLS 0 bytes, default 64
>>> [    0.029649] Unpacking initramfs...
>>> [    0.033933] kvm [1]: IPA Size Limit: 40 bits
>>> [    0.034713] kvm [1]: Hyp mode initialized successfully
>>> [    0.035476] Initialise system trusted keyrings
>>> [    0.035582] workingset: timestamp_bits=42 max_order=20 bucket_order=0
>>> [    0.035747] squashfs: version 4.0 (2009/01/31) Phillip Lougher
>>> [    0.035906] NFS: Registering the id_resolver key type
>>> [    0.035919] Key type id_resolver registered
>>> [    0.035922] Key type id_legacy registered
>>> [    0.035933] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
>>> [    0.035935] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
>>> [    0.036031] 9p: Installing v9fs 9p2000 file system support
>>> [    0.062587] Key type asymmetric registered
>>> [    0.062596] Asymmetric key parser 'x509' registered
>>> [    0.062657] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
>>> [    0.062661] io scheduler mq-deadline registered
>>> [    0.062664] io scheduler kyber registered
>>> [    0.062688] io scheduler bfq registered
>>> [    0.063318] irq_meson_gpio: 157 to 12 gpio interrupt mux initialized
>>> [    0.068061] EINJ: ACPI disabled.
>>> [    0.072570] amlogic_t7_pll_probe
>>> [    0.072855] amlogic_t7_pll_probe ret 0
>>> [    0.072943] amlogic_a1_periphs_probe
>>> [    0.078155] amlogic_a1_periphs_probe ret 0
>>> [    0.084876] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
>>> [    0.086691] fe078000.serial: ttyS0 at MMIO 0xfe078000 (irq = 14, base_baud = 1500000) is a meson_uart
>>> [    0.086710] printk: legacy console [ttyS0] enabled
>>> [    0.229167] sysfs: cannot create duplicate filename '/class/tty/ttyS0'
>>> [    0.229669] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 6.8.0-09793-gda876e5b54b3-dirty #15
>>> [    0.230684] Hardware name: Khadas vim4 (DT)
>>> [    0.231205] Call trace:
>>> [    0.231509]  dump_backtrace+0x94/0xec
>>> [    0.231963]  show_stack+0x18/0x24
>>> [    0.232374]  dump_stack_lvl+0x78/0x90
>>> [    0.232829]  dump_stack+0x18/0x24
>>> [    0.233241]  sysfs_warn_dup+0x64/0x80
>>> [    0.233696]  sysfs_do_create_link_sd+0xf0/0xf8
>>> [    0.234248]  sysfs_create_link+0x20/0x40
>>> [    0.234736]  device_add+0x27c/0x77c
>>> [    0.235169]  device_register+0x20/0x30
>>> [    0.235635]  tty_register_device_attr+0xfc/0x240
>>> [    0.236209]  tty_port_register_device_attr_serdev+0x8c/0xac
>>> [    0.236902]  serial_core_register_port+0x318/0x658
>>> [    0.237498]  serial_ctrl_register_port+0x10/0x1c
>>> [    0.238072]  uart_add_one_port+0x10/0x1c
>>> [    0.238560]  meson_uart_probe+0x2c0/0x3b4
>>> [    0.239058]  platform_probe+0x68/0xd8
>>> [    0.239513]  really_probe+0x148/0x2b4
>>> [    0.239968]  __driver_probe_device+0x78/0x12c
>>> [    0.240510]  driver_probe_device+0xdc/0x160
>>> [    0.241030]  __driver_attach+0x94/0x19c
>>> [    0.241507]  bus_for_each_dev+0x74/0xd4
>>> [    0.241983]  driver_attach+0x24/0x30
>>> [    0.242428]  bus_add_driver+0xe4/0x1e8
>>> [    0.242893]  driver_register+0x60/0x128
>>> [    0.243370]  __platform_driver_register+0x28/0x34
>>> [    0.243955]  meson_uart_platform_driver_init+0x1c/0x28
>>> [    0.244594]  do_one_initcall+0x6c/0x1b0
>>> [    0.245071]  kernel_init_freeable+0x1cc/0x294
>>> [    0.245613]  kernel_init+0x20/0x1dc
>>> [    0.246046]  ret_from_fork+0x10/0x20
>>> [    0.246555] meson_uart fe078000.serial: Cannot register tty device on line 0
>>> [    0.247729] msm_serial: driver initialized
>>> [    0.248150] SuperH (H)SCI(F) driver initialized
>>> [    0.248544] STM32 USART driver initialized
>>> [    0.263927] loop: module loaded
>>> [    0.264952] megasas: 07.727.03.00-rc1
>>> [    0.271065] tun: Universal TUN/TAP device driver, 1.6
>>> [    0.271824] thunder_xcv, ver 1.0
>>> [    0.271878] thunder_bgx, ver 1.0
>>> [    0.271956] nicpf, ver 1.0
>>> [    0.273230] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
>>> [    0.273437] hns3: Copyright (c) 2017 Huawei Corporation.
>>> [    0.274148] hclge is initializing
>>> [    0.274541] e1000: Intel(R) PRO/1000 Network Driver
>>> [    0.275116] e1000: Copyright (c) 1999-2006 Intel Corporation.
>>> [    0.275860] e1000e: Intel(R) PRO/1000 Network Driver
>>> [    0.276449] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
>>> [    0.277209] igb: Intel(R) Gigabit Ethernet Network Driver
>>> [    0.277867] igb: Copyright (c) 2007-2014 Intel Corporation.
>>> [    0.278576] igbvf: Intel(R) Gigabit Virtual Function Network Driver
>>> [    0.279330] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
>>> [    0.280319] sky2: driver version 1.30
>>> [    0.281597] VFIO - User Level meta-driver version: 0.3
>>> [    0.283859] usbcore: registered new interface driver usb-storage
>>> [    0.286328] i2c_dev: i2c /dev entries driver
>>> [    0.292404] sdhci: Secure Digital Host Controller Interface driver
>>> [    0.292481] sdhci: Copyright(c) Pierre Ossman
>>> [    0.293577] Synopsys Designware Multimedia Card Interface Driver
>>> [    0.294572] sdhci-pltfm: SDHCI platform and OF driver helper
>>> [    0.296259] ledtrig-cpu: registered to indicate activity on CPUs
>>> [    0.298966] meson-sm: secure-monitor enabled
>>> [    0.299963] usbcore: registered new interface driver usbhid
>>> [    0.299997] usbhid: USB HID core driver
>>> [    0.306803] NET: Registered PF_PACKET protocol family
>>> [    0.306919] 9pnet: Installing 9P2000 support
>>> [    0.307331] Key type dns_resolver registered
>>> [    0.318926] Timer migration: 1 hierarchy levels; 8 children per group; 1 crossnode level
>>> [    0.319462] registered taskstats version 1
>>> [    0.319968] Loading compiled-in X.509 certificates
>>> [    0.362771] clk: Disabling unused clocks
>>> [    0.363100] PM: genpd: Disabling unused power domains
>>> [    0.363383] ALSA device list:
>>> [    0.363580]   No soundcards found.
>>> [    0.368194] meson-gx-mmc fe08a000.sd: Got CD GPIO
>>> [    0.368524] SError Interrupt on CPU6, code 0x00000000bf000002 -- SError
>>> [    0.368531] CPU: 6 PID: 87 Comm: kworker/u32:3 Not tainted 6.8.0-09793-gda876e5b54b3-dirty #15
>>> [    0.368537] Hardware name: Khadas vim4 (DT)
>>> [    0.368540] Workqueue: async async_run_entry_fn
>>> [    0.368552] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>>> [    0.368556] pc : clk_mux_val_to_index+0x0/0xc0
>>> [    0.368565] lr : clk_mux_get_parent+0x4c/0x84
>>> [    0.368571] sp : ffff800082efba10
>>> [    0.368572] x29: ffff800082efba10 x28: ffff8000823279c0 x27: ffff800082327000
>>> [    0.368578] x26: ffff000004c361c0 x25: 0000000000000000 x24: 0000000000000002
>>> [    0.368584] x23: ffff000003f1d300 x22: ffff000003f1d2a0 x21: ffff000004c37280
>>> [    0.368589] x20: ffff000004c36ec0 x19: ffff000004bba800 x18: 0000000000000020
>>> [    0.368594] x17: ffff000000022000 x16: 0000000000000003 x15: ffffffffffffffff
>>> [    0.368599] x14: ffffffffffffffff x13: 0078756d2364732e x12: 3030306138306566
>>> [    0.368604] x11: 7f7f7f7f7f7f7f7f x10: ffff7fff83438910 x9 : 0000000000000005
>>> [    0.368609] x8 : 0101010101010101 x7 : 0000000000000000 x6 : 05114367045e5359
>>> [    0.368613] x5 : 0000000000000006 x4 : 0000000000000000 x3 : 0000000000000000
>>> [    0.368618] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000004c36ec0
>>> [    0.368624] Kernel panic - not syncing: Asynchronous SError Interrupt
>>> [    0.368626] CPU: 6 PID: 87 Comm: kworker/u32:3 Not tainted 6.8.0-09793-gda876e5b54b3-dirty #15
>>> [    0.368630] Hardware name: Khadas vim4 (DT)
>>> [    0.368631] Workqueue: async async_run_entry_fn
>>> [    0.368635] Call trace:
>>> [    0.368637]  dump_backtrace+0x94/0xec
>>> [    0.368644]  show_stack+0x18/0x24
>>> [    0.368649]  dump_stack_lvl+0x38/0x90
>>> [    0.368656]  dump_stack+0x18/0x24
>>> [    0.368661]  panic+0x388/0x3c8
>>> [    0.368666]  nmi_panic+0x48/0x94
>>> [    0.368670]  arm64_serror_panic+0x6c/0x78
>>> [    0.368674]  do_serror+0x3c/0x78
>>> [    0.368677]  el1h_64_error_handler+0x30/0x48
>>> [    0.368681]  el1h_64_error+0x64/0x68
>>> [    0.368684]  clk_mux_val_to_index+0x0/0xc0
>>> [    0.368689]  __clk_register+0x440/0x82c
>>> [    0.368693]  devm_clk_register+0x5c/0xbc
>>> [    0.368697]  meson_mmc_clk_init+0x11c/0x2a8
>>> [    0.368702]  meson_mmc_probe+0x18c/0x3c0
>>> [    0.368705]  platform_probe+0x68/0xd8
>>> [    0.368711]  really_probe+0x148/0x2b4
>>> [    0.368714]  __driver_probe_device+0x78/0x12c
>>> [    0.368718]  driver_probe_device+0xdc/0x160
>>> [    0.368721]  __device_attach_driver+0xb8/0x134
>>> [    0.368724]  bus_for_each_drv+0x84/0xe0
>>> [    0.368727]  __device_attach_async_helper+0xac/0xd0
>>> [    0.368730]  async_run_entry_fn+0x34/0xe0
>>> [    0.368734]  process_one_work+0x150/0x294
>>> [    0.368740]  worker_thread+0x304/0x408
>>> [    0.368744]  kthread+0x118/0x11c
>>> [    0.368748]  ret_from_fork+0x10/0x20
>>> [    0.368753] SMP: stopping secondary CPUs
>>> [    0.368760] Kernel Offset: disabled
>>> [    0.368761] CPU features: 0x0,00000060,d0080000,0200421b
>>> [    0.368765] Memory Limit: none
>>> [    0.400328] ---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]---
>>>
>>>
>>> --
>>> 2.44.0
>>>

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

^ permalink raw reply

* RE: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set additionalProperties to true
From: Peng Fan @ 2024-04-07 10:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Peng Fan (OSS), Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Sudeep Holla,
	Cristian Marussi
  Cc: devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <09f6b752-6b72-49d7-b248-6faba2fd13a7@kernel.org>

> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set
> additionalProperties to true
> 
> On 07/04/2024 02:37, Peng Fan wrote:
> >> Subject: Re: [PATCH v2 1/6] dt-bindings: firmware: arm,scmi: set
> >> additionalProperties to true
> >>
> >> On 05/04/2024 14:39, Peng Fan (OSS) wrote:
> >>> From: Peng Fan <peng.fan@nxp.com>
> >>>
> >>> When adding vendor extension protocols, there is dt-schema warning:
> >>> "
> >>> imx,scmi.example.dtb: scmi: 'protocol@81', 'protocol@84' do not
> >>> match any of the regexes: 'pinctrl-[0-9]+'
> >>> "
> >>>
> >>> Set additionalProperties to true to address the issue.
> >>
> >> I do not see anything addressed here, except making the binding
> >> accepting anything anywhere...
> >
> > I not wanna add vendor protocols in arm,scmi.yaml, so will introduce a
> > new yaml imx.scmi.yaml which add i.MX SCMI protocol extension.
> >
> > With additionalProperties set to false, I not know how, please suggest.
> 
> First of all, you cannot affect negatively existing devices (their
> bindings) and your patch does exactly that. This should make you thing what
> is the correct approach...
> 
> Rob gave you the comment about missing compatible - you still did not
> address that.

I added the compatible in patch 2/6 in the examples "compatible = "arm,scmi";"
> 
> You need common schema referenced in arm,scmi and your device specific
> schema, also using it.

ok, let me try to figure it out.

Thanks,
Peng.
> 
> 
> Best regards,
> Krzysztof

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

^ permalink raw reply

* RE: [EXT] Re: [PATCH v1 1/1] arm64: dts: imx93-11x11-evk: add rtc PCF2131 support
From: Joy Zou @ 2024-04-07  9:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Jacky Bai, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de
  Cc: kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx,
	devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <d18b05d9-266b-4a1b-a2cd-3b6f8173a39b@linaro.org>



BR
Joy Zou

> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Sent: 2024年4月7日 17:12
> To: Joy Zou <joy.zou@nxp.com>; Jacky Bai <ping.bai@nxp.com>;
> robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org;
> conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de
> Cc: kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> <linux-imx@nxp.com>; devicetree@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [EXT] Re: [PATCH v1 1/1] arm64: dts: imx93-11x11-evk: add rtc
> PCF2131 support
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On 07/04/2024 11:09, Joy Zou wrote:
> >
> >> -----Original Message-----
> >> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >> Sent: 2024年4月7日 17:04
> >> To: Joy Zou <joy.zou@nxp.com>; Jacky Bai <ping.bai@nxp.com>;
> >> robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org;
> >> conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de
> >> Cc: kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
> >> <linux-imx@nxp.com>; devicetree@vger.kernel.org; imx@lists.linux.dev;
> >> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> >> Subject: [EXT] Re: [PATCH v1 1/1] arm64: dts: imx93-11x11-evk: add
> >> rtc
> >> PCF2131 support
> >>> +&lpi2c3 {
> >>> +     #address-cells = <1>;
> >>> +     #size-cells = <0>;
> >>> +     clock-frequency = <400000>;
> >>> +     pinctrl-names = "default", "sleep";
> >>> +     pinctrl-0 = <&pinctrl_lpi2c3>;
> >>> +     pinctrl-1 = <&pinctrl_lpi2c3>;
> >>> +     status = "okay";
> >>> +
> >>> +     pcf2131: rtc@53 {
> >>> +                     compatible = "nxp,pcf2131";
> >>> +                     reg = <0x53>;
> >>> +                     interrupt-parent = <&pcal6524>;
> >>> +                     interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
> >>> +                     status = "okay";
> >>
> >> Really, just drop...
> > Ok, will drop the status in next version.
> > Thanks for your comment!
> 
> Please read DTS coding style.
Thanks you very much!
Yeah, I have read the DTS coding style. The “status” property is by default “okay”, thus it can be omitted.
BR
Joy Zou
> 
> Best regards,
> Krzysztof

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

^ permalink raw reply

* Re: [EXT] Re: [PATCH v1 1/1] arm64: dts: imx93-11x11-evk: add rtc PCF2131 support
From: Krzysztof Kozlowski @ 2024-04-07  9:12 UTC (permalink / raw)
  To: Joy Zou, Jacky Bai, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de
  Cc: kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx,
	devicetree@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <AS4PR04MB9386C629F898A8417AE57506E1012@AS4PR04MB9386.eurprd04.prod.outlook.com>

On 07/04/2024 11:09, Joy Zou wrote:
> 
>> -----Original Message-----
>> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Sent: 2024年4月7日 17:04
>> To: Joy Zou <joy.zou@nxp.com>; Jacky Bai <ping.bai@nxp.com>;
>> robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org;
>> conor+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de
>> Cc: kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
>> <linux-imx@nxp.com>; devicetree@vger.kernel.org; imx@lists.linux.dev;
>> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
>> Subject: [EXT] Re: [PATCH v1 1/1] arm64: dts: imx93-11x11-evk: add rtc
>> PCF2131 support
>>> +&lpi2c3 {
>>> +     #address-cells = <1>;
>>> +     #size-cells = <0>;
>>> +     clock-frequency = <400000>;
>>> +     pinctrl-names = "default", "sleep";
>>> +     pinctrl-0 = <&pinctrl_lpi2c3>;
>>> +     pinctrl-1 = <&pinctrl_lpi2c3>;
>>> +     status = "okay";
>>> +
>>> +     pcf2131: rtc@53 {
>>> +                     compatible = "nxp,pcf2131";
>>> +                     reg = <0x53>;
>>> +                     interrupt-parent = <&pcal6524>;
>>> +                     interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
>>> +                     status = "okay";
>>
>> Really, just drop...
> Ok, will drop the status in next version.
> Thanks for your comment!

Please read DTS coding style.

Best regards,
Krzysztof


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

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox