summaryrefslogtreecommitdiffstats
path: root/sys/dev/bhnd
Commit message (Collapse)AuthorAgeFilesLines
* MFC r308161:ngie2017-05-301-2/+0
| | | | | | r308161 (by lwhsu): - Fix `make` in sys/modules/bhnd
* MFC: r314097marius2017-05-102-8/+12
| | | | | | | | | | | | | | | - Allow different slicers for different flash types to be registered 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 one 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
* bhnd(4): Add devinfo allocation and child addition methods, modeled onlandonf2016-06-259-75/+232
| | | | | | | | | | pci_if. This allows bhnd(4) to manage per-device state (such as per-core pmu/clock refcounting) on behalf of subclass driver instances. Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6959
* bhnd(4): Perform explicit chipc child enumeration.landonf2016-06-2514-467/+481
| | | | | | | | | | | | | Replaces use of DEVICE_IDENTIFY with explicit enumeration of chipc child devices using the chipc capability structure. This is a precursor to PMU support, which requires more complex resource assignment handling than achievable with the static device name-based hints table. Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support) Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6896
* revert error commit from previous commit. my bad!adrian2016-06-231-1/+1
| | | | Approved by: re (implicit)
* [BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMAadrian2016-06-233-5/+40
| | | | | | | | | | | | | This patch addes missing implementation of BHND_BUS_RESET_CORE function for BCMA. The reset procedure is very simple: enable reset mode, stop clocking, enable clocking & force clock gating, disable reset mode, stop clock gating. Tested: * (michael) Tested on ASUS RT-N53 for enabling/reset USB core Submitted by: Michael Zhilin <mizhka@gmail.com> Approved by: re (gjb)
* siba(4): Adopt bcma-compatible mapping of bhnd(4) port/region identifiers.landonf2016-06-164-208/+189
| | | | | | | | | | | Maps Sonics/OCP per-core address spaces to bcma(4)-compatible port/region identifiers. This permits the use of common address map identifiers in bhnd device drivers, independent of the underlying interconnect type. Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6850
* bhnd(4): Fix resource allocation issues exposed by chipc PMU support.landonf2016-06-164-17/+42
| | | | | | | | | | | | - Delete all chipc children on attachment failure. - Added missing bhnd_nexus bhnd_bus_deactivate_resource implementation. - Drop a CHIPC_UNLOCK() accidentally left behind after lifting synchronization into the chipc region refcounting API. - Fix re-allocation of chipc resources. Previously, the resource ID was reset to -1 on release, preventing later re-allocation. Approved by: re (gjb), adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6849
* bhnd(4): Fix mips/broadcom core matching and bus pass order.landonf2016-06-083-4/+6
| | | | | | | | | | | | | | | | | Changes: - Fixed incorrect MIPS74k vendor ID in the bhnd core descriptor tables - Fixed MIPS core driver's matching against MIPS/MIPS33 cores. - Improved MIPS3302 core description. - Enabled BUS_PASS_BUS on the bhnd nexus drivers to allow early probing of the MIPS core. - Enabled BUS_PASS_CPU on the MIPS core driver to ensure correct attach order. - Disabled matching of the MIPS core driver on non-SoC devices. Reviewed by: Michael Zhilin <mizhka@gmail.com> Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6735
* bhnd(4): Add a vendor parameter to BHND_DEVICE(), replacing vendor-specificlandonf2016-06-087-17/+9
| | | | | | | BHND_*_DEVICE macros. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6736
* bhnd(4): support IPX OTP NVRAM/SPROM data sourcelandonf2016-06-0410-103/+159
| | | | | | | | | | | | | | | | Add support for fetching SPROM data from OTP on chipsets with an IPX OTP controller (including the BCM43225). This integrates the NVRAM data source into the chipc_caps capability structure, and adds a sprom_offset field that can be used with OTP to locate the SPROM image data (found within the general use region, H/W subregion). This also removes one of two duplicate parse error messages reported by both the bhnd_sprom driver and the underlying SPROM parsing API. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6729
* Switch mips/sentry5 to bhnd(4), and unify with mips/broadcomlandonf2016-06-048-705/+243
| | | | | | | | | | | | | | | | | | | | | Now that bhnd(4) provides feature parity with the previous siba/mips implementation, we can switch sentry5 over and begin lifting common support code out for use across bhnd(4) embedded targets. Changes: - Fixed enumeration of siba(4) per-core address maps, required for discovery of memory mapped chipc flash region on siba(4) devices. - Simplified bhnd kernel configuration (dropped 'bhndbus' option). - Replaced files.broadcom's direct file references with their corresponding standard kernel options. - Lifted out common bcma/siba nexus support, inheriting from the new generic bhnd_nexus driver. - Dropped now-unused sentry5 siba code. - Re-integrated BCM into the universe build now that it actually compiles. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6712
* bhnd(4): Add support for chipc-attached flashlandonf2016-06-047-3/+785
| | | | | | | | | This adds support for serial (via SPI) and parallel (via CFI) flash as found on BCM47xx/BCM53xx SoCs. Submitted by: Michael Zhilin <mizhka@gmail.com> Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6250
* Fix several MIPS/BCM-blocking bugs in bhnd(4) chipclandonf2016-06-046-26/+115
| | | | | | | | | | | | | | | - Correct IRQ lines for UART (to fix IRQ lookup in future) - Check device unit in resource assignment during chipc_add_child - If chipc hint->size is RM_MAX_END, resource end should be same as window end - Clear reference from resource list entry to resource in case of resource release - Add CHIPC_GET_CAPS implementation - Correct chipc flash constants (to be unshifted) - Default implementation of get_attach_type should iterate over device tree - Add default implementation for BHND_CHIPC_GET_CAPS usable by chipc grandchildren Submitted by: Michael Zhilin <mizhka@gmail.com> Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6584
* [bhnd] Fix release of uninitialized SPROM shadow in chipc detach.adrian2016-05-262-6/+1
| | | | | | | | | This was triggering a panic on detach; the SPROM shadow is now maintained by the bhnd_sprom_chipc driver, and should be removed from chipc. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6548
* [bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping ↵adrian2016-05-263-54/+127
| | | | | | | | | | | | | | | | | | table. This adds support for automatically configuring bhnd_chipc bus children with associated resources, using an internal 'hints' table based directly on Michael Zhilin's chipc resource mapping work. The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY() with the new resource table. This should be nearly drop-in compatible with the child device drivers in D6250. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6525
* [bhnd] Normalize bhnd(4) device matching APIadrian2016-05-2413-605/+659
| | | | | | | | | | | | | | | | | This unifies handling of core, chip, and board-level device matching, and adds support for matching device drivers against the bus attach type (e.g. SoC vs WiFi adapter). Core-level quirks on Broadcom's chipsets generally are specific to some combination of chip model, core revision, chip package (e.g. 12x9 SMT package), SROM revision, etc. Unifying the match APIs for all three attribute types (core, chip, board/srom) allows defining a single device quirk table that matches across all of those attributes. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6515
* [bhnd] fix compilation due to incompatible typesadrian2016-05-241-1/+1
| | | | | Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6532
* [bhnd] Implement pass-through resource management for ChipCommon.adrian2016-05-2417-874/+2523
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY resources with its children, allowing us to hang devices off of bhnd_chipc that rely on access to a subset of the device register space that bhnd_chipc itself must also allocate. We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY wasn't limited to use with allocations at the same size/offset. As a work-around, I implemented something similar to vga_pci.c, which implements similar reference counting of of PCI BAR resources for its children. With these changes, chipc will use reference counting of SYS_RES_MEMORY allocation/activation requests, to decide when to allocate/activate/ deactivate/release resources from the parent bhnd(4) bus. The requesting child device is allocated a new resource from chipc's rman, pointing to (possibly a subregion of) the refcounted bhnd resources allocated by chipc. Other resource types are just passed directly to the parent bhnd bus; RF_SHAREABLE works just fine with IRQs. I also lifted the SPROM device code out into a common driver, since this now allows me to hang simple subclasses off of a common driver off of both bhndb_pci and bhnd_chipc. Tested: * (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still attaches and can be queried. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: mizkha@gmail.com Differential Revision: https://reviews.freebsd.org/D6471
* [bhnd] Add support for querying the attachment type of the bhnd bus.adrian2016-05-238-38/+135
| | | | | | | | | | | | | | | This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let chipc make a coarse-grained determination as to whether UART, SPI, etc drivers ought to be attached, and on fullmac devices, whether a real CPU driver ought to be skipped for the ARM core, etc. Tested: * BCM4331 (BHND) * BCM4312 (SIBA) Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6492
* [bhnd] Add BHND SoC support (only BCMA case)adrian2016-05-203-0/+421
| | | | | | | | | | | | | | This patch introduces support of BHND on SoC: nexus-to-bhnd drivers. bhnd_soc is attached under nexus and responsible for all BHND-style calls from bhnd(4) bus to parents. bcma_nexus is bhnd(4) bus, attached to bhnd_soc and implement all nexus-style behaviour of BHND. Submitted by: Michael Zhilin <mizhka@gmail.com> Reviewed by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6248
* [bhnd] Add bhnd bridge support for bus_adjust_resource().adrian2016-05-203-7/+75
| | | | | | | | | | | | Adds support for adjusting active bus resource allocations, limiting the range to the constraints of the register window within which the resource is mapped. This is the final set of bhnd changes required to support delegating ChipCommon's register space to child devices. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6470
* [bhnd] Add remaining bus_(read|write|set)_(1|2|4) APIsadrian2016-05-206-64/+415
| | | | | | | | | | | | | | | | This adds bhnd-compatible implementations of bus_(read|write|set)_(1|2|4) APIs, and upgrades the SPROM parsing code to use bhnd_bus_read_region_stream_2(). This a precursor to bridge support for resource adjustment and the new ChipCommon bus support. Tested: * Tested against BCM4331 * Kernel build verified via tinderbox. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6469
* Don't repeat the the word 'the'eadler2016-05-171-1/+1
| | | | | | | (one manual change to fix grammar) Confirmed With: db Approved by: secteam (not really, but this is a comment typo fix)
* [bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.adrian2016-05-1722-196/+1732
| | | | | | | | | | | | Now that we've got access to SPROM and can access board identification, this implements all known remaining hardware work-arounds for the bhnd(4) PCI and PCIe-G1 cores operating endpoint mode. Additionally, this adds an initial set of skeleton PCIe-G2 hostb and pcib drivers, required by fullmac and newer softmac devices. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6377
* [bhnd] Centralize fetching of board informationadrian2016-05-1715-222/+942
| | | | | | | | | | | | | | | | | Centralizes fetching of board information (vendor, type, revision, etc), and adds support for matching quirks against board identification info. * Adds a BHND_BUS_READ_BOARD_INFO(), allowing bhnd bus/bus parent(s) to handle implementation-specific fetching of board info. * Integrates board type constants from the latest Broadcom ISC-licensed bcmdevs.h included in dd-wrt's Broadcom driver source drops. * Adds support for matching on chip/board quirks to bhnd_device_quirks()/ bhnd_chip_quirks(). * Use the new board/chip quirk matching to match Apple devices that failed to set BFL2_PCIEWAR_OVR in SROM. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6361
* [bhnd] Add logging macros to BHND.adrian2016-05-162-0/+193
| | | | | | | | | | | | | | | | | | | | | | There are 5 logging levels: * ERROR * WARN * INFO * DEBUG * TRACE There are 2 logging context: * with * without device DEBUG and TRACE records are printed only if bootverbose. Logging records are printed with source code line information if acceptable logging level is DEBUG or TRACE. Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6247
* [bhnd] Add support for matching of MIPS & ARM coresadrian2016-05-161-3/+9
| | | | | | | Extend macros for MIPS & ARM cores. Now only BCM cores can be matched by matching mechanism. Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6246
* Use awk to run bhnd's awk script, to allow noexec src diremaste2016-05-131-1/+1
| | | | | | PR: 209435 Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6312
* [bhnd] fix bcma resource allocation for regions; EROM work around.adrian2016-05-102-2/+21
| | | | | | | | | | | | | * bcma.c - assign different resource IDs for different regions * bcma_erom.c - workaround for BCM/MIPS bus enumerations Tested: * (submitter) Tested on ASUS RT-N16 initially, double checked on ASUS RT-N53 * (landonf) BCM4331 Submitted by: Michael Zhilin <mizkha@gmail.com> Differential Revision: https://reviews.freebsd.org/D6245
* [bhnd] fix incorrect typing.adrian2016-05-091-2/+3
| | | | Pointed out by: emaste
* [bhnd] Initial bhnd(4) SPROM/NVRAM support.adrian2016-05-0825-1134/+4482
| | | | | | | | | | | | | | | | | | | This adds support for the NVRAM handling and the basic SPROM hardware used on siba(4) and bcma(4) devices, including: * SPROM directly attached to the PCI core, accessible via PCI configuration space. * SPROM attached to later ChipCommon cores. * SPROM variables vended from the parent SoC bus (e.g. via a directly-attached flash device). Additional improvements to the NVRAM/SPROM interface will be required, but this changeset stands alone as working checkpoint. Submitted by: Landon Fuller <landonf@landonf.org> Reviewed by: Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support) Differential Revision: https://reviews.freebsd.org/D6196
* [bhnd] Add support for matching on chip identifiers.adrian2016-05-082-4/+130
| | | | | | | | This is used by the upcoming SPROM code to match on chipsets that require special handling of muxed SPROM pins. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6195
* [bhnd] Add bhnd_resource support for the bus_(read|write)(_multi_)stream_* ↵adrian2016-05-085-60/+423
| | | | | | | | | functions. This adds additional bhnd_resource shims used by the upcoming SPROM deltas. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6194
* [bhnd] Replace is_hostb_device() with a more general find_hostb_device()adrian2016-05-0812-75/+86
| | | | | | | | This allows bus children to query for the host bridge device, rather than having to iterate over all attached devices. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6193
* [bhnd] don't use anonymous unions.adrian2016-05-055-35/+53
| | | | Found by: gcc-4.2
* [bhnd] default to BUS_PROBE_DEFAULT for unknown BHND classes.adrian2016-05-051-0/+2
| | | | Found by: gcc-4.2
* [bhnd] handle unknown bhnd port type.adrian2016-05-051-1/+6
|
* [bhnd] quieten gcc warning.adrian2016-05-051-0/+3
|
* [bhnd] handle unknown port type.adrian2016-05-051-0/+5
| | | | Reported by: emaste
* bhnd: another build fix for GCC-using architecturesemaste2016-05-051-0/+2
| | | | | | | Further to r299119. GCC architectures failed with bcma_subr.c:138: warning: control reaches end of non-void function Sponsored by: The FreeBSD Foundation
* bhnd: fix build on gcc architecturesemaste2016-05-051-0/+2
| | | | | | | "make tinderbox" fails on sparc64 GENERIC-NODEBUG with: bhnd_subr.c:188: warning: control reaches end of non-void function Sponsored by: The FreeBSD Foundation
* [bwn] [bhnd] initial support for using bhnd for if_bwn devices.adrian2016-05-043-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an initial work in progress to use the replacement bhnd bus code for devices which support it. * Add manpage updates for bhnd, bhndb, siba * Add kernel options for bhnd, bhndbus, etc * Add initial support in if_bwn_pci / if_bwn_mac for using bhnd as the bus transport for suppoted NICs * if_bwn_pci will eventually be the PCI bus glue to interface to bwn, which will use the right backend bus to attach to, versus direct nexus/bhnd attachments (as found in embedded broadcom devices.) The PCI glue defaults to probing at a lower level than the bwn glue, so bwn should still attach as per normal without a boot time tunable set. It's also not fully fleshed out - the bwn probe/attach code needs to be broken out into platform and bus specific things (just like ath, ath_pci, ath_ahb) before we can shift the driver over to using this. Tested: * BCM4311, STA mode * BCM4312, STA mode Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6191
* sys/dev: minor spelling fixes.pfg2016-05-037-13/+13
| | | | Most affect comments, very few have user-visible effects.
* [bhnd] fix more module dependencies.adrian2016-05-023-4/+5
| | | | | Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6180
* [bhnd] add module dependencies.adrian2016-05-025-2/+7
| | | | | Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D6179
* [bhnd] Fix ChipCommon probing.adrian2016-04-251-1/+1
| | | | | | | | | | | | | | | | ChipCommon probing uses mapping table "chipc_devices". It calls bhnd_device_lookup, which iterate over mapping table with end condition: entry->desc != NULL So if mapping table contains row with description equals to NULL, it will stop processing of mapping. I.e. description is mandatory field and should be not NULL. This patch corrects mapping table for ChipCommon. Submitted by: Michael Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D6088
* [bhnd] use correct bus deallocation methodadrian2016-04-221-1/+1
| | | | | Submitted by: Mizhka Zhilin <mizhka@gmail.com> Differential Revision: https://reviews.freebsd.org/D5647
* [bhnd] Update bhndb format strings to match long -> rman_res_t size change.adrian2016-04-221-2/+2
| | | | | | | Does what it says on the tin; this unbreaks 32-bit builds. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D5764
* [bhnd] Add a common bhnd_pci driver shared by both bhnd_pcib and bhnd_pci_hostbadrian2016-04-2214-1515/+1288
| | | | | | | | | This extracts common code from bhndb_pci, bhnd_pcib, and bhnd_pci_hostb into a simpler shared bhnd_pci base driver, and should enable SoC-side implementation of bhnd_pcib root complex support. Submitted by: Landon Fuller <landonf@landonf.org> Differential Revision: https://reviews.freebsd.org/D5763
OpenPOWER on IntegriCloud