diff options
Diffstat (limited to 'drivers/fpga')
| -rw-r--r-- | drivers/fpga/altera-cvp.c | 10 | ||||
| -rw-r--r-- | drivers/fpga/altera-ps-spi.c | 5 | ||||
| -rw-r--r-- | drivers/fpga/dfl-afu-dma-region.c | 2 | ||||
| -rw-r--r-- | drivers/fpga/dfl.c | 22 | ||||
| -rw-r--r-- | drivers/fpga/ice40-spi.c | 5 | ||||
| -rw-r--r-- | drivers/fpga/stratix10-soc.c | 6 | ||||
| -rw-r--r-- | drivers/fpga/ts73xx-fpga.c | 10 | ||||
| -rw-r--r-- | drivers/fpga/xilinx-pr-decoupler.c | 10 | ||||
| -rw-r--r-- | drivers/fpga/xilinx-spi.c | 5 | ||||
| -rw-r--r-- | drivers/fpga/zynq-fpga.c | 10 | ||||
| -rw-r--r-- | drivers/fpga/zynqmp-fpga.c | 4 |
11 files changed, 33 insertions, 56 deletions
diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 35c3aa5792e2..770915fb97f9 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * FPGA Manager Driver for Altera Arria/Cyclone/Stratix CvP | 3 | * FPGA Manager Driver for Altera Arria/Cyclone/Stratix CvP |
| 3 | * | 4 | * |
| @@ -5,15 +6,6 @@ | |||
| 5 | * | 6 | * |
| 6 | * Anatolij Gustschin <agust@denx.de> | 7 | * Anatolij Gustschin <agust@denx.de> |
| 7 | * | 8 | * |
| 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. | ||
| 16 | * | ||
| 17 | * Manage Altera FPGA firmware using PCIe CvP. | 9 | * Manage Altera FPGA firmware using PCIe CvP. |
| 18 | * Firmware must be in binary "rbf" format. | 10 | * Firmware must be in binary "rbf" format. |
| 19 | */ | 11 | */ |
diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index 678d0115f840..a13f224303c6 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Altera Passive Serial SPI Driver | 3 | * Altera Passive Serial SPI Driver |
| 3 | * | 4 | * |
| @@ -5,10 +6,6 @@ | |||
| 5 | * | 6 | * |
| 6 | * Joshua Clayton <stillcompiling@gmail.com> | 7 | * Joshua Clayton <stillcompiling@gmail.com> |
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms and conditions of the GNU General Public License, | ||
| 10 | * version 2, as published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * Manage Altera FPGA firmware that is loaded over SPI using the passive | 9 | * Manage Altera FPGA firmware that is loaded over SPI using the passive |
| 13 | * serial configuration method. | 10 | * serial configuration method. |
| 14 | * Firmware must be in binary "rbf" format. | 11 | * Firmware must be in binary "rbf" format. |
diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c index c438722bf4e1..dcd80b088c7b 100644 --- a/drivers/fpga/dfl-afu-dma-region.c +++ b/drivers/fpga/dfl-afu-dma-region.c | |||
| @@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata, | |||
| 399 | region->pages[0], 0, | 399 | region->pages[0], 0, |
| 400 | region->length, | 400 | region->length, |
| 401 | DMA_BIDIRECTIONAL); | 401 | DMA_BIDIRECTIONAL); |
| 402 | if (dma_mapping_error(&pdata->dev->dev, region->iova)) { | 402 | if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) { |
| 403 | dev_err(&pdata->dev->dev, "failed to map for dma\n"); | 403 | dev_err(&pdata->dev->dev, "failed to map for dma\n"); |
| 404 | ret = -EFAULT; | 404 | ret = -EFAULT; |
| 405 | goto unpin_pages; | 405 | goto unpin_pages; |
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 2c09e502e721..4b66aaa32b5a 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c | |||
| @@ -40,6 +40,13 @@ enum dfl_fpga_devt_type { | |||
| 40 | DFL_FPGA_DEVT_MAX, | 40 | DFL_FPGA_DEVT_MAX, |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | static struct lock_class_key dfl_pdata_keys[DFL_ID_MAX]; | ||
| 44 | |||
| 45 | static const char *dfl_pdata_key_strings[DFL_ID_MAX] = { | ||
| 46 | "dfl-fme-pdata", | ||
| 47 | "dfl-port-pdata", | ||
| 48 | }; | ||
| 49 | |||
| 43 | /** | 50 | /** |
| 44 | * dfl_dev_info - dfl feature device information. | 51 | * dfl_dev_info - dfl feature device information. |
| 45 | * @name: name string of the feature platform device. | 52 | * @name: name string of the feature platform device. |
| @@ -315,7 +322,7 @@ static void dfl_chardev_uinit(void) | |||
| 315 | for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) | 322 | for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) |
| 316 | if (MAJOR(dfl_chrdevs[i].devt)) { | 323 | if (MAJOR(dfl_chrdevs[i].devt)) { |
| 317 | unregister_chrdev_region(dfl_chrdevs[i].devt, | 324 | unregister_chrdev_region(dfl_chrdevs[i].devt, |
| 318 | MINORMASK); | 325 | MINORMASK + 1); |
| 319 | dfl_chrdevs[i].devt = MKDEV(0, 0); | 326 | dfl_chrdevs[i].devt = MKDEV(0, 0); |
| 320 | } | 327 | } |
| 321 | } | 328 | } |
| @@ -325,8 +332,8 @@ static int dfl_chardev_init(void) | |||
| 325 | int i, ret; | 332 | int i, ret; |
| 326 | 333 | ||
| 327 | for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) { | 334 | for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) { |
| 328 | ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0, MINORMASK, | 335 | ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0, |
| 329 | dfl_chrdevs[i].name); | 336 | MINORMASK + 1, dfl_chrdevs[i].name); |
| 330 | if (ret) | 337 | if (ret) |
| 331 | goto exit; | 338 | goto exit; |
| 332 | } | 339 | } |
| @@ -443,11 +450,16 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) | |||
| 443 | struct platform_device *fdev = binfo->feature_dev; | 450 | struct platform_device *fdev = binfo->feature_dev; |
| 444 | struct dfl_feature_platform_data *pdata; | 451 | struct dfl_feature_platform_data *pdata; |
| 445 | struct dfl_feature_info *finfo, *p; | 452 | struct dfl_feature_info *finfo, *p; |
| 453 | enum dfl_id_type type; | ||
| 446 | int ret, index = 0; | 454 | int ret, index = 0; |
| 447 | 455 | ||
| 448 | if (!fdev) | 456 | if (!fdev) |
| 449 | return 0; | 457 | return 0; |
| 450 | 458 | ||
| 459 | type = feature_dev_id_type(fdev); | ||
| 460 | if (WARN_ON_ONCE(type >= DFL_ID_MAX)) | ||
| 461 | return -EINVAL; | ||
| 462 | |||
| 451 | /* | 463 | /* |
| 452 | * we do not need to care for the memory which is associated with | 464 | * we do not need to care for the memory which is associated with |
| 453 | * the platform device. After calling platform_device_unregister(), | 465 | * the platform device. After calling platform_device_unregister(), |
| @@ -463,6 +475,8 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) | |||
| 463 | pdata->num = binfo->feature_num; | 475 | pdata->num = binfo->feature_num; |
| 464 | pdata->dfl_cdev = binfo->cdev; | 476 | pdata->dfl_cdev = binfo->cdev; |
| 465 | mutex_init(&pdata->lock); | 477 | mutex_init(&pdata->lock); |
| 478 | lockdep_set_class_and_name(&pdata->lock, &dfl_pdata_keys[type], | ||
| 479 | dfl_pdata_key_strings[type]); | ||
| 466 | 480 | ||
| 467 | /* | 481 | /* |
| 468 | * the count should be initialized to 0 to make sure | 482 | * the count should be initialized to 0 to make sure |
| @@ -497,7 +511,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) | |||
| 497 | 511 | ||
| 498 | ret = platform_device_add(binfo->feature_dev); | 512 | ret = platform_device_add(binfo->feature_dev); |
| 499 | if (!ret) { | 513 | if (!ret) { |
| 500 | if (feature_dev_id_type(binfo->feature_dev) == PORT_ID) | 514 | if (type == PORT_ID) |
| 501 | dfl_fpga_cdev_add_port_dev(binfo->cdev, | 515 | dfl_fpga_cdev_add_port_dev(binfo->cdev, |
| 502 | binfo->feature_dev); | 516 | binfo->feature_dev); |
| 503 | else | 517 | else |
diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c index 6154661b8f76..56e112e14a10 100644 --- a/drivers/fpga/ice40-spi.c +++ b/drivers/fpga/ice40-spi.c | |||
| @@ -1,12 +1,9 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * FPGA Manager Driver for Lattice iCE40. | 3 | * FPGA Manager Driver for Lattice iCE40. |
| 3 | * | 4 | * |
| 4 | * Copyright (c) 2016 Joel Holdsworth | 5 | * Copyright (c) 2016 Joel Holdsworth |
| 5 | * | 6 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This driver adds support to the FPGA manager for configuring the SRAM of | 7 | * This driver adds support to the FPGA manager for configuring the SRAM of |
| 11 | * Lattice iCE40 FPGAs through slave SPI. | 8 | * Lattice iCE40 FPGAs through slave SPI. |
| 12 | */ | 9 | */ |
diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index 13851b3d1c56..215d33789c74 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c | |||
| @@ -507,12 +507,16 @@ static int __init s10_init(void) | |||
| 507 | if (!fw_np) | 507 | if (!fw_np) |
| 508 | return -ENODEV; | 508 | return -ENODEV; |
| 509 | 509 | ||
| 510 | of_node_get(fw_np); | ||
| 510 | np = of_find_matching_node(fw_np, s10_of_match); | 511 | np = of_find_matching_node(fw_np, s10_of_match); |
| 511 | if (!np) | 512 | if (!np) { |
| 513 | of_node_put(fw_np); | ||
| 512 | return -ENODEV; | 514 | return -ENODEV; |
| 515 | } | ||
| 513 | 516 | ||
| 514 | of_node_put(np); | 517 | of_node_put(np); |
| 515 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); | 518 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); |
| 519 | of_node_put(fw_np); | ||
| 516 | if (ret) | 520 | if (ret) |
| 517 | return ret; | 521 | return ret; |
| 518 | 522 | ||
diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c index dc22a5842609..9a17fe98c1b0 100644 --- a/drivers/fpga/ts73xx-fpga.c +++ b/drivers/fpga/ts73xx-fpga.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Technologic Systems TS-73xx SBC FPGA loader | 3 | * Technologic Systems TS-73xx SBC FPGA loader |
| 3 | * | 4 | * |
| @@ -5,15 +6,6 @@ | |||
| 5 | * | 6 | * |
| 6 | * FPGA Manager Driver for the on-board Altera Cyclone II FPGA found on | 7 | * FPGA Manager Driver for the on-board Altera Cyclone II FPGA found on |
| 7 | * TS-7300, heavily based on load_fpga.c in their vendor tree. | 8 | * TS-7300, heavily based on load_fpga.c in their vendor tree. |
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; version 2 of the License. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | */ | 9 | */ |
| 18 | 10 | ||
| 19 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c index 641036135207..af9b387c56d3 100644 --- a/drivers/fpga/xilinx-pr-decoupler.c +++ b/drivers/fpga/xilinx-pr-decoupler.c | |||
| @@ -1,18 +1,10 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (c) 2017, National Instruments Corp. | 3 | * Copyright (c) 2017, National Instruments Corp. |
| 3 | * Copyright (c) 2017, Xilix Inc | 4 | * Copyright (c) 2017, Xilix Inc |
| 4 | * | 5 | * |
| 5 | * FPGA Bridge Driver for the Xilinx LogiCORE Partial Reconfiguration | 6 | * FPGA Bridge Driver for the Xilinx LogiCORE Partial Reconfiguration |
| 6 | * Decoupler IP Core. | 7 | * Decoupler IP Core. |
| 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. | ||
| 16 | */ | 8 | */ |
| 17 | 9 | ||
| 18 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 469486be20c4..272ee0c22822 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Xilinx Spartan6 Slave Serial SPI Driver | 3 | * Xilinx Spartan6 Slave Serial SPI Driver |
| 3 | * | 4 | * |
| @@ -5,10 +6,6 @@ | |||
| 5 | * | 6 | * |
| 6 | * Anatolij Gustschin <agust@denx.de> | 7 | * Anatolij Gustschin <agust@denx.de> |
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms and conditions of the GNU General Public License, | ||
| 10 | * version 2, as published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * Manage Xilinx FPGA firmware that is loaded over SPI using | 9 | * Manage Xilinx FPGA firmware that is loaded over SPI using |
| 13 | * the slave serial configuration interface. | 10 | * the slave serial configuration interface. |
| 14 | */ | 11 | */ |
diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 57b0e6775958..31ef38e38537 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c | |||
| @@ -1,18 +1,10 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (c) 2011-2015 Xilinx Inc. | 3 | * Copyright (c) 2011-2015 Xilinx Inc. |
| 3 | * Copyright (c) 2015, National Instruments Corp. | 4 | * Copyright (c) 2015, National Instruments Corp. |
| 4 | * | 5 | * |
| 5 | * FPGA Manager Driver for Xilinx Zynq, heavily based on xdevcfg driver | 6 | * FPGA Manager Driver for Xilinx Zynq, heavily based on xdevcfg driver |
| 6 | * in their vendor tree. | 7 | * 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. | ||
| 16 | */ | 8 | */ |
| 17 | 9 | ||
| 18 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c index f7cbaadf49ab..b8a88d21d038 100644 --- a/drivers/fpga/zynqmp-fpga.c +++ b/drivers/fpga/zynqmp-fpga.c | |||
| @@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr, | |||
| 47 | char *kbuf; | 47 | char *kbuf; |
| 48 | int ret; | 48 | int ret; |
| 49 | 49 | ||
| 50 | if (!eemi_ops || !eemi_ops->fpga_load) | 50 | if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_load) |
| 51 | return -ENXIO; | 51 | return -ENXIO; |
| 52 | 52 | ||
| 53 | priv = mgr->priv; | 53 | priv = mgr->priv; |
| @@ -81,7 +81,7 @@ static enum fpga_mgr_states zynqmp_fpga_ops_state(struct fpga_manager *mgr) | |||
| 81 | const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); | 81 | const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); |
| 82 | u32 status; | 82 | u32 status; |
| 83 | 83 | ||
| 84 | if (!eemi_ops || !eemi_ops->fpga_get_status) | 84 | if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_get_status) |
| 85 | return FPGA_MGR_STATE_UNKNOWN; | 85 | return FPGA_MGR_STATE_UNKNOWN; |
| 86 | 86 | ||
| 87 | eemi_ops->fpga_get_status(&status); | 87 | eemi_ops->fpga_get_status(&status); |
