Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'fpga-late-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga into char-misc-next

Moritz writes:

Second set of FPGA Manager changes for 5.13-rc1

FPGA Manager:
- Russ' first change improves port_enable reliability
- Russ' second change adds a new device ID for a DFL device
- Geert's change updates the examples in binding with dt overlay sugar
syntax

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of my for-next branch) without issues.

Signed-off-by: Moritz Fischer <mdf@kernel.org>

* tag 'fpga-late-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga:
fpga: dfl: pci: add DID for D5005 PAC cards
dt-bindings: fpga: fpga-region: Convert to sugar syntax
fpga: dfl: afu: harden port enable logic
fpga: Add support for Xilinx DFX AXI Shutdown manager
dt-bindings: fpga: Add compatible value for Xilinx DFX AXI shutdown manager
fpga: xilinx-pr-decoupler: Simplify code by using dev_err_probe()
fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER

+117 -115
+75 -92
Documentation/devicetree/bindings/fpga/fpga-region.txt
··· 245 245 246 246 Overlay contains: 247 247 248 - /dts-v1/ /plugin/; 249 - / { 250 - fragment@0 { 251 - target = <&fpga_region0>; 252 - #address-cells = <1>; 253 - #size-cells = <1>; 254 - __overlay__ { 255 - #address-cells = <1>; 256 - #size-cells = <1>; 248 + /dts-v1/; 249 + /plugin/; 257 250 258 - firmware-name = "soc_system.rbf"; 259 - fpga-bridges = <&fpga_bridge1>; 260 - ranges = <0x20000 0xff200000 0x100000>, 261 - <0x0 0xc0000000 0x20000000>; 251 + &fpga_region0 { 252 + #address-cells = <1>; 253 + #size-cells = <1>; 262 254 263 - gpio@10040 { 264 - compatible = "altr,pio-1.0"; 265 - reg = <0x10040 0x20>; 266 - altr,ngpio = <4>; 267 - #gpio-cells = <2>; 268 - clocks = <2>; 269 - gpio-controller; 270 - }; 255 + firmware-name = "soc_system.rbf"; 256 + fpga-bridges = <&fpga_bridge1>; 257 + ranges = <0x20000 0xff200000 0x100000>, 258 + <0x0 0xc0000000 0x20000000>; 271 259 272 - onchip-memory { 273 - device_type = "memory"; 274 - compatible = "altr,onchipmem-15.1"; 275 - reg = <0x0 0x10000>; 276 - }; 277 - }; 260 + gpio@10040 { 261 + compatible = "altr,pio-1.0"; 262 + reg = <0x10040 0x20>; 263 + altr,ngpio = <4>; 264 + #gpio-cells = <2>; 265 + clocks = <2>; 266 + gpio-controller; 267 + }; 268 + 269 + onchip-memory { 270 + device_type = "memory"; 271 + compatible = "altr,onchipmem-15.1"; 272 + reg = <0x0 0x10000>; 278 273 }; 279 274 }; 280 275 ··· 366 371 }; 367 372 368 373 DT Overlay contains: 369 - /dts-v1/ /plugin/; 370 - / { 371 - fragment@0 { 372 - target = <&fpga_region0>; 374 + 375 + /dts-v1/; 376 + /plugin/; 377 + 378 + &fpga_region0 { 373 379 #address-cells = <1>; 374 380 #size-cells = <1>; 375 - __overlay__ { 376 - #address-cells = <1>; 377 - #size-cells = <1>; 378 381 379 - firmware-name = "zynq-gpio.bin"; 382 + firmware-name = "zynq-gpio.bin"; 380 383 381 - gpio1: gpio@40000000 { 382 - compatible = "xlnx,xps-gpio-1.00.a"; 383 - reg = <0x40000000 0x10000>; 384 - gpio-controller; 385 - #gpio-cells = <0x2>; 386 - xlnx,gpio-width= <0x6>; 387 - }; 384 + gpio1: gpio@40000000 { 385 + compatible = "xlnx,xps-gpio-1.00.a"; 386 + reg = <0x40000000 0x10000>; 387 + gpio-controller; 388 + #gpio-cells = <0x2>; 389 + xlnx,gpio-width= <0x6>; 388 390 }; 389 391 }; 390 392 ··· 394 402 configured. Each region has its own bridge in the FPGA fabric. 395 403 396 404 DT Overlay contains: 397 - /dts-v1/ /plugin/; 398 - / { 399 - fragment@0 { 400 - target = <&fpga_region0>; 401 - #address-cells = <1>; 402 - #size-cells = <1>; 403 - __overlay__ { 404 - #address-cells = <1>; 405 - #size-cells = <1>; 406 405 407 - firmware-name = "base.rbf"; 406 + /dts-v1/; 407 + /plugin/; 408 408 409 - fpga-bridge@4400 { 410 - compatible = "altr,freeze-bridge-controller"; 411 - reg = <0x4400 0x10>; 409 + &fpga_region0 { 410 + #address-cells = <1>; 411 + #size-cells = <1>; 412 412 413 - fpga_region1: fpga-region1 { 414 - compatible = "fpga-region"; 415 - #address-cells = <0x1>; 416 - #size-cells = <0x1>; 417 - ranges; 418 - }; 419 - }; 413 + firmware-name = "base.rbf"; 420 414 421 - fpga-bridge@4420 { 422 - compatible = "altr,freeze-bridge-controller"; 423 - reg = <0x4420 0x10>; 415 + fpga-bridge@4400 { 416 + compatible = "altr,freeze-bridge-controller"; 417 + reg = <0x4400 0x10>; 424 418 425 - fpga_region2: fpga-region2 { 426 - compatible = "fpga-region"; 427 - #address-cells = <0x1>; 428 - #size-cells = <0x1>; 429 - ranges; 430 - }; 431 - }; 419 + fpga_region1: fpga-region1 { 420 + compatible = "fpga-region"; 421 + #address-cells = <0x1>; 422 + #size-cells = <0x1>; 423 + ranges; 424 + }; 425 + }; 426 + 427 + fpga-bridge@4420 { 428 + compatible = "altr,freeze-bridge-controller"; 429 + reg = <0x4420 0x10>; 430 + 431 + fpga_region2: fpga-region2 { 432 + compatible = "fpga-region"; 433 + #address-cells = <0x1>; 434 + #size-cells = <0x1>; 435 + ranges; 432 436 }; 433 437 }; 434 438 }; ··· 439 451 "partial-fpga-config" boolean and the only bridge that is controlled during 440 452 programming is the FPGA based bridge of fpga_region1. 441 453 442 - /dts-v1/ /plugin/; 443 - / { 444 - fragment@0 { 445 - target = <&fpga_region1>; 446 - #address-cells = <1>; 447 - #size-cells = <1>; 448 - __overlay__ { 449 - #address-cells = <1>; 450 - #size-cells = <1>; 454 + /dts-v1/; 455 + /plugin/; 451 456 452 - firmware-name = "soc_image2.rbf"; 453 - partial-fpga-config; 457 + &fpga_region1 { 458 + #address-cells = <1>; 459 + #size-cells = <1>; 454 460 455 - gpio@10040 { 456 - compatible = "altr,pio-1.0"; 457 - reg = <0x10040 0x20>; 458 - clocks = <0x2>; 459 - altr,ngpio = <0x4>; 460 - #gpio-cells = <0x2>; 461 - gpio-controller; 462 - }; 463 - }; 461 + firmware-name = "soc_image2.rbf"; 462 + partial-fpga-config; 463 + 464 + gpio@10040 { 465 + compatible = "altr,pio-1.0"; 466 + reg = <0x10040 0x20>; 467 + clocks = <0x2>; 468 + altr,ngpio = <0x4>; 469 + #gpio-cells = <0x2>; 470 + gpio-controller; 464 471 }; 465 472 }; 466 473
+6 -4
drivers/fpga/dfl-afu-error.c
··· 52 52 struct dfl_feature_platform_data *pdata = dev_get_platdata(dev); 53 53 struct platform_device *pdev = to_platform_device(dev); 54 54 void __iomem *base_err, *base_hdr; 55 - int ret = -EBUSY; 55 + int enable_ret = 0, ret = -EBUSY; 56 56 u64 v; 57 57 58 58 base_err = dfl_get_feature_ioaddr_by_id(dev, PORT_FEATURE_ID_ERROR); ··· 96 96 v = readq(base_err + PORT_FIRST_ERROR); 97 97 writeq(v, base_err + PORT_FIRST_ERROR); 98 98 } else { 99 + dev_warn(dev, "%s: received 0x%llx, expected 0x%llx\n", 100 + __func__, v, err); 99 101 ret = -EINVAL; 100 102 } 101 103 102 104 /* Clear mask */ 103 105 __afu_port_err_mask(dev, false); 104 106 105 - /* Enable the Port by clear the reset */ 106 - __afu_port_enable(pdev); 107 + /* Enable the Port by clearing the reset */ 108 + enable_ret = __afu_port_enable(pdev); 107 109 108 110 done: 109 111 mutex_unlock(&pdata->lock); 110 - return ret; 112 + return enable_ret ? enable_ret : ret; 111 113 } 112 114 113 115 static ssize_t errors_show(struct device *dev, struct device_attribute *attr,
+24 -11
drivers/fpga/dfl-afu-main.c
··· 21 21 22 22 #include "dfl-afu.h" 23 23 24 + #define RST_POLL_INVL 10 /* us */ 25 + #define RST_POLL_TIMEOUT 1000 /* us */ 26 + 24 27 /** 25 28 * __afu_port_enable - enable a port by clear reset 26 29 * @pdev: port platform device. ··· 35 32 * 36 33 * The caller needs to hold lock for protection. 37 34 */ 38 - void __afu_port_enable(struct platform_device *pdev) 35 + int __afu_port_enable(struct platform_device *pdev) 39 36 { 40 37 struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); 41 38 void __iomem *base; ··· 44 41 WARN_ON(!pdata->disable_count); 45 42 46 43 if (--pdata->disable_count != 0) 47 - return; 44 + return 0; 48 45 49 46 base = dfl_get_feature_ioaddr_by_id(&pdev->dev, PORT_FEATURE_ID_HEADER); 50 47 ··· 52 49 v = readq(base + PORT_HDR_CTRL); 53 50 v &= ~PORT_CTRL_SFTRST; 54 51 writeq(v, base + PORT_HDR_CTRL); 55 - } 56 52 57 - #define RST_POLL_INVL 10 /* us */ 58 - #define RST_POLL_TIMEOUT 1000 /* us */ 53 + /* 54 + * HW clears the ack bit to indicate that the port is fully out 55 + * of reset. 56 + */ 57 + if (readq_poll_timeout(base + PORT_HDR_CTRL, v, 58 + !(v & PORT_CTRL_SFTRST_ACK), 59 + RST_POLL_INVL, RST_POLL_TIMEOUT)) { 60 + dev_err(&pdev->dev, "timeout, failure to enable device\n"); 61 + return -ETIMEDOUT; 62 + } 63 + 64 + return 0; 65 + } 59 66 60 67 /** 61 68 * __afu_port_disable - disable a port by hold reset ··· 99 86 if (readq_poll_timeout(base + PORT_HDR_CTRL, v, 100 87 v & PORT_CTRL_SFTRST_ACK, 101 88 RST_POLL_INVL, RST_POLL_TIMEOUT)) { 102 - dev_err(&pdev->dev, "timeout, fail to reset device\n"); 89 + dev_err(&pdev->dev, "timeout, failure to disable device\n"); 103 90 return -ETIMEDOUT; 104 91 } 105 92 ··· 123 110 int ret; 124 111 125 112 ret = __afu_port_disable(pdev); 126 - if (!ret) 127 - __afu_port_enable(pdev); 113 + if (ret) 114 + return ret; 128 115 129 - return ret; 116 + return __afu_port_enable(pdev); 130 117 } 131 118 132 119 static int port_reset(struct platform_device *pdev) ··· 885 872 static int port_enable_set(struct platform_device *pdev, bool enable) 886 873 { 887 874 struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); 888 - int ret = 0; 875 + int ret; 889 876 890 877 mutex_lock(&pdata->lock); 891 878 if (enable) 892 - __afu_port_enable(pdev); 879 + ret = __afu_port_enable(pdev); 893 880 else 894 881 ret = __afu_port_disable(pdev); 895 882 mutex_unlock(&pdata->lock);
+1 -1
drivers/fpga/dfl-afu.h
··· 80 80 }; 81 81 82 82 /* hold pdata->lock when call __afu_port_enable/disable */ 83 - void __afu_port_enable(struct platform_device *pdev); 83 + int __afu_port_enable(struct platform_device *pdev); 84 84 int __afu_port_disable(struct platform_device *pdev); 85 85 86 86 void afu_mmio_region_init(struct dfl_feature_platform_data *pdata);
+11 -7
drivers/fpga/dfl-pci.c
··· 69 69 } 70 70 71 71 /* PCI Device ID */ 72 - #define PCIE_DEVICE_ID_PF_INT_5_X 0xBCBD 73 - #define PCIE_DEVICE_ID_PF_INT_6_X 0xBCC0 74 - #define PCIE_DEVICE_ID_PF_DSC_1_X 0x09C4 75 - #define PCIE_DEVICE_ID_INTEL_PAC_N3000 0x0B30 72 + #define PCIE_DEVICE_ID_PF_INT_5_X 0xBCBD 73 + #define PCIE_DEVICE_ID_PF_INT_6_X 0xBCC0 74 + #define PCIE_DEVICE_ID_PF_DSC_1_X 0x09C4 75 + #define PCIE_DEVICE_ID_INTEL_PAC_N3000 0x0B30 76 + #define PCIE_DEVICE_ID_INTEL_PAC_D5005 0x0B2B 76 77 /* VF Device */ 77 - #define PCIE_DEVICE_ID_VF_INT_5_X 0xBCBF 78 - #define PCIE_DEVICE_ID_VF_INT_6_X 0xBCC1 79 - #define PCIE_DEVICE_ID_VF_DSC_1_X 0x09C5 78 + #define PCIE_DEVICE_ID_VF_INT_5_X 0xBCBF 79 + #define PCIE_DEVICE_ID_VF_INT_6_X 0xBCC1 80 + #define PCIE_DEVICE_ID_VF_DSC_1_X 0x09C5 81 + #define PCIE_DEVICE_ID_INTEL_PAC_D5005_VF 0x0B2C 80 82 81 83 static struct pci_device_id cci_pcie_id_tbl[] = { 82 84 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PF_INT_5_X),}, ··· 88 86 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PF_DSC_1_X),}, 89 87 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_VF_DSC_1_X),}, 90 88 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_N3000),}, 89 + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_D5005),}, 90 + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_D5005_VF),}, 91 91 {0,} 92 92 }; 93 93 MODULE_DEVICE_TABLE(pci, cci_pcie_id_tbl);