raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.1k stars 4.97k forks source link

1-wire hard coded to GPIO4 #368

Closed marknorgren closed 10 years ago

marknorgren commented 11 years ago

Currently access to 1-wire sensors is hard coded to GPIO pin 4.

This should be fixed to allow configuration to any of the available GPIO ports.

https://github.com/raspberrypi/linux/blob/rpi-3.6.y/arch/arm/mach-bcm2708/bcm2708.c#L80-L81

popcornmix commented 11 years ago

The 1-wire driver was a pull request from the community (@FrankBuss) I'd be willing to accept a pull requets to add the functionality you suggest, but it is not something I use or can test myself, so I won't be adding it.

FrankBuss commented 11 years ago

IIRC the idea of @bootc was to use the new pinmux system, when it is available. I don't know the current state of the implementation of it for the Raspberry Pi. So maybe we should wait until it is ported. Currently it is no problem, if compiled as a module, because the pin is reserved as 1-wire only, when the module is loaded. But if this needs some more time, a patch for a module parameter for it would be good, with default to GPIO4 for backward compatibility. Should be easy to implement.

@popcornmix: if you want a 1-wire device for testing (DS2411 temperature sensor), I would be glad to send you one for free, including the required pull-up resistor and jumper wires.

popcornmix commented 11 years ago

@FrankBuss Thanks for the offer, but really for the more niche drivers, I'd prefer to leave new features to people who are actually using that driver. I'll accept a PR to make the GPIO pin configurable (assuming it looks okay and no one objects).

I don't imagine a pinmux driver is likely without a PR from someone who is actively using it and willing to maintain it. I think there may be a pinmux driver in the upstream 2835 tree, but that is a very different kernel to the one we are used to, and currently has a number of missing features. Whilst it is a long term goal to move to it, I don't see that happening for some time.

FrankBuss commented 11 years ago

I don't need it configurable, but if @mrkd implements it, I can verify it. I chose GPIO4, because it has no other important function. ALT0 is GPCLK0, but there is GPCLK1 as well, and most users never need ALT5 for ARM-JTAG.

cleverca22 commented 10 years ago

this seems to be the same basic problem as #391 and the stuff i ran into with mpr121 on i2c, something device tree would solve easily

all 3 things are doing platform_device_register with some platform data, to set what the kernel expects is board design info that never changes

from looking at arch/arm/mach-bcm2708/bcm2708.c, it looks like you cant easily change it at runtime, it would have to be done with the kernel command line, or break the code out into a module that only has 5 lines of code

popcornmix commented 10 years ago

This was made configurable here: https://github.com/raspberrypi/linux/commit/0dd803a572ee4fe5c8539c79069e85013d2b0d71