Page MenuHomeFreeBSD

[BHND SoC] Add BHND SoC support (only BCMA case)
ClosedPublic

Authored by mizhka on May 6 2016, 5:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 10:37 PM
Unknown Object (File)
Thu, Apr 11, 1:08 AM
Unknown Object (File)
Mar 18 2024, 12:30 AM
Unknown Object (File)
Feb 19 2024, 9:54 PM
Unknown Object (File)
Jan 11 2024, 4:59 PM
Unknown Object (File)
Dec 20 2023, 2:01 AM
Unknown Object (File)
Dec 15 2023, 11:43 PM
Unknown Object (File)
Nov 27 2023, 2:51 AM
Subscribers

Details

Summary

This patch introduce to add 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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mizhka retitled this revision from to [BHND SoC] Add BHND SoC support (only BCMA case).
mizhka updated this object.
mizhka edited the test plan for this revision. (Show Details)
mizhka set the repository for this revision to rS FreeBSD src repository - subversion.
mizhka updated this object.
mizhka changed the visibility from "mizhka (Michael Zhilin)" to "Public (No Login Required)".
mizhka removed a subscriber: Contributor Reviews (src).
  • small changes after rebase to today's head

It should be possible to unify these as a single bcma_nexus driver that attaches to the mips nexus, and rely on the default/inherited implementation for most of these methods.

In the case of BHND_BUS_IS_HW_DISABLED, the default null implementation will be a problem (it panic()s); you could modify it to return false instead.

I should be able to run this locally on a MIPS device in the next couple days, at which point I can also help take a look at any issues in bhnd.

It should be possible to unify these as a single bcma_nexus driver that attaches to the mips nexus, and rely on the default/inherited implementation for most of these methods.

In the case of BHND_BUS_IS_HW_DISABLED, the default null implementation will be a problem (it panic()s); you could modify it to return false instead.

I should be able to run this locally on a MIPS device in the next couple days, at which point I can also help take a look at any issues in bhnd.

Default BHND resource activation is also good topic for discussion. Now it's call propagation to parent and fail if no parent. To avoid bhnd_soc, it also requires change.

BHND bus (bcma or siba) fetches CHIP ID from parent, so default get_chipid shouldn't panic and returns CHIP ID by calling bhnd_read_chipid.

Another question is resource allocation, BHND bus allocates resources for all cores (future devices). It may be done via hints, but it's not nice because BHND can handle up to 16 cores (or may be more) and it results in 16*3 lines of hints.

What is benefit of direct attachment of bcma_nexus to mips nexus?

In D6248#134154, @mizhka_gmail.com wrote:

It should be possible to unify these as a single bcma_nexus driver that attaches to the mips nexus, and rely on the default/inherited implementation for most of these methods.

In the case of BHND_BUS_IS_HW_DISABLED, the default null implementation will be a problem (it panic()s); you could modify it to return false instead.

I should be able to run this locally on a MIPS device in the next couple days, at which point I can also help take a look at any issues in bhnd.

Default BHND resource activation is also good topic for discussion. Now it's call propagation to parent and fail if no parent. To avoid bhnd_soc, it also requires change.

Right. Just to be explicit about it:

  • The default implementation of bhnd_bus_generic_alloc_resource delegates to BUS_ALLOC_RESOURCE and BHND_BUS_ACTIVATE_RESOURCE.
  • The default implementation of bhnd_bus_generic_activate_resource tries to delegate to the parent bus. If none, it returns EINVAL.

It should be sufficient to implement the standard BUS_ALLOC_RESOURCE, and the bhnd(4)-specific BHND_BUS_ACTIVATE_RESOURCE(), and have bhnd_bus_activate_resource just delegate to BUS_ACTIVATE_RESOURCE.

We could add a bhnd_bus_generic_direct_activate_resource() method implementation to bhnd_subr.c that provided this.

BHND bus (bcma or siba) fetches CHIP ID from parent, so default get_chipid shouldn't panic and returns CHIP ID by calling bhnd_read_chipid.

Since the location of ChipCommon can in theory vary (and some early siba(4) devices don't have a ChipCommon core), this behavior (and thus, the top-level bhnd drivers) would still need to be specific to the root bus being used:

  • On a platform using a root 'nexus' bus, my understanding is that the basic configuration (including the base ChipCommon address) should generally be fetched via device hints (ex sys/mips/conf/SENTRY5.hints).
  • On a platform using FDT, the device tree will supply the address of the chipcommon register block, and possibly interrupt configuration, etc.
  • On bridged PCI/SDIO/etc devices, a custom bhndb_* driver handles the device-specific behavior, and the bcma_bhndb/siba_bhndb drivers delegate most of this to bhndb.

Another question is resource allocation, BHND bus allocates resources for all cores (future devices). It may be done via hints, but it's not nice because BHND can handle up to 16 cores (or may be more) and it results in 16*3 lines of hints.

You should be able to to safely do this lazily; the MIPS nexus implementation will allocate/activate resources for devices that are children of the actual nexus-attached device -- you'd just need to check for RMAN_IS_DEFAULT_RANGE(start, end) && count == 1 and populate the request with default values before delegating to the parent nexus (and/or consult a local rman if you have one).

For an example of this (@adrian or @sobomax might have a better one), check out siba_alloc_resource() in sys/dev/siba/siba_mips.c.

What is benefit of direct attachment of bcma_nexus to mips nexus?

Just fewer moving parts. If there's common behavior we want bcma_nexus to inherit, we can reference common functions implementing the methods, or use kobj's inheritance mechanisms, without needing a full intermediary bhnd_soc parent in the device tree.

mizhka edited edge metadata.
  • early bus passing
This revision is now accepted and ready to land.May 20 2016, 12:58 AM
This revision was automatically updated to reflect the committed changes.