Page MenuHomeFreeBSD

sifive_prci: Add support for the FU740 PRCI
ClosedPublic

Authored by jrtc27 on Jul 5 2021, 12:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 4:59 AM
Unknown Object (File)
Fri, Nov 8, 8:37 AM
Unknown Object (File)
Fri, Nov 8, 5:51 AM
Unknown Object (File)
Oct 3 2024, 11:51 PM
Unknown Object (File)
Oct 3 2024, 5:06 PM
Unknown Object (File)
Oct 1 2024, 5:32 PM
Unknown Object (File)
Sep 28 2024, 1:22 PM
Unknown Object (File)
Sep 28 2024, 11:02 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/riscv/sifive/sifive_prci.c
230

Where does the bias of 2 come from?

236

From the clock schematic in the fu740 manual, pcieauxclk is not the child of hfpclk, but rather hfclk. I think the distinction would matter if we ever allow setting the pll clock frequency.

360–362

A lot of blank lines here... maybe lose this one?

369

So, is the generic clk_div class insufficient somehow?

sys/riscv/sifive/sifive_prci.c
230

Short answer: I used the Linux driver to infer the meaning of the register, as the manual is rather lacking in detail (though at least it documents this register unlike some of the others which are undocumented yet referred to by the Linux driver...)

The more elaborate answer is you can sort of infer this from the diagram. clktxclk is 0-250MHz and pclk is 0-125MHz, with pclk being clktxclk/N (ignoring buffers). Given the reset value of hfpclk_div is 0, that implies that 0 must mean 2 (as 250/125), and thus all values have an implicit +2 when used.

236

That's a good point, I suspect I just copied this from the divisor clock and failed to notice the subtle difference. Are we fine to assume the name of the clock in the device tree here, or do we need to make it dynamic?..

360–362

This was to mirror the style in prci_clk_pll_recalc, which I quite like as it separates out the MMIO from the normal calculation from the locking.

369

By default the real divisor is used, and you can also set a flag to have it start from 0, but there's no option to have a bias other than 0/1.

sys/riscv/sifive/sifive_prci.c
230

Yikes! Sounds good though :)

236

I think we can it assume it will be static since it appears to be defined in upstream u-boot and Linux as a fixed "hfclk".

501
513

Fix pcieauxclk parent (hfclk, not hfpclk), use explicit != NULL

This revision is now accepted and ready to land.Aug 4 2021, 2:54 PM
This revision was automatically updated to reflect the committed changes.