History

Merge tag 'zynqmp-soc-for-v5.2' of https://github.com/Xilinx/linux-xlnx into arm/drivers

arm64: zynqmp: SoC changes for v5.2 - Add support for ZynqMP fpga manager - Defer some probes which depends on firmware driver to be ready - Debugfs fix * tag 'zynqmp-soc-for-v5.2' of https://github.com/Xilinx/linux-xlnx: fpga manager: Adding FPGA Manager support for Xilinx zynqmp dt-bindings: fpga: Add bindings for ZynqMP fpga driver firmware: xilinx: Add fpga API's drivers: Defer probe if firmware is not ready firmware: xilinx: fix debugfs write handler

Olof Johansson committed 7 years ago

Commit b94d3ff2 parents 0065198 c09f74714 files · +302 −39Browse files

Unified · Split

14 files
  1. Documentation/devicetree/bindings/fpga/xlnx,zynqmp-pcap-fpga.txt +25 −0
  2. Documentation/xilinx/eemi.txt +2 −2
  3. drivers/clk/zynqmp/clkc.c +2 −2
  4. drivers/firmware/xilinx/zynqmp-debug.c +4 −14
  5. drivers/firmware/xilinx/zynqmp.c +55 −1
  6. drivers/fpga/Kconfig +9 −0
  7. drivers/fpga/Makefile +1 −0
  8. drivers/fpga/zynqmp-fpga.c +159 −0
  9. drivers/nvmem/zynqmp_nvmem.c +7 −3
  10. drivers/reset/reset-zynqmp.c +4 −4
  11. drivers/soc/xilinx/zynqmp_pm_domains.c +10 −8
  12. drivers/soc/xilinx/zynqmp_power.c +6 −4
  13. drivers/spi/spi-zynqmp-gqspi.c +5 −0
  14. include/linux/firmware/xlnx-zynqmp.h +13 −1
Documentation/devicetree/bindings/fpga/xlnx,zynqmp-pcap-fpga.txt+25−0
@@ -0,0 +1,25 @@
1Devicetree bindings for Zynq Ultrascale MPSoC FPGA Manager.
2The ZynqMP SoC uses the PCAP (Processor configuration Port) to configure the
3Programmable Logic (PL). The configuration uses the firmware interface.
4
5Required properties:
6- compatible: should contain "xlnx,zynqmp-pcap-fpga"
7
8Example for full FPGA configuration:
9
10 fpga-region0 {
11 compatible = "fpga-region";
12 fpga-mgr = <&zynqmp_pcap>;
13 #address-cells = <0x1>;
14 #size-cells = <0x1>;
15 };
16
17 firmware {
18 zynqmp_firmware: zynqmp-firmware {
19 compatible = "xlnx,zynqmp-firmware";
20 method = "smc";
21 zynqmp_pcap: pcap {
22 compatible = "xlnx,zynqmp-pcap-fpga";
23 };
24 };
25 };
Documentation/xilinx/eemi.txt+2−2
@@ -41,8 +41,8 @@ Example of EEMI ops usage: · 40 unmodified lines
41 int ret;41 int ret;
42 42
43 eemi_ops = zynqmp_pm_get_eemi_ops();43 eemi_ops = zynqmp_pm_get_eemi_ops();
44 if (!eemi_ops)44 if (IS_ERR(eemi_ops))
45 return -ENXIO;45 return PTR_ERR(eemi_ops);
46 46
47 ret = eemi_ops->query_data(qdata, ret_payload);47 ret = eemi_ops->query_data(qdata, ret_payload);
48 48
drivers/clk/zynqmp/clkc.c+2−2
@@ -695,8 +695,8 @@ static int zynqmp_clock_probe(struct platform_device *pdev) · 694 unmodified lines
695 struct device *dev = &pdev->dev;695 struct device *dev = &pdev->dev;
696 696
697 eemi_ops = zynqmp_pm_get_eemi_ops();697 eemi_ops = zynqmp_pm_get_eemi_ops();
698 if (!eemi_ops)698 if (IS_ERR(eemi_ops))
699 return -ENXIO;699 return PTR_ERR(eemi_ops);
700 700
701 ret = zynqmp_clk_setup(dev->of_node);701 ret = zynqmp_clk_setup(dev->of_node);
702 702
drivers/firmware/xilinx/zynqmp-debug.c+4−14
@@ -90,9 +90,6 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret) · 89 unmodified lines
90 int ret;90 int ret;
91 struct zynqmp_pm_query_data qdata = {0};91 struct zynqmp_pm_query_data qdata = {0};
92 92
93 if (!eemi_ops)
94 return -ENXIO;
95
96 switch (pm_id) {93 switch (pm_id) {
97 case PM_GET_API_VERSION:94 case PM_GET_API_VERSION:
98 ret = eemi_ops->get_api_version(&pm_api_version);95 ret = eemi_ops->get_api_version(&pm_api_version);
@@ -163,21 +160,14 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file, · 64 unmodified lines
163 160
164 strcpy(debugfs_buf, "");161 strcpy(debugfs_buf, "");
165 162
166 if (*off != 0 || len == 0)163 if (*off != 0 || len <= 1 || len > PAGE_SIZE - 1)
167 return -EINVAL;164 return -EINVAL;
168 165
169 kern_buff = kzalloc(len, GFP_KERNEL);166 kern_buff = memdup_user_nul(ptr, len);
170 if (!kern_buff)167 if (IS_ERR(kern_buff))
171 return -ENOMEM;168 return PTR_ERR(kern_buff);
172
173 tmp_buff = kern_buff;169 tmp_buff = kern_buff;
174 170
175 ret = strncpy_from_user(kern_buff, ptr, len);
176 if (ret < 0) {
177 ret = -EFAULT;
178 goto err;
179 }
180
181 /* Read the API name from a user request */171 /* Read the API name from a user request */
182 pm_api_req = strsep(&kern_buff, " ");172 pm_api_req = strsep(&kern_buff, " ");
183 173
drivers/firmware/xilinx/zynqmp.c+55−1
@@ -24,6 +24,8 @@ · 23 unmodified lines
24#include <linux/firmware/xlnx-zynqmp.h>24#include <linux/firmware/xlnx-zynqmp.h>
25#include "zynqmp-debug.h"25#include "zynqmp-debug.h"
26 26
27static const struct zynqmp_eemi_ops *eemi_ops_tbl;
28
27static const struct mfd_cell firmware_devs[] = {29static const struct mfd_cell firmware_devs[] = {
28 {30 {
29 .name = "zynqmp_power_controller",31 .name = "zynqmp_power_controller",
@@ -537,6 +539,49 @@ static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset, · 507 unmodified lines
537 return ret;539 return ret;
538}540}
539 541
542/**
543 * zynqmp_pm_fpga_load - Perform the fpga load
544 * @address: Address to write to
545 * @size: pl bitstream size
546 * @flags: Bitstream type
547 * -XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
548 * -XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
549 *
550 * This function provides access to pmufw. To transfer
551 * the required bitstream into PL.
552 *
553 * Return: Returns status, either success or error+reason
554 */
555static int zynqmp_pm_fpga_load(const u64 address, const u32 size,
556 const u32 flags)
557{
558 return zynqmp_pm_invoke_fn(PM_FPGA_LOAD, lower_32_bits(address),
559 upper_32_bits(address), size, flags, NULL);
560}
561
562/**
563 * zynqmp_pm_fpga_get_status - Read value from PCAP status register
564 * @value: Value to read
565 *
566 * This function provides access to the pmufw to get the PCAP
567 * status
568 *
569 * Return: Returns status, either success or error+reason
570 */
571static int zynqmp_pm_fpga_get_status(u32 *value)
572{
573 u32 ret_payload[PAYLOAD_ARG_CNT];
574 int ret;
575
576 if (!value)
577 return -EINVAL;
578
579 ret = zynqmp_pm_invoke_fn(PM_FPGA_GET_STATUS, 0, 0, 0, 0, ret_payload);
580 *value = ret_payload[1];
581
582 return ret;
583}
584
540/**585/**
541 * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller586 * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
542 * master has initialized its own power management587 * master has initialized its own power management
@@ -640,6 +685,8 @@ static const struct zynqmp_eemi_ops eemi_ops = { · 97 unmodified lines
640 .request_node = zynqmp_pm_request_node,685 .request_node = zynqmp_pm_request_node,
641 .release_node = zynqmp_pm_release_node,686 .release_node = zynqmp_pm_release_node,
642 .set_requirement = zynqmp_pm_set_requirement,687 .set_requirement = zynqmp_pm_set_requirement,
688 .fpga_load = zynqmp_pm_fpga_load,
689 .fpga_get_status = zynqmp_pm_fpga_get_status,
643};690};
644 691
645/**692/**
@@ -649,7 +696,11 @@ static const struct zynqmp_eemi_ops eemi_ops = { · 3 unmodified lines
649 */696 */
650const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)697const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
651{698{
652 return &eemi_ops;699 if (eemi_ops_tbl)
700 return eemi_ops_tbl;
701 else
702 return ERR_PTR(-EPROBE_DEFER);
703
653}704}
654EXPORT_SYMBOL_GPL(zynqmp_pm_get_eemi_ops);705EXPORT_SYMBOL_GPL(zynqmp_pm_get_eemi_ops);
655 706
@@ -694,6 +745,9 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) · 38 unmodified lines
694 pr_info("%s Trustzone version v%d.%d\n", __func__,745 pr_info("%s Trustzone version v%d.%d\n", __func__,
695 pm_tz_version >> 16, pm_tz_version & 0xFFFF);746 pm_tz_version >> 16, pm_tz_version & 0xFFFF);
696 747
748 /* Assign eemi_ops_table */
749 eemi_ops_tbl = &eemi_ops;
750
697 zynqmp_pm_api_debugfs_init();751 zynqmp_pm_api_debugfs_init();
698 752
699 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs,753 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs,
drivers/fpga/Kconfig+9−0
@@ -204,4 +204,13 @@ config FPGA_DFL_PCI · 203 unmodified lines
204 204
205 To compile this as a module, choose M here.205 To compile this as a module, choose M here.
206 206
207config FPGA_MGR_ZYNQMP_FPGA
208 tristate "Xilinx ZynqMP FPGA"
209 depends on ARCH_ZYNQMP || COMPILE_TEST
210 help
211 FPGA manager driver support for Xilinx ZynqMP FPGAs.
212 This driver uses the processor configuration port(PCAP)
213 to configure the programmable logic(PL) through PS
214 on ZynqMP SoC.
215
207endif # FPGA216endif # FPGA
drivers/fpga/Makefile+1−0
@@ -17,6 +17,7 @@ obj-$(CONFIG_FPGA_MGR_STRATIX10_SOC) += stratix10-soc.o · 16 unmodified lines
17obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o17obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o
18obj-$(CONFIG_FPGA_MGR_XILINX_SPI) += xilinx-spi.o18obj-$(CONFIG_FPGA_MGR_XILINX_SPI) += xilinx-spi.o
19obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o19obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
20obj-$(CONFIG_FPGA_MGR_ZYNQMP_FPGA) += zynqmp-fpga.o
20obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o21obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o
21obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o22obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o
22 23
drivers/fpga/zynqmp-fpga.c+159−0
@@ -0,0 +1,159 @@
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019 Xilinx, Inc.
4 */
5
6#include <linux/dma-mapping.h>
7#include <linux/fpga/fpga-mgr.h>
8#include <linux/io.h>
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/of_address.h>
12#include <linux/string.h>
13#include <linux/firmware/xlnx-zynqmp.h>
14
15/* Constant Definitions */
16#define IXR_FPGA_DONE_MASK BIT(3)
17
18/**
19 * struct zynqmp_fpga_priv - Private data structure
20 * @dev: Device data structure
21 * @flags: flags which is used to identify the bitfile type
22 */
23struct zynqmp_fpga_priv {
24 struct device *dev;
25 u32 flags;
26};
27
28static int zynqmp_fpga_ops_write_init(struct fpga_manager *mgr,
29 struct fpga_image_info *info,
30 const char *buf, size_t size)
31{
32 struct zynqmp_fpga_priv *priv;
33
34 priv = mgr->priv;
35 priv->flags = info->flags;
36
37 return 0;
38}
39
40static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
41 const char *buf, size_t size)
42{
43 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
44 struct zynqmp_fpga_priv *priv;
45 dma_addr_t dma_addr;
46 u32 eemi_flags = 0;
47 char *kbuf;
48 int ret;
49
50 if (!eemi_ops || !eemi_ops->fpga_load)
51 return -ENXIO;
52
53 priv = mgr->priv;
54
55 kbuf = dma_alloc_coherent(priv->dev, size, &dma_addr, GFP_KERNEL);
56 if (!kbuf)
57 return -ENOMEM;
58
59 memcpy(kbuf, buf, size);
60
61 wmb(); /* ensure all writes are done before initiate FW call */
62
63 if (priv->flags & FPGA_MGR_PARTIAL_RECONFIG)
64 eemi_flags |= XILINX_ZYNQMP_PM_FPGA_PARTIAL;
65
66 ret = eemi_ops->fpga_load(dma_addr, size, eemi_flags);
67
68 dma_free_coherent(priv->dev, size, kbuf, dma_addr);
69
70 return ret;
71}
72
73static int zynqmp_fpga_ops_write_complete(struct fpga_manager *mgr,
74 struct fpga_image_info *info)
75{
76 return 0;
77}
78
79static enum fpga_mgr_states zynqmp_fpga_ops_state(struct fpga_manager *mgr)
80{
81 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
82 u32 status;
83
84 if (!eemi_ops || !eemi_ops->fpga_get_status)
85 return FPGA_MGR_STATE_UNKNOWN;
86
87 eemi_ops->fpga_get_status(&status);
88 if (status & IXR_FPGA_DONE_MASK)
89 return FPGA_MGR_STATE_OPERATING;
90
91 return FPGA_MGR_STATE_UNKNOWN;
92}
93
94static const struct fpga_manager_ops zynqmp_fpga_ops = {
95 .state = zynqmp_fpga_ops_state,
96 .write_init = zynqmp_fpga_ops_write_init,
97 .write = zynqmp_fpga_ops_write,
98 .write_complete = zynqmp_fpga_ops_write_complete,
99};
100
101static int zynqmp_fpga_probe(struct platform_device *pdev)
102{
103 struct device *dev = &pdev->dev;
104 struct zynqmp_fpga_priv *priv;
105 struct fpga_manager *mgr;
106 int ret;
107
108 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
109 if (!priv)
110 return -ENOMEM;
111
112 priv->dev = dev;
113
114 mgr = devm_fpga_mgr_create(dev, "Xilinx ZynqMP FPGA Manager",
115 &zynqmp_fpga_ops, priv);
116 if (!mgr)
117 return -ENOMEM;
118
119 platform_set_drvdata(pdev, mgr);
120
121 ret = fpga_mgr_register(mgr);
122 if (ret) {
123 dev_err(dev, "unable to register FPGA manager");
124 return ret;
125 }
126
127 return 0;
128}
129
130static int zynqmp_fpga_remove(struct platform_device *pdev)
131{
132 struct fpga_manager *mgr = platform_get_drvdata(pdev);
133
134 fpga_mgr_unregister(mgr);
135
136 return 0;
137}
138
139static const struct of_device_id zynqmp_fpga_of_match[] = {
140 { .compatible = "xlnx,zynqmp-pcap-fpga", },
141 {},
142};
143
144MODULE_DEVICE_TABLE(of, zynqmp_fpga_of_match);
145
146static struct platform_driver zynqmp_fpga_driver = {
147 .probe = zynqmp_fpga_probe,
148 .remove = zynqmp_fpga_remove,
149 .driver = {
150 .name = "zynqmp_fpga_manager",
151 .of_match_table = of_match_ptr(zynqmp_fpga_of_match),
152 },
153};
154
155module_platform_driver(zynqmp_fpga_driver);
156
157MODULE_AUTHOR("Nava kishore Manne <navam@xilinx.com>");
158MODULE_DESCRIPTION("Xilinx ZynqMp FPGA Manager");
159MODULE_LICENSE("GPL");
drivers/nvmem/zynqmp_nvmem.c+7−3
@@ -16,6 +16,8 @@ struct zynqmp_nvmem_data { · 15 unmodified lines
16 struct nvmem_device *nvmem;16 struct nvmem_device *nvmem;
17};17};
18 18
19static const struct zynqmp_eemi_ops *eemi_ops;
20
19static int zynqmp_nvmem_read(void *context, unsigned int offset,21static int zynqmp_nvmem_read(void *context, unsigned int offset,
20 void *val, size_t bytes)22 void *val, size_t bytes)
21{23{
@@ -23,9 +25,7 @@ static int zynqmp_nvmem_read(void *context, unsigned int offset, · 1 unmodified line
23 int idcode, version;25 int idcode, version;
24 struct zynqmp_nvmem_data *priv = context;26 struct zynqmp_nvmem_data *priv = context;
25 27
26 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();28 if (!eemi_ops->get_chipid)
27
28 if (!eemi_ops || !eemi_ops->get_chipid)
29 return -ENXIO;29 return -ENXIO;
30 30
31 ret = eemi_ops->get_chipid(&idcode, &version);31 ret = eemi_ops->get_chipid(&idcode, &version);
@@ -61,6 +61,10 @@ static int zynqmp_nvmem_probe(struct platform_device *pdev) · 29 unmodified lines
61 if (!priv)61 if (!priv)
62 return -ENOMEM;62 return -ENOMEM;
63 63
64 eemi_ops = zynqmp_pm_get_eemi_ops();
65 if (IS_ERR(eemi_ops))
66 return PTR_ERR(eemi_ops);
67
64 priv->dev = dev;68 priv->dev = dev;
65 econfig.dev = dev;69 econfig.dev = dev;
66 econfig.reg_read = zynqmp_nvmem_read;70 econfig.reg_read = zynqmp_nvmem_read;
drivers/reset/reset-zynqmp.c+4−4
@@ -79,11 +79,11 @@ static int zynqmp_reset_probe(struct platform_device *pdev) · 78 unmodified lines
79 if (!priv)79 if (!priv)
80 return -ENOMEM;80 return -ENOMEM;
81 81
82 platform_set_drvdata(pdev, priv);
83
84 priv->eemi_ops = zynqmp_pm_get_eemi_ops();82 priv->eemi_ops = zynqmp_pm_get_eemi_ops();
85 if (!priv->eemi_ops)83 if (IS_ERR(priv->eemi_ops))
86 return -ENXIO;84 return PTR_ERR(priv->eemi_ops);
85
86 platform_set_drvdata(pdev, priv);
87 87
88 priv->rcdev.ops = &zynqmp_reset_ops;88 priv->rcdev.ops = &zynqmp_reset_ops;
89 priv->rcdev.owner = THIS_MODULE;89 priv->rcdev.owner = THIS_MODULE;
drivers/soc/xilinx/zynqmp_pm_domains.c+10−8
@@ -23,6 +23,8 @@ · 22 unmodified lines
23/* Flag stating if PM nodes mapped to the PM domain has been requested */23/* Flag stating if PM nodes mapped to the PM domain has been requested */
24#define ZYNQMP_PM_DOMAIN_REQUESTED BIT(0)24#define ZYNQMP_PM_DOMAIN_REQUESTED BIT(0)
25 25
26static const struct zynqmp_eemi_ops *eemi_ops;
27
26/**28/**
27 * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain29 * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain
28 * @gpd: Generic power domain30 * @gpd: Generic power domain
@@ -71,9 +73,8 @@ static int zynqmp_gpd_power_on(struct generic_pm_domain *domain) · 42 unmodified lines
71{73{
72 int ret;74 int ret;
73 struct zynqmp_pm_domain *pd;75 struct zynqmp_pm_domain *pd;
74 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
75 76
76 if (!eemi_ops || !eemi_ops->set_requirement)77 if (!eemi_ops->set_requirement)
77 return -ENXIO;78 return -ENXIO;
78 79
79 pd = container_of(domain, struct zynqmp_pm_domain, gpd);80 pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -107,9 +108,8 @@ static int zynqmp_gpd_power_off(struct generic_pm_domain *domain) · 27 unmodified lines
107 struct zynqmp_pm_domain *pd;108 struct zynqmp_pm_domain *pd;
108 u32 capabilities = 0;109 u32 capabilities = 0;
109 bool may_wakeup;110 bool may_wakeup;
110 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
111 111
112 if (!eemi_ops || !eemi_ops->set_requirement)112 if (!eemi_ops->set_requirement)
113 return -ENXIO;113 return -ENXIO;
114 114
115 pd = container_of(domain, struct zynqmp_pm_domain, gpd);115 pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -160,9 +160,8 @@ static int zynqmp_gpd_attach_dev(struct generic_pm_domain *domain, · 44 unmodified lines
160{160{
161 int ret;161 int ret;
162 struct zynqmp_pm_domain *pd;162 struct zynqmp_pm_domain *pd;
163 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
164 163
165 if (!eemi_ops || !eemi_ops->request_node)164 if (!eemi_ops->request_node)
166 return -ENXIO;165 return -ENXIO;
167 166
168 pd = container_of(domain, struct zynqmp_pm_domain, gpd);167 pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -197,9 +196,8 @@ static void zynqmp_gpd_detach_dev(struct generic_pm_domain *domain, · 28 unmodified lines
197{196{
198 int ret;197 int ret;
199 struct zynqmp_pm_domain *pd;198 struct zynqmp_pm_domain *pd;
200 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
201 199
202 if (!eemi_ops || !eemi_ops->release_node)200 if (!eemi_ops->release_node)
203 return;201 return;
204 202
205 pd = container_of(domain, struct zynqmp_pm_domain, gpd);203 pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -266,6 +264,10 @@ static int zynqmp_gpd_probe(struct platform_device *pdev) · 60 unmodified lines
266 struct zynqmp_pm_domain *pd;264 struct zynqmp_pm_domain *pd;
267 struct device *dev = &pdev->dev;265 struct device *dev = &pdev->dev;
268 266
267 eemi_ops = zynqmp_pm_get_eemi_ops();
268 if (IS_ERR(eemi_ops))
269 return PTR_ERR(eemi_ops);
270
269 pd = devm_kcalloc(dev, ZYNQMP_NUM_DOMAINS, sizeof(*pd), GFP_KERNEL);271 pd = devm_kcalloc(dev, ZYNQMP_NUM_DOMAINS, sizeof(*pd), GFP_KERNEL);
270 if (!pd)272 if (!pd)
271 return -ENOMEM;273 return -ENOMEM;
drivers/soc/xilinx/zynqmp_power.c+6−4
@@ -31,6 +31,7 @@ static const char *const suspend_modes[] = { · 30 unmodified lines
31};31};
32 32
33static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD;33static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD;
34static const struct zynqmp_eemi_ops *eemi_ops;
34 35
35enum pm_api_cb_id {36enum pm_api_cb_id {
36 PM_INIT_SUSPEND_CB = 30,37 PM_INIT_SUSPEND_CB = 30,
@@ -92,9 +93,8 @@ static ssize_t suspend_mode_store(struct device *dev, · 55 unmodified lines
92 const char *buf, size_t count)93 const char *buf, size_t count)
93{94{
94 int md, ret = -EINVAL;95 int md, ret = -EINVAL;
95 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
96 96
97 if (!eemi_ops || !eemi_ops->set_suspend_mode)97 if (!eemi_ops->set_suspend_mode)
98 return ret;98 return ret;
99 99
100 for (md = PM_SUSPEND_MODE_FIRST; md < ARRAY_SIZE(suspend_modes); md++)100 for (md = PM_SUSPEND_MODE_FIRST; md < ARRAY_SIZE(suspend_modes); md++)
@@ -120,9 +120,11 @@ static int zynqmp_pm_probe(struct platform_device *pdev) · 19 unmodified lines
120 int ret, irq;120 int ret, irq;
121 u32 pm_api_version;121 u32 pm_api_version;
122 122
123 const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();123 eemi_ops = zynqmp_pm_get_eemi_ops();
124 if (IS_ERR(eemi_ops))
125 return PTR_ERR(eemi_ops);
124 126
125 if (!eemi_ops || !eemi_ops->get_api_version || !eemi_ops->init_finalize)127 if (!eemi_ops->get_api_version || !eemi_ops->init_finalize)
126 return -ENXIO;128 return -ENXIO;
127 129
128 eemi_ops->init_finalize();130 eemi_ops->init_finalize();
drivers/spi/spi-zynqmp-gqspi.c+5−0
@@ -138,6 +138,7 @@ · 137 unmodified lines
138 138
139#define SPI_AUTOSUSPEND_TIMEOUT 3000139#define SPI_AUTOSUSPEND_TIMEOUT 3000
140enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA};140enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA};
141static const struct zynqmp_eemi_ops *eemi_ops;
141 142
142/**143/**
143 * struct zynqmp_qspi - Defines qspi driver instance144 * struct zynqmp_qspi - Defines qspi driver instance
@@ -1021,6 +1022,10 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) · 877 unmodified lines
1021 struct resource *res;1022 struct resource *res;
1022 struct device *dev = &pdev->dev;1023 struct device *dev = &pdev->dev;
1023 1024
1025 eemi_ops = zynqmp_pm_get_eemi_ops();
1026 if (IS_ERR(eemi_ops))
1027 return PTR_ERR(eemi_ops);
1028
1024 master = spi_alloc_master(&pdev->dev, sizeof(*xqspi));1029 master = spi_alloc_master(&pdev->dev, sizeof(*xqspi));
1025 if (!master)1030 if (!master)
1026 return -ENOMEM;1031 return -ENOMEM;
include/linux/firmware/xlnx-zynqmp.h+13−1
@@ -48,6 +48,14 @@ · 47 unmodified lines
48#define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U48#define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U
49#define ZYNQMP_PM_CAPABILITY_POWER 0x8U49#define ZYNQMP_PM_CAPABILITY_POWER 0x8U
50 50
51/*
52 * Firmware FPGA Manager flags
53 * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
54 * XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
55 */
56#define XILINX_ZYNQMP_PM_FPGA_FULL 0x0U
57#define XILINX_ZYNQMP_PM_FPGA_PARTIAL BIT(0)
58
51enum pm_api_id {59enum pm_api_id {
52 PM_GET_API_VERSION = 1,60 PM_GET_API_VERSION = 1,
53 PM_REQUEST_NODE = 13,61 PM_REQUEST_NODE = 13,
@@ -56,6 +64,8 @@ enum pm_api_id { · 2 unmodified lines
56 PM_RESET_ASSERT = 17,64 PM_RESET_ASSERT = 17,
57 PM_RESET_GET_STATUS,65 PM_RESET_GET_STATUS,
58 PM_PM_INIT_FINALIZE = 21,66 PM_PM_INIT_FINALIZE = 21,
67 PM_FPGA_LOAD,
68 PM_FPGA_GET_STATUS,
59 PM_GET_CHIPID = 24,69 PM_GET_CHIPID = 24,
60 PM_IOCTL = 34,70 PM_IOCTL = 34,
61 PM_QUERY_DATA,71 PM_QUERY_DATA,
@@ -258,6 +268,8 @@ struct zynqmp_pm_query_data { · 196 unmodified lines
258struct zynqmp_eemi_ops {268struct zynqmp_eemi_ops {
259 int (*get_api_version)(u32 *version);269 int (*get_api_version)(u32 *version);
260 int (*get_chipid)(u32 *idcode, u32 *version);270 int (*get_chipid)(u32 *idcode, u32 *version);
271 int (*fpga_load)(const u64 address, const u32 size, const u32 flags);
272 int (*fpga_get_status)(u32 *value);
261 int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);273 int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
262 int (*clock_enable)(u32 clock_id);274 int (*clock_enable)(u32 clock_id);
263 int (*clock_disable)(u32 clock_id);275 int (*clock_disable)(u32 clock_id);
@@ -293,7 +305,7 @@ const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void); · 29 unmodified lines
293#else305#else
294static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)306static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
295{307{
296 return NULL;308 return ERR_PTR(-ENODEV);
297}309}
298#endif310#endif
299 311

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t