-
Notifications
You must be signed in to change notification settings - Fork 5k
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
BCM270x: Move power module #980
Conversation
Make the power module available on ARCH_BCM2835 by moving it. The module turns on USB power making it possible to boot ARCH_BCM2835 directly with the VC bootloader. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
The VideoCore bootloader concatenates the bootargs property together with /boot/cmdline.txt and includes it's own set of options. Set bootargs to an empty string to behave like BCM270x. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
@pelwell It would have been nice if mkknlimg could tag the ARCH_BCM2835 kernel specially so the firmware can set device_tree= automatically for us. |
It's okay by me. |
I can arrange for the tagging and DTB selection, but I'm not available until Wednesday. |
@notro My proposal is to put an "architecture" prefix into the trailer, where the default is bcm2708 or bcm2709, and then arrange that mkknlimg adds bcm2835/bcm2836 for you (either automatically or as a command line option). For this to work, the bcm2835/bcm2836 .dtbs will have to maintain the same filename structure as the bcm2708/bcm2709 equivalents, e.g. bcm2836-rpi-2-b.dtb. |
That seems to be the case. From [PATCH 3/9] ARM: Make a copy of the 2835 dts for the 2836.:
I don't know what filenames Warren refers to in his follow up:
But anyway, I believe dts files will be the last bit to match mainline (if ever), so even if we end up diverging here it's no big deal. |
Tested on a Pi 1 and Pi 2, with and without DT. Merging. |
@notro How are you booting ARCH_BCM2835 builds? Are you using kernel_old with custom startup code? I get a boot failure because the machine ID isn't supported:
|
I just add this to /boot/config.txt:
|
Are you building with an unmodified bcm2835_defconfig? |
Yes. If you want onboard audio you currently have to manually enable: CONFIG_SOUND, CONFIG_SND, CONFIG_SND_BCM2835 I look forward to having an ARCH_BCM2835 tagged kernel, because I frequently forget to toggle the device_tree= setting when I switch between kernels, ending up with a system that doesn't boot. |
Unless you are using either a custom kernel header (or u-boot) and kernel_old, or a modified bcm2835 build that expects the 0xc42/3138 magic number, then I don't understand how it is working for you. Can you upload your kernel image somewhere and briefly outline your build steps? |
Are you tagging your kernel with the
|
Yes - the problem isn't DT support, it's the machine ID, which the firmware sets to 0xc42 for all Pi's. |
/boot files: http://tronnes.org/downloads/bcm2835-vcboot.tar.gz |
Thanks. |
The error you get indicates that the kernel doesn't find a matching Device Tree, because the error you get is the atags fallback. void __init setup_arch(char **cmdline_p)
{
const struct machine_desc *mdesc;
setup_processor();
mdesc = setup_machine_fdt(__atags_pointer);
if (!mdesc)
mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type); http://lxr.free-electrons.com/source/arch/arm/kernel/setup.c#L895 const struct machine_desc * __init
setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
{
...
if (!mdesc) {
early_print("\nError: unrecognized/unsupported machine ID"
" (r1 = 0x%08x).\n\n", machine_nr);
dump_machine_table(); /* does not return */
} http://lxr.free-electrons.com/source/arch/arm/kernel/atags_parse.c#L182 |
I'd just reached the same conclusion. A stray dtoverlay was failing because of missing labels and aborting the DT support. With an empty config.txt it boots. |
The firmware patch that implements this feature depends on a more complex patch to the loader. Once we're happy that both patches are good they will appear in a future release. |
Thank you. |
See: raspberrypi/linux#985 firmware: MMAL queue: extra protection on the sanity check firmware: MMAL: reset buffer recommended values on switching back to raw pixels firmware: OV5647: Remove readback of I2C writes firmware: MMAL: Add rawcam component and required framework changes firmware: Add MMAL to IL mapping for rawcam parameters firmware: Image_encode: Add support or YUYV input source firmware: OV5647 tuning: Add the fixed ISO preview modes firmware: Replacing board rev functions with board_info library firmware: arm_loader: Add support for ARCH_BCM2835 builds See: raspberrypi/linux#980 (comment)
See: raspberrypi/linux#985 firmware: MMAL queue: extra protection on the sanity check firmware: MMAL: reset buffer recommended values on switching back to raw pixels firmware: OV5647: Remove readback of I2C writes firmware: MMAL: Add rawcam component and required framework changes firmware: Add MMAL to IL mapping for rawcam parameters firmware: Image_encode: Add support or YUYV input source firmware: OV5647 tuning: Add the fixed ISO preview modes firmware: Replacing board rev functions with board_info library firmware: arm_loader: Add support for ARCH_BCM2835 builds See: raspberrypi/linux#980 (comment)
@popcornmix has pushed the updated firmware. |
That worked just fine, thank you! |
@pelwell Booting ARCH_BCM2835 with an overlay that references an unknown label prevents the kernel from booting:
I guess the loader falls back to atags when there is a problem with the overlay, but this is not good on ARCH_BCM2835. Better drop the overlay(s) and use the DT as-is. |
@popcornmix already has a firmware patch from me to make the loader much more resilient when faced with errors like that. |
The latest firmware (released yesterday) includes the patch. |
See: raspberrypi/linux#985 firmware: MMAL queue: extra protection on the sanity check firmware: MMAL: reset buffer recommended values on switching back to raw pixels firmware: OV5647: Remove readback of I2C writes firmware: MMAL: Add rawcam component and required framework changes firmware: Add MMAL to IL mapping for rawcam parameters firmware: Image_encode: Add support or YUYV input source firmware: OV5647 tuning: Add the fixed ISO preview modes firmware: Replacing board rev functions with board_info library firmware: arm_loader: Add support for ARCH_BCM2835 builds See: raspberrypi/linux#980 (comment)
Reduce differences with mainline
commit a2ccf46 upstream. rcutree_report_cpu_starting() must be called before cpu_probe() to avoid the following lockdep splat that triggered by calling __alloc_pages() when CONFIG_PROVE_RCU_LIST=y: ============================= WARNING: suspicious RCU usage 6.6.0+ #980 Not tainted ----------------------------- kernel/locking/lockdep.c:3761 RCU-list traversed in non-reader section!! other info that might help us debug this: RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 1 lock held by swapper/1/0: #0: 900000000c82ef98 (&pcp->lock){+.+.}-{2:2}, at: get_page_from_freelist+0x894/0x1790 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.0+ #980 Stack : 0000000000000001 9000000004f79508 9000000004893670 9000000100310000 90000001003137d0 0000000000000000 90000001003137d8 9000000004f79508 0000000000000000 0000000000000001 0000000000000000 90000000048a3384 203a656d616e2065 ca43677b3687e616 90000001002c3480 0000000000000008 000000000000009d 0000000000000000 0000000000000001 80000000ffffe0b8 000000000000000d 0000000000000033 0000000007ec0000 13bbf50562dad831 9000000005140748 0000000000000000 9000000004f79508 0000000000000004 0000000000000000 9000000005140748 90000001002bad40 0000000000000000 90000001002ba400 0000000000000000 9000000003573ec8 0000000000000000 00000000000000b0 0000000000000004 0000000000000000 0000000000070000 ... Call Trace: [<9000000003573ec8>] show_stack+0x38/0x150 [<9000000004893670>] dump_stack_lvl+0x74/0xa8 [<900000000360d2bc>] lockdep_rcu_suspicious+0x14c/0x190 [<900000000361235c>] __lock_acquire+0xd0c/0x2740 [<90000000036146f4>] lock_acquire+0x104/0x2c0 [<90000000048a955c>] _raw_spin_lock_irqsave+0x5c/0x90 [<900000000381cd5c>] rmqueue_bulk+0x6c/0x950 [<900000000381fc0c>] get_page_from_freelist+0xd4c/0x1790 [<9000000003821c6c>] __alloc_pages+0x1bc/0x3e0 [<9000000003583b40>] tlb_init+0x150/0x2a0 [<90000000035742a0>] per_cpu_trap_init+0xf0/0x110 [<90000000035712fc>] cpu_probe+0x3dc/0x7a0 [<900000000357ed20>] start_secondary+0x40/0xb0 [<9000000004897138>] smpboot_entry+0x54/0x58 raw_smp_processor_id() is required in order to avoid calling into lockdep before RCU has declared the CPU to be watched for readers. See also commit 29368e0 ("x86/smpboot: Move rcu_cpu_starting() earlier"), commit de5d9da ("s390/smp: move rcu_cpu_starting() earlier") and commit 99f070b ("powerpc/smp: Call rcu_cpu_starting() earlier"). Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit a2ccf46 upstream. rcutree_report_cpu_starting() must be called before cpu_probe() to avoid the following lockdep splat that triggered by calling __alloc_pages() when CONFIG_PROVE_RCU_LIST=y: ============================= WARNING: suspicious RCU usage 6.6.0+ #980 Not tainted ----------------------------- kernel/locking/lockdep.c:3761 RCU-list traversed in non-reader section!! other info that might help us debug this: RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 1 lock held by swapper/1/0: #0: 900000000c82ef98 (&pcp->lock){+.+.}-{2:2}, at: get_page_from_freelist+0x894/0x1790 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.0+ #980 Stack : 0000000000000001 9000000004f79508 9000000004893670 9000000100310000 90000001003137d0 0000000000000000 90000001003137d8 9000000004f79508 0000000000000000 0000000000000001 0000000000000000 90000000048a3384 203a656d616e2065 ca43677b3687e616 90000001002c3480 0000000000000008 000000000000009d 0000000000000000 0000000000000001 80000000ffffe0b8 000000000000000d 0000000000000033 0000000007ec0000 13bbf50562dad831 9000000005140748 0000000000000000 9000000004f79508 0000000000000004 0000000000000000 9000000005140748 90000001002bad40 0000000000000000 90000001002ba400 0000000000000000 9000000003573ec8 0000000000000000 00000000000000b0 0000000000000004 0000000000000000 0000000000070000 ... Call Trace: [<9000000003573ec8>] show_stack+0x38/0x150 [<9000000004893670>] dump_stack_lvl+0x74/0xa8 [<900000000360d2bc>] lockdep_rcu_suspicious+0x14c/0x190 [<900000000361235c>] __lock_acquire+0xd0c/0x2740 [<90000000036146f4>] lock_acquire+0x104/0x2c0 [<90000000048a955c>] _raw_spin_lock_irqsave+0x5c/0x90 [<900000000381cd5c>] rmqueue_bulk+0x6c/0x950 [<900000000381fc0c>] get_page_from_freelist+0xd4c/0x1790 [<9000000003821c6c>] __alloc_pages+0x1bc/0x3e0 [<9000000003583b40>] tlb_init+0x150/0x2a0 [<90000000035742a0>] per_cpu_trap_init+0xf0/0x110 [<90000000035712fc>] cpu_probe+0x3dc/0x7a0 [<900000000357ed20>] start_secondary+0x40/0xb0 [<9000000004897138>] smpboot_entry+0x54/0x58 raw_smp_processor_id() is required in order to avoid calling into lockdep before RCU has declared the CPU to be watched for readers. See also commit 29368e0 ("x86/smpboot: Move rcu_cpu_starting() earlier"), commit de5d9da ("s390/smp: move rcu_cpu_starting() earlier") and commit 99f070b ("powerpc/smp: Call rcu_cpu_starting() earlier"). Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This makes it possible to boot ARCH_BCM2835 directly from the VideoCore bootloader.
The power module turns on USB power, so u-boot is not strictly necessary anymore.
Tested on Pi1 and Pi2 regular kernel + ARCH_BCM2835.
On ARCH_BCM2835 add dtb to /boot/config.txt