-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Enable ARCH_BCM2835 for downstream use #1099
Conversation
@pelwell The mmc drivers get a slightly different build on ARCH_BCM2835. Is it possible to have the same build on all? |
It was never clear to me why the builds would handle SDIO interrupts differently:
I found this patch (bf3b5ec) that introduced sdio_run_irqs, but I don't know why the use int the mmc driver is conditional on the architecture. The differences in the sdhost driver are academic since we don't (and probably never will) use the SDIO capabilities - that code has never been run. The 2835 configuration seems to be the more up-to-date since it is using the new facility, so perhaps I could try making the change unconditionally. Unfortunately I'm not in a position to test SDIO functionality, which makes me reluctant to commit a change like that. |
There is only one in-kernel user of this new code, and that's the sdhci subsystem: mmc: sdhci: convert to new SDIO IRQ handling I added a printk to bcm2835_mmc_thread_irq(), but it didn't fire. So I suggest we just rip out this conditional code. It's been a year since the patch was added and there has been no other drivers converting to it, so it can't be that important.
I think it's important that the mmc driver behaves in the same way on all architectures if possible. |
See #1102 |
I've succeeded in getting the upstream interrupt controller to work for DT-enabled Pi 1 builds. Without DT it falls back to the old armctrl code. This patch (https://gist.github.com/pelwell/d41ec7fb7db4d1136eb5) should be applied after all of the others in this PR - perhaps you could append it, @notro? |
For Pi 2 there will be a race between the upstreaming of the BCM2836 support and our removal of non-DT support. If BCM2836 wins then we can produce a similar patch for Pi 2, otherwise we just remove the old armctrl driver and switch wholesale. Tested on Pi 1 and Pi 2, with and without Device Tree. |
@notro Can you rebase against 4.2-rc7, and consider appending my patch? |
Building fails on ARCH_BCM2835:
Why was this change necessary: - init_FIQ(FIQ_START);
+ init_FIQ(NUMBER_IRQS); I'm restarting the build now. I'll let you know when I have tried it. |
Because of lines like this (https://github.com/notro/linux/commit/bab25463bb5842694f73de42bdf7edec600f2b7c#diff-b412d3553bc228bafd652cac486b891fR107):
i.e. You have mapped the FIQs starting NUMBER_IRQS after the IRQs, and init_FIQ indicates where the FIQs start. Without this change it can't associate the arriving FIQ interrupts with the correct device. |
The irq-bcm2835.c change doesn't work on ARCH_BCM2835. Lots of:
Reverting the change made it work again. I remember that getting the fiq patch working was trial and error, so it's hard to come up with the rationale for this now :-) I guess you needed this change to make it work on ARCH_BCM2708? |
Yes, it was necessary. I'll try the 2835 build tomorrow. |
Add a duplicate irq range with an offset on the hwirq's so the driver can detect that enable_fiq() is used. Tested with downstream dwc_otg USB controller driver. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Currently poweroff/halt results in a reboot on the Raspberry Pi. The firmware uses the RSTS register to know which partiton to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. Partiton 63 is a special partition used by the firmware to indicate halt. The firmware made this change in 19 Aug 2013 and was matched by the downstream commit: Changes for new NOOBS multi partition booting from gsh Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Tested-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
These commands where used to make this commit: : Get changed and new config values from a merge ./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg : Remove these options cat << EOF > filter CONFIG_ARCH_BCM2708 CONFIG_BCM2708_DT CONFIG_ARM_PATCH_PHYS_VIRT CONFIG_PHYS_OFFSET CONFIG_CMDLINE CONFIG_BCM2708_WDT CONFIG_HW_RANDOM_BCM2708 CONFIG_SPI_BCM2708 EOF : Apply filter grep -F -v -f filter merge.cfg > filtered.cfg : Add these options : watchdog contains the restart/poweroff code. cat << EOF > added.cfg CONFIG_WATCHDOG=y CONFIG_BCM2835_WDT=y CONFIG_MISC_FILESYSTEMS=y CONFIG_I2C_BCM2835=m CONFIG_SND_BCM2835_SOC_I2S=m EOF : Create new config ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg : Verify ARCH=arm make oldconfig : Update bcm2835_defconfig ARCH=arm make savedefconfig cp defconfig arch/arm/configs/bcm2835_defconfig : Clean up rm merge.cfg filter filtered.cfg added.cfg defconfig Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
This is a hack until a proper solution is agreed upon. Martin Sperl is doing some work in this area. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Rebased |
I have an updated patch here that builds and works on ARCH_BCM2835 as well, and without changing any of the upstream code. There were two related problems:
You will see there is a constant offset of 72 between corresponding FIQs and IRQs, and 72 is FIQ_START. On MACH_BCM2708, CONFIG_SPARSE_IRQ is not set, so there are no legacy IRQs and it tries to use the identity mapping for IRQ numbers. The allocator avoids 0 as an illegal value, so maps BANK0 to 1-8. But it isn't necessary to skip 32 or 64, so the mapping ends up looking like this:
Here the FIQ->IRQ offset is 95 for BANK0 and 96 for BANK1 and BANK2. This explains why NUMBER_IRQs (96) worked as the argument to init_FIQ, but it wouldn't have worked for the BANK0 FIQs and breaks ARCH_BCM2835 builds. The workaround I have found is to provide an implementation of arch_dynirq_lower_bound (a weak function) that pushes the IRQ BANK0 numbers up, pulls the FIQ BANK1+2 numbers down to 104-167, and leaves the other numbers alone:
This restores the fixed offset, and keeps it at 72, matching ARCH_BCM2835 and removing the need to change irq-bcm2835. |
Thanks for the detailed explanation. |
I'm happy with this. @popcornmix? |
This PR breaks booting for me with bcm2709_defconfig. NFS boot fails. See: |
@pelwell looks like "BCM2708: Use upstream interrupt driver on all Pi1's" is the commit that breaks booting on Pi2. |
There's a squash patch here that should theoretically restore normal service. |
squash patch does fix the bcm2709_defconfig build. |
Although the aim is to delete the old armctrl driver, that can't happen while non-DT configurations are still supported. This commit enables use of the new FIQ-enabled upstream irqchip driver when DT is enabled on all BCM2835-based RPi platforms (Models A, B, A+, B+ & CM). BCM2836-based platforms (Pi 2) will get the same treatment at a later date, unless non-DT support has already been withdrawn.
Squashed and tested on ARCH_BCM2708. |
Enable ARCH_BCM2835 for downstream use
This PR makes ARCH_BCM2835 functionally equivalent to ARCH_BCM2708.
spi-bcm2708 is dropped now that spi-bcm2835 is the default on 4.1.
i2c-bcm2708 is kept, because i2c-bcm2835 has not seen any downstream use yet and it doesn't work with a I2C OLED display I have.
The Device Tree files are copied from their 2708 counterparts.
Issues
Onboard audio is disabled by default regardless of whether the module is loaded or not.
apb_pclk and uart0_pclk are defined both in bcm2708_common.dtsi and in clk-bcm2835 resulting in an error in the boot messages from the latter.
I haven't found a way to disable a DT clock, the status property is not checked and changing the compatible string results in no serial output.
This is a purely cosmetic issue.
Test details
Serial & Revision
Thermal
cpufreq
vc_mem
/dev/vcio
bcm2708_fb Colour palette
bcm2708_fb Ioctl: FBIOPAN_DISPLAY and FBIO_WAITFORVSYNC
bcm2708_fb Blanking
SPI is tested with a PiScreen display.
Uart1 is tested.