diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2012-10-28 07:49:53 -0400 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2012-11-09 05:37:17 -0500 |
commit | f2d1035e956052d29c83fe8f8da0d056af6d221a (patch) | |
tree | 1cb6769113f52ebf6e4457b6ec0adc38e7886e0b | |
parent | b8ebbaff03798180c4d9661105670e03276afe83 (diff) |
MIPS: BCM63XX: add and use a clock for PCIe
Add a PCIe clock and use that instead of directly touching the clock
control register. While at it, fail if there is no such clock.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Acked-by: Florian Fainelli <florian@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/4452
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r-- | arch/mips/bcm63xx/clk.c | 15 | ||||
-rw-r--r-- | arch/mips/pci/pci-bcm63xx.c | 15 |
2 files changed, 25 insertions, 5 deletions
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index dff79ab6005..89a5fb07786 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c | |||
@@ -253,6 +253,19 @@ static struct clk clk_ipsec = { | |||
253 | }; | 253 | }; |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * PCIe clock | ||
257 | */ | ||
258 | |||
259 | static void pcie_set(struct clk *clk, int enable) | ||
260 | { | ||
261 | bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); | ||
262 | } | ||
263 | |||
264 | static struct clk clk_pcie = { | ||
265 | .set = pcie_set, | ||
266 | }; | ||
267 | |||
268 | /* | ||
256 | * Internal peripheral clock | 269 | * Internal peripheral clock |
257 | */ | 270 | */ |
258 | static struct clk clk_periph = { | 271 | static struct clk clk_periph = { |
@@ -313,6 +326,8 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
313 | return &clk_pcm; | 326 | return &clk_pcm; |
314 | if (BCMCPU_IS_6368() && !strcmp(id, "ipsec")) | 327 | if (BCMCPU_IS_6368() && !strcmp(id, "ipsec")) |
315 | return &clk_ipsec; | 328 | return &clk_ipsec; |
329 | if (BCMCPU_IS_6328() && !strcmp(id, "pcie")) | ||
330 | return &clk_pcie; | ||
316 | return ERR_PTR(-ENOENT); | 331 | return ERR_PTR(-ENOENT); |
317 | } | 332 | } |
318 | 333 | ||
diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c index 8a48139d219..fa8c320936f 100644 --- a/arch/mips/pci/pci-bcm63xx.c +++ b/arch/mips/pci/pci-bcm63xx.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/clk.h> | ||
14 | #include <asm/bootinfo.h> | 15 | #include <asm/bootinfo.h> |
15 | 16 | ||
16 | #include "pci-bcm63xx.h" | 17 | #include "pci-bcm63xx.h" |
@@ -119,11 +120,6 @@ static void __init bcm63xx_reset_pcie(void) | |||
119 | { | 120 | { |
120 | u32 val; | 121 | u32 val; |
121 | 122 | ||
122 | /* enable clock */ | ||
123 | val = bcm_perf_readl(PERF_CKCTL_REG); | ||
124 | val |= CKCTL_6328_PCIE_EN; | ||
125 | bcm_perf_writel(val, PERF_CKCTL_REG); | ||
126 | |||
127 | /* enable SERDES */ | 123 | /* enable SERDES */ |
128 | val = bcm_misc_readl(MISC_SERDES_CTRL_REG); | 124 | val = bcm_misc_readl(MISC_SERDES_CTRL_REG); |
129 | val |= SERDES_PCIE_EN | SERDES_PCIE_EXD_EN; | 125 | val |= SERDES_PCIE_EN | SERDES_PCIE_EXD_EN; |
@@ -150,10 +146,19 @@ static void __init bcm63xx_reset_pcie(void) | |||
150 | mdelay(200); | 146 | mdelay(200); |
151 | } | 147 | } |
152 | 148 | ||
149 | static struct clk *pcie_clk; | ||
150 | |||
153 | static int __init bcm63xx_register_pcie(void) | 151 | static int __init bcm63xx_register_pcie(void) |
154 | { | 152 | { |
155 | u32 val; | 153 | u32 val; |
156 | 154 | ||
155 | /* enable clock */ | ||
156 | pcie_clk = clk_get(NULL, "pcie"); | ||
157 | if (IS_ERR_OR_NULL(pcie_clk)) | ||
158 | return -ENODEV; | ||
159 | |||
160 | clk_prepare_enable(pcie_clk); | ||
161 | |||
157 | bcm63xx_reset_pcie(); | 162 | bcm63xx_reset_pcie(); |
158 | 163 | ||
159 | /* configure the PCIe bridge */ | 164 | /* configure the PCIe bridge */ |