hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/fpga/zynq-fpga.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2011-2015 Xilinx Inc.
34 * Copyright (c) 2015, National Instruments Corp.
45 *
56 * FPGA Manager Driver for Xilinx Zynq, heavily based on xdevcfg driver
67 * in their vendor tree.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; version 2 of the License.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
168 */
179
1810 #include <linux/clk.h>
....@@ -501,6 +493,10 @@
501493 if (err)
502494 return err;
503495
496
+ /* Release 'PR' control back to the ICAP */
497
+ zynq_fpga_write(priv, CTRL_OFFSET,
498
+ zynq_fpga_read(priv, CTRL_OFFSET) & ~CTRL_PCAP_PR_MASK);
499
+
504500 err = zynq_fpga_poll_timeout(priv, INT_STS_OFFSET, intr_status,
505501 intr_status & IXR_PCFG_DONE_MASK,
506502 INIT_POLL_DELAY,
....@@ -582,14 +578,13 @@
582578 init_completion(&priv->dma_done);
583579
584580 priv->irq = platform_get_irq(pdev, 0);
585
- if (priv->irq < 0) {
586
- dev_err(dev, "No IRQ available\n");
581
+ if (priv->irq < 0)
587582 return priv->irq;
588
- }
589583
590584 priv->clk = devm_clk_get(dev, "ref_clk");
591585 if (IS_ERR(priv->clk)) {
592
- dev_err(dev, "input clock not found\n");
586
+ if (PTR_ERR(priv->clk) != -EPROBE_DEFER)
587
+ dev_err(dev, "input clock not found\n");
593588 return PTR_ERR(priv->clk);
594589 }
595590
....@@ -614,8 +609,8 @@
614609
615610 clk_disable(priv->clk);
616611
617
- mgr = fpga_mgr_create(dev, "Xilinx Zynq FPGA Manager",
618
- &zynq_fpga_ops, priv);
612
+ mgr = devm_fpga_mgr_create(dev, "Xilinx Zynq FPGA Manager",
613
+ &zynq_fpga_ops, priv);
619614 if (!mgr)
620615 return -ENOMEM;
621616
....@@ -624,7 +619,6 @@
624619 err = fpga_mgr_register(mgr);
625620 if (err) {
626621 dev_err(dev, "unable to register FPGA manager\n");
627
- fpga_mgr_free(mgr);
628622 clk_unprepare(priv->clk);
629623 return err;
630624 }