aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/broadcom/bcm2835
Commit message (Collapse)AuthorAgeFilesLines
* bcm2835_virtgpio: Add driver for virtual GPIO controller on some RPi modelsTetsuya Uemura9 days2-0/+359
| | | | | | | | | | | | | This driver enables bcm2835-virtgpio GPIO controller found on RPi3B and some CM boards. On which, the ACT (green) LED is connected to this controller. It is essential for FreeBSD to have this driver to control this LED. It will be exposed via gpioled(4). Reviewed by: mhorne MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51456
* arm bcm2835: Appease a warning from GCCJohn Baldwin2026-02-171-1/+1
| | | | | | | No code currently uses the vc_audio_msg_type_names array of strings. Reported by: -Wunused-variable Differential Revision: https://reviews.freebsd.org/D55162
* arm/broadcom: Fix a typo in a source code commentGordon Bergling2026-02-081-1/+1
| | | | | | - s/preceeded/preceded/ MFC after: 3 days
* vchiq: fix build with clang 21Dimitry Andric2026-01-161-1/+1
| | | | | | | | | | | | | | | | | | When compiling vchiq with clang 21, the following -Werror warning is produced: sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c:728:27: error: default initialization of an object of type 'VCHIQ_QUEUE_MESSAGE32_T' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe] 728 | VCHIQ_QUEUE_MESSAGE32_T args32; | ^ sys/contrib/vchiq/interface/vchiq_arm/vchiq_ioctl.h:151:40: note: member 'elements' declared 'const' here 151 | const /*VCHIQ_ELEMENT_T * */ uint32_t elements; | ^ While the warning is formally correct, the 'args32' object is immediately initialized after its declaration. Therefore, suppress the warning. MFC after: 3 days
* arm64: Add support to vchiq and bcm2835_audio (plus some fixes)Marco Devesas Campos2025-11-152-19/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add 64 bit support to vchiq: * update fields to the appropriate fixed bit-size variants (everywhere [cf. e.g., ref:sizes and ref:sizes2]) * refer to event semaphores (that go into the very 32 bit VC) by offset instead of pointers [ref:sems] * dsb() is dsb(sy) in arm64 (vchiq_{core.c,core.h,kmod.c}) [ref:dsb] * comment out some unneeded code in parse_rx_slots around VCHIQ_MSG_BULK_RX (cf. [ref:deadcode]) * adapt remote_event_signal to arm64 caching behaviours (vchiq_kmod.c) * refactor synchronization around remote_event_signal, forcing a wmb to be on the safe side; thereby make it look more like what linux does [ref:sync] (vchiq_{core,kmod}.c); and make a comment in vchiq_core.c true (wasn't before) * add a few more syncs to be on the safe side (vchiq_2835_arm.c) * use arm64 dcache invalidation mechanisms (vchiq_2835_arm.c) * explicitly invalidate pages on arm64 post bulk-read (vchiq_2835_arm.c) * support bulk transfers on rpi-4 (aka "long address space" transfers), by hard-coding their vc offset (0) and different bit-shift [ref:longbulk] (vchiq_2835_arm.c) * refactor a loop-of-constant-test (vchiq_2835_arm.c) * use the correct (hard-coded) cache-line size on arm64 * rework the handling of chipset "features" to account for the extra behaviours with 64 bit chipsets. (vchiq_kmod.c) * add sysctl-s (log, arm_log) to control debug (vchiq_kmod.c) * add example kernel config (GENERIC-VCHIQ) Fixes: * Rework error handling in create_pagelist, avoiding a potential panic when freeing memory that had been dmamem_alloc, a potential null dereference, and a leak when having problems pinning pages (vchiq_2835_arm.c) * fix a confusion about the behaviour cv_wait_sig that lead to uninterruptible looping (vchiq_bsd.c) * implement detection of fatal signals (vchiq_bsd.c) * fix a confusion with the name of a variable introduced by #a0b8746 that could lead to a panic when closing the cdev file (vchiq_arm.c) * release user connection when destructing cdevpriv and avoid user processes sharing connection data, which lead to stalls and data corruption. (vchiq_arm.c) Update bcm2835_audio to work on 64bit systems: * update VC audio fields (vc_vchi_audioserv_defs.h, bcm2835_audio.c) * repurpose the hitherto unused callback field to help push a 64 bit pointer in (bcm2835_audio.c) * increase (hopefully) the robustness of the code that shifts data to VC (bcm2835_audio.c) * add a sysctl to control the amount of debugging info output by bcm2835_audio.c Tested on zero, zero2 and 4+ with ping, functional, bulk and control vchiq_test-s, and omxplayer [ref:dsb]: https://github.com/raspberrypi/linux/commit/35b7ebda57affcfd3616d39d5a727a4495b31123 [ref:sems]: https://github.com/raspberrypi/linux/commit/24a4262afb10907fce3cdbc3ae336fcf4cdaece5 [ref:sizes]: https://github.com/raspberrypi/linux/commit/e64568b8ea6c04e747e432c17ce2452652075216 [ref:sizes2]: https://github.com/raspberrypi/linux/commit/f9bee6dd24addfa00c2c8d50c25b73efbfbb28ba [ref:deadcode]: https://github.com/raspberrypi/linux/commit/14f4d72fb799a9b3170a45ab80d4a3ddad541960 [ref:sync]: https://github.com/raspberrypi/linux/commit/51c071265079319583e4c6e8c61e09660300d0bf [ref:longbulk]: https://github.com/raspberrypi/linux/commit/37f6f19a83722c9b866cecb5e455b2e16e5bbc6b Differential Revision: https://reviews.freebsd.org/D37878 Submitted by: Marco Devesas Campos <devesas.campos@gmail.com>
* sound: Get rid of useless sndbuf getters and settersChristos Margiolis2025-11-111-4/+5
| | | | | | | | No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53528
* vchiq: fix another logging format string for 32/64 bitMarco Devesas Campos2025-10-301-2/+3
| | | | | | | This is from work from https://reviews.freebsd.org/D37878. Submitted by: Marco Devesas Campos <devesas.campos@gmail.com> Differential Revision: https://reviews.freebsd.org/D53372
* vchiq: logging/tracing refactoringMarco Devesas Campos2025-10-301-12/+54
| | | | | | | | | | | * Create macros for error, info, warn, trace / debug * Migrate existing printf() logging to use the above macros * Add a sysctl knob to control it at runtime This is based on work done in https://reviews.freebsd.org/D37878 . Submitted by: Marco Devesas Campos <devesas.campos@gmail.com> Differential Revision: https://reviews.freebsd.org/D53371
* gpio: implement bus_setup_intr and bus_teardown_intrAhmad Khalifa2025-09-301-0/+4
| | | | | | | | | | | Implement bus_setup_intr and bus_teardown_intr as bus_generic_setup_intr and bus_generic_teardown_intr respectively for GPIO drivers that support interrupts. This allows children to setup interrupts. Reported by: Evgenii Ivanov <devivanov@proton.me> Reviewed by: imp MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D52197
* gpio: remove gpiobus_attach_busAhmad Khalifa2025-08-132-2/+4
| | | | | | | | | | | | Since gpiobus_attach_bus can attach the gpiobus child along with its children in the same bus pass, the parent controller's reference to gpiobus might not be set by the time the children need it. Instead, drivers should use gpiobus_add_bus and explicitly call bus_attach_children. Reviewed by: mmel, imp (older version) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51578
* gpio: attach gpiobus when the controller is readyAhmad Khalifa2025-07-041-3/+3
| | | | | | | | | | Only attach gpiobus when the controller is fully initialized. Children of gpiobus expect this to be the case. Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51088
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-211-2/+2
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* bus_generic_detach: Delete children after detaching themJohn Baldwin2025-01-021-2/+0
| | | | | | | | | | | | | | | | | This provides better semantics as a standalone DEVMETHOD for device_attach as bus drivers should remove child devices they created as part of detach cleanup. The implementation calls bus_detach_children() first to permit child devices an opportunity to veto the detach operation. If that succeeds, device_delete_children() is used to delete the child devices. This requires fixing various drivers that were deleting devices explicitly (via a device_t pointer cached in the softc) after calling bus_generic_detach to stop doing that and just rely on bus_generic_detach to remove child devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47959
* bus_delayed_attach_children: Switch return type to voidJohn Baldwin2024-12-061-1/+2
| | | | | | | This function never fails similar to bus_attach_children. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47677
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-066-6/+10
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* Replace calls to bus_generic_probe with bus_identify_childrenJohn Baldwin2024-12-062-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47674
* sound: Make device registration more intuitiveChristos Margiolis2024-11-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The way a sound driver currently registers to sound(4) is using the following sequence of function calls: 1. pcm_register() to initialize snddev_info. 2. pcm_addchan() calls to create the device's primary channels. 3. pcm_setstatus() to do the final setup. While using 3 different functions in a specific order might not be very elegant, this pattern cannot be easily avoided. However, pcm_register() and pcm_setstatus() are especially confusing, since one would intuitively expect: 1. pcm_register() to actually do the registration, as opposed to a basic initialization. 2. pcm_setstatus() to, as the name suggests, set some kind of status, as opposed to finalizing the registration. This patch renames pcm_register() to pcm_init(), and pcm_setstatus() to pcm_register(). Drivers are modified accordingly. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D47325
* Revert "intrng: change multi-interrupt root support type to enum"Kyle Evans2024-10-251-1/+1
| | | | | | | | | This reverts commit 536c8d948e8563141356fd41fb8bfe65be289385. The change seemed fine on the surface, but converting to an enum has raised some concerns due to the asm <-> C interface. Back it out and let someone else deal with it later if they'd like to. Further context about the concerns can be found in D47279.
* intrng: change multi-interrupt root support type to enumElliott Mitchell2024-10-241-1/+1
| | | | | | | | | | | | | | | | | uint32_t is handy for directly interfacing with assembly-language. For the C portion, enum is much handier. In particular there is no need to count the number of roots by hand. This also works better for being able to build kernels with varying numbers of roots. Switch to INTR_ROOT_COUNT as this better matches the purpose of the value. Switch to root_type, rather than rootnum for similar reasons. Remove the default from the core. Better to require the architectures to declare the type since they will routinely deviate and a default chosen now will likely be suboptimal. Leave intr_irq_handler() taking a register type as that better matches for interfacing with assembly-language.
* intrng: Add support for multiple interrupt rootsAyrton Munoz2024-09-222-3/+5
| | | | | | | | | | | | | | Different types of interrupts may require using different exception vectors so this commit adds support multiple interrupt roots to handle these cases. Archs may opt-in to multiple interrupt roots by defining INTR_ROOT_NUM as the number of roots in their intr.h. Based off https://reviews.freebsd.org/D40161. Signed-off-by: Ayrton Munoz <a.munoz3327@gmail.com> Co-authored-by: Kyle Evans <kevans@FreeBSD.org> Co-authored-by: Andrew Turner <andrew@FreeBSD.org> Reviewed-by: imp,mmel,mhorne Pull-Request: https://github.com/freebsd/freebsd-src/pull/1363
* bcm2835: Remove support for SoCs with an Armv6 CPUAndrew Turner2024-09-115-370/+0
| | | | | | | Armv6 has been removed, there is no need to keep this in the tree. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45956
* newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANYWarner Losh2024-07-253-3/+3
| | | | Sponsored by: Netflix
* arm: Remove stray references to dev/sound/chip.hChristos Margiolis2024-05-061-1/+0
| | | | | | | Fixes: 923e0040a59a ("sound: Move chip.h contents to pcm/sound.h") Reported by: Jenkins CI Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Enable L1SS handling on RPI4 pcibHP van Braam2024-04-211-4/+18
| | | | | | | | | | | | | | | | | | | Thanks to @kevans91 for pointing me in the right direction. FreeBSD had the same bug as Linux (see https://bugzilla.kernel.org/show_bug.cgi?id=217276) where the ultimate solution was to honor the brcm,enable-l1ss FDT property. In current versions of the dtb files this property has been added by default. Without this on many, many pcie addin cards the pcib will Serror when trying to assert the clreq# pin on the pcie bus. Many cards do not have these hooked up. PR: 260131, 277638, 277605 Reviewed-by: emaste Signed-off-by: HP van Braam <hp@tmm.cx> Pull-request: https://github.com/freebsd/freebsd-src/pull/1179
* bcm2838_xhci: add moduleLexi Winter2024-04-101-0/+2
| | | | | | | | | | | | | | | | | | | | | bcm2838_xhci(4) is a shim for the XHCI controller on the Raspberry Pi 4B SoC. It loads the controller's firmware before passing control to the normal xhci(4) driver. When xhci(4) is built as a module (and not in the kernel), bcm2838_xhci is not built at all and the RPi4's XHCI controller won't attach due to missing firmware. To fix this, build a new module, bcm2838_xhci.ko, which depends on xhci.ko. For the dependency to work correctly, also modify xhci to provide the 'xhci' module in addition to the 'xhci_pci' module it already provided. Since bcm2838_xhci is specific to a quirk of the RPi4 SoC, only build the module for AArch64. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1142
* intrng: Allow alternative IPI PICs to be registered and usedJessica Clarke2024-01-241-1/+11
| | | | | | | | | | | | | | | | | | On RISC-V, the root PIC (whether the PLIC or, as will be the case in future, the local interrupt controller) cannot send IPIs, relying on another means to trigger the necessary software interrupts (firmware calls), but there are upcoming standard devices that will be able to inject them, so we can't just put the firmware calls in the root PIC driver. Thus, split out a new intr_ipi_dev from intr_irq_root_dev to use for sending IPIs. New devices can be registered with a given priority up until the first IPI is set up, when the best device seen so far gets frozen as the IPI device to use. Reviewed by: mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D35899
* intrng: Remove irq_root_ipicount and corresponding intr_pic_claim_root argJessica Clarke2024-01-242-2/+2
| | | | | | | | | | | | | The static irq_root_ipicount variable is only ever written to (with the value passed to irq_root_ipicount), never read. Moreover, the bcm2836 driver, as used by the Raspberry Pi 2B and 3A/B (but not 4, which uses a GIC-400, though does have the legacy interrupt controller present too) passes 0 as ipicount, despite implementing IPIs. It's thus inaccurate and serves no purpose, so should be removed. Reviewed by: mmel, imp, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D35897
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2719-19/+6
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* bcm2835/spi: Support SPI_FLAG_KEEP_CSJustin Hibbits2023-11-142-10/+25
| | | | | | | | | | | | | Summary: 3c08673438 brought in SPI_FLAG_KEEP_CS to keep the SPI chip select held post-transfer completion. Add this support to bcm2835 SPI for SPI devices that need it. As part of this, the owner thread needed carried through so that no other thread can take over the SPI bus until the owner releases the chip select. Reviewed by: manu Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D42599
* sys: Remove SND_DECLARE_FILEJohn Baldwin2023-08-181-2/+0
| | | | | Reviewed by: kbowling, imp, emaste Differential Revision: https://reviews.freebsd.org/D41499
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-166-6/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1626-52/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .c patternWarner Losh2023-08-161-3/+0
| | | | Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1615-30/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* sys: Remove $FreeBSD$: sound driver versionWarner Losh2023-08-161-1/+1
| | | | Remove /SND_DECLARE_FILE\("\$FreeBSD\$"\);/
* bcm2835_gpio: Handle BCM2711 pin configurationTetsuya Uemura2023-05-291-20/+61
| | | | | | | | | | | | | | | | Add support for GPIO internal pull up/down configuration on RPi4 family. BCM2711 SoC on 4th generation Raspberry Pi changed the way to configure its GPIO pins' internal pull up/down resistors. NetBSD already have support for this change, and port it to FreeBSD is trivial. This patch, based on the NetBSD commit adds the appropriate method for BCM2711 and now we can properly configure the GPIO pins' pull status. PR: 256372 Reviewed by: mhorne Obtained from: NetBSD bb88cfa64ad8 Pull Request: https://github.com/freebsd/freebsd-src/pull/746
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1225-25/+25
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* arm: remove passing trapframe to intr_ipi_dispatch()Elliott Mitchell2023-04-261-1/+1
| | | | | | This was needed before INTRNG was in place and handling the push of curthread->td_intr_frame. Since INTRNG now handles this, there is no longer and need for playing around with the frame inside IPI interrupts.
* Remove redundant data from pci host genericAndrew Turner2023-04-241-20/+8
| | | | | | | The bus tag and handle fields are already stored in the resource. Use this with the bus_read/bus_write helper macros. Sponsored by: Arm Ltd
* bcm_dma: don't dereference NULL softcMitchell Horne2023-02-241-7/+22
| | | | | | | | | | This file defines a small API to be used by other drivers. If any of these functions are called before the bcm_dma device has attached we should handle the error gracefully. Fix a formatting quirk while here. Reviewed by: manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38756
* bcm_dma: attach at an earlier bus passMark Millard2023-02-241-1/+2
| | | | | | | | | | | | | | The sdhci_bcm driver attach routine relies on bcm_dma already being attached, in order to allocate a DMA channel. However, both drivers attached at the default pass so this is not guaranteed. Newer RPI firmware exposes this assumption, and the result is a NULL-dereference in bcm_dma_allocate(). To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma. PR: 268835 Reviewed by: mhorne MFC after: 1 week
* pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.John Baldwin2022-09-221-2/+2
| | | | | | | | This matches the return type of pmap_mapdev/bios. Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36548
* bcm2835_clkman: add RPI4 compat stringMatthew Grooms2022-09-091-0/+1
| | | | | | | | | | This enables attachment on the RPI4, thus enabling the bcm2835_pwm driver too. Per the device tree documentation, these compat strings are equivalent, and no further changes to the driver are required. https://lists.freebsd.org/archives/freebsd-arm/2021-June/000143.html MFC after: 3 days
* Fix an indentation bug in the bcm pci driverAndrew Turner2022-05-231-1/+1
| | | | Sponsored by: The FreeBSD Foundation
* Use the error given in the bcm PCI driverAndrew Turner2022-05-231-3/+3
| | | | | | | When given an error return it and not just ENXIO as it may contain information usefule to debug an error. Sponsored by: The FreeBSD Foundation
* Error is not a bool in bcm2838_pci, check for != 0Andrew Turner2022-05-231-7/+7
| | | | | | Fix for style an check if error != 0 in the bcm2838 pci driver. Sponsored by: The FreeBSD Foundation
* Fix the style of bcm_pcib_msi_attach a littleAndrew Turner2022-05-231-2/+2
| | | | | | Move the definition of error to the top of the function. Sponsored by: The FreeBSD Foundation
* arm/arm64 broadcom: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-0923-75/+32
|
* Remove pcm_devclass from DRIVER_MODULE invocations.John Baldwin2022-05-061-1/+1
|