diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-03-15 10:54:37 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-03-21 17:05:53 -0500 |
commit | 97d654f8eb4b8fbb6e1afef076429a4235a3a3ad (patch) | |
tree | 2d289d4e07f15254254a873a15ccb443acebe7d9 /arch/arm/common/sa1111.c | |
parent | 824b5b5e59472c89bc508afa5c453547c91ed53b (diff) |
[ARM] Convert SA1111 to use clock architecture
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common/sa1111.c')
-rw-r--r-- | arch/arm/common/sa1111.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index 93352f6097c1..5ba1ee042349 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. |
@@ -641,6 +627,12 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
641 | 627 | ||
642 | memset(sachip, 0, sizeof(struct sa1111)); | 628 | memset(sachip, 0, sizeof(struct sa1111)); |
643 | 629 | ||
630 | sachip->clk = clk_get(me, "GPIO27_CLK"); | ||
631 | if (!sachip->clk) { | ||
632 | ret = PTR_ERR(sachip->clk); | ||
633 | goto err_free; | ||
634 | } | ||
635 | |||
644 | spin_lock_init(&sachip->lock); | 636 | spin_lock_init(&sachip->lock); |
645 | 637 | ||
646 | sachip->dev = me; | 638 | sachip->dev = me; |
@@ -656,7 +648,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
656 | sachip->base = ioremap(mem->start, PAGE_SIZE * 2); | 648 | sachip->base = ioremap(mem->start, PAGE_SIZE * 2); |
657 | if (!sachip->base) { | 649 | if (!sachip->base) { |
658 | ret = -ENOMEM; | 650 | ret = -ENOMEM; |
659 | goto out; | 651 | goto err_clkput; |
660 | } | 652 | } |
661 | 653 | ||
662 | /* | 654 | /* |
@@ -666,7 +658,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
666 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 658 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
667 | printk(KERN_DEBUG "SA1111 not detected: ID = %08lx\n", id); | 659 | printk(KERN_DEBUG "SA1111 not detected: ID = %08lx\n", id); |
668 | ret = -ENODEV; | 660 | ret = -ENODEV; |
669 | goto unmap; | 661 | goto err_unmap; |
670 | } | 662 | } |
671 | 663 | ||
672 | printk(KERN_INFO "SA1111 Microprocessor Companion Chip: " | 664 | printk(KERN_INFO "SA1111 Microprocessor Companion Chip: " |
@@ -726,9 +718,11 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
726 | 718 | ||
727 | return 0; | 719 | return 0; |
728 | 720 | ||
729 | unmap: | 721 | err_unmap: |
730 | iounmap(sachip->base); | 722 | iounmap(sachip->base); |
731 | out: | 723 | err_clkput: |
724 | clk_put(sachip->clk); | ||
725 | err_free: | ||
732 | kfree(sachip); | 726 | kfree(sachip); |
733 | return ret; | 727 | return ret; |
734 | } | 728 | } |
@@ -751,6 +745,8 @@ static void __sa1111_remove(struct sa1111 *sachip) | |||
751 | sa1111_writel(0, irqbase + SA1111_WAKEEN0); | 745 | sa1111_writel(0, irqbase + SA1111_WAKEEN0); |
752 | sa1111_writel(0, irqbase + SA1111_WAKEEN1); | 746 | sa1111_writel(0, irqbase + SA1111_WAKEEN1); |
753 | 747 | ||
748 | clk_disable(sachip->clk); | ||
749 | |||
754 | if (sachip->irq != NO_IRQ) { | 750 | if (sachip->irq != NO_IRQ) { |
755 | set_irq_chained_handler(sachip->irq, NULL); | 751 | set_irq_chained_handler(sachip->irq, NULL); |
756 | set_irq_data(sachip->irq, NULL); | 752 | set_irq_data(sachip->irq, NULL); |
@@ -759,6 +755,7 @@ static void __sa1111_remove(struct sa1111 *sachip) | |||
759 | } | 755 | } |
760 | 756 | ||
761 | iounmap(sachip->base); | 757 | iounmap(sachip->base); |
758 | clk_put(sachip->clk); | ||
762 | kfree(sachip); | 759 | kfree(sachip); |
763 | } | 760 | } |
764 | 761 | ||
@@ -857,6 +854,8 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | |||
857 | sa1111_writel(0, sachip->base + SA1111_SKPWM0); | 854 | sa1111_writel(0, sachip->base + SA1111_SKPWM0); |
858 | sa1111_writel(0, sachip->base + SA1111_SKPWM1); | 855 | sa1111_writel(0, sachip->base + SA1111_SKPWM1); |
859 | 856 | ||
857 | clk_disable(sachip->clk); | ||
858 | |||
860 | spin_unlock_irqrestore(&sachip->lock, flags); | 859 | spin_unlock_irqrestore(&sachip->lock, flags); |
861 | 860 | ||
862 | return 0; | 861 | return 0; |