On 10/30/23 18:08, Maxime Ripard wrote:
A syntax probably more straightforward would be
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
&{/} {
onewire {
compatible = "w1-gpio";
gpios = <&pio 1 0 GPIO_PULL_UP>;
status = "okay";
};
};
Thanks!
Much nicer actually :D
Just the #include does not work for me, unless I preprocess the dts file
with:
cpp -nostdinc -undef -x assembler-with-cpp -I
/usr/src/linux-headers-5.10.180-olimex/include/ sun50i-a64-w1-gpio.dts
sun50i-a64-w1-gpio.preprocessed
It is surprising to me that it works even if the pin 32 (PB0 on Allwinner
A64) is marked as output :)
The GPIO controller doesn't support simultaneous input and output and
1-wire needs to do both so it flips back and forth between input and
output.
Ok, thanks!
[] Driver for 1-wire Dallas network protocol.
[] sun50i-a64-pinctrl 1c20800.pinctrl: pin PB0 already requested by
onewire_device; cannot claim for 1c20800.pinctrl:32
[] sun50i-a64-pinctrl 1c20800.pinctrl: pin-32 (1c20800.pinctrl:32)
status -22
[] w1-gpio onewire_device: gpio_request (pin) failed
[] w1-gpio: probe of onewire_device failed with error -22
The problem is that the GPIO reference and the pinctrl reference for the
same pin conflict. In this case, the only thing you need the pinctrl
reference for is the pull-up, which you can achieve with a GPIO flag.
However, for the more general case, you may need to apply some other
pinconf setting to a GPIO pin, so we may need to fix this.
For me, it is surprising how other people do not have my same issue.
For example, in the instructions on the wiki [7], in the DTS from Armbian
[8] and in the one used by RaspberryPi (on Broadcom) [9] they all use the
same pin in two fragments. I tried using all of these and always got the
"already requested by" error.
It also depends on the general design of the GPIO controller. Ours
doesn't support both GPIO and some other feature at the same time, they
are exclusive, some do.
The GPIO framework support both though, and by default will allow to
request a GPIO and another pin muxing at the same time. This was fixed
in 2017, so the wiki might be older than that and have never been
updated. armbian is probably in the same case.
The RaspberryPi driver might have a bug or a different design that
allows what we can't do.
Ok, I will try to report this to the Armbian people.
A partially unrelated question, feel free to ignore me if I go off-topic:
I am going to use this 1-wire connection for measuring a chain of 12
DS18B20 thermometers. Currently, I am still using only 1 thermometer, I
am using an external pull up (10 kOhm) and an external 5V power supply,
connecting the 5V from the A64-olinuxino to the 5V of the power supply
(otherwise it was not working).
So the question is: if I use the external pull up, should I also keep
GPIO_PULL_UP in the DTS?
Many thanks for your help!
Ilario
--
Ilario
[email protected]
[email protected]
--
You received this message because you are subscribed to the Google Groups
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/linux-sunxi/6b8b4deb-aea3-47cb-9848-7b116683c6d8%40gmail.com.