diff options
Diffstat (limited to 'arch/arm/common/sa1111.c')
-rw-r--r-- | arch/arm/common/sa1111.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index 93352f6097c1..3f68db84e5e6 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <linux/clk.h> | ||
29 | 30 | ||
30 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
@@ -36,10 +37,6 @@ | |||
36 | 37 | ||
37 | #include <asm/hardware/sa1111.h> | 38 | #include <asm/hardware/sa1111.h> |
38 | 39 | ||
39 | #ifdef CONFIG_ARCH_PXA | ||
40 | #include <asm/arch/pxa-regs.h> | ||
41 | #endif | ||
42 | |||
43 | extern void __init sa1110_mb_enable(void); | 40 | extern void __init sa1110_mb_enable(void); |
44 | 41 | ||
45 | /* | 42 | /* |
@@ -51,6 +48,7 @@ extern void __init sa1110_mb_enable(void); | |||
51 | */ | 48 | */ |
52 | struct sa1111 { | 49 | struct sa1111 { |
53 | struct device *dev; | 50 | struct device *dev; |
51 | struct clk *clk; | ||
54 | unsigned long phys; | 52 | unsigned long phys; |
55 | int irq; | 53 | int irq; |
56 | spinlock_t lock; | 54 | spinlock_t lock; |
@@ -451,19 +449,7 @@ static void sa1111_wake(struct sa1111 *sachip) | |||
451 | 449 | ||
452 | spin_lock_irqsave(&sachip->lock, flags); | 450 | spin_lock_irqsave(&sachip->lock, flags); |
453 | 451 | ||
454 | #ifdef CONFIG_ARCH_SA1100 | 452 | clk_enable(sachip->clk); |
455 | /* | ||
456 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: | ||
457 | * (SA-1110 Developer's Manual, section 9.1.2.1) | ||
458 | */ | ||
459 | GAFR |= GPIO_32_768kHz; | ||
460 | GPDR |= GPIO_32_768kHz; | ||
461 | TUCR = TUCR_3_6864MHz; | ||
462 | #elif CONFIG_ARCH_PXA | ||
463 | pxa_gpio_mode(GPIO11_3_6MHz_MD); | ||
464 | #else | ||
465 | #error missing clock setup | ||
466 | #endif | ||
467 | 453 | ||
468 | /* | 454 | /* |
469 | * Turn VCO on, and disable PLL Bypass. | 455 | * Turn VCO on, and disable PLL Bypass. |
@@ -555,12 +541,11 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
555 | struct sa1111_dev *dev; | 541 | struct sa1111_dev *dev; |
556 | int ret; | 542 | int ret; |
557 | 543 | ||
558 | dev = kmalloc(sizeof(struct sa1111_dev), GFP_KERNEL); | 544 | dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL); |
559 | if (!dev) { | 545 | if (!dev) { |
560 | ret = -ENOMEM; | 546 | ret = -ENOMEM; |
561 | goto out; | 547 | goto out; |
562 | } | 548 | } |
563 | memset(dev, 0, sizeof(struct sa1111_dev)); | ||
564 | 549 | ||
565 | snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), | 550 | snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), |
566 | "%4.4lx", info->offset); | 551 | "%4.4lx", info->offset); |
@@ -635,11 +620,15 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
635 | unsigned int has_devs, val; | 620 | unsigned int has_devs, val; |
636 | int i, ret = -ENODEV; | 621 | int i, ret = -ENODEV; |
637 | 622 | ||
638 | sachip = kmalloc(sizeof(struct sa1111), GFP_KERNEL); | 623 | sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL); |
639 | if (!sachip) | 624 | if (!sachip) |
640 | return -ENOMEM; | 625 | return -ENOMEM; |
641 | 626 | ||
642 | memset(sachip, 0, sizeof(struct sa1111)); | 627 | sachip->clk = clk_get(me, "GPIO27_CLK"); |
628 | if (!sachip->clk) { | ||
629 | ret = PTR_ERR(sachip->clk); | ||
630 | goto err_free; | ||
631 | } | ||
643 | 632 | ||
644 | spin_lock_init(&sachip->lock); | 633 | spin_lock_init(&sachip->lock); |
645 | 634 | ||
@@ -656,7 +645,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
656 | sachip->base = ioremap(mem->start, PAGE_SIZE * 2); | 645 | sachip->base = ioremap(mem->start, PAGE_SIZE * 2); |
657 | if (!sachip->base) { | 646 | if (!sachip->base) { |
658 | ret = -ENOMEM; | 647 | ret = -ENOMEM; |
659 | goto out; | 648 | goto err_clkput; |
660 | } | 649 | } |
661 | 650 | ||
662 | /* | 651 | /* |
@@ -666,7 +655,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
666 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 655 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
667 | printk(KERN_DEBUG "SA1111 not detected: ID = %08lx\n", id); | 656 | printk(KERN_DEBUG "SA1111 not detected: ID = %08lx\n", id); |
668 | ret = -ENODEV; | 657 | ret = -ENODEV; |
669 | goto unmap; | 658 | goto err_unmap; |
670 | } | 659 | } |
671 | 660 | ||
672 | printk(KERN_INFO "SA1111 Microprocessor Companion Chip: " | 661 | printk(KERN_INFO "SA1111 Microprocessor Companion Chip: " |
@@ -726,9 +715,11 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
726 | 715 | ||
727 | return 0; | 716 | return 0; |
728 | 717 | ||
729 | unmap: | 718 | err_unmap: |
730 | iounmap(sachip->base); | 719 | iounmap(sachip->base); |
731 | out: | 720 | err_clkput: |
721 | clk_put(sachip->clk); | ||
722 | err_free: | ||
732 | kfree(sachip); | 723 | kfree(sachip); |
733 | return ret; | 724 | return ret; |
734 | } | 725 | } |
@@ -751,6 +742,8 @@ static void __sa1111_remove(struct sa1111 *sachip) | |||
751 | sa1111_writel(0, irqbase + SA1111_WAKEEN0); | 742 | sa1111_writel(0, irqbase + SA1111_WAKEEN0); |
752 | sa1111_writel(0, irqbase + SA1111_WAKEEN1); | 743 | sa1111_writel(0, irqbase + SA1111_WAKEEN1); |
753 | 744 | ||
745 | clk_disable(sachip->clk); | ||
746 | |||
754 | if (sachip->irq != NO_IRQ) { | 747 | if (sachip->irq != NO_IRQ) { |
755 | set_irq_chained_handler(sachip->irq, NULL); | 748 | set_irq_chained_handler(sachip->irq, NULL); |
756 | set_irq_data(sachip->irq, NULL); | 749 | set_irq_data(sachip->irq, NULL); |
@@ -759,6 +752,7 @@ static void __sa1111_remove(struct sa1111 *sachip) | |||
759 | } | 752 | } |
760 | 753 | ||
761 | iounmap(sachip->base); | 754 | iounmap(sachip->base); |
755 | clk_put(sachip->clk); | ||
762 | kfree(sachip); | 756 | kfree(sachip); |
763 | } | 757 | } |
764 | 758 | ||
@@ -857,6 +851,8 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | |||
857 | sa1111_writel(0, sachip->base + SA1111_SKPWM0); | 851 | sa1111_writel(0, sachip->base + SA1111_SKPWM0); |
858 | sa1111_writel(0, sachip->base + SA1111_SKPWM1); | 852 | sa1111_writel(0, sachip->base + SA1111_SKPWM1); |
859 | 853 | ||
854 | clk_disable(sachip->clk); | ||
855 | |||
860 | spin_unlock_irqrestore(&sachip->lock, flags); | 856 | spin_unlock_irqrestore(&sachip->lock, flags); |
861 | 857 | ||
862 | return 0; | 858 | return 0; |