2.3 Configure LAN8670 Support on SAM E54 Curiosity Ultra Development Board

: The SAM E54 Curiosity Ultra Development Board is presently not supported by Board Support Packages (BSPs) in Zephyr. However, both the SAM E54 Xplained Pro and the SAM E54 Curiosity Ultra Development Board utilize the same ATSAME54P20A System-on-Chip (SoC). Therefore, we adapt the device tree source (DTS) file and pin configuration settings from the SAM E54 Xplained Pro board to align with the specifications of the SAM E54 Curiosity Ultra Development Board. After these modifications are completed, we proceed with the compilation of the image file tailored for the SAM E54 Curiosity Ultra Development Board.
  1. Make sure that the virtual environment is activated.

    source ~/zephyrproject/.venv/bin/activate

  2. Enter the directory.

    $ cd zephyrproject/zephyr/

    : Development of the LAN8670 Rev. D0 PHY driver for upstream integration is ongoing. Until it becomes available upstream, you can download the LAN8670 PHY driver file from the microchip product site page.
    : For LAN8670 Rev. D0 chips follow the steps (2.a-2.c) below and then proceed with step number 3.
    1. Download the LAN8670 Zephyr driver package file from the microchip product site page.

      $ wget https://ww1.microchip.com/downloads/aemDocuments/documents/AIS/ProductDocuments/CodeExamples/EVB-LAN8670-RMII_Zephyr_Driver_1v0.zip

    2. Extract the downloaded software package into your local directory.

      $ unzip EVB-LAN8670-RMII_Zephyr_Driver_1v0.zip

    3. Copy the LAN8670 PHY driver file from the below directory to drivers/ethernet/phy/.

      $ cp EVB-LAN8670-RMII_Zephyr_Driver_1v0/zephyr-lan867x-support/files/phy_microchip_t1s.c drivers/ethernet/phy/

  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):
    /*
     * 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 = &sercom1;
                    zephyr,shell-uart = &sercom1;
                    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>;
    };
    
    
    &sercom1 {
            status = "okay";
            compatible = "atmel,sam0-uart";
            current-speed = <115200>;
            rxpo = <1>;
            txpo = <0>;
            #address-cells = <1>;
            #size-cells = <0>;
    
            pinctrl-0 = <&sercom1_uart_default>;
            pinctrl-names = "default";
    };
    
    &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";
    };
    
    &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";
    };
    
    &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 = "okay";
    
            pinctrl-0 = <&gmac_rmii>;
            pinctrl-names = "default";
    
            phy-handle = <&phy>;
    
            local-mac-address = [04 05 06 01 02 03];
            max-speed = <10>;
    };
    
    &mdio {
            status = "okay";
    
            pinctrl-0 = <&mdio_uc_default>;
            pinctrl-names = "default";
    
            phy: 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";
             };
    };
    
    &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. Open the same54_xpro-pinctrl.dtsi file.

    $ vim boards/atmel/sam0/same54_xpro/same54_xpro-pinctrl.dtsi

  6. In the file add “mdio_uc_default” and “sercom1_uart_default” nodes as shown below (marked bold in the code section):
    /*
     * Copyright (c) 2022, Gerson Fernando Budke <nandojve@gmail.com>
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <dt-bindings/pinctrl/same54p-pinctrl.h>
    
    &pinctrl {
            pwm_default: pwm_default {
                    group1 {
                            pinmux = <PC18F_TCC0_WO2>;
                    };
            };
    
            gmac_rmii: gmac_rmii {
                    group1 {
                            pinmux = <PA14L_GMAC_GTXCK>,
                                     <PA17L_GMAC_GTXEN>,
                                     <PA18L_GMAC_GTX0>,
                                     <PA19L_GMAC_GTX1>,
                                     <PC20L_GMAC_GRXDV>,
                                     <PA13L_GMAC_GRX0>,
                                     <PA12L_GMAC_GRX1>,
                                     <PA15L_GMAC_GRXER>;
                    };
            };
    
            mdio_default: mdio_default {
                    group1 {
                            pinmux = <PC11L_GMAC_GMDC>,
                                     <PC12L_GMAC_GMDIO>;
                    };
            };
    
            mdio_uc_default: mdio_uc_default {
                    group1 {
                            pinmux = <PC22L_GMAC_GMDC>,
                                     <PC23L_GMAC_GMDIO>;
                    };
            };
    
            sercom7_i2c_default: sercom7_i2c_default {
                    group1 {
                            pinmux = <PD8C_SERCOM7_PAD0>,
                                     <PD9C_SERCOM7_PAD1>;
                    };
            };
    
            sercom4_spi_default: sercom4_spi_default {
                    group1 {
                            pinmux = <PB26D_SERCOM4_PAD1>,
                                     <PB27D_SERCOM4_PAD0>,
                                     <PB29D_SERCOM4_PAD3>;
                    };
            };
    
            sercom2_uart_default: sercom2_uart_default {
                    group1 {
                            pinmux = <PB25D_SERCOM2_PAD0>,
                                     <PB24D_SERCOM2_PAD1>;
                     };
             };
    
            sercom1_uart_default: sercom1_uart_default {
                    group1 {
                            pinmux = <PC27C_SERCOM1_PAD0>,
                                     <PC28C_SERCOM1_PAD1>;
                    };
            };
    
            usb_dc_default: usb_dc_default {
                    group1 {
                            pinmux = <PA25H_USB_DP>,
                                     <PA24H_USB_DM>;
                    };
            };
    };
  7. Save the changes.