Modify

Opened 2 years ago

Last modified 2 years ago

#21889 new defect

1-Wire, w1-gpio-custom, Failed to parse gpio property for data pin (-2) (bcm963xx)

Reported by: virtual@… Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Chaos Calmer 15.05
Keywords: 1wire w1-gpio Cc:

Description

CHAOS CALMER (Chaos Calmer, r48666)
board name: F@ST2704V2
Broadcom 0x6328 CPU revision b0

cat /sys/kernel/debug/gpio
GPIOs 480-511, platform/10000084.gpio-controller, bcm63xx-gpio.0:
root@OpenWrt:~# insmod w1-gpio-custom bus0=0,489,0
root@OpenWrt:~# cat /sys/kernel/debug/gpio
GPIOs 480-511, platform/10000084.gpio-controller, bcm63xx-gpio.0:
root@OpenWrt:~# dmesg -c
[75858.376000] Custom GPIO-based W1 driver version 0.1.1
[75858.380000] w1-gpio w1-gpio.0: Failed to parse gpio property for data pin (-2)
[75858.388000] w1-gpio: probe of w1-gpio.0 failed with error -2
root@OpenWrt:~# rmmod w1-gpio-custom
root@OpenWrt:~# insmod w1-gpio-custom bus0=1,9,0
root@OpenWrt:~# cat /sys/kernel/debug/gpio
GPIOs 480-511, platform/10000084.gpio-controller, bcm63xx-gpio.0:
root@OpenWrt:~# dmesg -c
[75898.152000] Custom GPIO-based W1 driver version 0.1.1
[75898.156000] w1-gpio w1-gpio.1: Failed to parse gpio property for data pin (-2)
[75898.164000] w1-gpio: probe of w1-gpio.1 failed with error -2

test spi-gpio

root@OpenWrt:~# insmod spi-gpio-custom bus0=3,489,490,491,0,1000
root@OpenWrt:~# cat /sys/kernel/debug/gpio
GPIOs 480-511, platform/10000084.gpio-controller, bcm63xx-gpio.0:
 gpio-489 (spi_gpio.3          ) out lo
 gpio-490 (spi_gpio.3          ) out lo
 gpio-491 (spi_gpio.3          ) in  hi
root@OpenWrt:~# dmesg -c
[76744.632000] Custom GPIO-based SPI driver version 0.1

On Barrier Breaker all works.

Similar problem?:
/ticket/19695.html

Attachments (0)

Change History (1)

comment:1 Changed 2 years ago by virtual@…

Probably it is not correct, but works.
The example in linux-3.18.23/drivers/i2c/busses/i2c-gpio.c looked

/* First get the GPIO pins; if it fails, we'll defer the probe. */

linux-3.18.23/drivers/w1/masters/w1-gpio.c

static int w1_gpio_probe_dt(struct platform_device *pdev)
{
        struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct device_node *np = pdev->dev.of_node;
        int gpio;

        pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return -ENOMEM;

        if (of_get_property(np, "linux,open-drain", NULL))
                pdata->is_open_drain = 1;
++if (pdev->dev.of_node) {        /*(Virtual) of_node can be absent*/
        gpio = of_get_gpio(np, 0);
        if (gpio < 0) {
                if (gpio != -EPROBE_DEFER)
                        dev_err(&pdev->dev,
                                        "Failed to parse gpio property for data pin (%d)\n",
                                        gpio);

                return gpio;
        }
        pdata->pin = gpio;

        gpio = of_get_gpio(np, 1);
        if (gpio == -EPROBE_DEFER)
                return gpio;
        /* ignore other errors as the pullup gpio is optional */
        pdata->ext_pullup_enable_pin = gpio;

        pdev->dev.platform_data = pdata;
++}
        return 0;
}

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.