Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpi-4.7.y enable clock manager and modify all subsystems to use it #1628

Closed

Conversation

clivem
Copy link

@clivem clivem commented Aug 31, 2016

Placeholder.... This is what I think we have to merge to move all of the subsystems over to using clock manager in rpi-4.7.y.

@msperl I think this is turning more into a "loose ends" to have clock manager enabled by default, and move all of the subsystems over to using it, rather than an "backport upstream clockmgr/I2S" thing. I'm still testing, but I'm not seeing any issues at the moment.

DigitalDreamtime and others added 20 commits August 31, 2016 20:58
Undo the REVERT of the patches already reverted in downstream rpi-4.7.y
 to get us back to upstream.

b3b4815
d4481e2
d4c84d9
f66b42f
658794c
01506b7
fb8d849
6019d04
b99821f
224a465
846ee11

Signed-off-by: DigitalDreamtime <[email protected]>
Enable the clock manager by default.

Signed-off-by: Martin Sperl <[email protected]>
Removed clock registers from reg and added clock to i2s devicetree node.

Signed-off-by: Martin Sperl <[email protected]>
Upstream mandates the use of "serial" as name inside the device-tree.
Note that this does not affect the use of the alias - there
uart0 and uart1 are permissible.

This also fixed the patch references inside the overlays for the rpi3.

Signed-off-by: Martin Sperl <[email protected]>
Moved uart0 to use new clock framework.
At the same time removed the fixed clock clk_uart0
and the corresponding references, as the clock is now
read directly from the configured clocks.

If it ever becomes necessary the following can get added
to modify the base clock rate later:
	assigned-clocks = <&clocks BCM2835_CLOCK_UART>;
	assigned-clock-rates = <X>;

Signed-off-by: Martin Sperl <[email protected]>
use spi0 to use new clock framwork

Signed-off-by: Martin Sperl <[email protected]>
move i2c to use the new clock framework instead of the fixed clock

Signed-off-by: Martin Sperl <[email protected]>
Move PWM to use the new clock framework

Signed-off-by: Martin Sperl <[email protected]>
Fix the auxiliar clock provider to use the clock framework

Signed-off-by: Martin Sperl <[email protected]>
Fix the register range of the spi-aux devices,
as they do not control the gate.

Signed-off-by: Martin Sperl <[email protected]>
Move to new aux-uart driver (from upstream) and enable it correctly
in the device tree

Note that this may also solve the "serial not 115200 baud"
issue on the rpi3...

With an extension to the driver (requesting clock change
notifications) the driver could change the baud divider when
such a clock change occurs...

It still would require some communication between the firmware
and the kernel, so that this would get propagated.

Signed-off-by: Martin Sperl <[email protected]>
Remove no longer necessary fixed pwm clock.

Signed-off-by: Martin Sperl <[email protected]>
Use clock manager instead of self-made clockmanager.

Also fix some error paths that showd up during development
(especially missing release of dma resources on rmmod)

Signed-off-by: Martin Sperl <[email protected]>
Move smi to use clock framework.

Signed-off-by: Martin Sperl <[email protected]>
Move mmc to use clock framework.

For some reason the emmc clock dirver does not claim the
clock - enable count stays at 0 for the emmc clock.

Signed-off-by: Martin Sperl <[email protected]>
Move the sdhost device to use the clock framework.

Unfortunately I can not test it on my CM, as it seem as if
there is no overlay that would enable sdhost and change the
gpio-mux to the correct ALT0 (from Alt3 from mmc).

Signed-off-by: Martin Sperl <[email protected]>
Remove clk_core from device tree as it is no longer used.
Any "modification" to the core_clock in the bootloader is now
automatically detected via the cnew clockmgr.

Signed-off-by: Martin Sperl <[email protected]>
Revert the i2s-mmap dt overlay (7ee829f).

Signed-off-by: DigitalDreamtime <[email protected]>
Moved uart0 to use new clock framework.
At the same time removed the fixed clock clk_uart0
and the corresponding references, as the clock is now
read directly from the configured clocks.

If it ever becomes necessary the following can get added
to modify the base clock rate later:
	assigned-clocks = <&clocks BCM2835_CLOCK_UART>;
	assigned-clock-rates = <X>;

Signed-off-by: DigitalDreamtime <[email protected]>
Remove clk_core from device tree as it is no longer used.
Any "modification" to the core_clock in the bootloader is now
automatically detected via the cnew clockmgr.

Signed-off-by: DigitalDreamtime <[email protected]>
@msperl
Copy link
Contributor

msperl commented Aug 31, 2016

On comment: imo the "bcm2835-i2s: REVERT the reverted patches" patch is slightly ugly - maybe just revert each of the reverts separately to document what actually happened instead of referencing in the comment.

But it is up to @popcornmix to decide what he prefers to merge...

Besides that I guess we should now be good enough to use the clock-framework for everything.
(Besides some intensive testing - especially SMI, as the corresponding patch is untested!)

This finally allows to use vc4 graphics together with i2s.

If this works fine in 4.7, then it should also be possible to cherry-pick these patches in 4.4, but I guess that may be seen as too risky.

@msperl
Copy link
Contributor

msperl commented Sep 1, 2016

here the quick branch that just did the reverts individually:
https://github.com/msperl/linux-rpi/commits/rpi-4.7.y-clock-only
This:

7064620 Revert "Revert "ASoC: bcm2835: Add S16_LE support via packed DMA transfers""
d53e90d Revert "Revert "ASoC: bcm2835: setup clock only if CPU is clock master""
02771a5 Revert "Revert "ASoC: bcm2835: add 24bit support""
bc5f27c Revert "Revert "ASoC: bcm2835: move to use the clock framework""
b79165f Revert "bcm2835-i2s: get base address for DMA from devicetree"
0abba71 Revert "bcm2835-i2s: add 24bit support, update bclk_ratio to more correct values"
c434816 Revert "bcm2835-i2s: setup clock only if CPU is clock master"
a23e7bf Revert "bcm2835-i2s: Eliminate debugfs directory error"
3f5e417 Revert "bcm2835-i2s: Register PCM device"
f7eabb0 Revert "bcm2835-i2s: Enable MMAP support via a DT property"
2341c37 Revert "bcm2835-i2s: Reduce the TX DREQ threshold"

only replaces this:
d0b57d0 bcm2835-i2s: REVERT the reverted patches

Note that:
git diff remotes/DigitalDreamtimeLtd/rpi-4.7.y-clockmgr3 remotes/origin/rpi-4.7.y-clock-only produces no output, so the branches are identical in content.

Note: I have not tested this yet - compile is running...

@popcornmix: the question is: do you want a pull request of this patchset?

@clivem
Copy link
Author

clivem commented Sep 1, 2016

@msperl Yes, I know. I was lazy with the "revert the reverts" patchset, bundling it into one commit. ;)
I figured as they rebase the non-current branches, ie. when 4.7.2->4.7.3, it would matter as the history would disappear, nothing would be reverted to start with, so wouldn't need to revert the reverts. ;)

@msperl I'm thinking I want to ask @popcornmix to also cherry-pick this 2b8dfa3 commit from rpi-4.4.y to rpi-4.7.y. What do you think? (I think any of the other Anholt clock commits are specific to his VC4 stuff and can wait until he rebases his 4.4 code to 4.7.)

@popcornmix
Copy link
Collaborator

At some point after merging the reverts and "reverts of reverts" will be dropped.
Individual reverts of each commit will make this slightly easy to pair up, so is preferable, but I imagine I'll deal with it either way.

@msperl
Copy link
Contributor

msperl commented Sep 1, 2016

@popcornmix : Created #1629 with reverted reverts instead of the "bulk revert".

Please choose which one you prefer to merge.

@msperl
Copy link
Contributor

msperl commented Sep 1, 2016

@clivem : the patch by Eric with regards to DSI/PLL reconfig probably needs to get in when all those DSI patches go in.

In principle I guess the next step would be for eric to update his VC4 patchset for 4.7, but I guess we should be able to cherry-pick the VC4 4.8 patches immediately:

git log --oneline v4.8-rc4 ^rpi-4.7.y-clock-only --no-merges  -- ./drivers/gpu/drm/vc4/
63fe9bb drm/vc4: Delete unnecessary checks before two function calls
a20d5fa drm/vc4: Fix a "the the" typo in a comment.
20e48fd drm/vc4: Fix definition of QPU_R_MS_REV_FLAGS
7363cee drm/vc4: Add a getparam to signal support for branches.
6d45c81 drm/vc4: Add support for branching in shader validation.
93aa9ae drm/vc4: Add a bitmap of branch targets during shader validation.
d0566c2 drm/vc4: Move validation's current/max ip into the validation struct.
af71379 drm/vc4: Add a getparam ioctl for getting the V3D identity regs.
deb4765 drm/vc4: remove redundant ret status check
1bf59f1 drm/vc4: Implement precise vblank timestamping.
7a10096 drm/vc4: Bind the HVS before we bind the individual CRTCs.
027a697 gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle
9397776 drm: vc4: enable XBGR8888 and ABGR8888 pixel formats
f510f34 drm/vc4: Remove unused connector
398e979 drm/vc4: Remove open-coded drm_connector_register_all()
b2d61d6 drm: vc4: Rely on the default ->best_encoder() behavior
5e84c26 drm/atomic-helper: Massage swap_state signature somewhat
7ea7728 drm/core: Change declaration for gamma_set.
a9402df drm/vc4: clean up error exit path on failed dpi_connector allocation
2f196b7 drm/atomic: Add drm_atomic_crtc_state_for_each_plane_state
833cd78 drm/vc4: Use for_each_plane_in_state
b82caaf drm/vc4: Use lockless gem BO free callback
db36972 drm/vc4: Use drm_gem_object_unreference_unlocked

I am not sure if there would be some need for some other (support) patches to make these really work...

@msperl
Copy link
Contributor

msperl commented Sep 1, 2016

a quick check (individual cherry pick + conflict check + compile check) shows that this one does not apply cleanly:

  • 7ea7728 drm/core: Change declaration for gamma_set.
    • this has the following prerequisites (to apply without issues):
      • 3abb263 drm/cirrus: Drop redundnant gamma size check
      • 6136bfb drm/atomic-helper: Fixup kerneldoc for drm_atomic_helper_legacy_gamma_set
      • 5d943aa drm: Consolidate crtc arrays in drm_atomic_state
      • b8b5342 drm: Consolidate plane arrays in drm_atomic_state
      • 63e83c1 drm: Consolidate connector arrays in drm_atomic_state
      • 2e7a570 drm/doc: Appease sphinx
      • be9174a drm/atomic-helper: use for_each_*_in_state more
      • a0909cc drm/atomic: Handle funcs->best_encoder == NULL case
      • f55f170 drm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled
  • 5e84c26 drm/atomic-helper: Massage swap_state signature somewhat
    • 76c6dcc Merge branch 'virtio-gpu-for-airlied' of git://git.kraxel.org/linux into drm-next
      this is a merge and (probably) produces lots of conflicts...
    • bbbed88 virtio-gpu: switch to atomic cursor interfaces
    • e7cf096 virtio-gpu: add atomic_commit function
    • a288c1e drm/virtio: use drm_crtc_send_vblank_event()

so for the vc4 stuff eric needs to look into it...

But anyway: this is outside the scope of this pull

@clivem
Copy link
Author

clivem commented Sep 1, 2016

so for the vc4 stuff eric needs to look into it...

Yes, I'd rather stay well away from anything to do with vc4. I am not going to be able to do any testing with all of my "headless" configurations....

@clivem
Copy link
Author

clivem commented Sep 1, 2016

Closing, in favour of #1629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants