ls1028ardb gpio control(/sys/class/gpio/export)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ls1028ardb gpio control(/sys/class/gpio/export)

Jump to solution
830 Views
pjw
Contributor II

Hi, I'm using ls1028ardb and Trying to control gpio.

 

It is possible to control gpio with the command below.

echo 500 > /sys/class/gpio/export

Entering the command creates the gpio500 folder.

What I want to do is to have the gpio500 folder present without having to enter a command at boot time.

So I'm modifying the dts file and I don't know how to modify it.

 

Below is the file contents of fsl-ls1028a.dtsi.

gpio1: gpio@2300000 {
compatible = "fsl,ls1028a-gpio","fsl,qoriq-gpio";
reg = <0x0 0x2300000 0x0 0x10000>;
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
little-endian;

};

gpio2: gpio@2310000 {
compatible = "fsl,ls1028a-gpio","fsl,qoriq-gpio";
reg = <0x0 0x2310000 0x0 0x10000>;
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
little-endian;
};

gpio3: gpio@2320000 {
compatible = "fsl,ls1028a-gpio","fsl,qoriq-gpio";
reg = <0x0 0x2320000 0x0 0x10000>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
little-endian;

};

And nothing is written in the dts file.

So, as a result of inputting below, "test1" was created in /sys/firmware/devicetree/base/soc/gpio@2300000/gpio but not in /sys/class/gpio/.

 

&gpio3 {
compatible="gpio-test";
pinctrl-names="default";
pinctrl-0 = <&gpio3>;
status = "okay";

test1{
label="test1";
gpios = <&gpio3 9 0>;
default-state = "on";
};
};

 

Please let me know if it is right to modify dts file and how to modify it if right.

0 Kudos
1 Solution
811 Views
yipingwang
NXP TechSupport
NXP TechSupport

If you need to trigger gpiolib operations from device tree at bootup itself then you will need to either have this logic in our existing driver's probe function or write your own driver. Basically you need to use API's like- gpiod_request, gpiod_export, gpiod_export_link etc in your driver.

View solution in original post

0 Kudos
1 Reply
812 Views
yipingwang
NXP TechSupport
NXP TechSupport

If you need to trigger gpiolib operations from device tree at bootup itself then you will need to either have this logic in our existing driver's probe function or write your own driver. Basically you need to use API's like- gpiod_request, gpiod_export, gpiod_export_link etc in your driver.

0 Kudos