Skip to contentSkip to conversation

clk: sunxi-ng: Add the A83T clocks

PATCH Superseded Jean-Francois Moine 1 participant 5 messages Jun 11, 2016 – Aug 22, 2016 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#1 lore raw

PATCH v2 1/3 clk: sunxi-ng: Add N-D-M-P-factor clock support

In reply to Jean-Francois Moine

Introduce support for the PLL clocks of the A83T and A80 SoCs which are set from N, D1, D2, M and P factors.

---
 drivers/clk/sunxi-ng/Makefile     |   1 +
 drivers/clk/sunxi-ng/ccu_common.h |   1 +
 drivers/clk/sunxi-ng/ccu_ndmp.c   | 239 ++++++++++++++++++++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu_ndmp.h   |  96 +++++++++++++++
 4 files changed, 337 insertions(+)
 create mode 100644 drivers/clk/sunxi-ng/ccu_ndmp.c
 create mode 100644 drivers/clk/sunxi-ng/ccu_ndmp.h
drivers/clk/sunxi-ng/Makefile +1 -0
index cafabf0..f0608cb 100644
@@ -8,6 +8,7 @@ obj-y += ccu_fixed_factor.o
 obj-y += ccu_gate.o
 obj-y += ccu_mp.o
 obj-y += ccu_mux.o
+obj-y += ccu_ndmp.o
 obj-y += ccu_nk.o
 obj-y += ccu_nkm.o
 obj-y += ccu_nkmp.o
drivers/clk/sunxi-ng/ccu_common.h +1 -0
index fda2450..df3ae5e 100644
@@ -23,6 +23,7 @@
 #define CCU_FEATURE_VARIABLE_PREDIV	BIT(3)
 #define CCU_FEATURE_FIXED_PREDIV	BIT(4)
 #define CCU_FEATURE_FIXED_POSTDIV	BIT(5)
+#define CCU_FEATURE_N1			BIT(6)
 
 struct device_node;
 
drivers/clk/sunxi-ng/ccu_ndmp.c new file +239 -0

239 lines not on this page · raw message

drivers/clk/sunxi-ng/ccu_ndmp.h new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.8.4
#2 lore raw

PATCH v2 2/3 clk: sunxi-ng: Add the A83T clocks and resets

In reply to Jean-Francois Moine

Add the clocks and resets found in the A83T CCU.

---
 drivers/clk/sunxi-ng/Makefile          |   2 +-
 drivers/clk/sunxi-ng/ccu-sun8i-a83t.c  | 675 +++++++++++++++++++++++++++++++++
 include/dt-bindings/clock/sun8i-a83t.h | 150 ++++++++
 include/dt-bindings/reset/sun8i-a83t.h |  94 +++++
 4 files changed, 920 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
 create mode 100644 include/dt-bindings/clock/sun8i-a83t.h
 create mode 100644 include/dt-bindings/reset/sun8i-a83t.h
drivers/clk/sunxi-ng/Makefile +1 -1
index f0608cb..6511c4c 100644
@@ -15,4 +15,4 @@ obj-y += ccu_nkmp.o
 obj-y += ccu_nm.o
 obj-y += ccu_phase.o
 
-obj-$(CONFIG_MACH_SUN8I) += ccu-sun8i-h3.o
+obj-$(CONFIG_MACH_SUN8I) += ccu-sun8i-h3.o ccu-sun8i-a83t.o
drivers/clk/sunxi-ng/ccu-sun8i-a83t.c new file +675 -0

675 lines not on this page · raw message

include/dt-bindings/clock/sun8i-a83t.h new file +150 -0

150 lines not on this page · raw message

include/dt-bindings/reset/sun8i-a83t.h new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.8.4
#3 lore raw

PATCH v2 3/3 dt: sun8i: Define the clocks of the A83T

In reply to Jean-Francois Moine

The clocks are defined by the CCU binding.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
arch/arm/boot/dts/sun8i-a83t.dtsi +13 -5
index d3473f8..4fec56a 100644
@@ -45,9 +45,10 @@
 
 #include "skeleton.dtsi"
 
+#include <dt-bindings/clock/sun8i-a83t.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
-
 #include <dt-bindings/pinctrl/sun4i-a10.h>
+#include <dt-bindings/reset/sun8i-a83t.h>
 
 / {
 	interrupt-parent = <&gic>;
@@ -138,13 +139,13 @@
 			clock-output-names = "osc16M";
 		};
 
-		osc16Md512: osc16Md512_clk {
+		osc32k: osc32k_clk {
 			#clock-cells = <0>;
 			compatible = "fixed-factor-clock";
 			clock-div = <512>;
 			clock-mult = <1>;
 			clocks = <&osc16M>;
-			clock-output-names = "osc16M-d512";
+			clock-output-names = "osc32k";
 		};
 	};
 
@@ -154,13 +155,20 @@
 		#size-cells = <1>;
 		ranges;
 
+		ccu: clock at 01c20000 {
+			compatible = "allwinner,sun8i-a83t-ccu";
+			reg = <0x01c20000 0x400>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+		};
+
 		pio: pinctrl at 01c20800 {
 			compatible = "allwinner,sun8i-a83t-pinctrl";
 			interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
 			reg = <0x01c20800 0x400>;
-			clocks = <&osc24M>;
+			clocks = <&ccu CLK_BUS_PIO>;
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
@@ -210,7 +218,7 @@
 			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&osc24M>;
+			clocks = <&ccu CLK_BUS_UART0>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.8.4
#0 lore raw

v2 cover clk: sunxi-ng: Add the A83T clocks

This patch series adds the clocks of the sunxi A83T in the "modern" clock framework proposed by Maxime Ripard.
It applies on the V2 of his patch series.

It is currently being tested on a Banana Pi M3 with the legacy u-boot.
- working:
mmc0
mmc2 (eMMC) but slow clock
ths
uart0
usb0
- not working:

	mmc1 (wifi/bt)
	video (machine freeze on reading/writing the DE I/O memory)

- not yet tested
audio
prcm

Jean-Francois Moine (3):
clk: sunxi-ng: Add N-D-M-P-factor clock support
clk: sunxi-ng: Add the A83T clocks and resets
dt: sun8i: Define the clocks of the A83T

 arch/arm/boot/dts/sun8i-a83t.dtsi      |  18 +-
 drivers/clk/sunxi-ng/Makefile          |   3 +-
 drivers/clk/sunxi-ng/ccu-sun8i-a83t.c  | 675 +++++++++++++++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu_common.h      |   1 +
 drivers/clk/sunxi-ng/ccu_ndmp.c        | 239 ++++++++++++
 drivers/clk/sunxi-ng/ccu_ndmp.h        |  96 +++++
 include/dt-bindings/clock/sun8i-a83t.h | 150 ++++++++
 include/dt-bindings/reset/sun8i-a83t.h |  94 +++++
 8 files changed, 1270 insertions(+), 6 deletions(-)
 create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
 create mode 100644 drivers/clk/sunxi-ng/ccu_ndmp.c
 create mode 100644 drivers/clk/sunxi-ng/ccu_ndmp.h
 create mode 100644 include/dt-bindings/clock/sun8i-a83t.h
 create mode 100644 include/dt-bindings/reset/sun8i-a83t.h
Signature · 1 line
2.8.4
#5 lore raw

v2 cover clk: sunxi-ng: Add the A83T clocks

In reply to a message not in the archive
Quoted 3 lines · On Mon, 22 Aug 2016 02:23:51 +0800 Vishnu Patekar…

Thanks for followup patches for a83t modern clock.

well, this patch series does not apply on sunxi/for-next.

Hi Vishnu,

This series is rather old!
Well, at this time, I was thinking that the 'modern' clock (aka sunxi-ng) was a good thing, but, just after sending this series, I was blocked, mainly because of the 'new timing' of the MMC clocks. So, I rewrote and simplified the sunxi clock driver, and I submitted a 'ccu' patch which was refused by Maxime and Mike.

Actually, my 'ccu' driver is almost finished. The code is only 1200 lines in one file. It contains optimized computation of the clock parameters, handles the H3 CPU frequency, the MMC 'new timing', sigma-delta modulation for the audio PLL, the PRCM clocks and more. The SoC specific tables (actually H3 and A83T) are about 10kB, but they are defined as templates in .init.rodata, so that only the tables of the current SoC remain in memory after system init.

This driver works fine for my Allwinner's boards and I will never go back to the 'sunxi-ng' which is rather complex and lacks of flexibility. If you are interested, the source is available in my site (see below).

Signature · 2 lines
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/