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

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

Moritz writes:

FPGA Manager changes for 5.15-rc1

FPGA Manager

- Colin's change is a simple spelling cleanup.

DFL

- Martin's fist change exposes DFL feature revision to client drivers
- Martin's second change modifies a SPI driver to populate different
spi_board_info modaliases based on the DFL feature revision

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

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

* tag 'fpga-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga:
spi: spi-altera-dfl: support n5010 feature revision
fpga: dfl: expose feature revision from struct dfl_device
fpga: Fix spelling mistake "eXchnage" -> "exchange" in Kconfig

+32 -20
+1 -1
drivers/fpga/Kconfig
··· 119 119 depends on HAS_IOMEM 120 120 help 121 121 Say Y to enable drivers for Xilinx LogiCORE PR Decoupler 122 - or Xilinx Dynamic Function eXchnage AIX Shutdown Manager. 122 + or Xilinx Dynamic Function eXchange AIX Shutdown Manager. 123 123 The PR Decoupler exists in the FPGA fabric to isolate one 124 124 region of the FPGA from the busses while that region is 125 125 being reprogrammed during partial reconfig.
+17 -10
drivers/fpga/dfl.c
··· 381 381 382 382 ddev->type = feature_dev_id_type(pdev); 383 383 ddev->feature_id = feature->id; 384 + ddev->revision = feature->revision; 384 385 ddev->cdev = pdata->dfl_cdev; 385 386 386 387 /* add mmio resource */ ··· 718 717 */ 719 718 struct dfl_feature_info { 720 719 u16 fid; 720 + u8 revision; 721 721 struct resource mmio_res; 722 722 void __iomem *ioaddr; 723 723 struct list_head node; ··· 798 796 /* save resource information for each feature */ 799 797 feature->dev = fdev; 800 798 feature->id = finfo->fid; 799 + feature->revision = finfo->revision; 801 800 802 801 /* 803 802 * the FIU header feature has some fundamental functions (sriov ··· 913 910 devm_kfree(binfo->dev, binfo); 914 911 } 915 912 916 - static inline u32 feature_size(void __iomem *start) 913 + static inline u32 feature_size(u64 value) 917 914 { 918 - u64 v = readq(start + DFH); 919 - u32 ofst = FIELD_GET(DFH_NEXT_HDR_OFST, v); 915 + u32 ofst = FIELD_GET(DFH_NEXT_HDR_OFST, value); 920 916 /* workaround for private features with invalid size, use 4K instead */ 921 917 return ofst ? ofst : 4096; 922 918 } 923 919 924 - static u16 feature_id(void __iomem *start) 920 + static u16 feature_id(u64 value) 925 921 { 926 - u64 v = readq(start + DFH); 927 - u16 id = FIELD_GET(DFH_ID, v); 928 - u8 type = FIELD_GET(DFH_TYPE, v); 922 + u16 id = FIELD_GET(DFH_ID, value); 923 + u8 type = FIELD_GET(DFH_TYPE, value); 929 924 930 925 if (type == DFH_TYPE_FIU) 931 926 return FEATURE_ID_FIU_HEADER; ··· 1022 1021 unsigned int irq_base, nr_irqs; 1023 1022 struct dfl_feature_info *finfo; 1024 1023 int ret; 1024 + u8 revision; 1025 + u64 v; 1026 + 1027 + v = readq(binfo->ioaddr + ofst); 1028 + revision = FIELD_GET(DFH_REVISION, v); 1025 1029 1026 1030 /* read feature size and id if inputs are invalid */ 1027 - size = size ? size : feature_size(binfo->ioaddr + ofst); 1028 - fid = fid ? fid : feature_id(binfo->ioaddr + ofst); 1031 + size = size ? size : feature_size(v); 1032 + fid = fid ? fid : feature_id(v); 1029 1033 1030 1034 if (binfo->len - ofst < size) 1031 1035 return -EINVAL; ··· 1044 1038 return -ENOMEM; 1045 1039 1046 1040 finfo->fid = fid; 1041 + finfo->revision = revision; 1047 1042 finfo->mmio_res.start = binfo->start + ofst; 1048 1043 finfo->mmio_res.end = finfo->mmio_res.start + size - 1; 1049 1044 finfo->mmio_res.flags = IORESOURCE_MEM; ··· 1173 1166 { 1174 1167 if (!is_feature_dev_detected(binfo)) { 1175 1168 dev_err(binfo->dev, "the private feature 0x%x does not belong to any AFU.\n", 1176 - feature_id(binfo->ioaddr + ofst)); 1169 + feature_id(readq(binfo->ioaddr + ofst))); 1177 1170 return -EINVAL; 1178 1171 } 1179 1172
+1
drivers/fpga/dfl.h
··· 243 243 struct dfl_feature { 244 244 struct platform_device *dev; 245 245 u16 id; 246 + u8 revision; 246 247 int resource_index; 247 248 void __iomem *ioaddr; 248 249 struct dfl_feature_irq_ctx *irq_ctx;
+12 -9
drivers/spi/spi-altera-dfl.c
··· 104 104 .reg_read = indirect_bus_reg_read, 105 105 }; 106 106 107 - static struct spi_board_info m10_bmc_info = { 108 - .modalias = "m10-d5005", 109 - .max_speed_hz = 12500000, 110 - .bus_num = 0, 111 - .chip_select = 0, 112 - }; 113 - 114 107 static void config_spi_master(void __iomem *base, struct spi_master *master) 115 108 { 116 109 u64 v; ··· 123 130 124 131 static int dfl_spi_altera_probe(struct dfl_device *dfl_dev) 125 132 { 133 + struct spi_board_info board_info = { 0 }; 126 134 struct device *dev = &dfl_dev->dev; 127 135 struct spi_master *master; 128 136 struct altera_spi *hw; ··· 164 170 goto exit; 165 171 } 166 172 167 - if (!spi_new_device(master, &m10_bmc_info)) { 173 + if (dfl_dev->revision == FME_FEATURE_REV_MAX10_SPI_N5010) 174 + strscpy(board_info.modalias, "m10-n5010", SPI_NAME_SIZE); 175 + else 176 + strscpy(board_info.modalias, "m10-d5005", SPI_NAME_SIZE); 177 + 178 + board_info.max_speed_hz = 12500000; 179 + board_info.bus_num = 0; 180 + board_info.chip_select = 0; 181 + 182 + if (!spi_new_device(master, &board_info)) { 168 183 dev_err(dev, "%s failed to create SPI device: %s\n", 169 - __func__, m10_bmc_info.modalias); 184 + __func__, board_info.modalias); 170 185 } 171 186 172 187 return 0;
+1
include/linux/dfl.h
··· 38 38 int id; 39 39 u16 type; 40 40 u16 feature_id; 41 + u8 revision; 41 42 struct resource mmio_res; 42 43 int *irqs; 43 44 unsigned int num_irqs;