This patchset adds support for the SimpleFB on Allwinner SoCs with "Display Engine 2.0".
PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
PATCH 4 adds the pipeline strings for DE2 SimpleFB.
PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB) for H3/H5 SoCs.
PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
Icenowy Zheng (11): dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3 clk: sunxi-ng: add support for Allwinner H3 DE2 CCU clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU dt-bindings: simplefb-sunxi: add pipelines for DE2 ARM: sun8i: h3/h5: add DE2 CCU device node for H3 arm64: allwinner: h5: add compatible string for DE2 CCU ARM: sunxi: h3/h5: add simplefb nodes dt-bindings: add binding for A64 DE2 CCU SRAM clk: sunxi-ng: add support for Allwinner A64 DE2 CCU arm64: allwinner: a64: add DE2 CCU for A64 SoC arm64: allwinner: a64: add simplefb for A64 SoC
.../devicetree/bindings/clock/sun8i-de2.txt | 10 ++- .../bindings/display/simple-framebuffer-sunxi.txt | 4 + arch/arm/boot/dts/sun8i-h3.dtsi | 4 + arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 +++++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 65 +++++++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 + drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 85 +++++++++++++++++++--- 7 files changed, 202 insertions(+), 13 deletions(-)
The DE2 CCU is different on A83T and H3 -- the parent of the clocks on A83T is PLL_DE but on H3 it's the DE module clock. This is not noticed when I develop the DE2 CCU driver.
Fix the binding by using different compatibles for A83T and H3, adding notes for the PLL_DE usage on A83T, and change the binding example's compatible from A83T to H3 (as it specifies the DE module clock).
Fixes: ed74f8a8a679 ("dt-bindings: add binding for the Allwinner DE2 CCU") Signed-off-by: Icenowy Zheng icenowy@aosc.io --- Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/clock/sun8i-de2.txt b/Documentation/devicetree/bindings/clock/sun8i-de2.txt index 631d27cd89d6..f2fa87c4765c 100644 --- a/Documentation/devicetree/bindings/clock/sun8i-de2.txt +++ b/Documentation/devicetree/bindings/clock/sun8i-de2.txt @@ -4,13 +4,14 @@ Allwinner Display Engine 2.0 Clock Control Binding Required properties : - compatible: must contain one of the following compatibles: - "allwinner,sun8i-a83t-de2-clk" + - "allwinner,sun8i-h3-de2-clk" - "allwinner,sun8i-v3s-de2-clk" - "allwinner,sun50i-h5-de2-clk"
- reg: Must contain the registers base address and length - clocks: phandle to the clocks feeding the display engine subsystem. Three are needed: - - "mod": the display engine module clock + - "mod": the display engine module clock (on A83T it's the DE PLL) - "bus": the bus clock for the whole display engine subsystem - clock-names: Must contain the clock names described just above - resets: phandle to the reset control for the display engine subsystem. @@ -19,7 +20,7 @@ Required properties :
Example: de2_clocks: clock@1000000 { - compatible = "allwinner,sun8i-a83t-de2-clk"; + compatible = "allwinner,sun8i-h3-de2-clk"; reg = <0x01000000 0x100000>; clocks = <&ccu CLK_BUS_DE>, <&ccu CLK_DE>;
On Fri, Dec 22, 2017 at 6:22 AM, Icenowy Zheng icenowy@aosc.io wrote:
The DE2 CCU is different on A83T and H3 -- the parent of the clocks on A83T is PLL_DE but on H3 it's the DE module clock. This is not noticed when I develop the DE2 CCU driver.
Fix the binding by using different compatibles for A83T and H3, adding notes for the PLL_DE usage on A83T, and change the binding example's compatible from A83T to H3 (as it specifies the DE module clock).
Fixes: ed74f8a8a679 ("dt-bindings: add binding for the Allwinner DE2 CCU") Signed-off-by: Icenowy Zheng icenowy@aosc.io
Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Please add acks when posting new versions.
Rob
Allwinner H3 features a DE2 CCU like the one on A83T, however the parent of the clocks is the DE module clock, not the PLL_DE clock.
Add support for it.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 5cc9d9952121..2db5d4e00ea7 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -41,6 +41,8 @@ static SUNXI_CCU_GATE(wb_clk, "wb", "wb-div",
static SUNXI_CCU_M(mixer0_div_clk, "mixer0-div", "de", 0x0c, 0, 4, CLK_SET_RATE_PARENT); +static SUNXI_CCU_M(mixer1_div_clk, "mixer1-div", "de", 0x0c, 4, 4, + CLK_SET_RATE_PARENT); static SUNXI_CCU_M(wb_div_clk, "wb-div", "de", 0x0c, 8, 4, CLK_SET_RATE_PARENT);
@@ -65,6 +67,20 @@ static struct ccu_common *sun8i_a83t_de2_clks[] = { &wb_div_a83_clk.common, };
+static struct ccu_common *sun8i_h3_de2_clks[] = { + &mixer0_clk.common, + &mixer1_clk.common, + &wb_clk.common, + + &bus_mixer0_clk.common, + &bus_mixer1_clk.common, + &bus_wb_clk.common, + + &mixer0_div_clk.common, + &mixer1_div_clk.common, + &wb_div_clk.common, +}; + static struct ccu_common *sun8i_v3s_de2_clks[] = { &mixer0_clk.common, &wb_clk.common, @@ -93,6 +109,23 @@ static struct clk_hw_onecell_data sun8i_a83t_de2_hw_clks = { .num = CLK_NUMBER, };
+static struct clk_hw_onecell_data sun8i_h3_de2_hw_clks = { + .hws = { + [CLK_MIXER0] = &mixer0_clk.common.hw, + [CLK_MIXER1] = &mixer1_clk.common.hw, + [CLK_WB] = &wb_clk.common.hw, + + [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw, + [CLK_BUS_MIXER1] = &bus_mixer1_clk.common.hw, + [CLK_BUS_WB] = &bus_wb_clk.common.hw, + + [CLK_MIXER0_DIV] = &mixer0_div_clk.common.hw, + [CLK_MIXER1_DIV] = &mixer1_div_clk.common.hw, + [CLK_WB_DIV] = &wb_div_clk.common.hw, + }, + .num = CLK_NUMBER, +}; + static struct clk_hw_onecell_data sun8i_v3s_de2_hw_clks = { .hws = { [CLK_MIXER0] = &mixer0_clk.common.hw, @@ -133,6 +166,16 @@ static const struct sunxi_ccu_desc sun8i_a83t_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), };
+static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = { + .ccu_clks = sun8i_h3_de2_clks, + .num_ccu_clks = ARRAY_SIZE(sun8i_h3_de2_clks), + + .hw_clks = &sun8i_h3_de2_hw_clks, + + .resets = sun8i_a83t_de2_resets, + .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), +}; + static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { .ccu_clks = sun8i_a83t_de2_clks, .num_ccu_clks = ARRAY_SIZE(sun8i_a83t_de2_clks), @@ -237,6 +280,10 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { .compatible = "allwinner,sun8i-a83t-de2-clk", .data = &sun8i_a83t_de2_clk_desc, }, + { + .compatible = "allwinner,sun8i-h3-de2-clk", + .data = &sun8i_h3_de2_clk_desc, + }, { .compatible = "allwinner,sun8i-v3s-de2-clk", .data = &sun8i_v3s_de2_clk_desc,
The clocks of A64/H5 SoCs in the DE2 CCU is the same as the clocks in H3 DE2 CCU rather than the A83T DE2 CCU (the parent of them is the DE module clock).
Fix this by change the clock descriptions to use the clocks of H3.
Fixes: 763c5bd045b1 ("clk: sunxi-ng: add support for DE2 CCU") Signed-off-by: Icenowy Zheng icenowy@aosc.io --- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 2db5d4e00ea7..468d1abaf0ee 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -177,10 +177,10 @@ static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = { };
static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = { - .ccu_clks = sun8i_a83t_de2_clks, - .num_ccu_clks = ARRAY_SIZE(sun8i_a83t_de2_clks), + .ccu_clks = sun8i_h3_de2_clks, + .num_ccu_clks = ARRAY_SIZE(sun8i_h3_de2_clks),
- .hw_clks = &sun8i_a83t_de2_hw_clks, + .hw_clks = &sun8i_h3_de2_hw_clks,
.resets = sun50i_a64_de2_resets, .num_resets = ARRAY_SIZE(sun50i_a64_de2_resets),
As we're going to add simplefb support for Allwinner SoCs with DE2, add suitable pipeline strings in the device tree binding.
Acked-by: Rob Herring robh@kernel.org Signed-off-by: Icenowy Zheng icenowy@aosc.io --- Changes in v2: - Adds Rob's ACK.
.../devicetree/bindings/display/simple-framebuffer-sunxi.txt | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt b/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt index a9168ae6946c..d693b8dc9a62 100644 --- a/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt +++ b/Documentation/devicetree/bindings/display/simple-framebuffer-sunxi.txt @@ -15,6 +15,10 @@ Required properties: "de_be1-lcd1" "de_be0-lcd0-hdmi" "de_be1-lcd1-hdmi" + "mixer0-lcd0" + "mixer0-lcd0-hdmi" + "mixer1-lcd1-hdmi" + "mixer1-lcd1-tve"
Example:
The DE2 in H3/H5 has a clock control unit in it, and the behavior is slightly different between H3 and H5.
Add the common parts in H3/H5 DTSI, and add the compatible string in H3 DTSI.
The compatible string of H5 DE2 CCU will be added in a separated patch.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- Changes in v2: - Use H3 DE2 CCU compatible as it's discovered that H3 and A83T DE2 CCU are not equal.
arch/arm/boot/dts/sun8i-h3.dtsi | 4 ++++ arch/arm/boot/dts/sunxi-h3-h5.dtsi | 14 ++++++++++++++ 2 files changed, 18 insertions(+)
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi index b36f9f423c39..8495deecedad 100644 --- a/arch/arm/boot/dts/sun8i-h3.dtsi +++ b/arch/arm/boot/dts/sun8i-h3.dtsi @@ -85,6 +85,10 @@ compatible = "allwinner,sun8i-h3-ccu"; };
+&display_clocks { + compatible = "allwinner,sun8i-h3-de2-clk"; +}; + &mmc0 { compatible = "allwinner,sun7i-a20-mmc"; clocks = <&ccu CLK_BUS_MMC0>, diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index 8d40c00d64bb..fcb909658cf0 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -40,9 +40,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */
+#include <dt-bindings/clock/sun8i-de2.h> #include <dt-bindings/clock/sun8i-h3-ccu.h> #include <dt-bindings/clock/sun8i-r-ccu.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/reset/sun8i-de2.h> #include <dt-bindings/reset/sun8i-h3-ccu.h> #include <dt-bindings/reset/sun8i-r-ccu.h>
@@ -85,6 +87,18 @@ #size-cells = <1>; ranges;
+ display_clocks: clock@1000000 { + /* compatible is in per SoC .dtsi file */ + reg = <0x01000000 0x100000>; + clocks = <&ccu CLK_DE>, + <&ccu CLK_BUS_DE>; + clock-names = "mod", + "bus"; + resets = <&ccu RST_BUS_DE>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + syscon: syscon@1c00000 { compatible = "allwinner,sun8i-h3-system-controller", "syscon";
On Fri, Dec 22, 2017 at 08:22:37PM +0800, Icenowy Zheng wrote:
The DE2 in H3/H5 has a clock control unit in it, and the behavior is slightly different between H3 and H5.
Add the common parts in H3/H5 DTSI, and add the compatible string in H3 DTSI.
The compatible string of H5 DE2 CCU will be added in a separated patch.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
Changes in v2:
- Use H3 DE2 CCU compatible as it's discovered that H3 and A83T DE2 CCU are not equal.
arch/arm/boot/dts/sun8i-h3.dtsi | 4 ++++ arch/arm/boot/dts/sunxi-h3-h5.dtsi | 14 ++++++++++++++
Could you split that patch in half, with the common part in one patch, and the H3 part in a second one?
This is a nightmare to merge otherwise.
Thanks! Maxime
The DE2 CCU on Allwinner H5 SoC has a slightly different behavior than the one on H3, so the compatible string is not set in the common DTSI file.
Add the compatible string of H5 DE2 CCU in H5 DTSI file.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi index d9a720bff05d..e237c05cfdb4 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi @@ -98,6 +98,10 @@ compatible = "allwinner,sun50i-h5-ccu"; };
+&display_clocks { + compatible = "allwinner,sun50i-h5-de2-clk"; +}; + &mmc0 { compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
The H3/H5 SoCs have a HDMI output and a TV Composite output.
Add simplefb nodes for these outputs.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- arch/arm/boot/dts/sunxi-h3-h5.dtsi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index fcb909658cf0..31478c03790d 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -53,6 +53,35 @@ #address-cells = <1>; #size-cells = <1>;
+ chosen { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + framebuffer-hdmi { + compatible = "allwinner,simple-framebuffer", + "simple-framebuffer"; + allwinner,pipeline = "mixer0-lcd0-hdmi"; + clocks = <&display_clocks CLK_BUS_MIXER0>, + <&ccu CLK_BUS_TCON0>, <&ccu CLK_BUS_HDMI>, + <&display_clocks CLK_MIXER0>, + <&ccu CLK_TCON0>, <&ccu CLK_HDMI>, + <&ccu CLK_HDMI_DDC>; + status = "disabled"; + }; + + framebuffer-tve { + compatible = "allwinner,simple-framebuffer", + "simple-framebuffer"; + allwinner,pipeline = "mixer1-lcd1-tve"; + clocks = <&display_clocks CLK_BUS_MIXER1>, + <&ccu CLK_BUS_TCON1>, <&ccu CLK_BUS_TVE>, + <&display_clocks CLK_MIXER1>, + <&ccu CLK_TVE>; + status = "disabled"; + }; + }; + clocks { #address-cells = <1>; #size-cells = <1>;
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
The H3/H5 SoCs have a HDMI output and a TV Composite output.
Add simplefb nodes for these outputs.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi index fcb909658cf0..31478c03790d 100644 --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi @@ -53,6 +53,35 @@ #address-cells = <1>; #size-cells = <1>;
chosen {
#address-cells = <1>;
#size-cells = <1>;
ranges;
framebuffer-hdmi {
compatible = "allwinner,simple-framebuffer",
"simple-framebuffer";
allwinner,pipeline = "mixer0-lcd0-hdmi";
clocks = <&display_clocks CLK_BUS_MIXER0>,
<&ccu CLK_BUS_TCON0>, <&ccu CLK_BUS_HDMI>,
Are the bus clocks necessary? It's not like simplefb is going to access any of the control registers.
<&display_clocks CLK_MIXER0>,
<&ccu CLK_TCON0>, <&ccu CLK_HDMI>,
<&ccu CLK_HDMI_DDC>;
Is the DDC clock necessary? There's no usage of DDC with simplefb.
ChenYu
status = "disabled";
};
framebuffer-tve {
compatible = "allwinner,simple-framebuffer",
"simple-framebuffer";
allwinner,pipeline = "mixer1-lcd1-tve";
clocks = <&display_clocks CLK_BUS_MIXER1>,
<&ccu CLK_BUS_TCON1>, <&ccu CLK_BUS_TVE>,
<&display_clocks CLK_MIXER1>,
<&ccu CLK_TVE>;
status = "disabled";
};
};
clocks { #address-cells = <1>; #size-cells = <1>;
-- 2.14.2
A64's Display Engine 2.0 needs a section of SRAM (SRAM C) to be claimed, otherwise the whole DE2 memory zone cannot be accessed (kept to all 0).
Add binding for this, in order to make the DE2 CCU able to claim the SRAM and enable access to the DE2 clock and reset registers.
Acked-by: Rob Herring robh@kernel.org Signed-off-by: Icenowy Zheng icenowy@aosc.io --- Changes in v3: - Add Rob's ACK.
Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/sun8i-de2.txt b/Documentation/devicetree/bindings/clock/sun8i-de2.txt index f2fa87c4765c..a7d558a2b9b2 100644 --- a/Documentation/devicetree/bindings/clock/sun8i-de2.txt +++ b/Documentation/devicetree/bindings/clock/sun8i-de2.txt @@ -6,6 +6,7 @@ Required properties : - "allwinner,sun8i-a83t-de2-clk" - "allwinner,sun8i-h3-de2-clk" - "allwinner,sun8i-v3s-de2-clk" + - "allwinner,sun50i-a64-de2-clk" - "allwinner,sun50i-h5-de2-clk"
- reg: Must contain the registers base address and length @@ -18,6 +19,10 @@ Required properties : - #clock-cells : must contain 1 - #reset-cells : must contain 1
+Additional required properties for "allwinner,sun50i-a64-de2-clk" : +- allwinner,sram: See Documentation/devicetree/bindings/sram/sunxi-sram.txt, + should be the SRAM C section on A64 SoC. + Example: de2_clocks: clock@1000000 { compatible = "allwinner,sun8i-h3-de2-clk";
Allwinner A64's DE2 needs to claim a section of SRAM (SRAM C) to work.
Add support for it.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 468d1abaf0ee..38b029b7bb5a 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -17,6 +17,7 @@ #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/reset.h> +#include <linux/soc/sunxi/sunxi_sram.h>
#include "ccu_common.h" #include "ccu_div.h" @@ -196,6 +197,11 @@ static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), };
+static bool sunxi_de2_clk_has_sram(const struct device_node *node) +{ + return of_device_is_compatible(node, "allwinner,sun50i-a64-de2-clk"); +} + static int sunxi_de2_clk_probe(struct platform_device *pdev) { struct resource *res; @@ -239,11 +245,20 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) return ret; }
+ if (sunxi_de2_clk_has_sram(pdev->dev.of_node)) { + ret = sunxi_sram_claim(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, + "Error couldn't map SRAM to device\n"); + return ret; + } + } + /* The clocks need to be enabled for us to access the registers */ ret = clk_prepare_enable(bus_clk); if (ret) { dev_err(&pdev->dev, "Couldn't enable bus clk: %d\n", ret); - return ret; + goto err_release_sram; }
ret = clk_prepare_enable(mod_clk); @@ -272,6 +287,10 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) clk_disable_unprepare(mod_clk); err_disable_bus_clk: clk_disable_unprepare(bus_clk); +err_release_sram: + if (sunxi_de2_clk_has_sram(pdev->dev.of_node)) + sunxi_sram_release(&pdev->dev); + return ret; }
@@ -288,17 +307,14 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { .compatible = "allwinner,sun8i-v3s-de2-clk", .data = &sun8i_v3s_de2_clk_desc, }, + { + .compatible = "allwinner,sun50i-a64-de2-clk", + .data = &sun50i_a64_de2_clk_desc, + }, { .compatible = "allwinner,sun50i-h5-de2-clk", .data = &sun50i_a64_de2_clk_desc, }, - /* - * The Allwinner A64 SoC needs some bit to be poke in syscon to make - * DE2 really working. - * So there's currently no A64 compatible here. - * H5 shares the same reset line with A64, so here H5 is using the - * clock description of A64. - */ { } };
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
Allwinner A64's DE2 needs to claim a section of SRAM (SRAM C) to work.
Add support for it.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 468d1abaf0ee..38b029b7bb5a 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -17,6 +17,7 @@ #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/reset.h> +#include <linux/soc/sunxi/sunxi_sram.h>
#include "ccu_common.h" #include "ccu_div.h" @@ -196,6 +197,11 @@ static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = { .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets), };
+static bool sunxi_de2_clk_has_sram(const struct device_node *node) +{
return of_device_is_compatible(node, "allwinner,sun50i-a64-de2-clk");
Having to maintain a separate list is not a great idea. Please consider adding a de2 ccu specific structure that embeds a struct sunxi_ccu_desc, and also includes whatever special quirks flags this needs.
ChenYu
+}
static int sunxi_de2_clk_probe(struct platform_device *pdev) { struct resource *res; @@ -239,11 +245,20 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) return ret; }
if (sunxi_de2_clk_has_sram(pdev->dev.of_node)) {
ret = sunxi_sram_claim(&pdev->dev);
if (ret) {
dev_err(&pdev->dev,
"Error couldn't map SRAM to device\n");
return ret;
}
}
/* The clocks need to be enabled for us to access the registers */ ret = clk_prepare_enable(bus_clk); if (ret) { dev_err(&pdev->dev, "Couldn't enable bus clk: %d\n", ret);
return ret;
goto err_release_sram; } ret = clk_prepare_enable(mod_clk);
@@ -272,6 +287,10 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) clk_disable_unprepare(mod_clk); err_disable_bus_clk: clk_disable_unprepare(bus_clk); +err_release_sram:
if (sunxi_de2_clk_has_sram(pdev->dev.of_node))
sunxi_sram_release(&pdev->dev);
return ret;
}
@@ -288,17 +307,14 @@ static const struct of_device_id sunxi_de2_clk_ids[] = { .compatible = "allwinner,sun8i-v3s-de2-clk", .data = &sun8i_v3s_de2_clk_desc, },
{
.compatible = "allwinner,sun50i-a64-de2-clk",
.data = &sun50i_a64_de2_clk_desc,
}, { .compatible = "allwinner,sun50i-h5-de2-clk", .data = &sun50i_a64_de2_clk_desc, },
/*
* The Allwinner A64 SoC needs some bit to be poke in syscon to make
* DE2 really working.
* So there's currently no A64 compatible here.
* H5 shares the same reset line with A64, so here H5 is using the
* clock description of A64.
*/ { }
};
-- 2.14.2
On Fri, Dec 22, 2017 at 08:22:41PM +0800, Icenowy Zheng wrote:
Allwinner A64's DE2 needs to claim a section of SRAM (SRAM C) to work.
Add support for it.
That's highly suspicious that the clocks need an SRAM to operate properly.
Can you elaborate?
Maxime
The A64 SoC features a DE2 CCU like the one in H5, but needs to claim a section of SRAM (SRAM C) to be accessed.
Adds the device tree nodes for the SRAM controller and the DE2 CCU.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- Changes in v3: - Fixed the alliwnner,sram property (the 1 after SRAM phadle is missing in v2).
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index d783d164b9c3..fb8ea7c414e1 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -130,6 +130,40 @@ #size-cells = <1>; ranges;
+ display_clocks: clock@1000000 { + compatible = "allwinner,sun50i-a64-de2-clk"; + reg = <0x01000000 0x100000>; + clocks = <&ccu CLK_DE>, + <&ccu CLK_BUS_DE>; + clock-names = "mod", + "bus"; + resets = <&ccu RST_BUS_DE>; + allwinner,sram = <&de2_sram 1>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + sram-controller@1c00000 { + compatible = "allwinner,sun50i-a64-sram-controller"; + reg = <0x01c00000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram_c: sram@18000 { + compatible = "mmio-sram"; + reg = <0x00018000 0x28000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x00018000 0x28000>; + + de2_sram: sram-section@0 { + compatible = "allwinner,sun50i-a64-sram-c"; + reg = <0x0000 0x28000>; + }; + }; + }; + syscon: syscon@1c00000 { compatible = "allwinner,sun50i-a64-system-controller", "syscon";
The A64 SoC features two display pipelines, one has a LCD output, the other has a HDMI output.
Add support for simplefb for these pipelines on A64 SoC.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index fb8ea7c414e1..993f5df73e8d 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -42,9 +42,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */
+#include <dt-bindings/clock/sun8i-de2.h> #include <dt-bindings/clock/sun50i-a64-ccu.h> #include <dt-bindings/clock/sun8i-r-ccu.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/reset/sun8i-de2.h> #include <dt-bindings/reset/sun50i-a64-ccu.h>
/ { @@ -52,6 +54,35 @@ #address-cells = <1>; #size-cells = <1>;
+ chosen { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + framebuffer-lcd { + compatible = "allwinner,simple-framebuffer", + "simple-framebuffer"; + allwinner,pipeline = "mixer0-lcd0"; + clocks = <&display_clocks CLK_BUS_MIXER0>, + <&ccu CLK_BUS_TCON0>, <&ccu CLK_BUS_TCON0>, + <&display_clocks CLK_MIXER0>, + <&ccu CLK_TCON0>; + status = "disabled"; + }; + + framebuffer-hdmi { + compatible = "allwinner,simple-framebuffer", + "simple-framebuffer"; + allwinner,pipeline = "mixer1-lcd1-hdmi"; + clocks = <&display_clocks CLK_BUS_MIXER1>, + <&ccu CLK_BUS_TCON1>, <&ccu CLK_BUS_HDMI>, + <&display_clocks CLK_MIXER1>, + <&ccu CLK_TCON1>, <&ccu CLK_HDMI>, + <&ccu CLK_HDMI_DDC>; + status = "disabled"; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>;
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
This patchset adds support for the SimpleFB on Allwinner SoCs with "Display Engine 2.0".
PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
PATCH 4 adds the pipeline strings for DE2 SimpleFB.
PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB) for H3/H5 SoCs.
PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
Changelog?
ChenYu
Icenowy Zheng (11): dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3 clk: sunxi-ng: add support for Allwinner H3 DE2 CCU clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU dt-bindings: simplefb-sunxi: add pipelines for DE2 ARM: sun8i: h3/h5: add DE2 CCU device node for H3 arm64: allwinner: h5: add compatible string for DE2 CCU ARM: sunxi: h3/h5: add simplefb nodes dt-bindings: add binding for A64 DE2 CCU SRAM clk: sunxi-ng: add support for Allwinner A64 DE2 CCU arm64: allwinner: a64: add DE2 CCU for A64 SoC arm64: allwinner: a64: add simplefb for A64 SoC
.../devicetree/bindings/clock/sun8i-de2.txt | 10 ++- .../bindings/display/simple-framebuffer-sunxi.txt | 4 + arch/arm/boot/dts/sun8i-h3.dtsi | 4 + arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 +++++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 65 +++++++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 + drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 85 +++++++++++++++++++--- 7 files changed, 202 insertions(+), 13 deletions(-)
-- 2.14.2
在 2017年12月27日星期三 CST 下午12:09:41,Chen-Yu Tsai 写道:
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
This patchset adds support for the SimpleFB on Allwinner SoCs with "Display Engine 2.0".
PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
PATCH 4 adds the pipeline strings for DE2 SimpleFB.
PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB) for H3/H5 SoCs.
PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
Changelog?
They're in seperate patches.
ChenYu
Icenowy Zheng (11): dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3 clk: sunxi-ng: add support for Allwinner H3 DE2 CCU clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU dt-bindings: simplefb-sunxi: add pipelines for DE2 ARM: sun8i: h3/h5: add DE2 CCU device node for H3 arm64: allwinner: h5: add compatible string for DE2 CCU ARM: sunxi: h3/h5: add simplefb nodes dt-bindings: add binding for A64 DE2 CCU SRAM clk: sunxi-ng: add support for Allwinner A64 DE2 CCU arm64: allwinner: a64: add DE2 CCU for A64 SoC arm64: allwinner: a64: add simplefb for A64 SoC
.../devicetree/bindings/clock/sun8i-de2.txt | 10 ++- .../bindings/display/simple-framebuffer-sunxi.txt | 4 + arch/arm/boot/dts/sun8i-h3.dtsi | 4 + arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 +++++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 65 +++++++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 + drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 85 +++++++++++++++++++--- 7 files changed, 202 insertions(+), 13 deletions(-)
-- 2.14.2
On Wed, Dec 27, 2017 at 12:10 PM, Icenowy Zheng icenowy@aosc.io wrote:
在 2017年12月27日星期三 CST 下午12:09:41,Chen-Yu Tsai 写道:
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
This patchset adds support for the SimpleFB on Allwinner SoCs with "Display Engine 2.0".
PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
PATCH 4 adds the pipeline strings for DE2 SimpleFB.
PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB) for H3/H5 SoCs.
PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
Changelog?
They're in seperate patches.
Please add them to all patches in such a case. List "none" if there were no changes.
ChenYu
On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng icenowy@aosc.io wrote:
This patchset adds support for the SimpleFB on Allwinner SoCs with "Display Engine 2.0".
PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
PATCH 4 adds the pipeline strings for DE2 SimpleFB.
PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB) for H3/H5 SoCs.
PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
Icenowy Zheng (11): dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3 clk: sunxi-ng: add support for Allwinner H3 DE2 CCU clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU dt-bindings: simplefb-sunxi: add pipelines for DE2 ARM: sun8i: h3/h5: add DE2 CCU device node for H3 arm64: allwinner: h5: add compatible string for DE2 CCU
Applied the first six patches. There is no guarantee they will make it into 4.16.
ChenYu
ARM: sunxi: h3/h5: add simplefb nodes dt-bindings: add binding for A64 DE2 CCU SRAM clk: sunxi-ng: add support for Allwinner A64 DE2 CCU arm64: allwinner: a64: add DE2 CCU for A64 SoC arm64: allwinner: a64: add simplefb for A64 SoC
.../devicetree/bindings/clock/sun8i-de2.txt | 10 ++- .../bindings/display/simple-framebuffer-sunxi.txt | 4 + arch/arm/boot/dts/sun8i-h3.dtsi | 4 + arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 +++++++++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 65 +++++++++++++++++ arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 + drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 85 +++++++++++++++++++--- 7 files changed, 202 insertions(+), 13 deletions(-)
-- 2.14.2
dri-devel@lists.freedesktop.org