Add nvmem driver support for ZynqMP
v2 cover Add nvmem driver support for ZynqMP
Nava kishore Manne (3):
firmware: xilinx: Add zynqmp_pm_get_chipid() API
dt-bindings: nvmem: Add bindings for ZynqMP nvmem driver
nvmem: zynqmp: Added zynqmp nvmem firmware driver
.../bindings/nvmem/xlnx,zynqmp-nvmem.txt | 47 ++++++++++ drivers/firmware/xilinx/zynqmp.c | 24 ++++++ drivers/nvmem/Kconfig | 15 ++-- drivers/nvmem/Makefile | 5 +- drivers/nvmem/zynqmp_nvmem.c | 86 +++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 2 + 6 files changed, 169 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.txt create mode 100644 drivers/nvmem/zynqmp_nvmem.c
Signature · 1 line
2.18.0
PATCH v2 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 v2:
-None.
Changes for v1:
-None.Changes for RFC-V3:
-corrected typo error in commit msg.
Changes for RFC-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
@@ -186,6 +186,29 @@ static int zynqmp_pm_get_api_version(u32 *version)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; +} +/** * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version * @version: Returned version value
@@ -471,6 +494,7 @@ static int zynqmp_pm_ioctl(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2,static const struct zynqmp_eemi_ops eemi_ops = { .get_api_version = zynqmp_pm_get_api_version, + .get_chipid = zynqmp_pm_get_chipid, .query_data = zynqmp_pm_query_data, .clock_enable = zynqmp_pm_clock_enable, .clock_disable = zynqmp_pm_clock_disable,
include/linux/firmware/xlnx-zynqmp.h +2 -0
@@ -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 ,
@@ -91,6 +92,7 @@ struct zynqmp_pm_query_data {struct zynqmp_eemi_ops {int (*get_api_version)(u32 *version); +int (*get_chipid)(u32 *idcode,u32 *version);int (*query_data)(struct zynqmp_pm_query_data qdata,u32 *out);int (*clock_enable)(u32 clock_id);int (*clock_disable)(u32 clock_id);
Signature · 7 lines
2.18.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 1/3] firmware: xilinx: Add zynqmp_pm_get_chipid() API
Hi Kishore,
I need ack for this patch from Michal Simek to take this via nvmem tree.
thanks,
srini
Quoted 83 lines · Nava kishore Manne
This patch adds a new API to provide access to the hardware related data like soc revision, IDCODE... etc.
Signed-off-by Nava kishore Manne <[email protected]>---
Changes for v2:-None. Changes for v1: -None.Changes for RFC-V3:
-corrected typo error in commit msg.Changes for RFC-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@@ -186,6 +186,29 @@ static int zynqmp_pm_get_api_version(u32 *version)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; +} +/** * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version * @version: Returned version value @@ -471,6 +494,7 @@ static int zynqmp_pm_ioctl(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2,static const struct zynqmp_eemi_ops eemi_ops = { .get_api_version = zynqmp_pm_get_api_version, + .get_chipid = zynqmp_pm_get_chipid, .query_data = zynqmp_pm_query_data, .clock_enable = zynqmp_pm_clock_enable, .clock_disable = zynqmp_pm_clock_disable,include/linux/firmware/xlnx-zynqmp.h +2
-0@@ -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 ,@@ -91,6 +92,7 @@ struct zynqmp_pm_query_data {struct zynqmp_eemi_ops {int (*get_api_version)(u32 *version); +int (*get_chipid)(u32 *idcode,u32 *version);int (*query_data)(struct zynqmp_pm_query_data qdata,u32 *out);int (*clock_enable)(u32 clock_id);int (*clock_disable)(u32 clock_id);
Re: [PATCH v2 1/3] firmware: xilinx: Add zynqmp_pm_get_chipid() API
ne, 3. úno 2019 9:50 odesílatel Srinivas Kandagatla < [email protected]> napsal:
Quoted 7 lines
Hi Kishore,
I need ack for this patch from Michal Simek to take this via nvmem tree.
thanks,
srini
There will be collisions with other patches. If you can review it then I will take it via arm soc tree.
Thanks,
Michal
Quoted 95 lines · Nava kishore Manne
Quoted 13 lines
This patch adds a new API to provide access to the hardware related data like soc revision, IDCODE... etc.
Signed-off-by Nava kishore Manne <[email protected]>---
Changes for v2:-None. Changes for v1: -None.Changes for RFC-V3:
-corrected typo error in commit msg.Review
Quoted 8 lines
Changes for RFC-v2:
-New Patch.drivers/firmware/xilinx/zynqmp.c | 24 ++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 2 ++ 2 files changed, 26 insertions(+)(quoted diff) +0
-0
b/drivers/firmware/xilinx/zynqmp.cdrivers/firmware/xilinx/zynqmp.c static int zynqmp_pm_get_api_version(u32 *version) · line 194
Quoted 13 lines
index
9a1c72a9280f..af2a209fc2da100644drivers/firmware/xilinx/zynqmp.c +6
-0@@ -186,6 +186,29 @@ static int zynqmp_pm_get_api_version(u32 *version)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
Quoted 9 lines
drivers/firmware/xilinx/zynqmp.c +9
-0+* 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 ;drivers/firmware/xilinx/zynqmp.c static int zynqmp_pm_get_api_version(u32 *version)
Quoted 10 lines
drivers/firmware/xilinx/zynqmp.c +8
-0+ + ret =zynqmp_pm_invoke_fn (PM_GET_CHIPID ,0 ,0 ,0 ,0 , ret_payload); + *idcode = ret_payload[1 ]; + *version = ret_payload[2 ]; + +return ret; +} +/** * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
drivers/firmware/xilinx/zynqmp.c static int zynqmp_pm_ioctl(u32 node_id, u32
Quoted 2 lines
drivers/firmware/xilinx/zynqmp.c +0
-0* @version: Returned version value @@ -471,6 +494,7 @@ static int zynqmp_pm_ioctl(u32 node_id, u32
ioctl_id, u32 arg1, u32 arg2,Review
Quoted 8 lines
drivers/firmware/xilinx/zynqmp.c +1
-0static const struct zynqmp_eemi_ops eemi_ops = { .get_api_version = zynqmp_pm_get_api_version, + .get_chipid = zynqmp_pm_get_chipid, .query_data = zynqmp_pm_query_data, .clock_enable = zynqmp_pm_clock_enable, .clock_disable = zynqmp_pm_clock_disable,(quoted diff) +0
-0
b/include/linux/firmware/xlnx-zynqmp.hQuoted 13 lines
index
3c3c28eff56a..c435f4b35adf100644include/linux/firmware/xlnx-zynqmp.h +1
-0@@ -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 ,include/linux/firmware/xlnx-zynqmp.h struct zynqmp_pm_query_data { · line 98
Quoted 7 lines
include/linux/firmware/xlnx-zynqmp.h +1
-0@@ -91,6 +92,7 @@ struct zynqmp_pm_query_data {struct zynqmp_eemi_ops {int (*get_api_version)(u32 *version); +int (*get_chipid)(u32 *idcode,u32 *version);int (*query_data)(struct zynqmp_pm_query_data qdata,u32 *out);int (*clock_enable)(u32 clock_id);int (*clock_disable)(u32 clock_id);_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 1/3] firmware: xilinx: Add zynqmp_pm_get_chipid() API
In reply to Srinivas KandagatlaHi,
Quoted 3 lines · Srinivas Kandagatla
Hi Kishore,
I need ack for this patch from Michal Simek to take this via nvmem tree.
not sure if my reaction went through. Just for a record. There is high chance that there is collision in firmware interface. It means if you can ack/review that patches then I would take them via arm-soc trees.
Thanks,
Michal
Re: [PATCH v2 1/3] firmware: xilinx: Add zynqmp_pm_get_chipid() API
Quoted 11 lines · Michal Simek
Hi,
Quoted 3 lines · Srinivas Kandagatla
Hi Kishore,
I need ack for this patch from Michal Simek to take this via nvmem tree.
not sure if my reaction went through. Just for a record. There is high chance that there is collision in firmware interface. It means if you can ack/review that patches then I would take them via arm-soc trees.
I got the message! There are outstanding comments on the nvmem patch!
--srini
Quoted 3 lines
Thanks,
Michal
Re: [PATCH v2 1/3] firmware: xilinx: Add zynqmp_pm_get_chipid() API
Quoted 8 lines · Srinivas Kandagatla
Quoted 5 lines · Michal Simek
Hi,
Quoted 2 lines · Srinivas Kandagatla
Hi Kishore,
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I need ack for this patch from Michal Simek to take this via nvmem tree.
not sure if my reaction went through. Just for a record. There is high chance that there is collision in firmware interface. It means if you can ack/review that patches then I would take them via arm-soc trees.
I got the message! There are outstanding comments on the nvmem patch!
ok thanks.
Michal
PATCH v2 2/3 dt-bindings: nvmem: Add bindings for ZynqMP nvmem driver
In reply to Nava kishore ManneAdd documentation to describe Xilinx ZynqMP nvmem driver bindings.
--- .../bindings/nvmem/xlnx,zynqmp-nvmem.txt | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.txt
Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.txt new file +47 -0
@@ -0,0 +1,47 @@ +-------------------------------------------------------------------------- += 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 +------- +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
PATCH v2 3/3 nvmem: zynqmp: Added zynqmp nvmem firmware driver
In reply to Nava kishore ManneThis patch adds zynqmp nvmem firmware driver to access the SoC revision information from the hardware register.
---
Changes for v2:
-None.
Changes for v1:
-None.Changes for RFC-V3:
-Changed nvmem_register() to devm_nvmem_register()
and pr_debug() to dev_dbg() as suggested by srinivas.
Changes for RFC-V2:
-None.
drivers/nvmem/Kconfig | 15 +++---- drivers/nvmem/Makefile | 5 ++- drivers/nvmem/zynqmp_nvmem.c | 86 ++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 drivers/nvmem/zynqmp_nvmem.c
drivers/nvmem/Kconfig +7 -8
@@ -181,15 +181,14 @@ config RAVE_SP_EEPROM help Say y here to enable Rave SP EEPROM support. -config SC27XX_EFUSE - tristate "Spreadtrum SC27XX eFuse Support" - depends on MFD_SC27XX_PMIC || COMPILE_TEST - depends on HAS_IOMEM +config NVMEM_ZYNQMP + bool "Xilinx ZYNQMP SoC nvmem firmware support" + depends on ARCH_ZYNQMP help - This is a simple driver to dump specified values of Spreadtrum - SC27XX PMICs from eFuse. + This is a driver to access hardware related data like + soc revision, IDCODE... etc by using the firmware + interface. - This driver can also be built as a module. If so, the module - will be called nvmem-sc27xx-efuse. + If sure, say yes. If unsure, say no. endif
drivers/nvmem/Makefile +3 -2
@@ -39,5 +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_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o -nvmem-sc27xx-efuse-y := sc27xx-efuse.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
Re: [PATCH v2 3/3] nvmem: zynqmp: Added zynqmp nvmem firmware driver
drivers/nvmem/Kconfig config RAVE_SP_EEPROM · line 187
Quoted 5 lines · Nava kishore Manne
drivers/nvmem/Kconfig +0
-4-config SC27XX_EFUSE - tristate "Spreadtrum SC27XX eFuse Support" - depends on MFD_SC27XX_PMIC || COMPILE_TEST - depends on HAS_IOMEM
Why are you removing SC27XX_EFUSE support here?
It does not look right!
Quoted 20 lines
drivers/nvmem/Kconfig +7
-4+config NVMEM_ZYNQMP + bool "Xilinx ZYNQMP SoC nvmem firmware support" + depends on ARCH_ZYNQMP help - This is a simple driver to dump specified values of Spreadtrum - SC27XX PMICs from eFuse. + This is a driver to access hardware related data like + soc revision, IDCODE... etc by using the firmware + interface. - This driver can also be built as a module. If so, the module - will be called nvmem-sc27xx-efuse. + If sure, say yes. If unsure, say no. endifdrivers/nvmem/Makefile +0
-0
drivers/nvmem/Makefile obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o · line 43
Quoted 5 lines
drivers/nvmem/Makefile +0
-2@@ -39,5 +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_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o -nvmem-sc27xx-efuse-y := sc27xx-efuse.o
same here?
drivers/nvmem/Makefile obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o · line 44
Quoted 3 lines
drivers/nvmem/Makefile +3
-0+obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o +nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +
--srini
RE: [PATCH v2 3/3] nvmem: zynqmp: Added zynqmp nvmem firmware driver
Hi Srinivas,
Thanks for providing the review comments..
Quoted 40 lines
-----Original Message-----
From: Srinivas Kandagatla [mailto:[email protected]]
Sent: Sunday, February 3, 2019 3:08 PM
To: Nava kishore Manne <[email protected]>; [email protected];
[email protected]; Michal Simek <[email protected]>; Jolly Shah
<[email protected]>; Rajan Vaja <[email protected]>;
[email protected]; [email protected]; linux-
Subject: Re: [PATCH v2 3/3] nvmem: zynqmp: Added zynqmp nvmem firmware
driver
drivers/nvmem/Kconfig config RAVE_SP_EEPROM
Quoted 9 lines · Nava kishore Manne
drivers/nvmem/Kconfig +0
-4-config SC27XX_EFUSE - tristate "Spreadtrum SC27XX eFuse Support" - depends on MFD_SC27XX_PMIC || COMPILE_TEST - depends on HAS_IOMEM
Quoted 7 lines
Why are you removing
SC27XX_EFUSEsupport here?It does not look right!
Thanks for pointing it...
Yes, we should not remove this support.
By mistake, I have done this changes.. will fix in the next version...
Quoted 48 lines
drivers/nvmem/Makefile index obj-$(CONFIG_NVMEM_SNVS_LPGPR) +=
Quoted 39 lines
(quoted diff) +7
-4+config NVMEM_ZYNQMP + bool "Xilinx ZYNQMP SoC nvmem firmware support" + depends on ARCH_ZYNQMP help - This is a simple driver to dump specified values of Spreadtrum - SC27XX PMICs from eFuse. + This is a driver to access hardware related data like + soc revision, IDCODE... etc by using the firmware + interface. - This driver can also be built as a module. If so, the module - will be called nvmem-sc27xx-efuse. + If sure, say yes. If unsure, say no. endifdrivers/nvmem/Makefile index renamed from drivers/nvmem/Makefile +0
-0
4e8c61628f1a..0b3abd7f5d02100644--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
drivers/nvmem/Makefile index renamed from drivers/nvmem/Makefile +0
-0@@ -39,5 +39,6 @@ obj-$(CONFIG_NVMEM_SNVS_LPGPR) +=nvmem_snvs_lpgpr.o
Quoted 5 lines
drivers/nvmem/Makefile index renamed from drivers/nvmem/Makefile +0
-0nvmem_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
Quoted 9 lines
drivers/nvmem/Makefile index obj-$(CONFIG_NVMEM_SNVS_LPGPR) +=
Quoted 3 lines
drivers/nvmem/Makefile index renamed from drivers/nvmem/Makefile +0
-2-obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o -nvmem-sc27xx-efuse-y := sc27xx-efuse.osame here?
Will fix in the next version...
Regards,
Navakishore.