2.3 Configure LAN8651 Support on SAM E54 Xplained Pro Evaluation Kit Target

  1. Before continuing, make sure the virtual environment is activated.

    $ source ~/zephyrproject/.venv/bin/activate

  2. Enter the directory.

    $ cd zephyrproject/zephyr/

  3. Open the same54_xpro.dts file.

    $ vim boards/atmel/sam0/same54_xpro/same54_xpro.dts

  4. In the file make the adaptations as listed below (marked bold in the code section):
    • Add &dmac node between &sercom2 node and &sercom4 node.
    • Add the MAC and PHY node contents inside &sercom4 node.
    • Disable &gmac and &mdio nodes statuses.
    /*
    * Copyright (c) 2019 Benjamin Valentin 
    # Copyright (c) 2024-2025 Gerson Fernando Budke <nandojve@gmail.com> 
    * 
    * SPDX-License-Identifier: Apache-2.0 
    */
    
    /dts-v1/;
    #include <atmel/same5xx20.dtsi>
    #include "same54_xpro-pinctrl.dtsi" 
    #include <zephyr/dt-bindings/input/input-event-codes.h> 
    
    / {
        model = "SAM E54 Xplained Pro";
        compatible = "same54,xpro", "atmel,same54p20a", "atmel,same54";
     
        chosen { 
            zephyr,console = &sercom2; 
            zephyr,shell-uart = &sercom2; 
            zephyr,sram = &sram0; 
            zephyr,flash = &flash0; 
        }; 
    
        /* These aliases are provided for compatibility with samples */ 
        aliases { 
            led0 = &led0; 
            pwm-led0 = &pwm_led0; 
            sw0 = &button0; 
            i2c-0 = &sercom7; 
        }; 
    
        leds { 
            compatible = "gpio-leds"; 
            led0: led_0 { 
                gpios = <&portc 18 GPIO_ACTIVE_LOW>; 
                label = "Yellow LED"; 
            }; 
        }; 
    
        pwmleds { 
            compatible = "pwm-leds"; 
            pwm_led0: pwm_led_0 { 
                pwms = <&tcc0 2 PWM_MSEC(20)>; 
            }; 
        }; 
    
        buttons { 
            compatible = "gpio-keys"; 
            button0: button_0 { 
                gpios = <&portb 31 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; 
                label = "SW0"; 
                zephyr,code = <INPUT_KEY_0>; 
            }; 
        }; 
    }; 
    
    &cpu0 { 
        clock-frequency = <120000000>; 
    }; 
    
    &tcc0 { 
        status = "okay"; 
        compatible = "atmel,sam0-tcc-pwm"; 
        /* Gives a maximum period of 1.1s for 120MHz main clock */ 
        prescaler = <8>; 
        #pwm-cells = <2>; 
    
        pinctrl-0 = <&pwm_default>; 
        pinctrl-names = "default"; 
    }; 
    
    &rtc { 
        status = "okay"; 
        counter-mode = "clock"; 
        prescaler = <1024>; 
    
        atmel,assigned-clocks = <&osc32kctrl 4>; 
    }; 
    
    &sercom2 { 
        status = "okay"; 
        compatible = "atmel,sam0-uart"; 
        current-speed = <115200>;  
        rxpo = <1>; 
        txpo = <0>; 
        #address-cells = <1>; 
        #size-cells = <0>; 
    
        pinctrl-0 = <&sercom2_uart_default>; 
        pinctrl-names = "default"; 
    }; 
    
    &dmac { 
        status = "okay"; 
    }; 
    
    &sercom4 { 
        status = "okay"; 
        compatible = "atmel,sam0-spi"; 
        dipo = <3>; dopo = <0>; 
        #address-cells = <1>; 
        #size-cells = <0>; 
    
        pinctrl-0 = <&sercom4_spi_default>; 
        pinctrl-names = "default"; 
    
        cs-gpios = <&portb 28 GPIO_ACTIVE_LOW>; 
    
        /* Configure DMA */ 
        dmas = <&dmac 0 12>, <&dmac 1 13>; 
        dma-names = "rx", "tx"; 
    
        lan8651: lan8651@0 { 
           compatible = "microchip,lan865x"; 
           reg = <0>; 
           int-gpios = <&portb 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;  
           rst-gpios = <&porta 6 GPIO_ACTIVE_LOW>; 
           local-mac-address = [14 15 16 11 12 13]; 
           spi-max-frequency = <20000000>; 
           status = "okay"; 
               lan865x_mdio: lan865x_mdio { 
                   compatible = "microchip,lan865x-mdio"; 
                   status = "okay"; 
                   #address-cells = <1>; 
                   #size-cells = <0>; 
                   ethernet-phy@0 { 
                       compatible = "microchip,t1s-phy"; 
                       reg = <0x0>; 
                       plca-enable; 
                       plca-node-id = <0>; 
                       plca-node-count = <8>; 
                       plca-burst-count = <0>; 
                       plca-burst-timer = <0x80>; 
                       plca-to-timer = <0x20>; 
                       status = "okay"; 
                   }; 
               }; 
           }; 
    }; 
    
    &sercom7 { 
        status = "okay"; 
        compatible = "atmel,sam0-i2c"; 
        clock-frequency = <I2C_BITRATE_FAST>; 
        #address-cells = <1>; 
        #size-cells = <0>; 
    
        pinctrl-0 = <&sercom7_i2c_default>; 
        pinctrl-names = "default"; 
    
        eeprom: eeprom@5e { 
            compatible = "atmel,24mac402"; 
            reg = <0x5e>; 
        }; 
    }; 
    
    &adc0 { 
        status = "okay"; 
    }; 
    
    zephyr_udc0: &usb0 { 
        status = "okay"; 
    
        pinctrl-0 = <&usb_dc_default>; 
        pinctrl-names = "default"; 
    }; 
    
    &gmac { 
        status = "disabled"; 
    
        pinctrl-0 = <&gmac_rmii>; 
        pinctrl-names = "default"; 
    
        mac-eeprom = <&eeprom>; 
        phy-handle = <&phy>; 
    }; 
    
    &mdio { 
        status = "disabled"; 
    
        pinctrl-0 = <&mdio_default>; 
        pinctrl-names = "default"; 
    
        phy: ethernet-phy@0 { 
            compatible = "ethernet-phy"; 
            status = "disabled"; 
            reg = <0>; 
        }; 
    }; 
    
    &flash0 { 
        partitions { 
            compatible = "fixed-partitions"; 
            #address-cells = <1>; 
            #size-cells = <1>; 
    
            /* 
            * The final 16 KiB is reserved for the application. 
            * Storage partition will be used by FCB/LittleFS/NVS 
            * if enabled. 
            */ 
            storage_partition: partition@fc000 { 
                label = "storage"; 
                reg = <0x000fc000 0x00004000>; 
            }; 
        }; 
    };
  5. Save the changes.