Page MenuHomeFreeBSD

Add clkng driver for Allwinner SoC
ClosedPublic

Authored by manu on Feb 9 2017, 4:24 PM.

Details

Reviewers
jmcneill
Group Reviewers
ARM
Commits
rS314303: Add clkng driver for Allwinner SoC
Summary

This adds the ccung driver for Allwinner SoC.
Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu node.
Currently only H3 is supported with almost the same state as HEAD. (video pll aren't supported for now but we don't support video).
This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc ...)

Test Plan

Tested on OrangePi One
cpufreq OK, ethernet OK, Thermal OK.
Audio isn't tested (no headphone on OrangePi).

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

manu updated this revision to Diff 24923.Feb 9 2017, 4:24 PM
manu retitled this revision from to Add clkng driver for Allwinner SoC.
manu updated this object.
manu edited the test plan for this revision. (Show Details)
manu added reviewers: ARM, jmcneill.
manu set the repository for this revision to rS FreeBSD src repository.
manu added a project: ARM.
manu updated this revision to Diff 24961.Feb 10 2017, 12:05 PM
manu removed rS FreeBSD src repository as the repository for this revision.

Only include ccu_h3.c is H3 SoC was selected.

manu updated this revision to Diff 25079.Feb 13 2017, 1:53 PM

PLL_AUDIO factor n is 7 bit wide, not 6.

manu updated this revision to Diff 25103.Feb 13 2017, 5:49 PM

Fix a few more mistakes in width of some factors.
It has been checked two times now but might need another pair of eyes.

jmcneill added inline comments.Feb 18 2017, 4:37 PM
sys/arm/allwinner/clkng/aw_ccung.c
286 ↗(On Diff #25103)

We're going to need a way to make the SoC specific bits compile time options. No sense in having H3 support in a 64-bit kernel, for example.

sys/arm/allwinner/clkng/aw_clk_nkmp.c
158 ↗(On Diff #25103)

This looks to be H3 specific.

232 ↗(On Diff #25103)
if ((flags & CLK_SET_DRYRUN) != 0) {

and a few more below..

sys/arm/allwinner/clkng/aw_clk_nm.c
190 ↗(On Diff #25103)
if ((sc->flags & AW_CLK_REPARENT) != 0) {
manu added inline comments.Feb 18 2017, 9:06 PM
sys/arm/allwinner/clkng/aw_ccung.c
286 ↗(On Diff #25103)

RIght, I'll make it depend on ALLWINNER_SOC_XXX

sys/arm/allwinner/clkng/aw_clk_nkmp.c
158 ↗(On Diff #25103)

I haven't finished/tested A31 but since I had the same lock problem when implementing cpufreq it might be needed there.

232 ↗(On Diff #25103)

Yup sorry will correct that.

manu updated this revision to Diff 25611.Feb 23 2017, 5:00 AM

Fix a few style(9) errors and only include H3 clk if SOC_ALLWINNER_H3 is selected.

manu marked 5 inline comments as done.Feb 23 2017, 5:03 AM
manu marked 2 inline comments as done.Feb 23 2017, 6:39 AM
manu added inline comments.
sys/arm/allwinner/clkng/aw_clk_nkmp.c
158 ↗(On Diff #25103)

Confirmed, this is needed on A31 for cpufreq.

jmcneill added inline comments.Feb 25 2017, 5:11 PM
sys/arm/allwinner/clkng/aw_clk_nkmp.c
158 ↗(On Diff #25103)

Are there plans for a10- and a23-style pll1 on clkng? According to arm/allwinner/clk/aw_pll.c these use nkmp style registers but do not require this change sequence.

manu marked an inline comment as done.Feb 25 2017, 5:21 PM
manu added inline comments.
sys/arm/allwinner/clkng/aw_clk_nkmp.c
158 ↗(On Diff #25103)

Then just don't set AW_CLK_SCALE_CHANGE and this will do the job.

jmcneill accepted this revision.Feb 25 2017, 7:23 PM
jmcneill edited edge metadata.
This revision is now accepted and ready to land.Feb 25 2017, 7:23 PM
This revision was automatically updated to reflect the committed changes.