1. 硬件配置 打开核心板原理图,配置ETHERNET_RST,ETHERNET_EN,ENIT7,SPI_MISO,SPI_CS,SPI_MOSI,SPI_SCK,打开 vendor\mediatek\proprietary\scripts\dct\DrvGen.exe 工具选择 (1)vendor\mediatek\proprietary\bootable\bootloader\lk\target\tb8788p1_64_bsp\dct\dct\codegen.dws (2)kernel-4.4\drivers\misc\mediatek\dws\mt6771\tb8788p1_64_bsp.dws 配置操作如图所示:
上面的SPI模式如果没有配置的话,设备ID是读不到的,下图是我忘记配SPI模式抓的log
2. sensor 驱动移植 2.1 添加以太网驱动文件(dm9051) 将dm9051驱动文件夹添加到ethernet目录中 路径: kernel-4.4/drivers/net/ethernet/dm9051/
添加驱动文件后,添加修改配置文件 路径: kernel-4.4/drivers/net/ethernet/Kconfig - source "drivers/net/ethernet/dm9051/Kconfig"
复制代码路径: kernel-4.4/drivers/net/ethernet/Makefile - obj-$(CONFIG_DM9051) += dm9051/
复制代码2.2 修改配置文件 (1) 路径: kernel-4.4/arch/arm64/boot/dts/mediatek/mt6771.dts,在该目录下添加代码
- dm9051:dm9051{
- compatible = "mediatek,dm9051";
- };
复制代码(2) 路径: kernel-4.4/arch/arm64/boot/dts/mediatek/tb8788p1_64_bsp.dts,在该目录下添加代码 - &dm9051 {
- gpio-power = <&pio 72 0x0>;
- gpio-rst-dm9051 = <&pio 73 0x0>;
- interrupt-parent = <&pio>;
- interrupts = <7 IRQ_TYPE_LEVEL_HIGH 7 0>;
- deb-gpios = <&pio 7 0>;
- debounce = <1000>;
- };
复制代码- &spi0 {
- #address-cells = <1>;
- #size-cells = <0>;
- fingerprint@0 {
- compatible = "goodix,goodix-fp";
- reg = <0>;
- spi-max-frequency = <8000000>;
- netlink-event = <30>;
- status = "disabled";
- };
- ethernet_dm9051:ethernet_dm9051@1 {
- compatible = "davicom,dm9051";
- reg = <0>;
- spi-max-frequency = <20000000>;
- netlink-event = <30>;
- status ="okay";
- };
- };
复制代码(3) 路径: kernel-4.4/arch/arm64/configs/tb8788p1_64_bsp_defconfig,在该目录下添加代码 - #ethernet start
- CONFIG_DM9051=y
- CONFIG_ETHERNET=y
- CONFIG_SECTION_MISMATCH_WARN_ONLY=y
- CONFIG_NETDEVICES=y
- #ethernet end
复制代码操作完以上步骤后,可通过adb来看设备是否连通以太网,操作如下图
|