Repository navigation
Conversation
Conflicts: arch/arm/mach-bcm2708/bcm2708.c
people who upgrade from earlier version may still use the *ex* gpio_to_irq() of *ex* <mach/gpio.h>. in order to alert them to the bogusness of the situation, re-add <mach/gpio.> - for the sole purpose of placing a #error in it which clarifies what's to be done.
|
What kind of problem are trying to solve here? |
|
See #389 for the origin of all the trouble. User msperl had the problem that gpio_to_irq() did not work in board setup code. Including <mach/gpio.h> before <linux/gpio.h> solved the problem for him and the issue was quiet since then. I used similar code in my board setup (also having a mcp2515, curiously). using the wrong gpio_to_irq() (that from <linux/gpio.h> and not from <mach/gpio.h>) leaves me with an early kernel crash, seeing only the 4-color test screen that the bootloader brings. After hours of trying I figured out what the problem was. I suspect me and msperl are not the only ones trying to wire SPI devices on the Raspberry, so I first cleaned up that gpio_to_irq() misnomer in <mach/gpio.h>. Naively, I have to admit. When bringing my code forward to rpi-3.12.y, I came across that NEED_MACH_GPIO_H thing which is defined there but not in rpi-3.11.y nor rpi-3.10.y. Things broke again because <linux/gpio.h>, err <asm/gpio.h>, err <asm-generic/gpio.h>, include <mach/gpio.h> in turn - apparently expecting a gpio_to_irq() macro to be defined there which I had removed. Headache. Digging, I found arch/arm/Kconfig say Took the "should be avoided when possible" literally, and that's what this pull request is about. I tested /sys/class/gpio functionality, as well as the "framework" gpio_to_irq() by inserting a call and debug output in a random (well, mcp251x.c) driver. |
|
I really don't understand why you needed to change the gpio_to_irq macro in your previous pull request. So I did a test, building a kernel from rpi-3.12.y going back before your commit: Verify that we have the right version Then I added the code for MCP2515 (from #389) config and build The kernel booted fine. Then I wanted to see what was done with the gpio_to_irq macro: bcm2708.i What did you do that gave you problems? Edit: |
|
On rpi-3.10.y, where I the commit is from, there is gpio_to_irq() in mach/gpio.h, as a macro suitable for use in, for example, spi_board_info. linux/gpio.h brings its own definition of gpio_to_irq() (as a function) because NEED_MACH_GPIO_H is not set for the bcm2708 platform. To fix this, I renamed gpio_to_irq() in mach/gpio.h to __bcm2708_gpio_to_irq(). Now that I have more understanding, I'd say the proper fix would have simply been to define NEED_MACH_GPIO_H for the platform, so linux/gpio.h took the definition of gpio_to_irq() right from mach/gpio.h. On rpi-3.12.y, NEED_MACH_GPIO_H is defined. linux/gpio.h sees mach/gpio.h and you get gpio_to_irq() from there. Provided that it is there. My commit had removed it, so things work before that commit, and don't afterwards. So: I'd propose to revert commit f04ff75 and ignore my pull request, and pull #497 (reversal) instead. |
|
@jfasch would you suggest adding NEED_MACH_GPIO_H to 3.10.y? |
|
Yes, this would be the least confusing fix for the original issue. There are rumours though that NEED_MACH_GPIO_H prevents devicetree from happening. I don't understand the details, but I sure understand that per-platform macro definitions don't make the kernel platform independent. So, given that NEED_MACH_GPIO_H is the way to go:
I can do that, together with a bit of testing (hints appreciated), over the weekend if you want. |
I assume there was a build error without it, but can't remember the exact details. |
|
Ok. |
|
This is the commit that introduced NEED_MACH_GPIO_H: 0146422 It is apparently needed to make gpio_to_irq work in the board setup code. Drivers work fine without it. |
|
@notro, @popcornmix: here's the pull requests I promised to create.
Each of them
|
A recent commit of mine, f04ff75, removes the macro gpio_to_irq() from mach/gpio.h. Digging through the whole mess of the various gpio.h incarnations, I found that it's probably best to rename that file to gpio_irq.h, and to remove NEED_MACH_GPIO_H from the architecture.
See http://lists.infradead.org/pipermail/linux-arm-kernel/2012-September/118375.html which led me to the point that this has to go.