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.
Tool/software: Linux
We are beaglebone black based custom board with 256MB RAM and 512MB DDR.
We are using Linux kernel 3.12.
I was trying to configure three gpios as input in devicetree.
I want to achieve two things.
1. Configure(mux) GPIOs as input with PULLUP from devicetree
2. Get sysfs files for those GPIOs in sysfs so no need to export GPIOs but directly read the values.
Below devicetree snnipet I have used to configure pinmux,
am33xx_pinmux: pinmux@44e10800 { pinctrl-names = "default"; ---------------cut----------------------------- product_id_pins: product_id_pins{ pinctrl-single,pins = < 0x028 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_ad10.gpio0_26, (ZCE) */ 0x034 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_ad13.gpio1_13, (ZCE) */ 0x024 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_ad12.gpio1_12, (ZCE), */ >; }; }; pid { pinctrl-names = "default"; pinctrl-0 = <&product_id_pins>; };
With this I need to write following shell command to read those GPIOs
# echo 26 > /sys/class/gpio/export # echo 44 > /sys/class/gpio/export # echo 45 > /sys/class/gpio/export # cat /sys/class/gpio/gpio26/value 0 # cat /sys//class/gpio/gpio44/value 0 # cat /sys//class/gpio/gpio45/value 0
Now nothing is connected on these GPIO pins, so value must be read high but values are low.
other sysfs entries read following
# grep -r . /sys/class/gpio/gpio26/ /sys/class/gpio/gpio26/edge:none /sys/class/gpio/gpio26/power/control:auto /sys/class/gpio/gpio26/power/runtime_active_time:0 /sys/class/gpio/gpio26/power/runtime_status:unsupported /sys/class/gpio/gpio26/power/runtime_suspended_time:0 /sys/class/gpio/gpio26/value:0 /sys/class/gpio/gpio26/active_low:0 /sys/class/gpio/gpio26/direction:in # grep -r . /sys/class/gpio/gpio44/ /sys/class/gpio/gpio44/edge:none /sys/class/gpio/gpio44/power/control:auto /sys/class/gpio/gpio44/power/runtime_active_time:0 /sys/class/gpio/gpio44/power/runtime_status:unsupported /sys/class/gpio/gpio44/power/runtime_suspended_time:0 /sys/class/gpio/gpio44/value:0 /sys/class/gpio/gpio44/active_low:0 /sys/class/gpio/gpio44/direction:in # grep -r . /sys/class/gpio/gpio45/ /sys/class/gpio/gpio45/edge:none /sys/class/gpio/gpio45/power/control:auto /sys/class/gpio/gpio45/power/runtime_active_time:0 /sys/class/gpio/gpio45/power/runtime_status:unsupported /sys/class/gpio/gpio45/power/runtime_suspended_time:0 /sys/class/gpio/gpio45/value:0 /sys/class/gpio/gpio45/active_low:0 /sys/class/gpio/gpio45/direction:in
It has something to do with devicetree configuration.
Can someone suggest which client device I should configure in devicetree for those GPIOs ?
Thank you,
Regards,
Ankur
With some modification I am able to get pinmux right.
am33xx_pinmux: pinmux@44e10800 { pinctrl-names = "default"; ----------------CUT--------------- product_id_pins: product_id_pins{ pinctrl-single,pins = < 0x028 (INPUT_EN | PULL_UP | MUX_MODE7 ) /* gpmc_ad10.gpio0_26, BGA T12 (ZCE) */ 0x034 (INPUT_EN | PULL_UP | MUX_MODE7 ) /* gpmc_ad13.gpio1_13, BGA T13 (ZCE) */ 0x030 (INPUT_EN | PULL_UP | MUX_MODE7 ) /* gpmc_ad12.gpio1_12, BGA U13 (ZCE), TP39 */ >; }; }; pid { pinctrl-names = "default"; pinctrl-0 = <&product_id_pins>; compatible = "gpio-leds"; };
With These changes I have to use following commands to read gpios,
echo 26 > /sys/class/gpio/export echo 44 > /sys/class/gpio/export echo 45 > /sys/class/gpio/export cat /sys/class/gpio/gpio26/value cat /sys/class/gpio/gpio44/value cat /sys/class/gpio/gpio45/value
I have used compatible driver as "gpio-leds" which is not right.
And I wanted to create node for each gpio so that I can read gpio without exporting them.
Any suggestions ?