Dear all

I am trying to get multiple (currently 2) onewire (w1-gpio) devices running 
at the same time with two entries in the filesystem
/sys/bus/w1/devices/w1_bus_master1
/sys/bus/w1/devices/w1_bus_master2
and mapping to two pins (in my case  pins P8.39 and P8.41). I am using a 
BeagleBone Green running Debian 9 with kernel 4.14.71-ti-r80. 

Unfortunately, I could not get it working so far. The closest I got, is the 
device tree overlay file below (based on BB-W1-P9.12-00A0.dts from 
https://github.com/beagleboard/bb.org-overlays):
/*
 * Copyright (C) 2015 Robert Nelson <[email protected]>
 *
 * Virtual cape for onewire on connector pins P8.39 and P8.41
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black", 
"ti,beaglebone-green";

    /* identification */
    part-number = "BB-W1-test";
    version = "00A0";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P8.39",
        "P8.41";

    /*
     * Free up the pins used by the cape from the pinmux helpers.
     */
    fragment@0 {
        target = <&ocp>;
        __overlay__ {
            P8_39_pinmux { status = "disabled"; };
            P8_41_pinmux { status = "disabled"; };
        };
    };

    fragment@1 {
        target = <&am33xx_pinmux>;
        __overlay__ {

            dallas_w1_pins_tx: pinmux_dallas_w1_pins@0 {
                pinctrl-single,pins = <
                    BONE_P8_39 0x37
                >;
            };

            dallas_w1_pins_rx: pinmux_dallas_w1_pins@1 {
                pinctrl-single,pins = <
                    BONE_P8_41 0x37
                >;
            };
        };
    };

    fragment@2 {
        target-path="/";
        __overlay__ {

            w1_1: onewire@0 {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&dallas_w1_pins_tx>;

                compatible = "w1-gpio";
                gpios = <
                  &gpio2 12 GPIO_ACTIVE_HIGH
                >;
            };

            w1_2: onewire@1 {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&dallas_w1_pins_rx>;

                compatible = "w1-gpio";
                gpios = <
                    &gpio2 10 GPIO_ACTIVE_HIGH
                >;
            };
        };
    };
};



With this device tree overlay, I get one fully functional onewire device on 
P8.41, but the second device on P8.39 fails to setup:

Error messages in dmesg output:
[   27.032134] pinctrl-single 44e10800.pinmux: pin PIN44 already requested 
by onewire@1; cannot claim for onewire@0
[   27.153240] pinctrl-single 44e10800.pinmux: pin-44 (onewire@0) status -22
[   27.224225] pinctrl-single 44e10800.pinmux: could not request pin 44 
(PIN44) from group pinmux_dallas_w1_pins  on device pinctrl-single
[   27.330704] w1-gpio onewire@0: Error applying setting, reverse things 
back
[   27.442753] w1-gpio: probe of onewire@0 failed with error -22

As a consequence, in the filesystem I only see one device:
/sys/bus/w1/devices/w1_bus_master1

If I comment out one section (w1_1 or w1_2) in fragment@2, I get one 
working onewire device on either P8.39 or P8.41. 

I would be happy for any suggestions or help to get both onewire devices 
running at the same time. 

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" 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/beagleboard/1d799ac2-7bd9-4c15-91a0-bec7086d0730%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to