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.

TDA4VM: Unable to generate WKUP GPIO node

Part Number: TDA4VM


Tool/software:

Hi,

  There is an issue with debugging. According to the following circuit diagram, the interrupt pin of a2b is connected to WKUP_GPIO0.29 in the wkup domain, but the protocol stack of a2b(ad2428) is integrated in the A72 core. How should I monitor this interrupt pin in the A72 core? Currently, I have modified the dts file and added:

wkup_gpio_pins_default: wkup-gpio-default-pins {
pinctrl-single,pins = <J721E_WKUP_IOPAD(0x34, PIN_INPUT, 7) /* (F22) MCU_OSPI1_CLK.WKUP_GPIO0_29 */>;
};
&wkup_gpio0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&wkup_gpio_pins_default>;
};
However, there was no wkup_gpio0 node during verification, so it was executed
fd = open("/sys/class/gpio/gpio225/value", O_RDONLY | O_NONBLOCK);
Is there an error, how can I modify it to solve this problem?
Regards,
Yang
  • Hello Yang,

    There is an FAQ to check GPIO interrupts in Linux: https://e2e.ti.com/support/processors/f/791/t/1058595

    Usually the requesting driver for GPIO has to register an interrupt handler.

    The above FAQ shows a way to test GPIO interrupts.

    - Keerthy

  • Hi,

    Thank you very much for your reply I have modified the code based on your suggestion, but according to the logs, the newly added function code was not called. Is it necessary to turn on a certain switch? I still have a question, how is the parameter 432 in the gpio_get-value (432) function determined when calling it? If I use the pin "(F22) MCU-OSPI1_CLK-WKUP_GPO0.29", how will the parameter of this function be calculated. Below are the modified code and logs.
    diff --git a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
    index 6c25e16a3..ee769f5f3 100644
    --- a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
    +++ b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
    @@ -112,6 +112,11 @@ dp_connector_in: endpoint {
     			};
     		};
     	};
    +	a2b_gpio: a2b_gpio {
    +		compatible = "ti,a2b_gpio";
    +		interrupt-parent = <&wkup_gpio0>;
    +		interrupts = <52 IRQ_TYPE_EDGE_BOTH>;
    +	};
     	pps_gpio {
     		status = "okay";
    @@ -438,6 +443,7 @@ wkup_gpio_pins_default: wkup-gpio-default-pins {
     	// 		J721E_WKUP_IOPAD(0xdc, PIN_OUTPUT, 7) /* (H27) WKUP_GPIO0_11 */
     	// 		J721E_WKUP_IOPAD(0x4, PIN_INPUT_PULLUP, 7) /* (C21) MCU_OSPI0_LBCLKO.WKUP_GPIO0_17 */
     	 		J721E_WKUP_IOPAD(0x34, PIN_INPUT, 7) /* (F22) MCU_OSPI1_CLK.WKUP_GPIO0_29 */
    +			J721E_WKUP_IOPAD(0x90, PIN_INPUT, 7) /* (E27) WKUP_GPIO0_52 */
     	// 		J721E_WKUP_IOPAD(0x44, PIN_OUTPUT, 7) /* (G22) MCU_OSPI1_D1.WKUP_GPIO0_33 */
     	// 		J721E_WKUP_IOPAD(0x48, PIN_INPUT, 7) /* (D23) MCU_OSPI1_D2.WKUP_GPIO0_34 */
     	// 		J721E_WKUP_IOPAD(0x4c, PIN_INPUT, 7) /* (C23) MCU_OSPI1_D3.WKUP_GPIO0_35 */
    @@ -543,16 +549,14 @@ &main_uart1 {
     &main_uart2 {
     	status = "disabled";
     };
    +&wkup_gpio0 {
    +	status = "okay";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&wkup_gpio_pins_default>;
    +};
     
     &main_gpio0 {
     	status = "okay";
    	
    diff --git a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/gpio/gpio-davinci.c b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/gpio/gpio-davinci.c
    index 8db5717bd..1bf39bc98 100644
    --- a/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/gpio/gpio-davinci.c
    +++ b/psdkla/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/gpio/gpio-davinci.c
    @@ -23,9 +23,13 @@
     #include <linux/irqchip/chained_irq.h>
     #include <linux/spinlock.h>
     #include <linux/pm_runtime.h>
    +#include <linux/interrupt.h>
    +#include <linux/of_irq.h>
    +#include <linux/of_gpio.h>
     
     #define MAX_REGS_BANKS 5
     #define MAX_INT_PER_BANK 32
    +int a2b_gpio_init(void);
     
     struct davinci_gpio_regs {
     	u32	dir;
    @@ -120,6 +124,34 @@ davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
     	return __davinci_direction(chip, offset, true, value);
     }
     
    +static irqreturn_t a2b_irq(int irq, void *data)
    +{
    +	pr_info("%s: ####### irq %d, val=%d\n", __func__, irq,
    +		gpio_get_value(432));
    +	return IRQ_HANDLED;
    +}
    +
    +int a2b_gpio_init(void)
    +{
    +	struct device_node *np;
    +	int irq;
    +	int ret = 0;
    +
    +	np = of_find_node_by_name(NULL, "a2b_gpio");
    +
    +	if (np) {
    +		pr_info("### Initializing a2b irq gpio test\n");
    +		irq = irq_of_parse_and_map(np, 0);
    +		printk("### irq number is %d\n", irq);
    +		ret = request_irq(irq, a2b_irq, //IRQF_TRIGGER_RISING,
    +				  IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
    +				  "key-gpio", NULL);
    +		if (ret)
    +			pr_err("### request_irq returns %d\n", ret);
    +	}
    +
    +	return ret;
    +}
     /*
      * Read the pin's value (works even if it's set up as output);
      * returns zero/nonzero.
    @@ -196,6 +228,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
     	struct davinci_gpio_platform_data *pdata;
     	struct device *dev = &pdev->dev;
     
    +	printk("##### Name of gpio dev is %s\n", pdev->name);
     	pdata = davinci_gpio_get_pdata(pdev);
     	if (!pdata) {
     		dev_err(dev, "No platform data found\n");
    @@ -268,7 +301,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
     	ret = davinci_gpio_irq_setup(pdev);
     	if (ret)
     		return ret;
    -
    +	if (!strcmp("42110000.gpio", pdev->name)) {
    +		a2b_gpio_init();
    +	}
     	return 0;
     }
     
    Regards,
    Yang
  • Hi,

      Currently, there are no WKUP domain nodes generated under/sys/class/gpio/.

    Regards,

    Yang

  • Yang,

    The Linux kernel deprecated the SYSFS_GPIO. If you want the gpio SYSFS couple of configs need to be enabled in the kernel:
    CONFIG_EXPERT & CONFIG_SYSFS_GPIO. You should be able to see the gpio sysfs for WKUP_GPIO with the above configs enabled.

    - Keerthy

  • Hi,

      I have added these two macro definitions, otherwise the/sys/class/gpio node would not be visible.
    Regards,
    Yang
  • Yang,

    Understood. Can you attach your dtb for here? But any chance wkup_gpio nodes are disabled?

    Best Regards,

    Keerthy 

  • Hi 

    I found there is an error in log:

    [ 1.399907] ##### Name of gpio dev is 42110000.gpio
    [ 1.400986] mmc0: SDHCI controller on 4f80000.mmc [4f80000.mmc] using ADMA 64-bit
    [ 1.404961] davinci_gpio 42110000.gpio: error -ENXIO: IRQ index 0 not found
    [ 1.412258] mmc1: SDHCI controller on 4fb0000.mmc [4fb0000.mmc] using ADMA 64-bit
    [ 1.419519] ##### Name of gpio dev is 600000.gpio
    [ 1.434491] ##### Name of gpio dev is 601000.gpio

    3252.k3-j721e-common-proc-board.zip

    BR

    liupt