add DFL bus support to MODULE_DEVICE_TABLE()
Subsystems (5)
Xu Yilun
maintainerv12 cover add DFL bus support to MODULE_DEVICE_TABLE()
I added back the first 4 patches for DFL driver autoloading cause there are comments for them and I fixed one place.
Maybe this patchset should be posted together in next pull request, so that maintainers could see the usecase of include/linux/dfl.h
Main changes from v1:
- A new patch (Patch #3) to fix the description.
- Rename the dfl-bus.h to dfl.h
- Updated the MAINTAINERS under FPGA DFL DRIVERS.
- Improve comments and minor fixes.
Main changes from v2:
- Change the bus name from "dfl" to "fpga-dfl", also rename related variables, functions ...
- Changes the data type of fpga_dfl_device_id.type from u8 to u16
- Explicitly defines the values of enum fpga_dfl_id_type
- Delete the comments for the valid bits of type & feature_id
- changes MODALIAS format for fpga dfl devices
Main changes from v3:
- Change the bus name back to "dfl".
- Add 2 patches (#5, 6) for dfl drivers.
- Delete the retimer FEC mode configuration via module_parameter for
Patch #5
- Merge the patch "Make m10_n3000_info static" (https://lore.kernel.org/linux-fpga/[email protected]/T/#t)
into Patch #5
- Add static prefix for emif attributes macro for Patch #6
Main changes from v9:
- Add the description for struct dfl_device_id in mod_devicetable.h
- Move the dfl.h from include/linux/fpga to include/linux
- some code refactor and minor fixes for dfl-n3000-nios
Main changes from v10:
- use sysfs_emit instead of sprintf for both patches
- rebase to 5.10-rc1
Main changes from v11:
- Fix the type of driver_data from unsigned long to kernel_ulong_t
- Fixed up header guards to match filename by Moritz
- move the MODULE_DEVICE_TABLE() right after its definition
Xu Yilun (6):
fpga: dfl: fix the definitions of type & feature_id for dfl devices
fpga: dfl: move dfl_device_id to mod_devicetable.h
fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()
fpga: dfl: move dfl bus related APIs to include/linux/dfl.h
fpga: dfl: add support for N3000 Nios private feature
memory: dfl-emif: add the DFL EMIF private feature driver
.../ABI/testing/sysfs-bus-dfl-devices-emif | 25 + .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios | 47 ++ MAINTAINERS | 3 +- drivers/fpga/Kconfig | 11 + drivers/fpga/Makefile | 2 + drivers/fpga/dfl-n3000-nios.c | 588 +++++++++++++++++++++ drivers/fpga/dfl.c | 4 +- drivers/fpga/dfl.h | 85 +-- drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 2 + drivers/memory/dfl-emif.c | 207 ++++++++ include/linux/dfl.h | 86 +++ include/linux/mod_devicetable.h | 24 + scripts/mod/devicetable-offsets.c | 4 + scripts/mod/file2alias.c | 13 + 15 files changed, 1023 insertions(+), 87 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios create mode 100644 drivers/fpga/dfl-n3000-nios.c create mode 100644 drivers/memory/dfl-emif.c create mode 100644 include/linux/dfl.h
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v12 1/6 fpga: dfl: fix the definitions of type & feature_id for dfl devices
The value of the field dfl_device.type comes from the 12 bits register field DFH_ID according to DFL spec. So this patch changes the definition of the type field to u16.
Also it is not necessary to illustrate the valid bits of the type field in comments. Instead we should explicitly define the possible values in the enumeration type for it, because they are shared by hardware spec. We should not let the compiler decide these values.
Similar changes are also applied to dfl_device.feature_id.
This patch also fixed the MODALIAS format according to the changes above.
---
v9: no change
v10: no change
v11: no change
v12: no change
--- drivers/fpga/dfl.c | 3 +-- drivers/fpga/dfl.h | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/fpga/dfl.c +1 -2
@@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) {struct dfl_device *ddev =to_dfl_dev (dev); -/* The type has 4 valid bits and feature_id has 12 valid bits */ -return add_uevent_var (env,"MODALIAS=dfl:t%01Xf%03X" , +return add_uevent_var (env,"MODALIAS=dfl:t%04Xf%04X" , ddev->type, ddev->feature_id); }
drivers/fpga/dfl.h +7 -7
@@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,* enum dfl_id_type - define the DFL FIU types */ enum dfl_id_type { -FME_ID , -PORT_ID , +FME_ID =0 , +PORT_ID =1 ,DFL_ID_MAX , };/** * struct dfl_device_id - dfl device identifier -* @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. -* @feature_id: contains 12 bits feature identifier local to its DFL FIU type. +* @type: DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: feature identifier local to its DFL FIU type. * @driver_data: driver specific data. */ struct dfl_device_id { -u8 type; +u16 type;u16 feature_id;unsigned long driver_data; };
@@ -543,7 +543,7 @@ struct dfl_device_id {* @dev: generic device interface. * @id: id of the dfl device. * @type: type of DFL FIU of the device. See enum dfl_id_type. -* @feature_id: 16 bits feature identifier local to its DFL FIU type. +* @feature_id: feature identifier local to its DFL FIU type. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device.
@@ -553,7 +553,7 @@ struct dfl_device_id {struct dfl_device {struct device dev;int id; -u8 type; +u16 type;u16 feature_id;struct resource mmio_res;int *irqs;
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v12 2/6 fpga: dfl: move dfl_device_id to mod_devicetable.h
In reply to Xu YilunIn order to support MODULE_DEVICE_TABLE() for dfl device driver, this patch moves struct dfl_device_id to mod_devicetable.h
Some brief description for DFL (Device Feature List) is added to make the DFL known to the whole kernel.
---
v2: fix the order for the header file
v3: rebase the patch for dfl bus name change
v9: rebase the patch for dfl bus name changes back to "dfl"
v10: add some comments to describe what is DFL
v11: no change
v12: fix the type of driver_data from unsigned long to kernel_ulong_t
--- drivers/fpga/dfl.h | 13 +------------ include/linux/mod_devicetable.h | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/fpga/dfl.h +1 -12
@@ -22,6 +22,7 @@#include <linux/interrupt.h> #include <linux/iopoll.h> #include <linux/io-64-nonatomic-lo-hi.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/uuid.h>
@@ -526,18 +527,6 @@ enum dfl_id_type { };/** -* struct dfl_device_id - dfl device identifier -* @type: DFL FIU type of the device. See enum dfl_id_type. -* @feature_id: feature identifier local to its DFL FIU type. -* @driver_data: driver specific data. -*/ -struct dfl_device_id { -u16 type; -u16 feature_id; -unsigned long driver_data; -}; - -/** * struct dfl_device - represent an dfl device on dfl bus * * @dev: generic device interface.
include/linux/mod_devicetable.h +24 -0
@@ -838,4 +838,28 @@ struct mhi_device_id { kernel_ulong_t driver_data; }; +/* +* DFL (Device Feature List) +* +* DFL defines a linked list of feature headers within the device MMIO space to +* provide an extensible way of adding features. Software can walk through these +* predefined data structures to enumerate features. It is now used in the FPGA. +* See Documentation/fpga/dfl.rst for more information. +* +* The dfl bus type is introduced to match the individual feature devices (dfl +* devices) for specific dfl drivers. +*/ + +/** +* struct dfl_device_id - dfl device identifier +* @type: DFL FIU type of the device. See enum dfl_id_type. +* @feature_id: feature identifier local to its DFL FIU type. +* @driver_data: driver specific data. +*/ +struct dfl_device_id { +__u16 type; +__u16 feature_id; +kernel_ulong_t driver_data; +}; +#endif /* LINUX_MOD_DEVICETABLE_H */
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v12 3/6 fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()
In reply to Xu YilunDevice Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub features within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.
A dfl bus helps DFL framework modularize DFL device drivers for different sub features. The dfl bus matches its devices and drivers by DFL type and feature id.
This patch adds dfl bus support to MODULE_DEVICE_TABLE() by adding info about struct dfl_device_id in devicetable-offsets.c and add a dfl entry point in file2alias.c.
---
v2: add comments for the format of modalias
v3: changes the names from dfl_XXX to fpga_dfl_XXX
delete the comments of valid bits for modalias format
v9: rebase the patch for bus name changes back to "dfl"
v10: no change
v11: no change
v12: no change
--- scripts/mod/devicetable-offsets.c | 4 ++++ scripts/mod/file2alias.c | 13 +++++++++++++ 2 files changed, 17 insertions(+)
scripts/mod/devicetable-offsets.c +4 -0
@@ -243,5 +243,9 @@ int main(void)DEVID (mhi_device_id);DEVID_FIELD (mhi_device_id, chan); +DEVID (dfl_device_id); +DEVID_FIELD (dfl_device_id, type); +DEVID_FIELD (dfl_device_id, feature_id); +return 0 ; }
scripts/mod/file2alias.c +13 -0
@@ -1368,6 +1368,18 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)return 1 ; } +/* Looks like: dfl:tNfN */ +static int do_dfl_entry (const char *filename,void *symval,char *alias) +{ +DEF_FIELD (symval, dfl_device_id, type); +DEF_FIELD (symval, dfl_device_id, feature_id); + +sprintf (alias,"dfl:t%04Xf%04X" , type, feature_id); + +add_wildcard (alias); +return 1 ; +} +/* Does namelen bytes of name exactly match the symbol? */ static bool sym_is (const char *name,unsigned namelen,const char *symbol) {
@@ -1442,6 +1454,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, + {"dfl", SIZE_dfl_device_id, do_dfl_entry}, };/* Create MODULE_ALIAS() statements.
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v12 4/6 fpga: dfl: move dfl bus related APIs to include/linux/dfl.h
In reply to Xu YilunNow the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.
---
v2: updated the MAINTAINERS under FPGA DFL DRIVERS
improve the comments
rename the dfl-bus.h to dfl.h
v3: rebase the patch for previous changes
v9: rebase the patch for bus name changes back to "dfl"
v10: move the head file from inlude/linux/fpga to include/linux
v11: no change
v12: Fixed up header guards to match filename by Moritz
--- MAINTAINERS | 1 + drivers/fpga/dfl.c | 1 + drivers/fpga/dfl.h | 72 -------------------------------------------- include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 72 deletions(-) create mode 100644 include/linux/dfl.h
MAINTAINERS +1 -0
@@ -6886,6 +6886,7 @@ S: Maintained F: Documentation/ABI/testing/sysfs-bus-dfl F: Documentation/fpga/dfl.rst F: drivers/fpga/dfl* +F: include/linux/dfl.h F: include/uapi/linux/fpga-dfl.h FPGA MANAGER FRAMEWORK
drivers/fpga/dfl.c +1 -0
@@ -10,6 +10,7 @@* Wu Hao <[email protected]> * Xiao Guangrong <[email protected]> */ +#include <linux/dfl.h> #include <linux/fpga-dfl.h> #include <linux/module.h> #include <linux/uaccess.h>
drivers/fpga/dfl.h +0 -72
76 lines not on this page · raw message
include/linux/dfl.h new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.7.4
Xu Yilun
maintainerPATCH v12 5/6 fpga: dfl: add support for N3000 Nios private feature
In reply to Xu YilunThis patch adds support for the Nios handshake private feature on Intel PAC (Programmable Acceleration Card) N3000.
The Nios is the embedded processor on the FPGA card. This private feature provides a handshake interface to FPGA Nios firmware, which receives retimer configuration command from host and executes via an internal SPI master (spi-altera). When Nios finishes the configuration, host takes over the ownership of the SPI master to control an Intel MAX10 BMC (Board Management Controller) Chip on the SPI bus.
For Nios firmware handshake part, this driver requests the retimer configuration for Nios firmware on probe, and adds some sysfs nodes for user to query the onboard retimer's working mode and Nios firmware version.
For SPI part, this driver adds a spi-altera platform device as well as the MAX10 BMC spi slave info. A spi-altera driver will be matched to handle the following SPI work.
---
v3: add the doc for this driver
minor fixes for comments from Tom
v4: move the err log in regmap implementation, and delete
n3000_nios_writel/readl(), they have nothing to wrapper now.
some minor fixes and comments improvement.
v5: fix the output of fec_mode sysfs inf to "no" on 10G configuration,
cause no FEC mode could be configured for 10G.
rename the dfl_n3000_nios_* to n3000_nios_*
improves comments.
v6: fix the output of fec_mode sysfs inf to "not supported" if in 10G,
or the firmware version major < 3.
minor fixes and improves comments.
v7: improves comments.
v8: add sysfs interfaces for retimer mode, also doc update.
delete duplicated sysfs interfaces description in doc.
minor fixes.
v9: delete the retimer FEC mode configuration via module_parameter.
update the kernel version of the sysfs interfaces in Doc.
merge the patch "Make m10_n3000_info static" (https://lore.kernel.org/linux-fpga/[email protected]/T/#t)
remove the tags of Maintainers, this implementation is changed.
v10: improve the name of some macros, functions and variables.
refactor the FEC mode setting and reading.
refactor the retimer init error checking and dumping.
refactor the loop timeout for regbus reading & write.
some minor fixes.
v11: use sysfs_emit instead of sprintf.
rebase to 5.10-rc1. v12: move the MODULE_DEVICE_TABLE() right after its definition. --- .../ABI/testing/sysfs-bus-dfl-devices-n3000-nios | 47 ++ MAINTAINERS | 2 +- drivers/fpga/Kconfig | 11 + drivers/fpga/Makefile | 2 + drivers/fpga/dfl-n3000-nios.c | 588 +++++++++++++++++++++ 5 files changed, 649 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios create mode 100644 drivers/fpga/dfl-n3000-nios.c
Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios new file +47 -0
@@ -0,0 +1,47 @@ +What: /sys/bus/dfl/devices/dfl_dev.X/fec_mode +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. Returns the FEC mode of the 25G links of the + ethernet retimers configured by Nios firmware. "rs" for Reed + Solomon FEC, "kr" for Fire Code FEC, "no" for NO FEC. + "not supported" if the FEC mode setting is not supported, this + happens when the Nios firmware version major < 3, or no link is + configured to 25G. + Format: string + +What: /sys/bus/dfl/devices/dfl_dev.X/retimer_A_mode +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. Returns the enumeration value of the working mode of + the retimer A configured by the Nios firmware. The value is + read out from shared registers filled by the Nios firmware. Now + the values could be: + + - "0": Reset + - "1": 4x10G + - "2": 4x25G + - "3": 2x25G + - "4": 2x25G+2x10G + - "5": 1x25G + + If the Nios firmware is updated in future to support more + retimer modes, more enumeration value is expected. + Format: 0x%x + +What: /sys/bus/dfl/devices/dfl_dev.X/retimer_B_mode +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. Returns the enumeration value of the working mode of + the retimer B configured by the Nios firmware. The value format + is the same as retimer_A_mode. + +What: /sys/bus/dfl/devices/dfl_dev.X/nios_fw_version +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. Returns the version of the Nios firmware in the + FPGA. Its format is "major.minor.patch". + Format: %x.%x.%x
MAINTAINERS +1 -1
@@ -6883,7 +6883,7 @@ M: Wu Hao <[email protected]> R: Tom Rix <[email protected]> L: [email protected] S: Maintained -F: Documentation/ABI/testing/sysfs-bus-dfl +F: Documentation/ABI/testing/sysfs-bus-dfl* F: Documentation/fpga/dfl.rst F: drivers/fpga/dfl* F: include/linux/dfl.h
drivers/fpga/Kconfig +11 -0
@@ -191,6 +191,17 @@ config FPGA_DFL_AFU to the FPGA infrastructure via a Port. There may be more than one Port/AFU per DFL based FPGA device. +config FPGA_DFL_NIOS_INTEL_PAC_N3000 + tristate "FPGA DFL NIOS Driver for Intel PAC N3000" + depends on FPGA_DFL + select REGMAP + help + This is the driver for the N3000 Nios private feature on Intel + PAC (Programmable Acceleration Card) N3000. It communicates + with the embedded Nios processor to configure the retimers on + the card. It also instantiates the SPI master (spi-altera) for + the card's BMC (Board Management Controller). + config FPGA_DFL_PCI tristate "FPGA DFL PCIe Device Driver" depends on PCI && FPGA_DFL
drivers/fpga/Makefile +2 -0
@@ -44,5 +44,7 @@ dfl-fme-objs += dfl-fme-perf.o dfl-afu-objs := dfl-afu-main.o dfl-afu-region.o dfl-afu-dma-region.o dfl-afu-objs += dfl-afu-error.o +obj-$(CONFIG_FPGA_DFL_NIOS_INTEL_PAC_N3000) += dfl-n3000-nios.o + # Drivers for FPGAs which implement DFL obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o
drivers/fpga/dfl-n3000-nios.c new file +588 -0
588 lines not on this page · raw message
Signature · 1 line
2.7.4
kernel test robot
build botRe: [PATCH v12 5/6] fpga: dfl: add support for N3000 Nios private feature
Thank you for the patch! Perhaps something to improve:
Hi Xu,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc3]
[cannot apply to next-20201110]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Xu-Yilun/add-DFL-bus-support-to-MODULE_DEVICE_TABLE/20201106-141738 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 521b619acdc8f1f5acdac15b84f81fd9515b2aff config: x86_64-randconfig-a013-20201109 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 09ec07827b1128504457a93dee80b2ceee1af600)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/dc31f5e201083949c84c6b460e4ec00f6fabaecd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xu-Yilun/add-DFL-bus-support-to-MODULE_DEVICE_TABLE/20201106-141738 git checkout dc31f5e201083949c84c6b460e4ec00f6fabaecd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/fpga/dfl-n3000-nios.c:338:35: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
if (val & (N3000_NIOS_INIT_DONE || N3000_NIOS_INIT_START))
^ ~~~~~~~~~~~~~~~~~~~~~
drivers/fpga/dfl-n3000-nios.c:338:35: note: use '|' for a bitwise operation
if (val & (N3000_NIOS_INIT_DONE || N3000_NIOS_INIT_START))
^~
|1 warning generated.
vim +338 drivers/fpga/dfl-n3000-nios.c
295
296 static int n3000_nios_init_done_check(struct n3000_nios *nn)
297 {
298 unsigned int val, state_a, state_b;
299 struct device *dev = nn->dev;
300 int ret, ret2;
301
302 /*
303 * The SPI is shared by the Nios core inside the FPGA, Nios will use
304 * this SPI master to do some one time initialization after power up,
305 * and then release the control to OS. The driver needs to poll on
306 * INIT_DONE to see when driver could take the control.
307 *
308 * Please note that after Nios firmware version 3.0.0, INIT_START is
309 * introduced, so driver needs to trigger START firstly and then check
310 * INIT_DONE.
311 */
312
313 ret = regmap_read(nn->regmap, N3000_NIOS_FW_VERSION, &val);
314 if (ret)
315 return ret;
316
317 /*
318 * If Nios version register is totally uninitialized(== 0x0), then the
319 * Nios firmware is missing. So host could take control of SPI master
320 * safely, but initialization work for Nios is not done. To restore the
321 * card, we need to reprogram a new Nios firmware via the BMC chip on
322 * SPI bus. So the driver doesn't error out, it continues to create the
323 * spi controller device and spi_board_info for BMC.
324 */
325 if (val == 0) {
326 dev_err(dev, "Nios version reg = 0x%x, skip INIT_DONE check, but the retimer may be uninitialized\n",
327 val);
328 return 0;
329 }
330
331 if (FIELD_GET(N3000_NIOS_FW_VERSION_MAJOR, val) >= 3) {
332 /* read NIOS_INIT to check if retimer initialization is done */
333 ret = regmap_read(nn->regmap, N3000_NIOS_INIT, &val);
334 if (ret)
335 return ret;
336
337 /* check if retimers are initialized already */
> 338 if (val & (N3000_NIOS_INIT_DONE || N3000_NIOS_INIT_START)) 339 goto nios_init_done; 340 341 /* configure FEC mode per module param */ 342 val = N3000_NIOS_INIT_START; 343 344 /* 345 * When the retimer is to be set to 10G mode, there is no FEC 346 * mode setting, so the REQ_FEC_MODE field will be ignored by 347 * Nios firmware in this case. But we should still fill the FEC 348 * mode field cause host could not get the retimer working mode 349 * until the Nios init is done. 350 * 351 * For now the driver doesn't support the retimer FEC mode 352 * switching per user's request. It is always set to Reed 353 * Solomon FEC. 354 * 355 * The driver will set the same FEC mode for all links. 356 */ 357 val |= N3000_NIOS_INIT_REQ_FEC_MODE_RS_ALL; 358 359 ret = regmap_write(nn->regmap, N3000_NIOS_INIT, val); 360 if (ret) 361 return ret; 362 } 363 364 nios_init_done: 365 /* polls on NIOS_INIT_DONE */ 366 ret = regmap_read_poll_timeout(nn->regmap, N3000_NIOS_INIT, val, 367 val & N3000_NIOS_INIT_DONE, 368 N3000_NIOS_INIT_TIME_INTV, 369 N3000_NIOS_INIT_TIMEOUT);
370 if (ret)
371 dev_err(dev, "NIOS_INIT_DONE %s\n",
372 (ret == -ETIMEDOUT) ? "timed out" : "check error");
373
374 ret2 = regmap_read(nn->regmap, N3000_NIOS_PKVL_A_MODE_STS, &state_a);
375 if (ret2)
376 return ret2;
377
378 ret2 = regmap_read(nn->regmap, N3000_NIOS_PKVL_B_MODE_STS, &state_b);
379 if (ret2)
380 return ret2;
381
382 if (!ret) {
383 /*
384 * After INIT_DONE is detected, it still needs to check if the
385 * Nios firmware reports any error during the retimer
386 * configuration.
387 */
388 if (IS_MODE_STATUS_OK(state_a) && IS_MODE_STATUS_OK(state_b))
389 return 0;
390
391 /*
392 * If the retimer configuration is failed, the Nios firmware
393 * will still release the spi controller for host to
394 * communicate with the BMC. It makes possible for people to
395 * reprogram a new Nios firmware and restore the card. So the
396 * driver doesn't error out, it continues to create the spi
397 * controller device and spi_board_info for BMC.
398 */
399 dev_err(dev, "NIOS_INIT_DONE OK, but err on retimer init\n");
400 }
401
402 dev_err(nn->dev, "PKVL_A_MODE_STS 0x%x\n", state_a);
403 dev_err(nn->dev, "PKVL_B_MODE_STS 0x%x\n", state_b);
404
405 return ret;
406 }
407
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Xu Yilun
maintainerPATCH v12 6/6 memory: dfl-emif: add the DFL EMIF private feature driver
In reply to Xu YilunThis driver is for the EMIF private feature implemented under FPGA Device Feature List (DFL) framework. It is used to expose memory interface status information as well as memory clearing control.
The purpose of memory clearing block is to zero out all private memory when FPGA is to be reprogrammed. This gives users a reliable method to prevent potential data leakage.
---
v2: Adjust the position of this driver in Kconfig.
Improves the name of the Kconfig option.
Change the include dfl-bus.h to dfl.h, cause the previous patchset
renames the file.
Some minor fixes and comment improvement.
v3: Adjust the position of the driver in Makefile.
v9: Add static prefix for emif attributes macro.
Update the kernel version of the sysfs interfaces in Doc.
v10: Rebase due to the dfl head file moves to include/linux.
v11: Use sysfs_emit instead of sprintf.
Rebase to rebase to 5.10-rc1.
v12: no change.
--- .../ABI/testing/sysfs-bus-dfl-devices-emif | 25 +++ drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 2 + drivers/memory/dfl-emif.c | 207 +++++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif create mode 100644 drivers/memory/dfl-emif.c
Documentation/ABI/testing/sysfs-bus-dfl-devices-emif new file +25 -0
@@ -0,0 +1,25 @@ +What: /sys/bus/dfl/devices/dfl_dev.X/infX_cal_fail +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. It indicates if the calibration failed on this + memory interface. "1" for calibration failure, "0" for OK. + Format: %u + +What: /sys/bus/dfl/devices/dfl_dev.X/infX_init_done +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Read-only. It indicates if the initialization completed on + this memory interface. "1" for initialization complete, "0" + for not yet. + Format: %u + +What: /sys/bus/dfl/devices/dfl_dev.X/infX_clear +Date: Oct 2020 +KernelVersion: 5.11 +Contact: Xu Yilun <[email protected]> +Description: Write-only. Writing "1" to this file will zero out all memory + data in this memory interface. Writing of other values is + invalid. + Format: %u
drivers/memory/Kconfig +9 -0
@@ -137,6 +137,15 @@ config TI_EMIF_SRAM sequence so this driver provides several relocatable PM functions for the SoC PM code to use. +config FPGA_DFL_EMIF + tristate "FPGA DFL EMIF Driver" + depends on FPGA_DFL && HAS_IOMEM + help + This driver is for the EMIF private feature implemented under + FPGA Device Feature List (DFL) framework. It is used to expose + memory interface status information as well as memory clearing + control. + config MVEBU_DEVBUS bool "Marvell EBU Device Bus Controller" default y if PLAT_ORION
drivers/memory/Makefile +2 -0
@@ -28,6 +28,8 @@ obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o obj-$(CONFIG_SAMSUNG_MC) += samsung/ obj-$(CONFIG_TEGRA_MC) += tegra/ obj-$(CONFIG_TI_EMIF_SRAM) += ti-emif-sram.o +obj-$(CONFIG_FPGA_DFL_EMIF) += dfl-emif.o + ti-emif-sram-objs := ti-emif-pm.o ti-emif-sram-pm.o AFLAGS_ti-emif-sram-pm.o :=-Wa,-march=armv7-a
drivers/memory/dfl-emif.c new file +207 -0
207 lines not on this page · raw message
Signature · 1 line
2.7.4