aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-05-06 06:14:17 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-06 15:17:20 -0400
commitaf7dc2281fd3cedc04cb51bcc0887cdaf65c3fcc (patch)
tree5bd51ed12452e283806827e1793415ba6011b757 /arch
parentdc6048c7f97beaf8c5bb97ed772f43330d04727a (diff)
ARM: 6104/1: nomadik-gpio: use clk API
Add clocks with appropriate names in platforms that use it, and use the clk API in nomadik-gpio. Acked-by: Alessandro Rubini <rubini@unipv.it> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-nomadik/clock.c10
-rw-r--r--arch/arm/mach-ux500/clock.c16
-rw-r--r--arch/arm/plat-nomadik/gpio.c20
3 files changed, 40 insertions, 6 deletions
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
index 7af78501778..60f5bee09f2 100644
--- a/arch/arm/mach-nomadik/clock.c
+++ b/arch/arm/mach-nomadik/clock.c
@@ -37,6 +37,12 @@ static struct clk clk_48 = {
37 .rate = 48 * 1000 * 1000, 37 .rate = 48 * 1000 * 1000,
38}; 38};
39 39
40/*
41 * Catch-all default clock to satisfy drivers using the clk API. We don't
42 * model the actual hardware clocks yet.
43 */
44static struct clk clk_default;
45
40#define CLK(_clk, dev) \ 46#define CLK(_clk, dev) \
41 { \ 47 { \
42 .clk = _clk, \ 48 .clk = _clk, \
@@ -46,6 +52,10 @@ static struct clk clk_48 = {
46static struct clk_lookup lookups[] = { 52static struct clk_lookup lookups[] = {
47 CLK(&clk_48, "uart0"), 53 CLK(&clk_48, "uart0"),
48 CLK(&clk_48, "uart1"), 54 CLK(&clk_48, "uart1"),
55 CLK(&clk_default, "gpio.0"),
56 CLK(&clk_default, "gpio.1"),
57 CLK(&clk_default, "gpio.2"),
58 CLK(&clk_default, "gpio.3"),
49}; 59};
50 60
51static int __init clk_init(void) 61static int __init clk_init(void)
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index c325dad1679..1b2c9890e8b 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -364,7 +364,8 @@ static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL);
364 364
365static struct clk_lookup u8500_common_clks[] = { 365static struct clk_lookup u8500_common_clks[] = {
366 /* Peripheral Cluster #1 */ 366 /* Peripheral Cluster #1 */
367 CLK(gpio0, "gpioblock0", NULL), 367 CLK(gpio0, "gpio.0", NULL),
368 CLK(gpio0, "gpio.1", NULL),
368 CLK(slimbus0, "slimbus0", NULL), 369 CLK(slimbus0, "slimbus0", NULL),
369 CLK(i2c2, "nmk-i2c.2", NULL), 370 CLK(i2c2, "nmk-i2c.2", NULL),
370 CLK(sdi0, "sdi0", NULL), 371 CLK(sdi0, "sdi0", NULL),
@@ -374,7 +375,10 @@ static struct clk_lookup u8500_common_clks[] = {
374 CLK(uart0, "uart0", NULL), 375 CLK(uart0, "uart0", NULL),
375 376
376 /* Peripheral Cluster #3 */ 377 /* Peripheral Cluster #3 */
377 CLK(gpio2, "gpioblock2", NULL), 378 CLK(gpio2, "gpio.2", NULL),
379 CLK(gpio2, "gpio.3", NULL),
380 CLK(gpio2, "gpio.4", NULL),
381 CLK(gpio2, "gpio.5", NULL),
378 CLK(sdi5, "sdi5", NULL), 382 CLK(sdi5, "sdi5", NULL),
379 CLK(uart2, "uart2", NULL), 383 CLK(uart2, "uart2", NULL),
380 CLK(ske, "ske", NULL), 384 CLK(ske, "ske", NULL),
@@ -383,7 +387,7 @@ static struct clk_lookup u8500_common_clks[] = {
383 CLK(fsmc, "fsmc", NULL), 387 CLK(fsmc, "fsmc", NULL),
384 388
385 /* Peripheral Cluster #5 */ 389 /* Peripheral Cluster #5 */
386 CLK(gpio3, "gpioblock3", NULL), 390 CLK(gpio3, "gpio.8", NULL),
387 391
388 /* Peripheral Cluster #6 */ 392 /* Peripheral Cluster #6 */
389 CLK(hash1, "hash1", NULL), 393 CLK(hash1, "hash1", NULL),
@@ -418,7 +422,8 @@ static struct clk_lookup u8500_ed_clks[] = {
418 CLK(msp1_ed, "msp1", NULL), 422 CLK(msp1_ed, "msp1", NULL),
419 423
420 /* Peripheral Cluster #2 */ 424 /* Peripheral Cluster #2 */
421 CLK(gpio1_ed, "gpioblock1", NULL), 425 CLK(gpio1_ed, "gpio.6", NULL),
426 CLK(gpio1_ed, "gpio.7", NULL),
422 CLK(ssitx_ed, "ssitx", NULL), 427 CLK(ssitx_ed, "ssitx", NULL),
423 CLK(ssirx_ed, "ssirx", NULL), 428 CLK(ssirx_ed, "ssirx", NULL),
424 CLK(spi0_ed, "spi0", NULL), 429 CLK(spi0_ed, "spi0", NULL),
@@ -458,7 +463,8 @@ static struct clk_lookup u8500_v1_clks[] = {
458 CLK(msp1_v1, "msp1", NULL), 463 CLK(msp1_v1, "msp1", NULL),
459 464
460 /* Peripheral Cluster #2 */ 465 /* Peripheral Cluster #2 */
461 CLK(gpio1_v1, "gpioblock1", NULL), 466 CLK(gpio1_v1, "gpio.6", NULL),
467 CLK(gpio1_v1, "gpio.7", NULL),
462 CLK(ssitx_v1, "ssitx", NULL), 468 CLK(ssitx_v1, "ssitx", NULL),
463 CLK(ssirx_v1, "ssirx", NULL), 469 CLK(ssirx_v1, "ssirx", NULL),
464 CLK(spi0_v1, "spi0", NULL), 470 CLK(spi0_v1, "spi0", NULL),
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index eac9c9a7fbf..d28900cfa54 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -15,6 +15,8 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/clk.h>
19#include <linux/err.h>
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19#include <linux/spinlock.h> 21#include <linux/spinlock.h>
20#include <linux/interrupt.h> 22#include <linux/interrupt.h>
@@ -35,6 +37,7 @@
35struct nmk_gpio_chip { 37struct nmk_gpio_chip {
36 struct gpio_chip chip; 38 struct gpio_chip chip;
37 void __iomem *addr; 39 void __iomem *addr;
40 struct clk *clk;
38 unsigned int parent_irq; 41 unsigned int parent_irq;
39 spinlock_t lock; 42 spinlock_t lock;
40 /* Keep track of configured edges */ 43 /* Keep track of configured edges */
@@ -310,6 +313,7 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
310 struct nmk_gpio_chip *nmk_chip; 313 struct nmk_gpio_chip *nmk_chip;
311 struct gpio_chip *chip; 314 struct gpio_chip *chip;
312 struct resource *res; 315 struct resource *res;
316 struct clk *clk;
313 int irq; 317 int irq;
314 int ret; 318 int ret;
315 319
@@ -334,15 +338,24 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
334 goto out; 338 goto out;
335 } 339 }
336 340
341 clk = clk_get(&dev->dev, NULL);
342 if (IS_ERR(clk)) {
343 ret = PTR_ERR(clk);
344 goto out_release;
345 }
346
347 clk_enable(clk);
348
337 nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); 349 nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL);
338 if (!nmk_chip) { 350 if (!nmk_chip) {
339 ret = -ENOMEM; 351 ret = -ENOMEM;
340 goto out_release; 352 goto out_clk;
341 } 353 }
342 /* 354 /*
343 * The virt address in nmk_chip->addr is in the nomadik register space, 355 * The virt address in nmk_chip->addr is in the nomadik register space,
344 * so we can simply convert the resource address, without remapping 356 * so we can simply convert the resource address, without remapping
345 */ 357 */
358 nmk_chip->clk = clk;
346 nmk_chip->addr = io_p2v(res->start); 359 nmk_chip->addr = io_p2v(res->start);
347 nmk_chip->chip = nmk_gpio_template; 360 nmk_chip->chip = nmk_gpio_template;
348 nmk_chip->parent_irq = irq; 361 nmk_chip->parent_irq = irq;
@@ -368,6 +381,9 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
368 381
369out_free: 382out_free:
370 kfree(nmk_chip); 383 kfree(nmk_chip);
384out_clk:
385 clk_disable(clk);
386 clk_put(clk);
371out_release: 387out_release:
372 release_mem_region(res->start, resource_size(res)); 388 release_mem_region(res->start, resource_size(res));
373out: 389out:
@@ -385,6 +401,8 @@ static int __exit nmk_gpio_remove(struct platform_device *dev)
385 401
386 nmk_chip = platform_get_drvdata(dev); 402 nmk_chip = platform_get_drvdata(dev);
387 gpiochip_remove(&nmk_chip->chip); 403 gpiochip_remove(&nmk_chip->chip);
404 clk_disable(nmk_chip->clk);
405 clk_put(nmk_chip->clk);
388 kfree(nmk_chip); 406 kfree(nmk_chip);
389 release_mem_region(res->start, resource_size(res)); 407 release_mem_region(res->start, resource_size(res));
390 return 0; 408 return 0;