Skip to content

3.18 non-DT mode: can't request gpios #749

Closed

Description

@notro

In non-DT mode it's not possible to request gpios.
I haven't looked into what's causing this.

sudo BRANCH=next rpi-update

/boot/config.txt

device_tree=

Boot messages

[    0.000000] Linux version 3.18.1+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #731 PREEMPT Fri Dec 19 19:16:36 GMT 2014

[    0.000000] Machine: BCM2708

[    6.348587] platform leds-gpio: Driver leds-gpio requests probe deferral
[    7.032763] platform leds-gpio: Driver leds-gpio requests probe deferral
[    7.248651] platform leds-gpio: Driver leds-gpio requests probe deferral
[    7.419418] random: nonblocking pool is initialized
[   11.916121] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   12.474687] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   13.231775] platform leds-gpio: Driver leds-gpio requests probe deferral
[   13.259054] platform leds-gpio: Driver leds-gpio requests probe deferral

sysfs

root@raspberrypi:/sys/class/gpio# echo 18 > export
-bash: echo: write error: No such device

Activity

  1. notro commented on Dec 27, 2014

    @notro
    ContributorAuthor

    The problem is that there's no pinctrl device in non-DT mode, but the driver expects it to be.
    Since there's no device it returns -EPROBE_DEFER.

    arch/arm/mach-bcm2708/bcm2708_gpio.c

    static int bcm2708_gpio_request(struct gpio_chip *chip, unsigned offset)
    {
        return pinctrl_request_gpio(chip->base + offset);
    }
    
    

    With PR #748, bcm2708_gpio will not be used in DT mode anymore.
    Maybe bcm2708_gpio_request() and bcm2708_gpio_free() can be removed?

    They came with this commit: d9d191d

  2. popcornmix commented on Dec 28, 2014

    @popcornmix
    Collaborator
  3. pelwell commented on Dec 28, 2014

    @pelwell
    Contributor

    I was concerned that there was no tracking of GPIO usage, which is why I added them, but it turns out that an earlier upstream commit intentionally allows static pinctrl and dynamic GPIO allocations to overlap. As a result, it is necessary for drivers using GPIO allocations to also use pinctrl to ensure that a pin isn't used by both systems simultaneously, so my addition of those methods is pretty pointless.

    Go ahead and remove them.

  4. notro commented on Jan 4, 2015

    @notro
    ContributorAuthor

    Works fine in non-DT mode now that #748 is applied.

  5. added a commit that references this issue on Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions