Skip to contentSkip to conversation

Migrate Tegra to common clock framework

PATCH Superseded Prashant Gaikwad 4 participants 29 messages Dec 27, 2012 – Jan 9, 2013

Subsystems (20)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Prashant Gaikwad

author maintainer
#0 lore raw

v2 cover Migrate Tegra to common clock framework

This patchset does following:
1. Decompose single tegra clock structure into multiple clocks.
2. Try to use standard clock types supported by common clock framework.
3. Use dynamic initialization.
4. Move all clock code to drivers/clk/tegra from mach-tegra.
5. Add device tree support for Tegra20 and Tegra30 clocks.
6. Remove all legacy clock code from mach-tegra.

Tested on Tegra30 (Cardhu) and Tegra20 (Ventana).

Changes from v1:
Rebased on linux-next for 20121224.

Prashant Gaikwad (10):
clk: tegra: Add tegra specific clocks
arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h
ARM: Tegra: Define Tegra30 CAR binding
ARM: dt: tegra30: Add device node for APB MISC
ARM: dt: tegra20: Add device node for APB MISC
clk: tegra: add clock support for tegra20
clk: tegra: add clock support for tegra30
clk: tegra: add dt support
arm: tegra: Migrate to new clock code
arm: tegra: Remove legacy clock code

Stephen Warren (1):
ARM: tegra: Define Tegra20 CAR binding

 .../bindings/clock/nvidia,tegra20-car.txt          |  209 ++
 .../bindings/clock/nvidia,tegra30-car.txt          |  282 +++
 arch/arm/boot/dts/tegra20.dtsi                     |   11 +
 arch/arm/boot/dts/tegra30.dtsi                     |   11 +
 arch/arm/mach-tegra/Makefile                       |    5 -
 arch/arm/mach-tegra/board-dt-tegra20.c             |   30 -
 arch/arm/mach-tegra/board-dt-tegra30.c             |   31 -
 arch/arm/mach-tegra/clock.c                        |  166 --
 arch/arm/mach-tegra/clock.h                        |  153 --
 arch/arm/mach-tegra/common.c                       |   44 +-
 arch/arm/mach-tegra/cpu-tegra.c                    |    2 +-
 arch/arm/mach-tegra/cpuidle-tegra30.c              |    2 +-
 arch/arm/mach-tegra/hotplug.c                      |    2 +-
 arch/arm/mach-tegra/include/mach/clk.h             |   44 -
 arch/arm/mach-tegra/pcie.c                         |    2 +-
 arch/arm/mach-tegra/platsmp.c                      |    2 +-
 arch/arm/mach-tegra/pm.c                           |    2 +-
 arch/arm/mach-tegra/powergate.c                    |    2 +-
 arch/arm/mach-tegra/tegra20_clocks.c               | 1623 -------------
 arch/arm/mach-tegra/tegra20_clocks.h               |   42 -
 arch/arm/mach-tegra/tegra20_clocks_data.c          | 1143 ---------
 arch/arm/mach-tegra/tegra30_clocks.c               | 2506 --------------------
 arch/arm/mach-tegra/tegra30_clocks.h               |   54 -
 arch/arm/mach-tegra/tegra30_clocks_data.c          | 1425 -----------
 drivers/clk/Makefile                               |    1 +
 drivers/clk/tegra/Makefile                         |   11 +
 drivers/clk/tegra/clk-audio-sync.c                 |   89 +
 drivers/clk/tegra/clk-divider.c                    |  188 ++
 drivers/clk/tegra/clk-periph-gate.c                |  183 ++
 drivers/clk/tegra/clk-periph.c                     |  232 ++
 drivers/clk/tegra/clk-pll-out.c                    |  124 +
 drivers/clk/tegra/clk-pll.c                        |  674 ++++++
 drivers/clk/tegra/clk-super.c                      |  154 ++
 drivers/clk/tegra/clk-tegra20.c                    | 1275 ++++++++++
 drivers/clk/tegra/clk-tegra30.c                    | 1968 +++++++++++++++
 drivers/clk/tegra/clk.c                            |   97 +
 drivers/clk/tegra/clk.h                            |  493 ++++
 drivers/dma/tegra20-apb-dma.c                      |    2 +-
 drivers/gpu/drm/tegra/dc.c                         |    3 +-
 drivers/gpu/drm/tegra/drm.c                        |    1 -
 drivers/gpu/drm/tegra/hdmi.c                       |    3 +-
 drivers/i2c/busses/i2c-tegra.c                     |    3 +-
 drivers/input/keyboard/tegra-kbc.c                 |    2 +-
 drivers/spi/spi-tegra20-sflash.c                   |    2 +-
 drivers/spi/spi-tegra20-slink.c                    |    2 +-
 drivers/staging/nvec/nvec.c                        |    3 +-
 .../tegra_cpu_car.h => include/linux/clk/tegra.h   |   11 +-
 sound/soc/tegra/tegra30_ahub.c                     |    2 +-
 48 files changed, 6028 insertions(+), 7288 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
 delete mode 100644 arch/arm/mach-tegra/clock.c
 delete mode 100644 arch/arm/mach-tegra/clock.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/clk.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks_data.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks_data.c
 create mode 100644 drivers/clk/tegra/Makefile
 create mode 100644 drivers/clk/tegra/clk-audio-sync.c
 create mode 100644 drivers/clk/tegra/clk-divider.c
 create mode 100644 drivers/clk/tegra/clk-periph-gate.c
 create mode 100644 drivers/clk/tegra/clk-periph.c
 create mode 100644 drivers/clk/tegra/clk-pll-out.c
 create mode 100644 drivers/clk/tegra/clk-pll.c
 create mode 100644 drivers/clk/tegra/clk-super.c
 create mode 100644 drivers/clk/tegra/clk-tegra20.c
 create mode 100644 drivers/clk/tegra/clk-tegra30.c
 create mode 100644 drivers/clk/tegra/clk.c
 create mode 100644 drivers/clk/tegra/clk.h
 rename arch/arm/mach-tegra/tegra_cpu_car.h => include/linux/clk/tegra.h (92%)
Signature · 1 line
1.7.4.1
author maintainer
#1 lore raw

PATCH v2 1/11 clk: tegra: Add tegra specific clocks

Add tegra specific clocks, pll, pll_out, peripheral, frac_divider, super.

---
 drivers/clk/Makefile                |    1 +
 drivers/clk/tegra/Makefile          |    8 +
 drivers/clk/tegra/clk-audio-sync.c  |   89 +++++
 drivers/clk/tegra/clk-divider.c     |  188 ++++++++++
 drivers/clk/tegra/clk-periph-gate.c |  183 ++++++++++
 drivers/clk/tegra/clk-periph.c      |  194 ++++++++++
 drivers/clk/tegra/clk-pll-out.c     |  124 +++++++
 drivers/clk/tegra/clk-pll.c         |  674 +++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk-super.c       |  154 ++++++++
 drivers/clk/tegra/clk.c             |   69 ++++
 drivers/clk/tegra/clk.h             |  479 +++++++++++++++++++++++++
 11 files changed, 2163 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/tegra/Makefile
 create mode 100644 drivers/clk/tegra/clk-audio-sync.c
 create mode 100644 drivers/clk/tegra/clk-divider.c
 create mode 100644 drivers/clk/tegra/clk-periph-gate.c
 create mode 100644 drivers/clk/tegra/clk-periph.c
 create mode 100644 drivers/clk/tegra/clk-pll-out.c
 create mode 100644 drivers/clk/tegra/clk-pll.c
 create mode 100644 drivers/clk/tegra/clk-super.c
 create mode 100644 drivers/clk/tegra/clk.c
 create mode 100644 drivers/clk/tegra/clk.h
drivers/clk/Makefile +1 -0
index ee90e87..f0b269a 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_ARCH_U8500)	+= ux500/
 obj-$(CONFIG_ARCH_VT8500)	+= clk-vt8500.o
 obj-$(CONFIG_ARCH_SUNXI)	+= clk-sunxi.o
 obj-$(CONFIG_ARCH_ZYNQ)		+= clk-zynq.o
+obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
 
 # Chip specific
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
drivers/clk/tegra/Makefile new file +8 -0
new file mode 100644
index 0000000..68bd353
@@ -0,0 +1,8 @@
+obj-y					+= clk.o
+obj-y					+= clk-audio-sync.o
+obj-y					+= clk-divider.o
+obj-y					+= clk-periph.o
+obj-y					+= clk-periph-gate.o
+obj-y					+= clk-pll.o
+obj-y					+= clk-pll-out.o
+obj-y					+= clk-super.o
drivers/clk/tegra/clk-audio-sync.c new file +89 -0

89 lines not on this page · raw message

drivers/clk/tegra/clk-divider.c new file +188 -0

188 lines not on this page · raw message

drivers/clk/tegra/clk-periph-gate.c new file +183 -0

183 lines not on this page · raw message

drivers/clk/tegra/clk-periph.c new file +194 -0

194 lines not on this page · raw message

drivers/clk/tegra/clk-pll-out.c new file +124 -0

124 lines not on this page · raw message

drivers/clk/tegra/clk-pll.c new file +674 -0

674 lines not on this page · raw message

drivers/clk/tegra/clk-super.c new file +154 -0

154 lines not on this page · raw message

drivers/clk/tegra/clk.c new file +69 -0

69 lines not on this page · raw message

drivers/clk/tegra/clk.h new file +479 -0

479 lines not on this page · raw message

Signature · 1 line
1.7.4.1
author maintainer
#3 lore raw

PATCH v2 2/11 arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h

In reply to Prashant Gaikwad

tegra_cpu_car_ops struct is going to be accessed from drivers/clk/tegra. Move the tegra_cpu_car_ops to include/linux/clk/tegra.h.

---
 arch/arm/mach-tegra/clock.c                        |    2 +-
 arch/arm/mach-tegra/cpuidle-tegra30.c              |    2 +-
 arch/arm/mach-tegra/hotplug.c                      |    2 +-
 arch/arm/mach-tegra/platsmp.c                      |    2 +-
 arch/arm/mach-tegra/pm.c                           |    2 +-
 arch/arm/mach-tegra/tegra20_clocks.c               |    2 +-
 arch/arm/mach-tegra/tegra20_clocks_data.c          |    2 +-
 arch/arm/mach-tegra/tegra30_clocks.c               |    2 +-
 arch/arm/mach-tegra/tegra30_clocks_data.c          |    2 +-
 .../tegra_cpu_car.h => include/linux/clk/tegra.h   |    6 +++---
 10 files changed, 12 insertions(+), 12 deletions(-)
 rename arch/arm/mach-tegra/tegra_cpu_car.h => include/linux/clk/tegra.h (96%)
arch/arm/mach-tegra/clock.c +1 -1
index 867bf8b..8c0ff06 100644
@@ -26,10 +26,10 @@
 #include <linux/sched.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
+#include <linux/clk/tegra.h>
 
 #include "board.h"
 #include "clock.h"
-#include "tegra_cpu_car.h"
 
 /* Global data of Tegra CPU CAR ops */
 struct tegra_cpu_car_ops *tegra_cpu_car_ops;
arch/arm/mach-tegra/cpuidle-tegra30.c +1 -1
index 5e8cbf5..0b8c667 100644
@@ -24,6 +24,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpu_pm.h>
 #include <linux/clockchips.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/cpuidle.h>
 #include <asm/proc-fns.h>
@@ -32,7 +33,6 @@
 
 #include "pm.h"
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 #ifdef CONFIG_PM_SLEEP
 static int tegra30_idle_lp2(struct cpuidle_device *dev,
arch/arm/mach-tegra/hotplug.c +1 -1
index dca5141..2faea56 100644
@@ -10,12 +10,12 @@
  */
 #include <linux/kernel.h>
 #include <linux/smp.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/cacheflush.h>
 #include <asm/smp_plat.h>
 
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 static void (*tegra_hotplug_shutdown)(void);
 
arch/arm/mach-tegra/platsmp.c +1 -1
index 1b926df..dec6704 100644
@@ -18,6 +18,7 @@
 #include <linux/jiffies.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/gic.h>
@@ -29,7 +30,6 @@
 #include "fuse.h"
 #include "flowctrl.h"
 #include "reset.h"
-#include "tegra_cpu_car.h"
 
 #include "common.h"
 #include "iomap.h"
arch/arm/mach-tegra/pm.c +1 -1
index 1b11707..db44cd5 100644
@@ -24,6 +24,7 @@
 #include <linux/cpu_pm.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/smp_plat.h>
 #include <asm/cacheflush.h>
@@ -36,7 +37,6 @@
 #include "reset.h"
 #include "flowctrl.h"
 #include "sleep.h"
-#include "tegra_cpu_car.h"
 
 #define TEGRA_POWER_CPU_PWRREQ_OE	(1 << 16)  /* CPU pwr req enable */
 
arch/arm/mach-tegra/tegra20_clocks.c +1 -1
index 4eb6bc8..1a80ff6 100644
@@ -26,12 +26,12 @@
 #include <linux/io.h>
 #include <linux/clkdev.h>
 #include <linux/clk.h>
+#include <linux/clk/tegra.h>
 
 #include "clock.h"
 #include "fuse.h"
 #include "iomap.h"
 #include "tegra2_emc.h"
-#include "tegra_cpu_car.h"
 
 #define RST_DEVICES			0x004
 #define RST_DEVICES_SET			0x300
arch/arm/mach-tegra/tegra20_clocks_data.c +1 -1
index a23a073..022cdae 100644
@@ -26,12 +26,12 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/clk/tegra.h>
 
 #include "clock.h"
 #include "fuse.h"
 #include "tegra2_emc.h"
 #include "tegra20_clocks.h"
-#include "tegra_cpu_car.h"
 
 /* Clock definitions */
 
arch/arm/mach-tegra/tegra30_clocks.c +1 -1
index d714777..4330787 100644
@@ -28,6 +28,7 @@
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/syscore_ops.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/clkdev.h>
 
@@ -36,7 +37,6 @@
 #include "clock.h"
 #include "fuse.h"
 #include "iomap.h"
-#include "tegra_cpu_car.h"
 
 #define USE_PLL_LOCK_BITS 0
 
arch/arm/mach-tegra/tegra30_clocks_data.c +1 -1
index 6942c7a..ee01711 100644
@@ -28,11 +28,11 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
+#include <linux/clk/tegra.h>
 
 #include "clock.h"
 #include "fuse.h"
 #include "tegra30_clocks.h"
-#include "tegra_cpu_car.h"
 
 #define DEFINE_CLK_TEGRA(_name, _rate, _ops, _flags,		\
 		   _parent_names, _parents, _parent)		\
include/linux/clk/tegra.h renamed from arch/arm/mach-tegra/tegra_cpu_car.h +3 -3
similarity index 96%
rename from arch/arm/mach-tegra/tegra_cpu_car.h
rename to include/linux/clk/tegra.h
index 9764d31..0977f2a 100644
@@ -14,8 +14,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __MACH_TEGRA_CPU_CAR_H
-#define __MACH_TEGRA_CPU_CAR_H
+#ifndef __LINUX_CLK_TEGRA_H_
+#define __LINUX_CLK_TEGRA_H_
 
 /*
  * Tegra CPU clock and reset control ops
@@ -121,4 +121,4 @@ static inline void tegra_cpu_clock_resume(void)
 void tegra20_cpu_car_ops_init(void);
 void tegra30_cpu_car_ops_init(void);
 
-#endif /* __MACH_TEGRA_CPU_CAR_H */
+#endif /* __LINUX_CLK_TEGRA_H_ */
Signature · 1 line
1.7.4.1
author maintainer
#4 lore raw

PATCH v2 3/11 ARM: tegra: Define Tegra20 CAR binding

In reply to Prashant Gaikwad

From: Stephen Warren <[email protected]>

The Tegra20 CAR (Clock And Reset) Controller controls most aspects of most clocks within Tegra20. The device tree binding models this as a single monolithic clock provider, which exports many clocks. This reduces the number of nodes needed in device tree to represent these clocks.

This binding is only useful for Tegra20; the set of clocks that exists on Tegra30 is sufficiently different to merit its own binding.

[pgaikwad: Added mux clk ids and sorted CAR node]
---
 .../bindings/clock/nvidia,tegra20-car.txt          |  209 ++++++++++++++++++++
 arch/arm/boot/dts/tegra20.dtsi                     |    6 +
 2 files changed, 215 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt new file +209 -0
new file mode 100644
index 0000000..dc9f2bf
@@ -0,0 +1,209 @@
+NVIDIA Tegra20 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra20-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in", and the board-specific oscillator "osc".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the CAR.
+
+  The first 96 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
+  registers. These IDs often match those in the CAR's RST_DEVICES registers,
+  but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
+  this case, those clocks are assigned IDs above 95 in order to highlight
+  this issue. Implementations that interpret these clock IDs as bit values
+  within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
+  explicitly handle these special cases.
+
+  The balance of the clocks controlled by the CAR are assigned IDs of 96 and
+  above.
+
+  0	cpu
+  1	unassigned
+  2	unassigned
+  3	ac97
+  4	rtc
+  5	tmr
+  6	uart1
+  7	unassigned	(register bit affects uart2 and vfir)
+  8	gpio
+  9	sdmmc2
+  10	unassigned	(register bit affects spdif_in and spdif_out)
+  11	i2s1
+  12	i2c1
+  13	ndflash
+  14	sdmmc1
+  15	sdmmc4
+  16	twc
+  17	pwm
+  18	i2s2
+  19	epp
+  20	unassigned	(register bit affects vi and vi_sensor)
+  21	2d
+  22	usbd
+  23	isp
+  24	3d
+  25	ide
+  26	disp2
+  27	disp1
+  28	host1x
+  29	vcp
+  30	unassigned
+  31	cache2
+
+  32	mem
+  33	ahbdma
+  34	apbdma
+  35	unassigned
+  36	kbc
+  37	stat_mon
+  38	pmc
+  39	fuse
+  40	kfuse
+  41	sbc1
+  42	snor
+  43	spi1
+  44	sbc2
+  45	xio
+  46	sbc3
+  47	dvc
+  48	dsi
+  49	unassigned	(register bit affects tvo and cve)
+  50	mipi
+  51	hdmi
+  52	csi
+  53	tvdac
+  54	i2c2
+  55	uart3
+  56	unassigned
+  57	emc
+  58	usb2
+  59	usb3
+  60	mpe
+  61	vde
+  62	bsea
+  63	bsev
+
+  64	speedo
+  65	uart4
+  66	uart5
+  67	i2c3
+  68	sbc4
+  69	sdmmc3
+  70	pcie
+  71	owr
+  72	afi
+  73	csite
+  74	unassigned
+  75	avpucq
+  76	la
+  77	unassigned
+  78	unassigned
+  79	unassigned
+  80	unassigned
+  81	unassigned
+  82	unassigned
+  83	unassigned
+  84	irama
+  85	iramb
+  86	iramc
+  87	iramd
+  88	cram2
+  89	audio_2x	a/k/a audio_2x_sync_clk
+  90	clk_d
+  91	unassigned
+  92	sus
+  93	cdev1
+  94	cdev2
+  95	unassigned
+
+  96	uart2
+  97	vfir
+  98	spdif_in
+  99	spdif_out
+  100	vi
+  101	vi_sensor
+  102	tvo
+  103	cve
+  104	osc
+  105	clk_32k		a/k/a clk_s
+  106	clk_m
+  107	sclk
+  108	cclk
+  109	hclk
+  110	pclk
+  111	blink
+  112	pll_a
+  113	pll_a_out0
+  114	pll_c
+  115	pll_c_out1
+  116	pll_d
+  117	pll_d_out0
+  118	pll_e
+  119	pll_m
+  120	pll_m_out1
+  121	pll_p
+  122	pll_p_out1
+  123	pll_p_out2
+  124	pll_p_out3
+  125	pll_p_out4
+  126	pll_s
+  127	pll_u
+  128	pll_x
+  129	cop		a/k/a avp
+  130	audio		a/k/a audio_sync_clk
+  131	pll_ref
+  132	twd
+
+Mux clocks
+
+  200	audio_mux
+
+Example SoC include file:
+
+/ {
+	tegra_car: clock {
+		compatible = "nvidia,tegra20-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	usb at c5004000 {
+		clocks = <&tegra_car 58>; /* usb2 */
+	};
+};
+
+Example board file:
+
+/ {
+	clocks {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock at 0 {
+			compatible = "fixed-clock";
+			reg = <0>;
+			#clock-cells = <0>;
+			clock-frequency = <12000000>;
+		};
+
+		clk_32k: clock at 1 {
+			compatible = "fixed-clock";
+			reg = <1>;
+			#clock-cells = <0>;
+			clock-frequency = <32768>;
+		};
+	};
+
+	&tegra_car {
+		clocks = <&clk_32k> <&osc>;
+	};
+};
arch/arm/boot/dts/tegra20.dtsi +6 -0
index b8effa1..5b104f1 100644
@@ -123,6 +123,12 @@
 			      0 42 0x04>;
 	};
 
+	tegra_car: clock {
+		compatible = "nvidia,tegra20-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
 	apbdma: dma {
 		compatible = "nvidia,tegra20-apbdma";
 		reg = <0x6000a000 0x1200>;
Signature · 1 line
1.7.4.1
author maintainer
#5 lore raw

PATCH v2 4/11 ARM: Tegra: Define Tegra30 CAR binding

In reply to Prashant Gaikwad

The device tree binding models Tegra30 CAR (Clock And Reset) as a single monolithic clock provider.

---
 .../bindings/clock/nvidia,tegra30-car.txt          |  282 ++++++++++++++++++++
 arch/arm/boot/dts/tegra30.dtsi                     |    6 +
 2 files changed, 288 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt new file +282 -0
new file mode 100644
index 0000000..6740760
@@ -0,0 +1,282 @@
+NVIDIA Tegra30 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra30-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in", and the board-specific oscillator "osc".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the CAR.
+
+  The first 130 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
+  registers. These IDs often match those in the CAR's RST_DEVICES registers,
+  but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
+  this case, those clocks are assigned IDs above 160 in order to highlight
+  this issue. Implementations that interpret these clock IDs as bit values
+  within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
+  explicitly handle these special cases.
+
+  The balance of the clocks controlled by the CAR are assigned IDs of 160 and
+  above.
+
+  0	cpu
+  1	unassigned
+  2	unassigned
+  3	unassigned
+  4	rtc
+  5	timer
+  6	uarta
+  7	unassigned	(register bit affects uartb and vfir)
+  8	gpio
+  9	sdmmc2
+  10	unassigned	(register bit affects spdif_in and spdif_out)
+  11	i2s1
+  12	i2c1
+  13	ndflash
+  14	sdmmc1
+  15	sdmmc4
+  16	unassigned
+  17	pwm
+  18	i2s2
+  19	epp
+  20	unassigned	(register bit affects vi and vi_sensor)
+  21	2d
+  22	usbd
+  23	isp
+  24	3d
+  25	unassigned
+  26	disp2
+  27	disp1
+  28	host1x
+  29	vcp
+  30	i2s0
+  31	cop_cache
+
+  32	mc
+  33	ahbdma
+  34	apbdma
+  35	unassigned
+  36	kbc
+  37	statmon
+  38	pmc
+  39	unassigned	(register bit affects fuse and fuse_burn)
+  40	kfuse
+  41	sbc1
+  42	nor
+  43	unassigned
+  44	sbc2
+  45	unassigned
+  46	sbc3
+  47	i2c5
+  48	dsia
+  49	unassigned	(register bit affects cve and tvo)
+  50	mipi
+  51	hdmi
+  52	csi
+  53	tvdac
+  54	i2c2
+  55	uartc
+  56	unassigned
+  57	emc
+  58	usb2
+  59	usb3
+  60	mpe
+  61	vde
+  62	bsea
+  63	bsev
+
+  64	speedo
+  65	uartd
+  66	uarte
+  67	i2c3
+  68	sbc4
+  69	sdmmc3
+  70	pcie
+  71	owr
+  72	afi
+  73	csite
+  74	pciex
+  75	avpucq
+  76	la
+  77	unassigned
+  78	unassigned
+  79	dtv
+  80	ndspeed
+  81	i2cslow
+  82	dsib
+  83	unassigned
+  84	irama
+  85	iramb
+  86	iramc
+  87	iramd
+  88	cram2
+  89	unassigned
+  90	audio_2x	a/k/a audio_2x_sync_clk
+  91	unassigned
+  92	csus
+  93	cdev2
+  94	cdev1
+  95	unassigned
+
+  96	cpu_g
+  97	cpu_lp
+  98	3d2
+  99	mselect
+  100	tsensor
+  101	i2s3
+  102	i2s4
+  103	i2c4
+  104	sbc5
+  105	sbc6
+  106	d_audio
+  107	apbif
+  108	dam0
+  109	dam1
+  110	dam2
+  111	hda2codec_2x
+  112	atomics
+  113	audio0_2x
+  114	audio1_2x
+  115	audio2_2x
+  116	audio3_2x
+  117	audio4_2x
+  118	audio5_2x
+  119	actmon
+  120	extern1
+  121	extern2
+  122	extern3
+  123	sata_oob
+  124	sata
+  125	hda
+  127	se
+  128	hda2hdmi
+  129	sata_cold
+
+  160	uartb
+  161	vfir
+  162	spdif_in
+  163	spdif_out
+  164	vi
+  165	vi_sensor
+  166	fuse
+  167	fuse_burn
+  168	cve
+  169	tvo
+
+  170	clk_32k
+  171	clk_m
+  172	clk_m_div2
+  173	clk_m_div4
+  174	pll_ref
+  175	pll_c
+  176	pll_c_out1
+  177	pll_m
+  178	pll_m_out1
+  179	pll_p
+  180	pll_p_out1
+  181	pll_p_out2
+  182	pll_p_out3
+  183	pll_p_out4
+  184	pll_a
+  185	pll_a_out0
+  186	pll_d
+  187	pll_d_out0
+  188	pll_d2
+  189	pll_d2_out0
+  190	pll_u
+  191	pll_x
+  192	pll_x_out0
+  193	pll_e
+  194	spdif_in_sync
+  195	i2s0_sync
+  196	i2s1_sync
+  197	i2s2_sync
+  198	i2s3_sync
+  199	i2s4_sync
+  200	vimclk
+  201	audio0
+  202	audio1
+  203	audio2
+  204	audio3
+  205	audio4
+  206	audio5
+  207	clk_out_1 (extern1)
+  208	clk_out_2 (extern2)
+  209	clk_out_3 (extern3)
+  210	sclk
+  211	blink
+  212	cclk_g
+  213	cclk_lp
+  214	twd
+  215	cml0
+  216	cml1
+  217	i2cslow
+  218	i2c1_fast
+  219	i2c2_fast
+  220	i2c3_fast
+  221	i2c4_fast
+  222	i2c5_fast
+  223	dsi1_fast
+  224	dsi2_fast
+  225	hclk
+  226	pclk
+
+Mux clocks
+
+  300	audio0_mux
+  301	audio1_mux
+  302	audio2_mux
+  303	audio3_mux
+  304	audio4_mux
+  305	spdif_mux
+  306	clk_out_1_mux
+  307	clk_out_2_mux
+  308	clk_out_3_mux
+
+Example SoC include file:
+
+/ {
+	tegra_car: clock {
+		compatible = "nvidia,tegra30-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	usb at c5004000 {
+		clocks = <&tegra_car 58>; /* usb2 */
+	};
+};
+
+Example board file:
+
+/ {
+	clocks {
+		compatible = "simple-bug";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock at 0 {
+			compatible = "fixed-clock";
+			reg = <0>;
+			#clock-cells = <0>;
+			clock-frequency = <12000000>;
+		};
+
+		clk_32k: clock at 1 {
+			compatible = "fixed-clock";
+			reg = <1>;
+			#clock-cells = <0>;
+			clock-frequency = <32768>;
+		};
+	};
+
+	&tegra_car {
+		clocks = <&clk_32k> <&osc>;
+	};
+};
arch/arm/boot/dts/tegra30.dtsi +6 -0
index 529fdb8..6765646 100644
@@ -125,6 +125,12 @@
 			      0 122 0x04>;
 	};
 
+	tegra_car: clock {
+		compatible = "nvidia,tegra30-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
 	apbdma: dma {
 		compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
 		reg = <0x6000a000 0x1400>;
Signature · 1 line
1.7.4.1
author maintainer
#7 lore raw

PATCH v2 5/11 ARM: dt: tegra30: Add device node for APB MISC

In reply to Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

---
 arch/arm/boot/dts/tegra30.dtsi |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra30.dtsi +5 -0
index 6765646..00e2d44 100644
@@ -190,6 +190,11 @@
 		interrupt-controller;
 	};
 
+	apbmisc: apbmisc {
+		compatible = "nvidia,tegra30-apbmisc";
+		reg = <0x70000000 0x1000>;
+	};
+
 	pinmux: pinmux {
 		compatible = "nvidia,tegra30-pinmux";
 		reg = <0x70000868 0xd4    /* Pad control registers */
Signature · 1 line
1.7.4.1
author maintainer
#20 lore raw

PATCH v2 6/11 ARM: dt: tegra20: Add device node for APB MISC

In reply to Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

---
 arch/arm/boot/dts/tegra20.dtsi |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +5 -0
index 5b104f1..e919a2b 100644
@@ -171,6 +171,11 @@
 		interrupt-controller;
 	};
 
+	apbmisc: apbmisc {
+		compatible = "nvidia,tegra20-apbmisc";
+		reg = <0x70000000 0x1000>;
+	};
+
 	pinmux: pinmux {
 		compatible = "nvidia,tegra20-pinmux";
 		reg = <0x70000014 0x10   /* Tri-state registers */
Signature · 1 line
1.7.4.1
author maintainer
#21 lore raw

PATCH v2 7/11 clk: tegra: add clock support for tegra20

In reply to Prashant Gaikwad

Add tegra20 clock support based on common clock framework.

---
 drivers/clk/tegra/Makefile      |    2 +
 drivers/clk/tegra/clk-tegra20.c | 1275 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h         |    6 +
 3 files changed, 1283 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/tegra/clk-tegra20.c
drivers/clk/tegra/Makefile +2 -0
index 68bd353..00484fd 100644
@@ -6,3 +6,5 @@ obj-y					+= clk-periph-gate.o
 obj-y					+= clk-pll.o
 obj-y					+= clk-pll-out.o
 obj-y					+= clk-super.o
+
+obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
drivers/clk/tegra/clk-tegra20.c new file +1275 -0

1,275 lines not on this page · raw message

drivers/clk/tegra/clk.h +6 -0
index 7fdf8e6..7a2d7e7 100644
@@ -476,4 +476,10 @@ void tegra_init_from_table(struct tegra_clk_init_table *tbl,
 void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
 				struct clk *clks[], int clk_max);
 
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+void tegra20_clock_init(struct device_node *np);
+#else
+static inline void tegra20_clock_init(struct device_node *np) {}
+#endif /* CONFIG_ARCH_TEGRA_2x_SOC */
+
 #endif /* TEGRA_CLK_H */
Signature · 1 line
1.7.4.1
author maintainer
#22 lore raw

PATCH v2 8/11 clk: tegra: add clock support for tegra30

In reply to Prashant Gaikwad

Add tegra30 clock support based on common clock framework.

---
 drivers/clk/tegra/Makefile      |    1 +
 drivers/clk/tegra/clk-tegra30.c | 1968 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h         |    6 +
 3 files changed, 1975 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/tegra/clk-tegra30.c
drivers/clk/tegra/Makefile +1 -0
index 00484fd..2b41b0f 100644
@@ -8,3 +8,4 @@ obj-y					+= clk-pll-out.o
 obj-y					+= clk-super.o
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
+obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
drivers/clk/tegra/clk-tegra30.c new file +1968 -0

1,968 lines not on this page · raw message

drivers/clk/tegra/clk.h +6 -0
index 7a2d7e7..f1ed1d0 100644
@@ -482,4 +482,10 @@ void tegra20_clock_init(struct device_node *np);
 static inline void tegra20_clock_init(struct device_node *np) {}
 #endif /* CONFIG_ARCH_TEGRA_2x_SOC */
 
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+void tegra30_clock_init(struct device_node *np);
+#else
+static inline void tegra30_clock_init(struct device_node *np) {}
+#endif /* CONFIG_ARCH_TEGRA_3x_SOC */
+
 #endif /* TEGRA_CLK_H */
Signature · 1 line
1.7.4.1
author maintainer
#24 lore raw

PATCH v2 9/11 clk: tegra: add dt support

In reply to Prashant Gaikwad

Add support to initialize clock from DT.

---
 drivers/clk/tegra/clk.c   |   23 +++++++++++++++++++++++
 drivers/clk/tegra/clk.h   |    2 ++
 include/linux/clk/tegra.h |    1 +
 3 files changed, 26 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk.c +23 -0
index cf023a9..314d5bd 100644
@@ -67,3 +67,26 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl,
 			}
 	}
 }
+
+static const struct of_device_id tegra_dt_clk_match[] = {
+	{ .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init },
+	{ .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init },
+	{ }
+};
+
+void __init tegra_dt_init_clk(void)
+{
+	struct device_node *np;
+	const struct of_device_id *match;
+	of_tegra_clk_init_func_t clk_init_func;
+
+	np = of_find_matching_node(NULL, tegra_dt_clk_match);
+	if (!np)
+		return;
+
+	match = of_match_node(tegra_dt_clk_match, np);
+
+	clk_init_func = match->data;
+
+	clk_init_func(np);
+}
drivers/clk/tegra/clk.h +2 -0
index f1ed1d0..ca1f0e4 100644
@@ -20,6 +20,8 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 
+typedef void (*of_tegra_clk_init_func_t)(struct device_node *);
+
 /**
  * struct tegra_clk_sync_source - external clock source from codec
  *
include/linux/clk/tegra.h +1 -0
index 0977f2a..a97e241 100644
@@ -118,6 +118,7 @@ static inline void tegra_cpu_clock_resume(void)
 }
 #endif
 
+void tegra_dt_init_clk(void);
 void tegra20_cpu_car_ops_init(void);
 void tegra30_cpu_car_ops_init(void);
 
Signature · 1 line
1.7.4.1
author maintainer
#26 lore raw

PATCH v2 10/11 arm: tegra: Migrate to new clock code

In reply to Prashant Gaikwad

Migrate tegra clock support to drivers/clk/tegra, this involves moving
1. definition of tegra_cpu_car_ops to clk.c
2. definition of reset functions to clk-peripheral.c
3. change parent of cpu clock.

---
 arch/arm/mach-tegra/board-dt-tegra20.c |   30 ---------------------
 arch/arm/mach-tegra/board-dt-tegra30.c |   31 ----------------------
 arch/arm/mach-tegra/clock.c            |   19 -------------
 arch/arm/mach-tegra/common.c           |   44 +------------------------------
 arch/arm/mach-tegra/cpu-tegra.c        |    2 +-
 arch/arm/mach-tegra/include/mach/clk.h |    3 --
 arch/arm/mach-tegra/pcie.c             |    2 +-
 arch/arm/mach-tegra/powergate.c        |    2 +-
 drivers/clk/tegra/clk-periph.c         |   38 +++++++++++++++++++++++++++
 drivers/clk/tegra/clk.c                |    5 +++
 drivers/dma/tegra20-apb-dma.c          |    2 +-
 drivers/gpu/drm/tegra/dc.c             |    3 +-
 drivers/gpu/drm/tegra/drm.c            |    1 -
 drivers/gpu/drm/tegra/hdmi.c           |    3 +-
 drivers/i2c/busses/i2c-tegra.c         |    3 +-
 drivers/input/keyboard/tegra-kbc.c     |    2 +-
 drivers/spi/spi-tegra20-sflash.c       |    2 +-
 drivers/spi/spi-tegra20-slink.c        |    2 +-
 drivers/staging/nvec/nvec.c            |    3 +-
 include/linux/clk/tegra.h              |    4 +++
 sound/soc/tegra/tegra30_ahub.c         |    2 +-
 21 files changed, 61 insertions(+), 142 deletions(-)
arch/arm/mach-tegra/board-dt-tegra20.c +0 -30
index 734d9cc..1267ce0 100644
@@ -41,7 +41,6 @@
 #include <asm/setup.h>
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -103,37 +102,8 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
 	{}
 };
 
-static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
-	/* name		parent		rate		enabled */
-	{ "uarta",	"pll_p",	216000000,	true },
-	{ "uartd",	"pll_p",	216000000,	true },
-	{ "usbd",	"clk_m",	12000000,	false },
-	{ "usb2",	"clk_m",	12000000,	false },
-	{ "usb3",	"clk_m",	12000000,	false },
-	{ "pll_a",      "pll_p_out1",   56448000,       true },
-	{ "pll_a_out0", "pll_a",        11289600,       true },
-	{ "cdev1",      NULL,           0,              true },
-	{ "blink",      "clk_32k",      32768,          true },
-	{ "i2s1",       "pll_a_out0",   11289600,       false},
-	{ "i2s2",       "pll_a_out0",   11289600,       false},
-	{ "sdmmc1",	"pll_p",	48000000,	false},
-	{ "sdmmc3",	"pll_p",	48000000,	false},
-	{ "sdmmc4",	"pll_p",	48000000,	false},
-	{ "spi",	"pll_p",	20000000,	false },
-	{ "sbc1",	"pll_p",	100000000,	false },
-	{ "sbc2",	"pll_p",	100000000,	false },
-	{ "sbc3",	"pll_p",	100000000,	false },
-	{ "sbc4",	"pll_p",	100000000,	false },
-	{ "host1x",	"pll_c",	150000000,	false },
-	{ "disp1",	"pll_p",	600000000,	false },
-	{ "disp2",	"pll_p",	600000000,	false },
-	{ NULL,		NULL,		0,		0},
-};
-
 static void __init tegra_dt_init(void)
 {
-	tegra_clk_init_from_table(tegra_dt_clk_init_table);
-
 	/*
 	 * Finished with the static registrations now; fill in the missing
 	 * devices
arch/arm/mach-tegra/board-dt-tegra30.c +0 -31
index 6497d12..b65262c 100644
@@ -34,7 +34,6 @@
 #include <asm/hardware/gic.h>
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -66,38 +65,8 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
 	{}
 };
 
-static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
-	/* name		parent		rate		enabled */
-	{ "uarta",	"pll_p",	408000000,	true },
-	{ "pll_a",	"pll_p_out1",	564480000,	true },
-	{ "pll_a_out0",	"pll_a",	11289600,	true },
-	{ "extern1",	"pll_a_out0",	0,		true },
-	{ "clk_out_1",	"extern1",	0,		true },
-	{ "blink",	"clk_32k",	32768,		true },
-	{ "i2s0",	"pll_a_out0",	11289600,	false},
-	{ "i2s1",	"pll_a_out0",	11289600,	false},
-	{ "i2s2",	"pll_a_out0",	11289600,	false},
-	{ "i2s3",	"pll_a_out0",	11289600,	false},
-	{ "i2s4",	"pll_a_out0",	11289600,	false},
-	{ "sdmmc1",	"pll_p",	48000000,	false},
-	{ "sdmmc3",	"pll_p",	48000000,	false},
-	{ "sdmmc4",	"pll_p",	48000000,	false},
-	{ "sbc1",	"pll_p",	100000000,	false},
-	{ "sbc2",	"pll_p",	100000000,	false},
-	{ "sbc3",	"pll_p",	100000000,	false},
-	{ "sbc4",	"pll_p",	100000000,	false},
-	{ "sbc5",	"pll_p",	100000000,	false},
-	{ "sbc6",	"pll_p",	100000000,	false},
-	{ "host1x",	"pll_c",	150000000,	false},
-	{ "disp1",	"pll_p",	600000000,	false},
-	{ "disp2",	"pll_p",	600000000,	false},
-	{ NULL,		NULL,		0,		0},
-};
-
 static void __init tegra30_dt_init(void)
 {
-	tegra_clk_init_from_table(tegra_dt_clk_init_table);
-
 	of_platform_populate(NULL, of_default_bus_match_table,
 				tegra30_auxdata_lookup, NULL);
 }
arch/arm/mach-tegra/clock.c +0 -19
index 8c0ff06..baa0c5b 100644
@@ -31,9 +31,6 @@
 #include "board.h"
 #include "clock.h"
 
-/* Global data of Tegra CPU CAR ops */
-struct tegra_cpu_car_ops *tegra_cpu_car_ops;
-
 /*
  * Locking:
  *
@@ -131,22 +128,6 @@ void tegra_clk_init_from_table(struct tegra_clk_init_table *table)
 		tegra_clk_init_one_from_table(table);
 }
 
-void tegra_periph_reset_deassert(struct clk *c)
-{
-	struct clk_tegra *clk = to_clk_tegra(__clk_get_hw(c));
-	BUG_ON(!clk->reset);
-	clk->reset(__clk_get_hw(c), false);
-}
-EXPORT_SYMBOL(tegra_periph_reset_deassert);
-
-void tegra_periph_reset_assert(struct clk *c)
-{
-	struct clk_tegra *clk = to_clk_tegra(__clk_get_hw(c));
-	BUG_ON(!clk->reset);
-	clk->reset(__clk_get_hw(c), true);
-}
-EXPORT_SYMBOL(tegra_periph_reset_assert);
-
 /* Several extended clock configuration bits (e.g., clock routing, clock
  * phase control) are included in PLL and peripheral clock source
  * registers. */
arch/arm/mach-tegra/common.c +2 -42

80 lines not on this page · raw message

arch/arm/mach-tegra/cpu-tegra.c +1 -1
index a74d3c7..07555f6 100644
@@ -222,7 +222,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
 	if (IS_ERR(pll_x_clk))
 		return PTR_ERR(pll_x_clk);
 
-	pll_p_clk = clk_get_sys(NULL, "pll_p");
+	pll_p_clk = clk_get_sys(NULL, "pll_p_cclk");
 	if (IS_ERR(pll_p_clk))
 		return PTR_ERR(pll_p_clk);
 
arch/arm/mach-tegra/include/mach/clk.h +0 -3
index 95f3a54..85bbf10 100644
@@ -31,9 +31,6 @@ enum tegra_clk_ex_param {
 	TEGRA_CLK_PLLD_MIPI_MUX_SEL,
 };
 
-void tegra_periph_reset_deassert(struct clk *c);
-void tegra_periph_reset_assert(struct clk *c);
-
 #ifndef CONFIG_COMMON_CLK
 unsigned long clk_get_rate_all_locked(struct clk *c);
 #endif
arch/arm/mach-tegra/pcie.c +1 -1
index bffcd64..b60165f 100644
@@ -33,11 +33,11 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/export.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/sizes.h>
 #include <asm/mach/pci.h>
 
-#include <mach/clk.h>
 #include <mach/powergate.h>
 
 #include "board.h"
arch/arm/mach-tegra/powergate.c +1 -1
index 2cc1185..c6bc8f8 100644
@@ -26,8 +26,8 @@
 #include <linux/io.h>
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
+#include <linux/clk/tegra.h>
 
-#include <mach/clk.h>
 #include <mach/powergate.h>
 
 #include "fuse.h"
drivers/clk/tegra/clk-periph.c +38 -0
index 21fa881..06235f4 100644
@@ -112,6 +112,44 @@ static void clk_periph_disable(struct clk_hw *hw)
 	gate_ops->disable(gate_hw);
 }
 
+void tegra_periph_reset_deassert(struct clk *c)
+{
+	struct clk_hw *hw = __clk_get_hw(c);
+	struct tegra_clk_periph *periph = to_clk_periph(hw);
+	struct tegra_clk_periph_gate *gate;
+
+	if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
+		gate = container_of(hw, struct tegra_clk_periph_gate, hw);
+		if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
+			WARN_ON(1);
+			return;
+		}
+	} else {
+		gate = &periph->gate;
+	}
+
+	tegra_periph_reset(gate, 0);
+}
+
+void tegra_periph_reset_assert(struct clk *c)
+{
+	struct clk_hw *hw = __clk_get_hw(c);
+	struct tegra_clk_periph *periph = to_clk_periph(hw);
+	struct tegra_clk_periph_gate *gate;
+
+	if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
+		gate = container_of(hw, struct tegra_clk_periph_gate, hw);
+		if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
+			WARN_ON(1);
+			return;
+		}
+	} else {
+		gate = &periph->gate;
+	}
+
+	tegra_periph_reset(gate, 1);
+}
+
 const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
drivers/clk/tegra/clk.c +5 -0
index 314d5bd..9bb7463 100644
@@ -16,9 +16,14 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/of.h>
+#include <linux/clk/tegra.h>
 
 #include "clk.h"
 
+/* Global data of Tegra CPU CAR ops */
+struct tegra_cpu_car_ops *tegra_cpu_car_ops;
+
 void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
 				struct clk *clks[], int clk_max)
 {
drivers/dma/tegra20-apb-dma.c +1 -1
index c39e61b..afc9b89 100644
@@ -31,8 +31,8 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+#include <linux/clk/tegra.h>
 
-#include <mach/clk.h>
 #include "dmaengine.h"
 
 #define TEGRA_APBDMA_GENERAL			0x0
drivers/gpu/drm/tegra/dc.c +1 -2
index 0744103..cd2f8fa 100644
@@ -12,8 +12,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
-
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #include "drm.h"
 #include "dc.h"
drivers/gpu/drm/tegra/drm.c +0 -1
index 3a503c9..d980dc7 100644
@@ -11,7 +11,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 
-#include <mach/clk.h>
 #include <linux/dma-mapping.h>
 #include <asm/dma-iommu.h>
 
drivers/gpu/drm/tegra/hdmi.c +1 -2
index ab40164..2f39d3b 100644
@@ -14,8 +14,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
-
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #include "hdmi.h"
 #include "drm.h"
drivers/i2c/busses/i2c-tegra.c +1 -2
index 7b38877..c7aca35 100644
@@ -29,11 +29,10 @@
 #include <linux/of_i2c.h>
 #include <linux/of_device.h>
 #include <linux/module.h>
+#include <linux/clk/tegra.h>
 
 #include <asm/unaligned.h>
 
-#include <mach/clk.h>
-
 #define TEGRA_I2C_TIMEOUT (msecs_to_jiffies(1000))
 #define BYTES_PER_FIFO_WORD 4
 
drivers/input/keyboard/tegra-kbc.c +1 -1
index c76f968..54ac1dc 100644
@@ -30,7 +30,7 @@
 #include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/input/tegra_kbc.h>
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #define KBC_MAX_DEBOUNCE_CNT	0x3ffu
 
drivers/spi/spi-tegra20-sflash.c +1 -1
index 448a8cc..02feaa5 100644
@@ -34,7 +34,7 @@
 #include <linux/of_device.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi-tegra.h>
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #define SPI_COMMAND				0x000
 #define SPI_GO					BIT(30)
drivers/spi/spi-tegra20-slink.c +1 -1
index 651167f..fa208a5 100644
@@ -35,7 +35,7 @@
 #include <linux/of_device.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi-tegra.h>
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #define SLINK_COMMAND			0x000
 #define SLINK_BIT_LENGTH(x)		(((x) & 0x1f) << 0)
drivers/staging/nvec/nvec.c +1 -2
index 2830946..d51615b 100644
@@ -37,8 +37,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
-
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 
 #include "nvec.h"
 
include/linux/clk/tegra.h +4 -0
index a97e241..722a972 100644
@@ -17,6 +17,8 @@
 #ifndef __LINUX_CLK_TEGRA_H_
 #define __LINUX_CLK_TEGRA_H_
 
+#include <linux/clk.h>
+
 /*
  * Tegra CPU clock and reset control ops
  *
@@ -121,5 +123,7 @@ static inline void tegra_cpu_clock_resume(void)
 void tegra_dt_init_clk(void);
 void tegra20_cpu_car_ops_init(void);
 void tegra30_cpu_car_ops_init(void);
+void tegra_periph_reset_deassert(struct clk *c);
+void tegra_periph_reset_assert(struct clk *c);
 
 #endif /* __LINUX_CLK_TEGRA_H_ */
sound/soc/tegra/tegra30_ahub.c +1 -1
index f354dc3..bb31c41 100644
@@ -25,7 +25,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
-#include <mach/clk.h>
+#include <linux/clk/tegra.h>
 #include <sound/soc.h>
 #include "tegra30_ahub.h"
 
Signature · 1 line
1.7.4.1
author maintainer
#27 lore raw

PATCH v2 11/11 arm: tegra: Remove legacy clock code

In reply to Prashant Gaikwad

Remove all legacy clock code from mach-tegra.

---
 arch/arm/mach-tegra/Makefile              |    5 -
 arch/arm/mach-tegra/clock.c               |  147 --
 arch/arm/mach-tegra/clock.h               |  153 --
 arch/arm/mach-tegra/include/mach/clk.h    |   41 -
 arch/arm/mach-tegra/tegra20_clocks.c      | 1623 -------------------
 arch/arm/mach-tegra/tegra20_clocks.h      |   42 -
 arch/arm/mach-tegra/tegra20_clocks_data.c | 1143 -------------
 arch/arm/mach-tegra/tegra30_clocks.c      | 2506 -----------------------------
 arch/arm/mach-tegra/tegra30_clocks.h      |   54 -
 arch/arm/mach-tegra/tegra30_clocks_data.c | 1425 ----------------
 10 files changed, 0 insertions(+), 7139 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/clock.c
 delete mode 100644 arch/arm/mach-tegra/clock.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/clk.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra20_clocks_data.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.c
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks.h
 delete mode 100644 arch/arm/mach-tegra/tegra30_clocks_data.c
arch/arm/mach-tegra/Makefile +0 -5
index 0979e8b..79adbe3 100644
@@ -1,7 +1,6 @@
 obj-y                                   += common.o
 obj-y                                   += io.o
 obj-y                                   += irq.o
-obj-y                                   += clock.o
 obj-y                                   += timer.o
 obj-y					+= fuse.o
 obj-y					+= pmc.o
@@ -11,16 +10,12 @@ obj-y					+= apbio.o
 obj-y					+= pm.o
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_CPU_IDLE)			+= sleep.o
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += tegra20_clocks.o
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += tegra20_clocks_data.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra20_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= sleep-tegra20.o
 ifeq ($(CONFIG_CPU_IDLE),y)
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= cpuidle-tegra20.o
 endif
-obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_clocks.o
-obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_clocks_data.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= sleep-tegra30.o
 ifeq ($(CONFIG_CPU_IDLE),y)
arch/arm/mach-tegra/clock.c deleted +0 -147

147 lines not on this page · raw message

arch/arm/mach-tegra/clock.h deleted +0 -153

153 lines not on this page · raw message

arch/arm/mach-tegra/include/mach/clk.h deleted +0 -41

41 lines not on this page · raw message

arch/arm/mach-tegra/tegra20_clocks.c deleted +0 -1623

1,623 lines not on this page · raw message

arch/arm/mach-tegra/tegra20_clocks.h deleted +0 -42

42 lines not on this page · raw message

arch/arm/mach-tegra/tegra20_clocks_data.c deleted +0 -1143

971 lines not on this page · raw message

arch/arm/mach-tegra/tegra30_clocks.c deleted +0 -2506

2,506 lines not on this page · raw message

arch/arm/mach-tegra/tegra30_clocks.h deleted +0 -54

54 lines not on this page · raw message

arch/arm/mach-tegra/tegra30_clocks_data.c deleted +0 -1425

1,425 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.4.1

Part of the diff is not shown here. View the raw message.

#8 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

In reply to Prashant Gaikwad
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

#25 lore raw

Re: [PATCH v2 09/11] clk: tegra: add dt support

In reply to Prashant Gaikwad
Quoted 1 line · Prashant Gaikwad

Add support to initialize clock from DT.

Rather than require every separate clock driver to create a header in include/linux/clk/$socname.h, would it make sense to create a single function that can initialize any enable SoC's clocks, using a scheme similar to:

https://lkml.org/lkml/2012/11/20/706

That's in linux-next as of today, and Thomas Petazzoni was working on something similar for irqchips. It probably wouldn't be too hard to do the same for clock initialization?

#28 lore raw
In reply to Prashant Gaikwad
Quoted 7 lines · Prashant Gaikwad

This patchset does following:
1. Decompose single tegra clock structure into multiple clocks.
2. Try to use standard clock types supported by common clock framework.
3. Use dynamic initialization.
4. Move all clock code to drivers/clk/tegra from mach-tegra.
5. Add device tree support for Tegra20 and Tegra30 clocks.
6. Remove all legacy clock code from mach-tegra.

Mike,

Aside from a couple of small issues I just pointed out, this series looks reasonable to me. I'd like to take it through the Tegra tree since it might open up opportunities for other cleanup, and it has far more dependencies-on/conflicts-with other changes there than the drivers/clk tree. So, I'm looking for your ack when you can. Thanks.

author maintainer
#9 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

In reply to Stephen Warren
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

apbmisc reg for Tegra30 can be divided into following entries:

strap registers
jtag configuration registers
pull_up/pull_down control registers
vclk control registers
tvdac registers
chip id revision registers
pad control registers

This list is not same for Tegra20 and Tegra30.

OR

another way is to add chip id revision register region to CAR node as done for pinmux node and remove apb misc node.

What is preferred?

#10 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 20 lines · Prashant Gaikwad
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

apbmisc reg for Tegra30 can be divided into following entries:

strap registers
jtag configuration registers
pull_up/pull_down control registers
vclk control registers
tvdac registers
chip id revision registers
pad control registers

Quoted 1 line

This list is not same for Tegra20 and Tegra30.

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention above are truly dedicated to clock functionality.

Quoted 4 lines

OR

another way is to add chip id revision register region to CAR node as done for pinmux node and remove apb misc node.

The pinmux controller doesn't have a reg entry for the chip ID register. I don't understand what you mean here.

author maintainer
#11 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 20 lines · Stephen Warren
Quoted 19 lines · Prashant Gaikwad
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

apbmisc reg for Tegra30 can be divided into following entries:

strap registers
jtag configuration registers
pull_up/pull_down control registers
vclk control registers
tvdac registers
chip id revision registers
pad control registers

Quoted 5 lines
Quoted 1 line

This list is not same for Tegra20 and Tegra30.

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.
Only chip id revision registers are used in clock driver.

Quoted 6 lines
Quoted 4 lines

OR

another way is to add chip id revision register region to CAR node as done for pinmux node and remove apb misc node.

The pinmux controller doesn't have a reg entry for the chip ID register. I don't understand what you mean here.

I mean as we have separate entry for PAD control registers region in pinmux node we can have also have separate entry for chid id revision register region in CAR node.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 22 lines · Prashant Gaikwad
Quoted 21 lines · Stephen Warren
Quoted 20 lines · Prashant Gaikwad
Quoted 9 lines · Stephen Warren
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node
overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

apbmisc reg for Tegra30 can be divided into following entries:

strap registers
jtag configuration registers
pull_up/pull_down control registers
vclk control registers
tvdac registers
chip id revision registers
pad control registers

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This list is not same for Tegra20 and Tegra30.

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can you just read those?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

OR

another way is to add chip id revision register region to CAR node as done for pinmux node and remove apb misc node.

The pinmux controller doesn't have a reg entry for the chip ID register. I don't understand what you mean here.

I mean as we have separate entry for PAD control registers region in pinmux node we can have also have separate entry for chid id revision register region in CAR node.

The pad control registers are part of the pinmux HW, so it makes perfect sense for the pinmux driver to control them. The APB misc registers aren't part of the clock register set, so it doesn't make sense to the clock driver to touch them.

author maintainer
#13 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 28 lines · Stephen Warren
Quoted 27 lines · Prashant Gaikwad
Quoted 26 lines · Stephen Warren
Quoted 20 lines · Prashant Gaikwad
Quoted 9 lines · Stephen Warren
Quoted 2 lines · Prashant Gaikwad

APB misc contains multiple registers required by different modules such as CAR.

I don't see a DT binding document that describes what nvidia,tegra30-apbmisc means. Also, the register range for this new node
overlaps that for the pinmux node, so they can't both "request" their register region. You may need multiple entries in the apbmisc reg property to avoid this.

apbmisc reg for Tegra30 can be divided into following entries:

strap registers
jtag configuration registers
pull_up/pull_down control registers
vclk control registers
tvdac registers
chip id revision registers
pad control registers

Quoted 1 line

This list is not same for Tegra20 and Tegra30.

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention above are truly dedicated to clock functionality.

Quoted 8 lines
Quoted 2 lines

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

OR

another way is to add chip id revision register region to CAR node as done for pinmux node and remove apb misc node.

The pinmux controller doesn't have a reg entry for the chip ID register. I don't understand what you mean here.

I mean as we have separate entry for PAD control registers region in pinmux node we can have also have separate entry for chid id revision register region in CAR node.

The pad control registers are part of the pinmux HW, so it makes perfect sense for the pinmux driver to control them. The APB misc registers aren't part of the clock register set, so it doesn't make sense to the clock driver to touch them.

#14 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 5 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

author maintainer
#15 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 22 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 5 lines

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

tegra_init_fuse in arch/arm/mach-tegra/fuse.c is already reading chip id revision register, so I can implement one function to read this register in fuse.c, which will be used by clock driver and tegra_init_fuse. But then we need to add it to some header file in include/mach or include/linux, where? any suggestion?

#16 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 32 lines · Prashant Gaikwad
Quoted 25 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the
differences; the clock driver really shouldn't be touching the APB MISC
registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can
you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 5 lines

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

Quoted 5 lines

tegra_init_fuse in arch/arm/mach-tegra/fuse.c is already reading chip id revision register, so I can implement one function to read this register in fuse.c, which will be used by clock driver and tegra_init_fuse. But then we need to add it to some header file in include/mach or include/linux, where? any suggestion?

Somewhere other than arch/arm/mach-tega/include/mach/ would be good, so we don't have to move it later when we enable multi-platform zImage for Tegra. Perhaps include/linux/tegra-soc.h? I guess we could move the existing mach/powergate.h contents into that file later too.

author maintainer
#17 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 37 lines · Stephen Warren
Quoted 31 lines · Prashant Gaikwad
Quoted 25 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the
differences; the clock driver really shouldn't be touching the APB MISC
registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can
you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 5 lines

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

Quoted 5 lines

tegra_init_fuse in arch/arm/mach-tegra/fuse.c is already reading chip id revision register, so I can implement one function to read this register in fuse.c, which will be used by clock driver and tegra_init_fuse. But then we need to add it to some header file in include/mach or include/linux, where? any suggestion?

Quoted 4 lines

Somewhere other than arch/arm/mach-tega/include/mach/ would be good, so we don't have to move it later when we enable multi-platform zImage for Tegra. Perhaps include/linux/tegra-soc.h? I guess we could move the existing mach/powergate.h contents into that file later too.

include/linux/tegra-soc.h seems fine, I will send updated patch series.

maintainer
#18 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

In reply to Stephen Warren
Quoted 22 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the differences; the clock driver really shouldn't be touching the APB MISC registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 5 lines

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

I think individual driver should take care of flushing the write operation inplace of clock driver.
Atleast I moved flushing to i2c and spi for these drivers. Polluting clock driver here does not make sense here.

#19 lore raw

Re: [PATCH v2 05/11] ARM: dt: tegra30: Add device node for APB MISC

Quoted 32 lines · Laxman Dewangan
Quoted 25 lines · Stephen Warren
Quoted 3 lines · Prashant Gaikwad
Quoted 2 lines · Stephen Warren
Quoted 1 line · Prashant Gaikwad

On Thursday 03 January 2013 09:41 PM, Stephen Warren wrote:

...

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

OK. It sounds like we need a true APB MISC driver then, to abstract the
differences; the clock driver really shouldn't be touching the APB MISC
registers in all likelihood, unless a subset of the sections you mention
above are truly dedicated to clock functionality.

I don't think it is a good idea to create a driver for APB MISC, all registers are used by different drivers.

Well, it's even worse to have a bunch of other drivers randomly trample on a set of registers they don't own.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Only chip id revision registers are used in clock driver.

There are already global variables exposed by the Tegra fuse driver; can
you just read those?

It is not about variables or some value, we have to read some apb register to flush the write operation in apb bus before we disable peripheral clock.
We are using chip id revision register for this purpose.

Quoted 5 lines

Ah. That's definitely not something the clock driver should be doing directly. It's probably OK to add a custom Tegra-specific function to some file in arch/arm/mach-tegra to implement this. Even better would be a full bus driver for the APB bus, but that's probably too much bloat for now.

Quoted 4 lines

I think individual driver should take care of flushing the write operation inplace of clock driver.
Atleast I moved flushing to i2c and spi for these drivers. Polluting clock driver here does not make sense here.

That does seem like a reasonable assertion.

Still, I believe the clock driver currently does this already today, so removing it might be a regression. I think we want to:

a) Maintain this feature in the clock driver rework for now.
b) Audit and fix any device drivers.
c) Remove the feature from the clock driver.

Of course, if (b) is so easy to do that you don't need to do (a) or (c) at all, that's fine too, but I believe Prashant is under time pressure to get the common clock rework done before his vacation.

#2 lore raw

Re: [PATCH v2 01/11] clk: tegra: Add tegra specific clocks

In reply to Prashant Gaikwad
Quoted 3 lines · Prashant Gaikwad

Add tegra specific clocks, pll, pll_out, peripheral, frac_divider, super.

...

Quoted 27 lines
drivers/clk/tegra/clk-pll-out.c new file +21 -0
new file mode 100644
index 0000000..60a117b
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/slab.h>

drivers/clk/tegra/clk-pll-out.c line 31

Quoted 10 lines
drivers/clk/tegra/clk-pll-out.c new file +10 -0
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+
+#include "clk.h"
+
+#define to_clk_pll_out(_hw) container_of(_hw, struct tegra_clk_pll_out, hw)
+
+#define pll_out_enb(p) (BIT(p->enb_bit_idx))
+#define pll_out_rst(p) (BIT(p->rst_bit_idx))
+

Given that these 2 are always consecutive bits, wouldn't it make more sense to specify the bit offset once and then add 1 for the enable bit?

Cheers,

Peter.

#23 lore raw

Re: [PATCH v2 08/11] clk: tegra: add clock support for tegra30

In reply to Prashant Gaikwad
Quoted 41 lines · Prashant Gaikwad

Add tegra30 clock support based on common clock framework.

---
 drivers/clk/tegra/Makefile      |    1 +
 drivers/clk/tegra/clk-tegra30.c | 1968 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h         |    6 +
 3 files changed, 1975 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/tegra/clk-tegra30.c
drivers/clk/tegra/Makefile +1 -0
index 00484fd..2b41b0f 100644
@@ -8,3 +8,4 @@ obj-y                                   += clk-pll-out.o
 obj-y                                  += clk-super.o
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
+obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
drivers/clk/tegra/clk-tegra30.c new file +16 -0
new file mode 100644
index 0000000..a5496fe
@@ -0,0 +1,1968 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+

...

drivers/clk/tegra/clk-tegra30.c line 1435

Quoted 5 lines
drivers/clk/tegra/clk-tegra30.c new file +5 -0
+       TEGRA_INIT_DATA_MUX("i2c1",     "div-clk",      "tegra-i2c.0",          mux_pllp_clkm,          CLK_SOURCE_I2C1,        12,     &periph_l_regs, TEGRA_PERIPH_ON_APB, i2c1),
+       TEGRA_INIT_DATA_MUX("i2c2",     "div-clk",      "tegra-i2c.1",          mux_pllp_clkm,          CLK_SOURCE_I2C2,        54,     &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c2),
+       TEGRA_INIT_DATA_MUX("i2c3",     "div-clk",      "tegra-i2c.2",          mux_pllp_clkm,          CLK_SOURCE_I2C3,        67,     &periph_u_regs, TEGRA_PERIPH_ON_APB, i2c3),
+       TEGRA_INIT_DATA_MUX("i2c4",     "div-clk",      "tegra-i2c.3",          mux_pllp_clkm,          CLK_SOURCE_I2C4,        103,    &periph_v_regs, TEGRA_PERIPH_ON_APB, i2c4),
+       TEGRA_INIT_DATA_MUX("i2c5",     "div-clk",      "tegra-i2c.4",          mux_pllp_clkm,          CLK_SOURCE_I2C5,        47,     &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c5),

These clocks have a 16bit divider according to the TRM, so I think you need a new type for this?

Cheers,

Peter.

#6 lore raw

Re: [PATCH v2 04/11] ARM: Tegra: Define Tegra30 CAR binding

In reply to Prashant Gaikwad
Quoted 3 lines · Prashant Gaikwad

The device tree binding models Tegra30 CAR (Clock And Reset) as a single monolithic clock provider.

...

Quoted 1 line

+ 8 gpio

This clock isn't defined further on though...

Cheers,

Peter.