Skip to contentSkip to conversation

Migrate Tegra to common clock framework

PATCH Superseded Prashant Gaikwad 4 participants 24 messages Jan 4, 2013 – Jan 11, 2013

Subsystems (20)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Prashant Gaikwad

author maintainer
#0 lore raw

v3 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 v2:
Removed APB MISC node.
Fixed some issues reported by Joseph Lo.
Added function to read chip id revision register.

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

Prashant Gaikwad (8):
ARM: tegra: Add function to read chipid
clk: tegra: Add tegra specific clocks
arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h
ARM: Tegra: Define Tegra30 CAR binding
clk: tegra: add clock support for tegra20
clk: tegra: add clock support for tegra30
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          |  205 ++
 .../bindings/clock/nvidia,tegra30-car.txt          |  270 +++
 arch/arm/boot/dts/tegra20.dtsi                     |    6 +
 arch/arm/boot/dts/tegra30.dtsi                     |    6 +
 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/fuse.c                         |   12 +-
 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                |  182 ++
 drivers/clk/tegra/clk-periph.c                     |  228 ++
 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                    | 1244 ++++++++++
 drivers/clk/tegra/clk-tegra30.c                    | 2037 ++++++++++++++++
 drivers/clk/tegra/clk.c                            |   85 +
 drivers/clk/tegra/clk.h                            |  486 ++++
 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   |   13 +-
 include/linux/tegra-soc.h                          |   22 +
 sound/soc/tegra/tegra30_ahub.c                     |    2 +-
 50 files changed, 6048 insertions(+), 7292 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 (91%)
 create mode 100644 include/linux/tegra-soc.h
Signature · 1 line
1.7.4.1
author maintainer
#1 lore raw

PATCH v3 1/9 ARM: tegra: Add function to read chipid

Add function to read chip id from APB MISC registers. This function will also get called from clock driver to flush write operations on apb bus.

---
 arch/arm/mach-tegra/fuse.c |   12 ++++++++++--
 include/linux/tegra-soc.h  |   22 ++++++++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/tegra-soc.h
arch/arm/mach-tegra/fuse.c +10 -2
index 8121742..2cd8ac9 100644
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/tegra-soc.h>
 
 #include "fuse.h"
 #include "iomap.h"
@@ -105,6 +106,14 @@ static void tegra_get_process_id(void)
 	tegra_core_process_id = (reg >> 12) & 3;
 }
 
+void tegra_read_chipid(void)
+{
+	u32 reg;
+
+	reg = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
+	tegra_chip_id = (reg >> 8) & 0xff;
+}
+
 void tegra_init_fuse(void)
 {
 	u32 id;
@@ -119,8 +128,7 @@ void tegra_init_fuse(void)
 	reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
 	tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
 
-	id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
-	tegra_chip_id = (id >> 8) & 0xff;
+	tegra_read_chipid();
 
 	switch (tegra_chip_id) {
 	case TEGRA20:
include/linux/tegra-soc.h new file +22 -0
new file mode 100644
index 0000000..dcbc14c
@@ -0,0 +1,22 @@
+/*
+ * 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/>.
+ */
+
+#ifndef __LINUX_TEGRA_SOC_H_
+#define __LINUX_TEGRA_SOC_H_
+
+void tegra_read_chipid(void);
+
+#endif /* __LINUX_TEGRA_SOC_H_ */
Signature · 1 line
1.7.4.1
author maintainer
#2 lore raw

PATCH v3 2/9 clk: tegra: Add tegra specific clocks

In reply to Prashant Gaikwad

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 |  182 ++++++++++
 drivers/clk/tegra/clk-periph.c      |  190 ++++++++++
 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             |  474 ++++++++++++++++++++++++
 11 files changed, 2153 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 +182 -0

182 lines not on this page · raw message

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

190 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 +474 -0

474 lines not on this page · raw message

Signature · 1 line
1.7.4.1
author maintainer
#3 lore raw

PATCH v3 3/9 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 v3 4/9 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          |  205 ++++++++++++++++++++
 arch/arm/boot/dts/tegra20.dtsi                     |    6 +
 2 files changed, 211 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt new file +205 -0
new file mode 100644
index 0000000..0921fac
@@ -0,0 +1,205 @@
+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
+
+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 fe35c72..be3421d 100644
@@ -131,6 +131,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 v3 5/9 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          |  270 ++++++++++++++++++++
 arch/arm/boot/dts/tegra30.dtsi                     |    6 +
 2 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt new file +270 -0
new file mode 100644
index 0000000..6169493
@@ -0,0 +1,270 @@
+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
+
+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 f534a50..e254d59 100644
@@ -133,6 +133,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
#6 lore raw

PATCH v3 6/9 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 | 1244 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h         |    6 +
 3 files changed, 1252 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 +1244 -0

1,244 lines not on this page · raw message

drivers/clk/tegra/clk.h +6 -0
index 7cd3248..d2e771a 100644
@@ -471,4 +471,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
#7 lore raw

PATCH v3 7/9 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 | 2037 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h         |    6 +
 3 files changed, 2044 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 +2037 -0

2,037 lines not on this page · raw message

drivers/clk/tegra/clk.h +6 -0
index d2e771a..aa340bc 100644
@@ -477,4 +477,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
#8 lore raw

PATCH v3 8/9 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.
4. Remove legacy clock initialization.
5. Initialize clocks using DT.
6. Remove all instance of mach/clk.h

---
 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                |   16 +++++++++++
 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              |    5 +++
 sound/soc/tegra/tegra30_ahub.c         |    2 +-
 21 files changed, 73 insertions(+), 142 deletions(-)
arch/arm/mach-tegra/board-dt-tegra20.c +0 -30
index 8e35aae..c774a80 100644
@@ -42,7 +42,6 @@
 #include <asm/setup.h>
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -104,37 +103,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 a9ed15d..35ddf72 100644
@@ -35,7 +35,6 @@
 #include <asm/hardware/gic.h>
 
 #include "board.h"
-#include "clock.h"
 #include "common.h"
 #include "iomap.h"
 
@@ -67,38 +66,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 85d4a23..ebffed6 100644
@@ -266,7 +266,7 @@ static int __init tegra_cpufreq_init(void)
 	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 53d0858..73993ce 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 ed0ded2..c4ccb01 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 +16 -0
index cf023a9..a603b9a 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)
 {
@@ -67,3 +72,14 @@ 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_clocks_init(void)
+{
+	of_clk_init(tegra_dt_clk_match);
+}
drivers/dma/tegra20-apb-dma.c +1 -1
index efdfffa..f5f8a52 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 dcea77b..c048c98 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 +5 -0
index 0977f2a..a7e5a39 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
  *
@@ -120,5 +122,8 @@ static inline void tegra_cpu_clock_resume(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);
+void tegra_clocks_init(void);
 
 #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
#9 lore raw

PATCH v3 9/9 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 ----------------
 include/linux/clk/tegra.h                 |    2 -
 11 files changed, 0 insertions(+), 7141 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 bd5d312..6179b15 100644
@@ -1,7 +1,6 @@
 obj-y                                   += common.o
 obj-y                                   += io.o
 obj-y                                   += irq.o
-obj-y                                   += clock.o
 obj-y					+= fuse.o
 obj-y					+= pmc.o
 obj-y					+= flowctrl.o
@@ -10,16 +9,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

include/linux/clk/tegra.h +0 -2
index a7e5a39..404d6f9 100644

Lines of this file are not shown. View the 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.

Tested-by on the v3 series
#10 lore raw
In reply to Prashant Gaikwad
Quoted 28 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.

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

Changes from v2:
Removed APB MISC node.
Fixed some issues reported by Joseph Lo.
Added function to read chip id revision register.

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

Prashant Gaikwad (8):
ARM: tegra: Add function to read chipid
clk: tegra: Add tegra specific clocks
arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h
ARM: Tegra: Define Tegra30 CAR binding
clk: tegra: add clock support for tegra20
clk: tegra: add clock support for tegra30
arm: tegra: Migrate to new clock code
arm: tegra: Remove legacy clock code

Quoted 3 lines

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

Good job, Prashant. :-)

This series :

#11 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.

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

I imagine the same issue would be seen on Harmony or Ventana since they're very similar. All of those functions work fine with Tegra's for-next branch (commit 5e30b49 "Merge branch 'for-3.9/defconfig' into for-next").

I didn't try Tegra30. I assume you'll test both SoCs...

864e964 clk: vexpress: Use common of_clk_init() function c4e8389 clk: zynq: Use common of_clk_init() function 2c9ff0c clk: vt8500: Use common of_clk_init() function db9c59c clk: highbank: Use common of_clk_init() function b40949b clk: sunxi: Use common of_clk_init() function f6d1492 clk: tegra: Use common of_clk_init() function f6fd2eb clk: add common of_clk_init() function 70a8ea3 clk: tegra30: remove unused TEGRA_CLK_DUPLICATE()s 3945e4f clk: tegra20: remove unused TEGRA_CLK_DUPLICATE()s 587bcca arm: tegra30: remove auxdata
52b982f arm: tegra20: remove auxdata
3381359 ASoC: tegra: remove auxdata
d31ea1b ARM: dt: tegra30: Add clock information 542ddb5 ARM: dt: tegra20: Add clock information dd19f5f arm: tegra: Remove legacy clock code aaf17b6 arm: tegra: Migrate to new clock code 458a3ae clk: tegra: add clock support for tegra30 edb65f1 clk: tegra: add clock support for tegra20 1786e1f ARM: Tegra: Define Tegra30 CAR binding 7d77415 ARM: tegra: Define Tegra20 CAR binding a4798fa arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h df05a02 clk: tegra: Add tegra specific clocks ad00a81 ARM: tegra: Add function to read chipid

#12 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 9 lines · Stephen Warren
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.

Quoted 7 lines

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

The following work, on both Tegra20/30 unless otherwise specified:

* MMC/SD, I2C, audio, HDMI display (Tegra20 only; on Springbank), USB (Tegra20 only; not implemented on Tegra30).

I didn't test the following yet:

* LCD display on Tegra20.

The following are broken:

1)

SPI on either chip. This is because the SPI drivers call clk_get() with a specific clock name, and the DT patches you created don't have a clk-names property for any of the SPI nodes, hence this fails. However, since there's only a single clock to the SPI controllers, I think the drivers should be fixed not to request a specific clock name. The following makes SPI work on TrimSlice (Tegra20) and Cardhu (Tegra30):

Quoted 18 lines
drivers/spi/spi-tegra20-sflash.c +1 -1
index 02feaa5..e5dce91 100644
@@ -525,7 +525,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)
                goto exit_free_master;
        }
 
-       tsd->clk = devm_clk_get(&pdev->dev, "spi");
+       tsd->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(tsd->clk)) {
                dev_err(&pdev->dev, "can not get clock\n");
                ret = PTR_ERR(tsd->clk);
drivers/spi/spi-tegra20-slink.c +0 -0
index fa208a5..e255e7a 100644

drivers/spi/spi-tegra20-slink.c static int tegra_slink_probe(struct platform_device *pdev) · line 1197

Quoted 8 lines
drivers/spi/spi-tegra20-slink.c +1 -1
@@ -1191,7 +1191,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
                goto exit_free_master;
        }
 
-       tspi->clk = devm_clk_get(&pdev->dev, "slink");
+       tspi->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(tspi->clk)) {
                dev_err(&pdev->dev, "can not get clock\n");
                ret = PTR_ERR(tspi->clk);

I think you should include that in your series before the patches which add clocks into the DT.

2)

HDMI and LCD display are both broken on Cardhu/Tegra30.

I found that the DT lists the HDMI clock's parent as pll_d2_out0, yet the clock driver lists pll_d2 as a valid parent. I think the following patch fixes this correctly?

Quoted 5 lines
drivers/clk/tegra/clk-tegra30.c +0 -0
index a52b80c..661b9e1 100644

drivers/clk/tegra/clk-tegra30.c static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m", · line 1392

Quoted 10 lines
drivers/clk/tegra/clk-tegra30.c +2 -2
@@ -1385,8 +1385,8 @@ static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m",
 static const char *mux_pllmcpa[] = { "pll_m", "pll_c", "pll_p", "pll_a" };
 static const char *mux_pllpdc_clkm[] = { "pll_p", "pll_d", "pll_c", "clk_m" };
 static const char *mux_pllp_clkm[] = { "pll_p", "unused", "unused", "clk_m" };
-static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d",
-                                            "pll_a", "pll_c", "pll_d2",
+static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d_out0",
+                                            "pll_a", "pll_c", "pll_d2_out0",
                                             "clk_m" };
 static const char *mux_plla_clk32k_pllp_clkm_plle[] = { "pll_a_out0",
                                                        "clk_32k", "pll_p",

(are there any other similar problems in the code?)

After that, if I comment out:

late_initcall(clk_disable_unused);

... then either HDMI or LCD output on Cardhu work OK (or rather in HDMI's case, as well as can be expected due incorrect memory controller programming and hence display underflow at the moment). I haven't had a chance to investigate why that initcall is causing problems (the problem being a HW hang during boot in the HDMI case, and simply no visible output in the LCD case, but the system otherwise works OK).

For reference, the patches to enable LCD/HDMI on Cardhu can be found in:

git://nv-tegra.nvidia.com/user/swarren/linux-2.6 linux-next_common

3)

WiFi doesn't work on either chip (Springbank or Cardhu, but I expect Ventana has the same issue). I haven't been able to investigate why yet.

4)

I noticed that the PCIe driver (on Trimslice/Tegra20) was complaining about clk_get() failing or similar. I haven't been able to investigate why yet.

For reference, all of these problems are all introduced by your commit "arm: tegra: Migrate to new clock code"; everything works immediately before that.

Let me know if you find any solutions to these; I guess just update your branch. Otherwise, I'll keep investigating tomorrow.

author maintainer
#13 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 13 lines · Stephen Warren
Quoted 12 lines · Stephen Warren
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.

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

Quoted 7 lines
Quoted 3 lines

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

Stephen, thanks a lot for the extensive testing and fix!!

Quoted 41 lines

The following work, on both Tegra20/30 unless otherwise specified:

* MMC/SD, I2C, audio, HDMI display (Tegra20 only; on Springbank), USB (Tegra20 only; not implemented on Tegra30).

I didn't test the following yet:

* LCD display on Tegra20.

The following are broken:

1)

SPI on either chip. This is because the SPI drivers call clk_get() with a specific clock name, and the DT patches you created don't have a clk-names property for any of the SPI nodes, hence this fails. However, since there's only a single clock to the SPI controllers, I think the drivers should be fixed not to request a specific clock name. The following makes SPI work on TrimSlice (Tegra20) and Cardhu (Tegra30):

Quoted 21 lines
drivers/spi/spi-tegra20-sflash.c +1 -1
index 02feaa5..e5dce91 100644
@@ -525,7 +525,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)
                 goto exit_free_master;
         }
 
-       tsd->clk = devm_clk_get(&pdev->dev, "spi");
+       tsd->clk = devm_clk_get(&pdev->dev, NULL);
         if (IS_ERR(tsd->clk)) {
                 dev_err(&pdev->dev, "can not get clock\n");
                 ret = PTR_ERR(tsd->clk);
drivers/spi/spi-tegra20-slink.c +0 -0
index fa208a5..e255e7a 100644
@@ -1191,7 +1191,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
                 goto exit_free_master;
         }
 
Quoted 7 lines

drivers/spi/spi-tegra20-slink.c static int tegra_slink_probe(struct platform_device *pdev) · line 1197

Quoted 5 lines
drivers/spi/spi-tegra20-slink.c +1 -1
-       tspi->clk = devm_clk_get(&pdev->dev, "slink");
+       tspi->clk = devm_clk_get(&pdev->dev, NULL);
         if (IS_ERR(tspi->clk)) {
                 dev_err(&pdev->dev, "can not get clock\n");
                 ret = PTR_ERR(tspi->clk);

I think you should include that in your series before the patches which add clocks into the DT.

Included.

Quoted 8 lines

2)

HDMI and LCD display are both broken on Cardhu/Tegra30.

I found that the DT lists the HDMI clock's parent as pll_d2_out0, yet the clock driver lists pll_d2 as a valid parent. I think the following patch fixes this correctly?

Quoted 16 lines
Quoted 5 lines
drivers/clk/tegra/clk-tegra30.c +0 -0
index a52b80c..661b9e1 100644

drivers/clk/tegra/clk-tegra30.c static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m", · line 1392

Quoted 10 lines
drivers/clk/tegra/clk-tegra30.c +2 -2
@@ -1385,8 +1385,8 @@ static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m",
  static const char *mux_pllmcpa[] = { "pll_m", "pll_c", "pll_p", "pll_a" };
  static const char *mux_pllpdc_clkm[] = { "pll_p", "pll_d", "pll_c", "clk_m" };
  static const char *mux_pllp_clkm[] = { "pll_p", "unused", "unused", "clk_m" };
-static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d",
-                                            "pll_a", "pll_c", "pll_d2",
+static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d_out0",
+                                            "pll_a", "pll_c", "pll_d2_out0",
                                              "clk_m" };
  static const char *mux_plla_clk32k_pllp_clkm_plle[] = { "pll_a_out0",
                                                         "clk_32k", "pll_p",

(are there any other similar problems in the code?)

Included fix and reviewed code for more instances. There were some.

Quoted 11 lines

After that, if I comment out:

late_initcall(clk_disable_unused);

... then either HDMI or LCD output on Cardhu work OK (or rather in HDMI's case, as well as can be expected due incorrect memory controller programming and hence display underflow at the moment). I haven't had a chance to investigate why that initcall is causing problems (the problem being a HW hang during boot in the HDMI case, and simply no visible output in the LCD case, but the system otherwise works OK).

Quoted 3 lines

For reference, the patches to enable LCD/HDMI on Cardhu can be found in:

git://nv-tegra.nvidia.com/user/swarren/linux-2.6 linux-next_common

Not able to test LCD/HDMI even using above branch. Not sure what is missing. In kernel log I can see that Tegra DRM is initialized properly. Tried "dmesg > /dev/fb0".

Quoted 4 lines

3)

WiFi doesn't work on either chip (Springbank or Cardhu, but I expect Ventana has the same issue). I haven't been able to investigate why yet.

Probable fix included, can not test.

Quoted 5 lines

4)

I noticed that the PCIe driver (on Trimslice/Tegra20) was complaining about clk_get() failing or similar. I haven't been able to investigate why yet.

Fix included, pcie_xclk clock was missing

Quoted 6 lines

For reference, all of these problems are all introduced by your commit "arm: tegra: Migrate to new clock code"; everything works immediately before that.

Let me know if you find any solutions to these; I guess just update your branch. Otherwise, I'll keep investigating tomorrow.

I have updated the internal branch with all the above mentioned fixes.

#14 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 21 lines · Prashant Gaikwad
Quoted 20 lines · Stephen Warren
Quoted 8 lines · Stephen Warren
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.

Quoted 7 lines

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

WiFi and SPI now work on both Tegra20/30.

PCIe still doesn't work on Tegra20. The reason is that clk_plle_enable()'s call to _get_table_rate() fails, since pll->fixed_rate is 0, and hence there's no matching table entry.

I simply commented out that call, and the later code that uses its results to configure the PLL rate, and then everything worked - or at least PCIe device enumeration and hence lspci worked, which is as much as works right now with PCIe on Tegra...

Is the solution here to fix clk-tegra20.c's call to tegra_clk_plle() to specify a valid fixed rate?

However, I'm puzzled why clk_plle_enable() is even touching the dividers though; shouldn't clk_plle_set_rate() be setting up the rate, and clk_plle_enable() /just/ be enabling/disabling the PLL? The old clock driver appears to work the way I expect, and use the standard PLL set_rate op for this clock, and has a very simple custom enable op for PLLe.

The remaining item is the display issue on Tegra30, which I'll go look at now.

#15 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 24 lines · Stephen Warren
Quoted 21 lines · Prashant Gaikwad
Quoted 20 lines · Stephen Warren
Quoted 8 lines · Stephen Warren
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.

Quoted 7 lines

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

drivers/clk/tegra/clk-tegra30.c static void __init tegra30_periph_clk_init(void) · line 1546

Quoted 12 lines
drivers/clk/tegra/clk-tegra30.c +1 -1
index f2f526e..0bac07c 100644
@@ -1541,7 +1541,7 @@ static void __init tegra30_periph_clk_init(void)
 
 	/* usb3 */
 	clk = tegra_clk_periph_gate("usb3", "clk_m", 0, clk_base, 0, 59,
-				    &periph_l_regs, periph_clk_enb_refcnt);
+				    &periph_h_regs, periph_clk_enb_refcnt);
 	clk_register_clkdev(clk, NULL, "tegra-ehci.2");
 	clks[usb3] = clk;

I wonder if there are any other similar issues?

author maintainer
#16 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 23 lines · Stephen Warren
Quoted 22 lines · Stephen Warren
Quoted 21 lines · Prashant Gaikwad
Quoted 20 lines · Stephen Warren
Quoted 8 lines · Stephen Warren
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.

Quoted 7 lines

I think there are bugs here. I applied all your clock patches on top of Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

Quoted 8 lines
Quoted 2 lines

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

Stephen, thanks for the fix!! I have included this and PLLE fix; updated internal branch.

Please let me know if it is good to merge now, I will send the patches.

Quoted 6 lines
Quoted 6 lines
drivers/clk/tegra/clk-tegra30.c +0 -0
index f2f526e..0bac07c 100644
@@ -1541,7 +1541,7 @@ static void __init tegra30_periph_clk_init(void)
 
Quoted 7 lines

drivers/clk/tegra/clk-tegra30.c static void __init tegra30_periph_clk_init(void) · line 1546

Quoted 6 lines
drivers/clk/tegra/clk-tegra30.c +1 -1
  	/* usb3 */
  	clk = tegra_clk_periph_gate("usb3", "clk_m", 0, clk_base, 0, 59,
-				    &periph_l_regs, periph_clk_enb_refcnt);
+				    &periph_h_regs, periph_clk_enb_refcnt);
  	clk_register_clkdev(clk, NULL, "tegra-ehci.2");
  	clks[usb3] = clk;

I wonder if there are any other similar issues?

Reviewed, there were none.

#17 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 30 lines · Prashant Gaikwad
Quoted 29 lines · Stephen Warren
Quoted 27 lines · Stephen Warren
Quoted 24 lines · Prashant Gaikwad
Quoted 23 lines · Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 8 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.

Quoted 8 lines

I think there are bugs here. I applied all your clock patches on top of
Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

Stephen, thanks for the fix!! I have included this and PLLE fix; updated internal branch.

Almost everything works great now.

However, I don't see any fix for the PLLE issue in the code; if there is one it certainly doesn't work. Applying my previous hack makes it work.

FYI, the branch I tested with is at
git://nv-tegra.nvidia.com/user/swarren/linux-2.6 test-ccf-rework-2

It's rebased onto the latest Tegra for-next.

#18 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 33 lines · Stephen Warren
Quoted 32 lines · Prashant Gaikwad
Quoted 31 lines · Stephen Warren
Quoted 27 lines · Stephen Warren
Quoted 24 lines · Prashant Gaikwad
Quoted 23 lines · Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 8 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.

Quoted 8 lines

I think there are bugs here. I applied all your clock patches on top of
Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

Stephen, thanks for the fix!! I have included this and PLLE fix; updated internal branch.

Almost everything works great now.

I noticed a couple more issues.

First, the clock rate rounding behaviour changes with your patch series for at least the I2C clocks.

With I2C, you specify how fast you want the bus to go. The bus shouldn't run any faster than that since the rate matches the max specification for the attached devices. So the clock framework should pick the smallest divider that yields a clock that doesn't exceed the request from clk_set_rate(). However, the new code seems to pick the smallest divider that yields at least the requested clock. I can certainly see that other clocks (say memory, CPU, or other internal performance-related clocks) might want to round the other way though.

The I2C driver sets its module clock to 8 times the desired bus rate. This yields a request of:

desired bus rate: 100 KHz
desired clock rate: 800 KHz
actual clock rate before your change: 800 KHz
actual clock rate after your change: 800 KHz
-> OK

desired bus rate: 400 KHz
desired clock rate: 3.2 MHz
actual clock rate before your change: 3 MHz (so 375 KHz bus rate, OK) actual clock rate after your change: 4 MHZ (so 500 KHz bus rate, BAD)

desired bus rate: 80 KHz (Toshiba AC100's nvec/I2C slave driver) desired clock rate: 640 KHz
actual clock rate before your change: ~632 KHz (so ~79 KHz bus rate, OK) actual clock rate after your change: ~706 KHz (so ~88 KHz bus rate, BAD)

Can this be fixed?

Second, the Toshiba AC100 uses an alternative driver for the I2C HW, since it operates in I2C slave mode. So, the DT node for that driver needs to include the clocks properties so the driver can get the clocks through DT:

arch/arm/boot/dts/tegra20-paz00.dts line 285

Quoted 13 lines
arch/arm/boot/dts/tegra20-paz00.dts +2 -0
index edef66c..6495425 100644
@@ -278,6 +278,8 @@
                clock-frequency = <50000>;
                request-gpios = <&gpio 170 0>; /* gpio PV2 */
                slave-addr = <138>;
+               clocks = <&tegra_car 67>, <&tegra_car 124>;
+               clock-names = "div-clk", "fast-clk";
        };
 
        i2c at 7000d000 {

Your changes don't actually cause the driver to break though, since it abuses clk_get_sys() to retrieve clocks under a different driver name, which matches what the clock driver provides. However, I think you should also include the following patch at the end of your series to fix this up, so the clock looking happens through device tree:

drivers/staging/nvec/nvec.c static int tegra_nvec_probe(struct platform_device *pdev) · line 776

Quoted 13 lines
drivers/staging/nvec/nvec.c +1 -1
index d8826ed..6d44076 100644
@@ -770,7 +770,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
+       i2c_clk = clk_get(&pdev->dev, "div-clk");
        if (IS_ERR(i2c_clk)) {
                dev_err(nvec->dev, "failed to get controller clock\n");
                return -ENODEV;

Thanks.

author maintainer
#19 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 68 lines · Stephen Warren
Quoted 31 lines · Stephen Warren
Quoted 30 lines · Prashant Gaikwad
Quoted 29 lines · Stephen Warren
Quoted 27 lines · Stephen Warren
Quoted 24 lines · Prashant Gaikwad
Quoted 23 lines · Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 8 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.

Quoted 8 lines

I think there are bugs here. I applied all your clock patches on top of
Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

Stephen, thanks for the fix!! I have included this and PLLE fix; updated internal branch.

Almost everything works great now.

I noticed a couple more issues.

First, the clock rate rounding behaviour changes with your patch series for at least the I2C clocks.

With I2C, you specify how fast you want the bus to go. The bus shouldn't run any faster than that since the rate matches the max specification for the attached devices. So the clock framework should pick the smallest divider that yields a clock that doesn't exceed the request from clk_set_rate(). However, the new code seems to pick the smallest divider that yields at least the requested clock. I can certainly see that other clocks (say memory, CPU, or other internal performance-related clocks) might want to round the other way though.

The I2C driver sets its module clock to 8 times the desired bus rate. This yields a request of:

desired bus rate: 100 KHz
desired clock rate: 800 KHz
actual clock rate before your change: 800 KHz
actual clock rate after your change: 800 KHz
-> OK

desired bus rate: 400 KHz
desired clock rate: 3.2 MHz
actual clock rate before your change: 3 MHz (so 375 KHz bus rate, OK) actual clock rate after your change: 4 MHZ (so 500 KHz bus rate, BAD)

Quoted 6 lines

desired bus rate: 80 KHz (Toshiba AC100's nvec/I2C slave driver) desired clock rate: 640 KHz
actual clock rate before your change: ~632 KHz (so ~79 KHz bus rate, OK) actual clock rate after your change: ~706 KHz (so ~88 KHz bus rate, BAD)

Can this be fixed?

Fixed in latest patches.

Quoted 32 lines

Second, the Toshiba AC100 uses an alternative driver for the I2C HW, since it operates in I2C slave mode. So, the DT node for that driver needs to include the clocks properties so the driver can get the clocks through DT:

arch/arm/boot/dts/tegra20-paz00.dts line 285

Quoted 13 lines
arch/arm/boot/dts/tegra20-paz00.dts +2 -0
index edef66c..6495425 100644
@@ -278,6 +278,8 @@
                 clock-frequency = <50000>;
                 request-gpios = <&gpio 170 0>; /* gpio PV2 */
                 slave-addr = <138>;
+               clocks = <&tegra_car 67>, <&tegra_car 124>;
+               clock-names = "div-clk", "fast-clk";
         };
 
         i2c at 7000d000 {

Your changes don't actually cause the driver to break though, since it abuses clk_get_sys() to retrieve clocks under a different driver name, which matches what the clock driver provides. However, I think you should also include the following patch at the end of your series to fix this up, so the clock looking happens through device tree:

Quoted 8 lines
drivers/staging/nvec/nvec.c +0 -0
index d8826ed..6d44076 100644
@@ -770,7 +770,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
                 return -ENODEV;
         }
 
Quoted 5 lines

drivers/staging/nvec/nvec.c static int tegra_nvec_probe(struct platform_device *pdev) · line 776

Quoted 5 lines
drivers/staging/nvec/nvec.c +1 -1
-       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
+       i2c_clk = clk_get(&pdev->dev, "div-clk");
         if (IS_ERR(i2c_clk)) {
                 dev_err(nvec->dev, "failed to get controller clock\n");
                 return -ENODEV;

Included in the latest patches sent.

Quoted 1 line

Thanks.

maintainer
#20 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 2 lines · On Friday 11 January 2013 13:40:03 Prashant Gaikwad wrote:
Quoted 1 line · Stephen Warren

On 01/09/2013 10:34 AM, Stephen Warren wrote:

...

Quoted 41 lines
Quoted 41 lines

Second, the Toshiba AC100 uses an alternative driver for the I2C HW, since it operates in I2C slave mode. So, the DT node for that driver needs to include the clocks properties so the driver can get the clocks

through DT:

Quoted 13 lines
(quoted diff) +0 -0

b/arch/arm/boot/dts/tegra20-paz00.dts index edef66c..6495425 100644

arch/arm/boot/dts/tegra20-paz00.dts +2 -0
@@ -278,6 +278,8 @@
 
                 clock-frequency = <50000>;
                 request-gpios = <&gpio 170 0>; /* gpio PV2 */
                 slave-addr = <138>;
 
+               clocks = <&tegra_car 67>, <&tegra_car 124>;
+               clock-names = "div-clk", "fast-clk";
 
Quoted 3 lines
         };
         
         i2c at 7000d000 {

Your changes don't actually cause the driver to break though, since it abuses clk_get_sys() to retrieve clocks under a different driver name, which matches what the clock driver provides. However, I think you should also include the following patch at the end of your series to fix

this up, so the clock looking happens through device tree:

Quoted 13 lines
drivers/staging/nvec/nvec.c +1 -1
index d8826ed..6d44076 100644
@@ -770,7 +770,7 @@ static int tegra_nvec_probe(struct platform_device
 *pdev)>> 
                 return -ENODEV;
 
         }
 
-       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
+       i2c_clk = clk_get(&pdev->dev, "div-clk");
 
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
         if (IS_ERR(i2c_clk)) {
         
                 dev_err(nvec->dev, "failed to get controller clock\n");
                 return -ENODEV;

Included in the latest patches sent.

em, not yet in V4. Maybe you can also adjust the TODO (2nd entry) file now that this issue is fixed.

Thanks for taking care of this.

Marc

#21 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 3 lines · Marc Dietrich
Quoted 2 lines · On Friday 11 January 2013 13:40:03 Prashant Gaikwad wrote:
Quoted 1 line · Stephen Warren

On 01/09/2013 10:34 AM, Stephen Warren wrote:

...

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

Your changes don't actually cause the driver to break though, since it abuses clk_get_sys() to retrieve clocks under a different driver name, which matches what the clock driver provides. However, I think you should also include the following patch at the end of your series to fix this up, so the clock looking happens through device tree:

Quoted 13 lines
drivers/staging/nvec/nvec.c +1 -1
index d8826ed..6d44076 100644
@@ -770,7 +770,7 @@ static int tegra_nvec_probe(struct platform_device
 *pdev)>> 
                 return -ENODEV;
 
         }
 
-       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
+       i2c_clk = clk_get(&pdev->dev, "div-clk");
 
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
         if (IS_ERR(i2c_clk)) {
         
                 dev_err(nvec->dev, "failed to get controller clock\n");
                 return -ENODEV;

Included in the latest patches sent.

em, not yet in V4.

It's in V2 of the other series Prashant posted which sits on top of the CCF rework series.

Quoted 2 lines

Maybe you can also adjust the TODO (2nd entry) file now that this issue is fixed.

I'll try to remember to repost an updated version of the patch which does that...

maintainer
#22 lore raw

v3 cover Migrate Tegra to common clock framework

Quoted 34 lines · On Friday 11 January 2013 11:23:56 Stephen Warren wrote:
Quoted 3 lines · Marc Dietrich
Quoted 2 lines · On Friday 11 January 2013 13:40:03 Prashant Gaikwad wrote:
Quoted 1 line · Stephen Warren

On 01/09/2013 10:34 AM, Stephen Warren wrote:

...

Quoted 28 lines
Quoted 27 lines
Quoted 17 lines

Your changes don't actually cause the driver to break though, since it abuses clk_get_sys() to retrieve clocks under a different driver name, which matches what the clock driver provides. However, I think you should also include the following patch at the end of your series to fix

this up, so the clock looking happens through device tree:

Quoted 11 lines
drivers/staging/nvec/nvec.c +0 -0
index d8826ed..6d44076 100644
@@ -770,7 +770,7 @@ static int tegra_nvec_probe(struct platform_device
 *pdev)>>
 
                 return -ENODEV;
 
         }
 
Quoted 8 lines
Quoted 8 lines
drivers/staging/nvec/nvec.c +1 -1
-       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
+       i2c_clk = clk_get(&pdev->dev, "div-clk");
         if (IS_ERR(i2c_clk)) {
         
                 dev_err(nvec->dev, "failed to get controller
                 clock\n");
                 return -ENODEV;

Included in the latest patches sent.

Quoted 4 lines
Quoted 1 line

em, not yet in V4.

It's in V2 of the other series Prashant posted which sits on top of the CCF rework series.

ahh, sorry - I didn't see it because of the changed subject line.

Quoted 5 lines
Quoted 2 lines

Maybe you can also adjust the TODO (2nd entry) file now that this issue is fixed.

I'll try to remember to repost an updated version of the patch which does that...

no need if it just adds this change. I'll need to update the file anyway soon.

Thanks

Marc

author maintainer
#23 lore raw

v3 cover Migrate Tegra to common clock framework

In reply to Stephen Warren
Quoted 31 lines · Stephen Warren
Quoted 30 lines · Prashant Gaikwad
Quoted 29 lines · Stephen Warren
Quoted 27 lines · Stephen Warren
Quoted 24 lines · Prashant Gaikwad
Quoted 23 lines · Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 8 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.

Quoted 8 lines

I think there are bugs here. I applied all your clock patches on top of
Tegra's for-next (see list below), and found that the following don't work on Springbank:

* HDMI display
* Audio playback
* WiFi

(BTW, I stopped Cc'ing linux-kernel@, but added linux-tegra@ instead...)

Prashant, some updated testing results based off the "dev/ccf" branch you sent me on our internal git server:

...

Quoted 1 line

I have updated the internal branch with all the above mentioned fixes.

...

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

The remaining item is the display issue on Tegra30, which I'll go look at now.

The USB3 clock, which isn't used by any drivers on Tegra30, and hence was disabled at boot, was set up incorrectly and ended up mapping to the disp1 clock, and hence turned off the display. The following fixes it:

Stephen, thanks for the fix!! I have included this and PLLE fix; updated internal branch.

Almost everything works great now.

Great!!

Quoted 2 lines

However, I don't see any fix for the PLLE issue in the code; if there is one it certainly doesn't work. Applying my previous hack makes it work.

There is some difference between Tegra20 and Tegra30 PLLE implementation. Fixed in latest patches sent.

Quoted 4 lines

FYI, the branch I tested with is at
git://nv-tegra.nvidia.com/user/swarren/linux-2.6 test-ccf-rework-2

It's rebased onto the latest Tegra for-next.