Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
notro opened this issue Dec 27, 2014 · 4 comments
Closed

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

notro opened this issue Dec 27, 2014 · 4 comments

Comments

@notro
Copy link
Contributor

notro commented Dec 27, 2014

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
@notro
Copy link
Contributor Author

notro commented Dec 27, 2014

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

@popcornmix
Copy link
Collaborator

ping @pelwell

@pelwell
Copy link
Contributor

pelwell commented Dec 28, 2014

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.

@notro
Copy link
Contributor Author

notro commented Jan 4, 2015

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

@notro notro closed this as completed Jan 4, 2015
pfpacket pushed a commit to pfpacket/linux-rpi-rust that referenced this issue Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants