On Tue, Oct 27, 2020 at 05:23:00PM +0800, Xu Yilun wrote:
> This 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.
> 
> [[email protected]: Fixed up MAINTAINERS file to include added ABI doc]
> Signed-off-by: Xu Yilun <[email protected]>
> Signed-off-by: Wu Hao <[email protected]>
> Signed-off-by: Matthew Gerlach <[email protected]>
> Signed-off-by: Russ Weight <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> Reviewed-by: Tom Rix <[email protected]>
> ---
> 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.
> ---
>  .../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
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios 
> b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
> new file mode 100644
> index 0000000..a505537
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-dfl-devices-n3000-nios
> @@ -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
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9bbb378..bedb18d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -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
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index 7cd5a29..5d7f0ae 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -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).
> +

(...)

> +{
> +     struct n3000_nios *nn = dev_get_drvdata(&ddev->dev);
> +
> +     destroy_altera_spi_controller(nn);
> +}
> +
> +#define FME_FEATURE_ID_N3000_NIOS    0xd
> +
> +static const struct dfl_device_id n3000_nios_ids[] = {
> +     { FME_ID, FME_FEATURE_ID_N3000_NIOS },
> +     { }
> +};

Why isn't here a module device table?

Best regards,
Krzysztof

> +
> +static struct dfl_driver n3000_nios_driver = {
> +     .drv    = {
> +             .name       = "dfl-n3000-nios",
> +             .dev_groups = n3000_nios_groups,
> +     },
> +     .id_table = n3000_nios_ids,
> +     .probe   = n3000_nios_probe,
> +     .remove  = n3000_nios_remove,
> +};
> +
> +module_dfl_driver(n3000_nios_driver);
> +
> +MODULE_DEVICE_TABLE(dfl, n3000_nios_ids);
> +MODULE_DESCRIPTION("Driver for Nios private feature on Intel PAC N3000");
> +MODULE_AUTHOR("Intel Corporation");
> +MODULE_LICENSE("GPL v2");
> -- 
> 2.7.4
> 

Reply via email to