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 - with reverts #1629

Merged
merged 30 commits into from
Sep 2, 2016

Conversation

msperl
Copy link
Contributor

@msperl msperl commented Sep 1, 2016

Make use of the clock framework for all drivers (no more opt in like with the 4.4 kernels, where lots of things stop working when the clock framework is enabled - especially i2s)

This is the equivalent patch to #1628, but here with reverted reverts instead of a single "bulk" revert.

msperl and others added 30 commits September 1, 2016 06:53
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]>
@popcornmix
Copy link
Collaborator

Thanks for working on/testing this.

@clivem
Copy link

clivem commented Sep 2, 2016

which @pelwell says is due to initialisation ordering, and they succeed after a deferred probe.

It tries to initialise some subsystems before clockmgr is initialised, so deferred probe. It's fine. I don't think we should hide those messages. I'd rather see them. ;)

@clivem
Copy link

clivem commented Sep 2, 2016

Lets see if there are any issues in the next nightly LibreELEC build.

Sorry, I forgot. I know you already told me the answer to this.... Is the LibreELEC build using 4.6 or 4.7 tree?

@popcornmix
Copy link
Collaborator

The wording and red colouration in dmesg will probably cause unwanted bug reports. Maybe there is a way to make it seem more normal.

LE uses 4.7 kernel.

@clivem
Copy link

clivem commented Sep 2, 2016

if (PTR_ERR(clk) != -EPROBE_DEFER) {
  dev_err(dev, "could not get clk\n");
}

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

Note that I have posted a patch to the rpi and clock list to initialize clockmgr early - You could try that...

@pelwell
Copy link
Contributor

pelwell commented Sep 2, 2016

Yes, that's what my patch looks like (except without the deprecated braces around a single line block).

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

Please get someone to test smi and pwm...

@clivem
Copy link

clivem commented Sep 2, 2016

Note that I have posted a patch to the rpi and clock list to initialize clockmgr early - You could try that...

@msperl LOL. Martin, make it easy for a fool. Can you give me a link to the patch rather than me scouring mailing list archives?

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

https://patchwork.kernel.org/patch/9128797/
I had to search as well (first in my emails, then in Google)

@clivem
Copy link

clivem commented Sep 2, 2016

Thanks. Hmmm. State Rejected, archived

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

Well, it was related to the second patch to claim the sdram clock early, which Eric wanted to get implemented differently (probably because the sdram clocks are only accessible from vc4)
Still that first part does early initialization

@clivem
Copy link

clivem commented Sep 2, 2016

I'd add a Tested-By and be asking the RPi guys to pull it, but seen as it is't going to receive upstream acceptance, it'll just remain part of my local, ever growing, patch set.

It didn't apply cleanly so I removed "err" variable and used the already defined "ret".

DigitalDreamtimeLtd@08f54e2

@popcornmix
Copy link
Collaborator

Yes, I also cherry-picked the patch to 4.7 tree. It avoids the deferred probe warnings.

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

I will try to upstream the early init patch alone - glad to hear that it makes a difference on its own...

@clivem
Copy link

clivem commented Sep 2, 2016

I will try to upstream the early init patch alone - glad to hear that it makes a difference on its own...

Cool! Makes perfect sense to me, that something on which everything else now depends, get's initialised early and avoids a bunch of deferred probes..... sdhost, mmc, serial....

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

Well, if I remember correctly, there was one concern about possible drivers that during init enable a clock and then fail/defer on something else, which would disable a clock which could disable a necessary pll or pll-divider...

But then I guess that driver needs to get modified.

@msperl
Copy link
Contributor Author

msperl commented Sep 2, 2016

So I guess this is finally done - now we require the support by Eric to get vc4 updates into the 4.7 kernel...

@clivem
Copy link

clivem commented Sep 4, 2016

So I guess this is finally done

@msperl Yes, we're done. Will be interesting to see if there is any "fall-out" after the next LibreELEC build.

The real question is, do we want to pull the "subsystems to use clockmgr rather than clocks directly, backport" into rpi-4.4.y, as this is going to be the "default" RPi kernel for the foreseeable future.... #1592 (If Pi guys are going to wait for next LTS. And if that is to be 4.9, that's not going to be before the end of the year.)

Anyway, this is finally "put to bed". Thank you Martin! You did all of the heavy lifting. I mostly did the "getting frustrated"..... ISTR, it was January when I started running the new dma code. (That took its time to make it into downstream.) And I've lost track of how many months ago, I was testing a rpi-4 tree "backport" of dma/I2S/clockmgr......

I'd like to return to trying to get that "simple framework" callback stuff into upstream simple-card, if you're up for it? I made a few more mods. Next week I'll make a new rpi-4.7.y branch.....

@msperl
Copy link
Contributor Author

msperl commented Sep 5, 2016

@clivem as for the backport: the patches should be easy to apply, but I guess foundation will not want to move that way as there is a bigger risk in breaking things unexpectedly. The risk is still there with 4.7, but a move to a newer kernel makes it more obvious that things may break.

I wonder if we now can get the vc4 driver into 4.7, because going from there it should then be easy to move to the next stable kernel, as we are mostly upstream already....

But I guess that popcornmix will need to make that decision.

@clivem
Copy link

clivem commented Sep 5, 2016

but I guess foundation will not want to move that way as there is a bigger risk in breaking things unexpectedly. The risk is still there with 4.7, but a move to a newer kernel makes it more obvious that things may break.

Agreed. But my concern is that we think we have put this to bed..... (I thought this was finished 3 months ago when I had everything I needed to work with clockmgr, working with a patched rpi-4.4 build.) If they really do wait for a 4.9 LTS release before moving from 4.4, this is going to come up again around Christmas, if there are any issues...... Don't know about you but I'd rather see them resolved now, rather than deferred for 3 months.

I wonder if we now can get the vc4 driver into 4.7, because going from there it should then be easy to move to the next stable kernel, as we are mostly upstream already....

I wonder if we need to ask @popcornmix et @pelwell to make a "next" build from the rpi-4.7.y tree so it gets some wider testing. (I'm not convinced that OpenELEC is enough. The stuff those guys are testing. ie. the audio, I'm fairly sure we are on safe ground already. I'm not sure they are interested in VC4.)

I think we should ping Eric and ask him to get VC4 "up to scratch" in this rpi-4.7.y tree and get a "next" build out there for the people who might want to live a little dangerously and not sit out the rest of the year with a rpi-4.4 kernel build. There are several people who did want I2S and VC4 at the same time. Make it easy for them with a "next" build they can rpi-update to, and they will test! ;)

@clivem
Copy link

clivem commented Sep 6, 2016

Having had cause to look closely at the logs on my CM test subject today, I noticed the enc28j60 spi ethernet not initialising on 4.7.y ....

Linux version 4.7.2-513.20160903git6e32787.fc20.armv6hl.bcm2708 (clivem@e5530) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) )

kernel: enc28j60 spi0.0: enc28j60 Ethernet driver 1.02 loaded
kernel: enc28j60 spi0.0: enc28j60 chip not found
kernel: enc28j60: probe of spi0.0 failed with error -5

I wondered whether this was related to clockmgr....

Still works fine on my rpi-4.4.y plus clockmgr backport.... (So most likely something else changed between rpi-4.4.y and rpi-4.7.y.)

Linux version 4.4.19-504.20160906git571df49.fc20.armv6hl.bcm2708 (clivem@e5530) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) )

kernel: enc28j60 spi0.0: enc28j60 Ethernet driver 1.02 loaded
kernel: net eth0: enc28j60 driver registered
NetworkManager[187]: <info> (eth0): driver 'enc28j60' does not support carrier detection.
NetworkManager[187]: <info> (eth0): new Ethernet device (driver: 'enc28j60' ifindex: 3)

I'll have to take a closer look later in the week.

@msperl
Copy link
Contributor Author

msperl commented Sep 6, 2016

It is "correctly" detected, as otherwise eth0 does not probe - "enc28j60_chipset_init" fails...

You can load enc28j60 with the kernel argument debug=... (up to 0xffff)

That should give you messages like "chip RevID:" and that indicates that spi is working and the chip is detected...

@popcornmix
Copy link
Collaborator

Ping @anholt - the rpi-4.7.y tree now uses the upstream clock framework.
It might be nice (not urgent) to get the vc4-kms-v3d merged in as hopefully we are closer to upstream and fewer cherry-picks are required. No immediate plan to bump to 4.7, but we can push out a "next" branch kernel for wider testing.

@msperl
Copy link
Contributor Author

msperl commented Sep 7, 2016

For completeness: the clock patches have gone into clk-next, so they should show up in 4.9...

Stary2001 added a commit to Stary2001/linux that referenced this pull request Dec 12, 2018
PR raspberrypi#1629 removed a dereference in the original code leading to smi_bus_address being wrong
Stary2001 added a commit to Stary2001/linux that referenced this pull request Dec 12, 2018
bef1575 (raspberrypi#1629) removed a dereference in the original code leading to smi_bus_address being wrong
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.

5 participants