BBB Error applying ENC28J60 driver

Hi all,
I have a cape with ENC28J60, ans ethernet driver is supported in kernel version I use (6.1.33).
When booting I get this logs:

[    2.206836] pinctrl-single 44e10800.pinmux: pin PIN100 already requested by 481a0000.spi; cannot claim for spi1.0
[    2.217256] pinctrl-single 44e10800.pinmux: pin-100 (spi1.0) status -22
[    2.223910] pinctrl-single 44e10800.pinmux: could not request pin 100 (PIN100) from group pinmux_spi1_pins  on device pinctrl-single
[    2.235905] enc28j60 spi1.0: Error applying setting, reverse things back

This is my BB-SPI1-ENC28J60.dts which I compile to .dtbo

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    part-number = "BB-SPI1-ENC28J60";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            pinmux_spi1_pins: pinmux_spi1_pins {
                pinctrl-single,pins = <
                    0x190 0x33  /* mcasp0_fsx.spi1_sclk, INPUT_PULLUP | MODE3 */
                    0x194 0x33  /* mcasp0_axr0.spi1_d0, INPUT_PULLUP | MODE3 */
                    0x198 0x13  /* mcasp0_ahclkr.spi1_d1, OUTPUT_PULLUP | MODE3 */
                    0x19C 0x13  /* mcasp0_aclkx.spi1_cs0, OUTPUT_PULLUP | MODE3 */
                    0x1AC 0x37  /* mcasp0_ahclkx.P9_25, MODE7 | INPUT_PULLUP - PHY Interrupt */
                    0x028 0x07  /* gpmc_ad14.P8_14, MODE7 | OUTPUT - PHY Reset */
                >;
            };
        };
    };

    fragment@1 {
        target = <&spi1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";
            pinctrl-0 = <&pinmux_spi1_pins>;
            pinctrl-names = "default";

            eth1: enc28j60@0 {
                compatible = "microchip,enc28j60";
                reg = <0>; /* Chip select 0 */
                pinctrl-names = "default";
                pinctrl-0 = <&pinmux_spi1_pins>;
                interrupt-parent = <&gpio3>;
                interrupts = <21 0x2>; /* P9_25, falling edge */
                spi-max-frequency = <16000000>;
                reset-gpios = <&gpio0 26 0>; /* P8_14, active low */
                status = "okay";
            };
        };
    };
};
Here is the boot.scr

# Set environment variables
setenv console ttyO0,115200n8
setenv enable_uboot_overlays 1
#setenv enable_uboot_cape_universal 0
#setenv disable_uboot_overlay_video 1
#setenv bootdelay 3

setenv loadaddr 0x82000000
setenv fdtaddr 0x88000000
setenv spi1_enc28j60_overlayaddr 0x89000000

setenv rootpart /dev/mmcblk0p2
# Loading kernel and device tree from the second (ext4) partition
echo Booting from the first partition...
load mmc 0:1 ${loadaddr} boot/uImage
load mmc 0:1 ${fdtaddr} boot/dtbs/v6.1.33-ti-r7/am335x-boneblack.dtb

# Apply the Device Tree Overlay
fdt addr ${fdtaddr}
fdt resize 8192

# Load and Apply the Device Tree Overlay for BB-TRIA25-ENC28J60
echo Loading TRIA25-ENC28J60 Device Tree Overlay...
load mmc 0:1 ${spi1_enc28j60_overlayaddr} boot/dtbs/v6.1.33-ti-r7/overlays/BB-SPI1-ENC28J60.dtbo
echo Applying ENC28J60  Device Tree Overlay...
fdt apply ${spi1_enc28j60_overlayaddr}


# Set boot arguments for SD card boot
setenv bootargs console=${console} root=${rootpart} rootwait rw
setenv autoload no

# Boot the loaded kernel
bootm ${loadaddr} - ${fdtaddr}

Overlay is correctly applied, but can someone point me where the issue is and why I get these logs at the beggining? It is interfering with something that I do not have idea how to switch off.
Thanks!

Something else is already taking the spi port… probally audio…

Are you using hdmi? If not, a quick fix is just to force booting the am335x-bonegreen.dtb…

Regards,

Hi @RobertCNelson ,
According to schematics, it is sharing lines only with TDA19988 (HDMI transmitter), but in that case this pin needs to be in Mode 0 (McASP0_ACLKX).
I use am335x-boneblack.dtb as the main device tree. Do you think if HDMI needs to be off in Kernel config?

  │ Symbol: HDMI [=y]                                                                                                                                                                                          │  
  │ Type  : bool                                                                                                                                                                                               │  
  │ Defined at drivers/video/Kconfig:41                                                                                                                                                                        │  
  │   Depends on: HAS_IOMEM [=y]                                                                                                                                                                               │  
  │ Selected by [m]:                                                                                                                                                                                           │  
  │   - DRM [=m] && HAS_IOMEM [=y] && (AGP [=n] || AGP [=n]=n) && !EMULATED_CMPXCHG && HAS_DMA [=y]                                                                                                            │  
  │   - DRM_OMAP [=m] && HAS_IOMEM [=y] && DRM [=m] && OF [=y] && (ARCH_OMAP2PLUS [=y] || ARCH_MULTIPLATFORM [=y])                                                                                             │  
  │ Selected by [n]:                                                                                                                                                                                           │  
  │   - VIDEO_TDA1997X [=n] && MEDIA_SUPPORT [=m] && VIDEO_DEV [=m] && I2C [=y] && SND_SOC [=n]                                                                                                                │  
  │   - VIDEO_ADV7604 [=n] && MEDIA_SUPPORT [=m] && VIDEO_DEV [=m] && I2C [=y] && (GPIOLIB [=y] || COMPILE_TEST [=n])                                                                                          │  
  │   - VIDEO_ADV7842 [=n] && MEDIA_SUPPORT [=m] && VIDEO_DEV [=m] && I2C [=y]                                                                                                                                 │  
  │   - VIDEO_TC358743 [=n] && MEDIA_SUPPORT [=m] && VIDEO_DEV [=m] && I2C [=y]                                                                                                                                │  
  │   - VIDEO_ADV7511 [=n] && MEDIA_SUPPORT [=m] && VIDEO_DEV [=m] && I2C [=y] && (DRM_I2C_ADV7511 [=n]=n || COMPILE_TEST [=n])                                                                                │  
  │   - FB_OMAP2_DSS [=n] && HAS_IOMEM [=y] && OF [=y] && (ARCH_OMAP2PLUS [=y] || COMPILE_TEST [=n]) && FB_OMAP2 [=n]                                                                                          │  
  │   - SND_SOC_HDMI_CODEC [=n] && SOUND [=n] && !UML && SND [=n] && SND_SOC [=n]                                                                                                                              │  
  │   - SND_SOC_HDAC_HDMI [=n] && SOUND [=n] && !UML && SND [=n] && SND_SOC [=n]

HDMI pin’s get muxed by default in am335x-boneblack.dtb if you need those pins for your spi device, and don’t actually need “HDMI video” just use am335x-bonegreen.dtb if you need HDMI video (but no audio) you need to carve out the audio pins on the header thru the device-tree.

For BeagleBoard.org, we created a ‘base’ am335x-boneblack-uboot.dtb which we apply hdmi/emmc/audio/etc on top off to carefully select options…

Regards,

Hi @RobertCNelson even after switching to am335x-bonegreen.dtb there is the same issue, and same logs. Anything else that I can try? Does my overlay looks ok to you?

Hi @RobertCNelson I also expect that my .dtbo overwrites pin configuration from am335x-boneblack.dtb, or I am wrong?
Whatever I try to change in my overlay privided above, I get the same log.

Hi @RobertCNelson changing my .dts actually solved the problem, by splitting SPI and ethernet PHY specific pins.

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    part-number = "BB-SPI1-ENC28J60";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            pinmux_spi1_pins: pinmux_spi1_pins {
                pinctrl-single,pins = <
		    0x190 0x33  /* mcasp0_fsx.spi1_sclk, INPUT_PULLUP | MODE3 */
                    0x194 0x33  /* mcasp0_axr0.spi1_d0, INPUT_PULLUP | MODE3 */
                    0x198 0x33  /* mcasp0_ahclkr.spi1_d1, OUTPUT_PULLUP | MODE3 */
                    0x19C 0x33  /* mcasp0_aclkx.spi1_cs0, OUTPUT_PULLUP | MODE3 */
                >;
            };
	    pinmux_eth_pins: pinmux_eth_pins {
	    	pinctrl-single,pins = <
		    0x1AC 0x37  /* mcasp0_ahclkx.P9_25, MODE7 | INPUT_PULLUP - PHY Interrupt */
                    0x028 0x37  /* gpmc_ad14.P8_14, MODE7 | OUTPUT - PHY Reset */
		>;
            };
        };
    };

    fragment@1 {
        target = <&spi1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";
	    pinctrl-0 = <&pinmux_spi1_pins>;
	    pinctrl-names = "default";
	
            channel@0 {
                compatible = "microchip,enc28j60";
                reg = <0>; /* Chip select 0 */
                symlink = "bone/spi/1.0";
		pinctrl-names = "default";
		pinctrl-0 = <&pinmux_eth_pins>;
                interrupt-parent = <&gpio3>;
                interrupts = <21 0x2>; /* P9_25, falling edge */
                spi-max-frequency = <16000000>;
                local-mac-address = [ 00 00 00 00 00 00 ];                
		
            };
        };
    };
};

Still not sure why it works when I put all pins to input, but I took it from here: