NPU驱动集成手册

一、DTS配置

        1)、找到kernel/arch/arm64/boot/dts/tsingmicro/ts-tx536-evb.dts

        2)、添加如下配置:

npu_misc: npu_misc {

    compatible = "npu,misc";

    npu-interrupt = <&porta 42 GPIO_ACTIVE_LOW>;@戴臻辉 找Soc

    reg = <0x0 0xff800000 0x0 0x100000>;

    reg = <0x0 0xF0200000 0x0 0x100000>;

};

        3)、修改中断引脚 npu-interrupt = <&porta 42 GPIO_ACTIVE_LOW>;

        4)、修改NPU_CTR_BASE对应的物理地址reg = <0x0 0xff800000 0x0 0x100000>;

        5)、修改CPU_DMA_BASE对应的物理地址reg = <0x0 0xF0200000 0x0 0x100000>;

二、集成NPU驱动

        1)、将npu.c和ctr_param_addr.h复制到kernel/drivers/misc/目录下

        2)、修改kernel/drivers/misc/Makefile,增加如下内容:

obj-$(CONFIG_NPU_DRIVER) += npu.o

        3)、修改kernel/drivers/misc/Kconfig,增加如下内容:

config NPU_DRIVER

    tristate "NPU driver"

    ---help---

        Enable this configuration option to enable the npu driver.

        4)、修改kernel/arch/arm64/configs/ts_tx536_evb_emmc_defconfig,增加如下内容:

CONFIG_NPU_DRIVER=y

        5)、修改kernel/include/linux/device.h,增加如下内容:

#define DEVICE_ATTR(_name, _mode, _show, _store) \

        struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)

        6)、修改uboot/include/configs/ts4600.h文件

                将"setenv cmdline_append console=ttyAMA0,115200;" \修改为

"setenv cmdline_append console=ttyAMA0,115200; npu-bootmem=y;" \

三、验证

        系统起来之后通过cat /proc/cmdline查看是否添加成功。

posted @ 2022-11-26 09:55  Coder个人博客  阅读(252)  评论(0)    收藏  举报  来源