Hi,
I would like to read the status of main_gpio.
I have referred to the detect_enable_hyperflash function in board/ti/j721e/evm.c, and it only read the wkup_gpio.
For main_gpio, how to modify?
Thanks.
Best regards,
Namic Chang
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.
Hi,
I would like to read the status of main_gpio.
I have referred to the detect_enable_hyperflash function in board/ti/j721e/evm.c, and it only read the wkup_gpio.
For main_gpio, how to modify?
Thanks.
Best regards,
Namic Chang
Thanks for your query. Due to the regional holiday, please expect a 1~2 day delay in responses. Apologies for the delay, and thank you for your patience.
Hi Namic,
If wanting to read main_gpio pins in u-boot, I would recommend referencing this E2E thread where a user toggles and reads GPIO pins in u-boot: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1084498/tda4vm-q1-how-to-control-gpio-on-tda4-uboot
If you are already doing some experiments with some u-boot commands and not seeing any changes, my first suspicion is that pinmuxing is not being done in device tree, similar to the E2E that I have linked.
Regards,
Takuma
Hi, Takuma:
Thanks for your reply.
I have add pin mux in dtsi for main_gpio pins and set them to PIN_INPUT.
&main_gpio0 {
pinctrl-names = "default";
pinctrl-0 = <&main_gpio0_pins_default>;
};
&main_pmx0 {
main_gpio0_pins_default: main-gpio0-pins-default {
pinctrl-single,pins = <
J721S2_IOPAD(0x06c, PIN_INPUT, 7) /* (V26) MCAN1_TX.GPIO0_27 */
J721S2_IOPAD(0x078, PIN_INPUT, 7) /* (Y25) MCAN2_RX.GPIO0_30 */
>;
};
};
But I used dm_gpio_lookup_name(), dm_gpio_request() and dm_gpio_get_value() to access the two pins, I would get the result of wkup_gpio.
So, how can I use these dm_gpio_xxx functions to get the value of main_gpio ?
Thanks.
Best regards,
Namic Chang
Hi Namic,
I am not too familiar with dm_gpio_lookup_name() in U-Boot. However, my next suspicion after pinmuxing would be related to offsets for GPIO as this is a common issue when interfacing with GPIO in general.
If you stop in U-Boot by pressing any keys when prompted, you can do "gpio status -a" to print out all the GPIO banks. What I see on my end is the following on TDA4AL:
=> gpio status -a 0: input: 0 [ ] 1: input: 1 [ ] 2: input: 1 [ ] 3: input: 0 [ ] 4: input: 0 [ ] 5: input: 0 [ ] 6: input: 0 [ ] 7: input: 0 [ ] 8: input: 0 [ ] 9: input: 0 [ ] 10: input: 0 [ ] 11: input: 0 [ ] 12: input: 0 [ ] 13: input: 1 [ ] 14: input: 1 [ ] 15: input: 1 [ ] 16: input: 0 [ ] 17: input: 1 [ ] 18: input: 0 [ ] 19: input: 1 [ ] 20: input: 1 [ ] 21: input: 0 [ ] 22: input: 0 [ ] 23: input: 1 [ ] 24: input: 1 [ ] 25: input: 0 [ ] 26: input: 0 [ ] 27: input: 0 [ ] 28: input: 0 [ ] 29: input: 0 [ ] 30: input: 0 [ ] 31: input: 0 [ ] 32: input: 1 [ ] 33: input: 0 [ ] 34: input: 0 [ ] 35: input: 0 [ ] 36: input: 0 [ ] 37: input: 0 [ ] 38: input: 0 [ ] 39: input: 0 [ ] 40: input: 0 [ ] 41: input: 0 [ ] 42: input: 0 [ ] 43: input: 0 [ ] 44: input: 0 [ ] 45: input: 0 [ ] 46: input: 0 [ ] 47: input: 1 [ ] 48: input: 0 [ ] 49: input: 0 [ ] 50: input: 0 [ ] 51: input: 0 [ ] 52: input: 1 [ ] 53: input: 0 [ ] 54: input: 0 [ ] 55: input: 0 [ ] 56: input: 1 [ ] 57: input: 1 [ ] 58: input: 1 [ ] 59: input: 0 [ ] 60: input: 0 [ ] 61: input: 0 [ ] 62: input: 0 [ ] 63: input: 1 [ ] 64: input: 1 [ ] 65: input: 1 [ ] 66: input: 1 [ ] 67: input: 0 [ ] 68: input: 0 [ ] 69: input: 0 [ ] 70: input: 0 [ ] 71: input: 0 [ ] 72: input: 0 [ ] 73: input: 0 [ ] 74: input: 0 [ ] 75: input: 0 [ ] 76: input: 0 [ ] 77: input: 0 [ ] 78: input: 0 [ ] 79: input: 0 [ ] 80: input: 0 [ ] 81: input: 0 [ ] 82: input: 0 [ ] 83: input: 0 [ ] 84: input: 0 [ ] 85: input: 0 [ ] 86: input: 0 [ ] 87: input: 1 [ ] 88: input: 0 [ ] 0: input: 0 [ ] 1: input: 0 [ ] 2: input: 0 [ ] 3: input: 0 [ ] 4: input: 0 [ ] 5: input: 0 [ ] 6: input: 0 [ ] 7: input: 0 [ ] 8: input: 0 [ ] 9: input: 0 [ ] 10: input: 0 [ ] 11: input: 0 [ ] 12: input: 0 [ ] 13: input: 0 [ ] 14: input: 0 [ ] 15: input: 0 [ ] 16: input: 1 [ ] 17: input: 0 [ ] 18: input: 0 [ ] 19: input: 0 [ ] 20: input: 0 [ ] 21: input: 0 [ ] 22: input: 0 [ ] 23: input: 0 [ ] 24: input: 0 [ ] 25: input: 0 [ ] 26: input: 0 [ ] 27: input: 0 [ ] 28: input: 0 [ ] 29: input: 0 [ ] 30: input: 0 [ ] 31: input: 0 [ ] 32: input: 0 [ ] 33: input: 0 [ ] 34: input: 0 [ ] 35: input: 0 [ ] 36: input: 0 [ ] 37: input: 0 [ ] 38: input: 0 [ ] 39: input: 0 [ ] 40: input: 0 [ ] 41: input: 0 [ ] 42: input: 0 [ ] 43: input: 0 [ ] 44: input: 0 [ ] 45: input: 0 [ ] 46: input: 0 [ ] 47: input: 0 [ ] 48: input: 0 [ ] 49: input: 0 [ ] 50: input: 0 [ ] 51: input: 0 [ ] 52: input: 1 [ ] 53: input: 0 [ ] 54: input: 0 [ ] 55: input: 0 [ ] 56: input: 1 [ ] 57: input: 1 [ ] 58: input: 0 [ ] 59: input: 0 [ ] 60: input: 1 [ ] 61: input: 1 [ ] 62: input: 1 [ ] 63: input: 1 [ ] 64: input: 1 [ ] 65: input: 1 [ ] Bank gpio@21_: gpio@21_0: input: 0 [ ] gpio@21_1: input: 0 [ ] gpio@21_2: input: 0 [ ] gpio@21_3: input: 1 [ ] gpio@21_4: input: 0 [ ] gpio@21_5: input: 1 [ ] gpio@21_6: input: 0 [ ] gpio@21_7: input: 1 [ ] Bank gpio@20_: gpio@20_0: input: 0 [ ] gpio@20_1: input: 0 [ ] gpio@20_2: input: 0 [ ] gpio@20_3: input: 0 [ ] gpio@20_4: input: 0 [ ] gpio@20_5: input: 0 [ ] gpio@20_6: input: 0 [ ] gpio@20_7: input: 0 [ ] gpio@20_8: input: 0 [ ] gpio@20_9: input: 0 [ ] gpio@20_10: input: 1 [ ] gpio@20_11: input: 1 [ ] gpio@20_12: input: 0 [ ] gpio@20_13: input: 0 [ ] gpio@20_14: input: 0 [ ] gpio@20_15: input: 1 [ ] Bank gpio@22_: gpio@22_0: input: 0 [ ] gpio@22_1: input: 0 [ ] gpio@22_2: input: 1 [ ] gpio@22_3: input: 1 [ ] gpio@22_4: input: 0 [ ] gpio@22_5: input: 0 [ ] gpio@22_6: input: 0 [ ] gpio@22_7: input: 0 [ ] gpio@22_8: input: 0 [ ] gpio@22_9: input: 1 [ ] gpio@22_10: input: 0 [ ] gpio@22_11: input: 0 [ ] gpio@22_12: input: 0 [ ] gpio@22_13: input: 0 [ ] gpio@22_14: input: 0 [ ] gpio@22_15: input: 1 [ ] gpio@22_16: input: 1 [ ] gpio@22_17: input: 0 [ ] gpio@22_18: input: 0 [ ] gpio@22_19: input: 0 [ ] gpio@22_20: input: 0 [ ] gpio@22_21: input: 0 [ ] gpio@22_22: input: 1 [ ] gpio@22_23: input: 1 [ ]
When referencing datasheet's section 6.3.3 GPIO (https://www.ti.com/lit/ds/symlink/tda4vl-q1.pdf), you can find the number of WKUP_GPIO pins are 0~88 and MAIN_GPIO pins are 0~65.
My assumption is that dm_gpio_lookup_name is using similar methods to access the available GPIO pins as the command line gpio tool. If this is true, then it could be that the first 0~88 pins are for wkup_gpio and the next 89~154 pins after the wkup_gpio pins are the main_gpio pins.
Regards,
Takuma