Page MenuHomeFreeBSD

[BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA
ClosedPublic

Authored by mizhka on Jun 22 2016, 11:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 1, 5:15 AM
Unknown Object (File)
Sat, Nov 1, 1:13 AM
Unknown Object (File)
Wed, Oct 29, 1:00 PM
Unknown Object (File)
Sat, Oct 25, 2:32 PM
Unknown Object (File)
Sat, Oct 25, 2:32 PM
Unknown Object (File)
Sat, Oct 25, 2:32 PM
Unknown Object (File)
Sat, Oct 25, 2:32 PM
Unknown Object (File)
Sat, Oct 25, 2:32 PM
Subscribers

Details

Summary

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.

Test Plan

Tested on ASUS RT-N53 for enabling/reset USB core

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mizhka retitled this revision from to [BHND/bcma] Add implementation of BHND_BUS_RESET_CORE function for BCMA.
mizhka updated this object.
mizhka edited the test plan for this revision. (Show Details)
mizhka added reviewers: adrian, landonf.
mizhka set the repository for this revision to rS FreeBSD src repository - subversion.
adrian edited edge metadata.

looks good!

This revision is now accepted and ready to land.Jun 22 2016, 4:12 PM
landonf requested changes to this revision.Jun 23 2016, 5:27 AM
landonf edited edge metadata.

In addition to inline comments, if you happen to feel like implementing the nearly identical bcma_suspend_core(), I wouldn't say no :-)

sys/dev/bhnd/bcma/bcma.c
223

To ensure there are no pending operations prior to putting the core in reset, you should spin here for 300ms (in 10us intervals) waiting for resetstatus to clear.

227

After this 10us delay, you should spin waiting for resetstatus to clear; the resetctrl read-back shouldn't be necessary.

242

I'd recommend a slightly different order of operations that leaves the clock enabled/stable during reset (not that there's any documentation for any of this stuff ...).

  • Gate clock (SICF_FGC), but leave it enabled (SICF_CLOCK_EN).
  • Take core out of reset by clearing resetctrl.
  • Spin waiting for a read of resetctrl to return 0, retry up to ~10 times after first waiting up to 300us (in 10us intervals) for resetstatus to clear (for total possible delay of 3000us)
  • Disable clock gating (clear SICF_FGC).
sys/dev/bhnd/bhnd_core.h
27

These bcma-specific register offsets and bitflags are defined in bcma_dmp.h; can you switch to using those?

The bhnd_core.h header is shared with siba(4), which has its own register offsets/layout, but uses most of the same flags (including core-specific flags).

BCMA Offsets:

  • BHND_CF ->BCMA_DMP_IOCTRL (0x408)
  • BHND_SF -> BCMA_DMP_IOSTATUS (0x500)
  • BHND_RESET_CF -> BCMA_DMP_RESETCTRL (0x800)
  • BHND_RESET_SF -> BCMA_DMP_RESETSTATUS (0x804)

BCMA Flags:

  • BHND_RESET_CF_ENABLE -> BCMA_DMP_RC_RESET (0x0001)
This revision now requires changes to proceed.Jun 23 2016, 5:27 AM

In addition to inline comments, if you happen to feel like implementing the nearly identical bcma_suspend_core(), I wouldn't say no :-)

I can't find BCMA_DMP_RC_RESET:
https://github.com/freebsd/freebsd/search?utf8=%E2%9C%93&q=BCMA_DMP_RC_RESET&type=Code

Is there a typo?

mizhka edited edge metadata.
  • usage of macros from bcma_dmp.h instead of new ones
  • added status checks

Tested on Asus RT-N53 (USB core)

when you're both happy with it, I'll approve/commit it!

mizhka edited edge metadata.
  • fixed typo in macro name
  • timeout variable
landonf edited edge metadata.

It looks like the earlier revision already went in r302106. I can just revisit this when I get back around to implementing the siba versions and the remaining bcma suspend code.

This revision is now accepted and ready to land.Jun 25 2016, 5:28 AM
adrian edited edge metadata.
This revision was automatically updated to reflect the committed changes.