cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Ethernet Interface using KSZ8851 - Failed to define Interrupt

KDehm
Associate III

Hi,

We want to use a KSZ8851SNL SPI ethernet phy as second eth interface on a custom board. The implementation was according to https://www.kernel.org/doc/Documentation/devicetree/bindings/net/micrel%2Cks8851.yaml

The eth0 interface is initialised with success, but while loading the driver, the kernel is complaining about the interrupt pin, which is not configurable:

:~# dmesg | grep irq
[    7.495488] genirq: Setting trigger mode 8 for irq 78 failed (gic_set_type+0x0/0x4c)
[    7.516176] ks8851 spi1.0 eth0: failed to get irq

Also the pin is not shown using

cat /proc/interrupts

I attached the device tree section and another dmesg log showing the interface initialization. I tried different configurations following ST suggestions.

Does anyone know, why Pin PE1 is not configurable as interrupt using the device tree? When using Sysfs in userspace the pin gets configured as interrupt.

Or is the problem a different one?

Thanks in Advance!

Kai

3 REPLIES 3
PatrickF
ST Employee

Hi,

maybe an explanation is the way the EXTI HW allows to connect to pins.

Only one EXTI channel N interrupt could be define for each PxN port.

e.g. in your case, you might have another interrupt in conflict with PE1. Could be PA1, PB1, etc....

See https://wiki.st.com/stm32mpu/wiki/EXTI_internal_peripheral#Peripheral_overview and EXTI section in product RefMan.

0693W00000FB0DbQAL.pngRegards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi, thanks for your reply.

That could be the problem when using EXTI controller.

What about using GIC interrupt controller? Could you give me an example on how to configure PE1 as interrupt Pin for spi2 interface?

I was thinking the following code is initializing PE1 as interrupt:

interrupts-extended = <&exti 65 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "eth0-spi";

Main problem in the initialization of the ethernet interace is the following message:

ks8851 spi1.0 eth0: failed to get irq

Even if other pins are configured, the message is shown.

KDehm
Associate III

I could partly solve the problem by editing the kernel driver module for ks8851 (ks8851.c). The problem was caused by defining interrupt type. I changed the level interrupt to falling edge interrupt. Not sure, if this is the proper way. But since there is no error in driver initialization it seems to work.

//IRQF_TRIGGER_LOW | IRQF_ONESHOT,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,

Now the driver and interrupt is loaded by kernel and eth0 device appears in ifconfig. But the ethernet phy is not detecting a plugged in cable.

Is there another way to check if the ethernet phy is working properly?

Here are the console prints of ifconfig and dmesg as well as the device tree section

board:~# ifconfig
eth0      Link encap:Ethernet  HWaddr CE:C4:35:73:29:3E
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:78
 
board:~# dmesg | grep eth0
[    1.307257] ks8851 spi1.0 eth0: revision 1, MAC ce:c4:35:73:29:3e, IRQ 78, no EEPROM
[    7.115634] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
 
board:~# dmesg | grep ks8851
[    1.271371] ks8851 spi1.0: spi1.0 supply vdd-io not found, using dummy regulator
[    1.277486] ks8851 spi1.0: Linked as a consumer to regulator.0
[    1.283205] ks8851 spi1.0: Linked as a consumer to regulator.4
[    1.300073] ks8851 spi1.0: message enable is 0
[    1.307257] ks8851 spi1.0 eth0: revision 1, MAC ce:c4:35:73:29:3e, IRQ 78, no EEPROM
/* SPI Ethernet1 Interface */
&spi2{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi2_pins_mx>;
	pinctrl-1 = <&spi2_sleep_pins_mx>;
	cs-gpios = <&gpioa 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;	//GPIO PA11 SPI-CS
	status = "okay";
 
	/* USER CODE BEGIN spi2 */
	#address-cells = <1>;
        #size-cells = <0>;
	
	ethernet1: ethernet@1 {
            compatible = "micrel,ks8851";
            reg = <0>;
			reset-gpios = <&gpiog 7 0>;		// GPIO PG7
			spi-max-frequency = <40000000>;
			interrupt-parent = <&exti>;
			interrupts = <65 IRQ_TYPE_EDGE_FALLING>;   // GPIO PE1
        };
	/* USER CODE END spi2 */
};

Thanks in advance!