Jump to content

How to set correctly GPIO flags in dts files?


Recommended Posts

Posted (edited)

Hi,

 

I managed to make w1-GPIO work in Orange Pi Zero v3 for, for example, the DS18B20 sensor.

 

However, I have some doubts about setting the GPIO flags for w1-gpio. Many examples provide flags in the form

 

gpios = <&pio 0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;

 

but in the dts file when I use this form it does not work (syntax error) so I have to provide the flags in digital form.

 

A description of flags and bits is here

 

https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h

 

If I would like to set GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN then the digital value for these bits will be for set bits: 0110000 =  48

 

because GPIO_OPEN_DRAIN it is (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN)

 

Please help me and confirm whether I understood it correctly I wanted to get rid of the message in the logs for w1-gpio

 

[ 4.994183] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file

 

which understands that I need to set the GPIO flag GPIO_OPEN_DRAIN in the dts file

 

 

I see one problem with this source https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt

where a number of bits to set is 6 in source https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h

number of bits to set is 7

 

 

I hope I posted this question in the right section, if not please move it

Edited by TRay
Link to comment
Share on other sites

Posted (edited)

Reading many others documents about OPEN DRAIN flag , OZPI v3 and others like Raspberry Pi don't support Open DRAIN, but they should work in emulated mode, switching between input and output-driving-low. So for this reason if we set flag for GPIO with OPEN DARIN it looks not influence and not need setting this flag for w1-gpio for this SBC

 

 

Edited by TRay
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines