aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPrashant Gaikwad <pgaikwad@nvidia.com>2013-01-11 02:46:26 -0500
committerStephen Warren <swarren@nvidia.com>2013-01-28 13:19:07 -0500
commit61fd290d213e25d5a119b8ca25644001ed9f8f2d (patch)
tree16d8d1da34b5970985145c14cd6b8a624486abba /drivers
parentb08e8c0ecc42afa3a2e1019851af741980dd5a6b (diff)
ARM: tegra: migrate to new clock code
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 Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com> [swarren: use to_clk_periph_gate().] Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/tegra/clk-periph.c38
-rw-r--r--drivers/clk/tegra/clk.c16
-rw-r--r--drivers/dma/tegra20-apb-dma.c2
-rw-r--r--drivers/gpu/drm/tegra/dc.c3
-rw-r--r--drivers/gpu/drm/tegra/drm.c1
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c3
-rw-r--r--drivers/i2c/busses/i2c-tegra.c3
-rw-r--r--drivers/input/keyboard/tegra-kbc.c2
-rw-r--r--drivers/spi/spi-tegra20-sflash.c2
-rw-r--r--drivers/spi/spi-tegra20-slink.c2
-rw-r--r--drivers/staging/nvec/nvec.c3
11 files changed, 62 insertions, 13 deletions
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 5978e81b175b..788486e6331a 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -110,6 +110,44 @@ static void clk_periph_disable(struct clk_hw *hw)
110 gate_ops->disable(gate_hw); 110 gate_ops->disable(gate_hw);
111} 111}
112 112
113void tegra_periph_reset_deassert(struct clk *c)
114{
115 struct clk_hw *hw = __clk_get_hw(c);
116 struct tegra_clk_periph *periph = to_clk_periph(hw);
117 struct tegra_clk_periph_gate *gate;
118
119 if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
120 gate = to_clk_periph_gate(hw);
121 if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
122 WARN_ON(1);
123 return;
124 }
125 } else {
126 gate = &periph->gate;
127 }
128
129 tegra_periph_reset(gate, 0);
130}
131
132void tegra_periph_reset_assert(struct clk *c)
133{
134 struct clk_hw *hw = __clk_get_hw(c);
135 struct tegra_clk_periph *periph = to_clk_periph(hw);
136 struct tegra_clk_periph_gate *gate;
137
138 if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
139 gate = to_clk_periph_gate(hw);
140 if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
141 WARN_ON(1);
142 return;
143 }
144 } else {
145 gate = &periph->gate;
146 }
147
148 tegra_periph_reset(gate, 1);
149}
150
113const struct clk_ops tegra_clk_periph_ops = { 151const struct clk_ops tegra_clk_periph_ops = {
114 .get_parent = clk_periph_get_parent, 152 .get_parent = clk_periph_get_parent,
115 .set_parent = clk_periph_set_parent, 153 .set_parent = clk_periph_set_parent,
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index cf023a937208..a603b9af0ad3 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -16,9 +16,14 @@
16 16
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
19#include <linux/of.h>
20#include <linux/clk/tegra.h>
19 21
20#include "clk.h" 22#include "clk.h"
21 23
24/* Global data of Tegra CPU CAR ops */
25struct tegra_cpu_car_ops *tegra_cpu_car_ops;
26
22void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, 27void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
23 struct clk *clks[], int clk_max) 28 struct clk *clks[], int clk_max)
24{ 29{
@@ -67,3 +72,14 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl,
67 } 72 }
68 } 73 }
69} 74}
75
76static const struct of_device_id tegra_dt_clk_match[] = {
77 { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init },
78 { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init },
79 { }
80};
81
82void __init tegra_clocks_init(void)
83{
84 of_clk_init(tegra_dt_clk_match);
85}
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index c39e61bc8172..afc9b89e20f4 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -31,8 +31,8 @@
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/pm_runtime.h> 32#include <linux/pm_runtime.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/clk/tegra.h>
34 35
35#include <mach/clk.h>
36#include "dmaengine.h" 36#include "dmaengine.h"
37 37
38#define TEGRA_APBDMA_GENERAL 0x0 38#define TEGRA_APBDMA_GENERAL 0x0
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 656b2e3334a6..56813f967c8f 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -12,8 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/of.h> 13#include <linux/of.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15#include <linux/clk/tegra.h>
16#include <mach/clk.h>
17 16
18#include "drm.h" 17#include "drm.h"
19#include "dc.h" 18#include "dc.h"
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 3a503c9e4686..d980dc75788c 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -11,7 +11,6 @@
11#include <linux/of_address.h> 11#include <linux/of_address.h>
12#include <linux/of_platform.h> 12#include <linux/of_platform.h>
13 13
14#include <mach/clk.h>
15#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
16#include <asm/dma-iommu.h> 15#include <asm/dma-iommu.h>
17 16
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index e060c7e6434d..92ad276cc5e0 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -14,8 +14,7 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/regulator/consumer.h> 16#include <linux/regulator/consumer.h>
17 17#include <linux/clk/tegra.h>
18#include <mach/clk.h>
19 18
20#include "hdmi.h" 19#include "hdmi.h"
21#include "drm.h" 20#include "drm.h"
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 7b38877ffec1..c7aca35e38fd 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -29,11 +29,10 @@
29#include <linux/of_i2c.h> 29#include <linux/of_i2c.h>
30#include <linux/of_device.h> 30#include <linux/of_device.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/clk/tegra.h>
32 33
33#include <asm/unaligned.h> 34#include <asm/unaligned.h>
34 35
35#include <mach/clk.h>
36
37#define TEGRA_I2C_TIMEOUT (msecs_to_jiffies(1000)) 36#define TEGRA_I2C_TIMEOUT (msecs_to_jiffies(1000))
38#define BYTES_PER_FIFO_WORD 4 37#define BYTES_PER_FIFO_WORD 4
39 38
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index c76f96872d31..54ac1dc7d477 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -30,7 +30,7 @@
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/input/tegra_kbc.h> 32#include <linux/input/tegra_kbc.h>
33#include <mach/clk.h> 33#include <linux/clk/tegra.h>
34 34
35#define KBC_MAX_DEBOUNCE_CNT 0x3ffu 35#define KBC_MAX_DEBOUNCE_CNT 0x3ffu
36 36
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 448a8cc71df3..02feaa51a0fa 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -34,7 +34,7 @@
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/spi-tegra.h> 36#include <linux/spi/spi-tegra.h>
37#include <mach/clk.h> 37#include <linux/clk/tegra.h>
38 38
39#define SPI_COMMAND 0x000 39#define SPI_COMMAND 0x000
40#define SPI_GO BIT(30) 40#define SPI_GO BIT(30)
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 651167f2e0af..fa208a5cc612 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -35,7 +35,7 @@
35#include <linux/of_device.h> 35#include <linux/of_device.h>
36#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
37#include <linux/spi/spi-tegra.h> 37#include <linux/spi/spi-tegra.h>
38#include <mach/clk.h> 38#include <linux/clk/tegra.h>
39 39
40#define SLINK_COMMAND 0x000 40#define SLINK_COMMAND 0x000
41#define SLINK_BIT_LENGTH(x) (((x) & 0x1f) << 0) 41#define SLINK_BIT_LENGTH(x) (((x) & 0x1f) << 0)
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 2830946860d1..d51615b19797 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -37,8 +37,7 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40 40#include <linux/clk/tegra.h>
41#include <mach/clk.h>
42 41
43#include "nvec.h" 42#include "nvec.h"
44 43