diff options
Diffstat (limited to 'arch/arm/mach-pxa')
| -rw-r--r-- | arch/arm/mach-pxa/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/clock.c | 124 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/corgi.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/poodle.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/spitz.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-pxa/tosa.c | 1 |
7 files changed, 127 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 32526a0a6f86..382644401a4d 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | # Common support (must be linked before board specific support) | 5 | # Common support (must be linked before board specific support) |
| 6 | obj-y += generic.o irq.o dma.o time.o | 6 | obj-y += clock.o generic.o irq.o dma.o time.o |
| 7 | obj-$(CONFIG_PXA25x) += pxa25x.o | 7 | obj-$(CONFIG_PXA25x) += pxa25x.o |
| 8 | obj-$(CONFIG_PXA27x) += pxa27x.o | 8 | obj-$(CONFIG_PXA27x) += pxa27x.o |
| 9 | 9 | ||
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c new file mode 100644 index 000000000000..8f7c90a0593b --- /dev/null +++ b/arch/arm/mach-pxa/clock.c | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-sa1100/clock.c | ||
| 3 | */ | ||
| 4 | #include <linux/module.h> | ||
| 5 | #include <linux/kernel.h> | ||
| 6 | #include <linux/list.h> | ||
| 7 | #include <linux/errno.h> | ||
| 8 | #include <linux/err.h> | ||
| 9 | #include <linux/string.h> | ||
| 10 | #include <linux/clk.h> | ||
| 11 | #include <linux/spinlock.h> | ||
| 12 | |||
| 13 | #include <asm/arch/pxa-regs.h> | ||
| 14 | #include <asm/hardware.h> | ||
| 15 | #include <asm/semaphore.h> | ||
| 16 | |||
| 17 | struct clk { | ||
| 18 | struct list_head node; | ||
| 19 | unsigned long rate; | ||
| 20 | struct module *owner; | ||
| 21 | const char *name; | ||
| 22 | unsigned int enabled; | ||
| 23 | void (*enable)(void); | ||
| 24 | void (*disable)(void); | ||
| 25 | }; | ||
| 26 | |||
| 27 | static LIST_HEAD(clocks); | ||
| 28 | static DECLARE_MUTEX(clocks_sem); | ||
| 29 | static DEFINE_SPINLOCK(clocks_lock); | ||
| 30 | |||
| 31 | struct clk *clk_get(struct device *dev, const char *id) | ||
| 32 | { | ||
| 33 | struct clk *p, *clk = ERR_PTR(-ENOENT); | ||
| 34 | |||
| 35 | down(&clocks_sem); | ||
| 36 | list_for_each_entry(p, &clocks, node) { | ||
| 37 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | ||
| 38 | clk = p; | ||
| 39 | break; | ||
| 40 | } | ||
| 41 | } | ||
| 42 | up(&clocks_sem); | ||
| 43 | |||
| 44 | return clk; | ||
| 45 | } | ||
| 46 | EXPORT_SYMBOL(clk_get); | ||
| 47 | |||
| 48 | void clk_put(struct clk *clk) | ||
| 49 | { | ||
| 50 | module_put(clk->owner); | ||
| 51 | } | ||
| 52 | EXPORT_SYMBOL(clk_put); | ||
| 53 | |||
| 54 | int clk_enable(struct clk *clk) | ||
| 55 | { | ||
| 56 | unsigned long flags; | ||
| 57 | |||
| 58 | spin_lock_irqsave(&clocks_lock, flags); | ||
| 59 | if (clk->enabled++ == 0) | ||
| 60 | clk->enable(); | ||
| 61 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
| 62 | return 0; | ||
| 63 | } | ||
| 64 | EXPORT_SYMBOL(clk_enable); | ||
| 65 | |||
| 66 | void clk_disable(struct clk *clk) | ||
| 67 | { | ||
| 68 | unsigned long flags; | ||
| 69 | |||
| 70 | WARN_ON(clk->enabled == 0); | ||
| 71 | |||
| 72 | spin_lock_irqsave(&clocks_lock, flags); | ||
| 73 | if (--clk->enabled == 0) | ||
| 74 | clk->disable(); | ||
| 75 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
| 76 | } | ||
| 77 | EXPORT_SYMBOL(clk_disable); | ||
| 78 | |||
| 79 | unsigned long clk_get_rate(struct clk *clk) | ||
| 80 | { | ||
| 81 | return clk->rate; | ||
| 82 | } | ||
| 83 | EXPORT_SYMBOL(clk_get_rate); | ||
| 84 | |||
| 85 | |||
| 86 | static void clk_gpio27_enable(void) | ||
| 87 | { | ||
| 88 | pxa_gpio_mode(GPIO11_3_6MHz_MD); | ||
| 89 | } | ||
| 90 | |||
| 91 | static void clk_gpio27_disable(void) | ||
| 92 | { | ||
| 93 | } | ||
| 94 | |||
| 95 | static struct clk clk_gpio27 = { | ||
| 96 | .name = "GPIO27_CLK", | ||
| 97 | .rate = 3686400, | ||
| 98 | .enable = clk_gpio27_enable, | ||
| 99 | .disable = clk_gpio27_disable, | ||
| 100 | }; | ||
| 101 | |||
| 102 | int clk_register(struct clk *clk) | ||
| 103 | { | ||
| 104 | down(&clocks_sem); | ||
| 105 | list_add(&clk->node, &clocks); | ||
| 106 | up(&clocks_sem); | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | EXPORT_SYMBOL(clk_register); | ||
| 110 | |||
| 111 | void clk_unregister(struct clk *clk) | ||
| 112 | { | ||
| 113 | down(&clocks_sem); | ||
| 114 | list_del(&clk->node); | ||
| 115 | up(&clocks_sem); | ||
| 116 | } | ||
| 117 | EXPORT_SYMBOL(clk_unregister); | ||
| 118 | |||
| 119 | static int __init clk_init(void) | ||
| 120 | { | ||
| 121 | clk_register(&clk_gpio27); | ||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | arch_initcall(clk_init); | ||
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 7ffd2de8f2f3..68923b1d2b62 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
| 33 | 33 | ||
| 34 | #include <asm/arch/pxa-regs.h> | 34 | #include <asm/arch/pxa-regs.h> |
| 35 | #include <asm/arch/irq.h> | ||
| 36 | #include <asm/arch/irda.h> | 35 | #include <asm/arch/irda.h> |
| 37 | #include <asm/arch/mmc.h> | 36 | #include <asm/arch/mmc.h> |
| 38 | #include <asm/arch/udc.h> | 37 | #include <asm/arch/udc.h> |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index d5bda60209ec..98356f810007 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
| @@ -157,14 +157,14 @@ static struct platform_device smc91x_device = { | |||
| 157 | .resource = smc91x_resources, | 157 | .resource = smc91x_resources, |
| 158 | }; | 158 | }; |
| 159 | 159 | ||
| 160 | static int mst_audio_startup(snd_pcm_substream_t *substream, void *priv) | 160 | static int mst_audio_startup(struct snd_pcm_substream *substream, void *priv) |
| 161 | { | 161 | { |
| 162 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 162 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 163 | MST_MSCWR2 &= ~MST_MSCWR2_AC97_SPKROFF; | 163 | MST_MSCWR2 &= ~MST_MSCWR2_AC97_SPKROFF; |
| 164 | return 0; | 164 | return 0; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static void mst_audio_shutdown(snd_pcm_substream_t *substream, void *priv) | 167 | static void mst_audio_shutdown(struct snd_pcm_substream *substream, void *priv) |
| 168 | { | 168 | { |
| 169 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 169 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 170 | MST_MSCWR2 |= MST_MSCWR2_AC97_SPKROFF; | 170 | MST_MSCWR2 |= MST_MSCWR2_AC97_SPKROFF; |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 911e6ff5a9bd..b45560a8f6c4 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
| 30 | 30 | ||
| 31 | #include <asm/arch/pxa-regs.h> | 31 | #include <asm/arch/pxa-regs.h> |
| 32 | #include <asm/arch/irq.h> | ||
| 33 | #include <asm/arch/mmc.h> | 32 | #include <asm/arch/mmc.h> |
| 34 | #include <asm/arch/udc.h> | 33 | #include <asm/arch/udc.h> |
| 35 | #include <asm/arch/irda.h> | 34 | #include <asm/arch/irda.h> |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index c094d99ebf56..30ec317bbb97 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <asm/mach/irq.h> | 33 | #include <asm/mach/irq.h> |
| 34 | 34 | ||
| 35 | #include <asm/arch/pxa-regs.h> | 35 | #include <asm/arch/pxa-regs.h> |
| 36 | #include <asm/arch/irq.h> | ||
| 37 | #include <asm/arch/irda.h> | 36 | #include <asm/arch/irda.h> |
| 38 | #include <asm/arch/mmc.h> | 37 | #include <asm/arch/mmc.h> |
| 39 | #include <asm/arch/ohci.h> | 38 | #include <asm/arch/ohci.h> |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index d168286ed470..66ec71756d0f 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <asm/mach/irq.h> | 34 | #include <asm/mach/irq.h> |
| 35 | 35 | ||
| 36 | #include <asm/arch/pxa-regs.h> | 36 | #include <asm/arch/pxa-regs.h> |
| 37 | #include <asm/arch/irq.h> | ||
| 38 | #include <asm/arch/tosa.h> | 37 | #include <asm/arch/tosa.h> |
| 39 | 38 | ||
| 40 | #include <asm/hardware/scoop.h> | 39 | #include <asm/hardware/scoop.h> |
