Re: [PATCH v2 4/9] accel/neutron: Add driver for NXP Neutron NPU

From: Krzysztof Kozlowski

Date: Fri Mar 06 2026 - 09:27:32 EST


On 06/03/2026 14:27, Ioana Ciocoi-Radulescu wrote:
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8a5b27b061da..f7a687eb6b54 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -19191,6 +19191,16 @@ S: Orphan
> F: Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml
> F: drivers/nfc/nxp-nci
>
> +NXP Neutron NPU DRIVER

s/Neutron/NEUTRON/ as everything here is in uppercase

> +M: Ioana Ciocoi Radulescu <ruxandra.radulescu@xxxxxxx>
> +M: Jiwei Fu <jiwei.fu@xxxxxxx>
> +L: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> +S: Maintained
> +T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
> +F: Documentation/accel/neutron/
> +F: drivers/accel/neutron/
> +F: include/uapi/drm/neutron_accel.h


>
> diff --git a/drivers/accel/Makefile b/drivers/accel/Makefile
> index 1d3a7251b950..698136e12cce 100644
> --- a/drivers/accel/Makefile
> +++ b/drivers/accel/Makefile
> @@ -4,5 +4,6 @@ obj-$(CONFIG_DRM_ACCEL_AMDXDNA) += amdxdna/
> obj-$(CONFIG_DRM_ACCEL_ARM_ETHOSU) += ethosu/
> obj-$(CONFIG_DRM_ACCEL_HABANALABS) += habanalabs/
> obj-$(CONFIG_DRM_ACCEL_IVPU) += ivpu/
> +obj-$(CONFIG_DRM_ACCEL_NXP_NEUTRON) += neutron/
> obj-$(CONFIG_DRM_ACCEL_QAIC) += qaic/
> -obj-$(CONFIG_DRM_ACCEL_ROCKET) += rocket/
> \ No newline at end of file

You still have patch warnings.

> +obj-$(CONFIG_DRM_ACCEL_ROCKET) += rocket/
> diff --git a/drivers/accel/neutron/Kconfig b/drivers/accel/neutron/Kconfig
> new file mode 100644
> index 000000000000..37b8ecb49804
> --- /dev/null
> +++ b/drivers/accel/neutron/Kconfig
> @@ -0,0 +1,16 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +
> +config DRM_ACCEL_NXP_NEUTRON
> + tristate "NXP Neutron NPU"
> + depends on HAS_IOMEM
> + depends on DRM_ACCEL
> + depends on ARCH_MXC

Missing compile test

> + select DRM_GEM_DMA_HELPER
> + select DRM_SCHED
> + help
> + Enables driver for NXP Neutron NPU.
> +
> + Select this if you have an NXP SoC with Neutron, like i.MX95,
> + and want to run machine learning applications.
> +
> + If built as module, the module is named neutron.

...

> +
> + ret = devm_request_threaded_irq(dev, ndev->irq, NULL,
> + neutron_irq_handler_thread,
> + IRQF_ONESHOT, KBUILD_MODNAME, ndev);
> + if (ret) {
> + dev_err(dev, "Failed to request irq %d\n", ndev->irq);

Drop, not needed.

> + return ret;
> + }
> +
> + ret = of_reserved_mem_device_init(&pdev->dev);
> + if (ret) {
> + dev_err(dev, "Failed to initialize reserved memory\n");
> + return ret;
> + }
> +
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + goto free_reserved;
> +
> + pm_runtime_set_autosuspend_delay(dev, NEUTRON_SUSPEND_DELAY_MS);
> + pm_runtime_use_autosuspend(dev);
> +
> + ret = drm_dev_register(&ndev->base, 0);
> + if (ret)
> + goto free_reserved;
> +
> + return 0;
> +
> +free_reserved:
> + of_reserved_mem_device_release(&pdev->dev);
> +
> + return ret;
> +}
> +
> +static void neutron_remove(struct platform_device *pdev)
> +{
> + struct neutron_device *ndev = platform_get_drvdata(pdev);
> +
> + drm_dev_unregister(&ndev->base);
> + of_reserved_mem_device_release(&pdev->dev);
> +}
> +
> +static int neutron_runtime_suspend(struct device *dev)
> +{
> + struct neutron_device *ndev = dev_get_drvdata(dev);
> +
> + neutron_disable_irq(ndev);
> + neutron_shutdown(ndev);
> +
> + clk_bulk_disable_unprepare(ndev->num_clks, ndev->clks);
> +
> + return 0;
> +}
> +
> +static int neutron_runtime_resume(struct device *dev)
> +{
> + struct neutron_device *ndev = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = clk_bulk_prepare_enable(ndev->num_clks, ndev->clks);
> + if (ret)
> + return ret;
> +
> + ret = neutron_boot(ndev);
> + if (ret) {
> + clk_bulk_disable_unprepare(ndev->num_clks, ndev->clks);
> + return ret;
> + }
> +
> + neutron_enable_irq(ndev);
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops neutron_pm_ops = {
> + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> + RUNTIME_PM_OPS(neutron_runtime_suspend, neutron_runtime_resume, NULL)
> +};
> +
> +static const struct of_device_id neutron_match_table[] = {
> + { .compatible = "nxp,imx95-neutron" },
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, neutron_match_table);
> +
> +static struct platform_driver neutron_driver = {
> + .probe = &neutron_probe,
> + .remove = &neutron_remove,
> + .driver = {
> + .name = "neutron",
> + .of_match_table = of_match_ptr(neutron_match_table),

Drop of_match_ptr. You will have (or you have already same as v1) here
warning.

> + .pm = pm_ptr(&neutron_pm_ops),
> + },
> +};
Best regards,
Krzysztof