How to configure QE port B pins as gpios in p1021

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to configure QE port B pins as gpios in p1021

ソリューションへジャンプ
653件の閲覧回数
amanagantivinod
Contributor III

Hi All,

I am working on p1021rdb. I need to configure PB10 as gpio pin, I wrote gpios property as

gpios = <&qe_pio_b 42 0>; inside a device node.

then used following functions

of_gpio_count(),

of_get_gpio_flags(),

gpio_request(),

Here I am getting error in the of_get_gpio_flags() function call..

When I started debugging the this I came to know that QE gpio controller chip is added to the list of gpio chip controllers with only 32 gpios .

Ddue to this of_gpio_simple_xlate() is throwing error while comparing the below condition

if(gpiospec->args[0] >= gc->ngpio)

return -EINVAL;

what is the number that should be passed in the device tree to configure PB10 as gpio, is there any document that explains pin numbers and their corresponding gpio numbers in the QE gpio chip controller?

As the driver code supports only 32 gpios at max, how to port map pins? it is not like PA0 pin maps to 0, PB0 maps to 32 ??

Your help is appreciated.

ラベル(1)
0 件の賞賛
1 解決策
390件の閲覧回数
r8070z
NXP Employee
NXP Employee

Have a great day,

binding/powerpc/fsl/cpm_qe/gpio.txt says

#gpio-cells : Should be two. The first cell is the pin number and the second cell is used to specify optional parameters (currently unused).

as example see

lxr.free-electrons.com/source/arch/powerpc/boot/dts/mpc8569mds.dts

or

lxr.free-electrons.com/source/arch/powerpc/boot/dts/mpc8360rdk.dts

i.e. for PB10 it should be <&qe_pio_b 10 0>

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
390件の閲覧回数
amanagantivinod
Contributor III

Hi Podiatchev,

Thanks for your reply.

I understand that we need to create a node for each parallel I/O ports, and gpios property should use the proper proper port node's phandle, pin number as below..

gpios=<&qe_pio_X, pin_num, 0>

in my device tree there was only port-B node, I added  port-A and tried its pins as gpios its working... :smileygrin:

Thanks once again!!

0 件の賞賛
391件の閲覧回数
r8070z
NXP Employee
NXP Employee

Have a great day,

binding/powerpc/fsl/cpm_qe/gpio.txt says

#gpio-cells : Should be two. The first cell is the pin number and the second cell is used to specify optional parameters (currently unused).

as example see

lxr.free-electrons.com/source/arch/powerpc/boot/dts/mpc8569mds.dts

or

lxr.free-electrons.com/source/arch/powerpc/boot/dts/mpc8360rdk.dts

i.e. for PB10 it should be <&qe_pio_b 10 0>

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛