Skip to contentSkip to conversation

Add nvmem driver support for ZynqMP

RFC PATCH Superseded Nava kishore Manne 2 participants 5 messages Sep 21, 2018 – Sep 27, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Add nvmem driver support for ZynqMP

This series of patches are created On top of the
below series of patches.
https://lkml.org/lkml/2018/8/3/687

Nava kishore Manne (3):
firmware: xilinx: Add zynqmp_pm_get_chipid() API
dt-bindings: fpga: Add bindings for ZynqMP nvmem driver
nvmem: zynqmp: Added zynqmp nvmem firmware driver

 .../firmware/xilinx/xlnx,zynqmp-firmware.txt  | 35 ++++++++
 drivers/firmware/xilinx/zynqmp.c              | 24 ++++++
 drivers/nvmem/Kconfig                         | 10 +++
 drivers/nvmem/Makefile                        |  2 +
 drivers/nvmem/zynqmp_nvmem.c                  | 86 +++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h          |  2 +
 6 files changed, 159 insertions(+)
 create mode 100644 drivers/nvmem/zynqmp_nvmem.c
Signature · 1 line
2.18.0
#1 lore raw

RFC PATCH v3 1/3 firmware: xilinx: Add zynqmp_pm_get_chipid() API

This patch adds a new API to provide access to the hardware related data like soc revision, IDCODE... etc.

---
Changes for v3:
-corrected typo error in commit msg.
Changes for v2:
-New Patch.

 drivers/firmware/xilinx/zynqmp.c     | 24 ++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h |  2 ++
 2 files changed, 26 insertions(+)
drivers/firmware/xilinx/zynqmp.c +24 -0
index 7ccedf083926..7a33f934dce7 100644
@@ -447,8 +447,32 @@ static int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id)
 	return ret;
 }
 
+/**
+ * zynqmp_pm_get_chipid - Get silicon ID registers
+ * @idcode:     IDCODE register
+ * @version:    version register
+ *
+ * Return:      Returns the status of the operation and the idcode and version
+ *              registers in @idcode and @version.
+ */
+static int zynqmp_pm_get_chipid(u32 *idcode, u32 *version)
+{
+	u32 ret_payload[PAYLOAD_ARG_CNT];
+	int ret;
+
+	if (!idcode || !version)
+		return -EINVAL;
+
+	ret = zynqmp_pm_invoke_fn(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
+	*idcode = ret_payload[1];
+	*version = ret_payload[2];
+
+	return ret;
+}
+
 static const struct zynqmp_eemi_ops eemi_ops = {
 	.get_api_version = zynqmp_pm_get_api_version,
+	.get_chipid = zynqmp_pm_get_chipid,
 	.ioctl = zynqmp_pm_ioctl,
 	.query_data = zynqmp_pm_query_data,
 	.clock_enable = zynqmp_pm_clock_enable,
include/linux/firmware/xlnx-zynqmp.h +2 -0
index 58a74781b51d..5a49d6f937b5 100644
@@ -34,6 +34,7 @@
 
 enum pm_api_id {
 	PM_GET_API_VERSION = 1,
+	PM_GET_CHIPID = 22,
 	PM_IOCTL = 34,
 	PM_QUERY_DATA,
 	PM_CLOCK_ENABLE,
@@ -90,6 +91,7 @@ struct zynqmp_pm_query_data {
 
 struct zynqmp_eemi_ops {
 	int (*get_api_version)(u32 *version);
+	int (*get_chipid)(u32 *idcode, u32 *version);
 	int (*ioctl)(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2, u32 *out);
 	int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
 	int (*clock_enable)(u32 clock_id);
Signature · 1 line
2.18.0
#2 lore raw

RFC PATCH v3 2/3 dt-bindings: fpga: Add bindings for ZynqMP nvmem driver

In reply to Nava kishore Manne

Add documentation to describe Xilinx ZynqMP nvmem driver bindings.

---
Changes for v3:

		-None.

Changes for v2:
-Moved nvmem_firmware node as a child to
firwmare node.

 .../firmware/xilinx/xlnx,zynqmp-firmware.txt  | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt +35 -0
index 1b431d9bbe44..4b95fcc4dcb3 100644
@@ -17,6 +17,19 @@ Required properties:
 		  - "smc" : SMC #0, following the SMCCC
 		  - "hvc" : HVC #0, following the SMCCC
 
+--------------------------------------------------------------------------
+=  Zynq UltraScale+ MPSoC nvmem firmware driver binding =
+--------------------------------------------------------------------------
+The nvmem_firmware node provides access to the hardware related data
+like soc revision, IDCODE... etc, By using the firmware interface.
+
+Required properties:
+- compatible: should be "xlnx,zynqmp-nvmem-fw"
+
+= Data cells =
+Are child nodes of silicon id, bindings of which as described in
+bindings/nvmem/nvmem.txt
+
 -------
 Example
 -------
@@ -25,5 +38,27 @@ firmware {
 	zynqmp_firmware: zynqmp-firmware {
 		compatible = "xlnx,zynqmp-firmware";
 		method = "smc";
+		nvmem_firmware {
+			compatible = "xlnx,zynqmp-nvmem-fw";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			/* Data cells */
+			soc_revision: soc_revision {
+				reg = <0x0 0x4>;
+			};
+		};
 	};
 };
+
+= Data consumers =
+Are device nodes which consume nvmem data cells.
+
+For example:
+
+	pcap {
+		...
+		nvmem-cells = <&soc_revision>;
+		nvmem-cell-names = "soc_revision";
+	};
+
Signature · 1 line
2.18.0
maintainer
#3 lore raw

Re: [RFC PATCH v3 2/3] dt-bindings: fpga: Add bindings for ZynqMP nvmem driver

Quoted 6 lines · Nava kishore Manne

Add documentation to describe Xilinx ZynqMP nvmem driver bindings.

---
Changes for v3:

Quoted 7 lines
		-None.

Changes for v2:
-Moved nvmem_firmware node as a child to
firwmare node.

 .../firmware/xilinx/xlnx,zynqmp-firmware.txt  | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

There are various components of the zynqmp firmware bindings being sent separately. I cannot review it piece by piece. So please the firmware bindings as a complete set. Really, I mainly need to see a complete example.

Rob

#4 lore raw

RFC PATCH v3 3/3 nvmem: zynqmp: Added zynqmp nvmem firmware driver

In reply to Nava kishore Manne

This patch adds zynqmp nvmem firmware driver to access the SoC revision information from the hardware register.

---
Changes for v3:
-Changed nvmem_register() to devm_nvmem_register()
and pr_debug() to dev_dbg() as suggested by srinivas.
Changes for v2:

                -None.
 drivers/nvmem/Kconfig        | 10 +++++
 drivers/nvmem/Makefile       |  2 +
 drivers/nvmem/zynqmp_nvmem.c | 86 ++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
 create mode 100644 drivers/nvmem/zynqmp_nvmem.c
drivers/nvmem/Kconfig +10 -0
index 54a3c298247b..2edb1428ef6d 100644
@@ -181,4 +181,14 @@ config RAVE_SP_EEPROM
 	help
 	  Say y here to enable Rave SP EEPROM support.
 
+config NVMEM_ZYNQMP
+	bool "Xilinx ZYNQMP SoC nvmem firmware support"
+	depends on ARCH_ZYNQMP
+	help
+	  This is a driver to access hardware related data like
+	  soc revision, IDCODE... etc by using the firmware
+	  interface.
+
+	  If sure, say yes. If unsure, say no.
+
 endif
drivers/nvmem/Makefile +2 -0
index 27e96a8efd1c..0b3abd7f5d02 100644
@@ -39,4 +39,6 @@ obj-$(CONFIG_NVMEM_SNVS_LPGPR)	+= nvmem_snvs_lpgpr.o
 nvmem_snvs_lpgpr-y		:= snvs_lpgpr.o
 obj-$(CONFIG_RAVE_SP_EEPROM)	+= nvmem-rave-sp-eeprom.o
 nvmem-rave-sp-eeprom-y		:= rave-sp-eeprom.o
+obj-$(CONFIG_NVMEM_ZYNQMP)     += nvmem_zynqmp_nvmem.o
+nvmem_zynqmp_nvmem-y           := zynqmp_nvmem.o
 
drivers/nvmem/zynqmp_nvmem.c new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.18.0