Page MenuHomeFreeBSD

allwinner: Convert to extres clk/hwreset APIs
ClosedPublic

Authored by jmcneill on Mar 26 2016, 9:40 PM.

Details

Summary

Convert the Allwinner port from custom clock drivers to the new extres clk/hwreset APIs.

This removes the need for the custom "ccm" node in the Allwinner dts files, allowing us to use more or less unmodified upstream dts files.

As of now, upstream dts does not support the A20 HDMI or display engine, so these nodes are provided in sun7i-a20-hdmi.dtsi.

This patch has been verified across A10, A20, A31, and A31s boards.

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

jmcneill updated this revision to Diff 14637.Mar 26 2016, 9:40 PM
jmcneill retitled this revision from to allwinner: Convert to extres clk/hwreset APIs.
jmcneill updated this object.
jmcneill edited the test plan for this revision. (Show Details)
jmcneill added a reviewer: ARM.
jmcneill set the repository for this revision to rS FreeBSD src repository.
jmcneill added a project: ARM.
jmcneill added inline comments.Mar 26 2016, 9:51 PM
sys/arm/allwinner/a10_hdmi.c
198 ↗(On Diff #14637)

#define<tab>

andrew added inline comments.Mar 27 2016, 8:50 AM
sys/arm/allwinner/a10_ahci.c
329 ↗(On Diff #14637)

It wold be safer to check if both clocks exist in the dtb before trying to enable them.

358 ↗(On Diff #14637)

This might leave one or both clocks enabled which may not be desirable.

sys/arm/allwinner/a10_codec.c
809–819 ↗(On Diff #14637)

It feels like we need a high level API to optionally set the frequency & enable the clock, it's a common operation. Even better if it can handle multiple clocks & cleanup correctly on failure of one.

manu_bidouilliste.com added inline comments.
sys/arm/conf/A10
61 ↗(On Diff #14637)

Missing uart_snps

sys/arm/conf/A20
81 ↗(On Diff #14637)

This is not needed

sys/boot/fdt/dts/arm/bananapi.dts
29 ↗(On Diff #14637)

Could you integrate the change from D5718 with it ?
The disabled nodes aren't needed.

#include "sun7i-a20-hdmi.dtsi"

/ {

soc@01c00000 {
        hdmi@01c16000 {
                status = "okay";
        };

        hdmiaudio {
                status = "okay";
        };
};

};

&mmc0_pins_a {

allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;

};

sys/boot/fdt/dts/arm/cubieboard.dts
29 ↗(On Diff #14637)

#include "sun7i-a20-hdmi.dtsi"

/ {

soc@01c00000 {
        hdmi@01c16000 {
                status = "okay";
        };

        hdmiaudio {
                status = "okay";
        };
};

};

sys/boot/fdt/dts/arm/olinuxino-lime.dts
29 ↗(On Diff #14637)

#include "sun7i-a20-hdmi.dtsi"

/ {

soc@01c00000 {
        hdmi@01c16000 {
                status = "okay";
        };

        hdmiaudio {
                status = "okay";
        };
};

};

jmcneill added inline comments.Mar 27 2016, 4:26 PM
sys/boot/fdt/dts/arm/cubieboard.dts
29 ↗(On Diff #14637)

Do we know if the HDMI code works on sun4i-a10?

jmcneill added inline comments.Mar 27 2016, 4:34 PM
sys/arm/conf/A10
61 ↗(On Diff #14637)

Should get sorted out when D5749 is merged.

sys/arm/conf/A20
81 ↗(On Diff #14637)

This should get cleaned up when D5749 gets merged.

mmel added a subscriber: mmel.Mar 27 2016, 4:35 PM
mmel added inline comments.
sys/arm/allwinner/a10_codec.c
819 ↗(On Diff #14637)

Settings frequency in consumer driver is not frequent operation, mainly if is fixed. Imho, it's always better to setup base frequency plan for whole SoC at one place (in this case probably in driver for "/clocks" node). Typical consumers of clk_set_freq() are MMC, HDMI or UART - where frequency must be changed at runtime by user or connected device request.

sys/boot/fdt/dts/arm/cubieboard.dts
29 ↗(On Diff #14637)

You're right I forgot, just tested it and it doesn't work.

jmcneill marked 4 inline comments as done.Mar 27 2016, 4:47 PM
jmcneill added inline comments.
sys/boot/fdt/dts/arm/olinuxino-lime.dts
29 ↗(On Diff #14637)

Not supported on sun4i-a10 yet.

jmcneill marked 2 inline comments as done.Mar 27 2016, 4:47 PM
jmcneill updated this revision to Diff 14682.Mar 28 2016, 5:13 PM
  • a10_hdmi.c: style fix
  • a10_ahci.c: cleanup clocks on failure paths
jmcneill marked 2 inline comments as done.Mar 28 2016, 5:14 PM
jmcneill updated this revision to Diff 14843.Apr 2 2016, 9:51 PM

Fix some off-by-ones when validating mux input values, and add expected clock indices for sun4i usb clocks.

jmcneill marked 4 inline comments as done.Apr 2 2016, 9:53 PM
jmcneill updated this revision to Diff 14948.Apr 6 2016, 8:23 PM
  • aw_usbphy: Use regulator framework instead of poking GPIOs directly.
  • dts: add HDMI, HDMI audio, and MMC pin setting fixes to bananapi.dts
  • dwc: Split clock initialization between generic dwc and a20 dwc glue based on bindings documents (stmmac.txt, allwinner,sun7i-a20-gmac.txt)
jmcneill marked an inline comment as done.Apr 6 2016, 8:24 PM
gonzo accepted this revision.Apr 6 2016, 11:00 PM
gonzo added a reviewer: gonzo.
This revision is now accepted and ready to land.Apr 6 2016, 11:00 PM
This revision was automatically updated to reflect the committed changes.