This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

Linux/PROCESSOR-SDK-AM335X: Linking PHY interrupts to GPIO

Prodigy 20 points

Replies: 3

Views: 2518

Part Number: PROCESSOR-SDK-AM335X

Tool/software: Linux

I am using the Linux SDK am335x-evm-03.01.00.06 development environment with a custom Am335x design using a gigabit PHY. The interrupt pin from the PHY is connected to a GPIO pin (GPIO2_1) of the AM335x. I am attempting to define the device tree to connect this, as a GPIO interrupt, to the PHY. Here is my device tree snippet for the PHY definition:

phy0: ethernet-phy@0 {

  reg = <0>;
  interrupt-parent = <&gpio2>;
  interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
};

I have then set the .flags entry in the device driver to include the setting:

.flags = PHY_HAS_INTERRUPT,

On startup I am receiving the following kernel message:

libphy: 4a101000.mdio: probed

davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver Broadcom BCM54210s
net eth0: phy found : id is : 0x600d8595
libphy: 4a101000.mdio: Can't get IRQ -1 (PHY)
When that occurs none of the interrupt related calls are made within my PHY driver. Is it possible to configure a GPIO interrupt through the PHY definitions, or must it be done manually in the driver using the kernel GPIO calls (gpio_request(), request_irq(), etc)? I would prefer to use the struct phy_driver definitions for the driver as it already has callbacks for the PHY interrupt configuration and interrupt acknowledgement. 
Note that the system is fully operational without the interrupt, I am just looking to get some throughput improvement by utilizing the interrupts rather than polling.
Thanks,
Richard
  • Hi Richard,

    I will have a look and come back to you when I have something on this.

    Regards,
    Pavel



  • Richard Funderburk

    phy0: ethernet-phy@0 {

      reg = <0>;
      interrupt-parent = <&gpio2>;
      interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
    };

    From what I understand, you have direct connection between gigabit PHY and AM335x EMAC/MDIO on your board, same as AM335x TI EVM and SK. While ethernet-phy node is used when "MDIO bus multiplexer/switch controlled by GPIO pins" is used. The below driver and doc file are related:

    linux-4.4.19/drivers/net/phy/mdio-mux-gpio.c

    linux-4.4.19/Documentation/devicetree/bindings/net/mdio-mux-gpio.txt

    If you do not have MDIO switch on your custom board, I do not think using ethernet-phy node is properly. You might try to implement "interrupt-parent" and "interrupts" GPIO2_1 entries in the cpsw_emacx nodes, but I am not sure if this is also appropriate, the doc file is not clear about that.

    linux-4.4.19/Documentation/devicetree/bindings/net/cpsw.txt

    Regards,
    Pavel



  • In reply to Pavel Botev:

    Richard,

    I found two e2e threads where "interrupt-parent" and "interrupts" entries for gpio are used from within cpsw_emac node:

    e2e.ti.com/.../622606
    e2e.ti.com/.../622612

    Regards,
    Pavel



This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.