aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bhnd/cores/chipc
Commit message (Collapse)AuthorAgeFilesLines
* bhnd_bus_*_resource: Remove redundant type and rid argumentsJohn Baldwin2025-12-095-22/+13
| | | | | | | | | | | | | | Remove type and rid arguments from bhnd_bus_(activate|deactivate|release)_resource. This should have been done earlier to match the changes made to bus_release_resource, etc. While fixing up the callers, remove rid members from softc structures since the only time a value is needed is as a constant input to bhnd_bus_alloc_resource*. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53410
* bhnd_bus_alloc_resource*: Pass rid by valueJohn Baldwin2025-12-092-2/+2
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53409
* bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHODJohn Baldwin2025-12-091-4/+4
| | | | | | | | | The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402
* gpio: remove gpiobus_attach_busAhmad Khalifa2025-08-131-1/+3
| | | | | | | | | | | | 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
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-211-2/+4
| | | | | | 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-3/+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
* bhnd: Fix a few use after frees when releasing resourcesGavin Atkinson2024-12-271-2/+4
| | | | | | | The resource list entry needs to be looked up using rman_get_* prior to releasing the resource. Fixes: 9dbf5b0e6876 new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCE
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-062-5/+3
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* newbus: replace -1 in BUS_ADD_CHILD(...-1) with DEVICE_UNIT_ANYWarner Losh2024-07-252-7/+7
| | | | Sponsored by: Netflix
* bhnd: Use device_set_descf()Mark Johnston2024-06-021-3/+1
| | | | | | | Here we are in a device probe routine with no locks held. M_WAITOK allocations are ok. No functional change intended. MFC after: 1 week
* new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin2024-03-131-7/+6
| | | | | | | | | | The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
* new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCEJohn Baldwin2024-03-131-20/+14
| | | | | | | | | | The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
* new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCEJohn Baldwin2024-03-131-4/+3
| | | | | | | | | | The public bus_adjust_resource() API still accepts both forms, but the internal kobj method no longer passes the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44128
* bhnd_chipc: Make use of bus_generic_rman_* to simplify some codeJohn Baldwin2024-02-271-46/+22
| | | | | | | | This uses bus_generic_rman_alloc/release_resource to reduce some code duplication. However, I've left the custom activate/deactivate methods as-is. Differential Revision: https://reviews.freebsd.org/D43939
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-276-6/+0
| | | | | | | | | | | | | | | | 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
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1610-20/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-167-7/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-164-8/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1214-14/+14
| | | | | | | | | 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
* bhnd: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-097-15/+7
|
* Remove unused cfi_devclass.John Baldwin2022-05-091-1/+1
|
* bhnd(4): Remove some double words in source code commentsGordon Bergling2022-04-091-1/+1
| | | | | | | - s/be be/be/ - s/is is/is/ MFC after: 3 days
* bhnd_pwrctl_attach: eliminate write only bus variableWarner Losh2022-04-051-3/+0
| | | | Sponsored by: Netflix
* bhnd: Fix some -Wunused-but-set-variable warningsMark Johnston2022-02-282-6/+0
| | | | MFC after: 1 week
* Create wrapper for Giant taken for newbusWarner Losh2021-12-101-3/+3
| | | | | | | | | | | Create a wrapper for newbus to take giant and for busses to take it too. bus_topo_lock() should be called before interacting with newbus routines and unlocked with bus_topo_unlock(). If you need the topology lock for some reason, bus_topo_mtx() will provide that. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31831
* Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsEd Maste2021-08-083-3/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
* newbus: Move from bus_child_{pnpinfo,location}_src to ↵Warner Losh2021-06-231-24/+0
| | | | | | | | | | | | | | | | | | | | | | bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
* bhnd: clean up empty lines in .c and .h filesMateusz Guzik2020-09-019-34/+16
| | | | Notes: svn path=/head/; revision=365123
* bhnd_chipc(4): Fix leak of child device ivars by explicitly deletingLandon J. Fuller2018-01-201-0/+3
| | | | | | | | | | | | | | | any children prior to detach. With the newbus child deletion ordering changes introduced in r307518, parent devices are now detached (and their driver set to NULL) prior to detaching and deleting child devices; child-related bus methods (e.g. BUS_CHILD_DETACHED, BUS_CHILD_DELETED) are no longer be dispatched to the parent device driver after it returns 0 (success) from DEVICE_DETACH. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328187
* bhnd(4): fix a few bugs in pwrctl/fixed-clock device support.Landon J. Fuller2018-01-191-4/+8
| | | | | | | | | | | | | | - Do not panic on siba(4) detach when the bhnd(4) bus calls bhnd_get_pmu_info() on a PMU-less device. - Fix bhnd_pwrctl attach/detach on fixed-clock devices: - Treat bhnd_pwrctl_updateclk() as a no-op on fixed-clock devices. - Use bhnd_pwrctl_updateclk() to perform the appropriate clock transition on detach. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328176
* bhnd_chipc(4): Fix the assignment of non-wildcard child unit numbersLandon J. Fuller2018-01-191-3/+3
| | | | | | | | | | introduced in r326102 and r326109; all chipc children should be added with a wildcard unit (-1). Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=328174
* bhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIOLandon J. Fuller2017-12-141-1/+1
| | | | | | | | | | pin flags. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=326838
* SPDX: license IDs for some ISC-related files.Pedro F. Giffuni2017-12-0815-0/+30
| | | | Notes: svn path=/head/; revision=326695
* bhnd_chipc(4): Break cyclic references to the ChipCommon deviceLandon J. Fuller2017-12-021-2/+2
| | | | | | | | | | | | bhnd_chipc's children may hold strong provider references to their parent; we must detach any children before attempting to deregister the bhnd_chipc device as a bus service provider. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=326450
* bhnd(4): Add a basic ChipCommon GPIO driver sufficient to support bwn(4)Landon J. Fuller2017-11-225-2/+1047
| | | | | | | | | | | | | The driver is functional on both BHND Wi-Fi adapters and MIPS SoCs, but does not currently include support for features not required by bwn(4), including GPIO interrupt handling. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12708 Notes: svn path=/head/; revision=326109
* bhnd(4): extend the PMU APIs to support bwn(4)Landon J. Fuller2017-11-227-92/+490
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bwn(4) driver requires a number of extensions to the bhnd(4) PMU interface to support external configuration of PLLs, LDOs, and other parameters that require chipset or PHY-specific workarounds. These changes add support for: - Writing raw voltage register values to PHY-specific LDO regulator registers (required by LP-PHY). - Enabling/disabling PHY-specific LDOs (required by LP-PHY) - Writing to arbitrary PMU chipctrl registers (required for common PHY PLL reset support). - Requesting chipset/PLL-specific spurious signal avoidance modes. - Querying clock frequency and latency. Additionally, rather than updating legacy PWRCTL support to conform to the new PMU interface: - PWRCTL API is now provided by a bhnd_pwrctl_if.m interface. - Since PWRCTL is only found in older SSB-based chipsets, translation from bhnd(4) bus APIs to corresponding PWRCTL operations is now handled entirely within the siba(4) driver. - The PWRCTL-specific host bridge clock gating APIs in bhnd_bus_if.m have been lifted out into a standalone bhnd_pwrctl_hostb_if.m interface. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12664 Notes: svn path=/head/; revision=326102
* bhnd(4): implement MIPS and PCI(e) interrupt supportLandon J. Fuller2017-11-214-37/+119
| | | | | | | | | | | | | | | | | | | | | | On BHND MIPS SoCs, this replaces the use of hard-coded MIPS IRQ#s in the common bhnd(4) core drivers; we now register an INTRNG child PIC that handles routing of backplane interrupt vectors via the MIPS core. On BHND PCI devices, backplane interrupt vectors are now routed to the PCI/PCIe host bridge core when bus_setup_intr() is called, where they are dispatched by the PCI core via a host interrupt (e.g. INTx/MSI). The bhndb(4) bridge driver tracks registered interrupt handlers for the bridged bhnd(4) devices and manages backplane interrupt routing, while delegating actual bus interrupt setup/teardown to the parent bus on behalf of the bridged cores. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12518 Notes: svn path=/head/; revision=326079
* bhnd: Implement bhnd(4) platform device registration.Landon J. Fuller2017-09-272-3/+35
| | | | | | | | | | | | | | | | | | Add bhnd(4) API for explicitly registering BHND platform devices (ChipCommon, PMU, NVRAM, etc) with the bus, rather than walking the newbus hierarchy to discover platform devices. These devices are now also refcounted; attempting to deregister an actively used platform device will return EBUSY. This resolves a lock ordering incompatibility with bwn(4)'s firmware loading threads; previously it was necessary to acquire Giant to protect newbus access when locating and querying the NVRAM device. Approved by: adrian (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12392 Notes: svn path=/head/; revision=324070
* [mips] [bhnd] Support of old PMU for BMIPS and siba SoCMichael Zhilin2017-05-282-4/+10
| | | | | | | | | | | - Fix typo of PLL Type 4 - Don't panic of frequency getters Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Differential Revision: https://reviews.freebsd.org/D10967 Notes: svn path=/head/; revision=319069
* Add Northstar/BCM4706 core ID for ChipCommon.Landon J. Fuller2017-03-231-0/+1
| | | | | | | Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=315873
* Integrate BCM4706 PMU (rev6) support, derived from the ISC-licensed BroadcomLandon J. Fuller2017-03-201-4/+27
| | | | | | | | | | sbchipc.h and hndpmu.c sources included in the RT-N16 and later firmware source drops. Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=315651
* - Allow different slicers for different flash types to be registeredMarius Strobl2017-02-222-8/+12
| | | | | | | | | | | | | | | | | | | | with geom_flashmap(4) and teach it about MMC for slicing enhanced user data area partitions. The FDT slicer still is the default for CFI, NAND and SPI flash on FDT-enabled platforms. - In addition to a device_t, also pass the name of the GEOM provider in question to the slicers as a single device may provide more than provider. - Build a geom_flashmap.ko. - Use MODULE_VERSION() so other modules can depend on geom_flashmap(4). - Remove redundant/superfluous GEOM routines that either do nothing or provide/just call default GEOM (slice) functionality. - Trim/adjust includes Submitted by: jhibbits (RouterBoard bits) Reviewed by: jhibbits Notes: svn path=/head/; revision=314097
* bhnd(4): Fix regression in BCM4331 SPROM pin reference counting.Landon J. Fuller2016-09-171-2/+1
| | | | | | | | | | | | In r304870, refcount handling was lifted out into a common OTP/SPROM code path, but the refcount assertions in chipc_disable_sprom_pins() were not updated accordingly; this triggered an assertion on BCM4331 devices when releasing a SPROM pin reservation. Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=305907
* Migrate bhndb(4) to the new bhnd_erom API.Landon J. Fuller2016-09-041-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for probing and initializing bhndb(4) bridge state using the bhnd_erom API, ensuring that full bridge configuration is available *prior* to actually attaching and enumerating the bhnd(4) child device, allowing us to safely allocate bus-level agent/device resources during bhnd(4) bus enumeration. - Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue to the existing bhnd_erom_probe_static() method, and allows the bhndb bridge to discover the best available erom parser class prior to newbus probing of its children. - Add support for supplying identification hints when probing erom devices. This is required on early EXTIF-only chipsets, where chip identification registers are not available. - Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info records rather than bridged bhnd(4) device_t references to determine the bridged chipsets' capability/bridge configuration. - The bhndb parent (e.g. if_bwn) is now required to supply a hardware priority table to the bridge. The default table is currently sufficient for our supported devices. - Drop the two-pass attach approach we used for compatibility with bhndb(4) in the bhnd(4) bus drivers, and instead perform bus enumeration immediately, and allocate bridged per-child bus-level resources during that enumeration. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7768 Notes: svn path=/head/; revision=305371
* [mips/broadcom]: Replace static frequency table with generic PMU clockLandon J. Fuller2016-08-273-35/+149
| | | | | | | | | | | | | | | | | handling. - Extended PWRCTL/PMU APIs to support querying clock frequency during very early boot, prior to bus attach. - Implement generic PMU-based calculation of UART rclk values. - Replaced use of static frequency tables (bcm_socinfo) with runtime-determined values. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7552 Notes: svn path=/head/; revision=304871
* bhnd(4): Initial PMU/PWRCTL power and clock management support.Landon J. Fuller2016-08-2712-797/+1492
| | | | | | | | | | | | | | | | - Added bhnd_pmu driver implementations for PMU and PWRCTL chipsets, derived from Broadcom's ISC-licensed HND code. - Added bhnd bus-level support for routing per-core clock and resource power requests to the PMU device. - Lift ChipCommon support out into the bhnd module, dropping bhnd_chipc. Reviewed by: mizhka Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7492 Notes: svn path=/head/; revision=304870
* [mips/broadcom] Generic platform_reset() support.Landon J. Fuller2016-08-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | This adds support for performing platform_reset() on all supported devices, using early boot enumeration of chipc capabilities and available cores. - Added Broadcom-specific MIPS CP0 register definitions used by BCM4785-specific reset handling. - Added a bcm_platform structure for tracking chipc/pmu/cfe platform data. - Extended the BCMA EROM API to support early boot lookup of core info (including port/region mappings). - Extended platform_reset() to support PMU, PMU+AOB, and non-PMU devices. Reviewed by: mizhka Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7539 Notes: svn path=/head/; revision=304859
* bhnd(4): Implement NVRAM support required for PMU bring-up.Landon J. Fuller2016-08-161-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | - Added a generic bhnd_nvram_parser API, with support for the TLV format used on WGT634U devices, the standard BCM NVRAM format used on most modern devices, and the "board text file" format used on some hardware to supply external NVRAM data at runtime (e.g. via an EFI variable). - Extended the bhnd_bus_if and bhnd_nvram_if interfaces to support both string-based and primitive data type variable access, required for common behavior across both SPROM and NVRAM data sources. - Extended the existing SPROM implementation to support the new string-based NVRAM APIs. - Added an abstract bhnd_nvram driver, implementing the bhnd_nvram_if atop the bhnd_nvram_parser API. - Added a CFE-based bhnd_nvram driver to provide read-only access to NVRAM data on MIPS SoCs, pending implementation of a flash-aware bhnd_nvram driver. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7489 Notes: svn path=/head/; revision=304243
* bhnd(4): print extra register information on chipc SPI timeout.Landon J. Fuller2016-07-121-1/+3
| | | | | | | | | | Submitted by: Michael Zhilin <mizhka@gmail.com> Reviewed by: imp Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6993 Notes: svn path=/head/; revision=302602