diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-09-20 04:50:03 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-09-20 13:31:58 -0400 |
commit | 3c0227d262a5835849c68eb8328db016caad6085 (patch) | |
tree | 1a578a1965bd432a56542cc3d0500f3364395546 /drivers/gpio/gpio-nomadik.c | |
parent | b6fd41e29dea9c6753b1843a77e50433e6123bcb (diff) |
gpio/nomadik: disable clocks when unused
The GPIO clock is required for register access and interrupt detection.
When interrupt detection is not required on any of the pin in a block,
the block's clock can be disabled when the registers are not being
accessed.
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Rickard Andersson <rickard.andersson@stericsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com>
[Adjust for new IRQ chip core code, use only local functions]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/gpio/gpio-nomadik.c')
-rw-r--r-- | drivers/gpio/gpio-nomadik.c | 120 |
1 files changed, 113 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 2c212c732d76..97e9be94141b 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c | |||
@@ -276,6 +276,8 @@ static void nmk_gpio_glitch_slpm_init(unsigned int *slpm) | |||
276 | if (!chip) | 276 | if (!chip) |
277 | break; | 277 | break; |
278 | 278 | ||
279 | clk_enable(chip->clk); | ||
280 | |||
279 | slpm[i] = readl(chip->addr + NMK_GPIO_SLPC); | 281 | slpm[i] = readl(chip->addr + NMK_GPIO_SLPC); |
280 | writel(temp, chip->addr + NMK_GPIO_SLPC); | 282 | writel(temp, chip->addr + NMK_GPIO_SLPC); |
281 | } | 283 | } |
@@ -292,6 +294,8 @@ static void nmk_gpio_glitch_slpm_restore(unsigned int *slpm) | |||
292 | break; | 294 | break; |
293 | 295 | ||
294 | writel(slpm[i], chip->addr + NMK_GPIO_SLPC); | 296 | writel(slpm[i], chip->addr + NMK_GPIO_SLPC); |
297 | |||
298 | clk_disable(chip->clk); | ||
295 | } | 299 | } |
296 | } | 300 | } |
297 | 301 | ||
@@ -336,10 +340,12 @@ static int __nmk_config_pins(pin_cfg_t *cfgs, int num, bool sleep) | |||
336 | break; | 340 | break; |
337 | } | 341 | } |
338 | 342 | ||
343 | clk_enable(nmk_chip->clk); | ||
339 | spin_lock(&nmk_chip->lock); | 344 | spin_lock(&nmk_chip->lock); |
340 | __nmk_config_pin(nmk_chip, pin - nmk_chip->chip.base, | 345 | __nmk_config_pin(nmk_chip, pin - nmk_chip->chip.base, |
341 | cfgs[i], sleep, glitch ? slpm : NULL); | 346 | cfgs[i], sleep, glitch ? slpm : NULL); |
342 | spin_unlock(&nmk_chip->lock); | 347 | spin_unlock(&nmk_chip->lock); |
348 | clk_disable(nmk_chip->clk); | ||
343 | } | 349 | } |
344 | 350 | ||
345 | if (glitch) | 351 | if (glitch) |
@@ -424,6 +430,7 @@ int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) | |||
424 | if (!nmk_chip) | 430 | if (!nmk_chip) |
425 | return -EINVAL; | 431 | return -EINVAL; |
426 | 432 | ||
433 | clk_enable(nmk_chip->clk); | ||
427 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); | 434 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); |
428 | spin_lock(&nmk_chip->lock); | 435 | spin_lock(&nmk_chip->lock); |
429 | 436 | ||
@@ -431,6 +438,7 @@ int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) | |||
431 | 438 | ||
432 | spin_unlock(&nmk_chip->lock); | 439 | spin_unlock(&nmk_chip->lock); |
433 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); | 440 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); |
441 | clk_disable(nmk_chip->clk); | ||
434 | 442 | ||
435 | return 0; | 443 | return 0; |
436 | } | 444 | } |
@@ -457,9 +465,11 @@ int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull) | |||
457 | if (!nmk_chip) | 465 | if (!nmk_chip) |
458 | return -EINVAL; | 466 | return -EINVAL; |
459 | 467 | ||
468 | clk_enable(nmk_chip->clk); | ||
460 | spin_lock_irqsave(&nmk_chip->lock, flags); | 469 | spin_lock_irqsave(&nmk_chip->lock, flags); |
461 | __nmk_gpio_set_pull(nmk_chip, gpio - nmk_chip->chip.base, pull); | 470 | __nmk_gpio_set_pull(nmk_chip, gpio - nmk_chip->chip.base, pull); |
462 | spin_unlock_irqrestore(&nmk_chip->lock, flags); | 471 | spin_unlock_irqrestore(&nmk_chip->lock, flags); |
472 | clk_disable(nmk_chip->clk); | ||
463 | 473 | ||
464 | return 0; | 474 | return 0; |
465 | } | 475 | } |
@@ -483,9 +493,11 @@ int nmk_gpio_set_mode(int gpio, int gpio_mode) | |||
483 | if (!nmk_chip) | 493 | if (!nmk_chip) |
484 | return -EINVAL; | 494 | return -EINVAL; |
485 | 495 | ||
496 | clk_enable(nmk_chip->clk); | ||
486 | spin_lock_irqsave(&nmk_chip->lock, flags); | 497 | spin_lock_irqsave(&nmk_chip->lock, flags); |
487 | __nmk_gpio_set_mode(nmk_chip, gpio - nmk_chip->chip.base, gpio_mode); | 498 | __nmk_gpio_set_mode(nmk_chip, gpio - nmk_chip->chip.base, gpio_mode); |
488 | spin_unlock_irqrestore(&nmk_chip->lock, flags); | 499 | spin_unlock_irqrestore(&nmk_chip->lock, flags); |
500 | clk_disable(nmk_chip->clk); | ||
489 | 501 | ||
490 | return 0; | 502 | return 0; |
491 | } | 503 | } |
@@ -502,9 +514,13 @@ int nmk_gpio_get_mode(int gpio) | |||
502 | 514 | ||
503 | bit = 1 << (gpio - nmk_chip->chip.base); | 515 | bit = 1 << (gpio - nmk_chip->chip.base); |
504 | 516 | ||
517 | clk_enable(nmk_chip->clk); | ||
518 | |||
505 | afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & bit; | 519 | afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & bit; |
506 | bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & bit; | 520 | bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & bit; |
507 | 521 | ||
522 | clk_disable(nmk_chip->clk); | ||
523 | |||
508 | return (afunc ? NMK_GPIO_ALT_A : 0) | (bfunc ? NMK_GPIO_ALT_B : 0); | 524 | return (afunc ? NMK_GPIO_ALT_A : 0) | (bfunc ? NMK_GPIO_ALT_B : 0); |
509 | } | 525 | } |
510 | EXPORT_SYMBOL(nmk_gpio_get_mode); | 526 | EXPORT_SYMBOL(nmk_gpio_get_mode); |
@@ -525,7 +541,10 @@ static void nmk_gpio_irq_ack(struct irq_data *d) | |||
525 | nmk_chip = irq_data_get_irq_chip_data(d); | 541 | nmk_chip = irq_data_get_irq_chip_data(d); |
526 | if (!nmk_chip) | 542 | if (!nmk_chip) |
527 | return; | 543 | return; |
544 | |||
545 | clk_enable(nmk_chip->clk); | ||
528 | writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC); | 546 | writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC); |
547 | clk_disable(nmk_chip->clk); | ||
529 | } | 548 | } |
530 | 549 | ||
531 | enum nmk_gpio_irq_type { | 550 | enum nmk_gpio_irq_type { |
@@ -591,6 +610,7 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable) | |||
591 | else | 610 | else |
592 | nmk_chip->enabled &= ~bitmask; | 611 | nmk_chip->enabled &= ~bitmask; |
593 | 612 | ||
613 | clk_enable(nmk_chip->clk); | ||
594 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); | 614 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); |
595 | spin_lock(&nmk_chip->lock); | 615 | spin_lock(&nmk_chip->lock); |
596 | 616 | ||
@@ -601,6 +621,7 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable) | |||
601 | 621 | ||
602 | spin_unlock(&nmk_chip->lock); | 622 | spin_unlock(&nmk_chip->lock); |
603 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); | 623 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); |
624 | clk_disable(nmk_chip->clk); | ||
604 | 625 | ||
605 | return 0; | 626 | return 0; |
606 | } | 627 | } |
@@ -628,6 +649,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | |||
628 | return -EINVAL; | 649 | return -EINVAL; |
629 | bitmask = nmk_gpio_get_bitmask(gpio); | 650 | bitmask = nmk_gpio_get_bitmask(gpio); |
630 | 651 | ||
652 | clk_enable(nmk_chip->clk); | ||
631 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); | 653 | spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); |
632 | spin_lock(&nmk_chip->lock); | 654 | spin_lock(&nmk_chip->lock); |
633 | 655 | ||
@@ -641,13 +663,15 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | |||
641 | 663 | ||
642 | spin_unlock(&nmk_chip->lock); | 664 | spin_unlock(&nmk_chip->lock); |
643 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); | 665 | spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); |
666 | clk_disable(nmk_chip->clk); | ||
644 | 667 | ||
645 | return 0; | 668 | return 0; |
646 | } | 669 | } |
647 | 670 | ||
648 | static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) | 671 | static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
649 | { | 672 | { |
650 | bool enabled, wake = irqd_is_wakeup_set(d); | 673 | bool enabled; |
674 | bool wake = irqd_is_wakeup_set(d); | ||
651 | int gpio; | 675 | int gpio; |
652 | struct nmk_gpio_chip *nmk_chip; | 676 | struct nmk_gpio_chip *nmk_chip; |
653 | unsigned long flags; | 677 | unsigned long flags; |
@@ -664,10 +688,10 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
664 | if (type & IRQ_TYPE_LEVEL_LOW) | 688 | if (type & IRQ_TYPE_LEVEL_LOW) |
665 | return -EINVAL; | 689 | return -EINVAL; |
666 | 690 | ||
667 | enabled = nmk_chip->enabled & bitmask; | 691 | clk_enable(nmk_chip->clk); |
668 | |||
669 | spin_lock_irqsave(&nmk_chip->lock, flags); | 692 | spin_lock_irqsave(&nmk_chip->lock, flags); |
670 | 693 | ||
694 | enabled = !!(nmk_chip->enabled & bitmask); | ||
671 | if (enabled) | 695 | if (enabled) |
672 | __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false); | 696 | __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false); |
673 | 697 | ||
@@ -689,10 +713,28 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
689 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, true); | 713 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, true); |
690 | 714 | ||
691 | spin_unlock_irqrestore(&nmk_chip->lock, flags); | 715 | spin_unlock_irqrestore(&nmk_chip->lock, flags); |
716 | clk_disable(nmk_chip->clk); | ||
717 | |||
718 | return 0; | ||
719 | } | ||
720 | |||
721 | static unsigned int nmk_gpio_irq_startup(struct irq_data *d) | ||
722 | { | ||
723 | struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d); | ||
692 | 724 | ||
725 | clk_enable(nmk_chip->clk); | ||
726 | nmk_gpio_irq_unmask(d); | ||
693 | return 0; | 727 | return 0; |
694 | } | 728 | } |
695 | 729 | ||
730 | static void nmk_gpio_irq_shutdown(struct irq_data *d) | ||
731 | { | ||
732 | struct nmk_gpio_chip *nmk_chip = irq_data_get_irq_chip_data(d); | ||
733 | |||
734 | nmk_gpio_irq_mask(d); | ||
735 | clk_disable(nmk_chip->clk); | ||
736 | } | ||
737 | |||
696 | static struct irq_chip nmk_gpio_irq_chip = { | 738 | static struct irq_chip nmk_gpio_irq_chip = { |
697 | .name = "Nomadik-GPIO", | 739 | .name = "Nomadik-GPIO", |
698 | .irq_ack = nmk_gpio_irq_ack, | 740 | .irq_ack = nmk_gpio_irq_ack, |
@@ -700,6 +742,8 @@ static struct irq_chip nmk_gpio_irq_chip = { | |||
700 | .irq_unmask = nmk_gpio_irq_unmask, | 742 | .irq_unmask = nmk_gpio_irq_unmask, |
701 | .irq_set_type = nmk_gpio_irq_set_type, | 743 | .irq_set_type = nmk_gpio_irq_set_type, |
702 | .irq_set_wake = nmk_gpio_irq_set_wake, | 744 | .irq_set_wake = nmk_gpio_irq_set_wake, |
745 | .irq_startup = nmk_gpio_irq_startup, | ||
746 | .irq_shutdown = nmk_gpio_irq_shutdown, | ||
703 | }; | 747 | }; |
704 | 748 | ||
705 | static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc, | 749 | static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc, |
@@ -726,7 +770,11 @@ static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc, | |||
726 | static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | 770 | static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) |
727 | { | 771 | { |
728 | struct nmk_gpio_chip *nmk_chip = irq_get_handler_data(irq); | 772 | struct nmk_gpio_chip *nmk_chip = irq_get_handler_data(irq); |
729 | u32 status = readl(nmk_chip->addr + NMK_GPIO_IS); | 773 | u32 status; |
774 | |||
775 | clk_enable(nmk_chip->clk); | ||
776 | status = readl(nmk_chip->addr + NMK_GPIO_IS); | ||
777 | clk_disable(nmk_chip->clk); | ||
730 | 778 | ||
731 | __nmk_gpio_irq_handler(irq, desc, status); | 779 | __nmk_gpio_irq_handler(irq, desc, status); |
732 | } | 780 | } |
@@ -772,7 +820,12 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) | |||
772 | struct nmk_gpio_chip *nmk_chip = | 820 | struct nmk_gpio_chip *nmk_chip = |
773 | container_of(chip, struct nmk_gpio_chip, chip); | 821 | container_of(chip, struct nmk_gpio_chip, chip); |
774 | 822 | ||
823 | clk_enable(nmk_chip->clk); | ||
824 | |||
775 | writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRC); | 825 | writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRC); |
826 | |||
827 | clk_disable(nmk_chip->clk); | ||
828 | |||
776 | return 0; | 829 | return 0; |
777 | } | 830 | } |
778 | 831 | ||
@@ -781,8 +834,15 @@ static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) | |||
781 | struct nmk_gpio_chip *nmk_chip = | 834 | struct nmk_gpio_chip *nmk_chip = |
782 | container_of(chip, struct nmk_gpio_chip, chip); | 835 | container_of(chip, struct nmk_gpio_chip, chip); |
783 | u32 bit = 1 << offset; | 836 | u32 bit = 1 << offset; |
837 | int value; | ||
838 | |||
839 | clk_enable(nmk_chip->clk); | ||
840 | |||
841 | value = (readl(nmk_chip->addr + NMK_GPIO_DAT) & bit) != 0; | ||
784 | 842 | ||
785 | return (readl(nmk_chip->addr + NMK_GPIO_DAT) & bit) != 0; | 843 | clk_disable(nmk_chip->clk); |
844 | |||
845 | return value; | ||
786 | } | 846 | } |
787 | 847 | ||
788 | static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, | 848 | static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, |
@@ -791,7 +851,11 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, | |||
791 | struct nmk_gpio_chip *nmk_chip = | 851 | struct nmk_gpio_chip *nmk_chip = |
792 | container_of(chip, struct nmk_gpio_chip, chip); | 852 | container_of(chip, struct nmk_gpio_chip, chip); |
793 | 853 | ||
854 | clk_enable(nmk_chip->clk); | ||
855 | |||
794 | __nmk_gpio_set_output(nmk_chip, offset, val); | 856 | __nmk_gpio_set_output(nmk_chip, offset, val); |
857 | |||
858 | clk_disable(nmk_chip->clk); | ||
795 | } | 859 | } |
796 | 860 | ||
797 | static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, | 861 | static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, |
@@ -800,8 +864,12 @@ static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, | |||
800 | struct nmk_gpio_chip *nmk_chip = | 864 | struct nmk_gpio_chip *nmk_chip = |
801 | container_of(chip, struct nmk_gpio_chip, chip); | 865 | container_of(chip, struct nmk_gpio_chip, chip); |
802 | 866 | ||
867 | clk_enable(nmk_chip->clk); | ||
868 | |||
803 | __nmk_gpio_make_output(nmk_chip, offset, val); | 869 | __nmk_gpio_make_output(nmk_chip, offset, val); |
804 | 870 | ||
871 | clk_disable(nmk_chip->clk); | ||
872 | |||
805 | return 0; | 873 | return 0; |
806 | } | 874 | } |
807 | 875 | ||
@@ -832,6 +900,8 @@ static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
832 | [NMK_GPIO_ALT_C] = "altC", | 900 | [NMK_GPIO_ALT_C] = "altC", |
833 | }; | 901 | }; |
834 | 902 | ||
903 | clk_enable(nmk_chip->clk); | ||
904 | |||
835 | for (i = 0; i < chip->ngpio; i++, gpio++) { | 905 | for (i = 0; i < chip->ngpio; i++, gpio++) { |
836 | const char *label = gpiochip_is_requested(chip, i); | 906 | const char *label = gpiochip_is_requested(chip, i); |
837 | bool pull; | 907 | bool pull; |
@@ -876,6 +946,8 @@ static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
876 | 946 | ||
877 | seq_printf(s, "\n"); | 947 | seq_printf(s, "\n"); |
878 | } | 948 | } |
949 | |||
950 | clk_disable(nmk_chip->clk); | ||
879 | } | 951 | } |
880 | 952 | ||
881 | #else | 953 | #else |
@@ -893,6 +965,34 @@ static struct gpio_chip nmk_gpio_template = { | |||
893 | .can_sleep = 0, | 965 | .can_sleep = 0, |
894 | }; | 966 | }; |
895 | 967 | ||
968 | void nmk_gpio_clocks_enable(void) | ||
969 | { | ||
970 | int i; | ||
971 | |||
972 | for (i = 0; i < NUM_BANKS; i++) { | ||
973 | struct nmk_gpio_chip *chip = nmk_gpio_chips[i]; | ||
974 | |||
975 | if (!chip) | ||
976 | continue; | ||
977 | |||
978 | clk_enable(chip->clk); | ||
979 | } | ||
980 | } | ||
981 | |||
982 | void nmk_gpio_clocks_disable(void) | ||
983 | { | ||
984 | int i; | ||
985 | |||
986 | for (i = 0; i < NUM_BANKS; i++) { | ||
987 | struct nmk_gpio_chip *chip = nmk_gpio_chips[i]; | ||
988 | |||
989 | if (!chip) | ||
990 | continue; | ||
991 | |||
992 | clk_disable(chip->clk); | ||
993 | } | ||
994 | } | ||
995 | |||
896 | /* | 996 | /* |
897 | * Called from the suspend/resume path to only keep the real wakeup interrupts | 997 | * Called from the suspend/resume path to only keep the real wakeup interrupts |
898 | * (those that have had set_irq_wake() called on them) as wakeup interrupts, | 998 | * (those that have had set_irq_wake() called on them) as wakeup interrupts, |
@@ -912,6 +1012,8 @@ void nmk_gpio_wakeups_suspend(void) | |||
912 | if (!chip) | 1012 | if (!chip) |
913 | break; | 1013 | break; |
914 | 1014 | ||
1015 | clk_enable(chip->clk); | ||
1016 | |||
915 | chip->rwimsc = readl(chip->addr + NMK_GPIO_RWIMSC); | 1017 | chip->rwimsc = readl(chip->addr + NMK_GPIO_RWIMSC); |
916 | chip->fwimsc = readl(chip->addr + NMK_GPIO_FWIMSC); | 1018 | chip->fwimsc = readl(chip->addr + NMK_GPIO_FWIMSC); |
917 | 1019 | ||
@@ -926,6 +1028,8 @@ void nmk_gpio_wakeups_suspend(void) | |||
926 | /* 0 -> wakeup enable */ | 1028 | /* 0 -> wakeup enable */ |
927 | writel(~chip->real_wake, chip->addr + NMK_GPIO_SLPC); | 1029 | writel(~chip->real_wake, chip->addr + NMK_GPIO_SLPC); |
928 | } | 1030 | } |
1031 | |||
1032 | clk_disable(chip->clk); | ||
929 | } | 1033 | } |
930 | } | 1034 | } |
931 | 1035 | ||
@@ -939,11 +1043,15 @@ void nmk_gpio_wakeups_resume(void) | |||
939 | if (!chip) | 1043 | if (!chip) |
940 | break; | 1044 | break; |
941 | 1045 | ||
1046 | clk_enable(chip->clk); | ||
1047 | |||
942 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); | 1048 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); |
943 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); | 1049 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); |
944 | 1050 | ||
945 | if (chip->sleepmode) | 1051 | if (chip->sleepmode) |
946 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); | 1052 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); |
1053 | |||
1054 | clk_disable(chip->clk); | ||
947 | } | 1055 | } |
948 | } | 1056 | } |
949 | 1057 | ||
@@ -1010,8 +1118,6 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1010 | goto out_release; | 1118 | goto out_release; |
1011 | } | 1119 | } |
1012 | 1120 | ||
1013 | clk_enable(clk); | ||
1014 | |||
1015 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); | 1121 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); |
1016 | if (!nmk_chip) { | 1122 | if (!nmk_chip) { |
1017 | ret = -ENOMEM; | 1123 | ret = -ENOMEM; |